/* tslint:disable */
/* eslint-disable */
/**
 * Daytona
 * Daytona AI platform API Docs
 *
 * The version of the OpenAPI document: 1.0
 * Contact: support@daytona.com
 *
 * 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, replaceWithSerializableTypeIfNeeded } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
// @ts-ignore
import type { WebhookAppPortalAccess } from '../models';
// @ts-ignore
import type { WebhookInitializationStatus } from '../models';
/**
 * WebhooksApi - axios parameter creator
 */
export const WebhooksApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary Get Svix Consumer App Portal access for an organization
         * @param {string} organizationId 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        webhookControllerGetAppPortalAccess: async (organizationId: string, xDaytonaOrganizationID?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'organizationId' is not null or undefined
            assertParamExists('webhookControllerGetAppPortalAccess', 'organizationId', organizationId)
            const localVarPath = `/webhooks/organizations/{organizationId}/app-portal-access`
                .replace(`{${"organizationId"}}`, encodeURIComponent(String(organizationId)));
            // 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 bearer required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication oauth2 required

            localVarHeaderParameter['Accept'] = 'application/json';

            if (xDaytonaOrganizationID != null) {
                localVarHeaderParameter['X-Daytona-Organization-ID'] = String(xDaytonaOrganizationID);
            }
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Get webhook initialization status for an organization
         * @param {string} organizationId 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        webhookControllerGetInitializationStatus: async (organizationId: string, xDaytonaOrganizationID?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'organizationId' is not null or undefined
            assertParamExists('webhookControllerGetInitializationStatus', 'organizationId', organizationId)
            const localVarPath = `/webhooks/organizations/{organizationId}/initialization-status`
                .replace(`{${"organizationId"}}`, encodeURIComponent(String(organizationId)));
            // 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 bearer required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication oauth2 required

            localVarHeaderParameter['Accept'] = 'application/json';

            if (xDaytonaOrganizationID != null) {
                localVarHeaderParameter['X-Daytona-Organization-ID'] = String(xDaytonaOrganizationID);
            }
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Refresh cached endpoint presence flag for an organization
         * @param {string} organizationId 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        webhookControllerRefreshEndpoints: async (organizationId: string, xDaytonaOrganizationID?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'organizationId' is not null or undefined
            assertParamExists('webhookControllerRefreshEndpoints', 'organizationId', organizationId)
            const localVarPath = `/webhooks/organizations/{organizationId}/refresh-endpoints`
                .replace(`{${"organizationId"}}`, encodeURIComponent(String(organizationId)));
            // 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 bearer required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication oauth2 required


            if (xDaytonaOrganizationID != null) {
                localVarHeaderParameter['X-Daytona-Organization-ID'] = String(xDaytonaOrganizationID);
            }
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

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

/**
 * WebhooksApi - functional programming interface
 */
export const WebhooksApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = WebhooksApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary Get Svix Consumer App Portal access for an organization
         * @param {string} organizationId 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async webhookControllerGetAppPortalAccess(organizationId: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<WebhookAppPortalAccess>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.webhookControllerGetAppPortalAccess(organizationId, xDaytonaOrganizationID, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['WebhooksApi.webhookControllerGetAppPortalAccess']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Get webhook initialization status for an organization
         * @param {string} organizationId 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async webhookControllerGetInitializationStatus(organizationId: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<WebhookInitializationStatus>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.webhookControllerGetInitializationStatus(organizationId, xDaytonaOrganizationID, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['WebhooksApi.webhookControllerGetInitializationStatus']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Refresh cached endpoint presence flag for an organization
         * @param {string} organizationId 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async webhookControllerRefreshEndpoints(organizationId: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.webhookControllerRefreshEndpoints(organizationId, xDaytonaOrganizationID, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['WebhooksApi.webhookControllerRefreshEndpoints']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * WebhooksApi - factory interface
 */
export const WebhooksApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = WebhooksApiFp(configuration)
    return {
        /**
         * 
         * @summary Get Svix Consumer App Portal access for an organization
         * @param {string} organizationId 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        webhookControllerGetAppPortalAccess(organizationId: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): AxiosPromise<WebhookAppPortalAccess> {
            return localVarFp.webhookControllerGetAppPortalAccess(organizationId, xDaytonaOrganizationID, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Get webhook initialization status for an organization
         * @param {string} organizationId 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        webhookControllerGetInitializationStatus(organizationId: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): AxiosPromise<WebhookInitializationStatus> {
            return localVarFp.webhookControllerGetInitializationStatus(organizationId, xDaytonaOrganizationID, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Refresh cached endpoint presence flag for an organization
         * @param {string} organizationId 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        webhookControllerRefreshEndpoints(organizationId: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.webhookControllerRefreshEndpoints(organizationId, xDaytonaOrganizationID, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * WebhooksApi - object-oriented interface
 */
export class WebhooksApi extends BaseAPI {
    /**
     * 
     * @summary Get Svix Consumer App Portal access for an organization
     * @param {string} organizationId 
     * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public webhookControllerGetAppPortalAccess(organizationId: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig) {
        return WebhooksApiFp(this.configuration).webhookControllerGetAppPortalAccess(organizationId, xDaytonaOrganizationID, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Get webhook initialization status for an organization
     * @param {string} organizationId 
     * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public webhookControllerGetInitializationStatus(organizationId: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig) {
        return WebhooksApiFp(this.configuration).webhookControllerGetInitializationStatus(organizationId, xDaytonaOrganizationID, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Refresh cached endpoint presence flag for an organization
     * @param {string} organizationId 
     * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public webhookControllerRefreshEndpoints(organizationId: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig) {
        return WebhooksApiFp(this.configuration).webhookControllerRefreshEndpoints(organizationId, xDaytonaOrganizationID, options).then((request) => request(this.axios, this.basePath));
    }
}

