// 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';
/**
 * AgentChatServiceApi - axios parameter creator
 * @export
 */
export const AgentChatServiceApiAxiosParamCreator = function (configuration) {
    return {
        /**
         *
         * @param {number} [size] default
         * @param {number} [page]
         * @param {string} [q]
         * @param {Array<string>} [fields]
         * @param {string} [sort]
         * @param {boolean} [onlyClosed] filter
         * @param {boolean} [onlyUnprocessed]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getAgentChats: (size, page, q, fields, sort, onlyClosed, onlyUnprocessed, options = {}) => __awaiter(this, void 0, void 0, function* () {
            const localVarPath = `/agent/chats`;
            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 (size !== undefined) {
                localVarQueryParameter['size'] = size;
            }
            if (page !== undefined) {
                localVarQueryParameter['page'] = page;
            }
            if (q !== undefined) {
                localVarQueryParameter['q'] = q;
            }
            if (fields) {
                localVarQueryParameter['fields'] = fields;
            }
            if (sort !== undefined) {
                localVarQueryParameter['sort'] = sort;
            }
            if (onlyClosed !== undefined) {
                localVarQueryParameter['only_closed'] = onlyClosed;
            }
            if (onlyUnprocessed !== undefined) {
                localVarQueryParameter['only_unprocessed'] = onlyUnprocessed;
            }
            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,
            };
        }),
        /**
         *
         * @param {string} chatId
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        markChatProcessed: (chatId, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // verify required parameter 'chatId' is not null or undefined
            if (chatId === null || chatId === undefined) {
                throw new RequiredError('chatId', 'Required parameter chatId was null or undefined when calling markChatProcessed.');
            }
            const localVarPath = `/agent/chats/{chat_id}`.replace(`{${'chat_id'}}`, encodeURIComponent(String(chatId)));
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'PATCH' }, 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,
            };
        }),
    };
};
/**
 * AgentChatServiceApi - functional programming interface
 * @export
 */
export const AgentChatServiceApiFp = function (configuration) {
    return {
        /**
         *
         * @param {number} [size] default
         * @param {number} [page]
         * @param {string} [q]
         * @param {Array<string>} [fields]
         * @param {string} [sort]
         * @param {boolean} [onlyClosed] filter
         * @param {boolean} [onlyUnprocessed]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getAgentChats(size, page, q, fields, sort, onlyClosed, onlyUnprocessed, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield AgentChatServiceApiAxiosParamCreator(configuration).getAgentChats(size, page, q, fields, sort, onlyClosed, onlyUnprocessed, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
        /**
         *
         * @param {string} chatId
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        markChatProcessed(chatId, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield AgentChatServiceApiAxiosParamCreator(configuration).markChatProcessed(chatId, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
    };
};
/**
 * AgentChatServiceApi - factory interface
 * @export
 */
export const AgentChatServiceApiFactory = function (configuration, basePath, axios) {
    return {
        /**
         *
         * @param {number} [size] default
         * @param {number} [page]
         * @param {string} [q]
         * @param {Array<string>} [fields]
         * @param {string} [sort]
         * @param {boolean} [onlyClosed] filter
         * @param {boolean} [onlyUnprocessed]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getAgentChats(size, page, q, fields, sort, onlyClosed, onlyUnprocessed, options) {
            return AgentChatServiceApiFp(configuration)
                .getAgentChats(size, page, q, fields, sort, onlyClosed, onlyUnprocessed, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @param {string} chatId
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        markChatProcessed(chatId, options) {
            return AgentChatServiceApiFp(configuration)
                .markChatProcessed(chatId, options)
                .then((request) => request(axios, basePath));
        },
    };
};
/**
 * AgentChatServiceApi - object-oriented interface
 * @export
 * @class AgentChatServiceApi
 * @extends {BaseAPI}
 */
export class AgentChatServiceApi extends BaseAPI {
    /**
     *
     * @param {number} [size] default
     * @param {number} [page]
     * @param {string} [q]
     * @param {Array<string>} [fields]
     * @param {string} [sort]
     * @param {boolean} [onlyClosed] filter
     * @param {boolean} [onlyUnprocessed]
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AgentChatServiceApi
     */
    getAgentChats(size, page, q, fields, sort, onlyClosed, onlyUnprocessed, options) {
        return AgentChatServiceApiFp(this.configuration)
            .getAgentChats(size, page, q, fields, sort, onlyClosed, onlyUnprocessed, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @param {string} chatId
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AgentChatServiceApi
     */
    markChatProcessed(chatId, options) {
        return AgentChatServiceApiFp(this.configuration)
            .markChatProcessed(chatId, options)
            .then((request) => request(this.axios, this.basePath));
    }
}
//# sourceMappingURL=agent-chat-service-api.js.map