mirror of
https://github.com/GlueOps/autoglue.git
synced 2026-02-13 12:50:05 +01:00
168 lines
5.5 KiB
TypeScript
168 lines
5.5 KiB
TypeScript
/* tslint:disable */
|
|
/* eslint-disable */
|
|
/**
|
|
* AutoGlue API
|
|
* API for managing K3s clusters across cloud providers
|
|
*
|
|
* The version of the OpenAPI document: 1.0
|
|
*
|
|
*
|
|
* 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 type {
|
|
HandlersCreateUserKeyRequest,
|
|
HandlersUserAPIKeyOut,
|
|
} from '../models/index';
|
|
import {
|
|
HandlersCreateUserKeyRequestFromJSON,
|
|
HandlersCreateUserKeyRequestToJSON,
|
|
HandlersUserAPIKeyOutFromJSON,
|
|
HandlersUserAPIKeyOutToJSON,
|
|
} from '../models/index';
|
|
|
|
export interface CreateUserAPIKeyRequest {
|
|
body: HandlersCreateUserKeyRequest;
|
|
}
|
|
|
|
export interface DeleteUserAPIKeyRequest {
|
|
id: string;
|
|
}
|
|
|
|
/**
|
|
*
|
|
*/
|
|
export class MeAPIKeysApi extends runtime.BaseAPI {
|
|
|
|
/**
|
|
* Returns the plaintext key once. Store it securely on the client side.
|
|
* Create a new user API key
|
|
*/
|
|
async createUserAPIKeyRaw(requestParameters: CreateUserAPIKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<HandlersUserAPIKeyOut>> {
|
|
if (requestParameters['body'] == null) {
|
|
throw new runtime.RequiredError(
|
|
'body',
|
|
'Required parameter "body" was null or undefined when calling createUserAPIKey().'
|
|
);
|
|
}
|
|
|
|
const queryParameters: any = {};
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
headerParameters['Content-Type'] = 'application/json';
|
|
|
|
if (this.configuration && this.configuration.apiKey) {
|
|
headerParameters["X-API-KEY"] = await this.configuration.apiKey("X-API-KEY"); // ApiKeyAuth authentication
|
|
}
|
|
|
|
if (this.configuration && this.configuration.apiKey) {
|
|
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // BearerAuth authentication
|
|
}
|
|
|
|
|
|
let urlPath = `/me/api-keys`;
|
|
|
|
const response = await this.request({
|
|
path: urlPath,
|
|
method: 'POST',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
body: HandlersCreateUserKeyRequestToJSON(requestParameters['body']),
|
|
}, initOverrides);
|
|
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => HandlersUserAPIKeyOutFromJSON(jsonValue));
|
|
}
|
|
|
|
/**
|
|
* Returns the plaintext key once. Store it securely on the client side.
|
|
* Create a new user API key
|
|
*/
|
|
async createUserAPIKey(requestParameters: CreateUserAPIKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<HandlersUserAPIKeyOut> {
|
|
const response = await this.createUserAPIKeyRaw(requestParameters, initOverrides);
|
|
return await response.value();
|
|
}
|
|
|
|
/**
|
|
* Delete a user API key
|
|
*/
|
|
async deleteUserAPIKeyRaw(requestParameters: DeleteUserAPIKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
if (requestParameters['id'] == null) {
|
|
throw new runtime.RequiredError(
|
|
'id',
|
|
'Required parameter "id" was null or undefined when calling deleteUserAPIKey().'
|
|
);
|
|
}
|
|
|
|
const queryParameters: any = {};
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
if (this.configuration && this.configuration.apiKey) {
|
|
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // BearerAuth authentication
|
|
}
|
|
|
|
|
|
let urlPath = `/me/api-keys/{id}`;
|
|
urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
|
|
|
|
const response = await this.request({
|
|
path: urlPath,
|
|
method: 'DELETE',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
}, initOverrides);
|
|
|
|
return new runtime.VoidApiResponse(response);
|
|
}
|
|
|
|
/**
|
|
* Delete a user API key
|
|
*/
|
|
async deleteUserAPIKey(requestParameters: DeleteUserAPIKeyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
await this.deleteUserAPIKeyRaw(requestParameters, initOverrides);
|
|
}
|
|
|
|
/**
|
|
* List my API keys
|
|
*/
|
|
async listUserAPIKeysRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<HandlersUserAPIKeyOut>>> {
|
|
const queryParameters: any = {};
|
|
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
|
|
if (this.configuration && this.configuration.apiKey) {
|
|
headerParameters["X-API-KEY"] = await this.configuration.apiKey("X-API-KEY"); // ApiKeyAuth authentication
|
|
}
|
|
|
|
if (this.configuration && this.configuration.apiKey) {
|
|
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // BearerAuth authentication
|
|
}
|
|
|
|
|
|
let urlPath = `/me/api-keys`;
|
|
|
|
const response = await this.request({
|
|
path: urlPath,
|
|
method: 'GET',
|
|
headers: headerParameters,
|
|
query: queryParameters,
|
|
}, initOverrides);
|
|
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(HandlersUserAPIKeyOutFromJSON));
|
|
}
|
|
|
|
/**
|
|
* List my API keys
|
|
*/
|
|
async listUserAPIKeys(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<HandlersUserAPIKeyOut>> {
|
|
const response = await this.listUserAPIKeysRaw(initOverrides);
|
|
return await response.value();
|
|
}
|
|
|
|
}
|