// tslint:disable
/**
 * Webitel API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 24.04.0
 * Contact: support@webitel.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 { __awaiter } from "tslib";
import * as globalImportUrl from 'url';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { BASE_PATH, BaseAPI, RequiredError, } from '../base';
/**
 * CaseFilesApi - axios parameter creator
 * @export
 */
export const CaseFilesApiAxiosParamCreator = function (configuration) {
    return {
        /**
         *
         * @summary Delete a file
         * @param {string} caseEtag
         * @param {string} id The unique ID of the file to delete.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteFile: (caseEtag, id, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // verify required parameter 'caseEtag' is not null or undefined
            if (caseEtag === null || caseEtag === undefined) {
                throw new RequiredError('caseEtag', 'Required parameter caseEtag was null or undefined when calling deleteFile.');
            }
            // verify required parameter 'id' is not null or undefined
            if (id === null || id === undefined) {
                throw new RequiredError('id', 'Required parameter id was null or undefined when calling deleteFile.');
            }
            const localVarPath = `/cases/{case_etag}/files/{id}`
                .replace(`{${'case_etag'}}`, encodeURIComponent(String(caseEtag)))
                .replace(`{${'id'}}`, encodeURIComponent(String(id)));
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'DELETE' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication AccessToken required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? yield configuration.apiKey('X-Webitel-Access')
                    : yield configuration.apiKey;
                localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
            }
            localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            delete localVarUrlObj.search;
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        }),
        /**
         *
         * @summary Retrieve a list of files associated with a case
         * @param {string} caseEtag ID of the case to fetch files for (required).
         * @param {number} [page] The page number to retrieve.
         * @param {number} [size] Number of items per page.
         * @param {string} [q] Search term.
         * @param {Array<string>} [fields] Fields to include in the response.
         * @param {Array<string>} [ids] Array of requested id.
         * @param {string} [sort] Sorting
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listFiles: (caseEtag, page, size, q, fields, ids, sort, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // verify required parameter 'caseEtag' is not null or undefined
            if (caseEtag === null || caseEtag === undefined) {
                throw new RequiredError('caseEtag', 'Required parameter caseEtag was null or undefined when calling listFiles.');
            }
            const localVarPath = `/cases/{case_etag}/files`.replace(`{${'case_etag'}}`, encodeURIComponent(String(caseEtag)));
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication AccessToken required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? yield configuration.apiKey('X-Webitel-Access')
                    : yield configuration.apiKey;
                localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
            }
            if (page !== undefined) {
                localVarQueryParameter['page'] = page;
            }
            if (size !== undefined) {
                localVarQueryParameter['size'] = size;
            }
            if (q !== undefined) {
                localVarQueryParameter['q'] = q;
            }
            if (fields) {
                localVarQueryParameter['fields'] = fields;
            }
            if (ids) {
                localVarQueryParameter['ids'] = ids;
            }
            if (sort !== undefined) {
                localVarQueryParameter['sort'] = sort;
            }
            localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            delete localVarUrlObj.search;
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        }),
    };
};
/**
 * CaseFilesApi - functional programming interface
 * @export
 */
export const CaseFilesApiFp = function (configuration) {
    return {
        /**
         *
         * @summary Delete a file
         * @param {string} caseEtag
         * @param {string} id The unique ID of the file to delete.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteFile(caseEtag, id, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield CaseFilesApiAxiosParamCreator(configuration).deleteFile(caseEtag, id, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
        /**
         *
         * @summary Retrieve a list of files associated with a case
         * @param {string} caseEtag ID of the case to fetch files for (required).
         * @param {number} [page] The page number to retrieve.
         * @param {number} [size] Number of items per page.
         * @param {string} [q] Search term.
         * @param {Array<string>} [fields] Fields to include in the response.
         * @param {Array<string>} [ids] Array of requested id.
         * @param {string} [sort] Sorting
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listFiles(caseEtag, page, size, q, fields, ids, sort, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield CaseFilesApiAxiosParamCreator(configuration).listFiles(caseEtag, page, size, q, fields, ids, sort, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
    };
};
/**
 * CaseFilesApi - factory interface
 * @export
 */
export const CaseFilesApiFactory = function (configuration, basePath, axios) {
    return {
        /**
         *
         * @summary Delete a file
         * @param {string} caseEtag
         * @param {string} id The unique ID of the file to delete.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteFile(caseEtag, id, options) {
            return CaseFilesApiFp(configuration)
                .deleteFile(caseEtag, id, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Retrieve a list of files associated with a case
         * @param {string} caseEtag ID of the case to fetch files for (required).
         * @param {number} [page] The page number to retrieve.
         * @param {number} [size] Number of items per page.
         * @param {string} [q] Search term.
         * @param {Array<string>} [fields] Fields to include in the response.
         * @param {Array<string>} [ids] Array of requested id.
         * @param {string} [sort] Sorting
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listFiles(caseEtag, page, size, q, fields, ids, sort, options) {
            return CaseFilesApiFp(configuration)
                .listFiles(caseEtag, page, size, q, fields, ids, sort, options)
                .then((request) => request(axios, basePath));
        },
    };
};
/**
 * CaseFilesApi - object-oriented interface
 * @export
 * @class CaseFilesApi
 * @extends {BaseAPI}
 */
export class CaseFilesApi extends BaseAPI {
    /**
     *
     * @summary Delete a file
     * @param {string} caseEtag
     * @param {string} id The unique ID of the file to delete.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof CaseFilesApi
     */
    deleteFile(caseEtag, id, options) {
        return CaseFilesApiFp(this.configuration)
            .deleteFile(caseEtag, id, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Retrieve a list of files associated with a case
     * @param {string} caseEtag ID of the case to fetch files for (required).
     * @param {number} [page] The page number to retrieve.
     * @param {number} [size] Number of items per page.
     * @param {string} [q] Search term.
     * @param {Array<string>} [fields] Fields to include in the response.
     * @param {Array<string>} [ids] Array of requested id.
     * @param {string} [sort] Sorting
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof CaseFilesApi
     */
    listFiles(caseEtag, page, size, q, fields, ids, sort, options) {
        return CaseFilesApiFp(this.configuration)
            .listFiles(caseEtag, page, size, q, fields, ids, sort, options)
            .then((request) => request(this.axios, this.basePath));
    }
}
//# sourceMappingURL=case-files-api.js.map