This repository has been archived on 2023-11-06. You can view files and clone it, but cannot push or open issues or pull requests.
lfk-client-node/dist/services/AuthService.js
Nicolai Ort b958a03162
All checks were successful
continuous-integration/drone Build is passing
🚀New lib version v0.13.1 [CI SKIP]
2023-02-02 15:19:00 +00:00

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
* @returns 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
* @returns 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
* @returns 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
* @returns 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
* @returns 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;