/* tslint:disable */
/* eslint-disable */
/**
 * Daytona Analytics API
 * Daytona Analytics API - Read-only telemetry and usage data. Authenticated via Daytona API keys or JWT tokens.
 *
 * The version of the OpenAPI document: v0.0.0-dev
 * 
 *
 * 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, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
// @ts-ignore
import type { ModelsAggregatedUsage } from '../models';
// @ts-ignore
import type { ModelsSandboxUsage } from '../models';
// @ts-ignore
import type { ModelsUsageChartPoint } from '../models';
// @ts-ignore
import type { ModelsUsagePeriod } from '../models';
/**
 * UsageApi - axios parameter creator
 * @export
 */
export const UsageApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Returns individual usage records for a specific sandbox within a time range
         * @summary Get sandbox usage periods
         * @param {string} organizationId Organization ID
         * @param {string} sandboxId Sandbox ID
         * @param {string} from Start time (RFC3339)
         * @param {string} to End time (RFC3339)
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        organizationOrganizationIdSandboxSandboxIdUsageGet: async (organizationId: string, sandboxId: string, from: string, to: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'organizationId' is not null or undefined
            assertParamExists('organizationOrganizationIdSandboxSandboxIdUsageGet', 'organizationId', organizationId)
            // verify required parameter 'sandboxId' is not null or undefined
            assertParamExists('organizationOrganizationIdSandboxSandboxIdUsageGet', 'sandboxId', sandboxId)
            // verify required parameter 'from' is not null or undefined
            assertParamExists('organizationOrganizationIdSandboxSandboxIdUsageGet', 'from', from)
            // verify required parameter 'to' is not null or undefined
            assertParamExists('organizationOrganizationIdSandboxSandboxIdUsageGet', 'to', to)
            const localVarPath = `/organization/{organizationId}/sandbox/{sandboxId}/usage`
                .replace(`{${"organizationId"}}`, encodeURIComponent(String(organizationId)))
                .replace(`{${"sandboxId"}}`, encodeURIComponent(String(sandboxId)));
            // 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
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)

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

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


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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Returns organization-level resource usage totals for a given time period
         * @summary Get aggregated usage
         * @param {string} organizationId Organization ID
         * @param {string} from Start time (RFC3339)
         * @param {string} to End time (RFC3339)
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        organizationOrganizationIdUsageAggregatedGet: async (organizationId: string, from: string, to: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'organizationId' is not null or undefined
            assertParamExists('organizationOrganizationIdUsageAggregatedGet', 'organizationId', organizationId)
            // verify required parameter 'from' is not null or undefined
            assertParamExists('organizationOrganizationIdUsageAggregatedGet', 'from', from)
            // verify required parameter 'to' is not null or undefined
            assertParamExists('organizationOrganizationIdUsageAggregatedGet', 'to', to)
            const localVarPath = `/organization/{organizationId}/usage/aggregated`
                .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
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)

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

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


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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Returns per-minute resource usage data points for a given time period
         * @summary Get usage chart data
         * @param {string} organizationId Organization ID
         * @param {string} from Start time (RFC3339)
         * @param {string} to End time (RFC3339)
         * @param {string} [region] Region filter
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        organizationOrganizationIdUsageChartGet: async (organizationId: string, from: string, to: string, region?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'organizationId' is not null or undefined
            assertParamExists('organizationOrganizationIdUsageChartGet', 'organizationId', organizationId)
            // verify required parameter 'from' is not null or undefined
            assertParamExists('organizationOrganizationIdUsageChartGet', 'from', from)
            // verify required parameter 'to' is not null or undefined
            assertParamExists('organizationOrganizationIdUsageChartGet', 'to', to)
            const localVarPath = `/organization/{organizationId}/usage/chart`
                .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
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)

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

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

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


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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Returns resource usage aggregated per sandbox for a given time period
         * @summary Get per-sandbox usage
         * @param {string} organizationId Organization ID
         * @param {string} from Start time (RFC3339)
         * @param {string} to End time (RFC3339)
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        organizationOrganizationIdUsageSandboxGet: async (organizationId: string, from: string, to: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'organizationId' is not null or undefined
            assertParamExists('organizationOrganizationIdUsageSandboxGet', 'organizationId', organizationId)
            // verify required parameter 'from' is not null or undefined
            assertParamExists('organizationOrganizationIdUsageSandboxGet', 'from', from)
            // verify required parameter 'to' is not null or undefined
            assertParamExists('organizationOrganizationIdUsageSandboxGet', 'to', to)
            const localVarPath = `/organization/{organizationId}/usage/sandbox`
                .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
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)

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

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


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

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

/**
 * UsageApi - functional programming interface
 * @export
 */
export const UsageApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = UsageApiAxiosParamCreator(configuration)
    return {
        /**
         * Returns individual usage records for a specific sandbox within a time range
         * @summary Get sandbox usage periods
         * @param {string} organizationId Organization ID
         * @param {string} sandboxId Sandbox ID
         * @param {string} from Start time (RFC3339)
         * @param {string} to End time (RFC3339)
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async organizationOrganizationIdSandboxSandboxIdUsageGet(organizationId: string, sandboxId: string, from: string, to: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<ModelsUsagePeriod>>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.organizationOrganizationIdSandboxSandboxIdUsageGet(organizationId, sandboxId, from, to, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['UsageApi.organizationOrganizationIdSandboxSandboxIdUsageGet']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Returns organization-level resource usage totals for a given time period
         * @summary Get aggregated usage
         * @param {string} organizationId Organization ID
         * @param {string} from Start time (RFC3339)
         * @param {string} to End time (RFC3339)
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async organizationOrganizationIdUsageAggregatedGet(organizationId: string, from: string, to: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ModelsAggregatedUsage>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.organizationOrganizationIdUsageAggregatedGet(organizationId, from, to, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['UsageApi.organizationOrganizationIdUsageAggregatedGet']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Returns per-minute resource usage data points for a given time period
         * @summary Get usage chart data
         * @param {string} organizationId Organization ID
         * @param {string} from Start time (RFC3339)
         * @param {string} to End time (RFC3339)
         * @param {string} [region] Region filter
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async organizationOrganizationIdUsageChartGet(organizationId: string, from: string, to: string, region?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<ModelsUsageChartPoint>>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.organizationOrganizationIdUsageChartGet(organizationId, from, to, region, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['UsageApi.organizationOrganizationIdUsageChartGet']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Returns resource usage aggregated per sandbox for a given time period
         * @summary Get per-sandbox usage
         * @param {string} organizationId Organization ID
         * @param {string} from Start time (RFC3339)
         * @param {string} to End time (RFC3339)
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async organizationOrganizationIdUsageSandboxGet(organizationId: string, from: string, to: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<ModelsSandboxUsage>>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.organizationOrganizationIdUsageSandboxGet(organizationId, from, to, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['UsageApi.organizationOrganizationIdUsageSandboxGet']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * UsageApi - factory interface
 * @export
 */
export const UsageApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = UsageApiFp(configuration)
    return {
        /**
         * Returns individual usage records for a specific sandbox within a time range
         * @summary Get sandbox usage periods
         * @param {string} organizationId Organization ID
         * @param {string} sandboxId Sandbox ID
         * @param {string} from Start time (RFC3339)
         * @param {string} to End time (RFC3339)
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        organizationOrganizationIdSandboxSandboxIdUsageGet(organizationId: string, sandboxId: string, from: string, to: string, options?: RawAxiosRequestConfig): AxiosPromise<Array<ModelsUsagePeriod>> {
            return localVarFp.organizationOrganizationIdSandboxSandboxIdUsageGet(organizationId, sandboxId, from, to, options).then((request) => request(axios, basePath));
        },
        /**
         * Returns organization-level resource usage totals for a given time period
         * @summary Get aggregated usage
         * @param {string} organizationId Organization ID
         * @param {string} from Start time (RFC3339)
         * @param {string} to End time (RFC3339)
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        organizationOrganizationIdUsageAggregatedGet(organizationId: string, from: string, to: string, options?: RawAxiosRequestConfig): AxiosPromise<ModelsAggregatedUsage> {
            return localVarFp.organizationOrganizationIdUsageAggregatedGet(organizationId, from, to, options).then((request) => request(axios, basePath));
        },
        /**
         * Returns per-minute resource usage data points for a given time period
         * @summary Get usage chart data
         * @param {string} organizationId Organization ID
         * @param {string} from Start time (RFC3339)
         * @param {string} to End time (RFC3339)
         * @param {string} [region] Region filter
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        organizationOrganizationIdUsageChartGet(organizationId: string, from: string, to: string, region?: string, options?: RawAxiosRequestConfig): AxiosPromise<Array<ModelsUsageChartPoint>> {
            return localVarFp.organizationOrganizationIdUsageChartGet(organizationId, from, to, region, options).then((request) => request(axios, basePath));
        },
        /**
         * Returns resource usage aggregated per sandbox for a given time period
         * @summary Get per-sandbox usage
         * @param {string} organizationId Organization ID
         * @param {string} from Start time (RFC3339)
         * @param {string} to End time (RFC3339)
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        organizationOrganizationIdUsageSandboxGet(organizationId: string, from: string, to: string, options?: RawAxiosRequestConfig): AxiosPromise<Array<ModelsSandboxUsage>> {
            return localVarFp.organizationOrganizationIdUsageSandboxGet(organizationId, from, to, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * UsageApi - object-oriented interface
 * @export
 * @class UsageApi
 * @extends {BaseAPI}
 */
export class UsageApi extends BaseAPI {
    /**
     * Returns individual usage records for a specific sandbox within a time range
     * @summary Get sandbox usage periods
     * @param {string} organizationId Organization ID
     * @param {string} sandboxId Sandbox ID
     * @param {string} from Start time (RFC3339)
     * @param {string} to End time (RFC3339)
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof UsageApi
     */
    public organizationOrganizationIdSandboxSandboxIdUsageGet(organizationId: string, sandboxId: string, from: string, to: string, options?: RawAxiosRequestConfig) {
        return UsageApiFp(this.configuration).organizationOrganizationIdSandboxSandboxIdUsageGet(organizationId, sandboxId, from, to, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Returns organization-level resource usage totals for a given time period
     * @summary Get aggregated usage
     * @param {string} organizationId Organization ID
     * @param {string} from Start time (RFC3339)
     * @param {string} to End time (RFC3339)
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof UsageApi
     */
    public organizationOrganizationIdUsageAggregatedGet(organizationId: string, from: string, to: string, options?: RawAxiosRequestConfig) {
        return UsageApiFp(this.configuration).organizationOrganizationIdUsageAggregatedGet(organizationId, from, to, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Returns per-minute resource usage data points for a given time period
     * @summary Get usage chart data
     * @param {string} organizationId Organization ID
     * @param {string} from Start time (RFC3339)
     * @param {string} to End time (RFC3339)
     * @param {string} [region] Region filter
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof UsageApi
     */
    public organizationOrganizationIdUsageChartGet(organizationId: string, from: string, to: string, region?: string, options?: RawAxiosRequestConfig) {
        return UsageApiFp(this.configuration).organizationOrganizationIdUsageChartGet(organizationId, from, to, region, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Returns resource usage aggregated per sandbox for a given time period
     * @summary Get per-sandbox usage
     * @param {string} organizationId Organization ID
     * @param {string} from Start time (RFC3339)
     * @param {string} to End time (RFC3339)
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof UsageApi
     */
    public organizationOrganizationIdUsageSandboxGet(organizationId: string, from: string, to: string, options?: RawAxiosRequestConfig) {
        return UsageApiFp(this.configuration).organizationOrganizationIdUsageSandboxGet(organizationId, from, to, options).then((request) => request(this.axios, this.basePath));
    }
}

