92 lines
3.0 KiB
JavaScript
92 lines
3.0 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.AuthService = void 0;
|
|
const request_1 = require("../core/request");
|
|
class AuthService {
|
|
/**
|
|
* Login
|
|
* Login with your username/email and password. <br> You will receive:
|
|
* * access token (use it as a bearer token)
|
|
* * refresh token (will also be sent as a cookie)
|
|
* @param requestBody CreateAuth
|
|
* @result any
|
|
* @throws ApiError
|
|
*/
|
|
static async authControllerLogin(requestBody) {
|
|
const result = await (0, request_1.request)({
|
|
method: 'POST',
|
|
path: `/api/auth/login`,
|
|
body: requestBody,
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Logout
|
|
* Logout using your refresh token. <br> This instantly invalidates all your access and refresh tokens.
|
|
* @param requestBody HandleLogout
|
|
* @result any
|
|
* @throws ApiError
|
|
*/
|
|
static async authControllerLogout(requestBody) {
|
|
const result = await (0, request_1.request)({
|
|
method: 'POST',
|
|
path: `/api/auth/logout`,
|
|
body: requestBody,
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Refresh
|
|
* Refresh your access and refresh tokens using a valid refresh token. <br> You will receive:
|
|
* * access token (use it as a bearer token)
|
|
* * refresh token (will also be sent as a cookie)
|
|
* @param requestBody RefreshAuth
|
|
* @result any
|
|
* @throws ApiError
|
|
*/
|
|
static async authControllerRefresh(requestBody) {
|
|
const result = await (0, request_1.request)({
|
|
method: 'POST',
|
|
path: `/api/auth/refresh`,
|
|
body: requestBody,
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Get reset token
|
|
* Request a password reset token. <br> This will provide you with a reset token that you can use by posting to /api/auth/reset/{token}.
|
|
* @param locale
|
|
* @param requestBody CreateResetToken
|
|
* @result ResponseEmpty
|
|
* @throws ApiError
|
|
*/
|
|
static async authControllerGetResetToken(locale, requestBody) {
|
|
const result = await (0, request_1.request)({
|
|
method: 'POST',
|
|
path: `/api/auth/reset`,
|
|
query: {
|
|
'locale': locale,
|
|
},
|
|
body: requestBody,
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Reset password
|
|
* Reset a user's utilising a valid password reset token. <br> This will set the user's password to the one you provided in the body. <br> To get a reset token post to /api/auth/reset with your username.
|
|
* @param token
|
|
* @param requestBody ResetPassword
|
|
* @result any
|
|
* @throws ApiError
|
|
*/
|
|
static async authControllerResetPassword(token, requestBody) {
|
|
const result = await (0, request_1.request)({
|
|
method: 'POST',
|
|
path: `/api/auth/reset/${token}`,
|
|
body: requestBody,
|
|
});
|
|
return result.body;
|
|
}
|
|
}
|
|
exports.AuthService = AuthService;
|