baasic-sdk-javascript
Version:
JavaScript SDK provides core functionality for building web and mobile applications on [Baasic](http://www.baasic.com/).
102 lines (101 loc) • 4.54 kB
JavaScript
;
/* globals module */
/**
* @module passwordRecoveryClient
* @description Password Recovery Client provides an easy way to consume Password Recovery REST API end-points. In order to obtain needed routes `passwordRecoveryClient` uses `passwordRecoveryRoute`.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var inversify_1 = require("inversify");
var httpApi_1 = require("../../../httpApi");
var _1 = require("./");
var PasswordRecoveryClient = /** @class */ (function () {
function PasswordRecoveryClient(passwordRecoveryRoute, apiClient) {
this.passwordRecoveryRoute = passwordRecoveryRoute;
this.apiClient = apiClient;
}
Object.defineProperty(PasswordRecoveryClient.prototype, "routeDefinition", {
/**
* Provides direct access to `passwordRecoveryRoute`.
* @method
**/
get: function () {
return this.passwordRecoveryRoute;
},
enumerable: true,
configurable: true
});
/**
* Returns a promise that is resolved once the password change action is completed. This updates user's password selection.
* @method
* @param data Password recovery object used to update user's current password selection.
* @example passwordRecoveryClient.change({
newPassword : '<new-password>'
})
.then(function () {
// perform success action here
},
function (data) {
// perform error handling here
})
.finally (function () {});
*/
PasswordRecoveryClient.prototype.change = function (data) {
return this.apiClient.put(this.routeDefinition.passwordChange(), data);
};
/**
* Returns a promise that is resolved once the password recovery requestReset action is completed. This action initiates the password recovery process for the user.
* @method
* @param data A password recovery object which contains parameters required for the password retrieval request.
* @example passwordRecoveryClient.requestReset({
challengeIdentifier : '<challenge-identifier>',
challengeResponse : '<challenge-response>',
recoverUrl : '<recover-url>',
username : '<username>'
})
.then(function () {
// perform success action here
},
function (data) {
// perform error handling here
})
.finally (function () {});
*/
PasswordRecoveryClient.prototype.requestReset = function (data) {
return this.apiClient.post(this.routeDefinition.passwordRecovery(), data);
};
/**
* Returns a promise that is resolved once the password reset action is completed. This updates user's password selection.
* @method
* @param data Password recovery object used to update user's current password selection.
* @example passwordRecoveryClient.reset({
newPassword : '<new-password>',
passwordRecoveryToken : '<password-recovery-token>'
})
.then(function () {
// perform success action here
},
function (data) {
// perform error handling here
})
.finally (function () {});
*/
PasswordRecoveryClient.prototype.reset = function (data) {
return this.apiClient.put(this.routeDefinition.passwordRecovery(), data);
};
PasswordRecoveryClient = tslib_1.__decorate([
inversify_1.injectable(),
tslib_1.__param(0, inversify_1.inject(_1.TYPES.PasswordRecoveryRoute)),
tslib_1.__param(1, inversify_1.inject(httpApi_1.httpTYPES.ApiClient)),
tslib_1.__metadata("design:paramtypes", [_1.PasswordRecoveryRoute,
httpApi_1.ApiClient])
], PasswordRecoveryClient);
return PasswordRecoveryClient;
}());
exports.PasswordRecoveryClient = PasswordRecoveryClient;
/**
* @overview
***Notes:**
- Refer to the [Baasic REST API](http://dev.baasic.com/api/reference/home) for detailed information about available Baasic REST API end-points.
- All end-point objects are transformed by the associated route service.
*/