promise docs

Add promise jsdoc in loopback
This commit is contained in:
Jue Hou 2016-02-04 15:31:39 -05:00 committed by juehou
parent 982b8ac228
commit eb09681f21
3 changed files with 18 additions and 3 deletions

View File

@ -108,7 +108,9 @@ module.exports = function(Application) {
* @param {String} owner Owner's user ID.
* @param {String} name Name of the application
* @param {Object} options Other options
* @param {Function} callback Callback function
* @callback {Function} callback Callback function
* @param {Error} err
* @promise
*/
Application.register = function(owner, name, options, cb) {
assert(owner, 'owner is required');
@ -150,6 +152,7 @@ module.exports = function(Application) {
* @param {Any} appId
* @callback {Function} callback
* @param {Error} err
* @promise
*/
Application.resetKeys = function(appId, cb) {
cb = cb || utils.createPromiseCallback();
@ -176,7 +179,7 @@ module.exports = function(Application) {
* - restApiKey
* - windowsKey
* - masterKey
*
* @promise
*/
Application.authenticate = function(appId, key, cb) {
cb = cb || utils.createPromiseCallback();

View File

@ -79,6 +79,7 @@ module.exports = function(User) {
* @callback {Function} cb The callback function
* @param {String|Error} err The error string or object
* @param {AccessToken} token The generated access token object
* @promise
*/
User.prototype.createAccessToken = function(ttl, options, cb) {
if (cb === undefined && typeof options === 'function') {
@ -169,6 +170,7 @@ module.exports = function(User) {
* @callback {Function} callback Callback function
* @param {Error} err Error object
* @param {AccessToken} token Access token if login is successful
* @promise
*/
User.login = function(credentials, include, fn) {
@ -281,6 +283,7 @@ module.exports = function(User) {
* @param {String} accessTokenID
* @callback {Function} callback
* @param {Error} err
* @promise
*/
User.logout = function(tokenId, fn) {
@ -304,6 +307,7 @@ module.exports = function(User) {
* @callback {Function} callback Callback function
* @param {Error} err Error object
* @param {Boolean} isMatch Returns true if the given `password` matches record
* @promise
*/
User.prototype.hasPassword = function(plain, fn) {
@ -350,6 +354,10 @@ module.exports = function(User) {
* callback function. This function should NOT add the token to the user
* object, instead simply execute the callback with the token! User saving
* and email sending will be handled in the `verify()` method.
* @callback {Function} fn Callback function.
* @param {Error} err Error object.
* @param {Object} object Contains email, token, uid.
* @promise
*/
User.prototype.verify = function(options, fn) {
@ -463,6 +471,7 @@ module.exports = function(User) {
* @param {String} redirect URL to redirect the user to once confirmed
* @callback {Function} callback
* @param {Error} err
* @promise
*/
User.confirm = function(uid, token, redirect, fn) {
fn = fn || utils.createPromiseCallback();
@ -505,6 +514,7 @@ module.exports = function(User) {
* @prop {String} email The user's email address
* @callback {Function} callback
* @param {Error} err
* @promise
*/
User.resetPassword = function(options, cb) {

View File

@ -925,8 +925,10 @@ module.exports = function(registry) {
* @callback {Function} [callback] Callback function called with `(err, conflicts)` arguments.
* @param {Error} err Error object; see [Error object](http://docs.strongloop.com/display/LB/Error+object).
* @param {Conflict[]} conflicts A list of changes that could not be replicated due to conflicts.
* @param {Object] checkpoints The new checkpoints to use as the "since"
* @param {Object} checkpoints The new checkpoints to use as the "since"
* argument for the next replication.
*
* @promise
*/
PersistedModel.replicate = function(since, targetModel, options, callback) {