/* 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 { ApiKeyList } from '../models';
// @ts-ignore
import type { ApiKeyResponse } from '../models';
// @ts-ignore
import type { CreateApiKey } from '../models';
/**
 * ApiKeysApi - axios parameter creator
 */
export const ApiKeysApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary Create API key
         * @param {CreateApiKey} createApiKey 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createApiKey: async (createApiKey: CreateApiKey, xDaytonaOrganizationID?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'createApiKey' is not null or undefined
            assertParamExists('createApiKey', 'createApiKey', createApiKey)
            const localVarPath = `/api-keys`;
            // 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['Content-Type'] = 'application/json';
            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};
            localVarRequestOptions.data = serializeDataIfNeeded(createApiKey, localVarRequestOptions, configuration)

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Delete API key
         * @param {string} name 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteApiKey: async (name: string, xDaytonaOrganizationID?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'name' is not null or undefined
            assertParamExists('deleteApiKey', 'name', name)
            const localVarPath = `/api-keys/{name}`
                .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: 'DELETE', ...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,
            };
        },
        /**
         * 
         * @summary Delete API key for user
         * @param {string} userId 
         * @param {string} name 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteApiKeyForUser: async (userId: string, name: string, xDaytonaOrganizationID?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'userId' is not null or undefined
            assertParamExists('deleteApiKeyForUser', 'userId', userId)
            // verify required parameter 'name' is not null or undefined
            assertParamExists('deleteApiKeyForUser', 'name', name)
            const localVarPath = `/api-keys/{userId}/{name}`
                .replace(`{${"userId"}}`, encodeURIComponent(String(userId)))
                .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: 'DELETE', ...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,
            };
        },
        /**
         * 
         * @summary Get API key
         * @param {string} name 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getApiKey: async (name: string, xDaytonaOrganizationID?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'name' is not null or undefined
            assertParamExists('getApiKey', 'name', name)
            const localVarPath = `/api-keys/{name}`
                .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 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 current API key\'s details
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getCurrentApiKey: async (xDaytonaOrganizationID?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/api-keys/current`;
            // 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 List API keys
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listApiKeys: async (xDaytonaOrganizationID?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/api-keys`;
            // 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,
            };
        },
    }
};

/**
 * ApiKeysApi - functional programming interface
 */
export const ApiKeysApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = ApiKeysApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary Create API key
         * @param {CreateApiKey} createApiKey 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createApiKey(createApiKey: CreateApiKey, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiKeyResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.createApiKey(createApiKey, xDaytonaOrganizationID, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['ApiKeysApi.createApiKey']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Delete API key
         * @param {string} name 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteApiKey(name: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.deleteApiKey(name, xDaytonaOrganizationID, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['ApiKeysApi.deleteApiKey']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Delete API key for user
         * @param {string} userId 
         * @param {string} name 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteApiKeyForUser(userId: string, name: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.deleteApiKeyForUser(userId, name, xDaytonaOrganizationID, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['ApiKeysApi.deleteApiKeyForUser']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Get API key
         * @param {string} name 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getApiKey(name: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiKeyList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getApiKey(name, xDaytonaOrganizationID, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['ApiKeysApi.getApiKey']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Get current API key\'s details
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getCurrentApiKey(xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiKeyList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getCurrentApiKey(xDaytonaOrganizationID, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['ApiKeysApi.getCurrentApiKey']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary List API keys
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listApiKeys(xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<ApiKeyList>>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listApiKeys(xDaytonaOrganizationID, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['ApiKeysApi.listApiKeys']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * ApiKeysApi - factory interface
 */
export const ApiKeysApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = ApiKeysApiFp(configuration)
    return {
        /**
         * 
         * @summary Create API key
         * @param {CreateApiKey} createApiKey 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createApiKey(createApiKey: CreateApiKey, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): AxiosPromise<ApiKeyResponse> {
            return localVarFp.createApiKey(createApiKey, xDaytonaOrganizationID, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Delete API key
         * @param {string} name 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteApiKey(name: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.deleteApiKey(name, xDaytonaOrganizationID, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Delete API key for user
         * @param {string} userId 
         * @param {string} name 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteApiKeyForUser(userId: string, name: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.deleteApiKeyForUser(userId, name, xDaytonaOrganizationID, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Get API key
         * @param {string} name 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getApiKey(name: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): AxiosPromise<ApiKeyList> {
            return localVarFp.getApiKey(name, xDaytonaOrganizationID, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Get current API key\'s details
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getCurrentApiKey(xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): AxiosPromise<ApiKeyList> {
            return localVarFp.getCurrentApiKey(xDaytonaOrganizationID, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary List API keys
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listApiKeys(xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): AxiosPromise<Array<ApiKeyList>> {
            return localVarFp.listApiKeys(xDaytonaOrganizationID, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * ApiKeysApi - object-oriented interface
 */
export class ApiKeysApi extends BaseAPI {
    /**
     * 
     * @summary Create API key
     * @param {CreateApiKey} createApiKey 
     * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public createApiKey(createApiKey: CreateApiKey, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig) {
        return ApiKeysApiFp(this.configuration).createApiKey(createApiKey, xDaytonaOrganizationID, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Delete API key
     * @param {string} name 
     * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public deleteApiKey(name: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig) {
        return ApiKeysApiFp(this.configuration).deleteApiKey(name, xDaytonaOrganizationID, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Delete API key for user
     * @param {string} userId 
     * @param {string} name 
     * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public deleteApiKeyForUser(userId: string, name: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig) {
        return ApiKeysApiFp(this.configuration).deleteApiKeyForUser(userId, name, xDaytonaOrganizationID, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Get API key
     * @param {string} name 
     * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public getApiKey(name: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig) {
        return ApiKeysApiFp(this.configuration).getApiKey(name, xDaytonaOrganizationID, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Get current API key\'s details
     * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public getCurrentApiKey(xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig) {
        return ApiKeysApiFp(this.configuration).getCurrentApiKey(xDaytonaOrganizationID, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary List API keys
     * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public listApiKeys(xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig) {
        return ApiKeysApiFp(this.configuration).listApiKeys(xDaytonaOrganizationID, options).then((request) => request(this.axios, this.basePath));
    }
}

