/* tslint:disable */
/* eslint-disable */
/**
 * Halo
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 2.20.10-SNAPSHOT
 * 
 *
 * 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 } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
/**
 * IndicesV1alpha1ConsoleApi - axios parameter creator
 * @export
 */
export const IndicesV1alpha1ConsoleApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Build or rebuild post indices for full text search. This method is deprecated, please use POST /indices/-/rebuild instead.
         * @param {*} [options] Override http request option.
         * @deprecated
         * @throws {RequiredError}
         */
        buildPostIndices: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/apis/api.console.halo.run/v1alpha1/indices/post`;
            // 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 basicAuth required
            // http basic authentication required
            setBasicAuthToObject(localVarRequestOptions, configuration)

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


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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Rebuild all indices
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        rebuildAllIndices: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/apis/api.console.halo.run/v1alpha1/indices/-/rebuild`;
            // 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 basicAuth required
            // http basic authentication required
            setBasicAuthToObject(localVarRequestOptions, configuration)

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


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

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

/**
 * IndicesV1alpha1ConsoleApi - functional programming interface
 * @export
 */
export const IndicesV1alpha1ConsoleApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = IndicesV1alpha1ConsoleApiAxiosParamCreator(configuration)
    return {
        /**
         * Build or rebuild post indices for full text search. This method is deprecated, please use POST /indices/-/rebuild instead.
         * @param {*} [options] Override http request option.
         * @deprecated
         * @throws {RequiredError}
         */
        async buildPostIndices(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.buildPostIndices(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['IndicesV1alpha1ConsoleApi.buildPostIndices']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Rebuild all indices
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async rebuildAllIndices(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.rebuildAllIndices(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['IndicesV1alpha1ConsoleApi.rebuildAllIndices']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * IndicesV1alpha1ConsoleApi - factory interface
 * @export
 */
export const IndicesV1alpha1ConsoleApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = IndicesV1alpha1ConsoleApiFp(configuration)
    return {
        /**
         * Build or rebuild post indices for full text search. This method is deprecated, please use POST /indices/-/rebuild instead.
         * @param {*} [options] Override http request option.
         * @deprecated
         * @throws {RequiredError}
         */
        buildPostIndices(options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.buildPostIndices(options).then((request) => request(axios, basePath));
        },
        /**
         * Rebuild all indices
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        rebuildAllIndices(options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.rebuildAllIndices(options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * IndicesV1alpha1ConsoleApi - object-oriented interface
 * @export
 * @class IndicesV1alpha1ConsoleApi
 * @extends {BaseAPI}
 */
export class IndicesV1alpha1ConsoleApi extends BaseAPI {
    /**
     * Build or rebuild post indices for full text search. This method is deprecated, please use POST /indices/-/rebuild instead.
     * @param {*} [options] Override http request option.
     * @deprecated
     * @throws {RequiredError}
     * @memberof IndicesV1alpha1ConsoleApi
     */
    public buildPostIndices(options?: RawAxiosRequestConfig) {
        return IndicesV1alpha1ConsoleApiFp(this.configuration).buildPostIndices(options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Rebuild all indices
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof IndicesV1alpha1ConsoleApi
     */
    public rebuildAllIndices(options?: RawAxiosRequestConfig) {
        return IndicesV1alpha1ConsoleApiFp(this.configuration).rebuildAllIndices(options).then((request) => request(this.axios, this.basePath));
    }
}

