/* 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 { RoleRepresentation, RoleRepresentationFromJSON, RoleRepresentationToJSON, } from '../models'; export interface RealmClientScopesIdScopeMappingsClientsClientAvailableGetRequest { realm: string; id: string; client: string; } export interface RealmClientScopesIdScopeMappingsClientsClientCompositeGetRequest { realm: string; id: string; client: string; briefRepresentation?: boolean; } export interface RealmClientScopesIdScopeMappingsClientsClientDeleteRequest { realm: string; id: string; client: string; roleRepresentation: Array; } export interface RealmClientScopesIdScopeMappingsClientsClientGetRequest { realm: string; id: string; client: string; } export interface RealmClientScopesIdScopeMappingsClientsClientPostRequest { realm: string; id: string; client: string; roleRepresentation: Array; } export interface RealmClientScopesIdScopeMappingsRealmAvailableGetRequest { realm: string; id: string; } export interface RealmClientScopesIdScopeMappingsRealmCompositeGetRequest { realm: string; id: string; briefRepresentation?: boolean; } export interface RealmClientScopesIdScopeMappingsRealmDeleteRequest { realm: string; id: string; roleRepresentation: Array; } export interface RealmClientScopesIdScopeMappingsRealmGetRequest { realm: string; id: string; } export interface RealmClientScopesIdScopeMappingsRealmPostRequest { realm: string; id: string; roleRepresentation: Array; } export interface RealmClientsIdScopeMappingsClientsClientAvailableGetRequest { realm: string; id: string; client: string; } export interface RealmClientsIdScopeMappingsClientsClientCompositeGetRequest { realm: string; id: string; client: string; briefRepresentation?: boolean; } export interface RealmClientsIdScopeMappingsClientsClientDeleteRequest { realm: string; id: string; client: string; roleRepresentation: Array; } export interface RealmClientsIdScopeMappingsClientsClientGetRequest { realm: string; id: string; client: string; } export interface RealmClientsIdScopeMappingsClientsClientPostRequest { realm: string; id: string; client: string; roleRepresentation: Array; } export interface RealmClientsIdScopeMappingsRealmAvailableGetRequest { realm: string; id: string; } export interface RealmClientsIdScopeMappingsRealmCompositeGetRequest { realm: string; id: string; briefRepresentation?: boolean; } export interface RealmClientsIdScopeMappingsRealmDeleteRequest { realm: string; id: string; roleRepresentation: Array; } export interface RealmClientsIdScopeMappingsRealmGetRequest { realm: string; id: string; } export interface RealmClientsIdScopeMappingsRealmPostRequest { realm: string; id: string; roleRepresentation: Array; } /** * */ export class ScopeMappingsApi extends runtime.BaseAPI { /** * The available client-level roles Returns the roles for the client that can be associated with the client’s scope */ async realmClientScopesIdScopeMappingsClientsClientAvailableGetRaw(requestParameters: RealmClientScopesIdScopeMappingsClientsClientAvailableGetRequest): Promise>> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientScopesIdScopeMappingsClientsClientAvailableGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientScopesIdScopeMappingsClientsClientAvailableGet.'); } if (requestParameters.client === null || requestParameters.client === undefined) { throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling realmClientScopesIdScopeMappingsClientsClientAvailableGet.'); } 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}/client-scopes/{id}/scope-mappings/clients/{client}/available`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"client"}}`, encodeURIComponent(String(requestParameters.client))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * The available client-level roles Returns the roles for the client that can be associated with the client’s scope */ async realmClientScopesIdScopeMappingsClientsClientAvailableGet(requestParameters: RealmClientScopesIdScopeMappingsClientsClientAvailableGetRequest): Promise> { const response = await this.realmClientScopesIdScopeMappingsClientsClientAvailableGetRaw(requestParameters); return await response.value(); } /** * Get effective client roles Returns the roles for the client that are associated with the client’s scope. */ async realmClientScopesIdScopeMappingsClientsClientCompositeGetRaw(requestParameters: RealmClientScopesIdScopeMappingsClientsClientCompositeGetRequest): Promise>> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientScopesIdScopeMappingsClientsClientCompositeGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientScopesIdScopeMappingsClientsClientCompositeGet.'); } if (requestParameters.client === null || requestParameters.client === undefined) { throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling realmClientScopesIdScopeMappingsClientsClientCompositeGet.'); } const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.briefRepresentation !== undefined) { queryParameters['briefRepresentation'] = requestParameters.briefRepresentation; } 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}/client-scopes/{id}/scope-mappings/clients/{client}/composite`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"client"}}`, encodeURIComponent(String(requestParameters.client))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get effective client roles Returns the roles for the client that are associated with the client’s scope. */ async realmClientScopesIdScopeMappingsClientsClientCompositeGet(requestParameters: RealmClientScopesIdScopeMappingsClientsClientCompositeGetRequest): Promise> { const response = await this.realmClientScopesIdScopeMappingsClientsClientCompositeGetRaw(requestParameters); return await response.value(); } /** * Remove client-level roles from the client’s scope. */ async realmClientScopesIdScopeMappingsClientsClientDeleteRaw(requestParameters: RealmClientScopesIdScopeMappingsClientsClientDeleteRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientScopesIdScopeMappingsClientsClientDelete.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientScopesIdScopeMappingsClientsClientDelete.'); } if (requestParameters.client === null || requestParameters.client === undefined) { throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling realmClientScopesIdScopeMappingsClientsClientDelete.'); } if (requestParameters.roleRepresentation === null || requestParameters.roleRepresentation === undefined) { throw new runtime.RequiredError('roleRepresentation','Required parameter requestParameters.roleRepresentation was null or undefined when calling realmClientScopesIdScopeMappingsClientsClientDelete.'); } 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}/client-scopes/{id}/scope-mappings/clients/{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, body: requestParameters.roleRepresentation.map(RoleRepresentationToJSON), }); return new runtime.VoidApiResponse(response); } /** * Remove client-level roles from the client’s scope. */ async realmClientScopesIdScopeMappingsClientsClientDelete(requestParameters: RealmClientScopesIdScopeMappingsClientsClientDeleteRequest): Promise { await this.realmClientScopesIdScopeMappingsClientsClientDeleteRaw(requestParameters); } /** * Get the roles associated with a client’s scope Returns roles for the client. */ async realmClientScopesIdScopeMappingsClientsClientGetRaw(requestParameters: RealmClientScopesIdScopeMappingsClientsClientGetRequest): Promise>> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientScopesIdScopeMappingsClientsClientGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientScopesIdScopeMappingsClientsClientGet.'); } if (requestParameters.client === null || requestParameters.client === undefined) { throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling realmClientScopesIdScopeMappingsClientsClientGet.'); } 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}/client-scopes/{id}/scope-mappings/clients/{client}`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"client"}}`, encodeURIComponent(String(requestParameters.client))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get the roles associated with a client’s scope Returns roles for the client. */ async realmClientScopesIdScopeMappingsClientsClientGet(requestParameters: RealmClientScopesIdScopeMappingsClientsClientGetRequest): Promise> { const response = await this.realmClientScopesIdScopeMappingsClientsClientGetRaw(requestParameters); return await response.value(); } /** * Add client-level roles to the client’s scope */ async realmClientScopesIdScopeMappingsClientsClientPostRaw(requestParameters: RealmClientScopesIdScopeMappingsClientsClientPostRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientScopesIdScopeMappingsClientsClientPost.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientScopesIdScopeMappingsClientsClientPost.'); } if (requestParameters.client === null || requestParameters.client === undefined) { throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling realmClientScopesIdScopeMappingsClientsClientPost.'); } if (requestParameters.roleRepresentation === null || requestParameters.roleRepresentation === undefined) { throw new runtime.RequiredError('roleRepresentation','Required parameter requestParameters.roleRepresentation was null or undefined when calling realmClientScopesIdScopeMappingsClientsClientPost.'); } 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}/client-scopes/{id}/scope-mappings/clients/{client}`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"client"}}`, encodeURIComponent(String(requestParameters.client))), method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters.roleRepresentation.map(RoleRepresentationToJSON), }); return new runtime.VoidApiResponse(response); } /** * Add client-level roles to the client’s scope */ async realmClientScopesIdScopeMappingsClientsClientPost(requestParameters: RealmClientScopesIdScopeMappingsClientsClientPostRequest): Promise { await this.realmClientScopesIdScopeMappingsClientsClientPostRaw(requestParameters); } /** * Get realm-level roles that are available to attach to this client’s scope */ async realmClientScopesIdScopeMappingsRealmAvailableGetRaw(requestParameters: RealmClientScopesIdScopeMappingsRealmAvailableGetRequest): Promise>> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientScopesIdScopeMappingsRealmAvailableGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientScopesIdScopeMappingsRealmAvailableGet.'); } 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}/client-scopes/{id}/scope-mappings/realm/available`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get realm-level roles that are available to attach to this client’s scope */ async realmClientScopesIdScopeMappingsRealmAvailableGet(requestParameters: RealmClientScopesIdScopeMappingsRealmAvailableGetRequest): Promise> { const response = await this.realmClientScopesIdScopeMappingsRealmAvailableGetRaw(requestParameters); return await response.value(); } /** * Get effective realm-level roles associated with the client’s scope What this does is recurse any composite roles associated with the client’s scope and adds the roles to this lists. */ async realmClientScopesIdScopeMappingsRealmCompositeGetRaw(requestParameters: RealmClientScopesIdScopeMappingsRealmCompositeGetRequest): Promise>> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientScopesIdScopeMappingsRealmCompositeGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientScopesIdScopeMappingsRealmCompositeGet.'); } const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.briefRepresentation !== undefined) { queryParameters['briefRepresentation'] = requestParameters.briefRepresentation; } 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}/client-scopes/{id}/scope-mappings/realm/composite`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get effective realm-level roles associated with the client’s scope What this does is recurse any composite roles associated with the client’s scope and adds the roles to this lists. */ async realmClientScopesIdScopeMappingsRealmCompositeGet(requestParameters: RealmClientScopesIdScopeMappingsRealmCompositeGetRequest): Promise> { const response = await this.realmClientScopesIdScopeMappingsRealmCompositeGetRaw(requestParameters); return await response.value(); } /** * Remove a set of realm-level roles from the client’s scope */ async realmClientScopesIdScopeMappingsRealmDeleteRaw(requestParameters: RealmClientScopesIdScopeMappingsRealmDeleteRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientScopesIdScopeMappingsRealmDelete.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientScopesIdScopeMappingsRealmDelete.'); } if (requestParameters.roleRepresentation === null || requestParameters.roleRepresentation === undefined) { throw new runtime.RequiredError('roleRepresentation','Required parameter requestParameters.roleRepresentation was null or undefined when calling realmClientScopesIdScopeMappingsRealmDelete.'); } 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}/client-scopes/{id}/scope-mappings/realm`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'DELETE', headers: headerParameters, query: queryParameters, body: requestParameters.roleRepresentation.map(RoleRepresentationToJSON), }); return new runtime.VoidApiResponse(response); } /** * Remove a set of realm-level roles from the client’s scope */ async realmClientScopesIdScopeMappingsRealmDelete(requestParameters: RealmClientScopesIdScopeMappingsRealmDeleteRequest): Promise { await this.realmClientScopesIdScopeMappingsRealmDeleteRaw(requestParameters); } /** * Get realm-level roles associated with the client’s scope */ async realmClientScopesIdScopeMappingsRealmGetRaw(requestParameters: RealmClientScopesIdScopeMappingsRealmGetRequest): Promise>> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientScopesIdScopeMappingsRealmGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientScopesIdScopeMappingsRealmGet.'); } 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}/client-scopes/{id}/scope-mappings/realm`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get realm-level roles associated with the client’s scope */ async realmClientScopesIdScopeMappingsRealmGet(requestParameters: RealmClientScopesIdScopeMappingsRealmGetRequest): Promise> { const response = await this.realmClientScopesIdScopeMappingsRealmGetRaw(requestParameters); return await response.value(); } /** * Add a set of realm-level roles to the client’s scope */ async realmClientScopesIdScopeMappingsRealmPostRaw(requestParameters: RealmClientScopesIdScopeMappingsRealmPostRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientScopesIdScopeMappingsRealmPost.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientScopesIdScopeMappingsRealmPost.'); } if (requestParameters.roleRepresentation === null || requestParameters.roleRepresentation === undefined) { throw new runtime.RequiredError('roleRepresentation','Required parameter requestParameters.roleRepresentation was null or undefined when calling realmClientScopesIdScopeMappingsRealmPost.'); } 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}/client-scopes/{id}/scope-mappings/realm`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters.roleRepresentation.map(RoleRepresentationToJSON), }); return new runtime.VoidApiResponse(response); } /** * Add a set of realm-level roles to the client’s scope */ async realmClientScopesIdScopeMappingsRealmPost(requestParameters: RealmClientScopesIdScopeMappingsRealmPostRequest): Promise { await this.realmClientScopesIdScopeMappingsRealmPostRaw(requestParameters); } /** * The available client-level roles Returns the roles for the client that can be associated with the client’s scope */ async realmClientsIdScopeMappingsClientsClientAvailableGetRaw(requestParameters: RealmClientsIdScopeMappingsClientsClientAvailableGetRequest): Promise>> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientsIdScopeMappingsClientsClientAvailableGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientsIdScopeMappingsClientsClientAvailableGet.'); } if (requestParameters.client === null || requestParameters.client === undefined) { throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling realmClientsIdScopeMappingsClientsClientAvailableGet.'); } 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}/clients/{id}/scope-mappings/clients/{client}/available`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"client"}}`, encodeURIComponent(String(requestParameters.client))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * The available client-level roles Returns the roles for the client that can be associated with the client’s scope */ async realmClientsIdScopeMappingsClientsClientAvailableGet(requestParameters: RealmClientsIdScopeMappingsClientsClientAvailableGetRequest): Promise> { const response = await this.realmClientsIdScopeMappingsClientsClientAvailableGetRaw(requestParameters); return await response.value(); } /** * Get effective client roles Returns the roles for the client that are associated with the client’s scope. */ async realmClientsIdScopeMappingsClientsClientCompositeGetRaw(requestParameters: RealmClientsIdScopeMappingsClientsClientCompositeGetRequest): Promise>> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientsIdScopeMappingsClientsClientCompositeGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientsIdScopeMappingsClientsClientCompositeGet.'); } if (requestParameters.client === null || requestParameters.client === undefined) { throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling realmClientsIdScopeMappingsClientsClientCompositeGet.'); } const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.briefRepresentation !== undefined) { queryParameters['briefRepresentation'] = requestParameters.briefRepresentation; } 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}/clients/{id}/scope-mappings/clients/{client}/composite`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"client"}}`, encodeURIComponent(String(requestParameters.client))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get effective client roles Returns the roles for the client that are associated with the client’s scope. */ async realmClientsIdScopeMappingsClientsClientCompositeGet(requestParameters: RealmClientsIdScopeMappingsClientsClientCompositeGetRequest): Promise> { const response = await this.realmClientsIdScopeMappingsClientsClientCompositeGetRaw(requestParameters); return await response.value(); } /** * Remove client-level roles from the client’s scope. */ async realmClientsIdScopeMappingsClientsClientDeleteRaw(requestParameters: RealmClientsIdScopeMappingsClientsClientDeleteRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientsIdScopeMappingsClientsClientDelete.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientsIdScopeMappingsClientsClientDelete.'); } if (requestParameters.client === null || requestParameters.client === undefined) { throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling realmClientsIdScopeMappingsClientsClientDelete.'); } if (requestParameters.roleRepresentation === null || requestParameters.roleRepresentation === undefined) { throw new runtime.RequiredError('roleRepresentation','Required parameter requestParameters.roleRepresentation was null or undefined when calling realmClientsIdScopeMappingsClientsClientDelete.'); } 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}/clients/{id}/scope-mappings/clients/{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, body: requestParameters.roleRepresentation.map(RoleRepresentationToJSON), }); return new runtime.VoidApiResponse(response); } /** * Remove client-level roles from the client’s scope. */ async realmClientsIdScopeMappingsClientsClientDelete(requestParameters: RealmClientsIdScopeMappingsClientsClientDeleteRequest): Promise { await this.realmClientsIdScopeMappingsClientsClientDeleteRaw(requestParameters); } /** * Get the roles associated with a client’s scope Returns roles for the client. */ async realmClientsIdScopeMappingsClientsClientGetRaw(requestParameters: RealmClientsIdScopeMappingsClientsClientGetRequest): Promise>> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientsIdScopeMappingsClientsClientGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientsIdScopeMappingsClientsClientGet.'); } if (requestParameters.client === null || requestParameters.client === undefined) { throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling realmClientsIdScopeMappingsClientsClientGet.'); } 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}/clients/{id}/scope-mappings/clients/{client}`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"client"}}`, encodeURIComponent(String(requestParameters.client))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get the roles associated with a client’s scope Returns roles for the client. */ async realmClientsIdScopeMappingsClientsClientGet(requestParameters: RealmClientsIdScopeMappingsClientsClientGetRequest): Promise> { const response = await this.realmClientsIdScopeMappingsClientsClientGetRaw(requestParameters); return await response.value(); } /** * Add client-level roles to the client’s scope */ async realmClientsIdScopeMappingsClientsClientPostRaw(requestParameters: RealmClientsIdScopeMappingsClientsClientPostRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientsIdScopeMappingsClientsClientPost.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientsIdScopeMappingsClientsClientPost.'); } if (requestParameters.client === null || requestParameters.client === undefined) { throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling realmClientsIdScopeMappingsClientsClientPost.'); } if (requestParameters.roleRepresentation === null || requestParameters.roleRepresentation === undefined) { throw new runtime.RequiredError('roleRepresentation','Required parameter requestParameters.roleRepresentation was null or undefined when calling realmClientsIdScopeMappingsClientsClientPost.'); } 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}/clients/{id}/scope-mappings/clients/{client}`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"client"}}`, encodeURIComponent(String(requestParameters.client))), method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters.roleRepresentation.map(RoleRepresentationToJSON), }); return new runtime.VoidApiResponse(response); } /** * Add client-level roles to the client’s scope */ async realmClientsIdScopeMappingsClientsClientPost(requestParameters: RealmClientsIdScopeMappingsClientsClientPostRequest): Promise { await this.realmClientsIdScopeMappingsClientsClientPostRaw(requestParameters); } /** * Get realm-level roles that are available to attach to this client’s scope */ async realmClientsIdScopeMappingsRealmAvailableGetRaw(requestParameters: RealmClientsIdScopeMappingsRealmAvailableGetRequest): Promise>> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientsIdScopeMappingsRealmAvailableGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientsIdScopeMappingsRealmAvailableGet.'); } 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}/clients/{id}/scope-mappings/realm/available`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get realm-level roles that are available to attach to this client’s scope */ async realmClientsIdScopeMappingsRealmAvailableGet(requestParameters: RealmClientsIdScopeMappingsRealmAvailableGetRequest): Promise> { const response = await this.realmClientsIdScopeMappingsRealmAvailableGetRaw(requestParameters); return await response.value(); } /** * Get effective realm-level roles associated with the client’s scope What this does is recurse any composite roles associated with the client’s scope and adds the roles to this lists. */ async realmClientsIdScopeMappingsRealmCompositeGetRaw(requestParameters: RealmClientsIdScopeMappingsRealmCompositeGetRequest): Promise>> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientsIdScopeMappingsRealmCompositeGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientsIdScopeMappingsRealmCompositeGet.'); } const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.briefRepresentation !== undefined) { queryParameters['briefRepresentation'] = requestParameters.briefRepresentation; } 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}/clients/{id}/scope-mappings/realm/composite`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get effective realm-level roles associated with the client’s scope What this does is recurse any composite roles associated with the client’s scope and adds the roles to this lists. */ async realmClientsIdScopeMappingsRealmCompositeGet(requestParameters: RealmClientsIdScopeMappingsRealmCompositeGetRequest): Promise> { const response = await this.realmClientsIdScopeMappingsRealmCompositeGetRaw(requestParameters); return await response.value(); } /** * Remove a set of realm-level roles from the client’s scope */ async realmClientsIdScopeMappingsRealmDeleteRaw(requestParameters: RealmClientsIdScopeMappingsRealmDeleteRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientsIdScopeMappingsRealmDelete.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientsIdScopeMappingsRealmDelete.'); } if (requestParameters.roleRepresentation === null || requestParameters.roleRepresentation === undefined) { throw new runtime.RequiredError('roleRepresentation','Required parameter requestParameters.roleRepresentation was null or undefined when calling realmClientsIdScopeMappingsRealmDelete.'); } 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}/clients/{id}/scope-mappings/realm`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'DELETE', headers: headerParameters, query: queryParameters, body: requestParameters.roleRepresentation.map(RoleRepresentationToJSON), }); return new runtime.VoidApiResponse(response); } /** * Remove a set of realm-level roles from the client’s scope */ async realmClientsIdScopeMappingsRealmDelete(requestParameters: RealmClientsIdScopeMappingsRealmDeleteRequest): Promise { await this.realmClientsIdScopeMappingsRealmDeleteRaw(requestParameters); } /** * Get realm-level roles associated with the client’s scope */ async realmClientsIdScopeMappingsRealmGetRaw(requestParameters: RealmClientsIdScopeMappingsRealmGetRequest): Promise>> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientsIdScopeMappingsRealmGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientsIdScopeMappingsRealmGet.'); } 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}/clients/{id}/scope-mappings/realm`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get realm-level roles associated with the client’s scope */ async realmClientsIdScopeMappingsRealmGet(requestParameters: RealmClientsIdScopeMappingsRealmGetRequest): Promise> { const response = await this.realmClientsIdScopeMappingsRealmGetRaw(requestParameters); return await response.value(); } /** * Add a set of realm-level roles to the client’s scope */ async realmClientsIdScopeMappingsRealmPostRaw(requestParameters: RealmClientsIdScopeMappingsRealmPostRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientsIdScopeMappingsRealmPost.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientsIdScopeMappingsRealmPost.'); } if (requestParameters.roleRepresentation === null || requestParameters.roleRepresentation === undefined) { throw new runtime.RequiredError('roleRepresentation','Required parameter requestParameters.roleRepresentation was null or undefined when calling realmClientsIdScopeMappingsRealmPost.'); } 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}/clients/{id}/scope-mappings/realm`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters.roleRepresentation.map(RoleRepresentationToJSON), }); return new runtime.VoidApiResponse(response); } /** * Add a set of realm-level roles to the client’s scope */ async realmClientsIdScopeMappingsRealmPost(requestParameters: RealmClientsIdScopeMappingsRealmPostRequest): Promise { await this.realmClientsIdScopeMappingsRealmPostRaw(requestParameters); } }