import { Injectable } from '@angular/core'; import { SortDirection } from '@angular/material/sort'; import { Empty } from 'google-protobuf/google/protobuf/empty_pb'; import { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb'; import { BehaviorSubject } from 'rxjs'; import { AppQuery } from '../proto/generated/zitadel/app_pb'; import { KeyType } from '../proto/generated/zitadel/auth_n_key_pb'; import { ChangeQuery } from '../proto/generated/zitadel/change_pb'; import { IDPOwnerType } from '../proto/generated/zitadel/idp_pb'; import { ActionQuery, ActivateCustomLabelPolicyRequest, ActivateCustomLabelPolicyResponse, AddAPIAppRequest, AddAPIAppResponse, AddAppKeyRequest, AddAppKeyResponse, AddAppleProviderRequest, AddAppleProviderResponse, AddAzureADProviderRequest, AddAzureADProviderResponse, AddCustomLabelPolicyRequest, AddCustomLabelPolicyResponse, AddCustomLockoutPolicyRequest, AddCustomLockoutPolicyResponse, AddCustomLoginPolicyRequest, AddCustomLoginPolicyResponse, AddCustomNotificationPolicyRequest, AddCustomNotificationPolicyResponse, AddCustomPasswordAgePolicyRequest, AddCustomPasswordAgePolicyResponse, AddCustomPasswordComplexityPolicyRequest, AddCustomPasswordComplexityPolicyResponse, AddCustomPrivacyPolicyRequest, AddCustomPrivacyPolicyResponse, AddGenericOAuthProviderRequest, AddGenericOAuthProviderResponse, AddGenericOIDCProviderRequest, AddGenericOIDCProviderResponse, AddGitHubEnterpriseServerProviderRequest, AddGitHubEnterpriseServerProviderResponse, AddGitHubProviderRequest, AddGitHubProviderResponse, AddGitLabProviderRequest, AddGitLabProviderResponse, AddGitLabSelfHostedProviderRequest, AddGitLabSelfHostedProviderResponse, AddGoogleProviderRequest, AddGoogleProviderResponse, AddHumanUserRequest, AddHumanUserResponse, AddIDPToLoginPolicyRequest, AddIDPToLoginPolicyResponse, AddJWTProviderRequest, AddJWTProviderResponse, AddLDAPProviderRequest, AddLDAPProviderResponse, AddMachineKeyRequest, AddMachineKeyResponse, AddMachineUserRequest, AddMachineUserResponse, AddMultiFactorToLoginPolicyRequest, AddMultiFactorToLoginPolicyResponse, AddOIDCAppRequest, AddOIDCAppResponse, AddOrgDomainRequest, AddOrgDomainResponse, AddOrgMemberRequest, AddOrgMemberResponse, AddOrgRequest, AddOrgResponse, AddPersonalAccessTokenRequest, AddPersonalAccessTokenResponse, AddProjectGrantMemberRequest, AddProjectGrantMemberResponse, AddProjectGrantRequest, AddProjectGrantResponse, AddProjectMemberRequest, AddProjectMemberResponse, AddProjectRequest, AddProjectResponse, AddProjectRoleRequest, AddProjectRoleResponse, AddSAMLAppRequest, AddSAMLAppResponse, AddSAMLProviderRequest, AddSAMLProviderResponse, AddSecondFactorToLoginPolicyRequest, AddSecondFactorToLoginPolicyResponse, AddUserGrantRequest, AddUserGrantResponse, BulkAddProjectRolesRequest, BulkAddProjectRolesResponse, BulkRemoveUserGrantRequest, BulkRemoveUserGrantResponse, BulkSetUserMetadataRequest, BulkSetUserMetadataResponse, ClearFlowRequest, ClearFlowResponse, CreateActionRequest, CreateActionResponse, DeactivateActionRequest, DeactivateActionResponse, DeactivateAppRequest, DeactivateAppResponse, DeactivateOrgIDPRequest, DeactivateOrgIDPResponse, DeactivateOrgRequest, DeactivateOrgResponse, DeactivateProjectGrantRequest, DeactivateProjectGrantResponse, DeactivateProjectRequest, DeactivateProjectResponse, DeactivateUserRequest, DeactivateUserResponse, DeleteActionRequest, DeleteActionResponse, DeleteProviderRequest, DeleteProviderResponse, GenerateMachineSecretRequest, GenerateMachineSecretResponse, GenerateOrgDomainValidationRequest, GenerateOrgDomainValidationResponse, GetActionRequest, GetActionResponse, GetAppByIDRequest, GetAppByIDResponse, GetCustomDomainClaimedMessageTextRequest, GetCustomDomainClaimedMessageTextResponse, GetCustomInitMessageTextRequest, GetCustomInitMessageTextResponse, GetCustomLoginTextsRequest, GetCustomLoginTextsResponse, GetCustomPasswordChangeMessageTextRequest, GetCustomPasswordChangeMessageTextResponse, GetCustomPasswordlessRegistrationMessageTextRequest, GetCustomPasswordlessRegistrationMessageTextResponse, GetCustomPasswordResetMessageTextRequest, GetCustomPasswordResetMessageTextResponse, GetCustomVerifyEmailMessageTextRequest, GetCustomVerifyEmailMessageTextResponse, GetCustomVerifyEmailOTPMessageTextRequest, GetCustomVerifyEmailOTPMessageTextResponse, GetCustomVerifyPhoneMessageTextRequest, GetCustomVerifyPhoneMessageTextResponse, GetCustomVerifySMSOTPMessageTextRequest, GetCustomVerifySMSOTPMessageTextResponse, GetDefaultDomainClaimedMessageTextRequest, GetDefaultDomainClaimedMessageTextResponse, GetDefaultInitMessageTextRequest, GetDefaultInitMessageTextResponse, GetDefaultLabelPolicyRequest, GetDefaultLabelPolicyResponse, GetDefaultLoginTextsRequest, GetDefaultLoginTextsResponse, GetDefaultPasswordChangeMessageTextRequest, GetDefaultPasswordChangeMessageTextResponse, GetDefaultPasswordComplexityPolicyRequest, GetDefaultPasswordComplexityPolicyResponse, GetDefaultPasswordlessRegistrationMessageTextRequest, GetDefaultPasswordlessRegistrationMessageTextResponse, GetDefaultPasswordResetMessageTextRequest, GetDefaultPasswordResetMessageTextResponse, GetDefaultVerifyEmailMessageTextRequest, GetDefaultVerifyEmailMessageTextResponse, GetDefaultVerifyEmailOTPMessageTextRequest, GetDefaultVerifyEmailOTPMessageTextResponse, GetDefaultVerifyPhoneMessageTextRequest, GetDefaultVerifyPhoneMessageTextResponse, GetDefaultVerifySMSOTPMessageTextRequest, GetDefaultVerifySMSOTPMessageTextResponse, GetDomainPolicyRequest, GetDomainPolicyResponse, GetFlowRequest, GetFlowResponse, GetGrantedProjectByIDRequest, GetGrantedProjectByIDResponse, GetHumanEmailRequest, GetHumanEmailResponse, GetHumanPhoneRequest, GetHumanPhoneResponse, GetHumanProfileRequest, GetHumanProfileResponse, GetIAMRequest, GetIAMResponse, GetLabelPolicyRequest, GetLabelPolicyResponse, GetLockoutPolicyRequest, GetLockoutPolicyResponse, GetLoginPolicyRequest, GetLoginPolicyResponse, GetMyOrgRequest, GetMyOrgResponse, GetNotificationPolicyRequest, GetNotificationPolicyResponse, GetOIDCInformationRequest, GetOIDCInformationResponse, GetOrgByDomainGlobalRequest, GetOrgByDomainGlobalResponse, GetPasswordAgePolicyRequest, GetPasswordAgePolicyResponse, GetPasswordComplexityPolicyRequest, GetPasswordComplexityPolicyResponse, GetPreviewLabelPolicyRequest, GetPreviewLabelPolicyResponse, GetPrivacyPolicyRequest, GetPrivacyPolicyResponse, GetProjectByIDRequest, GetProjectByIDResponse, GetProjectGrantByIDRequest, GetProjectGrantByIDResponse, GetProviderByIDRequest, GetProviderByIDResponse, GetSupportedLanguagesRequest, GetSupportedLanguagesResponse, GetUserByIDRequest, GetUserByIDResponse, GetUserByLoginNameGlobalRequest, GetUserByLoginNameGlobalResponse, GetUserGrantByIDRequest, GetUserGrantByIDResponse, GetUserMetadataRequest, GetUserMetadataResponse, ListActionsRequest, ListActionsResponse, ListAppChangesRequest, ListAppChangesResponse, ListAppKeysRequest, ListAppKeysResponse, ListAppsRequest, ListAppsResponse, ListFlowTriggerTypesRequest, ListFlowTriggerTypesResponse, ListFlowTypesRequest, ListFlowTypesResponse, ListGrantedProjectRolesRequest, ListGrantedProjectRolesResponse, ListGrantedProjectsRequest, ListGrantedProjectsResponse, ListHumanAuthFactorsRequest, ListHumanAuthFactorsResponse, ListHumanLinkedIDPsRequest, ListHumanLinkedIDPsResponse, ListHumanPasswordlessRequest, ListHumanPasswordlessResponse, ListLoginPolicyIDPsRequest, ListLoginPolicyIDPsResponse, ListLoginPolicyMultiFactorsRequest, ListLoginPolicyMultiFactorsResponse, ListLoginPolicySecondFactorsResponse, ListMachineKeysRequest, ListMachineKeysResponse, ListOrgChangesRequest, ListOrgChangesResponse, ListOrgDomainsRequest, ListOrgDomainsResponse, ListOrgMemberRolesRequest, ListOrgMemberRolesResponse, ListOrgMembersRequest, ListOrgMembersResponse, ListOrgMetadataRequest, ListOrgMetadataResponse, ListPersonalAccessTokensRequest, ListPersonalAccessTokensResponse, ListProjectChangesRequest, ListProjectChangesResponse, ListProjectGrantChangesRequest, ListProjectGrantChangesResponse, ListProjectGrantMemberRolesRequest, ListProjectGrantMemberRolesResponse, ListProjectGrantMembersRequest, ListProjectGrantMembersResponse, ListProjectGrantsRequest, ListProjectGrantsResponse, ListProjectMemberRolesRequest, ListProjectMemberRolesResponse, ListProjectMembersRequest, ListProjectMembersResponse, ListProjectRolesRequest, ListProjectRolesResponse, ListProjectsRequest, ListProjectsResponse, ListProvidersRequest, ListProvidersResponse, ListUserChangesRequest, ListUserChangesResponse, ListUserGrantRequest, ListUserGrantResponse, ListUserMembershipsRequest, ListUserMembershipsResponse, ListUserMetadataRequest, ListUserMetadataResponse, ListUsersRequest, ListUsersResponse, ReactivateActionRequest, ReactivateActionResponse, ReactivateAppRequest, ReactivateAppResponse, ReactivateOrgIDPRequest, ReactivateOrgIDPResponse, ReactivateOrgRequest, ReactivateOrgResponse, ReactivateProjectGrantRequest, ReactivateProjectGrantResponse, ReactivateProjectRequest, ReactivateProjectResponse, ReactivateUserRequest, ReactivateUserResponse, RegenerateAPIClientSecretRequest, RegenerateAPIClientSecretResponse, RegenerateOIDCClientSecretRequest, RegenerateOIDCClientSecretResponse, RemoveAppKeyRequest, RemoveAppKeyResponse, RemoveAppRequest, RemoveAppResponse, RemoveCustomLabelPolicyFontRequest, RemoveCustomLabelPolicyFontResponse, RemoveCustomLabelPolicyIconDarkRequest, RemoveCustomLabelPolicyIconDarkResponse, RemoveCustomLabelPolicyIconRequest, RemoveCustomLabelPolicyIconResponse, RemoveCustomLabelPolicyLogoDarkRequest, RemoveCustomLabelPolicyLogoDarkResponse, RemoveCustomLabelPolicyLogoRequest, RemoveCustomLabelPolicyLogoResponse, RemoveHumanAuthFactorOTPEmailRequest, RemoveHumanAuthFactorOTPEmailResponse, RemoveHumanAuthFactorOTPRequest, RemoveHumanAuthFactorOTPResponse, RemoveHumanAuthFactorOTPSMSRequest, RemoveHumanAuthFactorOTPSMSResponse, RemoveHumanAuthFactorU2FRequest, RemoveHumanAuthFactorU2FResponse, RemoveHumanLinkedIDPRequest, RemoveHumanLinkedIDPResponse, RemoveHumanPasswordlessRequest, RemoveHumanPasswordlessResponse, RemoveHumanPhoneRequest, RemoveHumanPhoneResponse, RemoveIDPFromLoginPolicyRequest, RemoveIDPFromLoginPolicyResponse, RemoveMachineKeyRequest, RemoveMachineKeyResponse, RemoveMachineSecretRequest, RemoveMachineSecretResponse, RemoveMultiFactorFromLoginPolicyRequest, RemoveMultiFactorFromLoginPolicyResponse, RemoveOrgDomainRequest, RemoveOrgDomainResponse, RemoveOrgMemberRequest, RemoveOrgMemberResponse, RemoveOrgMetadataRequest, RemoveOrgMetadataResponse, RemoveOrgRequest, RemoveOrgResponse, RemovePersonalAccessTokenRequest, RemovePersonalAccessTokenResponse, RemoveProjectGrantMemberRequest, RemoveProjectGrantMemberResponse, RemoveProjectGrantRequest, RemoveProjectGrantResponse, RemoveProjectMemberRequest, RemoveProjectMemberResponse, RemoveProjectRequest, RemoveProjectResponse, RemoveProjectRoleRequest, RemoveProjectRoleResponse, RemoveSecondFactorFromLoginPolicyRequest, RemoveSecondFactorFromLoginPolicyResponse, RemoveUserGrantRequest, RemoveUserGrantResponse, RemoveUserMetadataRequest, RemoveUserMetadataResponse, RemoveUserRequest, RemoveUserResponse, ResendHumanEmailVerificationRequest, ResendHumanInitializationRequest, ResendHumanInitializationResponse, ResendHumanPhoneVerificationRequest, ResetCustomDomainClaimedMessageTextToDefaultRequest, ResetCustomDomainClaimedMessageTextToDefaultResponse, ResetCustomInitMessageTextToDefaultRequest, ResetCustomInitMessageTextToDefaultResponse, ResetCustomLoginTextsToDefaultRequest, ResetCustomLoginTextsToDefaultResponse, ResetCustomPasswordChangeMessageTextToDefaultRequest, ResetCustomPasswordChangeMessageTextToDefaultResponse, ResetCustomPasswordlessRegistrationMessageTextToDefaultRequest, ResetCustomPasswordlessRegistrationMessageTextToDefaultResponse, ResetCustomPasswordResetMessageTextToDefaultRequest, ResetCustomPasswordResetMessageTextToDefaultResponse, ResetCustomVerifyEmailMessageTextToDefaultRequest, ResetCustomVerifyEmailMessageTextToDefaultResponse, ResetCustomVerifyEmailOTPMessageTextToDefaultRequest, ResetCustomVerifyEmailOTPMessageTextToDefaultResponse, ResetCustomVerifyPhoneMessageTextToDefaultRequest, ResetCustomVerifyPhoneMessageTextToDefaultResponse, ResetCustomVerifySMSOTPMessageTextToDefaultRequest, ResetCustomVerifySMSOTPMessageTextToDefaultResponse, ResetLabelPolicyToDefaultRequest, ResetLabelPolicyToDefaultResponse, ResetLockoutPolicyToDefaultRequest, ResetLockoutPolicyToDefaultResponse, ResetLoginPolicyToDefaultRequest, ResetLoginPolicyToDefaultResponse, ResetNotificationPolicyToDefaultRequest, ResetNotificationPolicyToDefaultResponse, ResetPasswordAgePolicyToDefaultRequest, ResetPasswordAgePolicyToDefaultResponse, ResetPasswordComplexityPolicyToDefaultRequest, ResetPasswordComplexityPolicyToDefaultResponse, ResetPrivacyPolicyToDefaultRequest, ResetPrivacyPolicyToDefaultResponse, SendHumanResetPasswordNotificationRequest, SendPasswordlessRegistrationRequest, SendPasswordlessRegistrationResponse, SetCustomDomainClaimedMessageTextRequest, SetCustomDomainClaimedMessageTextResponse, SetCustomInitMessageTextRequest, SetCustomInitMessageTextResponse, SetCustomLoginTextsRequest, SetCustomLoginTextsResponse, SetCustomPasswordChangeMessageTextRequest, SetCustomPasswordChangeMessageTextResponse, SetCustomPasswordlessRegistrationMessageTextRequest, SetCustomPasswordlessRegistrationMessageTextResponse, SetCustomPasswordResetMessageTextRequest, SetCustomPasswordResetMessageTextResponse, SetCustomVerifyEmailMessageTextRequest, SetCustomVerifyEmailMessageTextResponse, SetCustomVerifyEmailOTPMessageTextRequest, SetCustomVerifyEmailOTPMessageTextResponse, SetCustomVerifyPhoneMessageTextRequest, SetCustomVerifyPhoneMessageTextResponse, SetCustomVerifySMSOTPMessageTextRequest, SetCustomVerifySMSOTPMessageTextResponse, SetHumanInitialPasswordRequest, SetOrgMetadataRequest, SetOrgMetadataResponse, SetPrimaryOrgDomainRequest, SetPrimaryOrgDomainResponse, SetTriggerActionsRequest, SetTriggerActionsResponse, SetUserMetadataRequest, SetUserMetadataResponse, UnlockUserRequest, UnlockUserResponse, UpdateActionRequest, UpdateActionResponse, UpdateAPIAppConfigRequest, UpdateAPIAppConfigResponse, UpdateAppleProviderRequest, UpdateAppleProviderResponse, UpdateAppRequest, UpdateAppResponse, UpdateAzureADProviderRequest, UpdateAzureADProviderResponse, UpdateCustomLabelPolicyRequest, UpdateCustomLabelPolicyResponse, UpdateCustomLockoutPolicyRequest, UpdateCustomLockoutPolicyResponse, UpdateCustomLoginPolicyRequest, UpdateCustomLoginPolicyResponse, UpdateCustomNotificationPolicyRequest, UpdateCustomNotificationPolicyResponse, UpdateCustomPasswordAgePolicyRequest, UpdateCustomPasswordAgePolicyResponse, UpdateCustomPasswordComplexityPolicyRequest, UpdateCustomPasswordComplexityPolicyResponse, UpdateCustomPrivacyPolicyRequest, UpdateCustomPrivacyPolicyResponse, UpdateGenericOAuthProviderRequest, UpdateGenericOAuthProviderResponse, UpdateGenericOIDCProviderRequest, UpdateGenericOIDCProviderResponse, UpdateGitHubEnterpriseServerProviderRequest, UpdateGitHubEnterpriseServerProviderResponse, UpdateGitHubProviderRequest, UpdateGitHubProviderResponse, UpdateGitLabProviderRequest, UpdateGitLabProviderResponse, UpdateGitLabSelfHostedProviderRequest, UpdateGitLabSelfHostedProviderResponse, UpdateGoogleProviderRequest, UpdateGoogleProviderResponse, UpdateHumanEmailRequest, UpdateHumanEmailResponse, UpdateHumanPhoneRequest, UpdateHumanPhoneResponse, UpdateHumanProfileRequest, UpdateHumanProfileResponse, UpdateJWTProviderRequest, UpdateJWTProviderResponse, UpdateLDAPProviderRequest, UpdateLDAPProviderResponse, UpdateMachineRequest, UpdateMachineResponse, UpdateOIDCAppConfigRequest, UpdateOIDCAppConfigResponse, UpdateOrgMemberRequest, UpdateOrgMemberResponse, UpdateOrgRequest, UpdateOrgResponse, UpdateProjectGrantMemberRequest, UpdateProjectGrantMemberResponse, UpdateProjectGrantRequest, UpdateProjectGrantResponse, UpdateProjectMemberRequest, UpdateProjectMemberResponse, UpdateProjectRequest, UpdateProjectResponse, UpdateProjectRoleRequest, UpdateProjectRoleResponse, UpdateSAMLAppConfigRequest, UpdateSAMLAppConfigResponse, UpdateSAMLProviderRequest, UpdateSAMLProviderResponse, UpdateUserGrantRequest, UpdateUserGrantResponse, UpdateUserNameRequest, UpdateUserNameResponse, ValidateOrgDomainRequest, ValidateOrgDomainResponse, } from '../proto/generated/zitadel/management_pb'; import { SearchQuery } from '../proto/generated/zitadel/member_pb'; import { MetadataQuery } from '../proto/generated/zitadel/metadata_pb'; import { ListQuery } from '../proto/generated/zitadel/object_pb'; import { DomainSearchQuery, DomainValidationType } from '../proto/generated/zitadel/org_pb'; import { PasswordComplexityPolicy } from '../proto/generated/zitadel/policy_pb'; import { GrantedProject, Project, ProjectQuery, RoleQuery } from '../proto/generated/zitadel/project_pb'; import { AccessTokenType, Gender, MembershipQuery, SearchQuery as UserSearchQuery, UserFieldName, UserGrantQuery, } from '../proto/generated/zitadel/user_pb'; import { GrpcService } from './grpc.service'; export type ResponseMapper = (resp: TResp) => TMappedResp; @Injectable({ providedIn: 'root', }) export class ManagementService { public ownedProjects: BehaviorSubject = new BehaviorSubject([]); public ownedProjectsCount: BehaviorSubject = new BehaviorSubject(0); public grantedProjects: BehaviorSubject = new BehaviorSubject([]); public grantedProjectsCount: BehaviorSubject = new BehaviorSubject(0); constructor(private readonly grpcService: GrpcService) {} public getDefaultLoginTexts(req: GetDefaultLoginTextsRequest): Promise { return this.grpcService.mgmt.getDefaultLoginTexts(req, null).then((resp) => resp.toObject()); } public getCustomLoginTexts(req: GetCustomLoginTextsRequest): Promise { return this.grpcService.mgmt.getCustomLoginTexts(req, null).then((resp) => resp.toObject()); } public setCustomLoginText(req: SetCustomLoginTextsRequest): Promise { return this.grpcService.mgmt.setCustomLoginText(req, null).then((resp) => resp.toObject()); } public resetCustomLoginTextToDefault(lang: string): Promise { const req = new ResetCustomLoginTextsToDefaultRequest(); req.setLanguage(lang); return this.grpcService.mgmt.resetCustomLoginTextToDefault(req, null).then((resp) => resp.toObject()); } // message texts public getDefaultInitMessageText( req: GetDefaultInitMessageTextRequest, ): Promise { return this.grpcService.mgmt.getDefaultInitMessageText(req, null).then((resp) => resp.toObject()); } public getCustomInitMessageText(req: GetCustomInitMessageTextRequest): Promise { return this.grpcService.mgmt.getCustomInitMessageText(req, null).then((resp) => resp.toObject()); } public setCustomInitMessageText(req: SetCustomInitMessageTextRequest): Promise { return this.grpcService.mgmt.setCustomInitMessageText(req, null).then((resp) => resp.toObject()); } public resetCustomInitMessageTextToDefault(lang: string): Promise { const req = new ResetCustomInitMessageTextToDefaultRequest(); req.setLanguage(lang); return this.grpcService.mgmt.resetCustomInitMessageTextToDefault(req, null).then((resp) => resp.toObject()); } public getDefaultVerifyEmailMessageText( req: GetDefaultVerifyEmailMessageTextRequest, ): Promise { return this.grpcService.mgmt.getDefaultVerifyEmailMessageText(req, null).then((resp) => resp.toObject()); } public getCustomVerifyEmailMessageText( req: GetCustomVerifyEmailMessageTextRequest, ): Promise { return this.grpcService.mgmt.getCustomVerifyEmailMessageText(req, null).then((resp) => resp.toObject()); } public setCustomVerifyEmailMessageText( req: SetCustomVerifyEmailMessageTextRequest, ): Promise { return this.grpcService.mgmt.setCustomVerifyEmailMessageText(req, null).then((resp) => resp.toObject()); } public resetCustomVerifyEmailMessageTextToDefault( lang: string, ): Promise { const req = new ResetCustomVerifyEmailMessageTextToDefaultRequest(); req.setLanguage(lang); return this.grpcService.mgmt.resetCustomVerifyEmailMessageTextToDefault(req, null).then((resp) => resp.toObject()); } public getDefaultVerifyPhoneMessageText( req: GetDefaultVerifyPhoneMessageTextRequest, ): Promise { return this.grpcService.mgmt.getDefaultVerifyPhoneMessageText(req, null).then((resp) => resp.toObject()); } public getCustomVerifyPhoneMessageText( req: GetCustomVerifyPhoneMessageTextRequest, ): Promise { return this.grpcService.mgmt.getCustomVerifyPhoneMessageText(req, null).then((resp) => resp.toObject()); } public setCustomVerifyPhoneMessageText( req: SetCustomVerifyPhoneMessageTextRequest, ): Promise { return this.grpcService.mgmt.setCustomVerifyPhoneMessageText(req, null).then((resp) => resp.toObject()); } public resetCustomVerifyPhoneMessageTextToDefault( lang: string, ): Promise { const req = new ResetCustomVerifyPhoneMessageTextToDefaultRequest(); req.setLanguage(lang); return this.grpcService.mgmt.resetCustomVerifyPhoneMessageTextToDefault(req, null).then((resp) => resp.toObject()); } public getDefaultVerifySMSOTPMessageText( req: GetDefaultVerifySMSOTPMessageTextRequest, ): Promise { return this.grpcService.mgmt.getDefaultVerifySMSOTPMessageText(req, null).then((resp) => resp.toObject()); } public getCustomVerifySMSOTPMessageText( req: GetCustomVerifySMSOTPMessageTextRequest, ): Promise { return this.grpcService.mgmt.getCustomVerifySMSOTPMessageText(req, null).then((resp) => resp.toObject()); } public setCustomVerifySMSOTPMessageText( req: SetCustomVerifySMSOTPMessageTextRequest, ): Promise { return this.grpcService.mgmt.setCustomVerifySMSOTPMessageText(req, null).then((resp) => resp.toObject()); } public resetCustomVerifySMSOTPMessageTextToDefault( lang: string, ): Promise { const req = new ResetCustomVerifySMSOTPMessageTextToDefaultRequest(); req.setLanguage(lang); return this.grpcService.mgmt.resetCustomVerifySMSOTPMessageTextToDefault(req, null).then((resp) => resp.toObject()); } public getDefaultVerifyEmailOTPMessageText( req: GetDefaultVerifyEmailOTPMessageTextRequest, ): Promise { return this.grpcService.mgmt.getDefaultVerifyEmailOTPMessageText(req, null).then((resp) => resp.toObject()); } public getCustomVerifyEmailOTPMessageText( req: GetCustomVerifyEmailOTPMessageTextRequest, ): Promise { return this.grpcService.mgmt.getCustomVerifyEmailOTPMessageText(req, null).then((resp) => resp.toObject()); } public setCustomVerifyEmailOTPMessageText( req: SetCustomVerifyEmailOTPMessageTextRequest, ): Promise { return this.grpcService.mgmt.setCustomVerifyEmailOTPMessageText(req, null).then((resp) => resp.toObject()); } public resetCustomVerifyEmailOTPMessageTextToDefault( lang: string, ): Promise { const req = new ResetCustomVerifyEmailOTPMessageTextToDefaultRequest(); req.setLanguage(lang); return this.grpcService.mgmt.resetCustomVerifyEmailOTPMessageTextToDefault(req, null).then((resp) => resp.toObject()); } public getDefaultPasswordResetMessageText( req: GetDefaultPasswordResetMessageTextRequest, ): Promise { return this.grpcService.mgmt.getDefaultPasswordResetMessageText(req, null).then((resp) => resp.toObject()); } public getCustomPasswordResetMessageText( req: GetCustomPasswordResetMessageTextRequest, ): Promise { return this.grpcService.mgmt.getCustomPasswordResetMessageText(req, null).then((resp) => resp.toObject()); } public setCustomPasswordResetMessageText( req: SetCustomPasswordResetMessageTextRequest, ): Promise { return this.grpcService.mgmt.setCustomPasswordResetMessageText(req, null).then((resp) => resp.toObject()); } public resetCustomPasswordResetMessageTextToDefault( lang: string, ): Promise { const req = new ResetCustomPasswordResetMessageTextToDefaultRequest(); req.setLanguage(lang); return this.grpcService.mgmt.resetCustomPasswordResetMessageTextToDefault(req, null).then((resp) => resp.toObject()); } public getDefaultDomainClaimedMessageText( req: GetDefaultDomainClaimedMessageTextRequest, ): Promise { return this.grpcService.mgmt.getDefaultDomainClaimedMessageText(req, null).then((resp) => resp.toObject()); } public getCustomDomainClaimedMessageText( req: GetCustomDomainClaimedMessageTextRequest, ): Promise { return this.grpcService.mgmt.getCustomDomainClaimedMessageText(req, null).then((resp) => resp.toObject()); } public setCustomDomainClaimedMessageCustomText( req: SetCustomDomainClaimedMessageTextRequest, ): Promise { return this.grpcService.mgmt.setCustomDomainClaimedMessageCustomText(req, null).then((resp) => resp.toObject()); } public resetCustomDomainClaimedMessageTextToDefault( lang: string, ): Promise { const req = new ResetCustomDomainClaimedMessageTextToDefaultRequest(); req.setLanguage(lang); return this.grpcService.mgmt.resetCustomDomainClaimedMessageTextToDefault(req, null).then((resp) => resp.toObject()); } public getDefaultPasswordlessRegistrationMessageText( req: GetDefaultPasswordlessRegistrationMessageTextRequest, ): Promise { return this.grpcService.mgmt.getDefaultPasswordlessRegistrationMessageText(req, null).then((resp) => resp.toObject()); } public getCustomPasswordlessRegistrationMessageText( req: GetCustomPasswordlessRegistrationMessageTextRequest, ): Promise { return this.grpcService.mgmt.getCustomPasswordlessRegistrationMessageText(req, null).then((resp) => resp.toObject()); } public setCustomPasswordlessRegistrationMessageCustomText( req: SetCustomPasswordlessRegistrationMessageTextRequest, ): Promise { return this.grpcService.mgmt .setCustomPasswordlessRegistrationMessageCustomText(req, null) .then((resp) => resp.toObject()); } public resetCustomPasswordlessRegistrationMessageTextToDefault( lang: string, ): Promise { const req = new ResetCustomPasswordlessRegistrationMessageTextToDefaultRequest(); req.setLanguage(lang); return this.grpcService.mgmt .resetCustomPasswordlessRegistrationMessageTextToDefault(req, null) .then((resp) => resp.toObject()); } public getDefaultPasswordChangeMessageText( req: GetDefaultPasswordChangeMessageTextRequest, ): Promise { return this.grpcService.mgmt.getDefaultPasswordChangeMessageText(req, null).then((resp) => resp.toObject()); } public getCustomPasswordChangeMessageText( req: GetCustomPasswordChangeMessageTextRequest, ): Promise { return this.grpcService.mgmt.getCustomPasswordChangeMessageText(req, null).then((resp) => resp.toObject()); } public setCustomPasswordChangeMessageText( req: SetCustomPasswordChangeMessageTextRequest, ): Promise { return this.grpcService.mgmt.setCustomPasswordChangeMessageCustomText(req, null).then((resp) => resp.toObject()); } public resetCustomPasswordChangeMessageTextToDefault( lang: string, ): Promise { const req = new ResetCustomPasswordChangeMessageTextToDefaultRequest(); req.setLanguage(lang); return this.grpcService.mgmt.resetCustomPasswordChangeMessageTextToDefault(req, null).then((resp) => resp.toObject()); } public updateUserName(userId: string, username: string): Promise { const req = new UpdateUserNameRequest(); req.setUserId(userId); req.setUserName(username); return this.grpcService.mgmt.updateUserName(req, null).then((resp) => resp.toObject()); } public unlockUser(req: UnlockUserRequest): Promise { return this.grpcService.mgmt.unlockUser(req, null).then((resp) => resp.toObject()); } public generateMachineSecret(userId: string): Promise { const req = new GenerateMachineSecretRequest(); req.setUserId(userId); return this.grpcService.mgmt.generateMachineSecret(req, null).then((resp) => resp.toObject()); } public removeMachineSecret(userId: string): Promise { const req = new RemoveMachineSecretRequest(); req.setUserId(userId); return this.grpcService.mgmt.removeMachineSecret(req, null).then((resp) => resp.toObject()); } public getPrivacyPolicy(): Promise { const req = new GetPrivacyPolicyRequest(); return this.grpcService.mgmt.getPrivacyPolicy(req, null).then((resp) => resp.toObject()); } public addCustomPrivacyPolicy(req: AddCustomPrivacyPolicyRequest): Promise { return this.grpcService.mgmt.addCustomPrivacyPolicy(req, null).then((resp) => resp.toObject()); } public updateCustomPrivacyPolicy( req: UpdateCustomPrivacyPolicyRequest, ): Promise { return this.grpcService.mgmt.updateCustomPrivacyPolicy(req, null).then((resp) => resp.toObject()); } public resetPrivacyPolicyToDefault(): Promise { const req = new ResetPrivacyPolicyToDefaultRequest(); return this.grpcService.mgmt.resetPrivacyPolicyToDefault(req, null).then((resp) => resp.toObject()); } public listHumanPasswordless(userId: string): Promise { const req = new ListHumanPasswordlessRequest(); req.setUserId(userId); return this.grpcService.mgmt.listHumanPasswordless(req, null).then((resp) => resp.toObject()); } public removeHumanPasswordless(tokenId: string, userId: string): Promise { const req = new RemoveHumanPasswordlessRequest(); req.setTokenId(tokenId); req.setUserId(userId); return this.grpcService.mgmt.removeHumanPasswordless(req, null).then((resp) => resp.toObject()); } public sendPasswordlessRegistration(userId: string): Promise { const req = new SendPasswordlessRegistrationRequest(); req.setUserId(userId); return this.grpcService.mgmt.sendPasswordlessRegistration(req, null).then((resp) => resp.toObject()); } public listLoginPolicyMultiFactors(): Promise { const req = new ListLoginPolicyMultiFactorsRequest(); return this.grpcService.mgmt.listLoginPolicyMultiFactors(req, null).then((resp) => resp.toObject()); } public addMultiFactorToLoginPolicy( req: AddMultiFactorToLoginPolicyRequest, ): Promise { return this.grpcService.mgmt.addMultiFactorToLoginPolicy(req, null).then((resp) => resp.toObject()); } public removeMultiFactorFromLoginPolicy( req: RemoveMultiFactorFromLoginPolicyRequest, ): Promise { return this.grpcService.mgmt.removeMultiFactorFromLoginPolicy(req, null).then((resp) => resp.toObject()); } public listLoginPolicySecondFactors(): Promise { const req = new Empty(); return this.grpcService.mgmt.listLoginPolicySecondFactors(req, null).then((resp) => resp.toObject()); } public addSecondFactorToLoginPolicy( req: AddSecondFactorToLoginPolicyRequest, ): Promise { return this.grpcService.mgmt.addSecondFactorToLoginPolicy(req, null).then((resp) => resp.toObject()); } public removeSecondFactorFromLoginPolicy( req: RemoveSecondFactorFromLoginPolicyRequest, ): Promise { return this.grpcService.mgmt.removeSecondFactorFromLoginPolicy(req, null).then((resp) => resp.toObject()); } public getLoginPolicy(): Promise { const req = new GetLoginPolicyRequest(); return this.grpcService.mgmt.getLoginPolicy(req, null).then((resp) => resp.toObject()); } public updateCustomLoginPolicy(req: UpdateCustomLoginPolicyRequest): Promise { return this.grpcService.mgmt.updateCustomLoginPolicy(req, null).then((resp) => resp.toObject()); } public addCustomLoginPolicy(req: AddCustomLoginPolicyRequest): Promise { return this.grpcService.mgmt.addCustomLoginPolicy(req, null).then((resp) => resp.toObject()); } public resetLoginPolicyToDefault(): Promise { const req = new ResetLoginPolicyToDefaultRequest(); return this.grpcService.mgmt.resetLoginPolicyToDefault(req, null).then((resp) => resp.toObject()); } public addIDPToLoginPolicy(idpId: string, ownerType: IDPOwnerType): Promise { const req = new AddIDPToLoginPolicyRequest(); req.setIdpId(idpId); req.setOwnertype(ownerType); return this.grpcService.mgmt.addIDPToLoginPolicy(req, null).then((resp) => resp.toObject()); } public removeIDPFromLoginPolicy(idpId: string): Promise { const req = new RemoveIDPFromLoginPolicyRequest(); req.setIdpId(idpId); return this.grpcService.mgmt.removeIDPFromLoginPolicy(req, null).then((resp) => resp.toObject()); } public listLoginPolicyIDPs(limit?: number, offset?: number): Promise { const req = new ListLoginPolicyIDPsRequest(); const metadata = new ListQuery(); if (limit) { metadata.setLimit(limit); } if (offset) { metadata.setOffset(offset); } return this.grpcService.mgmt.listLoginPolicyIDPs(req, null).then((resp) => resp.toObject()); } public deactivateOrgIDP(idpId: string): Promise { const req = new DeactivateOrgIDPRequest(); req.setIdpId(idpId); return this.grpcService.mgmt.deactivateOrgIDP(req, null).then((resp) => resp.toObject()); } public reactivateOrgIDP(idpId: string): Promise { const req = new ReactivateOrgIDPRequest(); req.setIdpId(idpId); return this.grpcService.mgmt.reactivateOrgIDP(req, null).then((resp) => resp.toObject()); } // idp templates public addAzureADProvider(req: AddAzureADProviderRequest): Promise { return this.grpcService.mgmt.addAzureADProvider(req, null).then((resp) => resp.toObject()); } public updateAzureADProvider(req: UpdateAzureADProviderRequest): Promise { return this.grpcService.mgmt.updateAzureADProvider(req, null).then((resp) => resp.toObject()); } public addGoogleProvider(req: AddGoogleProviderRequest): Promise { return this.grpcService.mgmt.addGoogleProvider(req, null).then((resp) => resp.toObject()); } public updateGoogleProvider(req: UpdateGoogleProviderRequest): Promise { return this.grpcService.mgmt.updateGoogleProvider(req, null).then((resp) => resp.toObject()); } public addLDAPProvider(req: AddLDAPProviderRequest): Promise { return this.grpcService.mgmt.addLDAPProvider(req, null).then((resp) => resp.toObject()); } public updateLDAPProvider(req: UpdateLDAPProviderRequest): Promise { return this.grpcService.mgmt.updateLDAPProvider(req, null).then((resp) => resp.toObject()); } public addGitLabProvider(req: AddGitLabProviderRequest): Promise { return this.grpcService.mgmt.addGitLabProvider(req, null).then((resp) => resp.toObject()); } public updateGitLabProvider(req: UpdateGitLabProviderRequest): Promise { return this.grpcService.mgmt.updateGitLabProvider(req, null).then((resp) => resp.toObject()); } public addGitLabSelfHostedProvider( req: AddGitLabSelfHostedProviderRequest, ): Promise { return this.grpcService.mgmt.addGitLabSelfHostedProvider(req, null).then((resp) => resp.toObject()); } public updateGitLabSelfHostedProvider( req: UpdateGitLabSelfHostedProviderRequest, ): Promise { return this.grpcService.mgmt.updateGitLabSelfHostedProvider(req, null).then((resp) => resp.toObject()); } public addGitHubProvider(req: AddGitHubProviderRequest): Promise { return this.grpcService.mgmt.addGitHubProvider(req, null).then((resp) => resp.toObject()); } public updateGitHubProvider(req: UpdateGitHubProviderRequest): Promise { return this.grpcService.mgmt.updateGitHubProvider(req, null).then((resp) => resp.toObject()); } public addGenericOIDCProvider(req: AddGenericOIDCProviderRequest): Promise { return this.grpcService.mgmt.addGenericOIDCProvider(req, null).then((resp) => resp.toObject()); } public updateGenericOIDCProvider( req: UpdateGenericOIDCProviderRequest, ): Promise { return this.grpcService.mgmt.updateGenericOIDCProvider(req, null).then((resp) => resp.toObject()); } public addGenericOAuthProvider(req: AddGenericOAuthProviderRequest): Promise { return this.grpcService.mgmt.addGenericOAuthProvider(req, null).then((resp) => resp.toObject()); } public updateGenericOAuthProvider( req: UpdateGenericOAuthProviderRequest, ): Promise { return this.grpcService.mgmt.updateGenericOAuthProvider(req, null).then((resp) => resp.toObject()); } public addJWTProvider(req: AddJWTProviderRequest): Promise { return this.grpcService.mgmt.addJWTProvider(req, null).then((resp) => resp.toObject()); } public updateJWTProvider(req: UpdateJWTProviderRequest): Promise { return this.grpcService.mgmt.updateJWTProvider(req, null).then((resp) => resp.toObject()); } public addSAMLProvider(req: AddSAMLProviderRequest): Promise { return this.grpcService.mgmt.addSAMLProvider(req, null).then((resp) => resp.toObject()); } public updateSAMLProvider(req: UpdateSAMLProviderRequest): Promise { return this.grpcService.mgmt.updateSAMLProvider(req, null).then((resp) => resp.toObject()); } public addGitHubEnterpriseServerProvider( req: AddGitHubEnterpriseServerProviderRequest, ): Promise { return this.grpcService.mgmt.addGitHubEnterpriseServerProvider(req, null).then((resp) => resp.toObject()); } public updateGitHubEnterpriseServerProvider( req: UpdateGitHubEnterpriseServerProviderRequest, ): Promise { return this.grpcService.mgmt.updateGitHubEnterpriseServerProvider(req, null).then((resp) => resp.toObject()); } public addAppleProvider(req: AddAppleProviderRequest): Promise { return this.grpcService.mgmt.addAppleProvider(req, null).then((resp) => resp.toObject()); } public updateAppleProvider(req: UpdateAppleProviderRequest): Promise { return this.grpcService.mgmt.updateAppleProvider(req, null).then((resp) => resp.toObject()); } public deleteProvider(id: string): Promise { const req = new DeleteProviderRequest(); req.setId(id); return this.grpcService.mgmt.deleteProvider(req, null).then((resp) => resp.toObject()); } public listProviders(req: ListProvidersRequest): Promise { return this.grpcService.mgmt.listProviders(req, null).then((resp) => resp.toObject()); } public getProviderByID(req: GetProviderByIDRequest): Promise { return this.grpcService.mgmt.getProviderByID(req, null).then((resp) => resp.toObject()); } public getProviderID(req: GetProviderByIDRequest): Promise { return this.grpcService.mgmt.getProviderByID(req, null); } public addHumanUser(req: AddHumanUserRequest): Promise { return this.grpcService.mgmt.addHumanUser(req, null).then((resp) => resp.toObject()); } public addMachineUser(req: AddMachineUserRequest): Promise { return this.grpcService.mgmt.addMachineUser(req, null).then((resp) => resp.toObject()); } public updateMachine( userId: string, name?: string, description?: string, accessTokenType?: AccessTokenType, ): Promise { const req = new UpdateMachineRequest(); req.setUserId(userId); if (name) { req.setName(name); } if (description) { req.setDescription(description); } if (accessTokenType !== undefined) { req.setAccessTokenType(accessTokenType); } return this.grpcService.mgmt.updateMachine(req, null).then((resp) => resp.toObject()); } public addMachineKey(userId: string, type: KeyType, date?: Timestamp): Promise { const req = new AddMachineKeyRequest(); req.setType(type); req.setUserId(userId); if (date) { req.setExpirationDate(date); } return this.grpcService.mgmt.addMachineKey(req, null).then((resp) => resp.toObject()); } public removeMachineKey(keyId: string, userId: string): Promise { const req = new RemoveMachineKeyRequest(); req.setKeyId(keyId); req.setUserId(userId); return this.grpcService.mgmt.removeMachineKey(req, null).then((resp) => resp.toObject()); } public listMachineKeys( userId: string, limit?: number, offset?: number, asc?: boolean, ): Promise { const req = new ListMachineKeysRequest(); const metadata = new ListQuery(); req.setUserId(userId); if (limit) { metadata.setLimit(limit); } if (offset) { metadata.setOffset(offset); } if (asc) { metadata.setAsc(asc); } req.setQuery(metadata); return this.grpcService.mgmt.listMachineKeys(req, null).then((resp) => resp.toObject()); } public removeHumanLinkedIDP( idpId: string, linkedUserId: string, userId: string, ): Promise { const req = new RemoveHumanLinkedIDPRequest(); req.setIdpId(idpId); req.setUserId(userId); req.setLinkedUserId(linkedUserId); return this.grpcService.mgmt.removeHumanLinkedIDP(req, null).then((resp) => resp.toObject()); } public listHumanLinkedIDPs( userId: string, limit?: number, offset?: number, ): Promise { const req = new ListHumanLinkedIDPsRequest(); const metadata = new ListQuery(); req.setUserId(userId); if (limit) { metadata.setLimit(limit); } if (offset) { metadata.setOffset(offset); } req.setQuery(metadata); return this.grpcService.mgmt.listHumanLinkedIDPs(req, null).then((resp) => resp.toObject()); } public getAction(id: string): Promise { const req = new GetActionRequest(); req.setId(id); return this.grpcService.mgmt.getAction(req, null).then((resp) => resp.toObject()); } public createAction(req: CreateActionRequest): Promise { return this.grpcService.mgmt.createAction(req, null).then((resp) => resp.toObject()); } public updateAction(req: UpdateActionRequest): Promise { return this.grpcService.mgmt.updateAction(req, null).then((resp) => resp.toObject()); } public deleteAction(id: string): Promise { const req = new DeleteActionRequest(); req.setId(id); return this.grpcService.mgmt.deleteAction(req, null).then((resp) => resp.toObject()); } public deactivateAction(id: string): Promise { const req = new DeactivateActionRequest(); req.setId(id); return this.grpcService.mgmt.deactivateAction(req, null).then((resp) => resp.toObject()); } public reactivateAction(id: string): Promise { const req = new ReactivateActionRequest(); req.setId(id); return this.grpcService.mgmt.reactivateAction(req, null).then((resp) => resp.toObject()); } public listActions( limit?: number, offset?: number, asc?: boolean, queryList?: ActionQuery[], ): Promise { const req = new ListActionsRequest(); const metadata = new ListQuery(); if (queryList) { req.setQueriesList(queryList); } if (limit) { metadata.setLimit(limit); } if (offset) { metadata.setOffset(offset); } if (asc) { metadata.setAsc(asc); } req.setQuery(metadata); return this.grpcService.mgmt.listActions(req, null).then((resp) => resp.toObject()); } public listFlowTypes(): Promise { const req = new ListFlowTypesRequest(); return this.grpcService.mgmt.listFlowTypes(req, null).then((resp) => resp.toObject()); } public listFlowTriggerTypes(type: string): Promise { const req = new ListFlowTriggerTypesRequest(); req.setType(type); return this.grpcService.mgmt.listFlowTriggerTypes(req, null).then((resp) => resp.toObject()); } public getFlow(type: string): Promise { const req = new GetFlowRequest(); req.setType(type); return this.grpcService.mgmt.getFlow(req, null).then((resp) => resp.toObject()); } public clearFlow(type: string): Promise { const req = new ClearFlowRequest(); req.setType(type); return this.grpcService.mgmt.clearFlow(req, null).then((resp) => resp.toObject()); } public setTriggerActions( actionIdsList: string[], type: string, triggerType: string, ): Promise { const req = new SetTriggerActionsRequest(); req.setActionIdsList(actionIdsList); req.setFlowType(type); req.setTriggerType(triggerType); return this.grpcService.mgmt.setTriggerActions(req, null).then((resp) => resp.toObject()); } public addPersonalAccessToken(userId: string, date?: Timestamp): Promise { const req = new AddPersonalAccessTokenRequest(); req.setUserId(userId); if (date) { req.setExpirationDate(date); } return this.grpcService.mgmt.addPersonalAccessToken(req, null).then((resp) => resp.toObject()); } public removePersonalAccessToken(tokenId: string, userId: string): Promise { const req = new RemovePersonalAccessTokenRequest(); req.setTokenId(tokenId); req.setUserId(userId); return this.grpcService.mgmt.removePersonalAccessToken(req, null).then((resp) => resp.toObject()); } public listPersonalAccessTokens( userId: string, limit?: number, offset?: number, asc?: boolean, ): Promise { const req = new ListPersonalAccessTokensRequest(); const metadata = new ListQuery(); req.setUserId(userId); if (limit) { metadata.setLimit(limit); } if (offset) { metadata.setOffset(offset); } if (asc) { metadata.setAsc(asc); } req.setQuery(metadata); return this.grpcService.mgmt.listPersonalAccessTokens(req, null).then((resp) => resp.toObject()); } public getIAM(): Promise { const req = new GetIAMRequest(); return this.grpcService.mgmt.getIAM(req, null).then((resp) => resp.toObject()); } public getDefaultPasswordComplexityPolicy(): Promise { const req = new GetDefaultPasswordComplexityPolicyRequest(); return this.grpcService.mgmt.getDefaultPasswordComplexityPolicy(req, null).then((resp) => resp.toObject()); } public getMyOrg(): Promise { const req = new GetMyOrgRequest(); return this.grpcService.mgmt.getMyOrg(req, null).then((resp) => resp.toObject()); } public addOrgDomain(domain: string): Promise { const req = new AddOrgDomainRequest(); req.setDomain(domain); return this.grpcService.mgmt.addOrgDomain(req, null).then((resp) => resp.toObject()); } public removeOrgDomain(domain: string): Promise { const req = new RemoveOrgDomainRequest(); req.setDomain(domain); return this.grpcService.mgmt.removeOrgDomain(req, null).then((resp) => resp.toObject()); } public listOrgDomains(queryList?: DomainSearchQuery[]): Promise { const req: ListOrgDomainsRequest = new ListOrgDomainsRequest(); // const metadata= new ListQuery(); if (queryList) { req.setQueriesList(queryList); } return this.grpcService.mgmt.listOrgDomains(req, null).then((resp) => resp.toObject()); } public setPrimaryOrgDomain(domain: string): Promise { const req = new SetPrimaryOrgDomainRequest(); req.setDomain(domain); return this.grpcService.mgmt.setPrimaryOrgDomain(req, null).then((resp) => resp.toObject()); } public generateOrgDomainValidation( domain: string, type: DomainValidationType, ): Promise { const req: GenerateOrgDomainValidationRequest = new GenerateOrgDomainValidationRequest(); req.setDomain(domain); req.setType(type); return this.grpcService.mgmt.generateOrgDomainValidation(req, null).then((resp) => resp.toObject()); } public validateOrgDomain(domain: string): Promise { const req = new ValidateOrgDomainRequest(); req.setDomain(domain); return this.grpcService.mgmt.validateOrgDomain(req, null).then((resp) => resp.toObject()); } public listOrgMembers(limit: number, offset: number): Promise { const req = new ListOrgMembersRequest(); const query = new ListQuery(); if (limit) { query.setLimit(limit); } if (offset) { query.setOffset(offset); } req.setQuery(query); return this.grpcService.mgmt.listOrgMembers(req, null).then((resp) => resp.toObject()); } public getOrgByDomainGlobal(domain: string): Promise { const req = new GetOrgByDomainGlobalRequest(); req.setDomain(domain); return this.grpcService.mgmt.getOrgByDomainGlobal(req, null).then((resp) => resp.toObject()); } public addOrg(name: string): Promise { const req = new AddOrgRequest(); req.setName(name); return this.grpcService.mgmt.addOrg(req, null).then((resp) => resp.toObject()); } public addOrgMember(userId: string, rolesList: string[]): Promise { const req = new AddOrgMemberRequest(); req.setUserId(userId); if (rolesList) { req.setRolesList(rolesList); } return this.grpcService.mgmt.addOrgMember(req, null).then((resp) => resp.toObject()); } public updateOrgMember(userId: string, rolesList: string[]): Promise { const req = new UpdateOrgMemberRequest(); req.setUserId(userId); req.setRolesList(rolesList); return this.grpcService.mgmt.updateOrgMember(req, null).then((resp) => resp.toObject()); } public removeOrgMember(userId: string): Promise { const req = new RemoveOrgMemberRequest(); req.setUserId(userId); return this.grpcService.mgmt.removeOrgMember(req, null).then((resp) => resp.toObject()); } public deactivateOrg(): Promise { const req = new DeactivateOrgRequest(); return this.grpcService.mgmt.deactivateOrg(req, null).then((resp) => resp.toObject()); } public reactivateOrg(): Promise { const req = new ReactivateOrgRequest(); return this.grpcService.mgmt.reactivateOrg(req, null).then((resp) => resp.toObject()); } public addProjectGrant( orgId: string, projectId: string, roleKeysList: string[], ): Promise { const req = new AddProjectGrantRequest(); req.setProjectId(projectId); req.setGrantedOrgId(orgId); req.setRoleKeysList(roleKeysList); return this.grpcService.mgmt.addProjectGrant(req, null).then((resp) => resp.toObject()); } public listOrgMemberRoles(): Promise { const req = new ListOrgMemberRolesRequest(); return this.grpcService.mgmt.listOrgMemberRoles(req, null).then((resp) => resp.toObject()); } // Policy public getLabelPolicy(): Promise { const req = new GetLabelPolicyRequest(); return this.grpcService.mgmt.getLabelPolicy(req, null).then((resp) => resp.toObject()); } public updateCustomLabelPolicy(req: UpdateCustomLabelPolicyRequest): Promise { return this.grpcService.mgmt.updateCustomLabelPolicy(req, null).then((resp) => resp.toObject()); } public resetLabelPolicyToDefault(): Promise { const req = new ResetLabelPolicyToDefaultRequest(); return this.grpcService.mgmt.resetLabelPolicyToDefault(req, null).then((resp) => resp.toObject()); } public addCustomLabelPolicy(req: AddCustomLabelPolicyRequest): Promise { return this.grpcService.mgmt.addCustomLabelPolicy(req, null).then((resp) => resp.toObject()); } public getDefaultLabelPolicy(req: GetDefaultLabelPolicyRequest): Promise { return this.grpcService.mgmt.getDefaultLabelPolicy(req, null).then((resp) => resp.toObject()); } public getPreviewLabelPolicy(): Promise { const req = new GetPreviewLabelPolicyRequest(); return this.grpcService.mgmt.getPreviewLabelPolicy(req, null).then((resp) => resp.toObject()); } public activateCustomLabelPolicy(): Promise { const req = new ActivateCustomLabelPolicyRequest(); return this.grpcService.mgmt.activateCustomLabelPolicy(req, null).then((resp) => resp.toObject()); } public removeLabelPolicyFont(): Promise { const req = new RemoveCustomLabelPolicyFontRequest(); return this.grpcService.mgmt.removeCustomLabelPolicyFont(req, null).then((resp) => resp.toObject()); } public removeLabelPolicyIcon(): Promise { const req = new RemoveCustomLabelPolicyIconRequest(); return this.grpcService.mgmt.removeCustomLabelPolicyIcon(req, null).then((resp) => resp.toObject()); } public removeLabelPolicyIconDark(): Promise { const req = new RemoveCustomLabelPolicyIconDarkRequest(); return this.grpcService.mgmt.removeCustomLabelPolicyIconDark(req, null).then((resp) => resp.toObject()); } public removeLabelPolicyLogo(): Promise { const req = new RemoveCustomLabelPolicyLogoRequest(); return this.grpcService.mgmt.removeCustomLabelPolicyLogo(req, null).then((resp) => resp.toObject()); } public removeLabelPolicyLogoDark(): Promise { const req = new RemoveCustomLabelPolicyLogoDarkRequest(); return this.grpcService.mgmt.removeCustomLabelPolicyLogoDark(req, null).then((resp) => resp.toObject()); } public getDomainPolicy(): Promise { const req = new GetDomainPolicyRequest(); return this.grpcService.mgmt.getDomainPolicy(req, null).then((resp) => resp.toObject()); } public getPasswordAgePolicy(): Promise { const req = new GetPasswordAgePolicyRequest(); return this.grpcService.mgmt.getPasswordAgePolicy(req, null).then((resp) => resp.toObject()); } public addCustomPasswordAgePolicy( maxAgeDays: number, expireWarnDays: number, ): Promise { const req = new AddCustomPasswordAgePolicyRequest(); req.setMaxAgeDays(maxAgeDays); req.setExpireWarnDays(expireWarnDays); return this.grpcService.mgmt.addCustomPasswordAgePolicy(req, null).then((resp) => resp.toObject()); } public resetPasswordAgePolicyToDefault(): Promise { const req = new ResetPasswordAgePolicyToDefaultRequest(); return this.grpcService.mgmt.resetPasswordAgePolicyToDefault(req, null).then((resp) => resp.toObject()); } public updateCustomPasswordAgePolicy( maxAgeDays: number, expireWarnDays: number, ): Promise { const req = new UpdateCustomPasswordAgePolicyRequest(); req.setMaxAgeDays(maxAgeDays); req.setExpireWarnDays(expireWarnDays); return this.grpcService.mgmt.updateCustomPasswordAgePolicy(req, null).then((resp) => resp.toObject()); } public getPasswordComplexityPolicy(): Promise { const req = new GetPasswordComplexityPolicyRequest(); return this.grpcService.mgmt.getPasswordComplexityPolicy(req, null).then((resp) => resp.toObject()); } public addCustomPasswordComplexityPolicy( hasLowerCase: boolean, hasUpperCase: boolean, hasNumber: boolean, hasSymbol: boolean, minLength: number, ): Promise { const req = new AddCustomPasswordComplexityPolicyRequest(); req.setHasLowercase(hasLowerCase); req.setHasUppercase(hasUpperCase); req.setHasNumber(hasNumber); req.setHasSymbol(hasSymbol); req.setMinLength(minLength); return this.grpcService.mgmt.addCustomPasswordComplexityPolicy(req, null).then((resp) => resp.toObject()); } public resetPasswordComplexityPolicyToDefault(): Promise { const req = new ResetPasswordComplexityPolicyToDefaultRequest(); return this.grpcService.mgmt.resetPasswordComplexityPolicyToDefault(req, null).then((resp) => resp.toObject()); } public updateCustomPasswordComplexityPolicy( hasLowerCase: boolean, hasUpperCase: boolean, hasNumber: boolean, hasSymbol: boolean, minLength: number, ): Promise { const req = new UpdateCustomPasswordComplexityPolicyRequest(); req.setHasLowercase(hasLowerCase); req.setHasUppercase(hasUpperCase); req.setHasNumber(hasNumber); req.setHasSymbol(hasSymbol); req.setMinLength(minLength); return this.grpcService.mgmt.updateCustomPasswordComplexityPolicy(req, null).then((resp) => resp.toObject()); } public getLockoutPolicy(): Promise { const req = new GetLockoutPolicyRequest(); return this.grpcService.mgmt.getLockoutPolicy(req, null).then((resp) => resp.toObject()); } public addCustomLockoutPolicy( maxPasswordAttempts: number, maxOTPAttempts: number, ): Promise { const req = new AddCustomLockoutPolicyRequest(); req.setMaxPasswordAttempts(maxPasswordAttempts); req.setMaxOtpAttempts(maxOTPAttempts); return this.grpcService.mgmt.addCustomLockoutPolicy(req, null).then((resp) => resp.toObject()); } public resetLockoutPolicyToDefault(): Promise { const req = new ResetLockoutPolicyToDefaultRequest(); return this.grpcService.mgmt.resetLockoutPolicyToDefault(req, null).then((resp) => resp.toObject()); } public updateCustomLockoutPolicy( maxPasswordAttempts: number, maxOTPAttempts: number, ): Promise { const req = new UpdateCustomLockoutPolicyRequest(); req.setMaxPasswordAttempts(maxPasswordAttempts); req.setMaxOtpAttempts(maxOTPAttempts); return this.grpcService.mgmt.updateCustomLockoutPolicy(req, null).then((resp) => resp.toObject()); } public getLocalizedComplexityPolicyPatternErrorString(policy: PasswordComplexityPolicy.AsObject): string { if (policy.hasNumber && policy.hasSymbol) { return 'POLICY.PWD_COMPLEXITY.SYMBOLANDNUMBERERROR'; } else if (policy.hasNumber) { return 'POLICY.PWD_COMPLEXITY.NUMBERERROR'; } else if (policy.hasSymbol) { return 'POLICY.PWD_COMPLEXITY.SYMBOLERROR'; } else { return 'POLICY.PWD_COMPLEXITY.PATTERNERROR'; } } /* notification policy */ public getNotificationPolicy(): Promise { const req = new GetNotificationPolicyRequest(); return this.grpcService.mgmt.getNotificationPolicy(req, null).then((resp) => resp.toObject()); } public resetNotificationPolicyToDefault(): Promise { const req = new ResetNotificationPolicyToDefaultRequest(); return this.grpcService.mgmt.resetNotificationPolicyToDefault(req, null).then((resp) => resp.toObject()); } public addCustomNotificationPolicy( req: AddCustomNotificationPolicyRequest, ): Promise { return this.grpcService.mgmt.addCustomNotificationPolicy(req, null).then((resp) => resp.toObject()); } public updateCustomNotificationPolicy( req: UpdateCustomNotificationPolicyRequest, ): Promise { return this.grpcService.mgmt.updateCustomNotificationPolicy(req, null).then((resp) => resp.toObject()); } public getUserByID(id: string): Promise { const req = new GetUserByIDRequest(); req.setId(id); return this.grpcService.mgmt.getUserByID(req, null).then((resp) => resp.toObject()); } public listUserMetadata( userId: string, offset?: number, limit?: number, queryList?: MetadataQuery[], ): Promise { const req = new ListUserMetadataRequest(); req.setId(userId); const metadata = new ListQuery(); if (offset) { metadata.setOffset(offset); } if (limit) { metadata.setLimit(limit); } if (queryList) { req.setQueriesList(queryList); } return this.grpcService.mgmt.listUserMetadata(req, null).then((resp) => resp.toObject()); } public listOrgMetadata( offset?: number, limit?: number, queryList?: MetadataQuery[], ): Promise { const req = new ListOrgMetadataRequest(); const metadata = new ListQuery(); if (offset) { metadata.setOffset(offset); } if (limit) { metadata.setLimit(limit); } if (queryList) { req.setQueriesList(queryList); } return this.grpcService.mgmt.listOrgMetadata(req, null).then((resp) => resp.toObject()); } public getUserMetadata(userId: string, key: string): Promise { const req = new GetUserMetadataRequest(); req.setId(userId); req.setKey(key); return this.grpcService.mgmt.getUserMetadata(req, null).then((resp) => resp.toObject()); } public setUserMetadata(key: string, value: string, userId: string): Promise { const req = new SetUserMetadataRequest(); req.setKey(key); req.setValue(value); req.setId(userId); return this.grpcService.mgmt.setUserMetadata(req, null).then((resp) => resp.toObject()); } public setOrgMetadata(key: string, value: string): Promise { const req = new SetOrgMetadataRequest(); req.setKey(key); req.setValue(value); return this.grpcService.mgmt.setOrgMetadata(req, null).then((resp) => resp.toObject()); } public bulkSetUserMetadata( list: BulkSetUserMetadataRequest.Metadata[], userId: string, ): Promise { const req = new BulkSetUserMetadataRequest(); req.setMetadataList(list); req.setId(userId); return this.grpcService.mgmt.bulkSetUserMetadata(req, null).then((resp) => resp.toObject()); } public removeUserMetadata(key: string, userId: string): Promise { const req = new RemoveUserMetadataRequest(); req.setKey(key); req.setId(userId); return this.grpcService.mgmt.removeUserMetadata(req, null).then((resp) => resp.toObject()); } public removeOrgMetadata(key: string): Promise { const req = new RemoveOrgMetadataRequest(); req.setKey(key); return this.grpcService.mgmt.removeOrgMetadata(req, null).then((resp) => resp.toObject()); } public removeUser(id: string): Promise { const req = new RemoveUserRequest(); req.setId(id); return this.grpcService.mgmt.removeUser(req, null).then((resp) => resp.toObject()); } public removeOrg(): Promise { const req = new RemoveOrgRequest(); return this.grpcService.mgmt.removeOrg(req, null).then((resp) => resp.toObject()); } public listProjectMembers( projectId: string, limit: number, offset: number, queryList?: SearchQuery[], ): Promise { const req = new ListProjectMembersRequest(); const query = new ListQuery(); req.setQuery(query); req.setProjectId(projectId); if (limit) { query.setLimit(limit); } if (offset) { query.setOffset(offset); } if (queryList) { req.setQueriesList(queryList); } req.setQuery(query); return this.grpcService.mgmt.listProjectMembers(req, null).then((resp) => resp.toObject()); } public listUserMemberships( userId: string, limit: number, offset: number, queryList?: MembershipQuery[], ): Promise { const req = new ListUserMembershipsRequest(); req.setUserId(userId); const metadata = new ListQuery(); if (limit) { metadata.setLimit(limit); } if (offset) { metadata.setOffset(offset); } if (queryList) { req.setQueriesList(queryList); } req.setQuery(metadata); return this.grpcService.mgmt.listUserMemberships(req, null).then((resp) => resp.toObject()); } public getHumanProfile(userId: string): Promise { const req = new GetHumanProfileRequest(); req.setUserId(userId); return this.grpcService.mgmt.getHumanProfile(req, null).then((resp) => resp.toObject()); } public listHumanMultiFactors(userId: string): Promise { const req = new ListHumanAuthFactorsRequest(); req.setUserId(userId); return this.grpcService.mgmt.listHumanAuthFactors(req, null).then((resp) => resp.toObject()); } public removeHumanMultiFactorOTP(userId: string): Promise { const req = new RemoveHumanAuthFactorOTPRequest(); req.setUserId(userId); return this.grpcService.mgmt.removeHumanAuthFactorOTP(req, null).then((resp) => resp.toObject()); } public removeHumanAuthFactorU2F(userId: string, tokenId: string): Promise { const req = new RemoveHumanAuthFactorU2FRequest(); req.setUserId(userId); req.setTokenId(tokenId); return this.grpcService.mgmt.removeHumanAuthFactorU2F(req, null).then((resp) => resp.toObject()); } public removeHumanAuthFactorOTPSMS(userId: string): Promise { const req = new RemoveHumanAuthFactorOTPSMSRequest(); req.setUserId(userId); return this.grpcService.mgmt.removeHumanAuthFactorOTPSMS(req, null).then((resp) => resp.toObject()); } public removeHumanAuthFactorOTPEmail(userId: string): Promise { const req = new RemoveHumanAuthFactorOTPEmailRequest(); req.setUserId(userId); return this.grpcService.mgmt.removeHumanAuthFactorOTPEmail(req, null).then((resp) => resp.toObject()); } public updateHumanProfile( userId: string, firstName?: string, lastName?: string, nickName?: string, displayName?: string, preferredLanguage?: string, gender?: Gender, ): Promise { const req = new UpdateHumanProfileRequest(); req.setUserId(userId); if (firstName) { req.setFirstName(firstName); } if (lastName) { req.setLastName(lastName); } if (nickName) { req.setNickName(nickName); } if (displayName) { req.setDisplayName(displayName); } if (gender) { req.setGender(gender); } if (preferredLanguage) { req.setPreferredLanguage(preferredLanguage); } return this.grpcService.mgmt.updateHumanProfile(req, null).then((resp) => resp.toObject()); } public getHumanEmail(id: string): Promise { const req = new GetHumanEmailRequest(); req.setUserId(id); return this.grpcService.mgmt.getHumanEmail(req, null).then((resp) => resp.toObject()); } public updateHumanEmail(userId: string, email: string, isVerified?: boolean): Promise { const req = new UpdateHumanEmailRequest(); req.setUserId(userId); req.setEmail(email); if (isVerified) { req.setIsEmailVerified(isVerified); } return this.grpcService.mgmt.updateHumanEmail(req, null).then((resp) => resp.toObject()); } public getHumanPhone(userId: string): Promise { const req = new GetHumanPhoneRequest(); req.setUserId(userId); return this.grpcService.mgmt.getHumanPhone(req, null).then((resp) => resp.toObject()); } public updateHumanPhone(userId: string, phone: string): Promise { const req = new UpdateHumanPhoneRequest(); req.setUserId(userId); req.setPhone(phone); return this.grpcService.mgmt.updateHumanPhone(req, null).then((resp) => resp.toObject()); } public removeHumanPhone(userId: string): Promise { const req = new RemoveHumanPhoneRequest(); req.setUserId(userId); return this.grpcService.mgmt.removeHumanPhone(req, null).then((resp) => resp.toObject()); } public deactivateUser(id: string): Promise { const req = new DeactivateUserRequest(); req.setId(id); return this.grpcService.mgmt.deactivateUser(req, null).then((resp) => resp.toObject()); } public addUserGrant( userId: string, roleNamesList: string[], projectId?: string, projectGrantId?: string, ): Promise { const req = new AddUserGrantRequest(); if (projectId) { req.setProjectId(projectId); } if (projectGrantId) { req.setProjectGrantId(projectGrantId); } req.setUserId(userId); req.setRoleKeysList(roleNamesList); return this.grpcService.mgmt.addUserGrant(req, null).then((resp) => resp.toObject()); } public reactivateUser(id: string): Promise { const req = new ReactivateUserRequest(); req.setId(id); return this.grpcService.mgmt.reactivateUser(req, null).then((resp) => resp.toObject()); } public addProjectRole( projectId: string, roleKey: string, displayName: string, group: string, ): Promise { const req = new AddProjectRoleRequest(); req.setProjectId(projectId); req.setRoleKey(roleKey); if (displayName) { req.setDisplayName(displayName); } req.setGroup(group); return this.grpcService.mgmt.addProjectRole(req, null).then((resp) => resp.toObject()); } public resendHumanEmailVerification(userId: string): Promise { const req = new ResendHumanEmailVerificationRequest(); req.setUserId(userId); return this.grpcService.mgmt.resendHumanEmailVerification(req, null).then((resp) => resp.toObject()); } public resendHumanInitialization(userId: string, newemail: string): Promise { const req = new ResendHumanInitializationRequest(); if (newemail) { req.setEmail(newemail); } req.setUserId(userId); return this.grpcService.mgmt.resendHumanInitialization(req, null).then((resp) => resp.toObject()); } public resendHumanPhoneVerification(userId: string): Promise { const req = new ResendHumanPhoneVerificationRequest(); req.setUserId(userId); return this.grpcService.mgmt.resendHumanPhoneVerification(req, null).then((resp) => resp.toObject()); } public setHumanInitialPassword(id: string, password: string): Promise { const req = new SetHumanInitialPasswordRequest(); req.setUserId(id); req.setPassword(password); return this.grpcService.mgmt.setHumanInitialPassword(req, null).then((resp) => resp.toObject()); } public sendHumanResetPasswordNotification(id: string, type: SendHumanResetPasswordNotificationRequest.Type): Promise { const req = new SendHumanResetPasswordNotificationRequest(); req.setUserId(id); req.setType(type); return this.grpcService.mgmt.sendHumanResetPasswordNotification(req, null).then((resp) => resp.toObject()); } public listUsers( limit: number, offset: number, queriesList?: UserSearchQuery[], sortingColumn?: UserFieldName, sortingDirection?: SortDirection, ): Promise { const req = new ListUsersRequest(); const query = new ListQuery(); if (limit) { query.setLimit(limit); } if (offset) { query.setOffset(offset); } if (sortingDirection) { query.setAsc(sortingDirection === 'asc'); } req.setQuery(query); if (sortingColumn) { req.setSortingColumn(sortingColumn); } if (queriesList) { req.setQueriesList(queriesList); } return this.grpcService.mgmt.listUsers(req, null).then((resp) => resp.toObject()); } public getUserByLoginNameGlobal(loginname: string): Promise { const req = new GetUserByLoginNameGlobalRequest(); req.setLoginName(loginname); return this.grpcService.mgmt.getUserByLoginNameGlobal(req, null).then((resp) => resp.toObject()); } // USER GRANTS public listUserGrants( limit?: number, offset?: number, queryList?: UserGrantQuery[], ): Promise { const req = new ListUserGrantRequest(); const query = new ListQuery(); if (limit) { query.setLimit(limit); } if (offset) { query.setOffset(offset); } req.setQuery(query); if (queryList) { req.setQueriesList(queryList); } return this.grpcService.mgmt.listUserGrants(req, null).then((resp) => resp.toObject()); } public getUserGrantByID(grantId: string, userId: string): Promise { const req = new GetUserGrantByIDRequest(); req.setGrantId(grantId); req.setUserId(userId); return this.grpcService.mgmt.getUserGrantByID(req, null).then((resp) => resp.toObject()); } public updateUserGrant( grantId: string, userId: string, roleKeysList: string[], ): Promise { const req = new UpdateUserGrantRequest(); req.setGrantId(grantId); req.setRoleKeysList(roleKeysList); req.setUserId(userId); return this.grpcService.mgmt.updateUserGrant(req, null).then((resp) => resp.toObject()); } public removeUserGrant(grantId: string, userId: string): Promise { const req = new RemoveUserGrantRequest(); req.setGrantId(grantId); req.setUserId(userId); return this.grpcService.mgmt.removeUserGrant(req, null).then((resp) => resp.toObject()); } public bulkRemoveUserGrant(grantIdsList: string[]): Promise { const req = new BulkRemoveUserGrantRequest(); req.setGrantIdList(grantIdsList); return this.grpcService.mgmt.bulkRemoveUserGrant(req, null).then((resp) => resp.toObject()); } public listAppChanges( appId: string, projectId: string, limit: number, sequence: number, ): Promise { const req = new ListAppChangesRequest(); const query = new ChangeQuery(); req.setAppId(appId); req.setProjectId(projectId); if (limit) { query.setLimit(limit); } if (sequence) { query.setSequence(sequence); } req.setQuery(query); return this.grpcService.mgmt.listAppChanges(req, null).then((resp) => resp.toObject()); } public listOrgChanges(limit: number, sequence: number): Promise { const req = new ListOrgChangesRequest(); const query = new ChangeQuery(); if (limit) { query.setLimit(limit); } if (sequence) { query.setSequence(sequence); } req.setQuery(query); return this.grpcService.mgmt.listOrgChanges(req, null).then((resp) => resp.toObject()); } public listProjectChanges( projectId: string, limit: number, sequence: number, ): Promise { const req = new ListProjectChangesRequest(); req.setProjectId(projectId); const query = new ChangeQuery(); if (limit) { query.setLimit(limit); } if (sequence) { query.setSequence(sequence); } req.setQuery(query); return this.grpcService.mgmt.listProjectChanges(req, null).then((resp) => resp.toObject()); } public listProjectGrantChanges( projectId: string, grantId: string, limit: number, sequence: number, ): Promise { const req = new ListProjectGrantChangesRequest(); req.setProjectId(projectId); req.setGrantId(grantId); const query = new ChangeQuery(); if (limit) { query.setLimit(limit); } if (sequence) { query.setSequence(sequence); } req.setQuery(query); return this.grpcService.mgmt.listProjectGrantChanges(req, null).then((resp) => resp.toObject()); } public listUserChanges(userId: string, limit: number, sequence: number): Promise { const req = new ListUserChangesRequest(); req.setUserId(userId); const query = new ChangeQuery(); if (limit) { query.setLimit(limit); } if (sequence) { query.setSequence(sequence); } req.setQuery(query); return this.grpcService.mgmt.listUserChanges(req, null).then((resp) => resp.toObject()); } // project public listProjects(limit?: number, offset?: number, queryList?: ProjectQuery[]): Promise { const req = new ListProjectsRequest(); const query = new ListQuery(); if (limit) { query.setLimit(limit); } if (offset) { query.setOffset(offset); } req.setQuery(query); if (queryList) { req.setQueriesList(queryList); } return this.grpcService.mgmt.listProjects(req, null).then((value) => { const obj = value.toObject(); const count = obj.resultList.length; if (count >= 0) { this.ownedProjects.next(obj.resultList); this.ownedProjectsCount.next(count); } return obj; }); } public listGrantedProjects( limit?: number, offset?: number, queryList?: ProjectQuery[], ): Promise { const req = new ListGrantedProjectsRequest(); const query = new ListQuery(); if (limit) { query.setLimit(limit); } if (offset) { query.setOffset(offset); } req.setQuery(query); if (queryList) { req.setQueriesList(queryList); } return this.grpcService.mgmt.listGrantedProjects(req, null).then((value) => { const obj = value.toObject(); this.grantedProjects.next(obj.resultList); this.grantedProjectsCount.next(obj.resultList.length); return obj; }); } public getOIDCInformation(): Promise { const req = new GetOIDCInformationRequest(); return this.grpcService.mgmt.getOIDCInformation(req, null).then((resp) => resp.toObject()); } public getProjectByID(projectId: string): Promise { const req = new GetProjectByIDRequest(); req.setId(projectId); return this.grpcService.mgmt.getProjectByID(req, null).then((resp) => resp.toObject()); } public getGrantedProjectByID(projectId: string, grantId: string): Promise { const req = new GetGrantedProjectByIDRequest(); req.setGrantId(grantId); req.setProjectId(projectId); return this.grpcService.mgmt.getGrantedProjectByID(req, null).then((resp) => resp.toObject()); } public addProject(project: AddProjectRequest.AsObject): Promise { const req = new AddProjectRequest(); req.setName(project.name); return this.grpcService.mgmt.addProject(req, null).then((value) => { const current = this.ownedProjectsCount.getValue(); this.ownedProjectsCount.next(current + 1); return value.toObject(); }); } public updateProject(req: UpdateProjectRequest): Promise { return this.grpcService.mgmt.updateProject(req, null).then((resp) => resp.toObject()); } public updateProjectGrant( grantId: string, projectId: string, rolesList: string[], ): Promise { const req = new UpdateProjectGrantRequest(); req.setRoleKeysList(rolesList); req.setGrantId(grantId); req.setProjectId(projectId); return this.grpcService.mgmt.updateProjectGrant(req, null).then((resp) => resp.toObject()); } public removeProjectGrant(grantId: string, projectId: string): Promise { const req = new RemoveProjectGrantRequest(); req.setGrantId(grantId); req.setProjectId(projectId); return this.grpcService.mgmt.removeProjectGrant(req, null).then((resp) => resp.toObject()); } public deactivateProject(projectId: string): Promise { const req = new DeactivateProjectRequest(); req.setId(projectId); return this.grpcService.mgmt.deactivateProject(req, null).then((resp) => resp.toObject()); } public reactivateProject(projectId: string): Promise { const req = new ReactivateProjectRequest(); req.setId(projectId); return this.grpcService.mgmt.reactivateProject(req, null).then((resp) => resp.toObject()); } public listProjectGrants(projectId: string, limit: number, offset: number): Promise { const req = new ListProjectGrantsRequest(); req.setProjectId(projectId); const query = new ListQuery(); if (limit) { query.setLimit(limit); } if (offset) { query.setOffset(offset); } req.setQuery(query); return this.grpcService.mgmt.listProjectGrants(req, null).then((resp) => resp.toObject()); } public listProjectGrantMemberRoles(): Promise { const req = new ListProjectGrantMemberRolesRequest(); return this.grpcService.mgmt.listProjectGrantMemberRoles(req, null).then((resp) => resp.toObject()); } public addProjectMember( projectId: string, userId: string, rolesList: string[], ): Promise { const req = new AddProjectMemberRequest(); req.setProjectId(projectId); req.setUserId(userId); req.setRolesList(rolesList); return this.grpcService.mgmt.addProjectMember(req, null).then((resp) => resp.toObject()); } public updateProjectMember( projectId: string, userId: string, rolesList: string[], ): Promise { const req = new UpdateProjectMemberRequest(); req.setProjectId(projectId); req.setUserId(userId); req.setRolesList(rolesList); return this.grpcService.mgmt.updateProjectMember(req, null).then((resp) => resp.toObject()); } public addProjectGrantMember( projectId: string, grantId: string, userId: string, rolesList: string[], ): Promise { const req = new AddProjectGrantMemberRequest(); req.setProjectId(projectId); req.setGrantId(grantId); req.setUserId(userId); req.setRolesList(rolesList); return this.grpcService.mgmt.addProjectGrantMember(req, null).then((resp) => resp.toObject()); } public updateProjectGrantMember( projectId: string, grantId: string, userId: string, rolesList: string[], ): Promise { const req = new UpdateProjectGrantMemberRequest(); req.setProjectId(projectId); req.setGrantId(grantId); req.setUserId(userId); req.setRolesList(rolesList); return this.grpcService.mgmt.updateProjectGrantMember(req, null).then((resp) => resp.toObject()); } public listProjectGrantMembers( projectId: string, grantId: string, limit: number, offset: number, queryList?: SearchQuery[], ): Promise { const req = new ListProjectGrantMembersRequest(); req.setProjectId(projectId); req.setGrantId(grantId); const query = new ListQuery(); if (limit) { query.setLimit(limit); } if (offset) { query.setOffset(offset); } req.setQuery(query); if (queryList) { req.setQueriesList(queryList); } return this.grpcService.mgmt.listProjectGrantMembers(req, null).then((resp) => resp.toObject()); } public removeProjectGrantMember( projectId: string, grantId: string, userId: string, ): Promise { const req = new RemoveProjectGrantMemberRequest(); req.setGrantId(grantId); req.setUserId(userId); req.setProjectId(projectId); return this.grpcService.mgmt.removeProjectGrantMember(req, null).then((resp) => resp.toObject()); } public reactivateApp(projectId: string, appId: string): Promise { const req = new ReactivateAppRequest(); req.setAppId(appId); req.setProjectId(projectId); return this.grpcService.mgmt.reactivateApp(req, null).then((resp) => resp.toObject()); } public deactivateApp(projectId: string, appId: string): Promise { const req = new DeactivateAppRequest(); req.setAppId(appId); req.setProjectId(projectId); return this.grpcService.mgmt.deactivateApp(req, null).then((resp) => resp.toObject()); } public regenerateOIDCClientSecret(appId: string, projectId: string): Promise { const req = new RegenerateOIDCClientSecretRequest(); req.setAppId(appId); req.setProjectId(projectId); return this.grpcService.mgmt.regenerateOIDCClientSecret(req, null).then((resp) => resp.toObject()); } public listAppKeys( projectId: string, appId: string, limit: number, offset: number, ): Promise { const req = new ListAppKeysRequest(); req.setProjectId(projectId); req.setAppId(appId); const metaData = new ListQuery(); if (limit) { metaData.setLimit(limit); } if (offset) { metaData.setOffset(offset); } req.setQuery(metaData); return this.grpcService.mgmt.listAppKeys(req, null).then((resp) => resp.toObject()); } public addAppKey( projectId: string, appId: string, type: KeyType, expirationDate?: Timestamp, ): Promise { const req = new AddAppKeyRequest(); req.setProjectId(projectId); req.setAppId(appId); req.setType(type); if (expirationDate) { req.setExpirationDate(expirationDate); } return this.grpcService.mgmt.addAppKey(req, null).then((resp) => resp.toObject()); } public removeAppKey(projectId: string, appId: string, keyId: string): Promise { const req = new RemoveAppKeyRequest(); req.setAppId(appId); req.setKeyId(keyId); req.setProjectId(projectId); return this.grpcService.mgmt.removeAppKey(req, null).then((resp) => resp.toObject()); } public listProjectRoles( projectId: string, limit: number, offset: number, queryList?: RoleQuery[], ): Promise { const req = new ListProjectRolesRequest(); req.setProjectId(projectId); const query = new ListQuery(); if (limit) { query.setLimit(limit); } if (offset) { query.setOffset(offset); } req.setQuery(query); if (queryList) { req.setQueriesList(queryList); } return this.grpcService.mgmt.listProjectRoles(req, null).then((resp) => resp.toObject()); } public listGrantedProjectRoles( projectId: string, grantId: string, limit?: number, offset?: number, queryList?: RoleQuery[], ): Promise { const req = new ListGrantedProjectRolesRequest(); req.setProjectId(projectId); req.setGrantId(grantId); const query = new ListQuery(); if (limit) { query.setLimit(limit); } if (offset) { query.setOffset(offset); } req.setQuery(query); if (queryList) { req.setQueriesList(queryList); } return this.grpcService.mgmt.listGrantedProjectRoles(req, null).then((resp) => resp.toObject()); } public bulkAddProjectRoles( projectId: string, rolesList: BulkAddProjectRolesRequest.Role[], ): Promise { const req = new BulkAddProjectRolesRequest(); req.setProjectId(projectId); req.setRolesList(rolesList); return this.grpcService.mgmt.bulkAddProjectRoles(req, null).then((resp) => resp.toObject()); } public removeProjectRole(projectId: string, roleKey: string): Promise { const req = new RemoveProjectRoleRequest(); req.setProjectId(projectId); req.setRoleKey(roleKey); return this.grpcService.mgmt.removeProjectRole(req, null).then((resp) => resp.toObject()); } public updateProjectRole( projectId: string, roleKey: string, displayName: string, group: string, ): Promise { const req = new UpdateProjectRoleRequest(); req.setProjectId(projectId); req.setRoleKey(roleKey); req.setGroup(group); req.setDisplayName(displayName); return this.grpcService.mgmt.updateProjectRole(req, null).then((resp) => resp.toObject()); } public removeProjectMember(projectId: string, userId: string): Promise { const req = new RemoveProjectMemberRequest(); req.setProjectId(projectId); req.setUserId(userId); return this.grpcService.mgmt.removeProjectMember(req, null).then((resp) => resp.toObject()); } public listApps( projectId: string, limit: number, offset: number, queryList?: AppQuery[], ): Promise { const req = new ListAppsRequest(); req.setProjectId(projectId); const query = new ListQuery(); if (limit) { query.setLimit(limit); } if (offset) { query.setOffset(offset); } req.setQuery(query); if (queryList) { req.setQueriesList(queryList); } return this.grpcService.mgmt.listApps(req, null).then((resp) => resp.toObject()); } public getAppByID(projectId: string, appId: string): Promise { const req = new GetAppByIDRequest(); req.setProjectId(projectId); req.setAppId(appId); return this.grpcService.mgmt.getAppByID(req, null).then((resp) => resp.toObject()); } public listProjectMemberRoles(): Promise { const req = new ListProjectMemberRolesRequest(); return this.grpcService.mgmt.listProjectMemberRoles(req, null).then((resp) => resp.toObject()); } public getProjectGrantByID(grantId: string, projectId: string): Promise { const req = new GetProjectGrantByIDRequest(); req.setGrantId(grantId); req.setProjectId(projectId); return this.grpcService.mgmt.getProjectGrantByID(req, null).then((resp) => resp.toObject()); } public removeProject(id: string): Promise { const req = new RemoveProjectRequest(); req.setId(id); return this.grpcService.mgmt.removeProject(req, null).then((value) => { const current = this.ownedProjectsCount.getValue(); this.ownedProjectsCount.next(current > 0 ? current - 1 : 0); return value.toObject(); }); } public deactivateProjectGrant(grantId: string, projectId: string): Promise { const req = new DeactivateProjectGrantRequest(); req.setGrantId(grantId); req.setProjectId(projectId); return this.grpcService.mgmt.deactivateProjectGrant(req, null).then((resp) => resp.toObject()); } public reactivateProjectGrant(grantId: string, projectId: string): Promise { const req = new ReactivateProjectGrantRequest(); req.setGrantId(grantId); req.setProjectId(projectId); return this.grpcService.mgmt.reactivateProjectGrant(req, null).then((resp) => resp.toObject()); } public addOIDCApp(req: AddOIDCAppRequest): Promise { return this.grpcService.mgmt.addOIDCApp(req, null).then((resp) => resp.toObject()); } public addAPIApp(req: AddAPIAppRequest): Promise { return this.grpcService.mgmt.addAPIApp(req, null).then((resp) => resp.toObject()); } public addSAMLApp(req: AddSAMLAppRequest): Promise { return this.grpcService.mgmt.addSAMLApp(req, null).then((resp) => resp.toObject()); } public regenerateAPIClientSecret(appId: string, projectId: string): Promise { const req = new RegenerateAPIClientSecretRequest(); req.setAppId(appId); req.setProjectId(projectId); return this.grpcService.mgmt.regenerateAPIClientSecret(req, null).then((resp) => resp.toObject()); } public updateApp(projectId: string, appId: string, name: string): Promise { const req = new UpdateAppRequest(); req.setAppId(appId); req.setName(name); req.setProjectId(projectId); return this.grpcService.mgmt.updateApp(req, null).then((resp) => resp.toObject()); } public updateOrg(name: string): Promise { const req = new UpdateOrgRequest(); req.setName(name); return this.grpcService.mgmt.updateOrg(req, null).then((resp) => resp.toObject()); } public updateOIDCAppConfig(req: UpdateOIDCAppConfigRequest): Promise { return this.grpcService.mgmt.updateOIDCAppConfig(req, null).then((resp) => resp.toObject()); } public updateAPIAppConfig(req: UpdateAPIAppConfigRequest): Promise { return this.grpcService.mgmt.updateAPIAppConfig(req, null).then((resp) => resp.toObject()); } public updateSAMLAppConfig(req: UpdateSAMLAppConfigRequest): Promise { return this.grpcService.mgmt.updateSAMLAppConfig(req, null).then((resp) => resp.toObject()); } public removeApp(projectId: string, appId: string): Promise { const req = new RemoveAppRequest(); req.setAppId(appId); req.setProjectId(projectId); return this.grpcService.mgmt.removeApp(req, null).then((resp) => resp.toObject()); } }