/* 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";
/**
 * ApiPluginHaloRunV1alpha1PluginApi - axios parameter creator
 * @export
 */
export const ApiPluginHaloRunV1alpha1PluginApiAxiosParamCreator = function (
  configuration?: Configuration
) {
  return {
    /**
     * Gets plugin available by name.
     * @param {string} name Plugin name
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    queryPluginAvailableByName: async (
      name: string,
      options: AxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      // verify required parameter 'name' is not null or undefined
      assertParamExists("queryPluginAvailableByName", "name", name);
      const localVarPath =
        `/apis/api.plugin.halo.run/v1alpha1/plugins/{name}/available`.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: "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,
      };
    },
  };
};

/**
 * ApiPluginHaloRunV1alpha1PluginApi - functional programming interface
 * @export
 */
export const ApiPluginHaloRunV1alpha1PluginApiFp = function (
  configuration?: Configuration
) {
  const localVarAxiosParamCreator =
    ApiPluginHaloRunV1alpha1PluginApiAxiosParamCreator(configuration);
  return {
    /**
     * Gets plugin available by name.
     * @param {string} name Plugin name
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async queryPluginAvailableByName(
      name: string,
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<boolean>
    > {
      const localVarAxiosArgs =
        await localVarAxiosParamCreator.queryPluginAvailableByName(
          name,
          options
        );
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
  };
};

/**
 * ApiPluginHaloRunV1alpha1PluginApi - factory interface
 * @export
 */
export const ApiPluginHaloRunV1alpha1PluginApiFactory = function (
  configuration?: Configuration,
  basePath?: string,
  axios?: AxiosInstance
) {
  const localVarFp = ApiPluginHaloRunV1alpha1PluginApiFp(configuration);
  return {
    /**
     * Gets plugin available by name.
     * @param {ApiPluginHaloRunV1alpha1PluginApiQueryPluginAvailableByNameRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    queryPluginAvailableByName(
      requestParameters: ApiPluginHaloRunV1alpha1PluginApiQueryPluginAvailableByNameRequest,
      options?: AxiosRequestConfig
    ): AxiosPromise<boolean> {
      return localVarFp
        .queryPluginAvailableByName(requestParameters.name, options)
        .then((request) => request(axios, basePath));
    },
  };
};

/**
 * Request parameters for queryPluginAvailableByName operation in ApiPluginHaloRunV1alpha1PluginApi.
 * @export
 * @interface ApiPluginHaloRunV1alpha1PluginApiQueryPluginAvailableByNameRequest
 */
export interface ApiPluginHaloRunV1alpha1PluginApiQueryPluginAvailableByNameRequest {
  /**
   * Plugin name
   * @type {string}
   * @memberof ApiPluginHaloRunV1alpha1PluginApiQueryPluginAvailableByName
   */
  readonly name: string;
}

/**
 * ApiPluginHaloRunV1alpha1PluginApi - object-oriented interface
 * @export
 * @class ApiPluginHaloRunV1alpha1PluginApi
 * @extends {BaseAPI}
 */
export class ApiPluginHaloRunV1alpha1PluginApi extends BaseAPI {
  /**
   * Gets plugin available by name.
   * @param {ApiPluginHaloRunV1alpha1PluginApiQueryPluginAvailableByNameRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof ApiPluginHaloRunV1alpha1PluginApi
   */
  public queryPluginAvailableByName(
    requestParameters: ApiPluginHaloRunV1alpha1PluginApiQueryPluginAvailableByNameRequest,
    options?: AxiosRequestConfig
  ) {
    return ApiPluginHaloRunV1alpha1PluginApiFp(this.configuration)
      .queryPluginAvailableByName(requestParameters.name, options)
      .then((request) => request(this.axios, this.basePath));
  }
}
