// 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';
/**
 * ContactsApi - axios parameter creator
 * @export
 */
export const ContactsApiAxiosParamCreator = function (configuration) {
    return {
        /**
         *
         * @summary Create NEW Contact
         * @param {WebitelContactsInputContact} input NEW Contact source changes
         * @param {Array<string>} [fields] Source Fields to return into result.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createContact: async (input, fields, options = {}) => {
            // 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 createContact.');
            }
            const localVarPath = `/contacts`;
            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 Remove Contact source
         * @param {string} etag Unique ID of the latest version of a resource.
         * @param {Array<string>} [fields] Fields to be retrieved into result of changes.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteContact: async (etag, fields, options = {}) => {
            // verify required parameter 'etag' is not null or undefined
            if (etag === null || etag === undefined) {
                throw new RequiredError('etag', 'Required parameter etag was null or undefined when calling deleteContact.');
            }
            const localVarPath = `/contacts/{etag}`.replace(`{${'etag'}}`, encodeURIComponent(String(etag)));
            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,
            };
        },
        /**
         *
         * @summary Locate Contact source
         * @param {string} etag The Contact source IDentifier. Accept: &#x60;etag&#x60; (obsolete+) or &#x60;id&#x60;.
         * @param {Array<string>} [fields] Source Fields to return into result.
         * @param {'READ' | 'WRITE' | 'DELETE'} [mode] The requirement of a special access mode to the Source.   - READ: Can &#x60;fetch&#x60; record. [GET]  - WRITE: Can &#x60;update&#x60; record. [PUT|PATCH]  - DELETE: Can &#x60;delete&#x60; record. [DELETE]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        locateContact: async (etag, fields, mode, options = {}) => {
            // verify required parameter 'etag' is not null or undefined
            if (etag === null || etag === undefined) {
                throw new RequiredError('etag', 'Required parameter etag was null or undefined when calling locateContact.');
            }
            const localVarPath = `/contacts/{etag}`.replace(`{${'etag'}}`, encodeURIComponent(String(etag)));
            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 (mode !== undefined) {
                localVarQueryParameter['mode'] = mode;
            }
            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,
            };
        },
        /**
         * | Field       | Type  | ----------- | ----  | **----------- READ-ONLY -----------** |  | `id`        | int64  | `ver`       | int32  | `etag`      | string  | **---------- OPERATIONAL ----------** |  | `created_at` | int64(epoch:milli)  | `created_by` | lookup(user)  | `updated_at` | int64(epoch:milli)  | `updated_by` | lookup(user)  | **---------- ATTRIBUTES -----------** |  | `name`      | name!  | `about`     | string  | `labels`    | list[label!]  | `emails`    | list[email!]  | `photos`    | list[photo!]  | `phones`    | list[phone!]  | `managers`  | list[manager!]  | `comments`  | list[comment!]  | `addresses` | list[address!]  | `languages` | list[language!]  | `timezones` | list[timezone!]  | `variables` | list[variable!]  | `imclients` | list[imClient!]
         * @summary Search for Contact(s)
         * @param {number} [page] Page number of result records.   _default(1); offset&#x3D;(size*(page-1));_  &#x60;&#x60;&#x60;javascript let     offset &#x3D; 0   , page &#x3D; req.page ; if (page &lt;&#x3D; 0)     page &#x3D; 1; if (page &gt; 1)     offset &#x3D; ((page-1)*size); // . . . &#x60;&#x60;&#x60;
         * @param {number} [size] Limit of result page records count.   _default(16); limit&#x3D;(size&lt;&#x3D;0?-1:size+1);_  &#x60;&#x60;&#x60;javascript const     default &#x3D; 16   , maximum &#x3D; 32 ; let limit &#x3D; req.size; if (limit &lt;&#x3D; 0)     limit &#x3D; default; if (maximum &lt; limit)     limit &#x3D; maximum; // . . . &#x60;&#x60;&#x60;
         * @param {string} [q] Search term: &#x60;?&#x60; - matches any character &#x60;*&#x60; - matches 0 or more characters Used to query records within a set of &#x60;qin&#x60; fields, eg: name,emails{type},labels etc...
         * @param {Array<string>} [sort] Sort result dataset of records by fields. &#x60;&#x60;&#x60; sort ::&#x3D; *( ORDER name )  ORDER  &#x3D; ASC / DESC DESC   &#x3D; \&quot;-\&quot; / \&quot;!\&quot; ASC    &#x3D; [ \&quot;+\&quot; ]   ; Default &#x60;&#x60;&#x60;  Fields available  - &#x60;id&#x60;(seq) - &#x60;domain&#x60;{name} - &#x60;created_at&#x60; - &#x60;created_by&#x60;{name} - &#x60;updated_at&#x60; - &#x60;updated_by&#x60;{name}  Use ?fields&#x3D;&#x60;field.sort()&#x60; option to sort Edge fields.
         * @param {Array<string>} [fields] Fields [Q]uery to build result dataset record. &#x60;&#x60;&#x60; fields ::&#x3D; field [ *( \&quot;,\&quot; field ) ] field  ::&#x3D; name [ *( func ) ] [ inner ] inner  ::&#x3D; \&quot;{\&quot; fields \&quot;}\&quot; funcs  ::&#x3D; *( func ) func   ::&#x3D; \&quot;.\&quot; name \&quot;(\&quot; [ args ] \&quot;)\&quot; name   ::&#x3D; ALPHA / DIGIT / USCORE  ALPHA    &#x3D; %x41-5A / %x61-7A  ; \&quot;A\&quot;-\&quot;Z\&quot; / \&quot;a\&quot;-\&quot;z\&quot; DIGIT    &#x3D; %x30-39            ; \&quot;0\&quot;-\&quot;9\&quot; USCORE   &#x3D; %x5F ; underscore  ; \&quot;_\&quot; &#x60;&#x60;&#x60;
         * @param {Array<string>} [id] Records with unique IDentifier(s). Accept: &#x60;id&#x60; -or- &#x60;etag&#x60;.
         * @param {Array<string>} [qin] [Q]uery[IN] is a set of search fields for term &#x60;q&#x60;. Default: &#x60;name{common_name}&#x60;.
         * @param {'READ' | 'WRITE' | 'DELETE'} [mode] Source access mode requirement.   - READ: Can &#x60;fetch&#x60; record. [GET]  - WRITE: Can &#x60;update&#x60; record. [PUT|PATCH]  - DELETE: Can &#x60;delete&#x60; record. [DELETE]
         * @param {string} [notIdGroup] Excludes contacts that belong to the specified group ID. - Filters out contacts associated with the given &#x60;group_id&#x60;.
         * @param {Array<string>} [group] Filters contacts by the specified group(s). - Includes only contacts that belong to one or more of the given group Group(s).
         * @param {Array<string>} [owner] Filters contacts by the specified owner(s). - Includes only contacts whose owner matches one or more of the given Owner(s). - The owner ID corresponds to &#x60;contact_id&#x60; in the &#x60;directory.wbt_user&#x60; table.
         * @param {Array<string>} [label] Filters contacts by the specified label(s). - Includes only contacts that have one or more of the given Label(s).
         * @param {boolean} [user] Filters contacts based on whether they are user-associated. - &#x60;true&#x60;  → Includes only user-associated contacts. - &#x60;false&#x60; → Includes only contacts that are NOT user-associated. - A contact is considered user-associated if it exists in &#x60;directory.wbt_user&#x60;.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        searchContacts: async (page, size, q, sort, fields, id, qin, mode, notIdGroup, group, owner, label, user, options = {}) => {
            const localVarPath = `/contacts`;
            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 (page !== undefined) {
                localVarQueryParameter['page'] = page;
            }
            if (size !== undefined) {
                localVarQueryParameter['size'] = size;
            }
            if (q !== undefined) {
                localVarQueryParameter['q'] = q;
            }
            if (sort) {
                localVarQueryParameter['sort'] = sort;
            }
            if (fields) {
                localVarQueryParameter['fields'] = fields;
            }
            if (id) {
                localVarQueryParameter['id'] = id;
            }
            if (qin) {
                localVarQueryParameter['qin'] = qin;
            }
            if (mode !== undefined) {
                localVarQueryParameter['mode'] = mode;
            }
            if (notIdGroup !== undefined) {
                localVarQueryParameter['not_id_group'] = notIdGroup;
            }
            if (group) {
                localVarQueryParameter['group'] = group;
            }
            if (owner) {
                localVarQueryParameter['owner'] = owner;
            }
            if (label) {
                localVarQueryParameter['label'] = label;
            }
            if (user !== undefined) {
                localVarQueryParameter['user'] = user;
            }
            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 NEW Update of the Contact source
         * @param {string} etag Unique ID of the latest version of an existing resorce.
         * @param {NEWContactSourceChanges} input
         * @param {Array<string>} [fields] Source Fields to return into result.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateContact: async (etag, input, fields, options = {}) => {
            // verify required parameter 'etag' is not null or undefined
            if (etag === null || etag === undefined) {
                throw new RequiredError('etag', 'Required parameter etag was null or undefined when calling updateContact.');
            }
            // 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 updateContact.');
            }
            const localVarPath = `/contacts/{etag}`.replace(`{${'etag'}}`, encodeURIComponent(String(etag)));
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = {
                method: 'PATCH',
                ...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,
            };
        },
    };
};
/**
 * ContactsApi - functional programming interface
 * @export
 */
export const ContactsApiFp = function (configuration) {
    return {
        /**
         *
         * @summary Create NEW Contact
         * @param {WebitelContactsInputContact} input NEW Contact source changes
         * @param {Array<string>} [fields] Source Fields to return into result.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createContact(input, fields, options) {
            const localVarAxiosArgs = await ContactsApiAxiosParamCreator(configuration).createContact(input, fields, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         *
         * @summary Remove Contact source
         * @param {string} etag Unique ID of the latest version of a resource.
         * @param {Array<string>} [fields] Fields to be retrieved into result of changes.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteContact(etag, fields, options) {
            const localVarAxiosArgs = await ContactsApiAxiosParamCreator(configuration).deleteContact(etag, fields, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         *
         * @summary Locate Contact source
         * @param {string} etag The Contact source IDentifier. Accept: &#x60;etag&#x60; (obsolete+) or &#x60;id&#x60;.
         * @param {Array<string>} [fields] Source Fields to return into result.
         * @param {'READ' | 'WRITE' | 'DELETE'} [mode] The requirement of a special access mode to the Source.   - READ: Can &#x60;fetch&#x60; record. [GET]  - WRITE: Can &#x60;update&#x60; record. [PUT|PATCH]  - DELETE: Can &#x60;delete&#x60; record. [DELETE]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async locateContact(etag, fields, mode, options) {
            const localVarAxiosArgs = await ContactsApiAxiosParamCreator(configuration).locateContact(etag, fields, mode, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         * | Field       | Type  | ----------- | ----  | **----------- READ-ONLY -----------** |  | `id`        | int64  | `ver`       | int32  | `etag`      | string  | **---------- OPERATIONAL ----------** |  | `created_at` | int64(epoch:milli)  | `created_by` | lookup(user)  | `updated_at` | int64(epoch:milli)  | `updated_by` | lookup(user)  | **---------- ATTRIBUTES -----------** |  | `name`      | name!  | `about`     | string  | `labels`    | list[label!]  | `emails`    | list[email!]  | `photos`    | list[photo!]  | `phones`    | list[phone!]  | `managers`  | list[manager!]  | `comments`  | list[comment!]  | `addresses` | list[address!]  | `languages` | list[language!]  | `timezones` | list[timezone!]  | `variables` | list[variable!]  | `imclients` | list[imClient!]
         * @summary Search for Contact(s)
         * @param {number} [page] Page number of result records.   _default(1); offset&#x3D;(size*(page-1));_  &#x60;&#x60;&#x60;javascript let     offset &#x3D; 0   , page &#x3D; req.page ; if (page &lt;&#x3D; 0)     page &#x3D; 1; if (page &gt; 1)     offset &#x3D; ((page-1)*size); // . . . &#x60;&#x60;&#x60;
         * @param {number} [size] Limit of result page records count.   _default(16); limit&#x3D;(size&lt;&#x3D;0?-1:size+1);_  &#x60;&#x60;&#x60;javascript const     default &#x3D; 16   , maximum &#x3D; 32 ; let limit &#x3D; req.size; if (limit &lt;&#x3D; 0)     limit &#x3D; default; if (maximum &lt; limit)     limit &#x3D; maximum; // . . . &#x60;&#x60;&#x60;
         * @param {string} [q] Search term: &#x60;?&#x60; - matches any character &#x60;*&#x60; - matches 0 or more characters Used to query records within a set of &#x60;qin&#x60; fields, eg: name,emails{type},labels etc...
         * @param {Array<string>} [sort] Sort result dataset of records by fields. &#x60;&#x60;&#x60; sort ::&#x3D; *( ORDER name )  ORDER  &#x3D; ASC / DESC DESC   &#x3D; \&quot;-\&quot; / \&quot;!\&quot; ASC    &#x3D; [ \&quot;+\&quot; ]   ; Default &#x60;&#x60;&#x60;  Fields available  - &#x60;id&#x60;(seq) - &#x60;domain&#x60;{name} - &#x60;created_at&#x60; - &#x60;created_by&#x60;{name} - &#x60;updated_at&#x60; - &#x60;updated_by&#x60;{name}  Use ?fields&#x3D;&#x60;field.sort()&#x60; option to sort Edge fields.
         * @param {Array<string>} [fields] Fields [Q]uery to build result dataset record. &#x60;&#x60;&#x60; fields ::&#x3D; field [ *( \&quot;,\&quot; field ) ] field  ::&#x3D; name [ *( func ) ] [ inner ] inner  ::&#x3D; \&quot;{\&quot; fields \&quot;}\&quot; funcs  ::&#x3D; *( func ) func   ::&#x3D; \&quot;.\&quot; name \&quot;(\&quot; [ args ] \&quot;)\&quot; name   ::&#x3D; ALPHA / DIGIT / USCORE  ALPHA    &#x3D; %x41-5A / %x61-7A  ; \&quot;A\&quot;-\&quot;Z\&quot; / \&quot;a\&quot;-\&quot;z\&quot; DIGIT    &#x3D; %x30-39            ; \&quot;0\&quot;-\&quot;9\&quot; USCORE   &#x3D; %x5F ; underscore  ; \&quot;_\&quot; &#x60;&#x60;&#x60;
         * @param {Array<string>} [id] Records with unique IDentifier(s). Accept: &#x60;id&#x60; -or- &#x60;etag&#x60;.
         * @param {Array<string>} [qin] [Q]uery[IN] is a set of search fields for term &#x60;q&#x60;. Default: &#x60;name{common_name}&#x60;.
         * @param {'READ' | 'WRITE' | 'DELETE'} [mode] Source access mode requirement.   - READ: Can &#x60;fetch&#x60; record. [GET]  - WRITE: Can &#x60;update&#x60; record. [PUT|PATCH]  - DELETE: Can &#x60;delete&#x60; record. [DELETE]
         * @param {string} [notIdGroup] Excludes contacts that belong to the specified group ID. - Filters out contacts associated with the given &#x60;group_id&#x60;.
         * @param {Array<string>} [group] Filters contacts by the specified group(s). - Includes only contacts that belong to one or more of the given group Group(s).
         * @param {Array<string>} [owner] Filters contacts by the specified owner(s). - Includes only contacts whose owner matches one or more of the given Owner(s). - The owner ID corresponds to &#x60;contact_id&#x60; in the &#x60;directory.wbt_user&#x60; table.
         * @param {Array<string>} [label] Filters contacts by the specified label(s). - Includes only contacts that have one or more of the given Label(s).
         * @param {boolean} [user] Filters contacts based on whether they are user-associated. - &#x60;true&#x60;  → Includes only user-associated contacts. - &#x60;false&#x60; → Includes only contacts that are NOT user-associated. - A contact is considered user-associated if it exists in &#x60;directory.wbt_user&#x60;.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async searchContacts(page, size, q, sort, fields, id, qin, mode, notIdGroup, group, owner, label, user, options) {
            const localVarAxiosArgs = await ContactsApiAxiosParamCreator(configuration).searchContacts(page, size, q, sort, fields, id, qin, mode, notIdGroup, group, owner, label, user, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         *
         * @summary NEW Update of the Contact source
         * @param {string} etag Unique ID of the latest version of an existing resorce.
         * @param {NEWContactSourceChanges} input
         * @param {Array<string>} [fields] Source Fields to return into result.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async updateContact(etag, input, fields, options) {
            const localVarAxiosArgs = await ContactsApiAxiosParamCreator(configuration).updateContact(etag, input, fields, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
    };
};
/**
 * ContactsApi - factory interface
 * @export
 */
export const ContactsApiFactory = function (configuration, basePath, axios) {
    return {
        /**
         *
         * @summary Create NEW Contact
         * @param {WebitelContactsInputContact} input NEW Contact source changes
         * @param {Array<string>} [fields] Source Fields to return into result.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createContact(input, fields, options) {
            return ContactsApiFp(configuration)
                .createContact(input, fields, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Remove Contact source
         * @param {string} etag Unique ID of the latest version of a resource.
         * @param {Array<string>} [fields] Fields to be retrieved into result of changes.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteContact(etag, fields, options) {
            return ContactsApiFp(configuration)
                .deleteContact(etag, fields, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Locate Contact source
         * @param {string} etag The Contact source IDentifier. Accept: &#x60;etag&#x60; (obsolete+) or &#x60;id&#x60;.
         * @param {Array<string>} [fields] Source Fields to return into result.
         * @param {'READ' | 'WRITE' | 'DELETE'} [mode] The requirement of a special access mode to the Source.   - READ: Can &#x60;fetch&#x60; record. [GET]  - WRITE: Can &#x60;update&#x60; record. [PUT|PATCH]  - DELETE: Can &#x60;delete&#x60; record. [DELETE]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        locateContact(etag, fields, mode, options) {
            return ContactsApiFp(configuration)
                .locateContact(etag, fields, mode, options)
                .then((request) => request(axios, basePath));
        },
        /**
         * | Field       | Type  | ----------- | ----  | **----------- READ-ONLY -----------** |  | `id`        | int64  | `ver`       | int32  | `etag`      | string  | **---------- OPERATIONAL ----------** |  | `created_at` | int64(epoch:milli)  | `created_by` | lookup(user)  | `updated_at` | int64(epoch:milli)  | `updated_by` | lookup(user)  | **---------- ATTRIBUTES -----------** |  | `name`      | name!  | `about`     | string  | `labels`    | list[label!]  | `emails`    | list[email!]  | `photos`    | list[photo!]  | `phones`    | list[phone!]  | `managers`  | list[manager!]  | `comments`  | list[comment!]  | `addresses` | list[address!]  | `languages` | list[language!]  | `timezones` | list[timezone!]  | `variables` | list[variable!]  | `imclients` | list[imClient!]
         * @summary Search for Contact(s)
         * @param {number} [page] Page number of result records.   _default(1); offset&#x3D;(size*(page-1));_  &#x60;&#x60;&#x60;javascript let     offset &#x3D; 0   , page &#x3D; req.page ; if (page &lt;&#x3D; 0)     page &#x3D; 1; if (page &gt; 1)     offset &#x3D; ((page-1)*size); // . . . &#x60;&#x60;&#x60;
         * @param {number} [size] Limit of result page records count.   _default(16); limit&#x3D;(size&lt;&#x3D;0?-1:size+1);_  &#x60;&#x60;&#x60;javascript const     default &#x3D; 16   , maximum &#x3D; 32 ; let limit &#x3D; req.size; if (limit &lt;&#x3D; 0)     limit &#x3D; default; if (maximum &lt; limit)     limit &#x3D; maximum; // . . . &#x60;&#x60;&#x60;
         * @param {string} [q] Search term: &#x60;?&#x60; - matches any character &#x60;*&#x60; - matches 0 or more characters Used to query records within a set of &#x60;qin&#x60; fields, eg: name,emails{type},labels etc...
         * @param {Array<string>} [sort] Sort result dataset of records by fields. &#x60;&#x60;&#x60; sort ::&#x3D; *( ORDER name )  ORDER  &#x3D; ASC / DESC DESC   &#x3D; \&quot;-\&quot; / \&quot;!\&quot; ASC    &#x3D; [ \&quot;+\&quot; ]   ; Default &#x60;&#x60;&#x60;  Fields available  - &#x60;id&#x60;(seq) - &#x60;domain&#x60;{name} - &#x60;created_at&#x60; - &#x60;created_by&#x60;{name} - &#x60;updated_at&#x60; - &#x60;updated_by&#x60;{name}  Use ?fields&#x3D;&#x60;field.sort()&#x60; option to sort Edge fields.
         * @param {Array<string>} [fields] Fields [Q]uery to build result dataset record. &#x60;&#x60;&#x60; fields ::&#x3D; field [ *( \&quot;,\&quot; field ) ] field  ::&#x3D; name [ *( func ) ] [ inner ] inner  ::&#x3D; \&quot;{\&quot; fields \&quot;}\&quot; funcs  ::&#x3D; *( func ) func   ::&#x3D; \&quot;.\&quot; name \&quot;(\&quot; [ args ] \&quot;)\&quot; name   ::&#x3D; ALPHA / DIGIT / USCORE  ALPHA    &#x3D; %x41-5A / %x61-7A  ; \&quot;A\&quot;-\&quot;Z\&quot; / \&quot;a\&quot;-\&quot;z\&quot; DIGIT    &#x3D; %x30-39            ; \&quot;0\&quot;-\&quot;9\&quot; USCORE   &#x3D; %x5F ; underscore  ; \&quot;_\&quot; &#x60;&#x60;&#x60;
         * @param {Array<string>} [id] Records with unique IDentifier(s). Accept: &#x60;id&#x60; -or- &#x60;etag&#x60;.
         * @param {Array<string>} [qin] [Q]uery[IN] is a set of search fields for term &#x60;q&#x60;. Default: &#x60;name{common_name}&#x60;.
         * @param {'READ' | 'WRITE' | 'DELETE'} [mode] Source access mode requirement.   - READ: Can &#x60;fetch&#x60; record. [GET]  - WRITE: Can &#x60;update&#x60; record. [PUT|PATCH]  - DELETE: Can &#x60;delete&#x60; record. [DELETE]
         * @param {string} [notIdGroup] Excludes contacts that belong to the specified group ID. - Filters out contacts associated with the given &#x60;group_id&#x60;.
         * @param {Array<string>} [group] Filters contacts by the specified group(s). - Includes only contacts that belong to one or more of the given group Group(s).
         * @param {Array<string>} [owner] Filters contacts by the specified owner(s). - Includes only contacts whose owner matches one or more of the given Owner(s). - The owner ID corresponds to &#x60;contact_id&#x60; in the &#x60;directory.wbt_user&#x60; table.
         * @param {Array<string>} [label] Filters contacts by the specified label(s). - Includes only contacts that have one or more of the given Label(s).
         * @param {boolean} [user] Filters contacts based on whether they are user-associated. - &#x60;true&#x60;  → Includes only user-associated contacts. - &#x60;false&#x60; → Includes only contacts that are NOT user-associated. - A contact is considered user-associated if it exists in &#x60;directory.wbt_user&#x60;.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        searchContacts(page, size, q, sort, fields, id, qin, mode, notIdGroup, group, owner, label, user, options) {
            return ContactsApiFp(configuration)
                .searchContacts(page, size, q, sort, fields, id, qin, mode, notIdGroup, group, owner, label, user, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary NEW Update of the Contact source
         * @param {string} etag Unique ID of the latest version of an existing resorce.
         * @param {NEWContactSourceChanges} input
         * @param {Array<string>} [fields] Source Fields to return into result.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateContact(etag, input, fields, options) {
            return ContactsApiFp(configuration)
                .updateContact(etag, input, fields, options)
                .then((request) => request(axios, basePath));
        },
    };
};
/**
 * ContactsApi - object-oriented interface
 * @export
 * @class ContactsApi
 * @extends {BaseAPI}
 */
export class ContactsApi extends BaseAPI {
    /**
     *
     * @summary Create NEW Contact
     * @param {WebitelContactsInputContact} input NEW Contact source changes
     * @param {Array<string>} [fields] Source Fields to return into result.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ContactsApi
     */
    createContact(input, fields, options) {
        return ContactsApiFp(this.configuration)
            .createContact(input, fields, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Remove Contact source
     * @param {string} etag Unique ID of the latest version of a resource.
     * @param {Array<string>} [fields] Fields to be retrieved into result of changes.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ContactsApi
     */
    deleteContact(etag, fields, options) {
        return ContactsApiFp(this.configuration)
            .deleteContact(etag, fields, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Locate Contact source
     * @param {string} etag The Contact source IDentifier. Accept: &#x60;etag&#x60; (obsolete+) or &#x60;id&#x60;.
     * @param {Array<string>} [fields] Source Fields to return into result.
     * @param {'READ' | 'WRITE' | 'DELETE'} [mode] The requirement of a special access mode to the Source.   - READ: Can &#x60;fetch&#x60; record. [GET]  - WRITE: Can &#x60;update&#x60; record. [PUT|PATCH]  - DELETE: Can &#x60;delete&#x60; record. [DELETE]
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ContactsApi
     */
    locateContact(etag, fields, mode, options) {
        return ContactsApiFp(this.configuration)
            .locateContact(etag, fields, mode, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     * | Field       | Type  | ----------- | ----  | **----------- READ-ONLY -----------** |  | `id`        | int64  | `ver`       | int32  | `etag`      | string  | **---------- OPERATIONAL ----------** |  | `created_at` | int64(epoch:milli)  | `created_by` | lookup(user)  | `updated_at` | int64(epoch:milli)  | `updated_by` | lookup(user)  | **---------- ATTRIBUTES -----------** |  | `name`      | name!  | `about`     | string  | `labels`    | list[label!]  | `emails`    | list[email!]  | `photos`    | list[photo!]  | `phones`    | list[phone!]  | `managers`  | list[manager!]  | `comments`  | list[comment!]  | `addresses` | list[address!]  | `languages` | list[language!]  | `timezones` | list[timezone!]  | `variables` | list[variable!]  | `imclients` | list[imClient!]
     * @summary Search for Contact(s)
     * @param {number} [page] Page number of result records.   _default(1); offset&#x3D;(size*(page-1));_  &#x60;&#x60;&#x60;javascript let     offset &#x3D; 0   , page &#x3D; req.page ; if (page &lt;&#x3D; 0)     page &#x3D; 1; if (page &gt; 1)     offset &#x3D; ((page-1)*size); // . . . &#x60;&#x60;&#x60;
     * @param {number} [size] Limit of result page records count.   _default(16); limit&#x3D;(size&lt;&#x3D;0?-1:size+1);_  &#x60;&#x60;&#x60;javascript const     default &#x3D; 16   , maximum &#x3D; 32 ; let limit &#x3D; req.size; if (limit &lt;&#x3D; 0)     limit &#x3D; default; if (maximum &lt; limit)     limit &#x3D; maximum; // . . . &#x60;&#x60;&#x60;
     * @param {string} [q] Search term: &#x60;?&#x60; - matches any character &#x60;*&#x60; - matches 0 or more characters Used to query records within a set of &#x60;qin&#x60; fields, eg: name,emails{type},labels etc...
     * @param {Array<string>} [sort] Sort result dataset of records by fields. &#x60;&#x60;&#x60; sort ::&#x3D; *( ORDER name )  ORDER  &#x3D; ASC / DESC DESC   &#x3D; \&quot;-\&quot; / \&quot;!\&quot; ASC    &#x3D; [ \&quot;+\&quot; ]   ; Default &#x60;&#x60;&#x60;  Fields available  - &#x60;id&#x60;(seq) - &#x60;domain&#x60;{name} - &#x60;created_at&#x60; - &#x60;created_by&#x60;{name} - &#x60;updated_at&#x60; - &#x60;updated_by&#x60;{name}  Use ?fields&#x3D;&#x60;field.sort()&#x60; option to sort Edge fields.
     * @param {Array<string>} [fields] Fields [Q]uery to build result dataset record. &#x60;&#x60;&#x60; fields ::&#x3D; field [ *( \&quot;,\&quot; field ) ] field  ::&#x3D; name [ *( func ) ] [ inner ] inner  ::&#x3D; \&quot;{\&quot; fields \&quot;}\&quot; funcs  ::&#x3D; *( func ) func   ::&#x3D; \&quot;.\&quot; name \&quot;(\&quot; [ args ] \&quot;)\&quot; name   ::&#x3D; ALPHA / DIGIT / USCORE  ALPHA    &#x3D; %x41-5A / %x61-7A  ; \&quot;A\&quot;-\&quot;Z\&quot; / \&quot;a\&quot;-\&quot;z\&quot; DIGIT    &#x3D; %x30-39            ; \&quot;0\&quot;-\&quot;9\&quot; USCORE   &#x3D; %x5F ; underscore  ; \&quot;_\&quot; &#x60;&#x60;&#x60;
     * @param {Array<string>} [id] Records with unique IDentifier(s). Accept: &#x60;id&#x60; -or- &#x60;etag&#x60;.
     * @param {Array<string>} [qin] [Q]uery[IN] is a set of search fields for term &#x60;q&#x60;. Default: &#x60;name{common_name}&#x60;.
     * @param {'READ' | 'WRITE' | 'DELETE'} [mode] Source access mode requirement.   - READ: Can &#x60;fetch&#x60; record. [GET]  - WRITE: Can &#x60;update&#x60; record. [PUT|PATCH]  - DELETE: Can &#x60;delete&#x60; record. [DELETE]
     * @param {string} [notIdGroup] Excludes contacts that belong to the specified group ID. - Filters out contacts associated with the given &#x60;group_id&#x60;.
     * @param {Array<string>} [group] Filters contacts by the specified group(s). - Includes only contacts that belong to one or more of the given group Group(s).
     * @param {Array<string>} [owner] Filters contacts by the specified owner(s). - Includes only contacts whose owner matches one or more of the given Owner(s). - The owner ID corresponds to &#x60;contact_id&#x60; in the &#x60;directory.wbt_user&#x60; table.
     * @param {Array<string>} [label] Filters contacts by the specified label(s). - Includes only contacts that have one or more of the given Label(s).
     * @param {boolean} [user] Filters contacts based on whether they are user-associated. - &#x60;true&#x60;  → Includes only user-associated contacts. - &#x60;false&#x60; → Includes only contacts that are NOT user-associated. - A contact is considered user-associated if it exists in &#x60;directory.wbt_user&#x60;.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ContactsApi
     */
    searchContacts(page, size, q, sort, fields, id, qin, mode, notIdGroup, group, owner, label, user, options) {
        return ContactsApiFp(this.configuration)
            .searchContacts(page, size, q, sort, fields, id, qin, mode, notIdGroup, group, owner, label, user, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary NEW Update of the Contact source
     * @param {string} etag Unique ID of the latest version of an existing resorce.
     * @param {NEWContactSourceChanges} input
     * @param {Array<string>} [fields] Source Fields to return into result.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ContactsApi
     */
    updateContact(etag, input, fields, options) {
        return ContactsApiFp(this.configuration)
            .updateContact(etag, input, fields, options)
            .then((request) => request(this.axios, this.basePath));
    }
}
//# sourceMappingURL=contacts-api.js.map