Files
auth/backend/keycloak/kc-client/apis/ComponentApi.ts
2022-09-05 17:02:45 +02:00

324 lines
13 KiB
TypeScript

/* 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<runtime.ApiResponse<Array<{ [key: string]: object; }>>> {
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<any>(response);
}
/**
*/
async realmComponentsGet(requestParameters: RealmComponentsGetRequest): Promise<Array<{ [key: string]: object; }>> {
const response = await this.realmComponentsGetRaw(requestParameters);
return await response.value();
}
/**
*/
async realmComponentsIdDeleteRaw(requestParameters: RealmComponentsIdDeleteRequest): Promise<runtime.ApiResponse<void>> {
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<void> {
await this.realmComponentsIdDeleteRaw(requestParameters);
}
/**
*/
async realmComponentsIdGetRaw(requestParameters: RealmComponentsIdGetRequest): Promise<runtime.ApiResponse<ComponentRepresentation>> {
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<ComponentRepresentation> {
const response = await this.realmComponentsIdGetRaw(requestParameters);
return await response.value();
}
/**
*/
async realmComponentsIdPutRaw(requestParameters: RealmComponentsIdPutRequest): Promise<runtime.ApiResponse<void>> {
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<void> {
await this.realmComponentsIdPutRaw(requestParameters);
}
/**
* List of subcomponent types that are available to configure for a particular parent component.
*/
async realmComponentsIdSubComponentTypesGetRaw(requestParameters: RealmComponentsIdSubComponentTypesGetRequest): Promise<runtime.ApiResponse<Array<{ [key: string]: object; }>>> {
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<any>(response);
}
/**
* List of subcomponent types that are available to configure for a particular parent component.
*/
async realmComponentsIdSubComponentTypesGet(requestParameters: RealmComponentsIdSubComponentTypesGetRequest): Promise<Array<{ [key: string]: object; }>> {
const response = await this.realmComponentsIdSubComponentTypesGetRaw(requestParameters);
return await response.value();
}
/**
*/
async realmComponentsPostRaw(requestParameters: RealmComponentsPostRequest): Promise<runtime.ApiResponse<void>> {
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<void> {
await this.realmComponentsPostRaw(requestParameters);
}
}