UNPKG

baasic-sdk-javascript

Version:

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

111 lines (110 loc) 4.71 kB
/** * @module userRoute * @description Baasic User Route Definition provides Baasic route templates which can be expanded to Baasic REST URIs. Various services can use Baasic User Route Service to obtain needed routes while other routes will be obtained through HAL. By convention, all route services use the same function names as their corresponding services. */ import { BaseRoute } from '../../common'; import { IOptions } from '../../common/contracts'; import { UserSocialLoginRoute } from './'; import { IAppUser, IUserOptions } from './contracts'; import { IAppOptions } from '../../core/contracts'; export declare class UserRoute extends BaseRoute { protected appOptions: IAppOptions; protected userSocialLoginRoute: UserSocialLoginRoute; /** * Find route with route and query parameters. **/ findRoute: string; /** * Get route with route and query parameters. **/ getRoute: string; /** * Create route with route and query parameters. **/ createRoute: string; /** * Update route with route and query parameters. **/ updateRoute: string; /** * Delete route with route and query parameters. **/ deleteRoute: string; /** * Exists route with route and query parameters. **/ existsRoute: string; /** * Change password route with route and query parameters. **/ changePasswordRoute: string; /** * Unlock route with route and query parameters. **/ unlockRoute: string; /** * Lock route with route and query parameters. **/ lockRoute: string; /** * Approve route with route and query parameters. **/ approveRoute: string; /** * Disapprove route with route and query parameters. **/ disapproveRoute: string; readonly socialLogin: UserSocialLoginRoute; constructor(appOptions: IAppOptions, userSocialLoginRoute: UserSocialLoginRoute); /** * Parses find user route which can be expanded with additional options. Supported items are: * - `searchQuery` - A string referencing user properties using the phrase or BQL (Baasic Query Language) search. * - `page` - A value used to set the page number, i.e. to retrieve certain user subset from the storage. * - `rpp` - A value used to limit the size of result set per page. * - `sort` - A string used to set the user property to sort the result collection by. * - `embed` - Comma separated list of resources to be contained within the current representation. * @method * @example userRoute.find({searchQuery: '<search-phrase>'}); **/ find(options: IUserOptions): any; /** * Parses get user route which must be expanded with the username of the previously created user resource in the system. Additional expand supported items are: * - `embed` - Comma separated list of resources to be contained within the current representation. * @method * @example userRoute.get({username: '<username>'}) **/ get(id: string, options?: IOptions): any; /** * Parses create user route, this URI template does not expose any additional options. * @method * @example userRoute.create(); **/ create(): any; update(data: IAppUser): any; delete(data: IAppUser): any; /** * Parses user exists route; URI template should be expanded with the username whose availability you'd like to check. * @method * @param username A username which uniquely identifies an application user. * @example userRoute.exists({username: '<username>'}); **/ exists(username: string, options?: any): any; /** * Parses change password route, URI template should be expanded with the username of the user resource whose password should be updated. * @method * @param username A username or id which uniquely identifies user resource. * @example userRoute.changePassword({username: '<username>'}); **/ changePassword(username: string): any; unlock(data: IAppUser): any; lock(data: IAppUser): any; approve(data: IAppUser): any; disapprove(data: IAppUser): 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. - [URI Template](https://github.com/Baasic/uritemplate-js) syntax enables expanding the Baasic route templates to Baasic REST URIs providing it with an object that contains URI parameters. - All end-point objects are transformed by the associated route definition. */