// 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';
/**
 * MessageApi - axios parameter creator
 * @export
 */
export const MessageApiAxiosParamCreator = function (configuration) {
    return {
        /**
         *
         * @summary Mark message as read by id.
         * @param {string} id
         * @param {string} [threadId]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        read: async (id, threadId, options = {}) => {
            // 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 read.');
            }
            const localVarPath = `/v1/messages/{id}/read`.replace(`{${'id'}}`, encodeURIComponent(String(id)));
            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 (threadId !== undefined) {
                localVarQueryParameter['thread_id'] = threadId;
            }
            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 SendFile delivers documents or files.
         * @param {WebitelImApiGatewayV1SendDocumentRequest} body Represents a request to send a message with document.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        sendFile: async (body, options = {}) => {
            // 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 sendFile.');
            }
            const localVarPath = `/v1/messages/file`;
            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;
            }
            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 body !== 'string' ||
                localVarRequestOptions.headers['Content-Type'] === 'application/json';
            localVarRequestOptions.data = needsSerialization
                ? JSON.stringify(body !== undefined ? body : {})
                : body || '';
            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         *
         * @summary SendImage delivers image-specific messages.
         * @param {WebitelImApiGatewayV1SendImageRequest} body Represents a request to send an message with image.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        sendImage: async (body, options = {}) => {
            // 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 sendImage.');
            }
            const localVarPath = `/v1/messages/image`;
            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;
            }
            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 body !== 'string' ||
                localVarRequestOptions.headers['Content-Type'] === 'application/json';
            localVarRequestOptions.data = needsSerialization
                ? JSON.stringify(body !== undefined ? body : {})
                : body || '';
            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         *
         * @summary SendText delivers a plain text message. We use the shared Request/Response types directly to avoid duplication.
         * @param {WebitelImApiGatewayV1SendTextRequest} body Represents a request to send a text message.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        sendText: async (body, options = {}) => {
            // 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 sendText.');
            }
            const localVarPath = `/v1/messages/text`;
            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;
            }
            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 body !== 'string' ||
                localVarRequestOptions.headers['Content-Type'] === 'application/json';
            localVarRequestOptions.data = needsSerialization
                ? JSON.stringify(body !== undefined ? body : {})
                : body || '';
            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    };
};
/**
 * MessageApi - functional programming interface
 * @export
 */
export const MessageApiFp = function (configuration) {
    return {
        /**
         *
         * @summary Mark message as read by id.
         * @param {string} id
         * @param {string} [threadId]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async read(id, threadId, options) {
            const localVarAxiosArgs = await MessageApiAxiosParamCreator(configuration).read(id, threadId, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         *
         * @summary SendFile delivers documents or files.
         * @param {WebitelImApiGatewayV1SendDocumentRequest} body Represents a request to send a message with document.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async sendFile(body, options) {
            const localVarAxiosArgs = await MessageApiAxiosParamCreator(configuration).sendFile(body, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         *
         * @summary SendImage delivers image-specific messages.
         * @param {WebitelImApiGatewayV1SendImageRequest} body Represents a request to send an message with image.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async sendImage(body, options) {
            const localVarAxiosArgs = await MessageApiAxiosParamCreator(configuration).sendImage(body, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         *
         * @summary SendText delivers a plain text message. We use the shared Request/Response types directly to avoid duplication.
         * @param {WebitelImApiGatewayV1SendTextRequest} body Represents a request to send a text message.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async sendText(body, options) {
            const localVarAxiosArgs = await MessageApiAxiosParamCreator(configuration).sendText(body, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
    };
};
/**
 * MessageApi - factory interface
 * @export
 */
export const MessageApiFactory = function (configuration, basePath, axios) {
    return {
        /**
         *
         * @summary Mark message as read by id.
         * @param {string} id
         * @param {string} [threadId]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        read(id, threadId, options) {
            return MessageApiFp(configuration)
                .read(id, threadId, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary SendFile delivers documents or files.
         * @param {WebitelImApiGatewayV1SendDocumentRequest} body Represents a request to send a message with document.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        sendFile(body, options) {
            return MessageApiFp(configuration)
                .sendFile(body, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary SendImage delivers image-specific messages.
         * @param {WebitelImApiGatewayV1SendImageRequest} body Represents a request to send an message with image.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        sendImage(body, options) {
            return MessageApiFp(configuration)
                .sendImage(body, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary SendText delivers a plain text message. We use the shared Request/Response types directly to avoid duplication.
         * @param {WebitelImApiGatewayV1SendTextRequest} body Represents a request to send a text message.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        sendText(body, options) {
            return MessageApiFp(configuration)
                .sendText(body, options)
                .then((request) => request(axios, basePath));
        },
    };
};
/**
 * MessageApi - object-oriented interface
 * @export
 * @class MessageApi
 * @extends {BaseAPI}
 */
export class MessageApi extends BaseAPI {
    /**
     *
     * @summary Mark message as read by id.
     * @param {string} id
     * @param {string} [threadId]
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof MessageApi
     */
    read(id, threadId, options) {
        return MessageApiFp(this.configuration)
            .read(id, threadId, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary SendFile delivers documents or files.
     * @param {WebitelImApiGatewayV1SendDocumentRequest} body Represents a request to send a message with document.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof MessageApi
     */
    sendFile(body, options) {
        return MessageApiFp(this.configuration)
            .sendFile(body, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary SendImage delivers image-specific messages.
     * @param {WebitelImApiGatewayV1SendImageRequest} body Represents a request to send an message with image.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof MessageApi
     */
    sendImage(body, options) {
        return MessageApiFp(this.configuration)
            .sendImage(body, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary SendText delivers a plain text message. We use the shared Request/Response types directly to avoid duplication.
     * @param {WebitelImApiGatewayV1SendTextRequest} body Represents a request to send a text message.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof MessageApi
     */
    sendText(body, options) {
        return MessageApiFp(this.configuration)
            .sendText(body, options)
            .then((request) => request(this.axios, this.basePath));
    }
}
//# sourceMappingURL=message-api.js.map