// 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';
/**
 * TimelineApi - axios parameter creator
 * @export
 */
export const TimelineApiAxiosParamCreator = function (configuration) {
    return {
        /**
         *
         * @param {string} contactId
         * @param {string} [page]
         * @param {string} [size]
         * @param {string} [q]
         * @param {string} [sort]
         * @param {Array<string>} [fields]
         * @param {Array<string>} [ids]
         * @param {string} [dateFrom]
         * @param {string} [dateTo]
         * @param {Array<'chat' | 'call' | 'email'>} [type]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getTimeline: (contactId, page, size, q, sort, fields, ids, dateFrom, dateTo, type, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // verify required parameter 'contactId' is not null or undefined
            if (contactId === null || contactId === undefined) {
                throw new RequiredError('contactId', 'Required parameter contactId was null or undefined when calling getTimeline.');
            }
            const localVarPath = `/contacts/{contact_id}/timeline`.replace(`{${'contact_id'}}`, encodeURIComponent(String(contactId)));
            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 (ids) {
                localVarQueryParameter['ids'] = ids;
            }
            if (dateFrom !== undefined) {
                localVarQueryParameter['date_from'] = dateFrom;
            }
            if (dateTo !== undefined) {
                localVarQueryParameter['date_to'] = dateTo;
            }
            if (type) {
                localVarQueryParameter['type'] = type;
            }
            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} contactId
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getTimelineCounter: (contactId, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // verify required parameter 'contactId' is not null or undefined
            if (contactId === null || contactId === undefined) {
                throw new RequiredError('contactId', 'Required parameter contactId was null or undefined when calling getTimelineCounter.');
            }
            const localVarPath = `/contacts/{contact_id}/timeline/counter`.replace(`{${'contact_id'}}`, encodeURIComponent(String(contactId)));
            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;
            }
            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,
            };
        }),
    };
};
/**
 * TimelineApi - functional programming interface
 * @export
 */
export const TimelineApiFp = function (configuration) {
    return {
        /**
         *
         * @param {string} contactId
         * @param {string} [page]
         * @param {string} [size]
         * @param {string} [q]
         * @param {string} [sort]
         * @param {Array<string>} [fields]
         * @param {Array<string>} [ids]
         * @param {string} [dateFrom]
         * @param {string} [dateTo]
         * @param {Array<'chat' | 'call' | 'email'>} [type]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getTimeline(contactId, page, size, q, sort, fields, ids, dateFrom, dateTo, type, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield TimelineApiAxiosParamCreator(configuration).getTimeline(contactId, page, size, q, sort, fields, ids, dateFrom, dateTo, type, 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} contactId
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getTimelineCounter(contactId, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield TimelineApiAxiosParamCreator(configuration).getTimelineCounter(contactId, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
    };
};
/**
 * TimelineApi - factory interface
 * @export
 */
export const TimelineApiFactory = function (configuration, basePath, axios) {
    return {
        /**
         *
         * @param {string} contactId
         * @param {string} [page]
         * @param {string} [size]
         * @param {string} [q]
         * @param {string} [sort]
         * @param {Array<string>} [fields]
         * @param {Array<string>} [ids]
         * @param {string} [dateFrom]
         * @param {string} [dateTo]
         * @param {Array<'chat' | 'call' | 'email'>} [type]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getTimeline(contactId, page, size, q, sort, fields, ids, dateFrom, dateTo, type, options) {
            return TimelineApiFp(configuration)
                .getTimeline(contactId, page, size, q, sort, fields, ids, dateFrom, dateTo, type, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @param {string} contactId
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getTimelineCounter(contactId, options) {
            return TimelineApiFp(configuration)
                .getTimelineCounter(contactId, options)
                .then((request) => request(axios, basePath));
        },
    };
};
/**
 * TimelineApi - object-oriented interface
 * @export
 * @class TimelineApi
 * @extends {BaseAPI}
 */
export class TimelineApi extends BaseAPI {
    /**
     *
     * @param {string} contactId
     * @param {string} [page]
     * @param {string} [size]
     * @param {string} [q]
     * @param {string} [sort]
     * @param {Array<string>} [fields]
     * @param {Array<string>} [ids]
     * @param {string} [dateFrom]
     * @param {string} [dateTo]
     * @param {Array<'chat' | 'call' | 'email'>} [type]
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof TimelineApi
     */
    getTimeline(contactId, page, size, q, sort, fields, ids, dateFrom, dateTo, type, options) {
        return TimelineApiFp(this.configuration)
            .getTimeline(contactId, page, size, q, sort, fields, ids, dateFrom, dateTo, type, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @param {string} contactId
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof TimelineApi
     */
    getTimelineCounter(contactId, options) {
        return TimelineApiFp(this.configuration)
            .getTimelineCounter(contactId, options)
            .then((request) => request(this.axios, this.basePath));
    }
}
//# sourceMappingURL=timeline-api.js.map