/* tslint:disable */
/* eslint-disable */
/**
 * zrok
 * zrok client access
 *
 * The version of the OpenAPI document: 0.3.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 {
  CreateFrontendRequest,
  CreateFrontendResponse,
  CreateIdentity201Response,
  CreateIdentityRequest,
  DeleteFrontendRequest,
  InviteTokenGenerateRequest,
  PublicFrontend,
  UpdateFrontendRequest,
} from '../models/index';
import {
    CreateFrontendRequestFromJSON,
    CreateFrontendRequestToJSON,
    CreateFrontendResponseFromJSON,
    CreateFrontendResponseToJSON,
    CreateIdentity201ResponseFromJSON,
    CreateIdentity201ResponseToJSON,
    CreateIdentityRequestFromJSON,
    CreateIdentityRequestToJSON,
    DeleteFrontendRequestFromJSON,
    DeleteFrontendRequestToJSON,
    InviteTokenGenerateRequestFromJSON,
    InviteTokenGenerateRequestToJSON,
    PublicFrontendFromJSON,
    PublicFrontendToJSON,
    UpdateFrontendRequestFromJSON,
    UpdateFrontendRequestToJSON,
} from '../models/index';

export interface CreateFrontendOperationRequest {
    body?: CreateFrontendRequest;
}

export interface CreateIdentityOperationRequest {
    body?: CreateIdentityRequest;
}

export interface DeleteFrontendOperationRequest {
    body?: DeleteFrontendRequest;
}

export interface InviteTokenGenerateOperationRequest {
    body?: InviteTokenGenerateRequest;
}

export interface UpdateFrontendOperationRequest {
    body?: UpdateFrontendRequest;
}

/**
 * 
 */
export class AdminApi extends runtime.BaseAPI {

    /**
     */
    async createFrontendRaw(requestParameters: CreateFrontendOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CreateFrontendResponse>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/zrok.v1+json';

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["x-token"] = this.configuration.apiKey("x-token"); // key authentication
        }

        const response = await this.request({
            path: `/frontend`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: CreateFrontendRequestToJSON(requestParameters.body),
        }, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => CreateFrontendResponseFromJSON(jsonValue));
    }

    /**
     */
    async createFrontend(requestParameters: CreateFrontendOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CreateFrontendResponse> {
        const response = await this.createFrontendRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     */
    async createIdentityRaw(requestParameters: CreateIdentityOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CreateIdentity201Response>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/zrok.v1+json';

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["x-token"] = this.configuration.apiKey("x-token"); // key authentication
        }

        const response = await this.request({
            path: `/identity`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: CreateIdentityRequestToJSON(requestParameters.body),
        }, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => CreateIdentity201ResponseFromJSON(jsonValue));
    }

    /**
     */
    async createIdentity(requestParameters: CreateIdentityOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CreateIdentity201Response> {
        const response = await this.createIdentityRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     */
    async deleteFrontendRaw(requestParameters: DeleteFrontendOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/zrok.v1+json';

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["x-token"] = this.configuration.apiKey("x-token"); // key authentication
        }

        const response = await this.request({
            path: `/frontend`,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
            body: DeleteFrontendRequestToJSON(requestParameters.body),
        }, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     */
    async deleteFrontend(requestParameters: DeleteFrontendOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.deleteFrontendRaw(requestParameters, initOverrides);
    }

    /**
     */
    async inviteTokenGenerateRaw(requestParameters: InviteTokenGenerateOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/zrok.v1+json';

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["x-token"] = this.configuration.apiKey("x-token"); // key authentication
        }

        const response = await this.request({
            path: `/invite/token/generate`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: InviteTokenGenerateRequestToJSON(requestParameters.body),
        }, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     */
    async inviteTokenGenerate(requestParameters: InviteTokenGenerateOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.inviteTokenGenerateRaw(requestParameters, initOverrides);
    }

    /**
     */
    async listFrontendsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<PublicFrontend>>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["x-token"] = this.configuration.apiKey("x-token"); // key authentication
        }

        const response = await this.request({
            path: `/frontends`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PublicFrontendFromJSON));
    }

    /**
     */
    async listFrontends(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<PublicFrontend>> {
        const response = await this.listFrontendsRaw(initOverrides);
        return await response.value();
    }

    /**
     */
    async updateFrontendRaw(requestParameters: UpdateFrontendOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/zrok.v1+json';

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["x-token"] = this.configuration.apiKey("x-token"); // key authentication
        }

        const response = await this.request({
            path: `/frontend`,
            method: 'PATCH',
            headers: headerParameters,
            query: queryParameters,
            body: UpdateFrontendRequestToJSON(requestParameters.body),
        }, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     */
    async updateFrontend(requestParameters: UpdateFrontendOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.updateFrontendRaw(requestParameters, initOverrides);
    }

}
