/* 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 { CreateVolume } from '../models';
// @ts-ignore
import type { VolumeDto } from '../models';
/**
 * VolumesApi - axios parameter creator
 */
export const VolumesApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary Create a new volume
         * @param {CreateVolume} createVolume 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createVolume: async (createVolume: CreateVolume, xDaytonaOrganizationID?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'createVolume' is not null or undefined
            assertParamExists('createVolume', 'createVolume', createVolume)
            const localVarPath = `/volumes`;
            // 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(createVolume, localVarRequestOptions, configuration)

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Delete volume
         * @param {string} volumeId ID of the volume
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteVolume: async (volumeId: string, xDaytonaOrganizationID?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'volumeId' is not null or undefined
            assertParamExists('deleteVolume', 'volumeId', volumeId)
            const localVarPath = `/volumes/{volumeId}`
                .replace(`{${"volumeId"}}`, encodeURIComponent(String(volumeId)));
            // 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 volume details
         * @param {string} volumeId ID of the volume
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getVolume: async (volumeId: string, xDaytonaOrganizationID?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'volumeId' is not null or undefined
            assertParamExists('getVolume', 'volumeId', volumeId)
            const localVarPath = `/volumes/{volumeId}`
                .replace(`{${"volumeId"}}`, encodeURIComponent(String(volumeId)));
            // 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 volume details by name
         * @param {string} name Name of the volume
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getVolumeByName: async (name: string, xDaytonaOrganizationID?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'name' is not null or undefined
            assertParamExists('getVolumeByName', 'name', name)
            const localVarPath = `/volumes/by-name/{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 List all volumes
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {boolean} [includeDeleted] Include deleted volumes in the response
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listVolumes: async (xDaytonaOrganizationID?: string, includeDeleted?: boolean, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/volumes`;
            // 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

            if (includeDeleted !== undefined) {
                localVarQueryParameter['includeDeleted'] = includeDeleted;
            }

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

/**
 * VolumesApi - functional programming interface
 */
export const VolumesApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = VolumesApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary Create a new volume
         * @param {CreateVolume} createVolume 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createVolume(createVolume: CreateVolume, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<VolumeDto>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.createVolume(createVolume, xDaytonaOrganizationID, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['VolumesApi.createVolume']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Delete volume
         * @param {string} volumeId ID of the volume
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteVolume(volumeId: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.deleteVolume(volumeId, xDaytonaOrganizationID, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['VolumesApi.deleteVolume']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Get volume details
         * @param {string} volumeId ID of the volume
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getVolume(volumeId: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<VolumeDto>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getVolume(volumeId, xDaytonaOrganizationID, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['VolumesApi.getVolume']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Get volume details by name
         * @param {string} name Name of the volume
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getVolumeByName(name: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<VolumeDto>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getVolumeByName(name, xDaytonaOrganizationID, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['VolumesApi.getVolumeByName']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary List all volumes
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {boolean} [includeDeleted] Include deleted volumes in the response
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listVolumes(xDaytonaOrganizationID?: string, includeDeleted?: boolean, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<VolumeDto>>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listVolumes(xDaytonaOrganizationID, includeDeleted, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['VolumesApi.listVolumes']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * VolumesApi - factory interface
 */
export const VolumesApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = VolumesApiFp(configuration)
    return {
        /**
         * 
         * @summary Create a new volume
         * @param {CreateVolume} createVolume 
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createVolume(createVolume: CreateVolume, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): AxiosPromise<VolumeDto> {
            return localVarFp.createVolume(createVolume, xDaytonaOrganizationID, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Delete volume
         * @param {string} volumeId ID of the volume
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteVolume(volumeId: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.deleteVolume(volumeId, xDaytonaOrganizationID, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Get volume details
         * @param {string} volumeId ID of the volume
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getVolume(volumeId: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): AxiosPromise<VolumeDto> {
            return localVarFp.getVolume(volumeId, xDaytonaOrganizationID, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Get volume details by name
         * @param {string} name Name of the volume
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getVolumeByName(name: string, xDaytonaOrganizationID?: string, options?: RawAxiosRequestConfig): AxiosPromise<VolumeDto> {
            return localVarFp.getVolumeByName(name, xDaytonaOrganizationID, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary List all volumes
         * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
         * @param {boolean} [includeDeleted] Include deleted volumes in the response
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listVolumes(xDaytonaOrganizationID?: string, includeDeleted?: boolean, options?: RawAxiosRequestConfig): AxiosPromise<Array<VolumeDto>> {
            return localVarFp.listVolumes(xDaytonaOrganizationID, includeDeleted, options).then((request) => request(axios, basePath));
        },
    };
};

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

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

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

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

    /**
     * 
     * @summary List all volumes
     * @param {string} [xDaytonaOrganizationID] Use with JWT to specify the organization ID
     * @param {boolean} [includeDeleted] Include deleted volumes in the response
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public listVolumes(xDaytonaOrganizationID?: string, includeDeleted?: boolean, options?: RawAxiosRequestConfig) {
        return VolumesApiFp(this.configuration).listVolumes(xDaytonaOrganizationID, includeDeleted, options).then((request) => request(this.axios, this.basePath));
    }
}

