/* tslint:disable */
/* eslint-disable */
/**
 * Admin API
 * The Admin API is used to manage the ApeCloud platform. 
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: support@apecloud.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 } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
// @ts-ignore
import type { APIErrorResponse } from '../models';
// @ts-ignore
import type { OrgResourceQuota } from '../models';
// @ts-ignore
import type { OrgResourceQuotaAndUsage } from '../models';
/**
 * OrganizationResourceQuotaApi - axios parameter creator
 * @export
 */
export const OrganizationResourceQuotaApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Update the resource quota of an organization
         * @summary Update the resource quota of an organization
         * @param {string} orgName The name of the organization
         * @param {OrgResourceQuota} orgResourceQuota 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        resourceQuota: async (orgName: string, orgResourceQuota: OrgResourceQuota, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('resourceQuota', 'orgName', orgName)
            // verify required parameter 'orgResourceQuota' is not null or undefined
            assertParamExists('resourceQuota', 'orgResourceQuota', orgResourceQuota)
            const localVarPath = `/admin/v1/organizations/{orgName}/resourceQuota`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)));
            // 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 BearerToken required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication DigestAuth required
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)


    
            localVarHeaderParameter['Content-Type'] = 'application/json';

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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Get the resource quota and usage of an organization
         * @param {string} orgName The name of the organization
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        resourceQuotaAndUsage: async (orgName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('resourceQuotaAndUsage', 'orgName', orgName)
            const localVarPath = `/admin/v1/organizations/{orgName}/resourceQuota`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)));
            // 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 BearerToken required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication DigestAuth required
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)


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

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

/**
 * OrganizationResourceQuotaApi - functional programming interface
 * @export
 */
export const OrganizationResourceQuotaApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = OrganizationResourceQuotaApiAxiosParamCreator(configuration)
    return {
        /**
         * Update the resource quota of an organization
         * @summary Update the resource quota of an organization
         * @param {string} orgName The name of the organization
         * @param {OrgResourceQuota} orgResourceQuota 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async resourceQuota(orgName: string, orgResourceQuota: OrgResourceQuota, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.resourceQuota(orgName, orgResourceQuota, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['OrganizationResourceQuotaApi.resourceQuota']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Get the resource quota and usage of an organization
         * @param {string} orgName The name of the organization
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async resourceQuotaAndUsage(orgName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<OrgResourceQuotaAndUsage>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.resourceQuotaAndUsage(orgName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['OrganizationResourceQuotaApi.resourceQuotaAndUsage']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * OrganizationResourceQuotaApi - factory interface
 * @export
 */
export const OrganizationResourceQuotaApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = OrganizationResourceQuotaApiFp(configuration)
    return {
        /**
         * Update the resource quota of an organization
         * @summary Update the resource quota of an organization
         * @param {OrganizationResourceQuotaApiResourceQuotaRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        resourceQuota(requestParameters: OrganizationResourceQuotaApiResourceQuotaRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.resourceQuota(requestParameters.orgName, requestParameters.orgResourceQuota, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Get the resource quota and usage of an organization
         * @param {OrganizationResourceQuotaApiResourceQuotaAndUsageRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        resourceQuotaAndUsage(requestParameters: OrganizationResourceQuotaApiResourceQuotaAndUsageRequest, options?: RawAxiosRequestConfig): AxiosPromise<OrgResourceQuotaAndUsage> {
            return localVarFp.resourceQuotaAndUsage(requestParameters.orgName, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * OrganizationResourceQuotaApi - interface
 * @export
 * @interface OrganizationResourceQuotaApi
 */
export interface OrganizationResourceQuotaApiInterface {
    /**
     * Update the resource quota of an organization
     * @summary Update the resource quota of an organization
     * @param {OrganizationResourceQuotaApiResourceQuotaRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof OrganizationResourceQuotaApiInterface
     */
    resourceQuota(requestParameters: OrganizationResourceQuotaApiResourceQuotaRequest, options?: RawAxiosRequestConfig): AxiosPromise<void>;

    /**
     * 
     * @summary Get the resource quota and usage of an organization
     * @param {OrganizationResourceQuotaApiResourceQuotaAndUsageRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof OrganizationResourceQuotaApiInterface
     */
    resourceQuotaAndUsage(requestParameters: OrganizationResourceQuotaApiResourceQuotaAndUsageRequest, options?: RawAxiosRequestConfig): AxiosPromise<OrgResourceQuotaAndUsage>;

}

/**
 * Request parameters for resourceQuota operation in OrganizationResourceQuotaApi.
 * @export
 * @interface OrganizationResourceQuotaApiResourceQuotaRequest
 */
export interface OrganizationResourceQuotaApiResourceQuotaRequest {
    /**
     * The name of the organization
     * @type {string}
     * @memberof OrganizationResourceQuotaApiResourceQuota
     */
    readonly orgName: string

    /**
     * 
     * @type {OrgResourceQuota}
     * @memberof OrganizationResourceQuotaApiResourceQuota
     */
    readonly orgResourceQuota: OrgResourceQuota
}

/**
 * Request parameters for resourceQuotaAndUsage operation in OrganizationResourceQuotaApi.
 * @export
 * @interface OrganizationResourceQuotaApiResourceQuotaAndUsageRequest
 */
export interface OrganizationResourceQuotaApiResourceQuotaAndUsageRequest {
    /**
     * The name of the organization
     * @type {string}
     * @memberof OrganizationResourceQuotaApiResourceQuotaAndUsage
     */
    readonly orgName: string
}

/**
 * OrganizationResourceQuotaApi - object-oriented interface
 * @export
 * @class OrganizationResourceQuotaApi
 * @extends {BaseAPI}
 */
export class OrganizationResourceQuotaApi extends BaseAPI implements OrganizationResourceQuotaApiInterface {
    /**
     * Update the resource quota of an organization
     * @summary Update the resource quota of an organization
     * @param {OrganizationResourceQuotaApiResourceQuotaRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof OrganizationResourceQuotaApi
     */
    public resourceQuota(requestParameters: OrganizationResourceQuotaApiResourceQuotaRequest, options?: RawAxiosRequestConfig) {
        return OrganizationResourceQuotaApiFp(this.configuration).resourceQuota(requestParameters.orgName, requestParameters.orgResourceQuota, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Get the resource quota and usage of an organization
     * @param {OrganizationResourceQuotaApiResourceQuotaAndUsageRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof OrganizationResourceQuotaApi
     */
    public resourceQuotaAndUsage(requestParameters: OrganizationResourceQuotaApiResourceQuotaAndUsageRequest, options?: RawAxiosRequestConfig) {
        return OrganizationResourceQuotaApiFp(this.configuration).resourceQuotaAndUsage(requestParameters.orgName, options).then((request) => request(this.axios, this.basePath));
    }
}

