// 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';
/**
 * ClassesApi - axios parameter creator
 * @export
 */
export const ClassesApiAxiosParamCreator = function (configuration) {
    return {
        /**
         *
         * @param {string} id [filter]: obj.id &#x3D; id
         * @param {string} [domain]
         * @param {string} [_class] [filter]: like \&#39;%class%\&#39;
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        readClass: async (id, domain, _class, 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 readClass.');
            }
            const localVarPath = `/objclass/{id}`.replace(`{${'id'}}`, encodeURIComponent(String(id)));
            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 (domain !== undefined) {
                localVarQueryParameter['domain'] = domain;
            }
            if (_class !== undefined) {
                localVarQueryParameter['class'] = _class;
            }
            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,
            };
        },
        /**
         *
         * @param {string} [domain] TO BE REMOVED // bound to session.domain.id
         * @param {string} [_class] [filter]: like \&#39;%class%\&#39;
         * @param {Array<string>} [fields] int64 id &#x3D; 3;  // [filter]: obj.id &#x3D; id controls  output
         * @param {Array<string>} [sort] sort: \&quot;field\&quot; asc; \&quot;!field\&quot; desc
         * @param {number} [page] page number
         * @param {number} [size] page size
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        searchClasses: async (domain, _class, fields, sort, page, size, options = {}) => {
            const localVarPath = `/objclass`;
            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 (domain !== undefined) {
                localVarQueryParameter['domain'] = domain;
            }
            if (_class !== undefined) {
                localVarQueryParameter['class'] = _class;
            }
            if (fields) {
                localVarQueryParameter['fields'] = fields;
            }
            if (sort) {
                localVarQueryParameter['sort'] = sort;
            }
            if (page !== undefined) {
                localVarQueryParameter['page'] = page;
            }
            if (size !== undefined) {
                localVarQueryParameter['size'] = size;
            }
            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,
            };
        },
        /**
         *
         * @param {string} classId (class::object).id
         * @param {ApiClassesUpdateClassBody} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateClass: async (classId, body, options = {}) => {
            // verify required parameter 'classId' is not null or undefined
            if (classId === null || classId === undefined) {
                throw new RequiredError('classId', 'Required parameter classId was null or undefined when calling updateClass.');
            }
            // 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 updateClass.');
            }
            const localVarPath = `/objclass/{class.id}`.replace(`{${'class.id'}}`, encodeURIComponent(String(classId)));
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = {
                method: 'PUT',
                ...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,
            };
        },
        /**
         *
         * @param {string} classId (class::object).id
         * @param {ApiClassesUpdateClassBody} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateClass2: async (classId, body, options = {}) => {
            // verify required parameter 'classId' is not null or undefined
            if (classId === null || classId === undefined) {
                throw new RequiredError('classId', 'Required parameter classId was null or undefined when calling updateClass2.');
            }
            // 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 updateClass2.');
            }
            const localVarPath = `/objclass/{class.id}`.replace(`{${'class.id'}}`, encodeURIComponent(String(classId)));
            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;
            }
            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,
            };
        },
    };
};
/**
 * ClassesApi - functional programming interface
 * @export
 */
export const ClassesApiFp = function (configuration) {
    return {
        /**
         *
         * @param {string} id [filter]: obj.id &#x3D; id
         * @param {string} [domain]
         * @param {string} [_class] [filter]: like \&#39;%class%\&#39;
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async readClass(id, domain, _class, options) {
            const localVarAxiosArgs = await ClassesApiAxiosParamCreator(configuration).readClass(id, domain, _class, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         *
         * @param {string} [domain] TO BE REMOVED // bound to session.domain.id
         * @param {string} [_class] [filter]: like \&#39;%class%\&#39;
         * @param {Array<string>} [fields] int64 id &#x3D; 3;  // [filter]: obj.id &#x3D; id controls  output
         * @param {Array<string>} [sort] sort: \&quot;field\&quot; asc; \&quot;!field\&quot; desc
         * @param {number} [page] page number
         * @param {number} [size] page size
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async searchClasses(domain, _class, fields, sort, page, size, options) {
            const localVarAxiosArgs = await ClassesApiAxiosParamCreator(configuration).searchClasses(domain, _class, fields, sort, page, size, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         *
         * @param {string} classId (class::object).id
         * @param {ApiClassesUpdateClassBody} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async updateClass(classId, body, options) {
            const localVarAxiosArgs = await ClassesApiAxiosParamCreator(configuration).updateClass(classId, body, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         *
         * @param {string} classId (class::object).id
         * @param {ApiClassesUpdateClassBody} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async updateClass2(classId, body, options) {
            const localVarAxiosArgs = await ClassesApiAxiosParamCreator(configuration).updateClass2(classId, body, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
    };
};
/**
 * ClassesApi - factory interface
 * @export
 */
export const ClassesApiFactory = function (configuration, basePath, axios) {
    return {
        /**
         *
         * @param {string} id [filter]: obj.id &#x3D; id
         * @param {string} [domain]
         * @param {string} [_class] [filter]: like \&#39;%class%\&#39;
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        readClass(id, domain, _class, options) {
            return ClassesApiFp(configuration)
                .readClass(id, domain, _class, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @param {string} [domain] TO BE REMOVED // bound to session.domain.id
         * @param {string} [_class] [filter]: like \&#39;%class%\&#39;
         * @param {Array<string>} [fields] int64 id &#x3D; 3;  // [filter]: obj.id &#x3D; id controls  output
         * @param {Array<string>} [sort] sort: \&quot;field\&quot; asc; \&quot;!field\&quot; desc
         * @param {number} [page] page number
         * @param {number} [size] page size
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        searchClasses(domain, _class, fields, sort, page, size, options) {
            return ClassesApiFp(configuration)
                .searchClasses(domain, _class, fields, sort, page, size, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @param {string} classId (class::object).id
         * @param {ApiClassesUpdateClassBody} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateClass(classId, body, options) {
            return ClassesApiFp(configuration)
                .updateClass(classId, body, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @param {string} classId (class::object).id
         * @param {ApiClassesUpdateClassBody} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateClass2(classId, body, options) {
            return ClassesApiFp(configuration)
                .updateClass2(classId, body, options)
                .then((request) => request(axios, basePath));
        },
    };
};
/**
 * ClassesApi - object-oriented interface
 * @export
 * @class ClassesApi
 * @extends {BaseAPI}
 */
export class ClassesApi extends BaseAPI {
    /**
     *
     * @param {string} id [filter]: obj.id &#x3D; id
     * @param {string} [domain]
     * @param {string} [_class] [filter]: like \&#39;%class%\&#39;
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ClassesApi
     */
    readClass(id, domain, _class, options) {
        return ClassesApiFp(this.configuration)
            .readClass(id, domain, _class, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @param {string} [domain] TO BE REMOVED // bound to session.domain.id
     * @param {string} [_class] [filter]: like \&#39;%class%\&#39;
     * @param {Array<string>} [fields] int64 id &#x3D; 3;  // [filter]: obj.id &#x3D; id controls  output
     * @param {Array<string>} [sort] sort: \&quot;field\&quot; asc; \&quot;!field\&quot; desc
     * @param {number} [page] page number
     * @param {number} [size] page size
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ClassesApi
     */
    searchClasses(domain, _class, fields, sort, page, size, options) {
        return ClassesApiFp(this.configuration)
            .searchClasses(domain, _class, fields, sort, page, size, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @param {string} classId (class::object).id
     * @param {ApiClassesUpdateClassBody} body
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ClassesApi
     */
    updateClass(classId, body, options) {
        return ClassesApiFp(this.configuration)
            .updateClass(classId, body, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @param {string} classId (class::object).id
     * @param {ApiClassesUpdateClassBody} body
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ClassesApi
     */
    updateClass2(classId, body, options) {
        return ClassesApiFp(this.configuration)
            .updateClass2(classId, body, options)
            .then((request) => request(this.axios, this.basePath));
    }
}
//# sourceMappingURL=classes-api.js.map