/* 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 { ClassType } from '../models';
// @ts-ignore
import type { CreateClassType } from '../models';
/**
 * ClassTypesApi - axios parameter creator
 * @export
 */
export const ClassTypesApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary Create a new class type
         * @param {CreateClassType} [createClassType] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createClassType: async (createClassType?: CreateClassType, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/admin/v1/classTypes`;
            // 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(createClassType, localVarRequestOptions, configuration)

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Delete a class type by ID
         * @param {string} id 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteClassType: async (id: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            assertParamExists('deleteClassType', 'id', id)
            const localVarPath = `/admin/v1/classTypes/{id}`
                .replace(`{${"id"}}`, encodeURIComponent(String(id)));
            // 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 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,
            };
        },
        /**
         * 
         * @summary Get a class type by ID
         * @param {string} id 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getClassType: async (id: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            assertParamExists('getClassType', 'id', id)
            const localVarPath = `/admin/v1/classTypes/{id}`
                .replace(`{${"id"}}`, encodeURIComponent(String(id)));
            // 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,
            };
        },
        /**
         * 
         * @summary Get all class types
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getClassTypes: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/admin/v1/classTypes`;
            // 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,
            };
        },
        /**
         * 
         * @summary Update a class type by ID
         * @param {string} id 
         * @param {CreateClassType} [createClassType] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateClassType: async (id: string, createClassType?: CreateClassType, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            assertParamExists('updateClassType', 'id', id)
            const localVarPath = `/admin/v1/classTypes/{id}`
                .replace(`{${"id"}}`, encodeURIComponent(String(id)));
            // 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: 'PATCH', ...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(createClassType, localVarRequestOptions, configuration)

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

/**
 * ClassTypesApi - functional programming interface
 * @export
 */
export const ClassTypesApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = ClassTypesApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary Create a new class type
         * @param {CreateClassType} [createClassType] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createClassType(createClassType?: CreateClassType, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ClassType>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.createClassType(createClassType, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['ClassTypesApi.createClassType']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Delete a class type by ID
         * @param {string} id 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteClassType(id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.deleteClassType(id, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['ClassTypesApi.deleteClassType']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Get a class type by ID
         * @param {string} id 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getClassType(id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ClassType>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getClassType(id, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['ClassTypesApi.getClassType']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Get all class types
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getClassTypes(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<ClassType>>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getClassTypes(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['ClassTypesApi.getClassTypes']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Update a class type by ID
         * @param {string} id 
         * @param {CreateClassType} [createClassType] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async updateClassType(id: string, createClassType?: CreateClassType, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ClassType>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.updateClassType(id, createClassType, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['ClassTypesApi.updateClassType']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * ClassTypesApi - factory interface
 * @export
 */
export const ClassTypesApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = ClassTypesApiFp(configuration)
    return {
        /**
         * 
         * @summary Create a new class type
         * @param {ClassTypesApiCreateClassTypeRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createClassType(requestParameters: ClassTypesApiCreateClassTypeRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise<ClassType> {
            return localVarFp.createClassType(requestParameters.createClassType, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Delete a class type by ID
         * @param {ClassTypesApiDeleteClassTypeRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteClassType(requestParameters: ClassTypesApiDeleteClassTypeRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.deleteClassType(requestParameters.id, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Get a class type by ID
         * @param {ClassTypesApiGetClassTypeRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getClassType(requestParameters: ClassTypesApiGetClassTypeRequest, options?: RawAxiosRequestConfig): AxiosPromise<ClassType> {
            return localVarFp.getClassType(requestParameters.id, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Get all class types
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getClassTypes(options?: RawAxiosRequestConfig): AxiosPromise<Array<ClassType>> {
            return localVarFp.getClassTypes(options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Update a class type by ID
         * @param {ClassTypesApiUpdateClassTypeRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateClassType(requestParameters: ClassTypesApiUpdateClassTypeRequest, options?: RawAxiosRequestConfig): AxiosPromise<ClassType> {
            return localVarFp.updateClassType(requestParameters.id, requestParameters.createClassType, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * ClassTypesApi - interface
 * @export
 * @interface ClassTypesApi
 */
export interface ClassTypesApiInterface {
    /**
     * 
     * @summary Create a new class type
     * @param {ClassTypesApiCreateClassTypeRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ClassTypesApiInterface
     */
    createClassType(requestParameters?: ClassTypesApiCreateClassTypeRequest, options?: RawAxiosRequestConfig): AxiosPromise<ClassType>;

    /**
     * 
     * @summary Delete a class type by ID
     * @param {ClassTypesApiDeleteClassTypeRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ClassTypesApiInterface
     */
    deleteClassType(requestParameters: ClassTypesApiDeleteClassTypeRequest, options?: RawAxiosRequestConfig): AxiosPromise<void>;

    /**
     * 
     * @summary Get a class type by ID
     * @param {ClassTypesApiGetClassTypeRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ClassTypesApiInterface
     */
    getClassType(requestParameters: ClassTypesApiGetClassTypeRequest, options?: RawAxiosRequestConfig): AxiosPromise<ClassType>;

    /**
     * 
     * @summary Get all class types
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ClassTypesApiInterface
     */
    getClassTypes(options?: RawAxiosRequestConfig): AxiosPromise<Array<ClassType>>;

    /**
     * 
     * @summary Update a class type by ID
     * @param {ClassTypesApiUpdateClassTypeRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ClassTypesApiInterface
     */
    updateClassType(requestParameters: ClassTypesApiUpdateClassTypeRequest, options?: RawAxiosRequestConfig): AxiosPromise<ClassType>;

}

/**
 * Request parameters for createClassType operation in ClassTypesApi.
 * @export
 * @interface ClassTypesApiCreateClassTypeRequest
 */
export interface ClassTypesApiCreateClassTypeRequest {
    /**
     * 
     * @type {CreateClassType}
     * @memberof ClassTypesApiCreateClassType
     */
    readonly createClassType?: CreateClassType
}

/**
 * Request parameters for deleteClassType operation in ClassTypesApi.
 * @export
 * @interface ClassTypesApiDeleteClassTypeRequest
 */
export interface ClassTypesApiDeleteClassTypeRequest {
    /**
     * 
     * @type {string}
     * @memberof ClassTypesApiDeleteClassType
     */
    readonly id: string
}

/**
 * Request parameters for getClassType operation in ClassTypesApi.
 * @export
 * @interface ClassTypesApiGetClassTypeRequest
 */
export interface ClassTypesApiGetClassTypeRequest {
    /**
     * 
     * @type {string}
     * @memberof ClassTypesApiGetClassType
     */
    readonly id: string
}

/**
 * Request parameters for updateClassType operation in ClassTypesApi.
 * @export
 * @interface ClassTypesApiUpdateClassTypeRequest
 */
export interface ClassTypesApiUpdateClassTypeRequest {
    /**
     * 
     * @type {string}
     * @memberof ClassTypesApiUpdateClassType
     */
    readonly id: string

    /**
     * 
     * @type {CreateClassType}
     * @memberof ClassTypesApiUpdateClassType
     */
    readonly createClassType?: CreateClassType
}

/**
 * ClassTypesApi - object-oriented interface
 * @export
 * @class ClassTypesApi
 * @extends {BaseAPI}
 */
export class ClassTypesApi extends BaseAPI implements ClassTypesApiInterface {
    /**
     * 
     * @summary Create a new class type
     * @param {ClassTypesApiCreateClassTypeRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ClassTypesApi
     */
    public createClassType(requestParameters: ClassTypesApiCreateClassTypeRequest = {}, options?: RawAxiosRequestConfig) {
        return ClassTypesApiFp(this.configuration).createClassType(requestParameters.createClassType, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Delete a class type by ID
     * @param {ClassTypesApiDeleteClassTypeRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ClassTypesApi
     */
    public deleteClassType(requestParameters: ClassTypesApiDeleteClassTypeRequest, options?: RawAxiosRequestConfig) {
        return ClassTypesApiFp(this.configuration).deleteClassType(requestParameters.id, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Get a class type by ID
     * @param {ClassTypesApiGetClassTypeRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ClassTypesApi
     */
    public getClassType(requestParameters: ClassTypesApiGetClassTypeRequest, options?: RawAxiosRequestConfig) {
        return ClassTypesApiFp(this.configuration).getClassType(requestParameters.id, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Get all class types
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ClassTypesApi
     */
    public getClassTypes(options?: RawAxiosRequestConfig) {
        return ClassTypesApiFp(this.configuration).getClassTypes(options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Update a class type by ID
     * @param {ClassTypesApiUpdateClassTypeRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ClassTypesApi
     */
    public updateClassType(requestParameters: ClassTypesApiUpdateClassTypeRequest, options?: RawAxiosRequestConfig) {
        return ClassTypesApiFp(this.configuration).updateClassType(requestParameters.id, requestParameters.createClassType, options).then((request) => request(this.axios, this.basePath));
    }
}

