/* tslint:disable */
/* eslint-disable */
/**
 * Halo Next API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 2.0.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, AxiosRequestConfig } 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,
} from "../base";
// @ts-ignore
import { AuthProvider } from "../models";
// @ts-ignore
import { ListedAuthProvider } from "../models";
/**
 * ApiConsoleHaloRunV1alpha1AuthProviderApi - axios parameter creator
 * @export
 */
export const ApiConsoleHaloRunV1alpha1AuthProviderApiAxiosParamCreator =
  function (configuration?: Configuration) {
    return {
      /**
       * Disables an auth provider
       * @param {string} name
       * @param {*} [options] Override http request option.
       * @throws {RequiredError}
       */
      disableAuthProvider: async (
        name: string,
        options: AxiosRequestConfig = {}
      ): Promise<RequestArgs> => {
        // verify required parameter 'name' is not null or undefined
        assertParamExists("disableAuthProvider", "name", name);
        const localVarPath =
          `/apis/api.console.halo.run/v1alpha1/auth-providers/{name}/disable`.replace(
            `{${"name"}}`,
            encodeURIComponent(String(name))
          );
        // 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: "PUT",
          ...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,
        };
      },
      /**
       * Enables an auth provider
       * @param {string} name
       * @param {*} [options] Override http request option.
       * @throws {RequiredError}
       */
      enableAuthProvider: async (
        name: string,
        options: AxiosRequestConfig = {}
      ): Promise<RequestArgs> => {
        // verify required parameter 'name' is not null or undefined
        assertParamExists("enableAuthProvider", "name", name);
        const localVarPath =
          `/apis/api.console.halo.run/v1alpha1/auth-providers/{name}/enable`.replace(
            `{${"name"}}`,
            encodeURIComponent(String(name))
          );
        // 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: "PUT",
          ...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,
        };
      },
      /**
       * Lists all auth providers
       * @param {*} [options] Override http request option.
       * @throws {RequiredError}
       */
      listAuthProviders: async (
        options: AxiosRequestConfig = {}
      ): Promise<RequestArgs> => {
        const localVarPath = `/apis/api.console.halo.run/v1alpha1/auth-providers`;
        // 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 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,
        };
      },
    };
  };

/**
 * ApiConsoleHaloRunV1alpha1AuthProviderApi - functional programming interface
 * @export
 */
export const ApiConsoleHaloRunV1alpha1AuthProviderApiFp = function (
  configuration?: Configuration
) {
  const localVarAxiosParamCreator =
    ApiConsoleHaloRunV1alpha1AuthProviderApiAxiosParamCreator(configuration);
  return {
    /**
     * Disables an auth provider
     * @param {string} name
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async disableAuthProvider(
      name: string,
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<AuthProvider>
    > {
      const localVarAxiosArgs =
        await localVarAxiosParamCreator.disableAuthProvider(name, options);
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
    /**
     * Enables an auth provider
     * @param {string} name
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async enableAuthProvider(
      name: string,
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<AuthProvider>
    > {
      const localVarAxiosArgs =
        await localVarAxiosParamCreator.enableAuthProvider(name, options);
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
    /**
     * Lists all auth providers
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async listAuthProviders(
      options?: AxiosRequestConfig
    ): Promise<
      (
        axios?: AxiosInstance,
        basePath?: string
      ) => AxiosPromise<Array<ListedAuthProvider>>
    > {
      const localVarAxiosArgs =
        await localVarAxiosParamCreator.listAuthProviders(options);
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
  };
};

/**
 * ApiConsoleHaloRunV1alpha1AuthProviderApi - factory interface
 * @export
 */
export const ApiConsoleHaloRunV1alpha1AuthProviderApiFactory = function (
  configuration?: Configuration,
  basePath?: string,
  axios?: AxiosInstance
) {
  const localVarFp = ApiConsoleHaloRunV1alpha1AuthProviderApiFp(configuration);
  return {
    /**
     * Disables an auth provider
     * @param {ApiConsoleHaloRunV1alpha1AuthProviderApiDisableAuthProviderRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    disableAuthProvider(
      requestParameters: ApiConsoleHaloRunV1alpha1AuthProviderApiDisableAuthProviderRequest,
      options?: AxiosRequestConfig
    ): AxiosPromise<AuthProvider> {
      return localVarFp
        .disableAuthProvider(requestParameters.name, options)
        .then((request) => request(axios, basePath));
    },
    /**
     * Enables an auth provider
     * @param {ApiConsoleHaloRunV1alpha1AuthProviderApiEnableAuthProviderRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    enableAuthProvider(
      requestParameters: ApiConsoleHaloRunV1alpha1AuthProviderApiEnableAuthProviderRequest,
      options?: AxiosRequestConfig
    ): AxiosPromise<AuthProvider> {
      return localVarFp
        .enableAuthProvider(requestParameters.name, options)
        .then((request) => request(axios, basePath));
    },
    /**
     * Lists all auth providers
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    listAuthProviders(
      options?: AxiosRequestConfig
    ): AxiosPromise<Array<ListedAuthProvider>> {
      return localVarFp
        .listAuthProviders(options)
        .then((request) => request(axios, basePath));
    },
  };
};

/**
 * Request parameters for disableAuthProvider operation in ApiConsoleHaloRunV1alpha1AuthProviderApi.
 * @export
 * @interface ApiConsoleHaloRunV1alpha1AuthProviderApiDisableAuthProviderRequest
 */
export interface ApiConsoleHaloRunV1alpha1AuthProviderApiDisableAuthProviderRequest {
  /**
   *
   * @type {string}
   * @memberof ApiConsoleHaloRunV1alpha1AuthProviderApiDisableAuthProvider
   */
  readonly name: string;
}

/**
 * Request parameters for enableAuthProvider operation in ApiConsoleHaloRunV1alpha1AuthProviderApi.
 * @export
 * @interface ApiConsoleHaloRunV1alpha1AuthProviderApiEnableAuthProviderRequest
 */
export interface ApiConsoleHaloRunV1alpha1AuthProviderApiEnableAuthProviderRequest {
  /**
   *
   * @type {string}
   * @memberof ApiConsoleHaloRunV1alpha1AuthProviderApiEnableAuthProvider
   */
  readonly name: string;
}

/**
 * ApiConsoleHaloRunV1alpha1AuthProviderApi - object-oriented interface
 * @export
 * @class ApiConsoleHaloRunV1alpha1AuthProviderApi
 * @extends {BaseAPI}
 */
export class ApiConsoleHaloRunV1alpha1AuthProviderApi extends BaseAPI {
  /**
   * Disables an auth provider
   * @param {ApiConsoleHaloRunV1alpha1AuthProviderApiDisableAuthProviderRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof ApiConsoleHaloRunV1alpha1AuthProviderApi
   */
  public disableAuthProvider(
    requestParameters: ApiConsoleHaloRunV1alpha1AuthProviderApiDisableAuthProviderRequest,
    options?: AxiosRequestConfig
  ) {
    return ApiConsoleHaloRunV1alpha1AuthProviderApiFp(this.configuration)
      .disableAuthProvider(requestParameters.name, options)
      .then((request) => request(this.axios, this.basePath));
  }

  /**
   * Enables an auth provider
   * @param {ApiConsoleHaloRunV1alpha1AuthProviderApiEnableAuthProviderRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof ApiConsoleHaloRunV1alpha1AuthProviderApi
   */
  public enableAuthProvider(
    requestParameters: ApiConsoleHaloRunV1alpha1AuthProviderApiEnableAuthProviderRequest,
    options?: AxiosRequestConfig
  ) {
    return ApiConsoleHaloRunV1alpha1AuthProviderApiFp(this.configuration)
      .enableAuthProvider(requestParameters.name, options)
      .then((request) => request(this.axios, this.basePath));
  }

  /**
   * Lists all auth providers
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof ApiConsoleHaloRunV1alpha1AuthProviderApi
   */
  public listAuthProviders(options?: AxiosRequestConfig) {
    return ApiConsoleHaloRunV1alpha1AuthProviderApiFp(this.configuration)
      .listAuthProviders(options)
      .then((request) => request(this.axios, this.basePath));
  }
}
