/* tslint:disable */
/* eslint-disable */
/**
 * agent/agentGrpc/agent.proto
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: version not set
 * 
 *
 * 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 {
  AccessPrivateResponse,
  RpcStatus,
  SharePrivateResponse,
  SharePublicResponse,
  StatusResponse,
  VersionResponse,
} from '../models/index';
import {
    AccessPrivateResponseFromJSON,
    AccessPrivateResponseToJSON,
    RpcStatusFromJSON,
    RpcStatusToJSON,
    SharePrivateResponseFromJSON,
    SharePrivateResponseToJSON,
    SharePublicResponseFromJSON,
    SharePublicResponseToJSON,
    StatusResponseFromJSON,
    StatusResponseToJSON,
    VersionResponseFromJSON,
    VersionResponseToJSON,
} from '../models/index';

export interface AgentAccessPrivateRequest {
    token?: string;
    bindAddress?: string;
    autoMode?: boolean;
    autoAddress?: string;
    autoStartPort?: number;
    autoEndPort?: number;
    responseHeaders?: Array<string>;
}

export interface AgentReleaseAccessRequest {
    frontendToken?: string;
}

export interface AgentReleaseShareRequest {
    token?: string;
}

export interface AgentSharePrivateRequest {
    target?: string;
    backendMode?: string;
    insecure?: boolean;
    closed?: boolean;
    accessGrants?: Array<string>;
}

export interface AgentSharePublicRequest {
    target?: string;
    basicAuth?: Array<string>;
    frontendSelection?: Array<string>;
    backendMode?: string;
    insecure?: boolean;
    oauthProvider?: string;
    oauthEmailAddressPatterns?: Array<string>;
    oauthCheckInterval?: string;
    closed?: boolean;
    accessGrants?: Array<string>;
}

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

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

        if (requestParameters['token'] != null) {
            queryParameters['token'] = requestParameters['token'];
        }

        if (requestParameters['bindAddress'] != null) {
            queryParameters['bindAddress'] = requestParameters['bindAddress'];
        }

        if (requestParameters['autoMode'] != null) {
            queryParameters['autoMode'] = requestParameters['autoMode'];
        }

        if (requestParameters['autoAddress'] != null) {
            queryParameters['autoAddress'] = requestParameters['autoAddress'];
        }

        if (requestParameters['autoStartPort'] != null) {
            queryParameters['autoStartPort'] = requestParameters['autoStartPort'];
        }

        if (requestParameters['autoEndPort'] != null) {
            queryParameters['autoEndPort'] = requestParameters['autoEndPort'];
        }

        if (requestParameters['responseHeaders'] != null) {
            queryParameters['responseHeaders'] = requestParameters['responseHeaders'];
        }

        const headerParameters: runtime.HTTPHeaders = {};

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

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

    /**
     */
    async agentAccessPrivate(requestParameters: AgentAccessPrivateRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AccessPrivateResponse> {
        const response = await this.agentAccessPrivateRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

        if (requestParameters['frontendToken'] != null) {
            queryParameters['frontendToken'] = requestParameters['frontendToken'];
        }

        const headerParameters: runtime.HTTPHeaders = {};

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

        return new runtime.JSONApiResponse<any>(response);
    }

    /**
     */
    async agentReleaseAccess(requestParameters: AgentReleaseAccessRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<object> {
        const response = await this.agentReleaseAccessRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

        if (requestParameters['token'] != null) {
            queryParameters['token'] = requestParameters['token'];
        }

        const headerParameters: runtime.HTTPHeaders = {};

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

        return new runtime.JSONApiResponse<any>(response);
    }

    /**
     */
    async agentReleaseShare(requestParameters: AgentReleaseShareRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<object> {
        const response = await this.agentReleaseShareRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

        if (requestParameters['target'] != null) {
            queryParameters['target'] = requestParameters['target'];
        }

        if (requestParameters['backendMode'] != null) {
            queryParameters['backendMode'] = requestParameters['backendMode'];
        }

        if (requestParameters['insecure'] != null) {
            queryParameters['insecure'] = requestParameters['insecure'];
        }

        if (requestParameters['closed'] != null) {
            queryParameters['closed'] = requestParameters['closed'];
        }

        if (requestParameters['accessGrants'] != null) {
            queryParameters['accessGrants'] = requestParameters['accessGrants'];
        }

        const headerParameters: runtime.HTTPHeaders = {};

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

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

    /**
     */
    async agentSharePrivate(requestParameters: AgentSharePrivateRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SharePrivateResponse> {
        const response = await this.agentSharePrivateRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

        if (requestParameters['target'] != null) {
            queryParameters['target'] = requestParameters['target'];
        }

        if (requestParameters['basicAuth'] != null) {
            queryParameters['basicAuth'] = requestParameters['basicAuth'];
        }

        if (requestParameters['frontendSelection'] != null) {
            queryParameters['frontendSelection'] = requestParameters['frontendSelection'];
        }

        if (requestParameters['backendMode'] != null) {
            queryParameters['backendMode'] = requestParameters['backendMode'];
        }

        if (requestParameters['insecure'] != null) {
            queryParameters['insecure'] = requestParameters['insecure'];
        }

        if (requestParameters['oauthProvider'] != null) {
            queryParameters['oauthProvider'] = requestParameters['oauthProvider'];
        }

        if (requestParameters['oauthEmailAddressPatterns'] != null) {
            queryParameters['oauthEmailAddressPatterns'] = requestParameters['oauthEmailAddressPatterns'];
        }

        if (requestParameters['oauthCheckInterval'] != null) {
            queryParameters['oauthCheckInterval'] = requestParameters['oauthCheckInterval'];
        }

        if (requestParameters['closed'] != null) {
            queryParameters['closed'] = requestParameters['closed'];
        }

        if (requestParameters['accessGrants'] != null) {
            queryParameters['accessGrants'] = requestParameters['accessGrants'];
        }

        const headerParameters: runtime.HTTPHeaders = {};

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

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

    /**
     */
    async agentSharePublic(requestParameters: AgentSharePublicRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SharePublicResponse> {
        const response = await this.agentSharePublicRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

        const headerParameters: runtime.HTTPHeaders = {};

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

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

    /**
     */
    async agentStatus(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<StatusResponse> {
        const response = await this.agentStatusRaw(initOverrides);
        return await response.value();
    }

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

        const headerParameters: runtime.HTTPHeaders = {};

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

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

    /**
     */
    async agentVersion(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<VersionResponse> {
        const response = await this.agentVersionRaw(initOverrides);
        return await response.value();
    }

}
