/* 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";
/**
 * ApiNotificationHaloRunV1alpha1SubscriptionApi - axios parameter creator
 * @export
 */
export const ApiNotificationHaloRunV1alpha1SubscriptionApiAxiosParamCreator =
  function (configuration?: Configuration) {
    return {
      /**
       * Unsubscribe a subscription
       * @param {string} token Unsubscribe token
       * @param {*} [options] Override http request option.
       * @throws {RequiredError}
       */
      unsubscribe: async (
        token: string,
        options: AxiosRequestConfig = {}
      ): Promise<RequestArgs> => {
        // verify required parameter 'token' is not null or undefined
        assertParamExists("unsubscribe", "token", token);
        const localVarPath = `/apis/api.notification.halo.run/v1alpha1/subscriptions/{name}/unsubscribe`;
        // 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);

        if (token !== undefined) {
          localVarQueryParameter["token"] = token;
        }

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

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

/**
 * ApiNotificationHaloRunV1alpha1SubscriptionApi - functional programming interface
 * @export
 */
export const ApiNotificationHaloRunV1alpha1SubscriptionApiFp = function (
  configuration?: Configuration
) {
  const localVarAxiosParamCreator =
    ApiNotificationHaloRunV1alpha1SubscriptionApiAxiosParamCreator(
      configuration
    );
  return {
    /**
     * Unsubscribe a subscription
     * @param {string} token Unsubscribe token
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async unsubscribe(
      token: string,
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<string>
    > {
      const localVarAxiosArgs = await localVarAxiosParamCreator.unsubscribe(
        token,
        options
      );
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
  };
};

/**
 * ApiNotificationHaloRunV1alpha1SubscriptionApi - factory interface
 * @export
 */
export const ApiNotificationHaloRunV1alpha1SubscriptionApiFactory = function (
  configuration?: Configuration,
  basePath?: string,
  axios?: AxiosInstance
) {
  const localVarFp =
    ApiNotificationHaloRunV1alpha1SubscriptionApiFp(configuration);
  return {
    /**
     * Unsubscribe a subscription
     * @param {ApiNotificationHaloRunV1alpha1SubscriptionApiUnsubscribeRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    unsubscribe(
      requestParameters: ApiNotificationHaloRunV1alpha1SubscriptionApiUnsubscribeRequest,
      options?: AxiosRequestConfig
    ): AxiosPromise<string> {
      return localVarFp
        .unsubscribe(requestParameters.token, options)
        .then((request) => request(axios, basePath));
    },
  };
};

/**
 * Request parameters for unsubscribe operation in ApiNotificationHaloRunV1alpha1SubscriptionApi.
 * @export
 * @interface ApiNotificationHaloRunV1alpha1SubscriptionApiUnsubscribeRequest
 */
export interface ApiNotificationHaloRunV1alpha1SubscriptionApiUnsubscribeRequest {
  /**
   * Unsubscribe token
   * @type {string}
   * @memberof ApiNotificationHaloRunV1alpha1SubscriptionApiUnsubscribe
   */
  readonly token: string;
}

/**
 * ApiNotificationHaloRunV1alpha1SubscriptionApi - object-oriented interface
 * @export
 * @class ApiNotificationHaloRunV1alpha1SubscriptionApi
 * @extends {BaseAPI}
 */
export class ApiNotificationHaloRunV1alpha1SubscriptionApi extends BaseAPI {
  /**
   * Unsubscribe a subscription
   * @param {ApiNotificationHaloRunV1alpha1SubscriptionApiUnsubscribeRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof ApiNotificationHaloRunV1alpha1SubscriptionApi
   */
  public unsubscribe(
    requestParameters: ApiNotificationHaloRunV1alpha1SubscriptionApiUnsubscribeRequest,
    options?: AxiosRequestConfig
  ) {
    return ApiNotificationHaloRunV1alpha1SubscriptionApiFp(this.configuration)
      .unsubscribe(requestParameters.token, options)
      .then((request) => request(this.axios, this.basePath));
  }
}
