/* 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 { SignUpRequest } from "../models";
// @ts-ignore
import { User } from "../models";
/**
 * ApiHaloRunV1alpha1UserApi - axios parameter creator
 * @export
 */
export const ApiHaloRunV1alpha1UserApiAxiosParamCreator = function (
  configuration?: Configuration
) {
  return {
    /**
     * Sign up a new user
     * @param {SignUpRequest} signUpRequest
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    signUp: async (
      signUpRequest: SignUpRequest,
      options: AxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      // verify required parameter 'signUpRequest' is not null or undefined
      assertParamExists("signUp", "signUpRequest", signUpRequest);
      const localVarPath = `/apis/api.halo.run/v1alpha1/users/-/signup`;
      // 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);

      localVarHeaderParameter["Content-Type"] = "application/json";

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

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

/**
 * ApiHaloRunV1alpha1UserApi - functional programming interface
 * @export
 */
export const ApiHaloRunV1alpha1UserApiFp = function (
  configuration?: Configuration
) {
  const localVarAxiosParamCreator =
    ApiHaloRunV1alpha1UserApiAxiosParamCreator(configuration);
  return {
    /**
     * Sign up a new user
     * @param {SignUpRequest} signUpRequest
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async signUp(
      signUpRequest: SignUpRequest,
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<User>
    > {
      const localVarAxiosArgs = await localVarAxiosParamCreator.signUp(
        signUpRequest,
        options
      );
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
  };
};

/**
 * ApiHaloRunV1alpha1UserApi - factory interface
 * @export
 */
export const ApiHaloRunV1alpha1UserApiFactory = function (
  configuration?: Configuration,
  basePath?: string,
  axios?: AxiosInstance
) {
  const localVarFp = ApiHaloRunV1alpha1UserApiFp(configuration);
  return {
    /**
     * Sign up a new user
     * @param {ApiHaloRunV1alpha1UserApiSignUpRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    signUp(
      requestParameters: ApiHaloRunV1alpha1UserApiSignUpRequest,
      options?: AxiosRequestConfig
    ): AxiosPromise<User> {
      return localVarFp
        .signUp(requestParameters.signUpRequest, options)
        .then((request) => request(axios, basePath));
    },
  };
};

/**
 * Request parameters for signUp operation in ApiHaloRunV1alpha1UserApi.
 * @export
 * @interface ApiHaloRunV1alpha1UserApiSignUpRequest
 */
export interface ApiHaloRunV1alpha1UserApiSignUpRequest {
  /**
   *
   * @type {SignUpRequest}
   * @memberof ApiHaloRunV1alpha1UserApiSignUp
   */
  readonly signUpRequest: SignUpRequest;
}

/**
 * ApiHaloRunV1alpha1UserApi - object-oriented interface
 * @export
 * @class ApiHaloRunV1alpha1UserApi
 * @extends {BaseAPI}
 */
export class ApiHaloRunV1alpha1UserApi extends BaseAPI {
  /**
   * Sign up a new user
   * @param {ApiHaloRunV1alpha1UserApiSignUpRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof ApiHaloRunV1alpha1UserApi
   */
  public signUp(
    requestParameters: ApiHaloRunV1alpha1UserApiSignUpRequest,
    options?: AxiosRequestConfig
  ) {
    return ApiHaloRunV1alpha1UserApiFp(this.configuration)
      .signUp(requestParameters.signUpRequest, options)
      .then((request) => request(this.axios, this.basePath));
  }
}
