/* tslint:disable */
/* eslint-disable */
/**
 * Fabro Run API
 * HTTP API for managing Fabro workflow run executions.
 *
 * The version of the OpenAPI document: 0.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 type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction, replaceWithSerializableTypeIfNeeded } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
// @ts-ignore
import type { DiagnosticsReport } from '../models';
// @ts-ignore
import type { ErrorResponse } from '../models';
// @ts-ignore
import type { HealthResponse } from '../models';
// @ts-ignore
import type { RootResponse } from '../models';
// @ts-ignore
import type { UserResponse } from '../models';
/**
 * DiscoveryApi - axios parameter creator
 */
export const DiscoveryApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Returns service health status. Used by load balancers and monitoring.
         * @summary Health Check
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getHealth: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/health`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            localVarHeaderParameter['Accept'] = 'application/json';

            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Returns the OpenAPI spec as JSON.
         * @summary OpenAPI Specification
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getOpenApiSpec: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/api/v1/openapi.json`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            localVarHeaderParameter['Accept'] = 'application/json';

            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Returns discovery URLs for the API.
         * @summary API Discovery
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getRoot: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            localVarHeaderParameter['Accept'] = 'application/json';

            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Returns info about the authenticated user.
         * @summary Current User
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getUser: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/api/v1/user`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication SessionCookie required

            // authentication BearerAuth required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            localVarHeaderParameter['Accept'] = 'application/json';

            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Probes external services and server configuration. May be slow.
         * @summary Run server health diagnostics
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        runDiagnostics: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/api/v1/health/diagnostics`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication SessionCookie required

            // authentication BearerAuth required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            localVarHeaderParameter['Accept'] = 'application/json';

            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    }
};

/**
 * DiscoveryApi - functional programming interface
 */
export const DiscoveryApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = DiscoveryApiAxiosParamCreator(configuration)
    return {
        /**
         * Returns service health status. Used by load balancers and monitoring.
         * @summary Health Check
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getHealth(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<HealthResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getHealth(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['DiscoveryApi.getHealth']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Returns the OpenAPI spec as JSON.
         * @summary OpenAPI Specification
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getOpenApiSpec(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<object>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getOpenApiSpec(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['DiscoveryApi.getOpenApiSpec']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Returns discovery URLs for the API.
         * @summary API Discovery
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getRoot(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<RootResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getRoot(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['DiscoveryApi.getRoot']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Returns info about the authenticated user.
         * @summary Current User
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getUser(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<UserResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getUser(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['DiscoveryApi.getUser']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Probes external services and server configuration. May be slow.
         * @summary Run server health diagnostics
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async runDiagnostics(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<DiagnosticsReport>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.runDiagnostics(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['DiscoveryApi.runDiagnostics']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * DiscoveryApi - factory interface
 */
export const DiscoveryApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = DiscoveryApiFp(configuration)
    return {
        /**
         * Returns service health status. Used by load balancers and monitoring.
         * @summary Health Check
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getHealth(options?: RawAxiosRequestConfig): AxiosPromise<HealthResponse> {
            return localVarFp.getHealth(options).then((request) => request(axios, basePath));
        },
        /**
         * Returns the OpenAPI spec as JSON.
         * @summary OpenAPI Specification
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getOpenApiSpec(options?: RawAxiosRequestConfig): AxiosPromise<object> {
            return localVarFp.getOpenApiSpec(options).then((request) => request(axios, basePath));
        },
        /**
         * Returns discovery URLs for the API.
         * @summary API Discovery
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getRoot(options?: RawAxiosRequestConfig): AxiosPromise<RootResponse> {
            return localVarFp.getRoot(options).then((request) => request(axios, basePath));
        },
        /**
         * Returns info about the authenticated user.
         * @summary Current User
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getUser(options?: RawAxiosRequestConfig): AxiosPromise<UserResponse> {
            return localVarFp.getUser(options).then((request) => request(axios, basePath));
        },
        /**
         * Probes external services and server configuration. May be slow.
         * @summary Run server health diagnostics
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        runDiagnostics(options?: RawAxiosRequestConfig): AxiosPromise<DiagnosticsReport> {
            return localVarFp.runDiagnostics(options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * DiscoveryApi - object-oriented interface
 */
export class DiscoveryApi extends BaseAPI {
    /**
     * Returns service health status. Used by load balancers and monitoring.
     * @summary Health Check
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public getHealth(options?: RawAxiosRequestConfig) {
        return DiscoveryApiFp(this.configuration).getHealth(options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Returns the OpenAPI spec as JSON.
     * @summary OpenAPI Specification
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public getOpenApiSpec(options?: RawAxiosRequestConfig) {
        return DiscoveryApiFp(this.configuration).getOpenApiSpec(options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Returns discovery URLs for the API.
     * @summary API Discovery
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public getRoot(options?: RawAxiosRequestConfig) {
        return DiscoveryApiFp(this.configuration).getRoot(options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Returns info about the authenticated user.
     * @summary Current User
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public getUser(options?: RawAxiosRequestConfig) {
        return DiscoveryApiFp(this.configuration).getUser(options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Probes external services and server configuration. May be slow.
     * @summary Run server health diagnostics
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public runDiagnostics(options?: RawAxiosRequestConfig) {
        return DiscoveryApiFp(this.configuration).runDiagnostics(options).then((request) => request(this.axios, this.basePath));
    }
}

