From 49425a0862578665777cf2079d4a2c57b50bb15a Mon Sep 17 00:00:00 2001 From: Luis Deschamps Rudge Date: Tue, 29 May 2018 13:36:33 -0300 Subject: [PATCH 1/6] Adding pagination docs for clients/connections --- src/management/ClientsManager.js | 17 +++++++++++++++-- src/management/ConnectionsManager.js | 17 +++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/management/ClientsManager.js b/src/management/ClientsManager.js index be255f4ea..de25f3382 100644 --- a/src/management/ClientsManager.js +++ b/src/management/ClientsManager.js @@ -86,12 +86,25 @@ utils.wrapPropertyMethod(ClientsManager, 'create', 'resource.create'); * @method getAll * @memberOf module:management.ClientsManager.prototype * - * @example + * @example + * This method takes an optional object as first argument that may be used to + * specify pagination settings and the search query. + * + * + * // Pagination settings. + * var params = { + * per_page: 10, + * page: 2 + * }; + * * management.clients.getAll(function (err, clients) { * console.log(clients.length); * }); * - * @param {Function} [cb] Callback function. + * @param {Object} [params] Users params. + * @param {Number} [params.per_page] Number of users per page. + * @param {Number} [params.page] Page number. + * @param {Function} [cb] Callback function. * * @return {Promise|undefined} */ diff --git a/src/management/ConnectionsManager.js b/src/management/ConnectionsManager.js index 69c4acc25..ff0e6d03b 100644 --- a/src/management/ConnectionsManager.js +++ b/src/management/ConnectionsManager.js @@ -80,12 +80,25 @@ utils.wrapPropertyMethod(ConnectionsManager, 'create', 'resource.create'); * @method getAll * @memberOf module:management.ConnectionsManager.prototype * - * @example + * @example + * This method takes an optional object as first argument that may be used to + * specify pagination settings and the search query. + * + * + * // Pagination settings. + * var params = { + * per_page: 10, + * page: 2 + * }; + * * management.connections.getAll(function (err, connections) { * console.log(connections.length); * }); * - * @param {Function} [cb] Callback function. + * @param {Object} [params] Users params. + * @param {Number} [params.per_page] Number of users per page. + * @param {Number} [params.page] Page number. + * @param {Function} [cb] Callback function. * * @return {Promise|undefined} */ From 92c13f09646b0919165e210dedc46d1d6cb6a760 Mon Sep 17 00:00:00 2001 From: Luis Deschamps Rudge Date: Tue, 29 May 2018 14:45:06 -0300 Subject: [PATCH 2/6] copy/paste hell --- src/management/ClientsManager.js | 2 +- src/management/ConnectionsManager.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/management/ClientsManager.js b/src/management/ClientsManager.js index de25f3382..8896698bc 100644 --- a/src/management/ClientsManager.js +++ b/src/management/ClientsManager.js @@ -101,7 +101,7 @@ utils.wrapPropertyMethod(ClientsManager, 'create', 'resource.create'); * console.log(clients.length); * }); * - * @param {Object} [params] Users params. + * @param {Object} [params] Clients params. * @param {Number} [params.per_page] Number of users per page. * @param {Number} [params.page] Page number. * @param {Function} [cb] Callback function. diff --git a/src/management/ConnectionsManager.js b/src/management/ConnectionsManager.js index ff0e6d03b..d1737115d 100644 --- a/src/management/ConnectionsManager.js +++ b/src/management/ConnectionsManager.js @@ -95,7 +95,7 @@ utils.wrapPropertyMethod(ConnectionsManager, 'create', 'resource.create'); * console.log(connections.length); * }); * - * @param {Object} [params] Users params. + * @param {Object} [params] Connections params. * @param {Number} [params.per_page] Number of users per page. * @param {Number} [params.page] Page number. * @param {Function} [cb] Callback function. From f1e7310eebbaadbd4b115ce17faf6b59ae6cdefa Mon Sep 17 00:00:00 2001 From: Luis Deschamps Rudge Date: Tue, 29 May 2018 14:46:25 -0300 Subject: [PATCH 3/6] no search query --- src/management/ClientsManager.js | 2 +- src/management/ConnectionsManager.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/management/ClientsManager.js b/src/management/ClientsManager.js index 8896698bc..f808d2ff0 100644 --- a/src/management/ClientsManager.js +++ b/src/management/ClientsManager.js @@ -88,7 +88,7 @@ utils.wrapPropertyMethod(ClientsManager, 'create', 'resource.create'); * * @example * This method takes an optional object as first argument that may be used to - * specify pagination settings and the search query. + * specify pagination settings. * * * // Pagination settings. diff --git a/src/management/ConnectionsManager.js b/src/management/ConnectionsManager.js index d1737115d..f782786e0 100644 --- a/src/management/ConnectionsManager.js +++ b/src/management/ConnectionsManager.js @@ -82,7 +82,7 @@ utils.wrapPropertyMethod(ConnectionsManager, 'create', 'resource.create'); * * @example * This method takes an optional object as first argument that may be used to - * specify pagination settings and the search query. + * specify pagination settings. * * * // Pagination settings. From af9b686647bf35123b11d2b26d25ca51a6f9205d Mon Sep 17 00:00:00 2001 From: Luis Deschamps Rudge Date: Tue, 29 May 2018 14:58:25 -0300 Subject: [PATCH 4/6] pagination warning --- src/management/ClientsManager.js | 3 ++- src/management/ConnectionsManager.js | 3 ++- src/management/UsersManager.js | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/management/ClientsManager.js b/src/management/ClientsManager.js index f808d2ff0..87c0f42a3 100644 --- a/src/management/ClientsManager.js +++ b/src/management/ClientsManager.js @@ -88,7 +88,8 @@ utils.wrapPropertyMethod(ClientsManager, 'create', 'resource.create'); * * @example * This method takes an optional object as first argument that may be used to - * specify pagination settings. + * specify pagination settings. If pagination options are not present, + * the first page of a limited number of results will be returned. * * * // Pagination settings. diff --git a/src/management/ConnectionsManager.js b/src/management/ConnectionsManager.js index f782786e0..1eadbac75 100644 --- a/src/management/ConnectionsManager.js +++ b/src/management/ConnectionsManager.js @@ -82,7 +82,8 @@ utils.wrapPropertyMethod(ConnectionsManager, 'create', 'resource.create'); * * @example * This method takes an optional object as first argument that may be used to - * specify pagination settings. + * specify pagination settings. If pagination options are not present, + * the first page of a limited number of results will be returned. * * * // Pagination settings. diff --git a/src/management/UsersManager.js b/src/management/UsersManager.js index 54f4cc235..d781cc0b9 100644 --- a/src/management/UsersManager.js +++ b/src/management/UsersManager.js @@ -144,7 +144,8 @@ UsersManager.prototype.create = function(data, cb) { * * @example * This method takes an optional object as first argument that may be used to - * specify pagination settings and the search query. + * specify pagination settings and the search query. If pagination options are + * not present, the first page of a limited number of results will be returned. * * * // Pagination settings. From 85b3745686dad1e1ce72711ee3d64594c042ad9a Mon Sep 17 00:00:00 2001 From: Luis Deschamps Rudge Date: Tue, 29 May 2018 15:02:37 -0300 Subject: [PATCH 5/6] number of X per page --- src/management/ClientsManager.js | 2 +- src/management/ConnectionsManager.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/management/ClientsManager.js b/src/management/ClientsManager.js index 87c0f42a3..12a500b0a 100644 --- a/src/management/ClientsManager.js +++ b/src/management/ClientsManager.js @@ -103,7 +103,7 @@ utils.wrapPropertyMethod(ClientsManager, 'create', 'resource.create'); * }); * * @param {Object} [params] Clients params. - * @param {Number} [params.per_page] Number of users per page. + * @param {Number} [params.per_page] Number of clients per page. * @param {Number} [params.page] Page number. * @param {Function} [cb] Callback function. * diff --git a/src/management/ConnectionsManager.js b/src/management/ConnectionsManager.js index 1eadbac75..fef8c2071 100644 --- a/src/management/ConnectionsManager.js +++ b/src/management/ConnectionsManager.js @@ -97,7 +97,7 @@ utils.wrapPropertyMethod(ConnectionsManager, 'create', 'resource.create'); * }); * * @param {Object} [params] Connections params. - * @param {Number} [params.per_page] Number of users per page. + * @param {Number} [params.per_page] Number of connections per page. * @param {Number} [params.page] Page number. * @param {Function} [cb] Callback function. * From ed7329940c7c66324188ced69d382bde290fb636 Mon Sep 17 00:00:00 2001 From: Luis Deschamps Rudge Date: Tue, 29 May 2018 15:13:41 -0300 Subject: [PATCH 6/6] v2.10.0 --- CHANGELOG.md | 60 +- docs/RetryRestClient.js.html | 116 +- docs/auth_DatabaseAuthenticator.js.html | 50 +- docs/auth_OAuthAuthenticator.js.html | 42 +- docs/auth_PasswordlessAuthenticator.js.html | 36 +- docs/auth_TokensManager.js.html | 40 +- docs/auth_UsersManager.js.html | 36 +- docs/auth_index.js.html | 66 +- docs/external-RestClient.html | 114 +- docs/index.html | 39 +- docs/index.js.html | 4 +- ...anagement_BlacklistedTokensManager.js.html | 15 +- docs/management_ClientGrantsManager.js.html | 17 +- docs/management_ClientsManager.js.html | 36 +- docs/management_ConnectionsManager.js.html | 36 +- ...anagement_DeviceCredentialsManager.js.html | 17 +- docs/management_EmailProviderManager.js.html | 18 +- docs/management_EmailTemplatesManager.js.html | 189 +++ docs/management_JobsManager.js.html | 100 +- docs/management_LogsManager.js.html | 13 +- ...management_ManagementTokenProvider.js.html | 56 +- .../management_ResourceServersManager.js.html | 16 +- docs/management_RulesManager.js.html | 19 +- docs/management_StatsManager.js.html | 20 +- docs/management_TenantManager.js.html | 18 +- docs/management_TicketsManager.js.html | 22 +- docs/management_UsersManager.js.html | 102 +- docs/management_index.js.html | 165 ++- docs/module-auth.AuthenticationClient.html | 40 +- docs/module-auth.DatabaseAuthenticator.html | 16 +- docs/module-auth.OAuthAuthenticator.html | 16 +- ...module-auth.PasswordlessAuthenticator.html | 14 +- docs/module-auth.TokensManager.html | 6 +- docs/module-auth.UsersManager.html | 10 +- docs/module-auth.html | 4 +- ...e-management.BlacklistedTokensManager.html | 8 +- ...module-management.ClientGrantsManager.html | 20 +- docs/module-management.ClientsManager.html | 165 ++- .../module-management.ConnectionsManager.html | 165 ++- ...e-management.DeviceCredentialsManager.html | 14 +- ...odule-management.EmailProviderManager.html | 16 +- ...dule-management.EmailTemplatesManager.html | 1313 +++++++++++++++++ docs/module-management.JobsManager.html | 43 +- docs/module-management.LogsManager.html | 8 +- docs/module-management.ManagementClient.html | 526 ++++++- ...le-management.ManagementTokenProvider.html | 4 +- ...ule-management.ResourceServersManager.html | 14 +- docs/module-management.RetryRestClient.html | 6 +- docs/module-management.RulesManager.html | 18 +- docs/module-management.StatsManager.html | 12 +- docs/module-management.TenantManager.html | 12 +- docs/module-management.TicketsManager.html | 8 +- docs/module-management.UsersManager.html | 57 +- docs/module-management.html | 7 +- docs/module-utils.html | 10 +- docs/utils.js.html | 52 +- package.json | 2 +- 57 files changed, 3181 insertions(+), 867 deletions(-) create mode 100644 docs/management_EmailTemplatesManager.js.html create mode 100644 docs/module-management.EmailTemplatesManager.html diff --git a/CHANGELOG.md b/CHANGELOG.md index 47df8b475..e0475ad89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,62 +1,90 @@ # Change Log +## [v2.10.0](https://github.com/auth0/node-auth0/tree/v2.10.0) (2018-05-29) + +[Full Changelog](https://github.com/auth0/node-auth0/compare/v2.9.3...v2.10.0) + +**Added** + +* Adding pagination docs for clients/connections [\#268](https://github.com/auth0/node-auth0/pull/268) ([luisrudge](https://github.com/luisrudge)) + +**Fixed** + +* Fix deleteUserMultifactor naming [\#259](https://github.com/auth0/node-auth0/pull/259) ([luisrudge](https://github.com/luisrudge)) + ## [v2.9.3](https://github.com/auth0/node-auth0/tree/v2.9.3) (2018-03-01) + [Full Changelog](https://github.com/auth0/node-auth0/compare/v2.9.2...v2.9.3) **Fixed** -- Add client secret to passwordGrant [\#217](https://github.com/auth0/node-auth0/pull/217) ([luisrudge](https://github.com/luisrudge)) +* Add client secret to passwordGrant [\#217](https://github.com/auth0/node-auth0/pull/217) ([luisrudge](https://github.com/luisrudge)) ## [v2.9.2](https://github.com/auth0/node-auth0/tree/v2.9.2) (2018-01-16) + [Full Changelog](https://github.com/auth0/node-auth0/compare/v2.9.1...v2.9.2) **Security** -- Update rest facade [\#232](https://github.com/auth0/node-auth0/pull/232) ([luisrudge](https://github.com/luisrudge)) + +* Update rest facade [\#232](https://github.com/auth0/node-auth0/pull/232) ([luisrudge](https://github.com/luisrudge)) ## [v2.9.1](https://github.com/auth0/node-auth0/tree/v2.9.1) (2017-12-08) + [Full Changelog](https://github.com/auth0/node-auth0/compare/v2.9.0...v2.9.1) **Fixed** -- fixed missing data object error [\#224](https://github.com/auth0/node-auth0/pull/224) ([dctoon](https://github.com/dctoon)) + +* fixed missing data object error [\#224](https://github.com/auth0/node-auth0/pull/224) ([dctoon](https://github.com/dctoon)) ## [v2.9.0](https://github.com/auth0/node-auth0/tree/v2.9.0) (2017-12-07) + [Full Changelog](https://github.com/auth0/node-auth0/compare/v2.8.0...v2.9.0) **Added** -- Added support for /users-by-email method. [\#218](https://github.com/auth0/node-auth0/pull/218) ([kopertop](https://github.com/kopertop)) -- Add retry functionality for management api requests [\#215](https://github.com/auth0/node-auth0/pull/215) ([dctoon](https://github.com/dctoon)) + +* Added support for /users-by-email method. [\#218](https://github.com/auth0/node-auth0/pull/218) ([kopertop](https://github.com/kopertop)) +* Add retry functionality for management api requests [\#215](https://github.com/auth0/node-auth0/pull/215) ([dctoon](https://github.com/dctoon)) ## [v2.8.0](https://github.com/auth0/node-auth0/tree/v2.8.0) (2017-09-30) + [Full Changelog](https://github.com/auth0/node-auth0/compare/v2.7.1...v2.8.0) **Added** -- Added tokenProvider functionality [\#196](https://github.com/auth0/node-auth0/pull/196) ([dctoon](https://github.com/dctoon)) + +* Added tokenProvider functionality [\#196](https://github.com/auth0/node-auth0/pull/196) ([dctoon](https://github.com/dctoon)) **Fixed** -- Fix wrapPropertyMethod mistake for updateClientGrant [\#202](https://github.com/auth0/node-auth0/pull/202) ([danedmunds](https://github.com/danedmunds)) + +* Fix wrapPropertyMethod mistake for updateClientGrant [\#202](https://github.com/auth0/node-auth0/pull/202) ([danedmunds](https://github.com/danedmunds)) ## [v2.7.1](https://github.com/auth0/node-auth0/tree/v2.7.1) (2017-09-30) + [Full Changelog](https://github.com/auth0/node-auth0/compare/v2.7.0...v2.7.1) **Fixed** -- Fix auth/users.getInfo to return JSON (fixes #158) [\#192](https://github.com/auth0/node-auth0/pull/192) ([pilwon](https://github.com/pilwon)) + +* Fix auth/users.getInfo to return JSON (fixes #158) [\#192](https://github.com/auth0/node-auth0/pull/192) ([pilwon](https://github.com/pilwon)) **Security** -- Update request to address ReDoS vulnerability [\#206](https://github.com/auth0/node-auth0/pull/206) ([dancrumb](https://github.com/dancrumb)) + +* Update request to address ReDoS vulnerability [\#206](https://github.com/auth0/node-auth0/pull/206) ([dancrumb](https://github.com/dancrumb)) ## [v2.7.0](https://github.com/auth0/node-auth0/tree/v2.7.0) (2017-06-28) + [Full Changelog](https://github.com/auth0/node-auth0/compare/v2.6.0...v2.7.0) **Added** -- Add password grant method [\#189](https://github.com/auth0/node-auth0/pull/189) ([hzalaz](https://github.com/hzalaz)) -- Retrieve a user's Guardian enrollments [\#181](https://github.com/auth0/node-auth0/pull/181) ([joshuaali](https://github.com/joshuaali)) -- Add get user logs [\#176](https://github.com/auth0/node-auth0/pull/176) ([amiram](https://github.com/amiram)) + +* Add password grant method [\#189](https://github.com/auth0/node-auth0/pull/189) ([hzalaz](https://github.com/hzalaz)) +* Retrieve a user's Guardian enrollments [\#181](https://github.com/auth0/node-auth0/pull/181) ([joshuaali](https://github.com/joshuaali)) +* Add get user logs [\#176](https://github.com/auth0/node-auth0/pull/176) ([amiram](https://github.com/amiram)) **Changed** -- Update packages and utilize error classes from rest-facade correctly (Fixes #154) [\#183](https://github.com/auth0/node-auth0/pull/183) ([charsleysa](https://github.com/charsleysa)) + +* Update packages and utilize error classes from rest-facade correctly (Fixes #154) [\#183](https://github.com/auth0/node-auth0/pull/183) ([charsleysa](https://github.com/charsleysa)) **Fixed** -- Fix impersonation to send AT in the params. [\#190](https://github.com/auth0/node-auth0/pull/190) ([hzalaz](https://github.com/hzalaz)) -- Fixed minor typo in DatabaseAuthenticator module [\#184](https://github.com/auth0/node-auth0/pull/184) ([scostello-paanalytics](https://github.com/scostello-paanalytics)) -- fix: avoid possible prototype override protection bypass [\#170](https://github.com/auth0/node-auth0/pull/170) ([AlmaasAre](https://github.com/AlmaasAre)) +* Fix impersonation to send AT in the params. [\#190](https://github.com/auth0/node-auth0/pull/190) ([hzalaz](https://github.com/hzalaz)) +* Fixed minor typo in DatabaseAuthenticator module [\#184](https://github.com/auth0/node-auth0/pull/184) ([scostello-paanalytics](https://github.com/scostello-paanalytics)) +* fix: avoid possible prototype override protection bypass [\#170](https://github.com/auth0/node-auth0/pull/170) ([AlmaasAre](https://github.com/AlmaasAre)) diff --git a/docs/RetryRestClient.js.html b/docs/RetryRestClient.js.html index 919dabb37..9829970f3 100644 --- a/docs/RetryRestClient.js.html +++ b/docs/RetryRestClient.js.html @@ -24,7 +24,7 @@
@@ -39,8 +39,7 @@

RetryRestClient.js

-

-var Promise = require('bluebird');
+            
var Promise = require('bluebird');
 var retry = require('retry');
 var ArgumentError = require('rest-facade').ArgumentError;
 var assign = Object.assign || require('object.assign');
@@ -54,10 +53,10 @@ 

RetryRestClient.js

* @memberOf module:management * @param {Object} restClient RestClient. * @param {Object} [options] Options for the RetryRestClient. - * @param {Object} [options.enabled:true] Enabled or Disable Retry Policy functionality. - * @param {Number} [options.maxRetries=10] The maximum amount of times to retry the operation. Default is 10. + * @param {Object} [options.enabled:true] Enabled or Disable Retry Policy functionality. + * @param {Number} [options.maxRetries=10] The maximum amount of times to retry the operation. Default is 10. */ -var RetryRestClient = function(restClient, options){ +var RetryRestClient = function(restClient, options) { if (restClient === null || typeof restClient !== 'object') { throw new ArgumentError('Must provide RestClient'); } @@ -75,54 +74,52 @@

RetryRestClient.js

this.restClient = restClient; this.maxRetries = params.maxRetries; this.enabled = params.enabled; -} +}; -RetryRestClient.prototype.getAll = function ( /* [params], [callback] */ ) { - return this.invoke('getAll', arguments); +RetryRestClient.prototype.getAll = function(/* [params], [callback] */) { + return this.invoke('getAll', arguments); }; -RetryRestClient.prototype.get = function ( /* [params], [callback] */ ) { - return this.invoke('get', arguments); -} +RetryRestClient.prototype.get = function(/* [params], [callback] */) { + return this.invoke('get', arguments); +}; -RetryRestClient.prototype.create = function ( /* [params], [callback] */ ) { - return this.invoke('create', arguments); -} +RetryRestClient.prototype.create = function(/* [params], [callback] */) { + return this.invoke('create', arguments); +}; -RetryRestClient.prototype.patch = function ( /* [params], [callback] */ ) { - return this.invoke('patch', arguments); -} +RetryRestClient.prototype.patch = function(/* [params], [callback] */) { + return this.invoke('patch', arguments); +}; -RetryRestClient.prototype.update = function ( /* [params], [callback] */ ) { - return this.invoke('update', arguments); -} +RetryRestClient.prototype.update = function(/* [params], [callback] */) { + return this.invoke('update', arguments); +}; -RetryRestClient.prototype.delete = function ( /* [params], [callback] */ ) { - return this.invoke('delete', arguments); -} +RetryRestClient.prototype.delete = function(/* [params], [callback] */) { + return this.invoke('delete', arguments); +}; -RetryRestClient.prototype.invoke = function(method, args){ +RetryRestClient.prototype.invoke = function(method, args) { var cb; args = Array.prototype.slice.call(args); // convert array-like object to array. - if(args && args[args.length -1] instanceof Function){ - cb = args[args.length -1]; + if (args && args[args.length - 1] instanceof Function) { + cb = args[args.length - 1]; args.pop(); // Remove the callback } var promise = this.handleRetry(method, args); if (cb instanceof Function) { - promise - .then(cb.bind(null, null)) - .catch(cb); + promise.then(cb.bind(null, null)).catch(cb); return; } return promise; -} +}; -RetryRestClient.prototype.handleRetry = function(method, args){ - if(!this.enabled){ +RetryRestClient.prototype.handleRetry = function(method, args) { + if (!this.enabled) { return this.restClient[method].apply(this.restClient, args); } @@ -134,12 +131,13 @@

RetryRestClient.js

}; var self = this; - var promise = new Promise(function (resolve, reject) { + var promise = new Promise(function(resolve, reject) { var operation = retry.operation(retryOptions); - operation.attempt(function(){ - self.restClient[method].apply(self.restClient, args) - .then(function(body) { + operation.attempt(function() { + self.restClient[method] + .apply(self.restClient, args) + .then(function(body) { resolve(body); }) .catch(function(err) { @@ -151,52 +149,50 @@

RetryRestClient.js

return promise; }; -RetryRestClient.prototype.invokeRetry = function(err, operation , reject){ +RetryRestClient.prototype.invokeRetry = function(err, operation, reject) { var ratelimits = this.extractRatelimits(err); - if(ratelimits){ + if (ratelimits) { var delay = ratelimits.reset * 1000 - new Date().getTime(); - if(delay > 0){ + if (delay > 0) { this.retryWithDelay(delay, operation, err, reject); - }else{ + } else { this.retryWithImmediate(operation, err, reject); - } - }else{ + } + } else { reject(err); - } -} + } +}; -RetryRestClient.prototype.extractRatelimits = function(err){ - if(err && err.statusCode === 429 && err.originalError && err.originalError.response){ +RetryRestClient.prototype.extractRatelimits = function(err) { + if (err && err.statusCode === 429 && err.originalError && err.originalError.response) { var headers = err.originalError.response.header; - if(headers && headers['x-ratelimit-limit']){ + if (headers && headers['x-ratelimit-limit']) { return { limit: headers['x-ratelimit-limit'], remaining: headers['x-ratelimit-remaining'], reset: headers['x-ratelimit-reset'] - } + }; } } return; -} +}; -RetryRestClient.prototype.retryWithImmediate = function(operation, err, reject){ - if(operation.retry(err)){ +RetryRestClient.prototype.retryWithImmediate = function(operation, err, reject) { + if (operation.retry(err)) { return; - } + } reject(err); -} +}; -RetryRestClient.prototype.retryWithDelay = function(delay, operation, err, reject){ +RetryRestClient.prototype.retryWithDelay = function(delay, operation, err, reject) { setTimeout(() => { - if(operation.retry(err)){ + if (operation.retry(err)) { return; } reject(err); }, delay); -} - - +}; module.exports = RetryRestClient;
@@ -211,7 +207,7 @@

RetryRestClient.js


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/auth_DatabaseAuthenticator.js.html b/docs/auth_DatabaseAuthenticator.js.html index fd52f0bb0..9e1136039 100644 --- a/docs/auth_DatabaseAuthenticator.js.html +++ b/docs/auth_DatabaseAuthenticator.js.html @@ -24,7 +24,7 @@
@@ -44,7 +44,6 @@

auth/DatabaseAuthenticator.js

var ArgumentError = require('rest-facade').ArgumentError; var RestClient = require('rest-facade').Client; - /** * @class * Abstracts the sign-in, sign-up and change-password processes for Database & @@ -57,7 +56,7 @@

auth/DatabaseAuthenticator.js

* @param {String} [options.clientId] Default client ID. * @param {OAuthAuthenticator} oauth OAuthAuthenticator instance. */ -var DatabaseAuthenticator = function (options, oauth) { +var DatabaseAuthenticator = function(options, oauth) { if (!options) { throw new ArgumentError('Missing authenticator options'); } @@ -80,7 +79,6 @@

auth/DatabaseAuthenticator.js

this.clientId = options.clientId; }; - /** * Sign in using a database or active directory service. * @method signIn @@ -116,7 +114,7 @@

auth/DatabaseAuthenticator.js

* * @return {Promise|undefined} */ -DatabaseAuthenticator.prototype.signIn = function (userData, cb) { +DatabaseAuthenticator.prototype.signIn = function(userData, cb) { var defaultFields = { connection: 'Username-Password-Authentication' }; @@ -126,20 +124,17 @@

auth/DatabaseAuthenticator.js

throw new ArgumentError('Missing user data object'); } - if (typeof data.username !== 'string' - || data.username.trim().length === 0) { + if (typeof data.username !== 'string' || data.username.trim().length === 0) { throw new ArgumentError('username field is required'); } - if (typeof data.password !== 'string' - || data.password.trim().length === 0) { + if (typeof data.password !== 'string' || data.password.trim().length === 0) { throw new ArgumentError('password field is required'); } return this.oauth.signIn(data, cb); }; - /** * Sign up using a database or active directory service. * @method signUp @@ -174,7 +169,7 @@

auth/DatabaseAuthenticator.js

* * @return {Promise|undefined} */ -DatabaseAuthenticator.prototype.signUp = function (userData, cb) { +DatabaseAuthenticator.prototype.signUp = function(userData, cb) { var params = { type: 'signup' }; @@ -187,18 +182,15 @@

auth/DatabaseAuthenticator.js

throw new ArgumentError('Missing user data object'); } - if (typeof data.email !== 'string' - || data.email.trim().length === 0) { + if (typeof data.email !== 'string' || data.email.trim().length === 0) { throw new ArgumentError('email field is required'); } - if (typeof data.password !== 'string' - || data.password.trim().length === 0) { + if (typeof data.password !== 'string' || data.password.trim().length === 0) { throw new ArgumentError('password field is required'); } - if (typeof data.connection !== 'string' - || data.connection.trim().length === 0) { + if (typeof data.connection !== 'string' || data.connection.trim().length === 0) { throw new ArgumentError('connection field is required'); } @@ -209,7 +201,6 @@

auth/DatabaseAuthenticator.js

return this.dbConnections.create(params, data); }; - /** * Change password using a database or active directory service. * @@ -247,7 +238,7 @@

auth/DatabaseAuthenticator.js

* * @return {Promise|undefined} */ -DatabaseAuthenticator.prototype.changePassword = function (userData, cb) { +DatabaseAuthenticator.prototype.changePassword = function(userData, cb) { var params = { type: 'change_password' }; @@ -260,18 +251,15 @@

auth/DatabaseAuthenticator.js

throw new ArgumentError('Missing user data object'); } - if (typeof data.email !== 'string' - || data.email.trim().length === 0) { + if (typeof data.email !== 'string' || data.email.trim().length === 0) { throw new ArgumentError('email field is required'); } - if (typeof data.password !== 'string' - || data.password.trim().length === 0) { + if (typeof data.password !== 'string' || data.password.trim().length === 0) { throw new ArgumentError('password field is required'); } - if (typeof data.connection !== 'string' - || data.connection.trim().length === 0) { + if (typeof data.connection !== 'string' || data.connection.trim().length === 0) { throw new ArgumentError('connection field is required'); } @@ -282,7 +270,6 @@

auth/DatabaseAuthenticator.js

return this.dbConnections.create(params, data); }; - /** * Request a change password email using a database or active directory service. * @@ -317,7 +304,7 @@

auth/DatabaseAuthenticator.js

* * @return {Promise|undefined} */ -DatabaseAuthenticator.prototype.requestChangePasswordEmail = function (userData, cb) { +DatabaseAuthenticator.prototype.requestChangePasswordEmail = function(userData, cb) { var params = { type: 'change_password' }; @@ -330,13 +317,11 @@

auth/DatabaseAuthenticator.js

throw new ArgumentError('Missing user data object'); } - if (typeof data.email !== 'string' - || data.email.trim().length === 0) { + if (typeof data.email !== 'string' || data.email.trim().length === 0) { throw new ArgumentError('email field is required'); } - if (typeof data.connection !== 'string' - || data.connection.trim().length === 0) { + if (typeof data.connection !== 'string' || data.connection.trim().length === 0) { throw new ArgumentError('connection field is required'); } @@ -347,7 +332,6 @@

auth/DatabaseAuthenticator.js

return this.dbConnections.create(params, data); }; - module.exports = DatabaseAuthenticator;
@@ -361,7 +345,7 @@

auth/DatabaseAuthenticator.js


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/auth_OAuthAuthenticator.js.html b/docs/auth_OAuthAuthenticator.js.html index 2b67fe084..316ac2315 100644 --- a/docs/auth_OAuthAuthenticator.js.html +++ b/docs/auth_OAuthAuthenticator.js.html @@ -24,7 +24,7 @@
@@ -44,7 +44,6 @@

auth/OAuthAuthenticator.js

var ArgumentError = require('rest-facade').ArgumentError; var RestClient = require('rest-facade').Client; - /** * @class * Abstracts the sign-in, sign-up and change-password processes for Database & @@ -57,7 +56,7 @@

auth/OAuthAuthenticator.js

* @param {String} [options.clientId] Default client ID. * @param {String} [options.clientSecret] Default client Secret. */ -var OAuthAuthenticator = function (options) { +var OAuthAuthenticator = function(options) { if (!options) { throw new ArgumentError('Missing authenticator options'); } @@ -80,7 +79,6 @@

auth/OAuthAuthenticator.js

this.clientSecret = options.clientSecret; }; - /** * Sign in using a username and password. * @@ -119,7 +117,7 @@

auth/OAuthAuthenticator.js

* * @return {Promise|undefined} */ -OAuthAuthenticator.prototype.signIn = function (userData, cb) { +OAuthAuthenticator.prototype.signIn = function(userData, cb) { var params = { type: 'ro' }; @@ -134,9 +132,7 @@

auth/OAuthAuthenticator.js

throw new ArgumentError('Missing user data object'); } - if (typeof data.connection !== 'string' - || data.connection.split().length === 0) - { + if (typeof data.connection !== 'string' || data.connection.split().length === 0) { throw new ArgumentError('connection field is required'); } @@ -171,7 +167,7 @@

auth/OAuthAuthenticator.js

* scope: 'openid' // Optional field. * }; * - * auth0.oauth.token(data, function (err, userData) { + * auth0.oauth.passwordGrant(data, function (err, userData) { * if (err) { * // Handle error. * } @@ -186,7 +182,7 @@

auth/OAuthAuthenticator.js

* * @return {Promise|undefined} */ -OAuthAuthenticator.prototype.passwordGrant = function (userData, cb) { +OAuthAuthenticator.prototype.passwordGrant = function(userData, cb) { var params = { type: 'token' }; @@ -201,18 +197,15 @@

auth/OAuthAuthenticator.js

throw new ArgumentError('Missing user data object'); } - if (typeof data.username !== 'string' - || data.username.split().length === 0) { + if (typeof data.username !== 'string' || data.username.split().length === 0) { throw new ArgumentError('username field is required'); } - if (typeof data.password !== 'string' - || data.password.split().length === 0) { + if (typeof data.password !== 'string' || data.password.split().length === 0) { throw new ArgumentError('password field is required'); } - if (typeof data.realm === 'string' - && data.realm.split().length !== 0) { + if (typeof data.realm === 'string' && data.realm.split().length !== 0) { data.grant_type = 'http://auth0.com/oauth/grant-type/password-realm'; } @@ -235,7 +228,7 @@

auth/OAuthAuthenticator.js

* * @return {Promise|undefined} */ -OAuthAuthenticator.prototype.socialSignIn = function (data, cb) { +OAuthAuthenticator.prototype.socialSignIn = function(data, cb) { var params = { type: 'access_token' }; @@ -244,13 +237,11 @@

auth/OAuthAuthenticator.js

throw new ArgumentError('Missing user credential objects'); } - if (typeof data.access_token !== 'string' - || data.access_token.trim().length === 0) { + if (typeof data.access_token !== 'string' || data.access_token.trim().length === 0) { throw new ArgumentError('access_token field is required'); } - if (typeof data.connection !== 'string' - || data.connection.trim().length === 0) { + if (typeof data.connection !== 'string' || data.connection.trim().length === 0) { throw new ArgumentError('connection field is required'); } @@ -262,15 +253,14 @@

auth/OAuthAuthenticator.js

}; OAuthAuthenticator.prototype.clientCredentialsGrant = function(options, cb) { - var params = { type: 'token' }; var defaultFields = { - grant_type: "client_credentials", - client_id: this.clientId, - client_secret: this.clientSecret + grant_type: 'client_credentials', + client_id: this.clientId, + client_secret: this.clientSecret }; var data = extend(defaultFields, options); @@ -307,7 +297,7 @@

auth/OAuthAuthenticator.js


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/auth_PasswordlessAuthenticator.js.html b/docs/auth_PasswordlessAuthenticator.js.html index 1099db8ad..a4526c156 100644 --- a/docs/auth_PasswordlessAuthenticator.js.html +++ b/docs/auth_PasswordlessAuthenticator.js.html @@ -24,7 +24,7 @@
@@ -44,7 +44,6 @@

auth/PasswordlessAuthenticator.js

var ArgumentError = require('rest-facade').ArgumentError; var RestClient = require('rest-facade').Client; - /** * @class * Handles authenticator with passwordless flows, e.g. SMS, Touch ID, etc. @@ -56,7 +55,7 @@

auth/PasswordlessAuthenticator.js

* @param {String} [options.clientId] Default client ID. * @param {OAuthAuthenticator} oauth OAuthAuthenticator instance. */ -var PasswordlessAuthenticator = function (options, oauth) { +var PasswordlessAuthenticator = function(options, oauth) { if (!options) { throw new ArgumentError('Missing authenticator options'); } @@ -79,7 +78,6 @@

auth/PasswordlessAuthenticator.js

this.clientId = options.clientId; }; - /** * Sign in with the given user credentials. * @@ -121,34 +119,33 @@

auth/PasswordlessAuthenticator.js

* * @return {Promise|undefined} */ -PasswordlessAuthenticator.prototype.signIn = function (userData, cb) { +PasswordlessAuthenticator.prototype.signIn = function(userData, cb) { var defaultFields = { client_id: this.clientId }; var data = extend(defaultFields, userData); // Don't let the user override the connection nor the grant type. - if (!data.connection || (data.connection !== 'email' && data.connection !== 'sms')) { data.connection = 'sms'; } + if (!data.connection || (data.connection !== 'email' && data.connection !== 'sms')) { + data.connection = 'sms'; + } data.grant_type = 'password'; if (!userData || typeof userData !== 'object') { throw new ArgumentError('Missing user data object'); } - if (typeof data.username !== 'string' - || data.username.trim().length === 0) { + if (typeof data.username !== 'string' || data.username.trim().length === 0) { throw new ArgumentError('username field (phone number) is required'); } - if (typeof data.password !== 'string' - || data.password.trim().length === 0) { + if (typeof data.password !== 'string' || data.password.trim().length === 0) { throw new ArgumentError('password field (verification code) is required'); } return this.oauth.signIn(data, cb); }; - /** * Start passwordless flow sending an email. * @@ -194,7 +191,7 @@

auth/PasswordlessAuthenticator.js

* * @return {Promise|undefined} */ -PasswordlessAuthenticator.prototype.sendEmail = function (userData, cb) { +PasswordlessAuthenticator.prototype.sendEmail = function(userData, cb) { var defaultFields = { client_id: this.clientId }; @@ -207,13 +204,11 @@

auth/PasswordlessAuthenticator.js

throw new ArgumentError('Missing user data object'); } - if (typeof data.email !== 'string' - || data.email.trim().length === 0) { + if (typeof data.email !== 'string' || data.email.trim().length === 0) { throw new ArgumentError('email field is required'); } - if (typeof data.send !== 'string' - || data.send.trim().length === 0) { + if (typeof data.send !== 'string' || data.send.trim().length === 0) { throw new ArgumentError('send field is required'); } @@ -224,7 +219,6 @@

auth/PasswordlessAuthenticator.js

return this.passwordless.create(data); }; - /** * Start passwordless flow sending an SMS. * @@ -255,7 +249,7 @@

auth/PasswordlessAuthenticator.js

* * @return {Promise|undefined} */ -PasswordlessAuthenticator.prototype.sendSMS = function (userData, cb) { +PasswordlessAuthenticator.prototype.sendSMS = function(userData, cb) { var defaultFields = { client_id: this.clientId }; @@ -268,8 +262,7 @@

auth/PasswordlessAuthenticator.js

throw new ArgumentError('Missing user data object'); } - if (typeof data.phone_number !== 'string' - || data.phone_number.trim().length === 0) { + if (typeof data.phone_number !== 'string' || data.phone_number.trim().length === 0) { throw new ArgumentError('phone_number field is required'); } @@ -280,7 +273,6 @@

auth/PasswordlessAuthenticator.js

return this.passwordless.create(data); }; - module.exports = PasswordlessAuthenticator; @@ -294,7 +286,7 @@

auth/PasswordlessAuthenticator.js


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/auth_TokensManager.js.html b/docs/auth_TokensManager.js.html index 509b7ba2a..5421d7edd 100644 --- a/docs/auth_TokensManager.js.html +++ b/docs/auth_TokensManager.js.html @@ -24,7 +24,7 @@
@@ -44,7 +44,6 @@

auth/TokensManager.js

var ArgumentError = require('rest-facade').ArgumentError; - /** * @class * Provides methods for getting token data and exchanging tokens. @@ -56,7 +55,7 @@

auth/TokensManager.js

* @param {String} [options.headers] Default request headers. * @param {String} [options.clientId] Default client ID. */ -var TokensManager = function (options) { +var TokensManager = function(options) { if (typeof options !== 'object') { throw new ArgumentError('Missing tokens manager options'); } @@ -70,7 +69,6 @@

auth/TokensManager.js

this.clientId = options.clientId || ''; }; - /** * Given an ID token get the user profile linked to it. * @@ -97,7 +95,7 @@

auth/TokensManager.js

* * @return {Promise|undefined} */ -TokensManager.prototype.getInfo = function (idToken, cb) { +TokensManager.prototype.getInfo = function(idToken, cb) { var headers = extend({}, this.headers); if (idToken === null || idToken === undefined) { @@ -118,16 +116,13 @@

auth/TokensManager.js

// Use callback if given. if (cb instanceof Function) { - promise - .then(cb.bind(null, null)) - .catch(cb); + promise.then(cb.bind(null, null)).catch(cb); return; } return promise; }; - /** * Exchange the token of the logged in user with a token that is valid to call * the API (signed with the API secret). @@ -168,19 +163,18 @@

auth/TokensManager.js

* * @return {Promise|undefined} */ -TokensManager.prototype.getDelegationToken = function (data, cb) { - var body = extend({ client_id : this.clientId }, data); +TokensManager.prototype.getDelegationToken = function(data, cb) { + var body = extend({ client_id: this.clientId }, data); var headers = this.headers; if (!data) { throw new ArgumentError('Missing token data object'); } - var hasIdToken = typeof data.id_token === 'string' - && data.id_token.trim().length !== 0; + var hasIdToken = typeof data.id_token === 'string' && data.id_token.trim().length !== 0; - var hasRefreshToken = typeof data.refresh_token === 'string' - && data.refresh_token.trim().length !== 0; + var hasRefreshToken = + typeof data.refresh_token === 'string' && data.refresh_token.trim().length !== 0; if (!hasIdToken && !hasRefreshToken) { throw new ArgumentError('one of id_token or refresh_token is required'); @@ -190,18 +184,15 @@

auth/TokensManager.js

throw new ArgumentError('id_token and refresh_token fields cannot be specified simulatenously'); } - if (typeof data.target !== 'string' - || data.target.trim().length === 0) { + if (typeof data.target !== 'string' || data.target.trim().length === 0) { throw new ArgumentError('target field is required'); } - if (typeof data.api_type !== 'string' - || data.api_type.trim().length === 0) { + if (typeof data.api_type !== 'string' || data.api_type.trim().length === 0) { throw new ArgumentError('api_type field is required'); } - if (typeof data.grant_type !== 'string' - || data.grant_type.trim().length === 0) { + if (typeof data.grant_type !== 'string' || data.grant_type.trim().length === 0) { throw new ArgumentError('grant_type field is required'); } @@ -215,16 +206,13 @@

auth/TokensManager.js

// Use callback if given. if (cb instanceof Function) { - promise - .then(cb.bind(null, null)) - .catch(cb); + promise.then(cb.bind(null, null)).catch(cb); return; } return promise; }; - module.exports = TokensManager; @@ -238,7 +226,7 @@

auth/TokensManager.js


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/auth_UsersManager.js.html b/docs/auth_UsersManager.js.html index 94bb7a9ff..88a28fb98 100644 --- a/docs/auth_UsersManager.js.html +++ b/docs/auth_UsersManager.js.html @@ -24,7 +24,7 @@
@@ -44,7 +44,6 @@

auth/UsersManager.js

var ArgumentError = require('rest-facade').ArgumentError; - /** * @class * Provides methods for getting user information and impersonating users. @@ -56,7 +55,7 @@

auth/UsersManager.js

* @param {String} [options.headers] Default request headers. * @param {String} [options.clientId] Default client ID. */ -var UsersManager = function (options) { +var UsersManager = function(options) { if (typeof options !== 'object') { throw new ArgumentError('Missing users manager options'); } @@ -70,7 +69,6 @@

auth/UsersManager.js

this.clientId = options.clientId; }; - /** * Given an access token get the user profile linked to it. * @@ -96,7 +94,7 @@

auth/UsersManager.js

* * @return {Promise|undefined} */ -UsersManager.prototype.getInfo = function (accessToken, cb) { +UsersManager.prototype.getInfo = function(accessToken, cb) { var url = this.baseUrl + '/userinfo'; var headers = extend({}, this.headers); @@ -121,16 +119,13 @@

auth/UsersManager.js

// Use callback if given. if (cb instanceof Function) { - promise - .then(cb.bind(null, null)) - .catch(cb); + promise.then(cb.bind(null, null)).catch(cb); return; } return promise; }; - /** * Impersonate the user with the given user ID. * @@ -167,7 +162,7 @@

auth/UsersManager.js

* * @return {Promise|undefined} */ -UsersManager.prototype.impersonate = function (userId, settings, cb) { +UsersManager.prototype.impersonate = function(userId, settings, cb) { var url = this.baseUrl + '/users/' + userId + '/impersonate'; if (userId === null || userId === undefined) { @@ -182,23 +177,23 @@

auth/UsersManager.js

throw new ArgumentError('Missing impersonation settings object'); } - if (typeof settings.impersonator_id !== 'string' - || settings.impersonator_id.trim().length === 0) { + if ( + typeof settings.impersonator_id !== 'string' || + settings.impersonator_id.trim().length === 0 + ) { throw new ArgumentError('impersonator_id field is required'); } - if (typeof settings.protocol !== 'string' - || settings.protocol.trim().length === 0) { + if (typeof settings.protocol !== 'string' || settings.protocol.trim().length === 0) { throw new ArgumentError('protocol field is required'); } - if (typeof settings.token !== 'string' - || settings.token.trim().length === 0) { + if (typeof settings.token !== 'string' || settings.token.trim().length === 0) { throw new ArgumentError('token field is required'); } var data = extend({ client_id: settings.clientId || this.clientId }, settings); - var headers = extend({'Authorization': `Bearer ${settings.token}`}, this.headers); + var headers = extend({ Authorization: `Bearer ${settings.token}` }, this.headers); // Perform the request. var promise = getRequestPromise({ method: 'POST', @@ -209,16 +204,13 @@

auth/UsersManager.js

// Use callback if given. if (cb instanceof Function) { - promise - .then(cb.bind(null, null)) - .catch(cb); + promise.then(cb.bind(null, null)).catch(cb); return; } return promise; }; - module.exports = UsersManager; @@ -232,7 +224,7 @@

auth/UsersManager.js


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/auth_index.js.html b/docs/auth_index.js.html index 72a320ddc..0d6e0bbf1 100644 --- a/docs/auth_index.js.html +++ b/docs/auth_index.js.html @@ -24,7 +24,7 @@
@@ -59,7 +59,6 @@

auth/index.js

var BASE_URL_FORMAT = 'https://%s'; - /** * @class * Authentication API SDK. @@ -75,7 +74,7 @@

auth/index.js

* accept a client ID. * </caption> * - * var AuthenticationClient = require('auth0'). AuthenticationClient; + * var AuthenticationClient = require('auth0').AuthenticationClient; * var auth0 = new AuthenticationClient({ * domain: '{YOUR_ACCOUNT}.auth0.com', * clientId: '{OPTIONAL_CLIENT_ID}' @@ -87,11 +86,9 @@

auth/index.js

* @param {String} [options.clientId] Default client ID. * @param {String} [options.clientSecret] Default client Secret. */ -var AuthenticationClient = function (options) { +var AuthenticationClient = function(options) { if (!options || typeof options !== 'object') { - throw new ArgumentError( - 'Authentication Client SDK options must be an object' - ); + throw new ArgumentError('Authentication Client SDK options must be an object'); } if (!options.domain || options.domain.length === 0) { @@ -150,7 +147,6 @@

auth/index.js

this.tokens = new TokensManager(managerOptions); }; - /** * Return an object with information about the current client, * @@ -159,31 +155,30 @@

auth/index.js

* * @return {Object} Object containing client information. */ -AuthenticationClient.prototype.getClientInfo = function () { +AuthenticationClient.prototype.getClientInfo = function() { var clientInfo = { name: 'node-auth0', version: pkg.version, dependencies: [], - environment: [{ - name: 'node.js', - version: process.version.replace('v', '') - }] + environment: [ + { + name: 'node.js', + version: process.version.replace('v', '') + } + ] }; // Add the dependencies to the client info object. - Object - .keys(pkg.dependencies) - .forEach(function (name) { - clientInfo.dependencies.push({ - name: name, - version: pkg.dependencies[name] - }); + Object.keys(pkg.dependencies).forEach(function(name) { + clientInfo.dependencies.push({ + name: name, + version: pkg.dependencies[name] }); + }); return clientInfo; }; - /** * Start passwordless flow sending an email. * @@ -218,13 +213,12 @@

auth/index.js

* * @return {Promise|undefined} */ -AuthenticationClient.prototype.requestMagicLink = function (data, cb) { +AuthenticationClient.prototype.requestMagicLink = function(data, cb) { data.send = 'link'; return this.passwordless.sendEmail(data, cb); }; - /** * Start passwordless flow sending an email. * @@ -257,13 +251,12 @@

auth/index.js

* * @return {Promise|undefined} */ -AuthenticationClient.prototype.requestEmailCode = function (data, cb) { +AuthenticationClient.prototype.requestEmailCode = function(data, cb) { data.send = 'code'; return this.passwordless.sendEmail(data, cb); }; - /** * Start passwordless flow sending an SMS. * @@ -293,7 +286,7 @@

auth/index.js

* * @return {Promise|undefined} */ -AuthenticationClient.prototype.requestSMSCode = function (data, cb) { +AuthenticationClient.prototype.requestSMSCode = function(data, cb) { var translatedData = { phone_number: data.phoneNumber || data.phone_number }; @@ -301,7 +294,6 @@

auth/index.js

return this.passwordless.sendSMS(translatedData, cb); }; - /** * Sign in with the given user credentials. * @@ -343,7 +335,7 @@

auth/index.js

* * @return {Promise|undefined} */ -AuthenticationClient.prototype.verifySMSCode = function (data, cb) { +AuthenticationClient.prototype.verifySMSCode = function(data, cb) { var translatedData = { username: data.phoneNumber || data.phone_number || data.username, password: data.code || data.password @@ -352,7 +344,6 @@

auth/index.js

return this.passwordless.signIn(translatedData, cb); }; - /** * Exchange the token of the logged in user with a token that is valid to call * the API (signed with the API secret). @@ -391,7 +382,7 @@

auth/index.js

* * @return {Promise|undefined} */ -AuthenticationClient.prototype.getDelegationToken = function (data, cb) { +AuthenticationClient.prototype.getDelegationToken = function(data, cb) { var translatedData = { id_token: data.id_token, api_type: data.api || data.api_type, @@ -403,7 +394,6 @@

auth/index.js

return this.tokens.getDelegationToken(translatedData, cb); }; - /** * Change password using a database or active directory service. * @@ -440,7 +430,7 @@

auth/index.js

* * @return {Promise|undefined} */ -AuthenticationClient.prototype.changePassword = function (data, cb) { +AuthenticationClient.prototype.changePassword = function(data, cb) { var translatedData = { connection: data.connection, email: data.email || data.username, @@ -450,7 +440,6 @@

auth/index.js

return this.database.changePassword(data, cb); }; - /** * Request a change password email using a database or active directory service. * @@ -484,7 +473,7 @@

auth/index.js

* * @return {Promise|undefined} */ -AuthenticationClient.prototype.requestChangePasswordEmail = function (data, cb) { +AuthenticationClient.prototype.requestChangePasswordEmail = function(data, cb) { var translatedData = { connection: data.connection, email: data.email || data.username @@ -493,7 +482,6 @@

auth/index.js

return this.database.requestChangePasswordEmail(data, cb); }; - /** * Given an access token get the user profile linked to it. * @@ -548,7 +536,11 @@

auth/index.js

* * @return {Promise|undefined} */ -utils.wrapPropertyMethod(AuthenticationClient, 'clientCredentialsGrant', 'oauth.clientCredentialsGrant'); +utils.wrapPropertyMethod( + AuthenticationClient, + 'clientCredentialsGrant', + 'oauth.clientCredentialsGrant' +); /** * Sign in using a username and password @@ -604,7 +596,7 @@

auth/index.js


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/external-RestClient.html b/docs/external-RestClient.html index f394eff4b..12e004fcc 100644 --- a/docs/external-RestClient.html +++ b/docs/external-RestClient.html @@ -24,7 +24,7 @@
@@ -187,7 +187,7 @@

Source:
@@ -287,7 +287,107 @@

Source:
+ + + + + +
See:
+
+ +
+ + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ +
+ +

+ RestClient +

+ + +
+ +
+
+ + +

Simple facade for consuming a REST API endpoint.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
@@ -487,7 +587,7 @@

Source:
@@ -587,7 +687,7 @@

Source:
@@ -687,7 +787,7 @@

Source:
@@ -839,7 +939,7 @@


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/index.html b/docs/index.html index 1f51f0b3d..88c45eb35 100644 --- a/docs/index.html +++ b/docs/index.html @@ -24,7 +24,7 @@
@@ -54,7 +54,9 @@ License Downloads

Node.js client library for the Auth0 platform.

-

Installation

  npm install auth0

Authentication API Client

This client must be used to access Auth0's Authentication API.

+

Installation

  npm install auth0

Documentation

You can find this library documentation in this page.

+

For more information about auth0 check our documentation page.

+

Authentication API Client

This client must be used to access Auth0's Authentication API.

The AuthenticationClient constructor takes an optional client ID, if specified it will be used as default value for all endpoints that accept a client ID.

var AuthenticationClient = require('auth0').AuthenticationClient;
 
@@ -78,7 +80,7 @@ 

Installation

  npm insta
   domain: '{YOUR_ACCOUNT}.auth0.com',
   clientId: '{YOUR_NON_INTERACTIVE_CLIENT_ID}',
   clientSecret: '{YOUR_NON_INTERACTIVE_CLIENT_SECRET}',
-  scope: "read:users write:users",
+  scope: 'read:users update:users'
 });

Make sure your ClientId is allowed to request tokens from Management API in Auth0 Dashboard

@@ -91,18 +93,21 @@

Installation

  npm insta
   clientSecret: '{CLIENT_SECRET}'
 });
 
-auth0.clientCredentialsGrant({
-  audience: 'https://{YOUR_ACCOUNT}.auth0.com/api/v2/',
-  scope: '{MANAGEMENT_API_SCOPES}'
-}, function (err, response) {
-  if (err) {
-    // Handle error.
+auth0.clientCredentialsGrant(
+  {
+    audience: 'https://{YOUR_ACCOUNT}.auth0.com/api/v2/',
+    scope: '{MANAGEMENT_API_SCOPES}'
+  },
+  function(err, response) {
+    if (err) {
+      // Handle error.
+    }
+    console.log(response.access_token);
   }
-  console.log(response.access_token);
-});

Also you can request a token when the user authenticates using any of our client side SDKs, e.g. auth0.js.

+);

Also you can request a token when the user authenticates using any of our client side SDKs, e.g. auth0.js.

Promises and callbacks

Be aware that all methods can be used with promises or callbacks. However, when a callback is provided no promise will be returned.

// Using callbacks.
-management.getUsers(function (err, users) {
+management.getUsers(function(err, users) {
   if (err) {
     // handle error.
   }
@@ -112,14 +117,12 @@ 

Promises and callbacks

Be aware that all methods can be used with pro // Using promises. management .getUsers() - .then(function (users) { + .then(function(users) { console.log(users); }) - .catch(function (err) { + .catch(function(err) { // Handle error. - });

Documentation

You can find this library documentation in this page.

-

For more information about auth0 check our documentation page.

-

What is Auth0?

Auth0 helps you to:

+ });

What is Auth0?

Auth0 helps you to:

@@ -152,7 +153,7 @@

management/BlacklistedTokensManager.js


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/management_ClientGrantsManager.js.html b/docs/management_ClientGrantsManager.js.html index 48c1e2bf5..cad917818 100644 --- a/docs/management_ClientGrantsManager.js.html +++ b/docs/management_ClientGrantsManager.js.html @@ -24,7 +24,7 @@
@@ -57,7 +57,7 @@

management/ClientGrantsManager.js

* @param {Object} [options.headers] Headers to be included in all requests. * @param {Object} [options.retry] Retry Policy Config */ -var ClientGrantsManager = function (options) { +var ClientGrantsManager = function(options) { if (options === null || typeof options !== 'object') { throw new ArgumentError('Must provide client options'); } @@ -87,11 +87,14 @@

management/ClientGrantsManager.js

* * @type {external:RestClient} */ - var auth0RestClient = new Auth0RestClient(options.baseUrl + '/client-grants/:id', clientOptions, options.tokenProvider); + var auth0RestClient = new Auth0RestClient( + options.baseUrl + '/client-grants/:id', + clientOptions, + options.tokenProvider + ); this.resource = new RetryRestClient(auth0RestClient, options.retry); }; - /** * Create an Auth0 client grant. * @@ -114,7 +117,6 @@

management/ClientGrantsManager.js

*/ utils.wrapPropertyMethod(ClientGrantsManager, 'create', 'resource.create'); - /** * Get all Auth0 Client Grants. * @@ -132,7 +134,6 @@

management/ClientGrantsManager.js

*/ utils.wrapPropertyMethod(ClientGrantsManager, 'getAll', 'resource.getAll'); - /** * Update an Auth0 client grant. * @@ -164,7 +165,6 @@

management/ClientGrantsManager.js

*/ utils.wrapPropertyMethod(ClientGrantsManager, 'update', 'resource.patch'); - /** * Delete an Auth0 client grant. * @@ -188,7 +188,6 @@

management/ClientGrantsManager.js

*/ utils.wrapPropertyMethod(ClientGrantsManager, 'delete', 'resource.delete'); - module.exports = ClientGrantsManager; @@ -202,7 +201,7 @@

management/ClientGrantsManager.js


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/management_ClientsManager.js.html b/docs/management_ClientsManager.js.html index c509e658a..816ff5512 100644 --- a/docs/management_ClientsManager.js.html +++ b/docs/management_ClientsManager.js.html @@ -24,7 +24,7 @@
@@ -61,7 +61,7 @@

management/ClientsManager.js

* @param {Object} [options.headers] Headers to be included in all requests. * @param {Object} [options.retry] Retry Policy Config */ -var ClientsManager = function (options) { +var ClientsManager = function(options) { if (options === null || typeof options !== 'object') { throw new ArgumentError('Must provide client options'); } @@ -91,11 +91,14 @@

management/ClientsManager.js

* * @type {external:RestClient} */ - var auth0RestClient = new Auth0RestClient(options.baseUrl + '/clients/:client_id', clientOptions, options.tokenProvider); + var auth0RestClient = new Auth0RestClient( + options.baseUrl + '/clients/:client_id', + clientOptions, + options.tokenProvider + ); this.resource = new RetryRestClient(auth0RestClient, options.retry); }; - /** * Create an Auth0 client. * @@ -118,25 +121,37 @@

management/ClientsManager.js

*/ utils.wrapPropertyMethod(ClientsManager, 'create', 'resource.create'); - /** * Get all Auth0 clients. * * @method getAll * @memberOf module:management.ClientsManager.prototype * - * @example + * @example <caption> + * This method takes an optional object as first argument that may be used to + * specify pagination settings. If pagination options are not present, + * the first page of a limited number of results will be returned. + * </caption> + * + * // Pagination settings. + * var params = { + * per_page: 10, + * page: 2 + * }; + * * management.clients.getAll(function (err, clients) { * console.log(clients.length); * }); * - * @param {Function} [cb] Callback function. + * @param {Object} [params] Clients params. + * @param {Number} [params.per_page] Number of clients per page. + * @param {Number} [params.page] Page number. + * @param {Function} [cb] Callback function. * * @return {Promise|undefined} */ utils.wrapPropertyMethod(ClientsManager, 'getAll', 'resource.getAll'); - /** * Get an Auth0 client. * @@ -160,7 +175,6 @@

management/ClientsManager.js

*/ utils.wrapPropertyMethod(ClientsManager, 'get', 'resource.get'); - /** * Update an Auth0 client. * @@ -188,7 +202,6 @@

management/ClientsManager.js

*/ utils.wrapPropertyMethod(ClientsManager, 'update', 'resource.patch'); - /** * Delete an Auth0 client. * @@ -212,7 +225,6 @@

management/ClientsManager.js

*/ utils.wrapPropertyMethod(ClientsManager, 'delete', 'resource.delete'); - module.exports = ClientsManager; @@ -226,7 +238,7 @@

management/ClientsManager.js


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/management_ConnectionsManager.js.html b/docs/management_ConnectionsManager.js.html index 8256209da..21e404918 100644 --- a/docs/management_ConnectionsManager.js.html +++ b/docs/management_ConnectionsManager.js.html @@ -24,7 +24,7 @@
@@ -55,7 +55,7 @@

management/ConnectionsManager.js

* @param {Object} [options.headers] Headers to be included in all requests. * @param {Object} [options.retry] Retry Policy Config */ -var ConnectionsManager = function (options) { +var ConnectionsManager = function(options) { if (options === null || typeof options !== 'object') { throw new ArgumentError('Must provide client options'); } @@ -85,11 +85,14 @@

management/ConnectionsManager.js

* * @type {external:RestClient} */ - var auth0RestClient = new Auth0RestClient(options.baseUrl + '/connections/:id ', clientOptions, options.tokenProvider); + var auth0RestClient = new Auth0RestClient( + options.baseUrl + '/connections/:id ', + clientOptions, + options.tokenProvider + ); this.resource = new RetryRestClient(auth0RestClient, options.retry); }; - /** * Create a new connection. * @@ -112,25 +115,37 @@

management/ConnectionsManager.js

*/ utils.wrapPropertyMethod(ConnectionsManager, 'create', 'resource.create'); - /** * Get all connections. * * @method getAll * @memberOf module:management.ConnectionsManager.prototype * - * @example + * @example <caption> + * This method takes an optional object as first argument that may be used to + * specify pagination settings. If pagination options are not present, + * the first page of a limited number of results will be returned. + * </caption> + * + * // Pagination settings. + * var params = { + * per_page: 10, + * page: 2 + * }; + * * management.connections.getAll(function (err, connections) { * console.log(connections.length); * }); * - * @param {Function} [cb] Callback function. + * @param {Object} [params] Connections params. + * @param {Number} [params.per_page] Number of connections per page. + * @param {Number} [params.page] Page number. + * @param {Function} [cb] Callback function. * * @return {Promise|undefined} */ utils.wrapPropertyMethod(ConnectionsManager, 'getAll', 'resource.getAll'); - /** * Get an Auth0 connection. * @@ -154,7 +169,6 @@

management/ConnectionsManager.js

*/ utils.wrapPropertyMethod(ConnectionsManager, 'get', 'resource.get'); - /** * Update an existing connection. * @@ -182,7 +196,6 @@

management/ConnectionsManager.js

*/ utils.wrapPropertyMethod(ConnectionsManager, 'update', 'resource.patch'); - /** * Delete an existing connection. * @@ -206,7 +219,6 @@

management/ConnectionsManager.js

*/ utils.wrapPropertyMethod(ConnectionsManager, 'delete', 'resource.delete'); - module.exports = ConnectionsManager; @@ -220,7 +232,7 @@

management/ConnectionsManager.js


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/management_DeviceCredentialsManager.js.html b/docs/management_DeviceCredentialsManager.js.html index 96c3be465..bbbf31976 100644 --- a/docs/management_DeviceCredentialsManager.js.html +++ b/docs/management_DeviceCredentialsManager.js.html @@ -24,7 +24,7 @@
@@ -50,7 +50,6 @@

management/DeviceCredentialsManager.js

* @see https://github.com/ngonzalvez/rest-facade */ - /** * @class DeviceCredentialsManager * Manages Auth0 Device Credentials. @@ -62,7 +61,7 @@

management/DeviceCredentialsManager.js

* @param {Object} [options.headers] Headers to be included in all requests. * @param {Object} [options.retry] Retry Policy Config */ -var DeviceCredentialsManager = function (options) { +var DeviceCredentialsManager = function(options) { if (options === null || typeof options !== 'object') { throw new ArgumentError('Must provide manager options'); } @@ -93,11 +92,14 @@

management/DeviceCredentialsManager.js

* * @type {external:RestClient} */ - var auth0RestClient = new Auth0RestClient(options.baseUrl + '/device-credentials/:id', clientOptions, options.tokenProvider); + var auth0RestClient = new Auth0RestClient( + options.baseUrl + '/device-credentials/:id', + clientOptions, + options.tokenProvider + ); this.resource = new RetryRestClient(auth0RestClient, options.retry); }; - /** * Create an Auth0 credential. * @@ -120,7 +122,6 @@

management/DeviceCredentialsManager.js

*/ utils.wrapPropertyMethod(DeviceCredentialsManager, 'createPublicKey', 'resource.create'); - /** * Get all Auth0 credentials. * @@ -138,7 +139,6 @@

management/DeviceCredentialsManager.js

*/ utils.wrapPropertyMethod(DeviceCredentialsManager, 'getAll', 'resource.getAll'); - /** * Delete an Auth0 device credential. * @@ -164,7 +164,6 @@

management/DeviceCredentialsManager.js

*/ utils.wrapPropertyMethod(DeviceCredentialsManager, 'delete', 'resource.delete'); - module.exports = DeviceCredentialsManager; @@ -178,7 +177,7 @@

management/DeviceCredentialsManager.js


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/management_EmailProviderManager.js.html b/docs/management_EmailProviderManager.js.html index ada2dcd69..b4f652ff7 100644 --- a/docs/management_EmailProviderManager.js.html +++ b/docs/management_EmailProviderManager.js.html @@ -24,7 +24,7 @@
@@ -50,7 +50,6 @@

management/EmailProviderManager.js

* @see https://github.com/ngonzalvez/rest-facade */ - /** * @class EmailProviderManager * Auth0 Email Provider. @@ -62,7 +61,7 @@

management/EmailProviderManager.js

* @param {Object} [options.headers] Headers to be included in all requests. * @param {Object} [options.retry] Retry Policy Config */ -var EmailProviderManager = function (options) { +var EmailProviderManager = function(options) { if (options === null || typeof options !== 'object') { throw new ArgumentError('Must provide client options'); } @@ -92,11 +91,14 @@

management/EmailProviderManager.js

* * @type {external:RestClient} */ - var auth0RestClient = new Auth0RestClient(options.baseUrl + '/emails/provider', clientOptions, options.tokenProvider); + var auth0RestClient = new Auth0RestClient( + options.baseUrl + '/emails/provider', + clientOptions, + options.tokenProvider + ); this.resource = new RetryRestClient(auth0RestClient, options.retry); }; - /** * Configure the email provider. * @@ -118,7 +120,6 @@

management/EmailProviderManager.js

*/ utils.wrapPropertyMethod(EmailProviderManager, 'configure', 'resource.create'); - /** * Get the email provider. * @@ -136,7 +137,6 @@

management/EmailProviderManager.js

*/ utils.wrapPropertyMethod(EmailProviderManager, 'get', 'resource.getAll'); - /** * Update the email provider. * @@ -161,7 +161,6 @@

management/EmailProviderManager.js

*/ utils.wrapPropertyMethod(EmailProviderManager, 'update', 'resource.patch'); - /** * Delete email provider. * @@ -183,7 +182,6 @@

management/EmailProviderManager.js

*/ utils.wrapPropertyMethod(EmailProviderManager, 'delete', 'resource.delete'); - module.exports = EmailProviderManager; @@ -197,7 +195,7 @@

management/EmailProviderManager.js


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/management_EmailTemplatesManager.js.html b/docs/management_EmailTemplatesManager.js.html new file mode 100644 index 000000000..4342b905f --- /dev/null +++ b/docs/management_EmailTemplatesManager.js.html @@ -0,0 +1,189 @@ + + + + + + management/EmailTemplatesManager.js - Documentation + + + + + + + + + + + + + + + + + +
+ +

management/EmailTemplatesManager.js

+ + + + + + + +
+
+
var ArgumentError = require('rest-facade').ArgumentError;
+var utils = require('../utils');
+var Auth0RestClient = require('../Auth0RestClient');
+var RetryRestClient = require('../RetryRestClient');
+
+/**
+ * Simple facade for consuming a REST API endpoint.
+ * @external RestClient
+ * @see https://github.com/ngonzalvez/rest-facade
+ */
+
+/**
+ * @class EmailTemplatesManager
+ * This class provides a simple abstraction for performing CRUD operations
+ * on Auth0's Email Templates. {@see https://auth0.com/docs/api/management/v2#!/Email_Templates/get_email_templates_by_templateName}
+ * @constructor
+ * @memberOf module:management
+ *
+ * @param {Object} options            The client options.
+ * @param {String} options.baseUrl    The URL of the API.
+ * @param {Object} [options.headers]  Headers to be included in all requests.
+ * @param {Object} [options.retry]    Retry Policy Config
+ */
+var EmailTemplatesManager = function(options) {
+  if (!options || 'object' !== typeof options) {
+    throw new ArgumentError('Must provide manager options');
+  }
+
+  if (!options.baseUrl || 'string' !== typeof options.baseUrl) {
+    throw new ArgumentError('Must provide a valid string as base URL for the API');
+  }
+
+  /**
+   * Options object for the Rest Client instance.
+   *
+   * @type {Object}
+   */
+  var clientOptions = {
+    headers: options.headers,
+    query: { repeatParams: false }
+  };
+
+  /**
+   * Provides an abstraction layer for performing CRUD operations on
+   * {@link https://auth0.com/docs/api/management/v2#!/Email_Templates/get_email_templates_by_templateName Auth0's Email Templates}.
+   *
+   * @type {external:RestClient}
+   */
+  var auth0RestClient = new Auth0RestClient(
+    options.baseUrl + '/email-templates/:name',
+    clientOptions,
+    options.tokenProvider
+  );
+  this.resource = new RetryRestClient(auth0RestClient, options.retry);
+};
+
+/**
+ * Create a new Email Template.
+ *
+ * @method    create
+ * @memberOf  module:management.EmailTemplatesManager.prototype
+ *
+ * @example
+ * management.emailTemplates.create(data, function (err) {
+ *   if (err) {
+ *     // Handle error.
+ *   }
+ *
+ *   // Email Template created.
+ * });
+ *
+ * @param   {Object}    data     Email Template data object.
+ * @param   {Function}  [cb]     Callback function.
+ *
+ * @return  {Promise|undefined}
+ */
+utils.wrapPropertyMethod(EmailTemplatesManager, 'create', 'resource.create');
+
+/**
+ * Get an Auth0 Email Template.
+ *
+ * @method    get
+ * @memberOf  module:management.EmailTemplatesManager.prototype
+ *
+ * @example
+ * management.emailTemplates.get({ name: EMAIL_TEMPLATE_NAME }, function (err, emailTemplate) {
+ *   if (err) {
+ *     // Handle error.
+ *   }
+ *
+ *   console.log(emailTemplate);
+ * });
+ *
+ * @param   {Object}    params          Email Template parameters.
+ * @param   {String}    params.name     Template Name
+ * @param   {Function}  [cb]            Callback function.
+ *
+ * @return  {Promise|undefined}
+ */
+utils.wrapPropertyMethod(EmailTemplatesManager, 'get', 'resource.get');
+
+/**
+ * Update an existing Email Template.
+ *
+ * @method    update
+ * @memberOf  module:management.EmailTemplatesManager.prototype
+ *
+ * @example
+ * var data = { from: 'new@email.com' };
+ * var params = { name: EMAIL_TEMPLATE_NAME };
+ *
+ * management.emailTemplates.update(params, data, function (err, emailTemplate) {
+ *   if (err) {
+ *     // Handle error.
+ *   }
+ *
+ *   console.log(emailTemplate.from);  // 'new@email.com'
+ * });
+ *
+ * @param   {Object}    params          Email Template parameters.
+ * @param   {String}    params.name     Template Name
+ * @param   {Object}    data            Updated Email Template data.
+ * @param   {Function}  [cb]            Callback function.
+ *
+ * @return  {Promise|undefined}
+ */
+utils.wrapPropertyMethod(EmailTemplatesManager, 'update', 'resource.patch');
+
+module.exports = EmailTemplatesManager;
+
+
+
+ + + + +
+ +
+ +
+ Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme. +
+ + + + + diff --git a/docs/management_JobsManager.js.html b/docs/management_JobsManager.js.html index eb9ffc653..5f08c8e7c 100644 --- a/docs/management_JobsManager.js.html +++ b/docs/management_JobsManager.js.html @@ -24,7 +24,7 @@
@@ -54,7 +54,6 @@

management/JobsManager.js

* @see https://github.com/ngonzalvez/rest-facade */ - /** * @class * Abstract the creation as well as the retrieval of async jobs. @@ -66,7 +65,7 @@

management/JobsManager.js

* @param {Object} [options.headers] Headers to be included in all requests. * @param {Object} [options.retry] Retry Policy Config */ -var JobsManager = function (options){ +var JobsManager = function(options) { if (options === null || typeof options !== 'object') { throw new ArgumentError('Must provide client options'); } @@ -93,11 +92,14 @@

management/JobsManager.js

* * @type {external:RestClient} */ - var auth0RestClient = new Auth0RestClient(options.baseUrl + '/jobs/:id', clientOptions, options.tokenProvider); + var auth0RestClient = new Auth0RestClient( + options.baseUrl + '/jobs/:id', + clientOptions, + options.tokenProvider + ); this.jobs = new RetryRestClient(auth0RestClient, options.retry); }; - /** * Get a job by its ID. * @@ -124,7 +126,7 @@

management/JobsManager.js

* * @return {Promise|undefined} */ -JobsManager.prototype.get = function (params, cb) { +JobsManager.prototype.get = function(params, cb) { if (!params.id || typeof params.id !== 'string') { throw new ArgumentError('The id parameter must be a valid job id'); } @@ -137,10 +139,10 @@

management/JobsManager.js

return this.jobs.get(params); }; - /** * Given a path to a file and a connection id, create a new job that imports the - * users contained in the file and associate them with the given connection. + * users contained in the file or JSON string and associate them with the given + * connection. * * @method importUsers * @memberOf module:management.JobsManager.prototype @@ -160,11 +162,12 @@

management/JobsManager.js

* @param {Object} data Users import data. * @param {String} data.connectionId Connection for the users insertion. * @param {String} data.users Path to the users data file. + * @param {String} data.users_json JSON data for the users. * @param {Function} [cb] Callback function. * * @return {Promise|undefined} */ -JobsManager.prototype.importUsers = function (data, cb) { +JobsManager.prototype.importUsers = function(data, cb) { var options = this.options; var headers = extend({}, options.headers); @@ -173,48 +176,47 @@

management/JobsManager.js

var url = options.baseUrl + '/jobs/users-imports'; var method = 'POST'; - var promise = new Promise(function (resolve, reject) { - request({ - url: url, - method: method, - headers: headers, - formData: { - users: { - value: fs.createReadStream(data.users), - options: { - filename: data.users - } - }, - connection_id: data.connection_id + var promise = new Promise(function(resolve, reject) { + request( + { + url: url, + method: method, + headers: headers, + formData: { + users: { + value: data.users_json ? Buffer.from(data.users_json) : fs.createReadStream(data.users), + options: { + filename: data.users_json ? 'users.json' : data.users, + } + }, + connection_id: data.connection_id + } + }, + function(err, res) { + // `superagent` uses the error parameter in callback on http errors. + // the following code is intended to keep that behaviour (https://github.com/visionmedia/superagent/blob/master/lib/node/response.js#L170) + var type = (res.statusCode / 100) | 0; + var isErrorResponse = 4 === type || 5 === type; + if (isErrorResponse) { + var error = new Error('cannot ' + method + url + ' (' + res.statusCode + ')'); + error.status = res.statusCode; + error.method = method; + error.text = res.text; + reject(error); + } + + if (err) { + reject(err); + } + + resolve(res); } - }, function (err, res) { - - - // `superagent` uses the error parameter in callback on http errors. - // the following code is intended to keep that behaviour (https://github.com/visionmedia/superagent/blob/master/lib/node/response.js#L170) - var type = res.statusCode / 100 | 0; - var isErrorResponse = (4 === type || 5 === type); - if (isErrorResponse) { - var error = new Error('cannot ' + method + url + ' (' + res.statusCode + ')'); - error.status = res.statusCode; - error.method = method; - error.text = res.text; - reject(error); - } - - if (err) { - reject(err); - } - - resolve(res); - }); + ); }); // Don't return a promise if a callback was given. if (cb && cb instanceof Function) { - promise - .then(cb.bind(null, null)) - .catch(cb); + promise.then(cb.bind(null, null)).catch(cb); return; } @@ -222,7 +224,6 @@

management/JobsManager.js

return promise; }; - /** * Send a verification email to a user. * @@ -246,7 +247,7 @@

management/JobsManager.js

* * @return {Promise|undefined} */ -JobsManager.prototype.verifyEmail = function (data, cb) { +JobsManager.prototype.verifyEmail = function(data, cb) { if (!data.user_id || typeof data.user_id !== 'string') { throw new ArgumentError('Must specify a user ID'); } @@ -259,7 +260,6 @@

management/JobsManager.js

return this.jobs.create({ id: 'verification-email' }, data); }; - module.exports = JobsManager; @@ -273,7 +273,7 @@

management/JobsManager.js


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/management_LogsManager.js.html b/docs/management_LogsManager.js.html index e98f1b139..d9283a774 100644 --- a/docs/management_LogsManager.js.html +++ b/docs/management_LogsManager.js.html @@ -24,7 +24,7 @@
@@ -55,7 +55,7 @@

management/LogsManager.js

* @param {Object} [options.headers] Headers to be included in all requests. * @param {Object} [options.retry] Retry Policy Config */ -var LogsManager = function (options) { +var LogsManager = function(options) { if (options === null || typeof options !== 'object') { throw new ArgumentError('Must provide client options'); } @@ -85,7 +85,11 @@

management/LogsManager.js

* * @type {external:RestClient} */ - var auth0RestClient = new Auth0RestClient(options.baseUrl + '/logs/:id ', clientOptions, options.tokenProvider); + var auth0RestClient = new Auth0RestClient( + options.baseUrl + '/logs/:id ', + clientOptions, + options.tokenProvider + ); this.resource = new RetryRestClient(auth0RestClient, options.retry); }; @@ -106,7 +110,6 @@

management/LogsManager.js

*/ utils.wrapPropertyMethod(LogsManager, 'getAll', 'resource.getAll'); - /** * Get an Auth0 log. * @@ -143,7 +146,7 @@

management/LogsManager.js


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/management_ManagementTokenProvider.js.html b/docs/management_ManagementTokenProvider.js.html index aba0d4a72..eeee64cd5 100644 --- a/docs/management_ManagementTokenProvider.js.html +++ b/docs/management_ManagementTokenProvider.js.html @@ -24,7 +24,7 @@
@@ -62,7 +62,7 @@

management/ManagementTokenProvider.js

* @param {Boolean} [options.enableCache=true] Enabled or Disable Cache * @param {Number} [options.cacheTTLInSeconds] By default the `expires_in` value will be used to determine the cached time of the token, this can be overridden. */ -var ManagementTokenProvider = function (options) { +var ManagementTokenProvider = function(options) { if (!options || typeof options !== 'object') { throw new ArgumentError('Options must be an object'); } @@ -85,7 +85,7 @@

management/ManagementTokenProvider.js

throw new ArgumentError('Must provide a audience'); } - if (typeof params.enableCache !== 'boolean'){ + if (typeof params.enableCache !== 'boolean') { throw new ArgumentError('enableCache must be a boolean'); } @@ -99,7 +99,7 @@

management/ManagementTokenProvider.js

} } - if (params.scope && typeof params.scope !== 'string'){ + if (params.scope && typeof params.scope !== 'string') { throw new ArgumentError('scope must be a string'); } @@ -111,7 +111,7 @@

management/ManagementTokenProvider.js

telemetry: this.options.telemetry }; this.authenticationClient = new AuthenticationClient(authenticationClientOptions); -} +}; /** * Returns the access_token. @@ -121,43 +121,45 @@

management/ManagementTokenProvider.js

* * @return {Promise} Promise returning an access_token. */ -ManagementTokenProvider.prototype.getAccessToken = function () { - if(this.options.enableCache){ - return this.getCachedAccessToken(this.options) - .then(function (data) { - return data.access_token - }); - }else{ - return this.clientCredentialsGrant(this.options.domain, this.options.scope, this.options.audience) - .then(function (data) { - return data.access_token - }); +ManagementTokenProvider.prototype.getAccessToken = function() { + if (this.options.enableCache) { + return this.getCachedAccessToken(this.options).then(function(data) { + return data.access_token; + }); + } else { + return this.clientCredentialsGrant( + this.options.domain, + this.options.scope, + this.options.audience + ).then(function(data) { + return data.access_token; + }); } -} +}; ManagementTokenProvider.prototype.getCachedAccessToken = Promise.promisify( memoizer({ - load: function (options, callback) { + load: function(options, callback) { this.clientCredentialsGrant(options.domain, options.scope, options.audience) - .then(function (data) { + .then(function(data) { callback(null, data); }) - .catch(function (err) { + .catch(function(err) { callback(err); }); }, - hash: function (options) { + hash: function(options) { return options.domain + '-' + options.clientId + '-' + options.scope; }, - itemMaxAge: function (options, data) { - if(options.cacheTTLInSeconds){ + itemMaxAge: function(options, data) { + if (options.cacheTTLInSeconds) { return options.cacheTTLInSeconds * 1000; } // if the expires_in is lower than 10 seconds, do not subtract 10 additional seconds. - if (data.expires_in && data.expires_in < 10 /* seconds */){ + if (data.expires_in && data.expires_in < 10 /* seconds */) { return data.expires_in * 1000; - }else if(data.expires_in){ + } else if (data.expires_in) { // Subtract 10 seconds from expires_in to fetch a new one, before it expires. return data.expires_in * 1000 - 10000 /* milliseconds */; } @@ -167,7 +169,7 @@

management/ManagementTokenProvider.js

}) ); -ManagementTokenProvider.prototype.clientCredentialsGrant = function (domain, scope, audience) { +ManagementTokenProvider.prototype.clientCredentialsGrant = function(domain, scope, audience) { return this.authenticationClient.clientCredentialsGrant({ audience: audience, scope: scope @@ -187,7 +189,7 @@

management/ManagementTokenProvider.js


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/management_ResourceServersManager.js.html b/docs/management_ResourceServersManager.js.html index ea641ca47..f9307a8e8 100644 --- a/docs/management_ResourceServersManager.js.html +++ b/docs/management_ResourceServersManager.js.html @@ -24,7 +24,7 @@
@@ -62,7 +62,7 @@

management/ResourceServersManager.js

* @param {Object} [options.retry] Retry Policy Config */ -var ResourceServersManager = function (options) { +var ResourceServersManager = function(options) { if (options === null || typeof options !== 'object') { throw new ArgumentError('Must provide resource server options'); } @@ -91,7 +91,11 @@

management/ResourceServersManager.js

* * @type {external:RestClient} */ - var auth0RestClient = new Auth0RestClient(options.baseUrl + '/resource-servers/:id', clientOptions, options.tokenProvider); + var auth0RestClient = new Auth0RestClient( + options.baseUrl + '/resource-servers/:id', + clientOptions, + options.tokenProvider + ); this.resource = new RetryRestClient(auth0RestClient, options.retry); }; @@ -134,7 +138,6 @@

management/ResourceServersManager.js

*/ utils.wrapPropertyMethod(ResourceServersManager, 'getAll', 'resource.getAll'); - /** * Get a Resource Server. * @@ -208,7 +211,8 @@

management/ResourceServersManager.js

*/ utils.wrapPropertyMethod(ResourceServersManager, 'delete', 'resource.delete'); -module.exports = ResourceServersManager; +module.exports = ResourceServersManager; +
@@ -220,7 +224,7 @@

management/ResourceServersManager.js


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/management_RulesManager.js.html b/docs/management_RulesManager.js.html index 21d63ed31..660dc2cb8 100644 --- a/docs/management_RulesManager.js.html +++ b/docs/management_RulesManager.js.html @@ -24,7 +24,7 @@
@@ -50,7 +50,6 @@

management/RulesManager.js

* @see https://github.com/ngonzalvez/rest-facade */ - /** * @class RulesManager * The rule class provides a simple abstraction for performing CRUD operations @@ -63,7 +62,7 @@

management/RulesManager.js

* @param {Object} [options.headers] Headers to be included in all requests. * @param {Object} [options.retry] Retry Policy Config */ -var RulesManager = function (options) { +var RulesManager = function(options) { if (options === null || typeof options !== 'object') { throw new ArgumentError('Must provide manager options'); } @@ -92,11 +91,14 @@

management/RulesManager.js

* * @type {external:RestClient} */ - var auth0RestClient = new Auth0RestClient(options.baseUrl + '/rules/:id', clientOptions, options.tokenProvider); + var auth0RestClient = new Auth0RestClient( + options.baseUrl + '/rules/:id', + clientOptions, + options.tokenProvider + ); this.resource = new RetryRestClient(auth0RestClient, options.retry); }; - /** * Create a new rule. * @@ -119,7 +121,6 @@

management/RulesManager.js

*/ utils.wrapPropertyMethod(RulesManager, 'create', 'resource.create'); - /** * Get all rules. * @@ -137,7 +138,6 @@

management/RulesManager.js

*/ utils.wrapPropertyMethod(RulesManager, 'getAll', 'resource.getAll'); - /** * Get an Auth0 rule. * @@ -161,7 +161,6 @@

management/RulesManager.js

*/ utils.wrapPropertyMethod(RulesManager, 'get', 'resource.get'); - /** * Update an existing rule. * @@ -199,7 +198,6 @@

management/RulesManager.js

*/ utils.wrapPropertyMethod(RulesManager, 'update', 'resource.patch'); - /** * Delete an existing rule. * @@ -223,7 +221,6 @@

management/RulesManager.js

*/ utils.wrapPropertyMethod(RulesManager, 'delete', 'resource.delete'); - module.exports = RulesManager; @@ -237,7 +234,7 @@

management/RulesManager.js


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/management_StatsManager.js.html b/docs/management_StatsManager.js.html index 7e43823d3..f9e9f55d2 100644 --- a/docs/management_StatsManager.js.html +++ b/docs/management_StatsManager.js.html @@ -24,7 +24,7 @@
@@ -49,7 +49,6 @@

management/StatsManager.js

* @see https://github.com/ngonzalvez/rest-facade */ - /** * @class * Abstracts interaction with the stats endpoint. @@ -61,7 +60,7 @@

management/StatsManager.js

* @param {Object} [options.headers] Headers to be included in all requests. * @param {Object} [options.retry] Retry Policy Config */ -var StatsManager = function (options){ +var StatsManager = function(options) { if (options === null || typeof options !== 'object') { throw new ArgumentError('Must provide manager options'); } @@ -86,11 +85,14 @@

management/StatsManager.js

* * @type {external:RestClient} */ - var auth0RestClient = new Auth0RestClient(options.baseUrl + '/stats/:type', clientOptions, options.tokenProvider); + var auth0RestClient = new Auth0RestClient( + options.baseUrl + '/stats/:type', + clientOptions, + options.tokenProvider + ); this.stats = new RetryRestClient(auth0RestClient, options.retry); }; - /** * Get the daily stats. * @@ -118,7 +120,7 @@

management/StatsManager.js

* * @return {Promise|undefined} */ -StatsManager.prototype.getDaily = function (params, cb) { +StatsManager.prototype.getDaily = function(params, cb) { params = params || {}; params.type = 'daily'; @@ -129,7 +131,6 @@

management/StatsManager.js

return this.stats.get(params); }; - /** * Get a the active users count. * @@ -149,7 +150,7 @@

management/StatsManager.js

* * @return {Promise|undefined} */ -StatsManager.prototype.getActiveUsersCount = function (cb) { +StatsManager.prototype.getActiveUsersCount = function(cb) { var options = { type: 'active-users' }; if (cb && cb instanceof Function) { @@ -160,7 +161,6 @@

management/StatsManager.js

return this.stats.get(options); }; - module.exports = StatsManager; @@ -174,7 +174,7 @@

management/StatsManager.js


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/management_TenantManager.js.html b/docs/management_TenantManager.js.html index af1337dd7..654809e72 100644 --- a/docs/management_TenantManager.js.html +++ b/docs/management_TenantManager.js.html @@ -24,7 +24,7 @@
@@ -49,7 +49,6 @@

management/TenantManager.js

* @see https://github.com/ngonzalvez/rest-facade */ - /** * @class * Abstracts interaction with the tenant endpoint. @@ -61,7 +60,7 @@

management/TenantManager.js

* @param {Object} [options.headers] Headers to be included in all requests. * @param {Object} [options.retry] Retry Policy Config */ -var TenantManager = function (options){ +var TenantManager = function(options) { if (options === null || typeof options !== 'object') { throw new ArgumentError('Must provide manager options'); } @@ -86,7 +85,11 @@

management/TenantManager.js

* * @type {external:RestClient} */ - var auth0RestClient = new Auth0RestClient(options.baseUrl + '/tenants/settings', clientOptions, options.tokenProvider); + var auth0RestClient = new Auth0RestClient( + options.baseUrl + '/tenants/settings', + clientOptions, + options.tokenProvider + ); this.tenant = new RetryRestClient(auth0RestClient, options.retry); }; @@ -108,7 +111,7 @@

management/TenantManager.js

* * @return {Promise|undefined} */ -TenantManager.prototype.updateSettings = function (data, cb) { +TenantManager.prototype.updateSettings = function(data, cb) { if (cb && cb instanceof Function) { return this.tenant.patch({}, data, cb); } @@ -136,7 +139,7 @@

management/TenantManager.js

* * @return {Promise|undefined} */ -TenantManager.prototype.getSettings = function (cb) { +TenantManager.prototype.getSettings = function(cb) { if (cb && cb instanceof Function) { return this.tenant.get({}, cb); } @@ -145,7 +148,6 @@

management/TenantManager.js

return this.tenant.get({}); }; - module.exports = TenantManager; @@ -159,7 +161,7 @@

management/TenantManager.js


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/management_TicketsManager.js.html b/docs/management_TicketsManager.js.html index 815f4a5ce..aa6977e20 100644 --- a/docs/management_TicketsManager.js.html +++ b/docs/management_TicketsManager.js.html @@ -24,7 +24,7 @@
@@ -48,13 +48,13 @@

management/TicketsManager.js

* Abstracts interaction with the tickets endpoint. * @constructor * @memberOf module:management - * + * * @param {Object} options The client options. * @param {String} options.baseUrl The URL of the API. * @param {Object} [options.headers] Headers to be included in all requests. * @param {Object} [options.retry] Retry Policy Config */ -var TicketsManager = function (options){ +var TicketsManager = function(options) { if (options === null || typeof options !== 'object') { throw new ArgumentError('Must provide manager options'); } @@ -79,11 +79,14 @@

management/TicketsManager.js

* * @type {external:RestClient} */ - var auth0RestClient = new Auth0RestClient(options.baseUrl + '/tickets/:type', clientOptions, options.tokenProvider); + var auth0RestClient = new Auth0RestClient( + options.baseUrl + '/tickets/:type', + clientOptions, + options.tokenProvider + ); this.ticket = new RetryRestClient(auth0RestClient, options.retry); }; - /** * Create a new password change ticket. * @@ -107,7 +110,7 @@

management/TicketsManager.js

* @param {Function} [cb] Callback function. * @return {Promise} */ -TicketsManager.prototype.changePassword = function (data, cb) { +TicketsManager.prototype.changePassword = function(data, cb) { var params = { type: 'password-change' }; if (cb && cb instanceof Function) { @@ -118,7 +121,6 @@

management/TicketsManager.js

return this.ticket.create(params, data); }; - /** * Create an email verification ticket. * @@ -140,7 +142,7 @@

management/TicketsManager.js

* @param {Function} [cb] Callback function. * @return {Promise} */ -TicketsManager.prototype.verifyEmail = function (data, cb) { +TicketsManager.prototype.verifyEmail = function(data, cb) { var params = { type: 'email-verification' }; if (cb && cb instanceof Function) { @@ -151,9 +153,7 @@

management/TicketsManager.js

return this.ticket.create(params, data); }; - module.exports = TicketsManager; - @@ -166,7 +166,7 @@

management/TicketsManager.js


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/management_UsersManager.js.html b/docs/management_UsersManager.js.html index 9f93208bc..10dfd95bb 100644 --- a/docs/management_UsersManager.js.html +++ b/docs/management_UsersManager.js.html @@ -24,7 +24,7 @@
@@ -49,7 +49,6 @@

management/UsersManager.js

* @see https://github.com/ngonzalvez/rest-facade */ - /** * @class * Abstracts interaction with the users endpoint. @@ -61,7 +60,7 @@

management/UsersManager.js

* @param {Object} [options.headers] Headers to be included in all requests. * @param {Object} [options.retry] Retry Policy Config */ -var UsersManager = function (options){ +var UsersManager = function(options) { if (options === null || typeof options !== 'object') { throw new ArgumentError('Must provide manager options'); } @@ -79,8 +78,12 @@

management/UsersManager.js

headers: options.headers, query: { repeatParams: false } }; - - var usersAuth0RestClient = new Auth0RestClient(options.baseUrl + '/users/:id', clientOptions, options.tokenProvider); + + var usersAuth0RestClient = new Auth0RestClient( + options.baseUrl + '/users/:id', + clientOptions, + options.tokenProvider + ); this.users = new RetryRestClient(usersAuth0RestClient, options.retry); /** @@ -90,7 +93,11 @@

management/UsersManager.js

* * @type {external:RestClient} */ - var multifactorAuth0RestClient = new Auth0RestClient(options.baseUrl + '/users/:id/multifactor/:provider', clientOptions, options.tokenProvider); + var multifactorAuth0RestClient = new Auth0RestClient( + options.baseUrl + '/users/:id/multifactor/:provider', + clientOptions, + options.tokenProvider + ); this.multifactor = new RetryRestClient(multifactorAuth0RestClient, options.retry); /** @@ -98,7 +105,11 @@

management/UsersManager.js

* * @type {external:RestClient} */ - var identitiesAuth0RestClient = new Auth0RestClient(options.baseUrl + '/users/:id/identities/:provider/:user_id', clientOptions, options.tokenProvider); + var identitiesAuth0RestClient = new Auth0RestClient( + options.baseUrl + '/users/:id/identities/:provider/:user_id', + clientOptions, + options.tokenProvider + ); this.identities = new RetryRestClient(identitiesAuth0RestClient, options.retry); /** @@ -106,7 +117,11 @@

management/UsersManager.js

* * @type {external:RestClient} */ - var userLogsAuth0RestClient = new Auth0RestClient(options.baseUrl + '/users/:id/logs', clientOptions, options.tokenProvider); + var userLogsAuth0RestClient = new Auth0RestClient( + options.baseUrl + '/users/:id/logs', + clientOptions, + options.tokenProvider + ); this.userLogs = new RetryRestClient(userLogsAuth0RestClient, options.retry); /** @@ -114,7 +129,11 @@

management/UsersManager.js

* * @type {external:RestClient} */ - var enrollmentsAuth0RestClient = new Auth0RestClient(options.baseUrl + '/users/:id/enrollments', clientOptions, options.tokenProvider); + var enrollmentsAuth0RestClient = new Auth0RestClient( + options.baseUrl + '/users/:id/enrollments', + clientOptions, + options.tokenProvider + ); this.enrollments = new RetryRestClient(enrollmentsAuth0RestClient, options.retry); /** @@ -122,11 +141,14 @@

management/UsersManager.js

* * @type {external:RestClient} */ - var usersByEmailClient = new Auth0RestClient(options.baseUrl + '/users-by-email', clientOptions, options.tokenProvider); + var usersByEmailClient = new Auth0RestClient( + options.baseUrl + '/users-by-email', + clientOptions, + options.tokenProvider + ); this.usersByEmail = new RetryRestClient(usersByEmailClient, options.retry); }; - /** * Create a new user. * @@ -147,7 +169,7 @@

management/UsersManager.js

* * @return {Promise|undefined} */ -UsersManager.prototype.create = function (data, cb) { +UsersManager.prototype.create = function(data, cb) { if (cb && cb instanceof Function) { return this.users.create(data, cb); } @@ -155,7 +177,6 @@

management/UsersManager.js

return this.users.create(data); }; - /** * Get all users. * @@ -164,7 +185,8 @@

management/UsersManager.js

* * @example <caption> * This method takes an optional object as first argument that may be used to - * specify pagination settings and the search query. + * specify pagination settings and the search query. If pagination options are + * not present, the first page of a limited number of results will be returned. * </caption> * * // Pagination settings. @@ -184,7 +206,7 @@

management/UsersManager.js

* * @return {Promise|undefined} */ -UsersManager.prototype.getAll = function (params) { +UsersManager.prototype.getAll = function(params) { return this.users.getAll.apply(this.users, arguments); }; @@ -208,11 +230,10 @@

management/UsersManager.js

* * @return {Promise|undefined} */ -UsersManager.prototype.getByEmail = function (email, callback) { +UsersManager.prototype.getByEmail = function(email, callback) { return this.usersByEmail.getAll({ email }, callback); }; - /** * Get a user by its id. * @@ -230,11 +251,10 @@

management/UsersManager.js

* * @return {Promise|undefined} */ -UsersManager.prototype.get = function () { +UsersManager.prototype.get = function() { return this.users.get.apply(this.users, arguments); }; - /** * Update a user by its id. * @@ -260,11 +280,10 @@

management/UsersManager.js

* * @return {Promise|undefined} */ -UsersManager.prototype.update = function () { +UsersManager.prototype.update = function() { return this.users.patch.apply(this.users, arguments); }; - /** * Update the user metadata. * @@ -293,7 +312,7 @@

management/UsersManager.js

* * @return {Promise|undefined} */ -UsersManager.prototype.updateUserMetadata = function (params, metadata, cb) { +UsersManager.prototype.updateUserMetadata = function(params, metadata, cb) { var data = { user_metadata: metadata }; @@ -305,7 +324,6 @@

management/UsersManager.js

return this.users.patch(params, data); }; - /** * Update the app metadata. * @@ -334,7 +352,7 @@

management/UsersManager.js

* * @return {Promise|undefined} */ -UsersManager.prototype.updateAppMetadata = function (params, metadata, cb) { +UsersManager.prototype.updateAppMetadata = function(params, metadata, cb) { var data = { app_metadata: metadata }; @@ -346,7 +364,6 @@

management/UsersManager.js

return this.users.patch(params, data); }; - /** * Delete a user by its id. * @@ -369,7 +386,7 @@

management/UsersManager.js

* * @return {Promise|undefined} */ -UsersManager.prototype.delete = function (params) { +UsersManager.prototype.delete = function(params) { if (typeof params !== 'object' || typeof params.id !== 'string') { throw new ArgumentError('You must provide an id for the delete method'); } @@ -377,7 +394,6 @@

management/UsersManager.js

return this.users.delete.apply(this.users, arguments); }; - /** * Delete all users. * @@ -397,7 +413,7 @@

management/UsersManager.js

* * @return {Promise|undefined} */ -UsersManager.prototype.deleteAll = function (cb) { +UsersManager.prototype.deleteAll = function(cb) { if (typeof cb !== 'function') { var errorMsg = 'The deleteAll method only accepts a callback as argument'; @@ -407,7 +423,6 @@

management/UsersManager.js

return this.users.delete.apply(this.users, arguments); }; - /** * Delete a multifactor provider. * @@ -432,7 +447,7 @@

management/UsersManager.js

* * @return {Promise|undefined} */ -UsersManager.prototype.deleteMultifactorProvider = function (params, cb) { +UsersManager.prototype.deleteMultifactorProvider = function(params, cb) { params = params || {}; if (!params.id || typeof params.id !== 'string') { @@ -450,7 +465,6 @@

management/UsersManager.js

return this.multifactor.delete(params); }; - /** * Link the user with another account. * @@ -458,13 +472,13 @@

management/UsersManager.js

* @memberOf module:management.UsersManager.prototype * * @example - * var params = { id: USER_ID }; - * var data = { - * user_id: 'OTHER_USER_ID', - * connection_id: 'CONNECTION_ID' + * var userId = 'USER_ID'; + * var params = { + * user_id: 'OTHER_USER_ID', + * connection_id: 'CONNECTION_ID' * }; * - * management.users.link(params, data, function (err, user) { + * management.users.link(userId, params, function (err, user) { * if (err) { * // Handle error. * } @@ -480,14 +494,17 @@

management/UsersManager.js

* * @return {Promise|undefined} */ -UsersManager.prototype.link = function (userId, params, cb) { +UsersManager.prototype.link = function(userId, params, cb) { var query = { id: userId }; params = params || {}; // Require a user ID. - if (!userId || typeof userId !== 'string') { + if (!userId) { throw new ArgumentError('The userId cannot be null or undefined'); } + if (typeof userId !== 'string') { + throw new ArgumentError('The userId has to be a string'); + } if (cb && cb instanceof Function) { return this.identities.create(query, params, cb); @@ -496,7 +513,6 @@

management/UsersManager.js

return this.identities.create(query, params); }; - /** * Unlink the given accounts. * @@ -522,7 +538,7 @@

management/UsersManager.js

* * @return {Promise|undefined} */ -UsersManager.prototype.unlink = function (params, cb) { +UsersManager.prototype.unlink = function(params, cb) { params = params || {}; if (!params.id || typeof params.id !== 'string') { @@ -571,7 +587,7 @@

management/UsersManager.js

* * @return {Promise|undefined} */ -UsersManager.prototype.logs = function (params, cb) { +UsersManager.prototype.logs = function(params, cb) { params = params || {}; if (!params.id || typeof params.id !== 'string') { @@ -598,7 +614,7 @@

management/UsersManager.js

* * @return {Promise|undefined} */ -UsersManager.prototype.getGuardianEnrollments = function () { +UsersManager.prototype.getGuardianEnrollments = function() { return this.enrollments.get.apply(this.enrollments, arguments); }; @@ -615,7 +631,7 @@

management/UsersManager.js


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/management_index.js.html b/docs/management_index.js.html index 37532ee4c..a798d2a61 100644 --- a/docs/management_index.js.html +++ b/docs/management_index.js.html @@ -24,7 +24,7 @@
@@ -65,6 +65,7 @@

management/index.js

var LogsManager = require('./LogsManager'); var ResourceServersManager = require('./ResourceServersManager'); var ManagementTokenProvider = require('./ManagementTokenProvider'); +var EmailTemplatesManager = require('./EmailTemplatesManager'); var BASE_URL_FORMAT = 'https://%s/api/v2'; var MANAGEMENT_API_AUD_FORMAT = 'https://%s/api/v2/'; @@ -92,7 +93,7 @@

management/index.js

* }); * * - * @example <caption> + * @example <caption> * Initialize your client class, by using a Non Interactive Client to fetch an access_token * via the Client Credentials Grant. * </caption> @@ -125,13 +126,13 @@

management/index.js

* @param {Number} [options.retry.maxRetries=10] Retry failed requests X times. * */ -var ManagementClient = function (options) { +var ManagementClient = function(options) { if (!options || typeof options !== 'object') { throw new ArgumentError('Management API SDK options must be an object'); } if (!options.domain || options.domain.length === 0) { - throw new ArgumentError('Must provide a domain'); + throw new ArgumentError('Must provide a domain'); } var baseUrl = util.format(BASE_URL_FORMAT, options.domain); @@ -144,7 +145,10 @@

management/index.js

}; if (options.token === undefined) { - var config = assign({ audience: util.format(MANAGEMENT_API_AUD_FORMAT, options.domain) }, options); + var config = assign( + { audience: util.format(MANAGEMENT_API_AUD_FORMAT, options.domain) }, + options + ); if (options.tokenProvider) { config.enableCache = options.tokenProvider.enableCache; @@ -164,9 +168,9 @@

management/index.js

var telemetry = jsonToBase64(options.clientInfo || this.getClientInfo()); managerOptions.headers['Auth0-Client'] = telemetry; } - + managerOptions.retry = options.retry; - + /** * Simple abstraction for performing CRUD operations on the * clients endpoint. @@ -274,9 +278,15 @@

management/index.js

*/ this.resourceServers = new ResourceServersManager(managerOptions); + /** + * Simple abstraction for performing CRUD operations on + * Auth0's Email Templates + * + * @type {EmailTemplatesManager} + */ + this.emailTemplates = new EmailTemplatesManager(managerOptions); }; - /** * Return an object with information about the current client, * @@ -285,30 +295,29 @@

management/index.js

* * @return {Object} Object containing client information. */ -ManagementClient.prototype.getClientInfo = function () { +ManagementClient.prototype.getClientInfo = function() { var clientInfo = { name: 'node-auth0', version: pkg.version, dependencies: [], - environment: [{ - name: 'node.js', - version: process.version.replace('v', '') - }] + environment: [ + { + name: 'node.js', + version: process.version.replace('v', '') + } + ] }; // Add the dependencies to the client info object. - Object - .keys(pkg.dependencies) - .forEach(function (name) { - clientInfo.dependencies.push({ - name: name, - version: pkg.dependencies[name] - }); + Object.keys(pkg.dependencies).forEach(function(name) { + clientInfo.dependencies.push({ + name: name, + version: pkg.dependencies[name] }); + }); return clientInfo; }; - /** * Get all connections. * @@ -327,7 +336,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'getConnections', 'connections.getAll'); - /** * Create a new connection. * @@ -350,7 +358,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'createConnection', 'connections.create'); - /** * Get an Auth0 connection. * @@ -374,7 +381,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'getConnection', 'connections.get'); - /** * Delete an existing connection. * @@ -398,7 +404,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'deleteConnection', 'connections.delete'); - /** * Update an existing connection. * @@ -426,7 +431,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'updateConnection', 'connections.update'); - /** * Get all Auth0 clients. * @@ -444,7 +448,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'getClients', 'clients.getAll'); - /** * Get an Auth0 client. * @@ -468,7 +471,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'getClient', 'clients.get'); - /** * Create an Auth0 client. * @@ -491,7 +493,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'createClient', 'clients.create'); - /** * Update an Auth0 client. * @@ -519,7 +520,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'updateClient', 'clients.update'); - /** * Delete an Auth0 client. * @@ -543,7 +543,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'deleteClient', 'clients.delete'); - /** * Get all Auth0 Client Grants. * @@ -561,7 +560,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'getClientGrants', 'clientGrants.getAll'); - /** * Create an Auth0 client grant. * @@ -584,7 +582,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'createClientGrant', 'clientGrants.create'); - /** * Update an Auth0 client grant. * @@ -616,7 +613,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'updateClientGrant', 'clientGrants.update'); - /** * Delete an Auth0 client grant. * @@ -640,7 +636,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'deleteClientGrant', 'clientGrants.delete'); - /** * Create an Auth0 credential. * @@ -661,8 +656,11 @@

management/index.js

* * @return {Promise|undefined} */ -utils.wrapPropertyMethod(ManagementClient, 'createDevicePublicKey', 'deviceCredentials.createPublicKey'); - +utils.wrapPropertyMethod( + ManagementClient, + 'createDevicePublicKey', + 'deviceCredentials.createPublicKey' +); /** * Get all Auth0 credentials. @@ -681,7 +679,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'getDeviceCredentials', 'deviceCredentials.getAll'); - /** * Delete an Auth0 device credential. * @@ -707,7 +704,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'deleteDeviceCredential', 'deviceCredentials.delete'); - /** * Get all rules. * @@ -725,11 +721,10 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'getRules', 'rules.getAll'); - /** * Create a new rule. * - * @method createRules + * @method createRule * @memberOf module:management.ManagementClient.prototype * * @example @@ -748,7 +743,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'createRule', 'rules.create'); - /** * Get an Auth0 rule. * @@ -772,7 +766,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'getRule', 'rules.get'); - /** * Delete an existing rule. * @@ -796,7 +789,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'deleteRule', 'rules.delete'); - /** * Update an existing rule. * @@ -823,7 +815,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'updateRule', 'rules.update'); - /** * Get all users. * @@ -876,8 +867,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'getUsersByEmail', 'users.getByEmail'); - - /** * Get a user by its id. * @@ -897,7 +886,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'getUser', 'users.get'); - /** * Delete all users. * @@ -919,7 +907,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'deleteAllUsers', 'users.deleteAll'); - /** * Delete a user by its id. * @@ -943,7 +930,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'deleteUser', 'users.delete'); - /** * Create a new user. * @@ -966,7 +952,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'createUser', 'users.create'); - /** * Update a user by its id. * @@ -994,7 +979,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'updateUser', 'users.update'); - /** * Update the user metadata for a user. * @@ -1025,7 +1009,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'updateUserMetadata', 'users.updateUserMetadata'); - /** * Update the app metadata for a user. * @@ -1056,7 +1039,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'updateAppMetadata', 'users.updateAppMetadata'); - /** * Delete a multifactor provider for a user. * @@ -1066,7 +1048,7 @@

management/index.js

* @example * var params = { id: USER_ID, provider: MULTIFACTOR_PROVIDER }; * - * management.deleteUserMultifcator(params, function (err, user) { + * management.deleteUserMultifactor(params, function (err, user) { * if (err) { * // Handle error. * } @@ -1081,8 +1063,45 @@

management/index.js

* * @return {Promise|undefined} */ -utils.wrapPropertyMethod(ManagementClient, 'deleteUserMultifcator', 'users.deleteMultifactorProvider'); +utils.wrapPropertyMethod( + ManagementClient, + 'deleteUserMultifactor', + 'users.deleteMultifactorProvider' +); +/** + * Delete a multifactor provider for a user. + * + * @method deleteUserMultifcator + * @memberOf module:management.ManagementClient.prototype + * + * @example + * var params = { id: USER_ID, provider: MULTIFACTOR_PROVIDER }; + * + * management.deleteUserMultifcator(params, function (err, user) { + * if (err) { + * // Handle error. + * } + * + * // Users accounts unlinked. + * }); + * + * @param {Object} params Data object. + * @param {String} params.id The user id. + * @param {String} params.provider Multifactor provider. + * @param {Function} [cb] Callback function + * + * @return {Promise|undefined} + * + * @deprecated The function name has a typo. + * We're shipping this so it doesn't break compatibility. + * Use {@link deleteUserMultifactor} instead. + */ +utils.wrapPropertyMethod( + ManagementClient, + 'deleteUserMultifcator', + 'users.deleteMultifactorProvider' +); /** * Unlink the given accounts. @@ -1111,7 +1130,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'unlinkUsers', 'users.unlink'); - /** * Link the user with another account. * @@ -1119,13 +1137,13 @@

management/index.js

* @memberOf module:management.ManagementClient.prototype * * @example - * var params = { id: USER_ID }; - * var data = { + * var userId = 'USER_ID'; + * var params = { * user_id: 'OTHER_USER_ID', * connection_id: 'CONNECTION_ID' * }; * - * management.linkUsers(params, data, function (err, user) { + * management.linkUsers(userId, params, function (err, user) { * if (err) { * // Handle error. * } @@ -1189,8 +1207,11 @@

management/index.js

* * @return {Promise|undefined} */ -utils.wrapPropertyMethod(ManagementClient, 'getGuardianEnrollments', 'users.getGuardianEnrollments'); - +utils.wrapPropertyMethod( + ManagementClient, + 'getGuardianEnrollments', + 'users.getGuardianEnrollments' +); /** * Get all blacklisted tokens. @@ -1209,7 +1230,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'getBlacklistedTokens', 'blacklistedTokens.getAll'); - /** * Blacklist a new token. * @@ -1239,7 +1259,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'blacklistToken', 'blacklistedTokens.add'); - /** * Get the email provider. * @@ -1257,7 +1276,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'getEmailProvider', 'emailProvider.get'); - /** * Configure the email provider. * @@ -1280,7 +1298,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'configureEmailProvider', 'emailProvider.configure'); - /** * Delete email provider. * @@ -1302,7 +1319,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'deleteEmailProvider', 'emailProvider.delete'); - /** * Update the email provider. * @@ -1327,7 +1343,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'updateEmailProvider', 'emailProvider.update'); - /** * Get a the active users count. * @@ -1349,7 +1364,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'getActiveUsersCount', 'stats.getActiveUsersCount'); - /** * Get the daily stats. * @@ -1379,7 +1393,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'getDailyStats', 'stats.getDaily'); - /** * Get the tenant settings.. * @@ -1401,7 +1414,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'getTenantSettings', 'tenant.getSettings'); - /** * Update the tenant settings. * @@ -1422,7 +1434,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'updateTenantSettings', 'tenant.updateSettings'); - /** * Get a job by its ID. * @@ -1451,7 +1462,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'getJob', 'jobs.get'); - /** * Given a path to a file and a connection id, create a new job that imports the * users contained in the file and associate them with the given connection. @@ -1480,7 +1490,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'importUsers', 'jobs.importUsers'); - /** * Send a verification email to a user. * @@ -1506,7 +1515,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'sendEmailVerification', 'jobs.verifyEmail'); - /** * Create a new password change ticket. * @@ -1532,7 +1540,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'createPasswordChangeTicket', 'tickets.changePassword'); - /** * Create an email verification ticket. * @@ -1597,7 +1604,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'getLogs', 'logs.getAll'); - /** * Create a new resource server. * @@ -1638,7 +1644,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'getResourceServers', 'resourceServers.getAll'); - /** * Get a Resource Server. * @@ -1662,7 +1667,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'getResourceServer', 'resourceServers.get'); - /** * Delete an existing resource server. * @@ -1686,7 +1690,6 @@

management/index.js

*/ utils.wrapPropertyMethod(ManagementClient, 'deleteResourceServer', 'resourceServers.delete'); - /** * Update an existing resource server. * @@ -1726,7 +1729,7 @@

management/index.js


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-auth.AuthenticationClient.html b/docs/module-auth.AuthenticationClient.html index 89847b2c7..78bf69bda 100644 --- a/docs/module-auth.AuthenticationClient.html +++ b/docs/module-auth.AuthenticationClient.html @@ -24,7 +24,7 @@
@@ -103,7 +103,7 @@

n
Source:
@@ -331,7 +331,7 @@

Example
accept a client ID.

-
var AuthenticationClient = require('auth0'). AuthenticationClient;
+    
var AuthenticationClient = require('auth0').AuthenticationClient;
 var auth0 = new AuthenticationClient({
   domain: '{YOUR_ACCOUNT}.auth0.com',
   clientId: '{OPTIONAL_CLIENT_ID}'
@@ -401,7 +401,7 @@ 

databaseSource:
@@ -475,7 +475,7 @@

oauthSource:
@@ -549,7 +549,7 @@

passwordl
Source:
@@ -623,7 +623,7 @@

tokensSource:
@@ -697,7 +697,7 @@

usersSource:
@@ -781,7 +781,7 @@

changeP
Source:
@@ -1071,7 +1071,7 @@

Source:
@@ -1350,7 +1350,7 @@

getClien
Source:
@@ -1459,7 +1459,7 @@

get
Source:
@@ -1775,7 +1775,7 @@

getProfile<
Source:
@@ -1953,7 +1953,7 @@

password
Source:
@@ -2274,7 +2274,7 @@

Source:
@@ -2536,7 +2536,7 @@

reque
Source:
@@ -2817,7 +2817,7 @@

request
Source:
@@ -3333,7 +3333,7 @@

verifySM
Source:
@@ -3622,7 +3622,7 @@

Examples

- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-auth.DatabaseAuthenticator.html b/docs/module-auth.DatabaseAuthenticator.html index eea529f61..15dc60c43 100644 --- a/docs/module-auth.DatabaseAuthenticator.html +++ b/docs/module-auth.DatabaseAuthenticator.html @@ -24,7 +24,7 @@
@@ -102,7 +102,7 @@

Source:
@@ -372,7 +372,7 @@

(inner) Source:
@@ -456,7 +456,7 @@

changeP
Source:
@@ -792,7 +792,7 @@

Source:
@@ -1100,7 +1100,7 @@

signInSource:
@@ -1435,7 +1435,7 @@

signUpSource:
@@ -1738,7 +1738,7 @@
Example

- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-auth.OAuthAuthenticator.html b/docs/module-auth.OAuthAuthenticator.html index 02a30e319..31dbb16ab 100644 --- a/docs/module-auth.OAuthAuthenticator.html +++ b/docs/module-auth.OAuthAuthenticator.html @@ -24,7 +24,7 @@
@@ -102,7 +102,7 @@

new
Source:
@@ -382,7 +382,7 @@

(inner) Source:
@@ -466,7 +466,7 @@

password
Source:
@@ -727,7 +727,7 @@

Example
scope: 'openid' // Optional field. }; -auth0.oauth.token(data, function (err, userData) { +auth0.oauth.passwordGrant(data, function (err, userData) { if (err) { // Handle error. } @@ -787,7 +787,7 @@

signInSource:
@@ -1079,7 +1079,7 @@

socialSig
Source:
@@ -1284,7 +1284,7 @@

Returns:

- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-auth.PasswordlessAuthenticator.html b/docs/module-auth.PasswordlessAuthenticator.html index 82638ae84..e1cd7e45b 100644 --- a/docs/module-auth.PasswordlessAuthenticator.html +++ b/docs/module-auth.PasswordlessAuthenticator.html @@ -24,7 +24,7 @@
@@ -101,7 +101,7 @@

Source:
@@ -371,7 +371,7 @@

(inner) Source:
@@ -455,7 +455,7 @@

sendEmailSource:
@@ -775,7 +775,7 @@

sendSMSSource:
@@ -1099,7 +1099,7 @@

signInSource:
@@ -1492,7 +1492,7 @@
Examples

- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-auth.TokensManager.html b/docs/module-auth.TokensManager.html index 844385e17..96a999e72 100644 --- a/docs/module-auth.TokensManager.html +++ b/docs/module-auth.TokensManager.html @@ -24,7 +24,7 @@
@@ -101,7 +101,7 @@

new Toke
Source:
@@ -352,7 +352,7 @@

Parameters:

- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-auth.UsersManager.html b/docs/module-auth.UsersManager.html index e4314d16b..e320fc68e 100644 --- a/docs/module-auth.UsersManager.html +++ b/docs/module-auth.UsersManager.html @@ -24,7 +24,7 @@
@@ -101,7 +101,7 @@

new Users
Source:
@@ -387,7 +387,7 @@

getInfoSource:
@@ -611,7 +611,7 @@

impersonat
Source:
@@ -1009,7 +1009,7 @@

Example

- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-auth.html b/docs/module-auth.html index 50d4181f3..1885e3cba 100644 --- a/docs/module-auth.html +++ b/docs/module-auth.html @@ -24,7 +24,7 @@
@@ -105,7 +105,7 @@

Classes


- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-management.BlacklistedTokensManager.html b/docs/module-management.BlacklistedTokensManager.html index e879f9a19..5b67cdd19 100644 --- a/docs/module-management.BlacklistedTokensManager.html +++ b/docs/module-management.BlacklistedTokensManager.html @@ -24,7 +24,7 @@
@@ -542,7 +542,7 @@

addSource:
@@ -842,7 +842,7 @@

getAllSource:
@@ -991,7 +991,7 @@
Example

- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-management.ClientGrantsManager.html b/docs/module-management.ClientGrantsManager.html index d7fb24aaf..fb05d1429 100644 --- a/docs/module-management.ClientGrantsManager.html +++ b/docs/module-management.ClientGrantsManager.html @@ -24,7 +24,7 @@
@@ -542,7 +542,7 @@

createSource:
@@ -760,7 +760,7 @@

createSource:
@@ -978,7 +978,7 @@

deleteSource:
@@ -1247,7 +1247,7 @@

deleteSource:
@@ -1516,7 +1516,7 @@

getAllSource:
@@ -1696,7 +1696,7 @@

getAllSource:
@@ -1876,7 +1876,7 @@

updateSource:
@@ -2186,7 +2186,7 @@

updateSource:
@@ -2465,7 +2465,7 @@
Example

- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-management.ClientsManager.html b/docs/module-management.ClientsManager.html index 877da56ad..2aeb4314c 100644 --- a/docs/module-management.ClientsManager.html +++ b/docs/module-management.ClientsManager.html @@ -24,7 +24,7 @@
@@ -546,7 +546,7 @@

createSource:
@@ -764,7 +764,7 @@

deleteSource:
@@ -1033,7 +1033,7 @@

getSource:
@@ -1259,7 +1259,7 @@
Example
-

getAll(cbopt) → {Promise|undefined}

+

getAll(paramsopt, cbopt) → {Promise|undefined}

@@ -1302,7 +1302,7 @@

getAllSource:
@@ -1346,6 +1346,141 @@
Parameters:
+ + + params + + + + + +Object + + + + + + + + + <optional>
+ + + + + + + + + + + +

Clients params.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
per_page + + +Number + + + + + + <optional>
+ + + + + +
+

Number of clients per page.

+ +
page + + +Number + + + + + + <optional>
+ + + + + +
+

Page number.

+ +
+ + + + + + + cb @@ -1426,7 +1561,19 @@
Returns:
Example
-
management.clients.getAll(function (err, clients) {
+        

+ This method takes an optional object as first argument that may be used to + specify pagination settings. If pagination options are not present, + the first page of a limited number of results will be returned. +

+ +
// Pagination settings.
+var params = {
+  per_page: 10,
+  page: 2
+};
+
+management.clients.getAll(function (err, clients) {
   console.log(clients.length);
 });
@@ -1482,7 +1629,7 @@

updateSource:
@@ -1757,7 +1904,7 @@
Example

- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-management.ConnectionsManager.html b/docs/module-management.ConnectionsManager.html index fb7d1514a..64fba72b9 100644 --- a/docs/module-management.ConnectionsManager.html +++ b/docs/module-management.ConnectionsManager.html @@ -24,7 +24,7 @@
@@ -541,7 +541,7 @@

createSource:
@@ -759,7 +759,7 @@

deleteSource:
@@ -1028,7 +1028,7 @@

getSource:
@@ -1254,7 +1254,7 @@
Example
-

getAll(cbopt) → {Promise|undefined}

+

getAll(paramsopt, cbopt) → {Promise|undefined}

@@ -1297,7 +1297,7 @@

getAllSource:
@@ -1341,6 +1341,141 @@
Parameters:
+ + + params + + + + + +Object + + + + + + + + + <optional>
+ + + + + + + + + + + +

Connections params.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
per_page + + +Number + + + + + + <optional>
+ + + + + +
+

Number of connections per page.

+ +
page + + +Number + + + + + + <optional>
+ + + + + +
+

Page number.

+ +
+ + + + + + + cb @@ -1421,7 +1556,19 @@
Returns:
Example
-
management.connections.getAll(function (err, connections) {
+        

+ This method takes an optional object as first argument that may be used to + specify pagination settings. If pagination options are not present, + the first page of a limited number of results will be returned. +

+ +
// Pagination settings.
+var params = {
+  per_page: 10,
+  page: 2
+};
+
+management.connections.getAll(function (err, connections) {
   console.log(connections.length);
 });
@@ -1477,7 +1624,7 @@

updateSource:
@@ -1752,7 +1899,7 @@
Example

- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-management.DeviceCredentialsManager.html b/docs/module-management.DeviceCredentialsManager.html index fd18ed701..e1cbd7842 100644 --- a/docs/module-management.DeviceCredentialsManager.html +++ b/docs/module-management.DeviceCredentialsManager.html @@ -24,7 +24,7 @@
@@ -102,7 +102,7 @@

Source:
@@ -383,7 +383,7 @@

(inner) Source:
@@ -457,7 +457,7 @@

(inner) Source:
@@ -541,7 +541,7 @@

createSource:
@@ -1030,7 +1030,7 @@

getAllSource:
@@ -1179,7 +1179,7 @@
Example

- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-management.EmailProviderManager.html b/docs/module-management.EmailProviderManager.html index 652a2b16d..c9a00106a 100644 --- a/docs/module-management.EmailProviderManager.html +++ b/docs/module-management.EmailProviderManager.html @@ -24,7 +24,7 @@
@@ -102,7 +102,7 @@

n
Source:
@@ -383,7 +383,7 @@

(inner) Source:
@@ -457,7 +457,7 @@

(inner) Source:
@@ -541,7 +541,7 @@

configureSource:
@@ -759,7 +759,7 @@

deleteSource:
@@ -943,7 +943,7 @@

getSource:
@@ -1345,7 +1345,7 @@
Example

- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-management.EmailTemplatesManager.html b/docs/module-management.EmailTemplatesManager.html new file mode 100644 index 000000000..39ee99e0a --- /dev/null +++ b/docs/module-management.EmailTemplatesManager.html @@ -0,0 +1,1313 @@ + + + + + + EmailTemplatesManager - Documentation + + + + + + + + + + + + + + + + + +
+ +

EmailTemplatesManager

+ + + + + + + +
+ +
+ +

+ management. + + EmailTemplatesManager +

+ +

EmailTemplatesManager +This class provides a simple abstraction for performing CRUD operations +on Auth0's Email Templates. {@see https://auth0.com/docs/api/management/v2#!/Email_Templates/get_email_templates_by_templateName}

+ + +
+ +
+
+ + +
+ + +

Constructor

+ + +

new EmailTemplatesManager(options)

+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + +Object + + + + +

The client options.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
baseUrl + + +String + + + + + + + + + + +

The URL of the API.

+ +
headers + + +Object + + + + + + <optional>
+ + + + + +
+

Headers to be included in all requests.

+ +
retry + + +Object + + + + + + <optional>
+ + + + + +
+

Retry Policy Config

+ +
+ + +
+ + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + +

Members

+ + + +
+

(inner) auth0RestClient :external:RestClient

+ + + + +
+

Provides an abstraction layer for performing CRUD operations on +Auth0's Email Templates.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +
Type:
+ + + + + + +
+ + + +
+

(inner) clientOptions :Object

+ + + + +
+

Options object for the Rest Client instance.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +
Type:
+
    +
  • + +Object + + +
  • +
+ + + + + +
+ + + + + +

Methods

+ + + +
+ + + +

create(data, cbopt) → {Promise|undefined}

+ + + + + +
+

Create a new Email Template.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
data + + +Object + + + + + + + + + + +

Email Template data object.

+ +
cb + + +function + + + + + + <optional>
+ + + + + +
+

Callback function.

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +Promise +| + +undefined + + +
+
+ + + +
+ + + +
+
Example
+ +
management.emailTemplates.create(data, function (err) {
+  if (err) {
+    // Handle error.
+  }
+
+  // Email Template created.
+});
+ +
+ +
+ + +
+ + + +

get(params, cbopt) → {Promise|undefined}

+ + + + + +
+

Get an Auth0 Email Template.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
params + + +Object + + + + + + + + + + +

Email Template parameters.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +String + + + + +

Template Name

+ +
+ + +
cb + + +function + + + + + + <optional>
+ + + + + +
+

Callback function.

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +Promise +| + +undefined + + +
+
+ + + +
+ + + +
+
Example
+ +
management.emailTemplates.get({ name: EMAIL_TEMPLATE_NAME }, function (err, emailTemplate) {
+  if (err) {
+    // Handle error.
+  }
+
+  console.log(emailTemplate);
+});
+ +
+ +
+ + +
+ + + +

update(params, data, cbopt) → {Promise|undefined}

+ + + + + +
+

Update an existing Email Template.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
params + + +Object + + + + + + + + + + +

Email Template parameters.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +String + + + + +

Template Name

+ +
+ + +
data + + +Object + + + + + + + + + + +

Updated Email Template data.

+ +
cb + + +function + + + + + + <optional>
+ + + + + +
+

Callback function.

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +Promise +| + +undefined + + +
+
+ + + +
+ + + +
+
Example
+ +
var data = { from: 'new@email.com' };
+var params = { name: EMAIL_TEMPLATE_NAME };
+
+management.emailTemplates.update(params, data, function (err, emailTemplate) {
+  if (err) {
+    // Handle error.
+  }
+
+  console.log(emailTemplate.from);  // 'new@email.com'
+});
+ +
+ +
+ + + + + + +
+ +
+ + + + +
+ +
+ +
+ Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme. +
+ + + + + \ No newline at end of file diff --git a/docs/module-management.JobsManager.html b/docs/module-management.JobsManager.html index 1bc85fe9a..81278da5c 100644 --- a/docs/module-management.JobsManager.html +++ b/docs/module-management.JobsManager.html @@ -24,7 +24,7 @@
@@ -101,7 +101,7 @@

new JobsMa
Source:
@@ -382,7 +382,7 @@

(inner) Source:
@@ -466,7 +466,7 @@

getSource:
@@ -705,7 +705,8 @@

importUser

Given a path to a file and a connection id, create a new job that imports the -users contained in the file and associate them with the given connection.

+users contained in the file or JSON string and associate them with the given +connection.

@@ -741,7 +742,7 @@

importUser
Source:
@@ -887,6 +888,32 @@

Parameters:
+ + + + users_json + + + + + +String + + + + + + + + + + +

JSON data for the users.

+ + + + + @@ -1039,7 +1066,7 @@

verifyEmai
Source:
@@ -1279,7 +1306,7 @@

Example

- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-management.LogsManager.html b/docs/module-management.LogsManager.html index 2ba92bba5..91506e36c 100644 --- a/docs/module-management.LogsManager.html +++ b/docs/module-management.LogsManager.html @@ -24,7 +24,7 @@
@@ -541,7 +541,7 @@

getSource:
@@ -810,7 +810,7 @@

getAllSource:
@@ -959,7 +959,7 @@
Example

- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-management.ManagementClient.html b/docs/module-management.ManagementClient.html index e6a062a8e..13d55fffb 100644 --- a/docs/module-management.ManagementClient.html +++ b/docs/module-management.ManagementClient.html @@ -24,7 +24,7 @@
@@ -106,7 +106,7 @@

new M
Source:
@@ -723,7 +723,7 @@

blac
Source:
@@ -798,7 +798,7 @@

clientGra
Source:
@@ -873,7 +873,7 @@

clientsSource:
@@ -948,7 +948,7 @@

connection
Source:
@@ -1023,7 +1023,7 @@

devi
Source:
@@ -1098,7 +1098,7 @@

emailPro
Source:
@@ -1125,6 +1125,81 @@

Type:
+

+ + + +
+

emailTemplates :EmailTemplatesManager

+ + + + +
+

Simple abstraction for performing CRUD operations on +Auth0's Email Templates

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +
Type:
+
    +
  • + +EmailTemplatesManager + + +
  • +
+ + + + +
@@ -1172,7 +1247,7 @@

jobsSource:
@@ -1246,7 +1321,7 @@

logsSource:
@@ -1321,7 +1396,7 @@

resour
Source:
@@ -1396,7 +1471,7 @@

rulesSource:
@@ -1470,7 +1545,7 @@

statsSource:
@@ -1544,7 +1619,7 @@

tenantSource:
@@ -1618,7 +1693,7 @@

ticketsSource:
@@ -1693,7 +1768,7 @@

usersSource:
@@ -1777,7 +1852,7 @@

blackli
Source:
@@ -2077,7 +2152,7 @@

Source:
@@ -2295,7 +2370,7 @@

createCli
Source:
@@ -2513,7 +2588,7 @@

creat
Source:
@@ -2731,7 +2806,7 @@

Source:
@@ -2949,7 +3024,7 @@

Source:
@@ -3133,7 +3208,7 @@

Source:
@@ -3319,7 +3394,7 @@

c
Source:
@@ -3494,7 +3569,7 @@

Example
-

createRules(data, cbopt) → {Promise|undefined}

+

createRule(data, cbopt) → {Promise|undefined}

@@ -3537,7 +3612,7 @@

createRule
Source:
@@ -3755,7 +3830,7 @@

createUser<
Source:
@@ -3973,7 +4048,7 @@

deleteA
Source:
@@ -4426,7 +4501,7 @@

delet
Source:
@@ -4695,7 +4770,7 @@

Source:
@@ -4966,7 +5041,7 @@

de
Source:
@@ -5150,7 +5225,7 @@

d
Source:
@@ -5419,7 +5494,7 @@

deleteRule<
Source:
@@ -5688,7 +5763,7 @@

deleteUser<
Source:
@@ -5957,7 +6032,308 @@

Source:
+ + + + + + + + + + + + + + + + + +

Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
params + + +Object + + + + + + + + + + +

Data object.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
id + + +String + + + + +

The user id.

+ +
provider + + +String + + + + +

Multifactor provider.

+ +
+ + +
cb + + +function + + + + + + <optional>
+ + + + + +
+

Callback function

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +Promise +| + +undefined + + +
+
+ + + +
+ + + +
+
Example
+ +
var params = { id: USER_ID, provider: MULTIFACTOR_PROVIDER };
+
+management.deleteUserMultifactor(params, function (err, user) {
+  if (err) {
+    // Handle error.
+  }
+
+  // Users accounts unlinked.
+});
+ +
+ +

+ + +
+ + + +

deleteUserMultifcator(params, cbopt) → {Promise|undefined}

+ + + + + +
+

Delete a multifactor provider for a user.

+
+ + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
  • The function name has a typo. +We're shipping this so it doesn't break compatibility. +Use deleteUserMultifactor instead.
+ + + + + + + + + + + +
Source:
+
@@ -6254,7 +6630,7 @@

ge
Source:
@@ -6438,7 +6814,7 @@

g
Source:
@@ -6618,7 +6994,7 @@

getClientSource:
@@ -6887,7 +7263,7 @@

getClien
Source:
@@ -6995,7 +7371,7 @@

getClients<
Source:
@@ -7175,7 +7551,7 @@

getConne
Source:
@@ -7444,7 +7820,7 @@

getConn
Source:
@@ -7658,7 +8034,7 @@

getDaily
Source:
@@ -7958,7 +8334,7 @@

g
Source:
@@ -8138,7 +8514,7 @@

getEm
Source:
@@ -8318,7 +8694,7 @@

Source:
@@ -8583,7 +8959,7 @@

getJobSource:
@@ -8857,7 +9233,7 @@

getLogSource:
@@ -9126,7 +9502,7 @@

getLogsSource:
@@ -9340,7 +9716,7 @@

getR
Source:
@@ -9609,7 +9985,7 @@

get
Source:
@@ -9823,7 +10199,7 @@

getRuleSource:
@@ -10092,7 +10468,7 @@

getRulesSource:
@@ -10272,7 +10648,7 @@

getT
Source:
@@ -10456,7 +10832,7 @@

getUserSource:
@@ -10721,7 +11097,7 @@

getUserLog
Source:
@@ -11096,7 +11472,7 @@

getUsersSource:
@@ -11422,7 +11798,7 @@

getUse
Source:
@@ -11644,7 +12020,7 @@

importUser
Source:
@@ -11942,7 +12318,7 @@

linkUsersSource:
@@ -12211,13 +12587,13 @@
Returns:
Example
-
var params = { id: USER_ID };
-var data = {
+    
var userId = 'USER_ID';
+var params = {
   user_id: 'OTHER_USER_ID',
   connection_id: 'CONNECTION_ID'
 };
 
-management.linkUsers(params, data, function (err, user) {
+management.linkUsers(userId, params, function (err, user) {
   if (err) {
     // Handle error.
   }
@@ -12277,7 +12653,7 @@ 

Source:
@@ -12548,7 +12924,7 @@

unlinkUser
Source:
@@ -12871,7 +13247,7 @@

upda
Source:
@@ -13180,7 +13556,7 @@

updateCli
Source:
@@ -13486,7 +13862,7 @@

updat
Source:
@@ -13792,7 +14168,7 @@

up
Source:
@@ -14045,7 +14421,7 @@

u
Source:
@@ -14351,7 +14727,7 @@

updateRule<
Source:
@@ -14656,7 +15032,7 @@

u
Source:
@@ -14872,7 +15248,7 @@

updateUser<
Source:
@@ -15178,7 +15554,7 @@

upd
Source:
@@ -15456,7 +15832,7 @@

Example

- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-management.ManagementTokenProvider.html b/docs/module-management.ManagementTokenProvider.html index 2fa6f25f6..e7a7a25ec 100644 --- a/docs/module-management.ManagementTokenProvider.html +++ b/docs/module-management.ManagementTokenProvider.html @@ -24,7 +24,7 @@
@@ -633,7 +633,7 @@
Returns:

- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-management.ResourceServersManager.html b/docs/module-management.ResourceServersManager.html index 0ce856e80..2aa84c486 100644 --- a/docs/module-management.ResourceServersManager.html +++ b/docs/module-management.ResourceServersManager.html @@ -24,7 +24,7 @@
@@ -546,7 +546,7 @@

createSource:
@@ -764,7 +764,7 @@

deleteSource:
@@ -1033,7 +1033,7 @@

getSource:
@@ -1302,7 +1302,7 @@

getAllSource:
@@ -1482,7 +1482,7 @@

updateSource:
@@ -1757,7 +1757,7 @@
Example

- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-management.RetryRestClient.html b/docs/module-management.RetryRestClient.html index f1e59f82f..7104caf06 100644 --- a/docs/module-management.RetryRestClient.html +++ b/docs/module-management.RetryRestClient.html @@ -24,7 +24,7 @@
@@ -102,7 +102,7 @@

new Re
Source:
@@ -377,7 +377,7 @@

Parameters:

- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-management.RulesManager.html b/docs/module-management.RulesManager.html index cafdf4b13..7b05c7f88 100644 --- a/docs/module-management.RulesManager.html +++ b/docs/module-management.RulesManager.html @@ -24,7 +24,7 @@
@@ -103,7 +103,7 @@

new Rules
Source:
@@ -384,7 +384,7 @@

(inner) Source:
@@ -458,7 +458,7 @@

(inner) Source:
@@ -542,7 +542,7 @@

createSource:
@@ -760,7 +760,7 @@

deleteSource:
@@ -1298,7 +1298,7 @@

getAllSource:
@@ -1478,7 +1478,7 @@

updateSource:
@@ -1763,7 +1763,7 @@
Example

- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-management.StatsManager.html b/docs/module-management.StatsManager.html index 649d5a0e7..e0d697018 100644 --- a/docs/module-management.StatsManager.html +++ b/docs/module-management.StatsManager.html @@ -24,7 +24,7 @@
@@ -101,7 +101,7 @@

new Stats
Source:
@@ -382,7 +382,7 @@

(inner) Source:
@@ -466,7 +466,7 @@

ge
Source:
@@ -650,7 +650,7 @@

getDailySource:
@@ -919,7 +919,7 @@
Example

- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-management.TenantManager.html b/docs/module-management.TenantManager.html index f7ada9e05..ba6aad4e3 100644 --- a/docs/module-management.TenantManager.html +++ b/docs/module-management.TenantManager.html @@ -24,7 +24,7 @@
@@ -101,7 +101,7 @@

new Tena
Source:
@@ -382,7 +382,7 @@

(inner) Source:
@@ -466,7 +466,7 @@

getSetting
Source:
@@ -650,7 +650,7 @@

updateS
Source:
@@ -835,7 +835,7 @@

Example

- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-management.TicketsManager.html b/docs/module-management.TicketsManager.html index 28177c7ac..02480d991 100644 --- a/docs/module-management.TicketsManager.html +++ b/docs/module-management.TicketsManager.html @@ -24,7 +24,7 @@
@@ -466,7 +466,7 @@

changeP
Source:
@@ -652,7 +652,7 @@

verifyEmai
Source:
@@ -805,7 +805,7 @@

Example

- Generated by JSDoc 3.4.3 on Thu Mar 01 2018 16:23:51 GMT-0300 (-03) using the Minami theme. + Generated by JSDoc 3.4.3 on Tue May 29 2018 15:13:41 GMT-0300 (-03) using the Minami theme.
diff --git a/docs/module-management.UsersManager.html b/docs/module-management.UsersManager.html index 61ce511c5..e8dbd1de6 100644 --- a/docs/module-management.UsersManager.html +++ b/docs/module-management.UsersManager.html @@ -24,7 +24,7 @@
@@ -101,7 +101,7 @@

new Users
Source:
@@ -381,7 +381,7 @@

(
Source:
@@ -455,7 +455,7 @@

(i
Source:
@@ -530,7 +530,7 @@

(
Source:
@@ -604,7 +604,7 @@

(inn
Source:
@@ -678,7 +678,7 @@

(inner) <
Source:
@@ -762,7 +762,7 @@

createSource:
@@ -980,7 +980,7 @@

deleteSource:
@@ -1249,7 +1249,7 @@

deleteAllSource:
@@ -1433,7 +1433,7 @@

Source:
@@ -1730,7 +1730,7 @@

getSource:
@@ -1995,7 +1995,7 @@

getAllSource:
@@ -2256,7 +2256,8 @@
Example

This method takes an optional object as first argument that may be used to - specify pagination settings and the search query. + specify pagination settings and the search query. If pagination options are + not present, the first page of a limited number of results will be returned.

// Pagination settings.
@@ -2321,7 +2322,7 @@ 

getByEmail<
Source:
@@ -2542,7 +2543,7 @@

Source:
@@ -2807,7 +2808,7 @@