// 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';
/**
 * TwoFactorAuthenticationApi - axios parameter creator
 * @export
 */
export const TwoFactorAuthenticationApiAxiosParamCreator = function (configuration) {
    return {
        /**
         *
         * @summary GenerateUserTfaKey generates new or regenerates secret for the concrete user
         * @param {string} userId
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        generateUserTfaKey: (userId, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // verify required parameter 'userId' is not null or undefined
            if (userId === null || userId === undefined) {
                throw new RequiredError('userId', 'Required parameter userId was null or undefined when calling generateUserTfaKey.');
            }
            const localVarPath = `/users/{user_id}/2fa`.replace(`{${'user_id'}}`, encodeURIComponent(String(userId)));
            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 GetUserTfaKey locates the secret for user and returns it as a TOTP url
         * @param {string} userId
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getUserTfaKey: (userId, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // verify required parameter 'userId' is not null or undefined
            if (userId === null || userId === undefined) {
                throw new RequiredError('userId', 'Required parameter userId was null or undefined when calling getUserTfaKey.');
            }
            const localVarPath = `/users/{user_id}/2fa`.replace(`{${'user_id'}}`, encodeURIComponent(String(userId)));
            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,
            };
        }),
    };
};
/**
 * TwoFactorAuthenticationApi - functional programming interface
 * @export
 */
export const TwoFactorAuthenticationApiFp = function (configuration) {
    return {
        /**
         *
         * @summary GenerateUserTfaKey generates new or regenerates secret for the concrete user
         * @param {string} userId
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        generateUserTfaKey(userId, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield TwoFactorAuthenticationApiAxiosParamCreator(configuration).generateUserTfaKey(userId, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
        /**
         *
         * @summary GetUserTfaKey locates the secret for user and returns it as a TOTP url
         * @param {string} userId
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getUserTfaKey(userId, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield TwoFactorAuthenticationApiAxiosParamCreator(configuration).getUserTfaKey(userId, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
    };
};
/**
 * TwoFactorAuthenticationApi - factory interface
 * @export
 */
export const TwoFactorAuthenticationApiFactory = function (configuration, basePath, axios) {
    return {
        /**
         *
         * @summary GenerateUserTfaKey generates new or regenerates secret for the concrete user
         * @param {string} userId
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        generateUserTfaKey(userId, options) {
            return TwoFactorAuthenticationApiFp(configuration)
                .generateUserTfaKey(userId, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary GetUserTfaKey locates the secret for user and returns it as a TOTP url
         * @param {string} userId
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getUserTfaKey(userId, options) {
            return TwoFactorAuthenticationApiFp(configuration)
                .getUserTfaKey(userId, options)
                .then((request) => request(axios, basePath));
        },
    };
};
/**
 * TwoFactorAuthenticationApi - object-oriented interface
 * @export
 * @class TwoFactorAuthenticationApi
 * @extends {BaseAPI}
 */
export class TwoFactorAuthenticationApi extends BaseAPI {
    /**
     *
     * @summary GenerateUserTfaKey generates new or regenerates secret for the concrete user
     * @param {string} userId
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof TwoFactorAuthenticationApi
     */
    generateUserTfaKey(userId, options) {
        return TwoFactorAuthenticationApiFp(this.configuration)
            .generateUserTfaKey(userId, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary GetUserTfaKey locates the secret for user and returns it as a TOTP url
     * @param {string} userId
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof TwoFactorAuthenticationApi
     */
    getUserTfaKey(userId, options) {
        return TwoFactorAuthenticationApiFp(this.configuration)
            .getUserTfaKey(userId, options)
            .then((request) => request(this.axios, this.basePath));
    }
}
//# sourceMappingURL=two-factor-authentication-api.js.map