/* 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 { PaginatedAuditLogs } from '../models';
/**
 * AuditApi - axios parameter creator
 */
export const AuditApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary Get audit logs for organization
         * @param {string} organizationId Organization ID
         * @param {number} [page] Page number of the results
         * @param {number} [limit] Number of results per page
         * @param {Date} [from] From date (ISO 8601 format)
         * @param {Date} [to] To date (ISO 8601 format)
         * @param {string} [nextToken] Token for cursor-based pagination. When provided, takes precedence over page parameter.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getOrganizationAuditLogs: async (organizationId: string, page?: number, limit?: number, from?: Date, to?: Date, nextToken?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'organizationId' is not null or undefined
            assertParamExists('getOrganizationAuditLogs', 'organizationId', organizationId)
            const localVarPath = `/audit/organizations/{organizationId}`
                .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

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

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

            if (from !== undefined) {
                localVarQueryParameter['from'] = (from as any instanceof Date) ?
                    (from as any).toISOString() :
                    from;
            }

            if (to !== undefined) {
                localVarQueryParameter['to'] = (to as any instanceof Date) ?
                    (to as any).toISOString() :
                    to;
            }

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

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

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

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

/**
 * AuditApi - functional programming interface
 */
export const AuditApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = AuditApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary Get audit logs for organization
         * @param {string} organizationId Organization ID
         * @param {number} [page] Page number of the results
         * @param {number} [limit] Number of results per page
         * @param {Date} [from] From date (ISO 8601 format)
         * @param {Date} [to] To date (ISO 8601 format)
         * @param {string} [nextToken] Token for cursor-based pagination. When provided, takes precedence over page parameter.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getOrganizationAuditLogs(organizationId: string, page?: number, limit?: number, from?: Date, to?: Date, nextToken?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PaginatedAuditLogs>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getOrganizationAuditLogs(organizationId, page, limit, from, to, nextToken, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AuditApi.getOrganizationAuditLogs']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * AuditApi - factory interface
 */
export const AuditApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = AuditApiFp(configuration)
    return {
        /**
         * 
         * @summary Get audit logs for organization
         * @param {string} organizationId Organization ID
         * @param {number} [page] Page number of the results
         * @param {number} [limit] Number of results per page
         * @param {Date} [from] From date (ISO 8601 format)
         * @param {Date} [to] To date (ISO 8601 format)
         * @param {string} [nextToken] Token for cursor-based pagination. When provided, takes precedence over page parameter.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getOrganizationAuditLogs(organizationId: string, page?: number, limit?: number, from?: Date, to?: Date, nextToken?: string, options?: RawAxiosRequestConfig): AxiosPromise<PaginatedAuditLogs> {
            return localVarFp.getOrganizationAuditLogs(organizationId, page, limit, from, to, nextToken, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * AuditApi - object-oriented interface
 */
export class AuditApi extends BaseAPI {
    /**
     * 
     * @summary Get audit logs for organization
     * @param {string} organizationId Organization ID
     * @param {number} [page] Page number of the results
     * @param {number} [limit] Number of results per page
     * @param {Date} [from] From date (ISO 8601 format)
     * @param {Date} [to] To date (ISO 8601 format)
     * @param {string} [nextToken] Token for cursor-based pagination. When provided, takes precedence over page parameter.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public getOrganizationAuditLogs(organizationId: string, page?: number, limit?: number, from?: Date, to?: Date, nextToken?: string, options?: RawAxiosRequestConfig) {
        return AuditApiFp(this.configuration).getOrganizationAuditLogs(organizationId, page, limit, from, to, nextToken, options).then((request) => request(this.axios, this.basePath));
    }
}

