/* 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 { ImageRegistry } from '../models';
// @ts-ignore
import type { ImageRegistryList } from '../models';
/**
 * ImageRegistryApi - axios parameter creator
 * @export
 */
export const ImageRegistryApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary Create image registry
         * @param {ImageRegistry} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createImageRegistry: async (body: ImageRegistry, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'body' is not null or undefined
            assertParamExists('createImageRegistry', 'body', body)
            const localVarPath = `/admin/v1/imageRegistries`;
            // 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(body, localVarRequestOptions, configuration)

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Delete image registry
         * @param {string} imageRegistryName name of the image registry
         * @param {ImageRegistry} [imageRegistry] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteImageRegistry: async (imageRegistryName: string, imageRegistry?: ImageRegistry, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'imageRegistryName' is not null or undefined
            assertParamExists('deleteImageRegistry', 'imageRegistryName', imageRegistryName)
            const localVarPath = `/admin/v1/imageRegistries/{imageRegistryName}`
                .replace(`{${"imageRegistryName"}}`, encodeURIComponent(String(imageRegistryName)));
            // 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)


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

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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Get image registry
         * @param {string} imageRegistryName name of the image registry
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getImageRegistry: async (imageRegistryName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'imageRegistryName' is not null or undefined
            assertParamExists('getImageRegistry', 'imageRegistryName', imageRegistryName)
            const localVarPath = `/admin/v1/imageRegistries/{imageRegistryName}`
                .replace(`{${"imageRegistryName"}}`, encodeURIComponent(String(imageRegistryName)));
            // 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,
            };
        },
        /**
         * List image registries
         * @summary List image registries
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listImageRegistries: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/admin/v1/imageRegistries`;
            // 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,
            };
        },
        /**
         * partially update the specified image registry
         * @summary Update image registry
         * @param {string} imageRegistryName name of the image registry
         * @param {ImageRegistry} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        patchImageRegistry: async (imageRegistryName: string, body: ImageRegistry, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'imageRegistryName' is not null or undefined
            assertParamExists('patchImageRegistry', 'imageRegistryName', imageRegistryName)
            // verify required parameter 'body' is not null or undefined
            assertParamExists('patchImageRegistry', 'body', body)
            const localVarPath = `/admin/v1/imageRegistries/{imageRegistryName}`
                .replace(`{${"imageRegistryName"}}`, encodeURIComponent(String(imageRegistryName)));
            // 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(body, localVarRequestOptions, configuration)

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

/**
 * ImageRegistryApi - functional programming interface
 * @export
 */
export const ImageRegistryApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = ImageRegistryApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary Create image registry
         * @param {ImageRegistry} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createImageRegistry(body: ImageRegistry, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ImageRegistry>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.createImageRegistry(body, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['ImageRegistryApi.createImageRegistry']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Delete image registry
         * @param {string} imageRegistryName name of the image registry
         * @param {ImageRegistry} [imageRegistry] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteImageRegistry(imageRegistryName: string, imageRegistry?: ImageRegistry, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.deleteImageRegistry(imageRegistryName, imageRegistry, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['ImageRegistryApi.deleteImageRegistry']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Get image registry
         * @param {string} imageRegistryName name of the image registry
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getImageRegistry(imageRegistryName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ImageRegistry>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getImageRegistry(imageRegistryName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['ImageRegistryApi.getImageRegistry']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * List image registries
         * @summary List image registries
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listImageRegistries(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ImageRegistryList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listImageRegistries(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['ImageRegistryApi.listImageRegistries']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * partially update the specified image registry
         * @summary Update image registry
         * @param {string} imageRegistryName name of the image registry
         * @param {ImageRegistry} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async patchImageRegistry(imageRegistryName: string, body: ImageRegistry, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ImageRegistry>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.patchImageRegistry(imageRegistryName, body, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['ImageRegistryApi.patchImageRegistry']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * ImageRegistryApi - factory interface
 * @export
 */
export const ImageRegistryApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = ImageRegistryApiFp(configuration)
    return {
        /**
         * 
         * @summary Create image registry
         * @param {ImageRegistryApiCreateImageRegistryRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createImageRegistry(requestParameters: ImageRegistryApiCreateImageRegistryRequest, options?: RawAxiosRequestConfig): AxiosPromise<ImageRegistry> {
            return localVarFp.createImageRegistry(requestParameters.body, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Delete image registry
         * @param {ImageRegistryApiDeleteImageRegistryRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteImageRegistry(requestParameters: ImageRegistryApiDeleteImageRegistryRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.deleteImageRegistry(requestParameters.imageRegistryName, requestParameters.imageRegistry, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Get image registry
         * @param {ImageRegistryApiGetImageRegistryRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getImageRegistry(requestParameters: ImageRegistryApiGetImageRegistryRequest, options?: RawAxiosRequestConfig): AxiosPromise<ImageRegistry> {
            return localVarFp.getImageRegistry(requestParameters.imageRegistryName, options).then((request) => request(axios, basePath));
        },
        /**
         * List image registries
         * @summary List image registries
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listImageRegistries(options?: RawAxiosRequestConfig): AxiosPromise<ImageRegistryList> {
            return localVarFp.listImageRegistries(options).then((request) => request(axios, basePath));
        },
        /**
         * partially update the specified image registry
         * @summary Update image registry
         * @param {ImageRegistryApiPatchImageRegistryRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        patchImageRegistry(requestParameters: ImageRegistryApiPatchImageRegistryRequest, options?: RawAxiosRequestConfig): AxiosPromise<ImageRegistry> {
            return localVarFp.patchImageRegistry(requestParameters.imageRegistryName, requestParameters.body, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * ImageRegistryApi - interface
 * @export
 * @interface ImageRegistryApi
 */
export interface ImageRegistryApiInterface {
    /**
     * 
     * @summary Create image registry
     * @param {ImageRegistryApiCreateImageRegistryRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ImageRegistryApiInterface
     */
    createImageRegistry(requestParameters: ImageRegistryApiCreateImageRegistryRequest, options?: RawAxiosRequestConfig): AxiosPromise<ImageRegistry>;

    /**
     * 
     * @summary Delete image registry
     * @param {ImageRegistryApiDeleteImageRegistryRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ImageRegistryApiInterface
     */
    deleteImageRegistry(requestParameters: ImageRegistryApiDeleteImageRegistryRequest, options?: RawAxiosRequestConfig): AxiosPromise<void>;

    /**
     * 
     * @summary Get image registry
     * @param {ImageRegistryApiGetImageRegistryRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ImageRegistryApiInterface
     */
    getImageRegistry(requestParameters: ImageRegistryApiGetImageRegistryRequest, options?: RawAxiosRequestConfig): AxiosPromise<ImageRegistry>;

    /**
     * List image registries
     * @summary List image registries
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ImageRegistryApiInterface
     */
    listImageRegistries(options?: RawAxiosRequestConfig): AxiosPromise<ImageRegistryList>;

    /**
     * partially update the specified image registry
     * @summary Update image registry
     * @param {ImageRegistryApiPatchImageRegistryRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ImageRegistryApiInterface
     */
    patchImageRegistry(requestParameters: ImageRegistryApiPatchImageRegistryRequest, options?: RawAxiosRequestConfig): AxiosPromise<ImageRegistry>;

}

/**
 * Request parameters for createImageRegistry operation in ImageRegistryApi.
 * @export
 * @interface ImageRegistryApiCreateImageRegistryRequest
 */
export interface ImageRegistryApiCreateImageRegistryRequest {
    /**
     * 
     * @type {ImageRegistry}
     * @memberof ImageRegistryApiCreateImageRegistry
     */
    readonly body: ImageRegistry
}

/**
 * Request parameters for deleteImageRegistry operation in ImageRegistryApi.
 * @export
 * @interface ImageRegistryApiDeleteImageRegistryRequest
 */
export interface ImageRegistryApiDeleteImageRegistryRequest {
    /**
     * name of the image registry
     * @type {string}
     * @memberof ImageRegistryApiDeleteImageRegistry
     */
    readonly imageRegistryName: string

    /**
     * 
     * @type {ImageRegistry}
     * @memberof ImageRegistryApiDeleteImageRegistry
     */
    readonly imageRegistry?: ImageRegistry
}

/**
 * Request parameters for getImageRegistry operation in ImageRegistryApi.
 * @export
 * @interface ImageRegistryApiGetImageRegistryRequest
 */
export interface ImageRegistryApiGetImageRegistryRequest {
    /**
     * name of the image registry
     * @type {string}
     * @memberof ImageRegistryApiGetImageRegistry
     */
    readonly imageRegistryName: string
}

/**
 * Request parameters for patchImageRegistry operation in ImageRegistryApi.
 * @export
 * @interface ImageRegistryApiPatchImageRegistryRequest
 */
export interface ImageRegistryApiPatchImageRegistryRequest {
    /**
     * name of the image registry
     * @type {string}
     * @memberof ImageRegistryApiPatchImageRegistry
     */
    readonly imageRegistryName: string

    /**
     * 
     * @type {ImageRegistry}
     * @memberof ImageRegistryApiPatchImageRegistry
     */
    readonly body: ImageRegistry
}

/**
 * ImageRegistryApi - object-oriented interface
 * @export
 * @class ImageRegistryApi
 * @extends {BaseAPI}
 */
export class ImageRegistryApi extends BaseAPI implements ImageRegistryApiInterface {
    /**
     * 
     * @summary Create image registry
     * @param {ImageRegistryApiCreateImageRegistryRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ImageRegistryApi
     */
    public createImageRegistry(requestParameters: ImageRegistryApiCreateImageRegistryRequest, options?: RawAxiosRequestConfig) {
        return ImageRegistryApiFp(this.configuration).createImageRegistry(requestParameters.body, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Delete image registry
     * @param {ImageRegistryApiDeleteImageRegistryRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ImageRegistryApi
     */
    public deleteImageRegistry(requestParameters: ImageRegistryApiDeleteImageRegistryRequest, options?: RawAxiosRequestConfig) {
        return ImageRegistryApiFp(this.configuration).deleteImageRegistry(requestParameters.imageRegistryName, requestParameters.imageRegistry, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Get image registry
     * @param {ImageRegistryApiGetImageRegistryRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ImageRegistryApi
     */
    public getImageRegistry(requestParameters: ImageRegistryApiGetImageRegistryRequest, options?: RawAxiosRequestConfig) {
        return ImageRegistryApiFp(this.configuration).getImageRegistry(requestParameters.imageRegistryName, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * List image registries
     * @summary List image registries
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ImageRegistryApi
     */
    public listImageRegistries(options?: RawAxiosRequestConfig) {
        return ImageRegistryApiFp(this.configuration).listImageRegistries(options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * partially update the specified image registry
     * @summary Update image registry
     * @param {ImageRegistryApiPatchImageRegistryRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ImageRegistryApi
     */
    public patchImageRegistry(requestParameters: ImageRegistryApiPatchImageRegistryRequest, options?: RawAxiosRequestConfig) {
        return ImageRegistryApiFp(this.configuration).patchImageRegistry(requestParameters.imageRegistryName, requestParameters.body, options).then((request) => request(this.axios, this.basePath));
    }
}

