/* 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 { MenuVo } from "../models";
/**
 * ApiHaloRunV1alpha1MenuApi - axios parameter creator
 * @export
 */
export const ApiHaloRunV1alpha1MenuApiAxiosParamCreator = function (
  configuration?: Configuration
) {
  return {
    /**
     * Gets menu by name.
     * @param {string} name Menu name
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    queryMenuByName: async (
      name: string,
      options: AxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      // verify required parameter 'name' is not null or undefined
      assertParamExists("queryMenuByName", "name", name);
      const localVarPath = `/apis/api.halo.run/v1alpha1/menus/{name}`.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,
      };
    },
    /**
     * Gets primary menu.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    queryPrimaryMenu: async (
      options: AxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      const localVarPath = `/apis/api.halo.run/v1alpha1/menus/-`;
      // 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,
      };
    },
  };
};

/**
 * ApiHaloRunV1alpha1MenuApi - functional programming interface
 * @export
 */
export const ApiHaloRunV1alpha1MenuApiFp = function (
  configuration?: Configuration
) {
  const localVarAxiosParamCreator =
    ApiHaloRunV1alpha1MenuApiAxiosParamCreator(configuration);
  return {
    /**
     * Gets menu by name.
     * @param {string} name Menu name
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async queryMenuByName(
      name: string,
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<MenuVo>
    > {
      const localVarAxiosArgs = await localVarAxiosParamCreator.queryMenuByName(
        name,
        options
      );
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
    /**
     * Gets primary menu.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async queryPrimaryMenu(
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<MenuVo>
    > {
      const localVarAxiosArgs =
        await localVarAxiosParamCreator.queryPrimaryMenu(options);
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
  };
};

/**
 * ApiHaloRunV1alpha1MenuApi - factory interface
 * @export
 */
export const ApiHaloRunV1alpha1MenuApiFactory = function (
  configuration?: Configuration,
  basePath?: string,
  axios?: AxiosInstance
) {
  const localVarFp = ApiHaloRunV1alpha1MenuApiFp(configuration);
  return {
    /**
     * Gets menu by name.
     * @param {ApiHaloRunV1alpha1MenuApiQueryMenuByNameRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    queryMenuByName(
      requestParameters: ApiHaloRunV1alpha1MenuApiQueryMenuByNameRequest,
      options?: AxiosRequestConfig
    ): AxiosPromise<MenuVo> {
      return localVarFp
        .queryMenuByName(requestParameters.name, options)
        .then((request) => request(axios, basePath));
    },
    /**
     * Gets primary menu.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    queryPrimaryMenu(options?: AxiosRequestConfig): AxiosPromise<MenuVo> {
      return localVarFp
        .queryPrimaryMenu(options)
        .then((request) => request(axios, basePath));
    },
  };
};

/**
 * Request parameters for queryMenuByName operation in ApiHaloRunV1alpha1MenuApi.
 * @export
 * @interface ApiHaloRunV1alpha1MenuApiQueryMenuByNameRequest
 */
export interface ApiHaloRunV1alpha1MenuApiQueryMenuByNameRequest {
  /**
   * Menu name
   * @type {string}
   * @memberof ApiHaloRunV1alpha1MenuApiQueryMenuByName
   */
  readonly name: string;
}

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

  /**
   * Gets primary menu.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof ApiHaloRunV1alpha1MenuApi
   */
  public queryPrimaryMenu(options?: AxiosRequestConfig) {
    return ApiHaloRunV1alpha1MenuApiFp(this.configuration)
      .queryPrimaryMenu(options)
      .then((request) => request(this.axios, this.basePath));
  }
}
