/* 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 { ClientScopeRepresentation, ClientScopeRepresentationFromJSON, ClientScopeRepresentationToJSON, } from '../models'; export interface RealmClientScopesGetRequest { realm: string; } export interface RealmClientScopesIdDeleteRequest { realm: string; id: string; } export interface RealmClientScopesIdGetRequest { realm: string; id: string; } export interface RealmClientScopesIdPutRequest { realm: string; id: string; clientScopeRepresentation: ClientScopeRepresentation; } export interface RealmClientScopesPostRequest { realm: string; clientScopeRepresentation: ClientScopeRepresentation; } /** * */ export class ClientScopesApi extends runtime.BaseAPI { /** * Get client scopes belonging to the realm Returns a list of client scopes belonging to the realm */ async realmClientScopesGetRaw(requestParameters: RealmClientScopesGetRequest): Promise>> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientScopesGet.'); } 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`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * Get client scopes belonging to the realm Returns a list of client scopes belonging to the realm */ async realmClientScopesGet(requestParameters: RealmClientScopesGetRequest): Promise> { const response = await this.realmClientScopesGetRaw(requestParameters); return await response.value(); } /** * Delete the client scope */ async realmClientScopesIdDeleteRaw(requestParameters: RealmClientScopesIdDeleteRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientScopesIdDelete.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientScopesIdDelete.'); } 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}`.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 client scope */ async realmClientScopesIdDelete(requestParameters: RealmClientScopesIdDeleteRequest): Promise { await this.realmClientScopesIdDeleteRaw(requestParameters); } /** * Get representation of the client scope */ async realmClientScopesIdGetRaw(requestParameters: RealmClientScopesIdGetRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientScopesIdGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientScopesIdGet.'); } 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}`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response, (jsonValue) => ClientScopeRepresentationFromJSON(jsonValue)); } /** * Get representation of the client scope */ async realmClientScopesIdGet(requestParameters: RealmClientScopesIdGetRequest): Promise { const response = await this.realmClientScopesIdGetRaw(requestParameters); return await response.value(); } /** * Update the client scope */ async realmClientScopesIdPutRaw(requestParameters: RealmClientScopesIdPutRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientScopesIdPut.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientScopesIdPut.'); } if (requestParameters.clientScopeRepresentation === null || requestParameters.clientScopeRepresentation === undefined) { throw new runtime.RequiredError('clientScopeRepresentation','Required parameter requestParameters.clientScopeRepresentation was null or undefined when calling realmClientScopesIdPut.'); } 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}`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'PUT', headers: headerParameters, query: queryParameters, body: ClientScopeRepresentationToJSON(requestParameters.clientScopeRepresentation), }); return new runtime.VoidApiResponse(response); } /** * Update the client scope */ async realmClientScopesIdPut(requestParameters: RealmClientScopesIdPutRequest): Promise { await this.realmClientScopesIdPutRaw(requestParameters); } /** * Create a new client scope Client Scope’s name must be unique! */ async realmClientScopesPostRaw(requestParameters: RealmClientScopesPostRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientScopesPost.'); } if (requestParameters.clientScopeRepresentation === null || requestParameters.clientScopeRepresentation === undefined) { throw new runtime.RequiredError('clientScopeRepresentation','Required parameter requestParameters.clientScopeRepresentation was null or undefined when calling realmClientScopesPost.'); } 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`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))), method: 'POST', headers: headerParameters, query: queryParameters, body: ClientScopeRepresentationToJSON(requestParameters.clientScopeRepresentation), }); return new runtime.VoidApiResponse(response); } /** * Create a new client scope Client Scope’s name must be unique! */ async realmClientScopesPost(requestParameters: RealmClientScopesPostRequest): Promise { await this.realmClientScopesPostRaw(requestParameters); } }