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

267 lines
11 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* 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<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 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<any>(response);
}
/**
* Get client scopes belonging to the realm Returns a list of client scopes belonging to the realm
*/
async realmClientScopesGet(requestParameters: RealmClientScopesGetRequest): Promise<Array<{ [key: string]: object; }>> {
const response = await this.realmClientScopesGetRaw(requestParameters);
return await response.value();
}
/**
* Delete the client scope
*/
async realmClientScopesIdDeleteRaw(requestParameters: RealmClientScopesIdDeleteRequest): 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 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<void> {
await this.realmClientScopesIdDeleteRaw(requestParameters);
}
/**
* Get representation of the client scope
*/
async realmClientScopesIdGetRaw(requestParameters: RealmClientScopesIdGetRequest): Promise<runtime.ApiResponse<ClientScopeRepresentation>> {
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<ClientScopeRepresentation> {
const response = await this.realmClientScopesIdGetRaw(requestParameters);
return await response.value();
}
/**
* Update the client scope
*/
async realmClientScopesIdPutRaw(requestParameters: RealmClientScopesIdPutRequest): 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 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<void> {
await this.realmClientScopesIdPutRaw(requestParameters);
}
/**
* Create a new client scope Client Scopes name must be unique!
*/
async realmClientScopesPostRaw(requestParameters: RealmClientScopesPostRequest): 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 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 Scopes name must be unique!
*/
async realmClientScopesPost(requestParameters: RealmClientScopesPostRequest): Promise<void> {
await this.realmClientScopesPostRaw(requestParameters);
}
}