/* tslint:disable */
/* eslint-disable */
/**
 * AssistedInstall
 * Assisted installation
 *
 * The version of the OpenAPI document: 1.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 { ListManagedDomains } from '../models';
// @ts-ignore
import { ModelError } from '../models';
/**
 * ManagedDomainsApi - axios parameter creator
 * @export
 */
export const ManagedDomainsApiAxiosParamCreator = function (configuration?: Configuration) {
  return {
    /**
     * List of managed DNS domains.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    v2ListManagedDomains: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
      const localVarPath = `/v2/domains`;
      // 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 userAuth required
      await setApiKeyToObject(localVarHeaderParameter, 'Authorization', configuration);

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

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

/**
 * ManagedDomainsApi - functional programming interface
 * @export
 */
export const ManagedDomainsApiFp = function (configuration?: Configuration) {
  const localVarAxiosParamCreator = ManagedDomainsApiAxiosParamCreator(configuration);
  return {
    /**
     * List of managed DNS domains.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async v2ListManagedDomains(
      options?: AxiosRequestConfig,
    ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListManagedDomains>> {
      const localVarAxiosArgs = await localVarAxiosParamCreator.v2ListManagedDomains(options);
      return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
    },
  };
};

/**
 * ManagedDomainsApi - factory interface
 * @export
 */
export const ManagedDomainsApiFactory = function (
  configuration?: Configuration,
  basePath?: string,
  axios?: AxiosInstance,
) {
  const localVarFp = ManagedDomainsApiFp(configuration);
  return {
    /**
     * List of managed DNS domains.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    v2ListManagedDomains(options?: AxiosRequestConfig): AxiosPromise<ListManagedDomains> {
      return localVarFp.v2ListManagedDomains(options).then((request) => request(axios, basePath));
    },
  };
};

/**
 * ManagedDomainsApi - object-oriented interface
 * @export
 * @class ManagedDomainsApi
 * @extends {BaseAPI}
 */
export class ManagedDomainsApi extends BaseAPI {
  /**
   * List of managed DNS domains.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof ManagedDomainsApi
   */
  public v2ListManagedDomains(options?: AxiosRequestConfig) {
    return ManagedDomainsApiFp(this.configuration)
      .v2ListManagedDomains(options)
      .then((request) => request(this.axios, this.basePath));
  }
}
