// 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';
/**
 * MessagesServiceApi - axios parameter creator
 * @export
 */
export const MessagesServiceApiAxiosParamCreator = function (configuration) {
    return {
        /**
         *
         * @summary Broadcast message send message from via to peer recipients.
         * @param {WebitelChatBroadcastMessageRequest} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        broadcastMessage: 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 broadcastMessage.');
            }
            const localVarPath = `/chat/broadcast`;
            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,
            };
        },
    };
};
/**
 * MessagesServiceApi - functional programming interface
 * @export
 */
export const MessagesServiceApiFp = function (configuration) {
    return {
        /**
         *
         * @summary Broadcast message send message from via to peer recipients.
         * @param {WebitelChatBroadcastMessageRequest} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async broadcastMessage(body, options) {
            const localVarAxiosArgs = await MessagesServiceApiAxiosParamCreator(configuration).broadcastMessage(body, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
    };
};
/**
 * MessagesServiceApi - factory interface
 * @export
 */
export const MessagesServiceApiFactory = function (configuration, basePath, axios) {
    return {
        /**
         *
         * @summary Broadcast message send message from via to peer recipients.
         * @param {WebitelChatBroadcastMessageRequest} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        broadcastMessage(body, options) {
            return MessagesServiceApiFp(configuration)
                .broadcastMessage(body, options)
                .then((request) => request(axios, basePath));
        },
    };
};
/**
 * MessagesServiceApi - object-oriented interface
 * @export
 * @class MessagesServiceApi
 * @extends {BaseAPI}
 */
export class MessagesServiceApi extends BaseAPI {
    /**
     *
     * @summary Broadcast message send message from via to peer recipients.
     * @param {WebitelChatBroadcastMessageRequest} body
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof MessagesServiceApi
     */
    broadcastMessage(body, options) {
        return MessagesServiceApiFp(this.configuration)
            .broadcastMessage(body, options)
            .then((request) => request(this.axios, this.basePath));
    }
}
//# sourceMappingURL=messages-service-api.js.map