// 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 * 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';
/**
 * ContactLinkingServiceApi - axios parameter creator
 * @export
 */
export const ContactLinkingServiceApiAxiosParamCreator = function (configuration) {
    return {
        /**
         *
         * @summary CreateContactFromConversation creates new contact from the data existing in the conversation and after that links this contact to the external user.
         * @param {string} conversationId
         * @param {string} [timezoneId]
         * @param {string} [timezoneName]
         * @param {string} [ownerId]
         * @param {string} [ownerName]
         * @param {Array<string>} [label]
         * @param {string} [name]
         * @param {string} [description]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createContactFromConversation: async (conversationId, timezoneId, timezoneName, ownerId, ownerName, label, name, description, options = {}) => {
            // verify required parameter 'conversationId' is not null or undefined
            if (conversationId === null || conversationId === undefined) {
                throw new RequiredError('conversationId', 'Required parameter conversationId was null or undefined when calling createContactFromConversation.');
            }
            const localVarPath = `/chat/{conversation_id}/contact`.replace(`{${'conversation_id'}}`, encodeURIComponent(String(conversationId)));
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = {
                method: 'POST',
                ...baseOptions,
                ...options,
            };
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication AccessToken required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? await configuration.apiKey('X-Webitel-Access')
                    : await configuration.apiKey;
                localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
            }
            if (timezoneId !== undefined) {
                localVarQueryParameter['timezone.id'] = timezoneId;
            }
            if (timezoneName !== undefined) {
                localVarQueryParameter['timezone.name'] = timezoneName;
            }
            if (ownerId !== undefined) {
                localVarQueryParameter['owner.id'] = ownerId;
            }
            if (ownerName !== undefined) {
                localVarQueryParameter['owner.name'] = ownerName;
            }
            if (label) {
                localVarQueryParameter['label'] = label;
            }
            if (name !== undefined) {
                localVarQueryParameter['name'] = name;
            }
            if (description !== undefined) {
                localVarQueryParameter['description'] = description;
            }
            localVarUrlObj.query = {
                ...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 = {
                ...localVarHeaderParameter,
                ...headersFromBaseOptions,
                ...options.headers,
            };
            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         *
         * @summary LinkContactToClient creates connection between existing internal contact and external client.
         * @param {string} conversationId
         * @param {string} [contactId]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        linkContactToClient: async (conversationId, contactId, options = {}) => {
            // verify required parameter 'conversationId' is not null or undefined
            if (conversationId === null || conversationId === undefined) {
                throw new RequiredError('conversationId', 'Required parameter conversationId was null or undefined when calling linkContactToClient.');
            }
            const localVarPath = `/chat/{conversation_id}/link`.replace(`{${'conversation_id'}}`, encodeURIComponent(String(conversationId)));
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = {
                method: 'POST',
                ...baseOptions,
                ...options,
            };
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication AccessToken required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? await configuration.apiKey('X-Webitel-Access')
                    : await configuration.apiKey;
                localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
            }
            if (contactId !== undefined) {
                localVarQueryParameter['contact_id'] = contactId;
            }
            localVarUrlObj.query = {
                ...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 = {
                ...localVarHeaderParameter,
                ...headersFromBaseOptions,
                ...options.headers,
            };
            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    };
};
/**
 * ContactLinkingServiceApi - functional programming interface
 * @export
 */
export const ContactLinkingServiceApiFp = function (configuration) {
    return {
        /**
         *
         * @summary CreateContactFromConversation creates new contact from the data existing in the conversation and after that links this contact to the external user.
         * @param {string} conversationId
         * @param {string} [timezoneId]
         * @param {string} [timezoneName]
         * @param {string} [ownerId]
         * @param {string} [ownerName]
         * @param {Array<string>} [label]
         * @param {string} [name]
         * @param {string} [description]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createContactFromConversation(conversationId, timezoneId, timezoneName, ownerId, ownerName, label, name, description, options) {
            const localVarAxiosArgs = await ContactLinkingServiceApiAxiosParamCreator(configuration).createContactFromConversation(conversationId, timezoneId, timezoneName, ownerId, ownerName, label, name, description, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         *
         * @summary LinkContactToClient creates connection between existing internal contact and external client.
         * @param {string} conversationId
         * @param {string} [contactId]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async linkContactToClient(conversationId, contactId, options) {
            const localVarAxiosArgs = await ContactLinkingServiceApiAxiosParamCreator(configuration).linkContactToClient(conversationId, contactId, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
    };
};
/**
 * ContactLinkingServiceApi - factory interface
 * @export
 */
export const ContactLinkingServiceApiFactory = function (configuration, basePath, axios) {
    return {
        /**
         *
         * @summary CreateContactFromConversation creates new contact from the data existing in the conversation and after that links this contact to the external user.
         * @param {string} conversationId
         * @param {string} [timezoneId]
         * @param {string} [timezoneName]
         * @param {string} [ownerId]
         * @param {string} [ownerName]
         * @param {Array<string>} [label]
         * @param {string} [name]
         * @param {string} [description]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createContactFromConversation(conversationId, timezoneId, timezoneName, ownerId, ownerName, label, name, description, options) {
            return ContactLinkingServiceApiFp(configuration)
                .createContactFromConversation(conversationId, timezoneId, timezoneName, ownerId, ownerName, label, name, description, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary LinkContactToClient creates connection between existing internal contact and external client.
         * @param {string} conversationId
         * @param {string} [contactId]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        linkContactToClient(conversationId, contactId, options) {
            return ContactLinkingServiceApiFp(configuration)
                .linkContactToClient(conversationId, contactId, options)
                .then((request) => request(axios, basePath));
        },
    };
};
/**
 * ContactLinkingServiceApi - object-oriented interface
 * @export
 * @class ContactLinkingServiceApi
 * @extends {BaseAPI}
 */
export class ContactLinkingServiceApi extends BaseAPI {
    /**
     *
     * @summary CreateContactFromConversation creates new contact from the data existing in the conversation and after that links this contact to the external user.
     * @param {string} conversationId
     * @param {string} [timezoneId]
     * @param {string} [timezoneName]
     * @param {string} [ownerId]
     * @param {string} [ownerName]
     * @param {Array<string>} [label]
     * @param {string} [name]
     * @param {string} [description]
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ContactLinkingServiceApi
     */
    createContactFromConversation(conversationId, timezoneId, timezoneName, ownerId, ownerName, label, name, description, options) {
        return ContactLinkingServiceApiFp(this.configuration)
            .createContactFromConversation(conversationId, timezoneId, timezoneName, ownerId, ownerName, label, name, description, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary LinkContactToClient creates connection between existing internal contact and external client.
     * @param {string} conversationId
     * @param {string} [contactId]
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ContactLinkingServiceApi
     */
    linkContactToClient(conversationId, contactId, options) {
        return ContactLinkingServiceApiFp(this.configuration)
            .linkContactToClient(conversationId, contactId, options)
            .then((request) => request(this.axios, this.basePath));
    }
}
//# sourceMappingURL=contact-linking-service-api.js.map