// 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';
/**
 * UserSettingsApi - axios parameter creator
 * @export
 */
export const UserSettingsApiAxiosParamCreator = function (configuration) {
    return {
        /**
         *
         * @summary GET /user/settings/{key=*}
         * @param {string} key
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getUserSettings: (key, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // verify required parameter 'key' is not null or undefined
            if (key === null || key === undefined) {
                throw new RequiredError('key', 'Required parameter key was null or undefined when calling getUserSettings.');
            }
            const localVarPath = `/user/settings/{key}`.replace(`{${'key'}}`, encodeURIComponent(String(key)));
            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;
            }
            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,
            };
        }),
        /**
         * PUT /user/settings/{key=*} Content-Type: application/json; charset=utf-8  ${value=.body}
         * @summary Create -or- Update
         * @param {string} key
         * @param {object} value
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        setUserSettings: (key, value, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // verify required parameter 'key' is not null or undefined
            if (key === null || key === undefined) {
                throw new RequiredError('key', 'Required parameter key was null or undefined when calling setUserSettings.');
            }
            // verify required parameter 'value' is not null or undefined
            if (value === null || value === undefined) {
                throw new RequiredError('value', 'Required parameter value was null or undefined when calling setUserSettings.');
            }
            const localVarPath = `/user/settings/{key}`.replace(`{${'key'}}`, encodeURIComponent(String(key)));
            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 value !== 'string' ||
                localVarRequestOptions.headers['Content-Type'] === 'application/json';
            localVarRequestOptions.data = needsSerialization
                ? JSON.stringify(value !== undefined ? value : {})
                : value || '';
            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        }),
    };
};
/**
 * UserSettingsApi - functional programming interface
 * @export
 */
export const UserSettingsApiFp = function (configuration) {
    return {
        /**
         *
         * @summary GET /user/settings/{key=*}
         * @param {string} key
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getUserSettings(key, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield UserSettingsApiAxiosParamCreator(configuration).getUserSettings(key, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
        /**
         * PUT /user/settings/{key=*} Content-Type: application/json; charset=utf-8  ${value=.body}
         * @summary Create -or- Update
         * @param {string} key
         * @param {object} value
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        setUserSettings(key, value, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield UserSettingsApiAxiosParamCreator(configuration).setUserSettings(key, value, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
    };
};
/**
 * UserSettingsApi - factory interface
 * @export
 */
export const UserSettingsApiFactory = function (configuration, basePath, axios) {
    return {
        /**
         *
         * @summary GET /user/settings/{key=*}
         * @param {string} key
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getUserSettings(key, options) {
            return UserSettingsApiFp(configuration)
                .getUserSettings(key, options)
                .then((request) => request(axios, basePath));
        },
        /**
         * PUT /user/settings/{key=*} Content-Type: application/json; charset=utf-8  ${value=.body}
         * @summary Create -or- Update
         * @param {string} key
         * @param {object} value
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        setUserSettings(key, value, options) {
            return UserSettingsApiFp(configuration)
                .setUserSettings(key, value, options)
                .then((request) => request(axios, basePath));
        },
    };
};
/**
 * UserSettingsApi - object-oriented interface
 * @export
 * @class UserSettingsApi
 * @extends {BaseAPI}
 */
export class UserSettingsApi extends BaseAPI {
    /**
     *
     * @summary GET /user/settings/{key=*}
     * @param {string} key
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof UserSettingsApi
     */
    getUserSettings(key, options) {
        return UserSettingsApiFp(this.configuration)
            .getUserSettings(key, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     * PUT /user/settings/{key=*} Content-Type: application/json; charset=utf-8  ${value=.body}
     * @summary Create -or- Update
     * @param {string} key
     * @param {object} value
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof UserSettingsApi
     */
    setUserSettings(key, value, options) {
        return UserSettingsApiFp(this.configuration)
            .setUserSettings(key, value, options)
            .then((request) => request(this.axios, this.basePath));
    }
}
//# sourceMappingURL=user-settings-api.js.map