/* 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";
/**
 * ApiConsoleHaloRunV1alpha1RestorationApi - axios parameter creator
 * @export
 */
export const ApiConsoleHaloRunV1alpha1RestorationApiAxiosParamCreator =
  function (configuration?: Configuration) {
    return {
      /**
       *
       * @param {File} file
       * @param {*} [options] Override http request option.
       * @throws {RequiredError}
       */
      restoreBackup: async (
        file: File,
        options: AxiosRequestConfig = {}
      ): Promise<RequestArgs> => {
        // verify required parameter 'file' is not null or undefined
        assertParamExists("restoreBackup", "file", file);
        const localVarPath = `/apis/api.console.halo.run/v1alpha1/restorations`;
        // 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;
        const localVarFormParams = new ((configuration &&
          configuration.formDataCtor) ||
          FormData)();

        // authentication BasicAuth required
        // http basic authentication required
        setBasicAuthToObject(localVarRequestOptions, configuration);

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

        if (file !== undefined) {
          localVarFormParams.append("file", file as any);
        }

        localVarHeaderParameter["Content-Type"] = "multipart/form-data";

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

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

/**
 * ApiConsoleHaloRunV1alpha1RestorationApi - functional programming interface
 * @export
 */
export const ApiConsoleHaloRunV1alpha1RestorationApiFp = function (
  configuration?: Configuration
) {
  const localVarAxiosParamCreator =
    ApiConsoleHaloRunV1alpha1RestorationApiAxiosParamCreator(configuration);
  return {
    /**
     *
     * @param {File} file
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async restoreBackup(
      file: File,
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>
    > {
      const localVarAxiosArgs = await localVarAxiosParamCreator.restoreBackup(
        file,
        options
      );
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
  };
};

/**
 * ApiConsoleHaloRunV1alpha1RestorationApi - factory interface
 * @export
 */
export const ApiConsoleHaloRunV1alpha1RestorationApiFactory = function (
  configuration?: Configuration,
  basePath?: string,
  axios?: AxiosInstance
) {
  const localVarFp = ApiConsoleHaloRunV1alpha1RestorationApiFp(configuration);
  return {
    /**
     *
     * @param {ApiConsoleHaloRunV1alpha1RestorationApiRestoreBackupRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    restoreBackup(
      requestParameters: ApiConsoleHaloRunV1alpha1RestorationApiRestoreBackupRequest,
      options?: AxiosRequestConfig
    ): AxiosPromise<void> {
      return localVarFp
        .restoreBackup(requestParameters.file, options)
        .then((request) => request(axios, basePath));
    },
  };
};

/**
 * Request parameters for restoreBackup operation in ApiConsoleHaloRunV1alpha1RestorationApi.
 * @export
 * @interface ApiConsoleHaloRunV1alpha1RestorationApiRestoreBackupRequest
 */
export interface ApiConsoleHaloRunV1alpha1RestorationApiRestoreBackupRequest {
  /**
   *
   * @type {File}
   * @memberof ApiConsoleHaloRunV1alpha1RestorationApiRestoreBackup
   */
  readonly file: File;
}

/**
 * ApiConsoleHaloRunV1alpha1RestorationApi - object-oriented interface
 * @export
 * @class ApiConsoleHaloRunV1alpha1RestorationApi
 * @extends {BaseAPI}
 */
export class ApiConsoleHaloRunV1alpha1RestorationApi extends BaseAPI {
  /**
   *
   * @param {ApiConsoleHaloRunV1alpha1RestorationApiRestoreBackupRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof ApiConsoleHaloRunV1alpha1RestorationApi
   */
  public restoreBackup(
    requestParameters: ApiConsoleHaloRunV1alpha1RestorationApiRestoreBackupRequest,
    options?: AxiosRequestConfig
  ) {
    return ApiConsoleHaloRunV1alpha1RestorationApiFp(this.configuration)
      .restoreBackup(requestParameters.file, options)
      .then((request) => request(this.axios, this.basePath));
  }
}
