UNPKG

@novo-learning/novo-sdk

Version:

SDK for the Novolanguage Speech Analysis API

40 lines 1.48 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AuthApi = void 0; const user_data_mapper_1 = require("../../mappers/user-data.mapper"); const generated_1 = require("./generated"); class AuthApi { constructor(configuration, basePath, axios) { this.authApi = new generated_1.AuthApi(configuration, basePath, axios); this.userDataMapper = new user_data_mapper_1.UserDataMapper(); } mapGeneratedAuthenticationReponse(dto) { return { ...dto, data: { ...dto.data, data: { ...dto.data.data, user: this.userDataMapper.mapFromGenerated(dto.data.data.user), }, }, }; } refresh(refreshRequestDtoV1, options) { return this.authApi .refresh(refreshRequestDtoV1, options) .then((response) => this.mapGeneratedAuthenticationReponse(response)); } sso(authenticateSsoRequestDtoV1, options) { return this.authApi .sso(authenticateSsoRequestDtoV1, options) .then((response) => this.mapGeneratedAuthenticationReponse(response)); } ssoAnonymous(ssoRequestDtoV1, options) { return this.authApi .ssoAnonymous(ssoRequestDtoV1, options) .then((response) => this.mapGeneratedAuthenticationReponse(response)); } } exports.AuthApi = AuthApi; //# sourceMappingURL=auth-api.js.map