/* tslint:disable */ /* eslint-disable */ /** * Keycloak Admin REST API * This is a REST API reference for the Keycloak Admin * * The version of the OpenAPI document: 1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import * as runtime from '../runtime'; import { CredentialRepresentation, CredentialRepresentationFromJSON, CredentialRepresentationToJSON, FederatedIdentityRepresentation, FederatedIdentityRepresentationFromJSON, FederatedIdentityRepresentationToJSON, UserRepresentation, UserRepresentationFromJSON, UserRepresentationToJSON, } from '../models'; export interface RealmUsersCountGetRequest { realm: string; email?: string; emailVerified?: boolean; enabled?: boolean; firstName?: string; lastName?: string; search?: string; username?: string; } export interface RealmUsersGetRequest { realm: string; briefRepresentation?: boolean; email?: string; emailVerified?: boolean; enabled?: boolean; exact?: boolean; first?: number; firstName?: string; idpAlias?: string; idpUserId?: string; lastName?: string; max?: number; q?: string; search?: string; username?: string; } export interface RealmUsersIdConfiguredUserStorageCredentialTypesGetRequest { realm: string; id: string; } export interface RealmUsersIdConsentsClientDeleteRequest { realm: string; id: string; client: string; } export interface RealmUsersIdConsentsGetRequest { realm: string; id: string; } export interface RealmUsersIdCredentialsCredentialIdDeleteRequest { realm: string; id: string; credentialId: string; } export interface RealmUsersIdCredentialsCredentialIdMoveAfterNewPreviousCredentialIdPostRequest { realm: string; id: string; credentialId: string; newPreviousCredentialId: string; } export interface RealmUsersIdCredentialsCredentialIdMoveToFirstPostRequest { realm: string; id: string; credentialId: string; } export interface RealmUsersIdCredentialsCredentialIdUserLabelPutRequest { realm: string; id: string; credentialId: string; body: string; } export interface RealmUsersIdCredentialsGetRequest { realm: string; id: string; } export interface RealmUsersIdDeleteRequest { realm: string; id: string; } export interface RealmUsersIdDisableCredentialTypesPutRequest { realm: string; id: string; requestBody: Array; } export interface RealmUsersIdExecuteActionsEmailPutRequest { realm: string; id: string; requestBody: Array; clientId?: string; lifespan?: number; redirectUri?: string; } export interface RealmUsersIdFederatedIdentityGetRequest { realm: string; id: string; } export interface RealmUsersIdFederatedIdentityProviderDeleteRequest { realm: string; id: string; provider: string; } export interface RealmUsersIdFederatedIdentityProviderPostRequest { realm: string; id: string; provider: string; federatedIdentityRepresentation: FederatedIdentityRepresentation; } export interface RealmUsersIdGetRequest { realm: string; id: string; } export interface RealmUsersIdGroupsCountGetRequest { realm: string; id: string; search?: string; } export interface RealmUsersIdGroupsGetRequest { realm: string; id: string; briefRepresentation?: boolean; first?: number; max?: number; search?: string; } export interface RealmUsersIdGroupsGroupIdDeleteRequest { realm: string; id: string; groupId: string; } export interface RealmUsersIdGroupsGroupIdPutRequest { realm: string; id: string; groupId: string; } export interface RealmUsersIdImpersonationPostRequest { realm: string; id: string; } export interface RealmUsersIdLogoutPostRequest { realm: string; id: string; } export interface RealmUsersIdOfflineSessionsClientUuidGetRequest { realm: string; id: string; clientUuid: string; } export interface RealmUsersIdPutRequest { realm: string; id: string; userRepresentation: UserRepresentation; } export interface RealmUsersIdResetPasswordPutRequest { realm: string; id: string; credentialRepresentation: CredentialRepresentation; } export interface RealmUsersIdSendVerifyEmailPutRequest { realm: string; id: string; clientId?: string; redirectUri?: string; } export interface RealmUsersIdSessionsGetRequest { realm: string; id: string; } export interface RealmUsersPostRequest { realm: string; userRepresentation: UserRepresentation; } export interface RealmUsersProfileGetRequest { realm: string; } export interface RealmUsersProfilePutRequest { realm: string; body: string; } /** * */ export class UsersApi extends runtime.BaseAPI { /** * Returns the number of users that match the given criteria. */ async realmUsersCountGetRaw(requestParameters: RealmUsersCountGetRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersCountGet.'); } const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.email !== undefined) { queryParameters['email'] = requestParameters.email; } if (requestParameters.emailVerified !== undefined) { queryParameters['emailVerified'] = requestParameters.emailVerified; } if (requestParameters.enabled !== undefined) { queryParameters['enabled'] = requestParameters.enabled; } if (requestParameters.firstName !== undefined) { queryParameters['firstName'] = requestParameters.firstName; } if (requestParameters.lastName !== undefined) { queryParameters['lastName'] = requestParameters.lastName; } if (requestParameters.search !== undefined) { queryParameters['search'] = requestParameters.search; } if (requestParameters.username !== undefined) { queryParameters['username'] = requestParameters.username; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/count`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.TextApiResponse(response) as any; } /** * Returns the number of users that match the given criteria. */ async realmUsersCountGet(requestParameters: RealmUsersCountGetRequest): Promise { const response = await this.realmUsersCountGetRaw(requestParameters); return await response.value(); } /** * Get users Returns a stream of users, filtered according to query parameters. */ async realmUsersGetRaw(requestParameters: RealmUsersGetRequest): Promise>> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersGet.'); } const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.briefRepresentation !== undefined) { queryParameters['briefRepresentation'] = requestParameters.briefRepresentation; } if (requestParameters.email !== undefined) { queryParameters['email'] = requestParameters.email; } if (requestParameters.emailVerified !== undefined) { queryParameters['emailVerified'] = requestParameters.emailVerified; } if (requestParameters.enabled !== undefined) { queryParameters['enabled'] = requestParameters.enabled; } if (requestParameters.exact !== undefined) { queryParameters['exact'] = requestParameters.exact; } if (requestParameters.first !== undefined) { queryParameters['first'] = requestParameters.first; } if (requestParameters.firstName !== undefined) { queryParameters['firstName'] = requestParameters.firstName; } if (requestParameters.idpAlias !== undefined) { queryParameters['idpAlias'] = requestParameters.idpAlias; } if (requestParameters.idpUserId !== undefined) { queryParameters['idpUserId'] = requestParameters.idpUserId; } if (requestParameters.lastName !== undefined) { queryParameters['lastName'] = requestParameters.lastName; } if (requestParameters.max !== undefined) { queryParameters['max'] = requestParameters.max; } if (requestParameters.q !== undefined) { queryParameters['q'] = requestParameters.q; } if (requestParameters.search !== undefined) { queryParameters['search'] = requestParameters.search; } if (requestParameters.username !== undefined) { queryParameters['username'] = requestParameters.username; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get users Returns a stream of users, filtered according to query parameters. */ async realmUsersGet(requestParameters: RealmUsersGetRequest): Promise> { const response = await this.realmUsersGetRaw(requestParameters); return await response.value(); } /** * Return credential types, which are provided by the user storage where user is stored. */ async realmUsersIdConfiguredUserStorageCredentialTypesGetRaw(requestParameters: RealmUsersIdConfiguredUserStorageCredentialTypesGetRequest): Promise>> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdConfiguredUserStorageCredentialTypesGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdConfiguredUserStorageCredentialTypesGet.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}/configured-user-storage-credential-types`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Return credential types, which are provided by the user storage where user is stored. */ async realmUsersIdConfiguredUserStorageCredentialTypesGet(requestParameters: RealmUsersIdConfiguredUserStorageCredentialTypesGetRequest): Promise> { const response = await this.realmUsersIdConfiguredUserStorageCredentialTypesGetRaw(requestParameters); return await response.value(); } /** * Revoke consent and offline tokens for particular client from user */ async realmUsersIdConsentsClientDeleteRaw(requestParameters: RealmUsersIdConsentsClientDeleteRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdConsentsClientDelete.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdConsentsClientDelete.'); } if (requestParameters.client === null || requestParameters.client === undefined) { throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling realmUsersIdConsentsClientDelete.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}/consents/{client}`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"client"}}`, encodeURIComponent(String(requestParameters.client))), method: 'DELETE', headers: headerParameters, query: queryParameters, }); return new runtime.VoidApiResponse(response); } /** * Revoke consent and offline tokens for particular client from user */ async realmUsersIdConsentsClientDelete(requestParameters: RealmUsersIdConsentsClientDeleteRequest): Promise { await this.realmUsersIdConsentsClientDeleteRaw(requestParameters); } /** * Get consents granted by the user */ async realmUsersIdConsentsGetRaw(requestParameters: RealmUsersIdConsentsGetRequest): Promise>> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdConsentsGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdConsentsGet.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}/consents`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get consents granted by the user */ async realmUsersIdConsentsGet(requestParameters: RealmUsersIdConsentsGetRequest): Promise> { const response = await this.realmUsersIdConsentsGetRaw(requestParameters); return await response.value(); } /** * Remove a credential for a user */ async realmUsersIdCredentialsCredentialIdDeleteRaw(requestParameters: RealmUsersIdCredentialsCredentialIdDeleteRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdCredentialsCredentialIdDelete.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdCredentialsCredentialIdDelete.'); } if (requestParameters.credentialId === null || requestParameters.credentialId === undefined) { throw new runtime.RequiredError('credentialId','Required parameter requestParameters.credentialId was null or undefined when calling realmUsersIdCredentialsCredentialIdDelete.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}/credentials/{credentialId}`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"credentialId"}}`, encodeURIComponent(String(requestParameters.credentialId))), method: 'DELETE', headers: headerParameters, query: queryParameters, }); return new runtime.VoidApiResponse(response); } /** * Remove a credential for a user */ async realmUsersIdCredentialsCredentialIdDelete(requestParameters: RealmUsersIdCredentialsCredentialIdDeleteRequest): Promise { await this.realmUsersIdCredentialsCredentialIdDeleteRaw(requestParameters); } /** * Move a credential to a position behind another credential */ async realmUsersIdCredentialsCredentialIdMoveAfterNewPreviousCredentialIdPostRaw(requestParameters: RealmUsersIdCredentialsCredentialIdMoveAfterNewPreviousCredentialIdPostRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdCredentialsCredentialIdMoveAfterNewPreviousCredentialIdPost.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdCredentialsCredentialIdMoveAfterNewPreviousCredentialIdPost.'); } if (requestParameters.credentialId === null || requestParameters.credentialId === undefined) { throw new runtime.RequiredError('credentialId','Required parameter requestParameters.credentialId was null or undefined when calling realmUsersIdCredentialsCredentialIdMoveAfterNewPreviousCredentialIdPost.'); } if (requestParameters.newPreviousCredentialId === null || requestParameters.newPreviousCredentialId === undefined) { throw new runtime.RequiredError('newPreviousCredentialId','Required parameter requestParameters.newPreviousCredentialId was null or undefined when calling realmUsersIdCredentialsCredentialIdMoveAfterNewPreviousCredentialIdPost.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}/credentials/{credentialId}/moveAfter/{newPreviousCredentialId}`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"credentialId"}}`, encodeURIComponent(String(requestParameters.credentialId))).replace(`{${"newPreviousCredentialId"}}`, encodeURIComponent(String(requestParameters.newPreviousCredentialId))), method: 'POST', headers: headerParameters, query: queryParameters, }); return new runtime.VoidApiResponse(response); } /** * Move a credential to a position behind another credential */ async realmUsersIdCredentialsCredentialIdMoveAfterNewPreviousCredentialIdPost(requestParameters: RealmUsersIdCredentialsCredentialIdMoveAfterNewPreviousCredentialIdPostRequest): Promise { await this.realmUsersIdCredentialsCredentialIdMoveAfterNewPreviousCredentialIdPostRaw(requestParameters); } /** * Move a credential to a first position in the credentials list of the user */ async realmUsersIdCredentialsCredentialIdMoveToFirstPostRaw(requestParameters: RealmUsersIdCredentialsCredentialIdMoveToFirstPostRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdCredentialsCredentialIdMoveToFirstPost.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdCredentialsCredentialIdMoveToFirstPost.'); } if (requestParameters.credentialId === null || requestParameters.credentialId === undefined) { throw new runtime.RequiredError('credentialId','Required parameter requestParameters.credentialId was null or undefined when calling realmUsersIdCredentialsCredentialIdMoveToFirstPost.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}/credentials/{credentialId}/moveToFirst`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"credentialId"}}`, encodeURIComponent(String(requestParameters.credentialId))), method: 'POST', headers: headerParameters, query: queryParameters, }); return new runtime.VoidApiResponse(response); } /** * Move a credential to a first position in the credentials list of the user */ async realmUsersIdCredentialsCredentialIdMoveToFirstPost(requestParameters: RealmUsersIdCredentialsCredentialIdMoveToFirstPostRequest): Promise { await this.realmUsersIdCredentialsCredentialIdMoveToFirstPostRaw(requestParameters); } /** * Update a credential label for a user */ async realmUsersIdCredentialsCredentialIdUserLabelPutRaw(requestParameters: RealmUsersIdCredentialsCredentialIdUserLabelPutRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdCredentialsCredentialIdUserLabelPut.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdCredentialsCredentialIdUserLabelPut.'); } if (requestParameters.credentialId === null || requestParameters.credentialId === undefined) { throw new runtime.RequiredError('credentialId','Required parameter requestParameters.credentialId was null or undefined when calling realmUsersIdCredentialsCredentialIdUserLabelPut.'); } if (requestParameters.body === null || requestParameters.body === undefined) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling realmUsersIdCredentialsCredentialIdUserLabelPut.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'text/plain'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}/credentials/{credentialId}/userLabel`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"credentialId"}}`, encodeURIComponent(String(requestParameters.credentialId))), method: 'PUT', headers: headerParameters, query: queryParameters, body: requestParameters.body as any, }); return new runtime.VoidApiResponse(response); } /** * Update a credential label for a user */ async realmUsersIdCredentialsCredentialIdUserLabelPut(requestParameters: RealmUsersIdCredentialsCredentialIdUserLabelPutRequest): Promise { await this.realmUsersIdCredentialsCredentialIdUserLabelPutRaw(requestParameters); } /** */ async realmUsersIdCredentialsGetRaw(requestParameters: RealmUsersIdCredentialsGetRequest): Promise>> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdCredentialsGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdCredentialsGet.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}/credentials`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** */ async realmUsersIdCredentialsGet(requestParameters: RealmUsersIdCredentialsGetRequest): Promise> { const response = await this.realmUsersIdCredentialsGetRaw(requestParameters); return await response.value(); } /** * Delete the user */ async realmUsersIdDeleteRaw(requestParameters: RealmUsersIdDeleteRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdDelete.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdDelete.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'DELETE', headers: headerParameters, query: queryParameters, }); return new runtime.VoidApiResponse(response); } /** * Delete the user */ async realmUsersIdDelete(requestParameters: RealmUsersIdDeleteRequest): Promise { await this.realmUsersIdDeleteRaw(requestParameters); } /** * Disable all credentials for a user of a specific type */ async realmUsersIdDisableCredentialTypesPutRaw(requestParameters: RealmUsersIdDisableCredentialTypesPutRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdDisableCredentialTypesPut.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdDisableCredentialTypesPut.'); } if (requestParameters.requestBody === null || requestParameters.requestBody === undefined) { throw new runtime.RequiredError('requestBody','Required parameter requestParameters.requestBody was null or undefined when calling realmUsersIdDisableCredentialTypesPut.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}/disable-credential-types`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'PUT', headers: headerParameters, query: queryParameters, body: requestParameters.requestBody, }); return new runtime.VoidApiResponse(response); } /** * Disable all credentials for a user of a specific type */ async realmUsersIdDisableCredentialTypesPut(requestParameters: RealmUsersIdDisableCredentialTypesPutRequest): Promise { await this.realmUsersIdDisableCredentialTypesPutRaw(requestParameters); } /** * Send a update account email to the user An email contains a link the user can click to perform a set of required actions. */ async realmUsersIdExecuteActionsEmailPutRaw(requestParameters: RealmUsersIdExecuteActionsEmailPutRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdExecuteActionsEmailPut.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdExecuteActionsEmailPut.'); } if (requestParameters.requestBody === null || requestParameters.requestBody === undefined) { throw new runtime.RequiredError('requestBody','Required parameter requestParameters.requestBody was null or undefined when calling realmUsersIdExecuteActionsEmailPut.'); } const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.clientId !== undefined) { queryParameters['client_id'] = requestParameters.clientId; } if (requestParameters.lifespan !== undefined) { queryParameters['lifespan'] = requestParameters.lifespan; } if (requestParameters.redirectUri !== undefined) { queryParameters['redirect_uri'] = requestParameters.redirectUri; } const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}/execute-actions-email`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'PUT', headers: headerParameters, query: queryParameters, body: requestParameters.requestBody, }); return new runtime.VoidApiResponse(response); } /** * Send a update account email to the user An email contains a link the user can click to perform a set of required actions. */ async realmUsersIdExecuteActionsEmailPut(requestParameters: RealmUsersIdExecuteActionsEmailPutRequest): Promise { await this.realmUsersIdExecuteActionsEmailPutRaw(requestParameters); } /** * Get social logins associated with the user */ async realmUsersIdFederatedIdentityGetRaw(requestParameters: RealmUsersIdFederatedIdentityGetRequest): Promise>> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdFederatedIdentityGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdFederatedIdentityGet.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}/federated-identity`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get social logins associated with the user */ async realmUsersIdFederatedIdentityGet(requestParameters: RealmUsersIdFederatedIdentityGetRequest): Promise> { const response = await this.realmUsersIdFederatedIdentityGetRaw(requestParameters); return await response.value(); } /** * Remove a social login provider from user */ async realmUsersIdFederatedIdentityProviderDeleteRaw(requestParameters: RealmUsersIdFederatedIdentityProviderDeleteRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdFederatedIdentityProviderDelete.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdFederatedIdentityProviderDelete.'); } if (requestParameters.provider === null || requestParameters.provider === undefined) { throw new runtime.RequiredError('provider','Required parameter requestParameters.provider was null or undefined when calling realmUsersIdFederatedIdentityProviderDelete.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}/federated-identity/{provider}`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"provider"}}`, encodeURIComponent(String(requestParameters.provider))), method: 'DELETE', headers: headerParameters, query: queryParameters, }); return new runtime.VoidApiResponse(response); } /** * Remove a social login provider from user */ async realmUsersIdFederatedIdentityProviderDelete(requestParameters: RealmUsersIdFederatedIdentityProviderDeleteRequest): Promise { await this.realmUsersIdFederatedIdentityProviderDeleteRaw(requestParameters); } /** * Add a social login provider to the user */ async realmUsersIdFederatedIdentityProviderPostRaw(requestParameters: RealmUsersIdFederatedIdentityProviderPostRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdFederatedIdentityProviderPost.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdFederatedIdentityProviderPost.'); } if (requestParameters.provider === null || requestParameters.provider === undefined) { throw new runtime.RequiredError('provider','Required parameter requestParameters.provider was null or undefined when calling realmUsersIdFederatedIdentityProviderPost.'); } if (requestParameters.federatedIdentityRepresentation === null || requestParameters.federatedIdentityRepresentation === undefined) { throw new runtime.RequiredError('federatedIdentityRepresentation','Required parameter requestParameters.federatedIdentityRepresentation was null or undefined when calling realmUsersIdFederatedIdentityProviderPost.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}/federated-identity/{provider}`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"provider"}}`, encodeURIComponent(String(requestParameters.provider))), method: 'POST', headers: headerParameters, query: queryParameters, body: FederatedIdentityRepresentationToJSON(requestParameters.federatedIdentityRepresentation), }); return new runtime.VoidApiResponse(response); } /** * Add a social login provider to the user */ async realmUsersIdFederatedIdentityProviderPost(requestParameters: RealmUsersIdFederatedIdentityProviderPostRequest): Promise { await this.realmUsersIdFederatedIdentityProviderPostRaw(requestParameters); } /** * Get representation of the user */ async realmUsersIdGetRaw(requestParameters: RealmUsersIdGetRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdGet.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => UserRepresentationFromJSON(jsonValue)); } /** * Get representation of the user */ async realmUsersIdGet(requestParameters: RealmUsersIdGetRequest): Promise { const response = await this.realmUsersIdGetRaw(requestParameters); return await response.value(); } /** */ async realmUsersIdGroupsCountGetRaw(requestParameters: RealmUsersIdGroupsCountGetRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdGroupsCountGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdGroupsCountGet.'); } const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.search !== undefined) { queryParameters['search'] = requestParameters.search; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}/groups/count`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** */ async realmUsersIdGroupsCountGet(requestParameters: RealmUsersIdGroupsCountGetRequest): Promise<{ [key: string]: object; }> { const response = await this.realmUsersIdGroupsCountGetRaw(requestParameters); return await response.value(); } /** */ async realmUsersIdGroupsGetRaw(requestParameters: RealmUsersIdGroupsGetRequest): Promise>> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdGroupsGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdGroupsGet.'); } const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.briefRepresentation !== undefined) { queryParameters['briefRepresentation'] = requestParameters.briefRepresentation; } if (requestParameters.first !== undefined) { queryParameters['first'] = requestParameters.first; } if (requestParameters.max !== undefined) { queryParameters['max'] = requestParameters.max; } if (requestParameters.search !== undefined) { queryParameters['search'] = requestParameters.search; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}/groups`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** */ async realmUsersIdGroupsGet(requestParameters: RealmUsersIdGroupsGetRequest): Promise> { const response = await this.realmUsersIdGroupsGetRaw(requestParameters); return await response.value(); } /** */ async realmUsersIdGroupsGroupIdDeleteRaw(requestParameters: RealmUsersIdGroupsGroupIdDeleteRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdGroupsGroupIdDelete.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdGroupsGroupIdDelete.'); } if (requestParameters.groupId === null || requestParameters.groupId === undefined) { throw new runtime.RequiredError('groupId','Required parameter requestParameters.groupId was null or undefined when calling realmUsersIdGroupsGroupIdDelete.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}/groups/{groupId}`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"groupId"}}`, encodeURIComponent(String(requestParameters.groupId))), method: 'DELETE', headers: headerParameters, query: queryParameters, }); return new runtime.VoidApiResponse(response); } /** */ async realmUsersIdGroupsGroupIdDelete(requestParameters: RealmUsersIdGroupsGroupIdDeleteRequest): Promise { await this.realmUsersIdGroupsGroupIdDeleteRaw(requestParameters); } /** */ async realmUsersIdGroupsGroupIdPutRaw(requestParameters: RealmUsersIdGroupsGroupIdPutRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdGroupsGroupIdPut.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdGroupsGroupIdPut.'); } if (requestParameters.groupId === null || requestParameters.groupId === undefined) { throw new runtime.RequiredError('groupId','Required parameter requestParameters.groupId was null or undefined when calling realmUsersIdGroupsGroupIdPut.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}/groups/{groupId}`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"groupId"}}`, encodeURIComponent(String(requestParameters.groupId))), method: 'PUT', headers: headerParameters, query: queryParameters, }); return new runtime.VoidApiResponse(response); } /** */ async realmUsersIdGroupsGroupIdPut(requestParameters: RealmUsersIdGroupsGroupIdPutRequest): Promise { await this.realmUsersIdGroupsGroupIdPutRaw(requestParameters); } /** * Impersonate the user */ async realmUsersIdImpersonationPostRaw(requestParameters: RealmUsersIdImpersonationPostRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdImpersonationPost.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdImpersonationPost.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}/impersonation`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'POST', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Impersonate the user */ async realmUsersIdImpersonationPost(requestParameters: RealmUsersIdImpersonationPostRequest): Promise<{ [key: string]: object; }> { const response = await this.realmUsersIdImpersonationPostRaw(requestParameters); return await response.value(); } /** * Remove all user sessions associated with the user Also send notification to all clients that have an admin URL to invalidate the sessions for the particular user. */ async realmUsersIdLogoutPostRaw(requestParameters: RealmUsersIdLogoutPostRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdLogoutPost.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdLogoutPost.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}/logout`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'POST', headers: headerParameters, query: queryParameters, }); return new runtime.VoidApiResponse(response); } /** * Remove all user sessions associated with the user Also send notification to all clients that have an admin URL to invalidate the sessions for the particular user. */ async realmUsersIdLogoutPost(requestParameters: RealmUsersIdLogoutPostRequest): Promise { await this.realmUsersIdLogoutPostRaw(requestParameters); } /** * Get offline sessions associated with the user and client */ async realmUsersIdOfflineSessionsClientUuidGetRaw(requestParameters: RealmUsersIdOfflineSessionsClientUuidGetRequest): Promise>> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdOfflineSessionsClientUuidGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdOfflineSessionsClientUuidGet.'); } if (requestParameters.clientUuid === null || requestParameters.clientUuid === undefined) { throw new runtime.RequiredError('clientUuid','Required parameter requestParameters.clientUuid was null or undefined when calling realmUsersIdOfflineSessionsClientUuidGet.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}/offline-sessions/{clientUuid}`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"clientUuid"}}`, encodeURIComponent(String(requestParameters.clientUuid))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get offline sessions associated with the user and client */ async realmUsersIdOfflineSessionsClientUuidGet(requestParameters: RealmUsersIdOfflineSessionsClientUuidGetRequest): Promise> { const response = await this.realmUsersIdOfflineSessionsClientUuidGetRaw(requestParameters); return await response.value(); } /** * Update the user */ async realmUsersIdPutRaw(requestParameters: RealmUsersIdPutRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdPut.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdPut.'); } if (requestParameters.userRepresentation === null || requestParameters.userRepresentation === undefined) { throw new runtime.RequiredError('userRepresentation','Required parameter requestParameters.userRepresentation was null or undefined when calling realmUsersIdPut.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'PUT', headers: headerParameters, query: queryParameters, body: UserRepresentationToJSON(requestParameters.userRepresentation), }); return new runtime.VoidApiResponse(response); } /** * Update the user */ async realmUsersIdPut(requestParameters: RealmUsersIdPutRequest): Promise { await this.realmUsersIdPutRaw(requestParameters); } /** * Set up a new password for the user. */ async realmUsersIdResetPasswordPutRaw(requestParameters: RealmUsersIdResetPasswordPutRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdResetPasswordPut.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdResetPasswordPut.'); } if (requestParameters.credentialRepresentation === null || requestParameters.credentialRepresentation === undefined) { throw new runtime.RequiredError('credentialRepresentation','Required parameter requestParameters.credentialRepresentation was null or undefined when calling realmUsersIdResetPasswordPut.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}/reset-password`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'PUT', headers: headerParameters, query: queryParameters, body: CredentialRepresentationToJSON(requestParameters.credentialRepresentation), }); return new runtime.VoidApiResponse(response); } /** * Set up a new password for the user. */ async realmUsersIdResetPasswordPut(requestParameters: RealmUsersIdResetPasswordPutRequest): Promise { await this.realmUsersIdResetPasswordPutRaw(requestParameters); } /** * Send an email-verification email to the user An email contains a link the user can click to verify their email address. */ async realmUsersIdSendVerifyEmailPutRaw(requestParameters: RealmUsersIdSendVerifyEmailPutRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdSendVerifyEmailPut.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdSendVerifyEmailPut.'); } const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.clientId !== undefined) { queryParameters['client_id'] = requestParameters.clientId; } if (requestParameters.redirectUri !== undefined) { queryParameters['redirect_uri'] = requestParameters.redirectUri; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}/send-verify-email`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'PUT', headers: headerParameters, query: queryParameters, }); return new runtime.VoidApiResponse(response); } /** * Send an email-verification email to the user An email contains a link the user can click to verify their email address. */ async realmUsersIdSendVerifyEmailPut(requestParameters: RealmUsersIdSendVerifyEmailPutRequest): Promise { await this.realmUsersIdSendVerifyEmailPutRaw(requestParameters); } /** * Get sessions associated with the user */ async realmUsersIdSessionsGetRaw(requestParameters: RealmUsersIdSessionsGetRequest): Promise>> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersIdSessionsGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmUsersIdSessionsGet.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/{id}/sessions`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get sessions associated with the user */ async realmUsersIdSessionsGet(requestParameters: RealmUsersIdSessionsGetRequest): Promise> { const response = await this.realmUsersIdSessionsGetRaw(requestParameters); return await response.value(); } /** * Create a new user Username must be unique. */ async realmUsersPostRaw(requestParameters: RealmUsersPostRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersPost.'); } if (requestParameters.userRepresentation === null || requestParameters.userRepresentation === undefined) { throw new runtime.RequiredError('userRepresentation','Required parameter requestParameters.userRepresentation was null or undefined when calling realmUsersPost.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))), method: 'POST', headers: headerParameters, query: queryParameters, body: UserRepresentationToJSON(requestParameters.userRepresentation), }); return new runtime.VoidApiResponse(response); } /** * Create a new user Username must be unique. */ async realmUsersPost(requestParameters: RealmUsersPostRequest): Promise { await this.realmUsersPostRaw(requestParameters); } /** */ async realmUsersProfileGetRaw(requestParameters: RealmUsersProfileGetRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersProfileGet.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/profile`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.TextApiResponse(response) as any; } /** */ async realmUsersProfileGet(requestParameters: RealmUsersProfileGetRequest): Promise { const response = await this.realmUsersProfileGetRaw(requestParameters); return await response.value(); } /** */ async realmUsersProfilePutRaw(requestParameters: RealmUsersProfilePutRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmUsersProfilePut.'); } if (requestParameters.body === null || requestParameters.body === undefined) { throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling realmUsersProfilePut.'); } const queryParameters: runtime.HTTPQuery = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = typeof token === 'function' ? token("access_token", []) : token; if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/{realm}/users/profile`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))), method: 'PUT', headers: headerParameters, query: queryParameters, body: requestParameters.body as any, }); return new runtime.VoidApiResponse(response); } /** */ async realmUsersProfilePut(requestParameters: RealmUsersProfilePutRequest): Promise { await this.realmUsersProfilePutRaw(requestParameters); } }