/* tslint:disable */
/* eslint-disable */
/**
 * Halo
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 2.20.10-SNAPSHOT
 * 
 *
 * 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, RawAxiosRequestConfig } 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, operationServerMap } from '../base';
/**
 * NotificationV1alpha1PublicApi - axios parameter creator
 * @export
 */
export const NotificationV1alpha1PublicApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Unsubscribe a subscription
         * @param {string} name Subscription name
         * @param {string} token Unsubscribe token
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        unsubscribe: async (name: string, token: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'name' is not null or undefined
            assertParamExists('unsubscribe', 'name', name)
            // verify required parameter 'token' is not null or undefined
            assertParamExists('unsubscribe', 'token', token)
            const localVarPath = `/apis/api.notification.halo.run/v1alpha1/subscriptions/{name}/unsubscribe`
                .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)

            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,
            };
        },
    }
};

/**
 * NotificationV1alpha1PublicApi - functional programming interface
 * @export
 */
export const NotificationV1alpha1PublicApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = NotificationV1alpha1PublicApiAxiosParamCreator(configuration)
    return {
        /**
         * Unsubscribe a subscription
         * @param {string} name Subscription name
         * @param {string} token Unsubscribe token
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async unsubscribe(name: string, token: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<string>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.unsubscribe(name, token, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['NotificationV1alpha1PublicApi.unsubscribe']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

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

/**
 * Request parameters for unsubscribe operation in NotificationV1alpha1PublicApi.
 * @export
 * @interface NotificationV1alpha1PublicApiUnsubscribeRequest
 */
export interface NotificationV1alpha1PublicApiUnsubscribeRequest {
    /**
     * Subscription name
     * @type {string}
     * @memberof NotificationV1alpha1PublicApiUnsubscribe
     */
    readonly name: string

    /**
     * Unsubscribe token
     * @type {string}
     * @memberof NotificationV1alpha1PublicApiUnsubscribe
     */
    readonly token: string
}

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

