This commit is contained in:
87
dist/services/AuthService.js
vendored
87
dist/services/AuthService.js
vendored
@@ -1,87 +0,0 @@
|
||||
"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 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 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 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 requestBody CreateResetToken
|
||||
* @returns any
|
||||
* @throws ApiError
|
||||
*/
|
||||
static async authControllerGetResetToken(requestBody) {
|
||||
const result = await request_1.request({
|
||||
method: 'POST',
|
||||
path: `/api/auth/reset`,
|
||||
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 request_1.request({
|
||||
method: 'POST',
|
||||
path: `/api/auth/reset/${token}`,
|
||||
body: requestBody,
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
}
|
||||
exports.AuthService = AuthService;
|
||||
Reference in New Issue
Block a user