// 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';
/**
 * FileServiceApi - axios parameter creator
 * @export
 */
export const FileServiceApiAxiosParamCreator = function (configuration) {
    return {
        /**
         *
         * @param {StorageDeleteFilesRequest} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteFiles: (body, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // verify required parameter 'body' is not null or undefined
            if (body === null || body === undefined) {
                throw new RequiredError('body', 'Required parameter body was null or undefined when calling deleteFiles.');
            }
            const localVarPath = `/storage/file`;
            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;
            }
            localVarHeaderParameter['Content-Type'] = 'application/json';
            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);
            const needsSerialization = typeof body !== 'string' ||
                localVarRequestOptions.headers['Content-Type'] === 'application/json';
            localVarRequestOptions.data = needsSerialization
                ? JSON.stringify(body !== undefined ? body : {})
                : body || '';
            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        }),
        /**
         *
         * @param {number} [page]
         * @param {number} [size]
         * @param {string} [q]
         * @param {string} [sort]
         * @param {Array<string>} [fields]
         * @param {Array<string>} [id]
         * @param {string} [uploadedAtFrom]
         * @param {string} [uploadedAtTo]
         * @param {Array<string>} [uploadedBy]
         * @param {Array<string>} [referenceId]
         * @param {Array<'UnknownChannel' | 'ChatChannel' | 'MailChannel' | 'CallChannel' | 'LogChannel' | 'MediaChannel' | 'KnowledgebaseChannel' | 'CasesChannel'>} [channel]
         * @param {string} [retentionUntilFrom]
         * @param {string} [retentionUntilTo]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        searchFiles: (page, size, q, sort, fields, id, uploadedAtFrom, uploadedAtTo, uploadedBy, referenceId, channel, retentionUntilFrom, retentionUntilTo, options = {}) => __awaiter(this, void 0, void 0, function* () {
            const localVarPath = `/storage/file`;
            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 (sort !== undefined) {
                localVarQueryParameter['sort'] = sort;
            }
            if (fields) {
                localVarQueryParameter['fields'] = fields;
            }
            if (id) {
                localVarQueryParameter['id'] = id;
            }
            if (uploadedAtFrom !== undefined) {
                localVarQueryParameter['uploaded_at.from'] = uploadedAtFrom;
            }
            if (uploadedAtTo !== undefined) {
                localVarQueryParameter['uploaded_at.to'] = uploadedAtTo;
            }
            if (uploadedBy) {
                localVarQueryParameter['uploaded_by'] = uploadedBy;
            }
            if (referenceId) {
                localVarQueryParameter['reference_id'] = referenceId;
            }
            if (channel) {
                localVarQueryParameter['channel'] = channel;
            }
            if (retentionUntilFrom !== undefined) {
                localVarQueryParameter['retention_until.from'] = retentionUntilFrom;
            }
            if (retentionUntilTo !== undefined) {
                localVarQueryParameter['retention_until.to'] = retentionUntilTo;
            }
            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,
            };
        }),
    };
};
/**
 * FileServiceApi - functional programming interface
 * @export
 */
export const FileServiceApiFp = function (configuration) {
    return {
        /**
         *
         * @param {StorageDeleteFilesRequest} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteFiles(body, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield FileServiceApiAxiosParamCreator(configuration).deleteFiles(body, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
        /**
         *
         * @param {number} [page]
         * @param {number} [size]
         * @param {string} [q]
         * @param {string} [sort]
         * @param {Array<string>} [fields]
         * @param {Array<string>} [id]
         * @param {string} [uploadedAtFrom]
         * @param {string} [uploadedAtTo]
         * @param {Array<string>} [uploadedBy]
         * @param {Array<string>} [referenceId]
         * @param {Array<'UnknownChannel' | 'ChatChannel' | 'MailChannel' | 'CallChannel' | 'LogChannel' | 'MediaChannel' | 'KnowledgebaseChannel' | 'CasesChannel'>} [channel]
         * @param {string} [retentionUntilFrom]
         * @param {string} [retentionUntilTo]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        searchFiles(page, size, q, sort, fields, id, uploadedAtFrom, uploadedAtTo, uploadedBy, referenceId, channel, retentionUntilFrom, retentionUntilTo, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield FileServiceApiAxiosParamCreator(configuration).searchFiles(page, size, q, sort, fields, id, uploadedAtFrom, uploadedAtTo, uploadedBy, referenceId, channel, retentionUntilFrom, retentionUntilTo, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
    };
};
/**
 * FileServiceApi - factory interface
 * @export
 */
export const FileServiceApiFactory = function (configuration, basePath, axios) {
    return {
        /**
         *
         * @param {StorageDeleteFilesRequest} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteFiles(body, options) {
            return FileServiceApiFp(configuration)
                .deleteFiles(body, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @param {number} [page]
         * @param {number} [size]
         * @param {string} [q]
         * @param {string} [sort]
         * @param {Array<string>} [fields]
         * @param {Array<string>} [id]
         * @param {string} [uploadedAtFrom]
         * @param {string} [uploadedAtTo]
         * @param {Array<string>} [uploadedBy]
         * @param {Array<string>} [referenceId]
         * @param {Array<'UnknownChannel' | 'ChatChannel' | 'MailChannel' | 'CallChannel' | 'LogChannel' | 'MediaChannel' | 'KnowledgebaseChannel' | 'CasesChannel'>} [channel]
         * @param {string} [retentionUntilFrom]
         * @param {string} [retentionUntilTo]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        searchFiles(page, size, q, sort, fields, id, uploadedAtFrom, uploadedAtTo, uploadedBy, referenceId, channel, retentionUntilFrom, retentionUntilTo, options) {
            return FileServiceApiFp(configuration)
                .searchFiles(page, size, q, sort, fields, id, uploadedAtFrom, uploadedAtTo, uploadedBy, referenceId, channel, retentionUntilFrom, retentionUntilTo, options)
                .then((request) => request(axios, basePath));
        },
    };
};
/**
 * FileServiceApi - object-oriented interface
 * @export
 * @class FileServiceApi
 * @extends {BaseAPI}
 */
export class FileServiceApi extends BaseAPI {
    /**
     *
     * @param {StorageDeleteFilesRequest} body
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof FileServiceApi
     */
    deleteFiles(body, options) {
        return FileServiceApiFp(this.configuration)
            .deleteFiles(body, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @param {number} [page]
     * @param {number} [size]
     * @param {string} [q]
     * @param {string} [sort]
     * @param {Array<string>} [fields]
     * @param {Array<string>} [id]
     * @param {string} [uploadedAtFrom]
     * @param {string} [uploadedAtTo]
     * @param {Array<string>} [uploadedBy]
     * @param {Array<string>} [referenceId]
     * @param {Array<'UnknownChannel' | 'ChatChannel' | 'MailChannel' | 'CallChannel' | 'LogChannel' | 'MediaChannel' | 'KnowledgebaseChannel' | 'CasesChannel'>} [channel]
     * @param {string} [retentionUntilFrom]
     * @param {string} [retentionUntilTo]
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof FileServiceApi
     */
    searchFiles(page, size, q, sort, fields, id, uploadedAtFrom, uploadedAtTo, uploadedBy, referenceId, channel, retentionUntilFrom, retentionUntilTo, options) {
        return FileServiceApiFp(this.configuration)
            .searchFiles(page, size, q, sort, fields, id, uploadedAtFrom, uploadedAtTo, uploadedBy, referenceId, channel, retentionUntilFrom, retentionUntilTo, options)
            .then((request) => request(this.axios, this.basePath));
    }
}
//# sourceMappingURL=file-service-api.js.map