UNPKG

baasic-sdk-javascript

Version:

JavaScript SDK provides core functionality for building web and mobile applications on [Baasic](http://www.baasic.com/).

65 lines (64 loc) 3.14 kB
/** * @module registerClient * @description Register Client provides an easy way to consume Application Registration REST API end-points. In order to obtain needed routes `registerClient` uses `registerRoute`. */ import { ApiClient, IHttpResponse } from '../../httpApi'; import { ITokenHandler } from '../../core/contracts'; import { RegisterRoute } from './'; import { IAppUser, IRegisterUser } from './contracts'; export declare class RegisterClient { protected registerRoute: RegisterRoute; protected apiClient: ApiClient; protected tokenHandler: ITokenHandler; /** * Provides direct access to `registerRoute`. * @method * @example registerClient.routeDefinition.get(); **/ readonly routeDefinition: RegisterRoute; constructor(registerRoute: RegisterRoute, apiClient: ApiClient, tokenHandler: ITokenHandler); /** * Returns a promise that is resolved once the register create has been performed. This action will create a new user if completed successfully. Created user is not approved immediately, instead an activation e-mail is sent to the user. * @param data A user account object that needs to be inserted into the system. * @method * @example registerClient.create({ activationUrl : '<activation-url>', challengeIdentifier : '<challenge-identifier>', challengeResponse : '<challenge-response>', confirmPassword : '<confirm-password>', email : '<email>', password : '<password>', username : '<username>' }) .success(function (data) { // perform success actions here }).error(function (data, status) { // perform error handling here }) .finally (function () {}); **/ create(data: IRegisterUser): PromiseLike<IHttpResponse<IAppUser>>; /** * Returns a promise that is resolved once the account activation action has been performed; this action activates a user account and success response returns the token resource. * @param data Security code which uniquely identifies user account that needs to be activated. * @returns A promise that is resolved once the account activation action has been performed. * @method * @example registerClient.activate({ activationToken : '<activation-token>' }) .then(function (data) { // perform success actions here }, function (data, status) { // perform error handling here }) .finally (function () {}); **/ activate(data: string): PromiseLike<any>; } /** * @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 definition. */