166 lines
6.6 KiB
TypeScript
166 lines
6.6 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 {
|
|
ClientInitialAccessCreatePresentation,
|
|
ClientInitialAccessCreatePresentationFromJSON,
|
|
ClientInitialAccessCreatePresentationToJSON,
|
|
ClientInitialAccessPresentation,
|
|
ClientInitialAccessPresentationFromJSON,
|
|
ClientInitialAccessPresentationToJSON,
|
|
} from '../models';
|
|
|
|
export interface RealmClientsInitialAccessGetRequest {
|
|
realm: string;
|
|
}
|
|
|
|
export interface RealmClientsInitialAccessIdDeleteRequest {
|
|
realm: string;
|
|
id: string;
|
|
}
|
|
|
|
export interface RealmClientsInitialAccessPostRequest {
|
|
realm: string;
|
|
clientInitialAccessCreatePresentation: ClientInitialAccessCreatePresentation;
|
|
}
|
|
|
|
/**
|
|
*
|
|
*/
|
|
export class ClientInitialAccessApi extends runtime.BaseAPI {
|
|
|
|
/**
|
|
*/
|
|
async realmClientsInitialAccessGetRaw(requestParameters: RealmClientsInitialAccessGetRequest): 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 realmClientsInitialAccessGet.');
|
|
}
|
|
|
|
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-initial-access`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))),
|
|
method: 'GET',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
});
|
|
|
|
return new runtime.JSONApiResponse<any>(response);
|
|
}
|
|
|
|
/**
|
|
*/
|
|
async realmClientsInitialAccessGet(requestParameters: RealmClientsInitialAccessGetRequest): Promise<Array<{ [key: string]: object; }>> {
|
|
const response = await this.realmClientsInitialAccessGetRaw(requestParameters);
|
|
return await response.value();
|
|
}
|
|
|
|
/**
|
|
*/
|
|
async realmClientsInitialAccessIdDeleteRaw(requestParameters: RealmClientsInitialAccessIdDeleteRequest): 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 realmClientsInitialAccessIdDelete.');
|
|
}
|
|
|
|
if (requestParameters.id === null || requestParameters.id === undefined) {
|
|
throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling realmClientsInitialAccessIdDelete.');
|
|
}
|
|
|
|
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-initial-access/{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 realmClientsInitialAccessIdDelete(requestParameters: RealmClientsInitialAccessIdDeleteRequest): Promise<void> {
|
|
await this.realmClientsInitialAccessIdDeleteRaw(requestParameters);
|
|
}
|
|
|
|
/**
|
|
* Create a new initial access token.
|
|
*/
|
|
async realmClientsInitialAccessPostRaw(requestParameters: RealmClientsInitialAccessPostRequest): Promise<runtime.ApiResponse<ClientInitialAccessPresentation>> {
|
|
if (requestParameters.realm === null || requestParameters.realm === undefined) {
|
|
throw new runtime.RequiredError('realm','Required parameter requestParameters.realm was null or undefined when calling realmClientsInitialAccessPost.');
|
|
}
|
|
|
|
if (requestParameters.clientInitialAccessCreatePresentation === null || requestParameters.clientInitialAccessCreatePresentation === undefined) {
|
|
throw new runtime.RequiredError('clientInitialAccessCreatePresentation','Required parameter requestParameters.clientInitialAccessCreatePresentation was null or undefined when calling realmClientsInitialAccessPost.');
|
|
}
|
|
|
|
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-initial-access`.replace(`{${"realm"}}`, encodeURIComponent(String(requestParameters.realm))),
|
|
method: 'POST',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
body: ClientInitialAccessCreatePresentationToJSON(requestParameters.clientInitialAccessCreatePresentation),
|
|
});
|
|
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => ClientInitialAccessPresentationFromJSON(jsonValue));
|
|
}
|
|
|
|
/**
|
|
* Create a new initial access token.
|
|
*/
|
|
async realmClientsInitialAccessPost(requestParameters: RealmClientsInitialAccessPostRequest): Promise<ClientInitialAccessPresentation> {
|
|
const response = await this.realmClientsInitialAccessPostRaw(requestParameters);
|
|
return await response.value();
|
|
}
|
|
|
|
}
|