// 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';
/**
 * CaseCommunicationsApi - axios parameter creator
 * @export
 */
export const CaseCommunicationsApiAxiosParamCreator = function (configuration) {
    return {
        /**
         *
         * @summary Links a communication to a specific case.
         * @param {string} caseEtag Case identifier.
         * @param {WebitelCasesInputCaseCommunication} input Input data for the communications to link.
         * @param {Array<string>} [fields] List of fields to include in the response.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        linkCommunication: async (caseEtag, input, fields, options = {}) => {
            // 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 linkCommunication.');
            }
            // verify required parameter 'input' is not null or undefined
            if (input === null || input === undefined) {
                throw new RequiredError('input', 'Required parameter input was null or undefined when calling linkCommunication.');
            }
            const localVarPath = `/cases/{case_etag}/communication`.replace(`{${'case_etag'}}`, encodeURIComponent(String(caseEtag)));
            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 (fields) {
                localVarQueryParameter['fields'] = fields;
            }
            localVarHeaderParameter['Content-Type'] = 'application/json';
            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,
            };
            const needsSerialization = typeof input !== 'string' ||
                localVarRequestOptions.headers['Content-Type'] === 'application/json';
            localVarRequestOptions.data = needsSerialization
                ? JSON.stringify(input !== undefined ? input : {})
                : input || '';
            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         *
         * @summary Lists all communications linked to a specific case. Currently a feature for future development.
         * @param {string} caseEtag Case identifier.
         * @param {Array<string>} [fields] List of fields to include in the response.
         * @param {string} [q] Query string for filtering results.
         * @param {number} [size] Number of records per page.
         * @param {number} [page] Page number for pagination.
         * @param {string} [sort] Sorting order.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listCommunications: async (caseEtag, fields, q, size, page, sort, options = {}) => {
            // 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 listCommunications.');
            }
            const localVarPath = `/cases/{case_etag}/communication`.replace(`{${'case_etag'}}`, encodeURIComponent(String(caseEtag)));
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = {
                method: 'GET',
                ...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 (fields) {
                localVarQueryParameter['fields'] = fields;
            }
            if (q !== undefined) {
                localVarQueryParameter['q'] = q;
            }
            if (size !== undefined) {
                localVarQueryParameter['size'] = size;
            }
            if (page !== undefined) {
                localVarQueryParameter['page'] = page;
            }
            if (sort !== undefined) {
                localVarQueryParameter['sort'] = sort;
            }
            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 Unlinks a communication from a specific case.
         * @param {string} caseEtag
         * @param {string} id Communication identifier.
         * @param {Array<string>} [fields] List of fields to include in the response.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        unlinkCommunication: async (caseEtag, id, fields, options = {}) => {
            // 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 unlinkCommunication.');
            }
            // 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 unlinkCommunication.');
            }
            const localVarPath = `/cases/{case_etag}/communication/{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 = {
                method: 'DELETE',
                ...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 (fields) {
                localVarQueryParameter['fields'] = fields;
            }
            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,
            };
        },
    };
};
/**
 * CaseCommunicationsApi - functional programming interface
 * @export
 */
export const CaseCommunicationsApiFp = function (configuration) {
    return {
        /**
         *
         * @summary Links a communication to a specific case.
         * @param {string} caseEtag Case identifier.
         * @param {WebitelCasesInputCaseCommunication} input Input data for the communications to link.
         * @param {Array<string>} [fields] List of fields to include in the response.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async linkCommunication(caseEtag, input, fields, options) {
            const localVarAxiosArgs = await CaseCommunicationsApiAxiosParamCreator(configuration).linkCommunication(caseEtag, input, fields, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         *
         * @summary Lists all communications linked to a specific case. Currently a feature for future development.
         * @param {string} caseEtag Case identifier.
         * @param {Array<string>} [fields] List of fields to include in the response.
         * @param {string} [q] Query string for filtering results.
         * @param {number} [size] Number of records per page.
         * @param {number} [page] Page number for pagination.
         * @param {string} [sort] Sorting order.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listCommunications(caseEtag, fields, q, size, page, sort, options) {
            const localVarAxiosArgs = await CaseCommunicationsApiAxiosParamCreator(configuration).listCommunications(caseEtag, fields, q, size, page, sort, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         *
         * @summary Unlinks a communication from a specific case.
         * @param {string} caseEtag
         * @param {string} id Communication identifier.
         * @param {Array<string>} [fields] List of fields to include in the response.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async unlinkCommunication(caseEtag, id, fields, options) {
            const localVarAxiosArgs = await CaseCommunicationsApiAxiosParamCreator(configuration).unlinkCommunication(caseEtag, id, fields, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
    };
};
/**
 * CaseCommunicationsApi - factory interface
 * @export
 */
export const CaseCommunicationsApiFactory = function (configuration, basePath, axios) {
    return {
        /**
         *
         * @summary Links a communication to a specific case.
         * @param {string} caseEtag Case identifier.
         * @param {WebitelCasesInputCaseCommunication} input Input data for the communications to link.
         * @param {Array<string>} [fields] List of fields to include in the response.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        linkCommunication(caseEtag, input, fields, options) {
            return CaseCommunicationsApiFp(configuration)
                .linkCommunication(caseEtag, input, fields, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Lists all communications linked to a specific case. Currently a feature for future development.
         * @param {string} caseEtag Case identifier.
         * @param {Array<string>} [fields] List of fields to include in the response.
         * @param {string} [q] Query string for filtering results.
         * @param {number} [size] Number of records per page.
         * @param {number} [page] Page number for pagination.
         * @param {string} [sort] Sorting order.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listCommunications(caseEtag, fields, q, size, page, sort, options) {
            return CaseCommunicationsApiFp(configuration)
                .listCommunications(caseEtag, fields, q, size, page, sort, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Unlinks a communication from a specific case.
         * @param {string} caseEtag
         * @param {string} id Communication identifier.
         * @param {Array<string>} [fields] List of fields to include in the response.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        unlinkCommunication(caseEtag, id, fields, options) {
            return CaseCommunicationsApiFp(configuration)
                .unlinkCommunication(caseEtag, id, fields, options)
                .then((request) => request(axios, basePath));
        },
    };
};
/**
 * CaseCommunicationsApi - object-oriented interface
 * @export
 * @class CaseCommunicationsApi
 * @extends {BaseAPI}
 */
export class CaseCommunicationsApi extends BaseAPI {
    /**
     *
     * @summary Links a communication to a specific case.
     * @param {string} caseEtag Case identifier.
     * @param {WebitelCasesInputCaseCommunication} input Input data for the communications to link.
     * @param {Array<string>} [fields] List of fields to include in the response.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof CaseCommunicationsApi
     */
    linkCommunication(caseEtag, input, fields, options) {
        return CaseCommunicationsApiFp(this.configuration)
            .linkCommunication(caseEtag, input, fields, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Lists all communications linked to a specific case. Currently a feature for future development.
     * @param {string} caseEtag Case identifier.
     * @param {Array<string>} [fields] List of fields to include in the response.
     * @param {string} [q] Query string for filtering results.
     * @param {number} [size] Number of records per page.
     * @param {number} [page] Page number for pagination.
     * @param {string} [sort] Sorting order.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof CaseCommunicationsApi
     */
    listCommunications(caseEtag, fields, q, size, page, sort, options) {
        return CaseCommunicationsApiFp(this.configuration)
            .listCommunications(caseEtag, fields, q, size, page, sort, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Unlinks a communication from a specific case.
     * @param {string} caseEtag
     * @param {string} id Communication identifier.
     * @param {Array<string>} [fields] List of fields to include in the response.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof CaseCommunicationsApi
     */
    unlinkCommunication(caseEtag, id, fields, options) {
        return CaseCommunicationsApiFp(this.configuration)
            .unlinkCommunication(caseEtag, id, fields, options)
            .then((request) => request(this.axios, this.basePath));
    }
}
//# sourceMappingURL=case-communications-api.js.map