bedrock-web-account
v2.1.0
Published
User Account APIs for Bedrock Web Apps
Downloads
9
Keywords
Readme
bedrock-web-account
User account APIs for Bedrock Web Apps
API Reference
Classes
Typedefs
AccountService
This service is used to encapsulate all account based activity for a project.
Kind: global class
- AccountService
- new exports.AccountService([config])
- .exists(options) ⇒ Boolean
- .create(options) ⇒ Object
- .get(options) ⇒ Object
- .getAll(options) ⇒ Array
- .update(options) ⇒ Void
- .setStatus(options) ⇒ Void
- .getRoles(options) ⇒ Array.<Object>
new exports.AccountService([config])
| Param | Type | Default | | --- | --- | --- | | [config] | Object | {urls: {base: '/accounts'}} | | [config.urls] | Object | {} | | [config.urls.base] | string | "/accounts" |
accountService.exists(options) ⇒ Boolean
On 200 exists returns true on error if it is a NotFoundError we return false in all other cases we forward the error to the project.
Kind: instance method of AccountService
Returns: Boolean - exists
| Param | Type | Default | | --- | --- | --- | | options | Object | | | [options.baseUrl] | string | "/accounts" | | options.email | string | |
accountService.create(options) ⇒ Object
Takes a url and an email then creates an account for a user.
Kind: instance method of AccountService
| Param | Type | Default | | --- | --- | --- | | options | Object | | | [options.url] | string | "/accounts" | | options.email | string | |
accountService.get(options) ⇒ Object
Takes a url and an id and finds a single account.
Kind: instance method of AccountService
Returns: Object - an account
| Param | Type | Default | | --- | --- | --- | | options | Object | | | [options.baseUrl] | string | "/accounts" | | options.id | string | |
accountService.getAll(options) ⇒ Array
Returns all accounts that match the given query parameters.
Kind: instance method of AccountService
Returns: Array - data
| Param | Type | Default | Description | | --- | --- | --- | --- | | options | Object | | | | [options.baseUrl] | string | "/accounts" | The base baseUrl. | | options.email | string | | The user's email. | | [options.after] | string | null | An account's ID. | | [options.limit] | number | 10 | How many accounts to return. |
accountService.update(options) ⇒ Void
Updates an account via a series of json patches patches need to be in the:
json patch format we use fast-json for handling json patches.
Kind: instance method of AccountService
| Param | Type | Default | Description | | --- | --- | --- | --- | | options | Object | | | | [options.baseUrl] | string | "/accounts" | | | options.id | string | | An account's id. | | options.sequence | number | | An account's sequence number. | | config.patch | Array.<Object> | | A JSON patch per RFC6902. |
accountService.setStatus(options) ⇒ Void
Takes an id and a status string then changes an account's status.
Kind: instance method of AccountService
| Param | Type | Default | Description | | --- | --- | --- | --- | | options | Object | | | | [options.baseUrl] | string | "/accounts" | | | options.id | string | | An account id. | | options.status | StatusType | | one of 3 status types |
accountService.getRoles(options) ⇒ Array.<Object>
Takes an account's id and returns all sysRoles for it.
Kind: instance method of AccountService
| Param | Type | Default | Description | | --- | --- | --- | --- | | options | Object | | | | [options.baseUrl] | string | "/accounts" | | | options.id | string | | An account id. |
RegisterController
Encapsulates the registration methods.
Kind: global class
new exports.RegisterController(options)
| Param | Type | Default | | --- | --- | --- | | options | Object | | | [options.debounceExists] | number | 500 | | [options.accountServiceConfig] | Object | {} |
registerController.exists()
Exists is a debounced method used to check if an email already exists during registration.
Kind: instance method of RegisterController
registerController.register()
Registers a user then sets registering to false.
Kind: instance method of RegisterController
StatusType : "active" | "disabled" | "deleted"
Kind: global typedef
Copyright (c) 2018-2019 Digital Bazaar, Inc. All rights reserved.
