/* 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 { ComponentRepresentation, ComponentRepresentationFromJSON, ComponentRepresentationToJSON, } from '../models'; export interface RealmComponentsGetRequest { realm: string; name?: string; parent?: string; type?: string; } export interface RealmComponentsIdDeleteRequest { realm: string; id: string; } export interface RealmComponentsIdGetRequest { realm: string; id: string; } export interface RealmComponentsIdPutRequest { realm: string; id: string; componentRepresentation: ComponentRepresentation; } export interface RealmComponentsIdSubComponentTypesGetRequest { realm: string; id: string; type?: string; } export interface RealmComponentsPostRequest { realm: string; componentRepresentation: ComponentRepresentation; } /** * */ export class ComponentApi extends runtime.BaseAPI { /** */ async realmComponentsGetRaw(requestParameters: RealmComponentsGetRequest): Promise>> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmComponentsGet.'); } const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.name !== undefined) { queryParameters['name'] = requestParameters.name; } if (requestParameters.parent !== undefined) { queryParameters['parent'] = requestParameters.parent; } if (requestParameters.type !== undefined) { queryParameters['type'] = requestParameters.type; } 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}/components`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** */ async realmComponentsGet(requestParameters: RealmComponentsGetRequest): Promise> { const response = await this.realmComponentsGetRaw(requestParameters); return await response.value(); } /** */ async realmComponentsIdDeleteRaw(requestParameters: RealmComponentsIdDeleteRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmComponentsIdDelete.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmComponentsIdDelete.'); } 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}/components/{id}`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'DELETE', headers: headerParameters, query: queryParameters, }); return new runtime.VoidApiResponse(response); } /** */ async realmComponentsIdDelete(requestParameters: RealmComponentsIdDeleteRequest): Promise { await this.realmComponentsIdDeleteRaw(requestParameters); } /** */ async realmComponentsIdGetRaw(requestParameters: RealmComponentsIdGetRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmComponentsIdGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmComponentsIdGet.'); } 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}/components/{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) => ComponentRepresentationFromJSON(jsonValue)); } /** */ async realmComponentsIdGet(requestParameters: RealmComponentsIdGetRequest): Promise { const response = await this.realmComponentsIdGetRaw(requestParameters); return await response.value(); } /** */ async realmComponentsIdPutRaw(requestParameters: RealmComponentsIdPutRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmComponentsIdPut.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmComponentsIdPut.'); } if (requestParameters.componentRepresentation === null || requestParameters.componentRepresentation === undefined) { throw new runtime.RequiredError('componentRepresentation','Required parameter requestParameters.componentRepresentation was null or undefined when calling realmComponentsIdPut.'); } 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}/components/{id}`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'PUT', headers: headerParameters, query: queryParameters, body: ComponentRepresentationToJSON(requestParameters.componentRepresentation), }); return new runtime.VoidApiResponse(response); } /** */ async realmComponentsIdPut(requestParameters: RealmComponentsIdPutRequest): Promise { await this.realmComponentsIdPutRaw(requestParameters); } /** * List of subcomponent types that are available to configure for a particular parent component. */ async realmComponentsIdSubComponentTypesGetRaw(requestParameters: RealmComponentsIdSubComponentTypesGetRequest): Promise>> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmComponentsIdSubComponentTypesGet.'); } if (requestParameters.id === null || requestParameters.id === undefined) { throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmComponentsIdSubComponentTypesGet.'); } const queryParameters: runtime.HTTPQuery = {}; if (requestParameters.type !== undefined) { queryParameters['type'] = requestParameters.type; } 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}/components/{id}/sub-component-types`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), method: 'GET', headers: headerParameters, query: queryParameters, }); return new runtime.JSONApiResponse(response); } /** * List of subcomponent types that are available to configure for a particular parent component. */ async realmComponentsIdSubComponentTypesGet(requestParameters: RealmComponentsIdSubComponentTypesGetRequest): Promise> { const response = await this.realmComponentsIdSubComponentTypesGetRaw(requestParameters); return await response.value(); } /** */ async realmComponentsPostRaw(requestParameters: RealmComponentsPostRequest): Promise> { if (requestParameters.realm === null || requestParameters.realm === undefined) { throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmComponentsPost.'); } if (requestParameters.componentRepresentation === null || requestParameters.componentRepresentation === undefined) { throw new runtime.RequiredError('componentRepresentation','Required parameter requestParameters.componentRepresentation was null or undefined when calling realmComponentsPost.'); } 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}/components`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))), method: 'POST', headers: headerParameters, query: queryParameters, body: ComponentRepresentationToJSON(requestParameters.componentRepresentation), }); return new runtime.VoidApiResponse(response); } /** */ async realmComponentsPost(requestParameters: RealmComponentsPostRequest): Promise { await this.realmComponentsPostRaw(requestParameters); } }