// 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';
/**
 * AccountApi - axios parameter creator
 * @export
 */
export const AccountApiAxiosParamCreator = function (configuration) {
    return {
        /**
         *
         * @summary Inspect current Authorization credentials
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        inspect: (options = {}) => __awaiter(this, void 0, void 0, function* () {
            const localVarPath = `/v1/auth/token`;
            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,
            };
        }),
        /**
         *
         * @summary Logout Device Request
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        logout: (options = {}) => __awaiter(this, void 0, void 0, function* () {
            const localVarPath = `/v1/auth/logout`;
            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;
            }
            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 Register device to receive PUSH notifications
         * @param {WebitelImApiGatewayV1PUSHSubscription} push PUSH Notification subscription
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        registerDevice: (push, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // verify required parameter 'push' is not null or undefined
            if (push === null || push === undefined) {
                throw new RequiredError('push', 'Required parameter push was null or undefined when calling registerDevice.');
            }
            const localVarPath = `/v1/auth/device`;
            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 push !== 'string' ||
                localVarRequestOptions.headers['Content-Type'] === 'application/json';
            localVarRequestOptions.data = needsSerialization
                ? JSON.stringify(push !== undefined ? push : {})
                : push || '';
            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        }),
        /**
         *
         * @summary // Authorization Request. Part of OAuth flow rpc Auth(AuthRequest) returns (AuthResponse);
         * @param {WebitelImApiGatewayV1TokenRequest} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        token: (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 token.');
            }
            const localVarPath = `/v1/auth/token`;
            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 Deletes a device by its token, stops sending PUSH-notifications to it.
         * @param {WebitelImApiGatewayV1PUSHSubscription} push PUSH Notification subscription
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        unregisterDevice: (push, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // verify required parameter 'push' is not null or undefined
            if (push === null || push === undefined) {
                throw new RequiredError('push', 'Required parameter push was null or undefined when calling unregisterDevice.');
            }
            const localVarPath = `/v1/auth/device`;
            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;
            }
            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 push !== 'string' ||
                localVarRequestOptions.headers['Content-Type'] === 'application/json';
            localVarRequestOptions.data = needsSerialization
                ? JSON.stringify(push !== undefined ? push : {})
                : push || '';
            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        }),
    };
};
/**
 * AccountApi - functional programming interface
 * @export
 */
export const AccountApiFp = function (configuration) {
    return {
        /**
         *
         * @summary Inspect current Authorization credentials
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        inspect(options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield AccountApiAxiosParamCreator(configuration).inspect(options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
        /**
         *
         * @summary Logout Device Request
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        logout(options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield AccountApiAxiosParamCreator(configuration).logout(options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
        /**
         *
         * @summary Register device to receive PUSH notifications
         * @param {WebitelImApiGatewayV1PUSHSubscription} push PUSH Notification subscription
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        registerDevice(push, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield AccountApiAxiosParamCreator(configuration).registerDevice(push, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
        /**
         *
         * @summary // Authorization Request. Part of OAuth flow rpc Auth(AuthRequest) returns (AuthResponse);
         * @param {WebitelImApiGatewayV1TokenRequest} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        token(body, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield AccountApiAxiosParamCreator(configuration).token(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 Deletes a device by its token, stops sending PUSH-notifications to it.
         * @param {WebitelImApiGatewayV1PUSHSubscription} push PUSH Notification subscription
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        unregisterDevice(push, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield AccountApiAxiosParamCreator(configuration).unregisterDevice(push, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
    };
};
/**
 * AccountApi - factory interface
 * @export
 */
export const AccountApiFactory = function (configuration, basePath, axios) {
    return {
        /**
         *
         * @summary Inspect current Authorization credentials
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        inspect(options) {
            return AccountApiFp(configuration)
                .inspect(options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Logout Device Request
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        logout(options) {
            return AccountApiFp(configuration)
                .logout(options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Register device to receive PUSH notifications
         * @param {WebitelImApiGatewayV1PUSHSubscription} push PUSH Notification subscription
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        registerDevice(push, options) {
            return AccountApiFp(configuration)
                .registerDevice(push, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary // Authorization Request. Part of OAuth flow rpc Auth(AuthRequest) returns (AuthResponse);
         * @param {WebitelImApiGatewayV1TokenRequest} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        token(body, options) {
            return AccountApiFp(configuration)
                .token(body, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Deletes a device by its token, stops sending PUSH-notifications to it.
         * @param {WebitelImApiGatewayV1PUSHSubscription} push PUSH Notification subscription
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        unregisterDevice(push, options) {
            return AccountApiFp(configuration)
                .unregisterDevice(push, options)
                .then((request) => request(axios, basePath));
        },
    };
};
/**
 * AccountApi - object-oriented interface
 * @export
 * @class AccountApi
 * @extends {BaseAPI}
 */
export class AccountApi extends BaseAPI {
    /**
     *
     * @summary Inspect current Authorization credentials
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AccountApi
     */
    inspect(options) {
        return AccountApiFp(this.configuration)
            .inspect(options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Logout Device Request
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AccountApi
     */
    logout(options) {
        return AccountApiFp(this.configuration)
            .logout(options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Register device to receive PUSH notifications
     * @param {WebitelImApiGatewayV1PUSHSubscription} push PUSH Notification subscription
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AccountApi
     */
    registerDevice(push, options) {
        return AccountApiFp(this.configuration)
            .registerDevice(push, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary // Authorization Request. Part of OAuth flow rpc Auth(AuthRequest) returns (AuthResponse);
     * @param {WebitelImApiGatewayV1TokenRequest} body
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AccountApi
     */
    token(body, options) {
        return AccountApiFp(this.configuration)
            .token(body, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Deletes a device by its token, stops sending PUSH-notifications to it.
     * @param {WebitelImApiGatewayV1PUSHSubscription} push PUSH Notification subscription
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AccountApi
     */
    unregisterDevice(push, options) {
        return AccountApiFp(this.configuration)
            .unregisterDevice(push, options)
            .then((request) => request(this.axios, this.basePath));
    }
}
//# sourceMappingURL=account-api.js.map