// 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';
/**
 * RoutingVariableServiceApi - axios parameter creator
 * @export
 */
export const RoutingVariableServiceApiAxiosParamCreator = function (configuration) {
    return {
        /**
         *
         * @summary Create RoutingVariable
         * @param {EngineCreateRoutingVariableRequest} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createRoutingVariable: (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 createRoutingVariable.');
            }
            const localVarPath = `/routing/variables`;
            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 Remove RoutingVariable
         * @param {string} id
         * @param {string} [domainId]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteRoutingVariable: (id, domainId, 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 deleteRoutingVariable.');
            }
            const localVarPath = `/routing/variables/{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;
            }
            if (domainId !== undefined) {
                localVarQueryParameter['domain_id'] = domainId;
            }
            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 RoutingVariable item
         * @param {string} id
         * @param {string} [domainId]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        readRoutingVariable: (id, domainId, 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 readRoutingVariable.');
            }
            const localVarPath = `/routing/variables/{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 (domainId !== undefined) {
                localVarQueryParameter['domain_id'] = domainId;
            }
            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 List of RoutingVariable
         * @param {number} [page]
         * @param {number} [size]
         * @param {string} [domainId]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        searchRoutingVariable: (page, size, domainId, options = {}) => __awaiter(this, void 0, void 0, function* () {
            const localVarPath = `/routing/variables`;
            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 (domainId !== undefined) {
                localVarQueryParameter['domain_id'] = domainId;
            }
            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 RoutingVariable
         * @param {string} id
         * @param {EngineRoutingVariableServiceUpdateRoutingVariableBody} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateRoutingVariable: (id, body, 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 updateRoutingVariable.');
            }
            // 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 updateRoutingVariable.');
            }
            const localVarPath = `/routing/variables/{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 body !== 'string' ||
                localVarRequestOptions.headers['Content-Type'] === 'application/json';
            localVarRequestOptions.data = needsSerialization
                ? JSON.stringify(body !== undefined ? body : {})
                : body || '';
            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        }),
    };
};
/**
 * RoutingVariableServiceApi - functional programming interface
 * @export
 */
export const RoutingVariableServiceApiFp = function (configuration) {
    return {
        /**
         *
         * @summary Create RoutingVariable
         * @param {EngineCreateRoutingVariableRequest} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createRoutingVariable(body, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield RoutingVariableServiceApiAxiosParamCreator(configuration).createRoutingVariable(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 Remove RoutingVariable
         * @param {string} id
         * @param {string} [domainId]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteRoutingVariable(id, domainId, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield RoutingVariableServiceApiAxiosParamCreator(configuration).deleteRoutingVariable(id, domainId, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
        /**
         *
         * @summary RoutingVariable item
         * @param {string} id
         * @param {string} [domainId]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        readRoutingVariable(id, domainId, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield RoutingVariableServiceApiAxiosParamCreator(configuration).readRoutingVariable(id, domainId, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
        /**
         *
         * @summary List of RoutingVariable
         * @param {number} [page]
         * @param {number} [size]
         * @param {string} [domainId]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        searchRoutingVariable(page, size, domainId, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield RoutingVariableServiceApiAxiosParamCreator(configuration).searchRoutingVariable(page, size, domainId, 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 RoutingVariable
         * @param {string} id
         * @param {EngineRoutingVariableServiceUpdateRoutingVariableBody} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateRoutingVariable(id, body, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield RoutingVariableServiceApiAxiosParamCreator(configuration).updateRoutingVariable(id, body, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
    };
};
/**
 * RoutingVariableServiceApi - factory interface
 * @export
 */
export const RoutingVariableServiceApiFactory = function (configuration, basePath, axios) {
    return {
        /**
         *
         * @summary Create RoutingVariable
         * @param {EngineCreateRoutingVariableRequest} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createRoutingVariable(body, options) {
            return RoutingVariableServiceApiFp(configuration)
                .createRoutingVariable(body, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Remove RoutingVariable
         * @param {string} id
         * @param {string} [domainId]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteRoutingVariable(id, domainId, options) {
            return RoutingVariableServiceApiFp(configuration)
                .deleteRoutingVariable(id, domainId, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary RoutingVariable item
         * @param {string} id
         * @param {string} [domainId]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        readRoutingVariable(id, domainId, options) {
            return RoutingVariableServiceApiFp(configuration)
                .readRoutingVariable(id, domainId, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary List of RoutingVariable
         * @param {number} [page]
         * @param {number} [size]
         * @param {string} [domainId]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        searchRoutingVariable(page, size, domainId, options) {
            return RoutingVariableServiceApiFp(configuration)
                .searchRoutingVariable(page, size, domainId, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Update RoutingVariable
         * @param {string} id
         * @param {EngineRoutingVariableServiceUpdateRoutingVariableBody} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateRoutingVariable(id, body, options) {
            return RoutingVariableServiceApiFp(configuration)
                .updateRoutingVariable(id, body, options)
                .then((request) => request(axios, basePath));
        },
    };
};
/**
 * RoutingVariableServiceApi - object-oriented interface
 * @export
 * @class RoutingVariableServiceApi
 * @extends {BaseAPI}
 */
export class RoutingVariableServiceApi extends BaseAPI {
    /**
     *
     * @summary Create RoutingVariable
     * @param {EngineCreateRoutingVariableRequest} body
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RoutingVariableServiceApi
     */
    createRoutingVariable(body, options) {
        return RoutingVariableServiceApiFp(this.configuration)
            .createRoutingVariable(body, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Remove RoutingVariable
     * @param {string} id
     * @param {string} [domainId]
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RoutingVariableServiceApi
     */
    deleteRoutingVariable(id, domainId, options) {
        return RoutingVariableServiceApiFp(this.configuration)
            .deleteRoutingVariable(id, domainId, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary RoutingVariable item
     * @param {string} id
     * @param {string} [domainId]
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RoutingVariableServiceApi
     */
    readRoutingVariable(id, domainId, options) {
        return RoutingVariableServiceApiFp(this.configuration)
            .readRoutingVariable(id, domainId, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary List of RoutingVariable
     * @param {number} [page]
     * @param {number} [size]
     * @param {string} [domainId]
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RoutingVariableServiceApi
     */
    searchRoutingVariable(page, size, domainId, options) {
        return RoutingVariableServiceApiFp(this.configuration)
            .searchRoutingVariable(page, size, domainId, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Update RoutingVariable
     * @param {string} id
     * @param {EngineRoutingVariableServiceUpdateRoutingVariableBody} body
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RoutingVariableServiceApi
     */
    updateRoutingVariable(id, body, options) {
        return RoutingVariableServiceApiFp(this.configuration)
            .updateRoutingVariable(id, body, options)
            .then((request) => request(this.axios, this.basePath));
    }
}
//# sourceMappingURL=routing-variable-service-api.js.map