// 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';
/**
 * GroupsApi - axios parameter creator
 * @export
 */
export const GroupsApiAxiosParamCreator = function (configuration) {
    return {
        /**
         *
         * @summary Attach contacts to multiple groups
         * @param {WebitelContactsAddContactsToGroupRequest} body Request message for adding contacts to a group.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        addContactsToGroups: (body, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // 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 addContactsToGroups.');
            }
            const localVarPath = `/contacts/groups/contacts:attach`;
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, 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;
            }
            localVarHeaderParameter['Content-Type'] = 'application/json';
            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);
            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 Create a new group
         * @param {WebitelContactsCreateGroupRequest} body Request message for creating a new group.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createGroup: (body, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // 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 createGroup.');
            }
            const localVarPath = `/contacts/groups`;
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, 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;
            }
            localVarHeaderParameter['Content-Type'] = 'application/json';
            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);
            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 Delete a group
         * @param {string} id The unique ID of the group to delete.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteGroup: (id, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // 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 deleteGroup.');
            }
            const localVarPath = `/contacts/groups/{id}`.replace(`{${'id'}}`, encodeURIComponent(String(id)));
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'DELETE' }, 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,
            };
        }),
        /**
         *
         * @summary Retrieve a list of groups or search groups
         * @param {number} [page] Page number of result dataset records. offset &#x3D; (page*size)
         * @param {number} [size] Size count of records on result page. limit &#x3D; (size++)
         * @param {Array<string>} [fields] Fields to be retrieved as a result.
         * @param {Array<string>} [sort] Sort the result according to fields.
         * @param {Array<string>} [id] Filter by unique IDs.
         * @param {string} [q] Search term: group name; &#x60;?&#x60; - matches any one character &#x60;*&#x60; - matches 0 or more characters
         * @param {string} [name] Filter by group name.
         * @param {'GROUP_TYPE_UNSPECIFIED' | 'STATIC' | 'DYNAMIC'} [type] Filter by group type.   - GROUP_TYPE_UNSPECIFIED: Default value  - STATIC: Static group  - DYNAMIC: Dynamic group
         * @param {boolean} [enabled] Filter by only enabled group
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listGroups: (page, size, fields, sort, id, q, name, type, enabled, options = {}) => __awaiter(this, void 0, void 0, function* () {
            const localVarPath = `/contacts/groups`;
            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 (fields) {
                localVarQueryParameter['fields'] = fields;
            }
            if (sort) {
                localVarQueryParameter['sort'] = sort;
            }
            if (id) {
                localVarQueryParameter['id'] = id;
            }
            if (q !== undefined) {
                localVarQueryParameter['q'] = q;
            }
            if (name !== undefined) {
                localVarQueryParameter['name'] = name;
            }
            if (type !== undefined) {
                localVarQueryParameter['type'] = type;
            }
            if (enabled !== undefined) {
                localVarQueryParameter['enabled'] = enabled;
            }
            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,
            };
        }),
        /**
         *
         * @summary Locate a group by ID
         * @param {string} id The unique ID of the group to locate.
         * @param {Array<string>} [fields] Fields to be retrieved into result.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        locateGroup: (id, fields, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // 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 locateGroup.');
            }
            const localVarPath = `/contacts/groups/{id}`.replace(`{${'id'}}`, encodeURIComponent(String(id)));
            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 (fields) {
                localVarQueryParameter['fields'] = fields;
            }
            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,
            };
        }),
        /**
         *
         * @summary Remove contacts from a group
         * @param {string} groupId The unique ID of the group.
         * @param {Array<string>} [contactIds] List of contact IDs to remove from the group.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        removeContactsFromGroup: (groupId, contactIds, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // verify required parameter 'groupId' is not null or undefined
            if (groupId === null || groupId === undefined) {
                throw new RequiredError('groupId', 'Required parameter groupId was null or undefined when calling removeContactsFromGroup.');
            }
            const localVarPath = `/contacts/groups/{group_id}/contact`.replace(`{${'group_id'}}`, encodeURIComponent(String(groupId)));
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'DELETE' }, 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 (contactIds) {
                localVarQueryParameter['contact_ids'] = contactIds;
            }
            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,
            };
        }),
        /**
         *
         * @summary Update an existing group
         * @param {string} id The unique ID of the group to update.
         * @param {WebitelContactsInputGroup} input
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateGroup: (id, input, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // 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 updateGroup.');
            }
            // 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 updateGroup.');
            }
            const localVarPath = `/contacts/groups/{id}`.replace(`{${'id'}}`, encodeURIComponent(String(id)));
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'PUT' }, 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;
            }
            localVarHeaderParameter['Content-Type'] = 'application/json';
            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);
            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 Update an existing group
         * @param {string} id The unique ID of the group to update.
         * @param {WebitelContactsInputGroup} input
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateGroup2: (id, input, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // 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 updateGroup2.');
            }
            // 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 updateGroup2.');
            }
            const localVarPath = `/contacts/groups/{id}`.replace(`{${'id'}}`, encodeURIComponent(String(id)));
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'PATCH' }, 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;
            }
            localVarHeaderParameter['Content-Type'] = 'application/json';
            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);
            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,
            };
        }),
    };
};
/**
 * GroupsApi - functional programming interface
 * @export
 */
export const GroupsApiFp = function (configuration) {
    return {
        /**
         *
         * @summary Attach contacts to multiple groups
         * @param {WebitelContactsAddContactsToGroupRequest} body Request message for adding contacts to a group.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        addContactsToGroups(body, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield GroupsApiAxiosParamCreator(configuration).addContactsToGroups(body, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
        /**
         *
         * @summary Create a new group
         * @param {WebitelContactsCreateGroupRequest} body Request message for creating a new group.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createGroup(body, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield GroupsApiAxiosParamCreator(configuration).createGroup(body, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
        /**
         *
         * @summary Delete a group
         * @param {string} id The unique ID of the group to delete.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteGroup(id, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield GroupsApiAxiosParamCreator(configuration).deleteGroup(id, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
        /**
         *
         * @summary Retrieve a list of groups or search groups
         * @param {number} [page] Page number of result dataset records. offset &#x3D; (page*size)
         * @param {number} [size] Size count of records on result page. limit &#x3D; (size++)
         * @param {Array<string>} [fields] Fields to be retrieved as a result.
         * @param {Array<string>} [sort] Sort the result according to fields.
         * @param {Array<string>} [id] Filter by unique IDs.
         * @param {string} [q] Search term: group name; &#x60;?&#x60; - matches any one character &#x60;*&#x60; - matches 0 or more characters
         * @param {string} [name] Filter by group name.
         * @param {'GROUP_TYPE_UNSPECIFIED' | 'STATIC' | 'DYNAMIC'} [type] Filter by group type.   - GROUP_TYPE_UNSPECIFIED: Default value  - STATIC: Static group  - DYNAMIC: Dynamic group
         * @param {boolean} [enabled] Filter by only enabled group
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listGroups(page, size, fields, sort, id, q, name, type, enabled, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield GroupsApiAxiosParamCreator(configuration).listGroups(page, size, fields, sort, id, q, name, type, enabled, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
        /**
         *
         * @summary Locate a group by ID
         * @param {string} id The unique ID of the group to locate.
         * @param {Array<string>} [fields] Fields to be retrieved into result.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        locateGroup(id, fields, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield GroupsApiAxiosParamCreator(configuration).locateGroup(id, fields, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
        /**
         *
         * @summary Remove contacts from a group
         * @param {string} groupId The unique ID of the group.
         * @param {Array<string>} [contactIds] List of contact IDs to remove from the group.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        removeContactsFromGroup(groupId, contactIds, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield GroupsApiAxiosParamCreator(configuration).removeContactsFromGroup(groupId, contactIds, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
        /**
         *
         * @summary Update an existing group
         * @param {string} id The unique ID of the group to update.
         * @param {WebitelContactsInputGroup} input
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateGroup(id, input, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield GroupsApiAxiosParamCreator(configuration).updateGroup(id, input, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
        /**
         *
         * @summary Update an existing group
         * @param {string} id The unique ID of the group to update.
         * @param {WebitelContactsInputGroup} input
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateGroup2(id, input, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield GroupsApiAxiosParamCreator(configuration).updateGroup2(id, input, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
    };
};
/**
 * GroupsApi - factory interface
 * @export
 */
export const GroupsApiFactory = function (configuration, basePath, axios) {
    return {
        /**
         *
         * @summary Attach contacts to multiple groups
         * @param {WebitelContactsAddContactsToGroupRequest} body Request message for adding contacts to a group.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        addContactsToGroups(body, options) {
            return GroupsApiFp(configuration)
                .addContactsToGroups(body, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Create a new group
         * @param {WebitelContactsCreateGroupRequest} body Request message for creating a new group.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createGroup(body, options) {
            return GroupsApiFp(configuration)
                .createGroup(body, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Delete a group
         * @param {string} id The unique ID of the group to delete.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteGroup(id, options) {
            return GroupsApiFp(configuration)
                .deleteGroup(id, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Retrieve a list of groups or search groups
         * @param {number} [page] Page number of result dataset records. offset &#x3D; (page*size)
         * @param {number} [size] Size count of records on result page. limit &#x3D; (size++)
         * @param {Array<string>} [fields] Fields to be retrieved as a result.
         * @param {Array<string>} [sort] Sort the result according to fields.
         * @param {Array<string>} [id] Filter by unique IDs.
         * @param {string} [q] Search term: group name; &#x60;?&#x60; - matches any one character &#x60;*&#x60; - matches 0 or more characters
         * @param {string} [name] Filter by group name.
         * @param {'GROUP_TYPE_UNSPECIFIED' | 'STATIC' | 'DYNAMIC'} [type] Filter by group type.   - GROUP_TYPE_UNSPECIFIED: Default value  - STATIC: Static group  - DYNAMIC: Dynamic group
         * @param {boolean} [enabled] Filter by only enabled group
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listGroups(page, size, fields, sort, id, q, name, type, enabled, options) {
            return GroupsApiFp(configuration)
                .listGroups(page, size, fields, sort, id, q, name, type, enabled, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Locate a group by ID
         * @param {string} id The unique ID of the group to locate.
         * @param {Array<string>} [fields] Fields to be retrieved into result.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        locateGroup(id, fields, options) {
            return GroupsApiFp(configuration)
                .locateGroup(id, fields, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Remove contacts from a group
         * @param {string} groupId The unique ID of the group.
         * @param {Array<string>} [contactIds] List of contact IDs to remove from the group.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        removeContactsFromGroup(groupId, contactIds, options) {
            return GroupsApiFp(configuration)
                .removeContactsFromGroup(groupId, contactIds, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Update an existing group
         * @param {string} id The unique ID of the group to update.
         * @param {WebitelContactsInputGroup} input
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateGroup(id, input, options) {
            return GroupsApiFp(configuration)
                .updateGroup(id, input, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Update an existing group
         * @param {string} id The unique ID of the group to update.
         * @param {WebitelContactsInputGroup} input
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateGroup2(id, input, options) {
            return GroupsApiFp(configuration)
                .updateGroup2(id, input, options)
                .then((request) => request(axios, basePath));
        },
    };
};
/**
 * GroupsApi - object-oriented interface
 * @export
 * @class GroupsApi
 * @extends {BaseAPI}
 */
export class GroupsApi extends BaseAPI {
    /**
     *
     * @summary Attach contacts to multiple groups
     * @param {WebitelContactsAddContactsToGroupRequest} body Request message for adding contacts to a group.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof GroupsApi
     */
    addContactsToGroups(body, options) {
        return GroupsApiFp(this.configuration)
            .addContactsToGroups(body, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Create a new group
     * @param {WebitelContactsCreateGroupRequest} body Request message for creating a new group.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof GroupsApi
     */
    createGroup(body, options) {
        return GroupsApiFp(this.configuration)
            .createGroup(body, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Delete a group
     * @param {string} id The unique ID of the group to delete.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof GroupsApi
     */
    deleteGroup(id, options) {
        return GroupsApiFp(this.configuration)
            .deleteGroup(id, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Retrieve a list of groups or search groups
     * @param {number} [page] Page number of result dataset records. offset &#x3D; (page*size)
     * @param {number} [size] Size count of records on result page. limit &#x3D; (size++)
     * @param {Array<string>} [fields] Fields to be retrieved as a result.
     * @param {Array<string>} [sort] Sort the result according to fields.
     * @param {Array<string>} [id] Filter by unique IDs.
     * @param {string} [q] Search term: group name; &#x60;?&#x60; - matches any one character &#x60;*&#x60; - matches 0 or more characters
     * @param {string} [name] Filter by group name.
     * @param {'GROUP_TYPE_UNSPECIFIED' | 'STATIC' | 'DYNAMIC'} [type] Filter by group type.   - GROUP_TYPE_UNSPECIFIED: Default value  - STATIC: Static group  - DYNAMIC: Dynamic group
     * @param {boolean} [enabled] Filter by only enabled group
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof GroupsApi
     */
    listGroups(page, size, fields, sort, id, q, name, type, enabled, options) {
        return GroupsApiFp(this.configuration)
            .listGroups(page, size, fields, sort, id, q, name, type, enabled, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Locate a group by ID
     * @param {string} id The unique ID of the group to locate.
     * @param {Array<string>} [fields] Fields to be retrieved into result.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof GroupsApi
     */
    locateGroup(id, fields, options) {
        return GroupsApiFp(this.configuration)
            .locateGroup(id, fields, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Remove contacts from a group
     * @param {string} groupId The unique ID of the group.
     * @param {Array<string>} [contactIds] List of contact IDs to remove from the group.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof GroupsApi
     */
    removeContactsFromGroup(groupId, contactIds, options) {
        return GroupsApiFp(this.configuration)
            .removeContactsFromGroup(groupId, contactIds, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Update an existing group
     * @param {string} id The unique ID of the group to update.
     * @param {WebitelContactsInputGroup} input
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof GroupsApi
     */
    updateGroup(id, input, options) {
        return GroupsApiFp(this.configuration)
            .updateGroup(id, input, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Update an existing group
     * @param {string} id The unique ID of the group to update.
     * @param {WebitelContactsInputGroup} input
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof GroupsApi
     */
    updateGroup2(id, input, options) {
        return GroupsApiFp(this.configuration)
            .updateGroup2(id, input, options)
            .then((request) => request(this.axios, this.basePath));
    }
}
//# sourceMappingURL=groups-api.js.map