// 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';
/**
 * BucketServiceApi - axios parameter creator
 * @export
 */
export const BucketServiceApiAxiosParamCreator = function (configuration) {
    return {
        /**
         *
         * @summary Create Bucket
         * @param {EngineCreateBucketRequest} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createBucket: async (body, options = {}) => {
            // verify required parameter 'body' is not null or undefined
            if (body === null || body === undefined) {
                throw new RequiredError('body', 'Required parameter body was null or undefined when calling createBucket.');
            }
            const localVarPath = `/call_center/buckets`;
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = {
                method: 'POST',
                ...baseOptions,
                ...options,
            };
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication AccessToken required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? await configuration.apiKey('X-Webitel-Access')
                    : await configuration.apiKey;
                localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
            }
            localVarHeaderParameter['Content-Type'] = 'application/json';
            localVarUrlObj.query = {
                ...localVarUrlObj.query,
                ...localVarQueryParameter,
                ...options.query,
            };
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            delete localVarUrlObj.search;
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {
                ...localVarHeaderParameter,
                ...headersFromBaseOptions,
                ...options.headers,
            };
            const needsSerialization = typeof body !== 'string' ||
                localVarRequestOptions.headers['Content-Type'] === 'application/json';
            localVarRequestOptions.data = needsSerialization
                ? JSON.stringify(body !== undefined ? body : {})
                : body || '';
            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         *
         * @summary Remove Bucket
         * @param {string} id
         * @param {string} [domainId]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteBucket: async (id, domainId, 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 deleteBucket.');
            }
            const localVarPath = `/call_center/buckets/{id}`.replace(`{${'id'}}`, encodeURIComponent(String(id)));
            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 (domainId !== undefined) {
                localVarQueryParameter['domain_id'] = domainId;
            }
            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 Bucket item
         * @param {string} id
         * @param {string} [domainId]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        readBucket: async (id, domainId, 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 readBucket.');
            }
            const localVarPath = `/call_center/buckets/{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 (domainId !== undefined) {
                localVarQueryParameter['domain_id'] = domainId;
            }
            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 List of Bucket
         * @param {number} [page]
         * @param {number} [size]
         * @param {string} [q]
         * @param {string} [sort]
         * @param {Array<string>} [fields]
         * @param {Array<number>} [id]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        searchBucket: async (page, size, q, sort, fields, id, options = {}) => {
            const localVarPath = `/call_center/buckets`;
            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 !== undefined) {
                localVarQueryParameter['sort'] = sort;
            }
            if (fields) {
                localVarQueryParameter['fields'] = fields;
            }
            if (id) {
                localVarQueryParameter['id'] = id;
            }
            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 Update Bucket
         * @param {string} id
         * @param {EngineBucketServiceUpdateBucketBody} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateBucket: async (id, body, 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 updateBucket.');
            }
            // 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 updateBucket.');
            }
            const localVarPath = `/call_center/buckets/{id}`.replace(`{${'id'}}`, encodeURIComponent(String(id)));
            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,
            };
        },
    };
};
/**
 * BucketServiceApi - functional programming interface
 * @export
 */
export const BucketServiceApiFp = function (configuration) {
    return {
        /**
         *
         * @summary Create Bucket
         * @param {EngineCreateBucketRequest} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createBucket(body, options) {
            const localVarAxiosArgs = await BucketServiceApiAxiosParamCreator(configuration).createBucket(body, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         *
         * @summary Remove Bucket
         * @param {string} id
         * @param {string} [domainId]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteBucket(id, domainId, options) {
            const localVarAxiosArgs = await BucketServiceApiAxiosParamCreator(configuration).deleteBucket(id, domainId, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         *
         * @summary Bucket item
         * @param {string} id
         * @param {string} [domainId]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async readBucket(id, domainId, options) {
            const localVarAxiosArgs = await BucketServiceApiAxiosParamCreator(configuration).readBucket(id, domainId, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         *
         * @summary List of Bucket
         * @param {number} [page]
         * @param {number} [size]
         * @param {string} [q]
         * @param {string} [sort]
         * @param {Array<string>} [fields]
         * @param {Array<number>} [id]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async searchBucket(page, size, q, sort, fields, id, options) {
            const localVarAxiosArgs = await BucketServiceApiAxiosParamCreator(configuration).searchBucket(page, size, q, sort, fields, id, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         *
         * @summary Update Bucket
         * @param {string} id
         * @param {EngineBucketServiceUpdateBucketBody} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async updateBucket(id, body, options) {
            const localVarAxiosArgs = await BucketServiceApiAxiosParamCreator(configuration).updateBucket(id, body, options);
            return (axios = globalAxios, basePath = BASE_PATH) => {
                const axiosRequestArgs = {
                    ...localVarAxiosArgs.options,
                    url: basePath + localVarAxiosArgs.url,
                };
                return axios.request(axiosRequestArgs);
            };
        },
    };
};
/**
 * BucketServiceApi - factory interface
 * @export
 */
export const BucketServiceApiFactory = function (configuration, basePath, axios) {
    return {
        /**
         *
         * @summary Create Bucket
         * @param {EngineCreateBucketRequest} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createBucket(body, options) {
            return BucketServiceApiFp(configuration)
                .createBucket(body, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Remove Bucket
         * @param {string} id
         * @param {string} [domainId]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteBucket(id, domainId, options) {
            return BucketServiceApiFp(configuration)
                .deleteBucket(id, domainId, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Bucket item
         * @param {string} id
         * @param {string} [domainId]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        readBucket(id, domainId, options) {
            return BucketServiceApiFp(configuration)
                .readBucket(id, domainId, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary List of Bucket
         * @param {number} [page]
         * @param {number} [size]
         * @param {string} [q]
         * @param {string} [sort]
         * @param {Array<string>} [fields]
         * @param {Array<number>} [id]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        searchBucket(page, size, q, sort, fields, id, options) {
            return BucketServiceApiFp(configuration)
                .searchBucket(page, size, q, sort, fields, id, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Update Bucket
         * @param {string} id
         * @param {EngineBucketServiceUpdateBucketBody} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateBucket(id, body, options) {
            return BucketServiceApiFp(configuration)
                .updateBucket(id, body, options)
                .then((request) => request(axios, basePath));
        },
    };
};
/**
 * BucketServiceApi - object-oriented interface
 * @export
 * @class BucketServiceApi
 * @extends {BaseAPI}
 */
export class BucketServiceApi extends BaseAPI {
    /**
     *
     * @summary Create Bucket
     * @param {EngineCreateBucketRequest} body
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof BucketServiceApi
     */
    createBucket(body, options) {
        return BucketServiceApiFp(this.configuration)
            .createBucket(body, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Remove Bucket
     * @param {string} id
     * @param {string} [domainId]
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof BucketServiceApi
     */
    deleteBucket(id, domainId, options) {
        return BucketServiceApiFp(this.configuration)
            .deleteBucket(id, domainId, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Bucket item
     * @param {string} id
     * @param {string} [domainId]
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof BucketServiceApi
     */
    readBucket(id, domainId, options) {
        return BucketServiceApiFp(this.configuration)
            .readBucket(id, domainId, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary List of Bucket
     * @param {number} [page]
     * @param {number} [size]
     * @param {string} [q]
     * @param {string} [sort]
     * @param {Array<string>} [fields]
     * @param {Array<number>} [id]
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof BucketServiceApi
     */
    searchBucket(page, size, q, sort, fields, id, options) {
        return BucketServiceApiFp(this.configuration)
            .searchBucket(page, size, q, sort, fields, id, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Update Bucket
     * @param {string} id
     * @param {EngineBucketServiceUpdateBucketBody} body
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof BucketServiceApi
     */
    updateBucket(id, body, options) {
        return BucketServiceApiFp(this.configuration)
            .updateBucket(id, body, options)
            .then((request) => request(this.axios, this.basePath));
    }
}
//# sourceMappingURL=bucket-service-api.js.map