Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/husky-3.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpatrick authored Sep 13, 2019
2 parents 6493075 + 05a64df commit 72b3161
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 6 deletions.
70 changes: 70 additions & 0 deletions src/management/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1712,6 +1712,76 @@ utils.wrapPropertyMethod(ManagementClient, 'getBlacklistedTokens', 'blacklistedT
*/
utils.wrapPropertyMethod(ManagementClient, 'blacklistToken', 'blacklistedTokens.add');

/**
* Create a new Email Template.
*
* @method createEmailTemplate
* @memberOf module:management.ManagementClient.prototype
*
* @example
* management.createEmailTemplate(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(ManagementClient, 'createEmailTemplate', 'emailTemplates.create');

/**
* Get an Auth0 Email Template.
*
* @method getEmailTemplate
* @memberOf module:management.ManagementClient.prototype
*
* @example
* management.getEmailTemplate({ 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(ManagementClient, 'getEmailTemplate', 'emailTemplates.get');

/**
* Update an existing Email Template.
*
* @method updateEmailTemplates
* @memberOf module:management.ManagementClient.prototype
*
* @example
* var data = { from: 'new@email.com' };
* var params = { name: EMAIL_TEMPLATE_NAME };
*
* management.updateEmailTemplates(params, data, function (err, emailTemplate) {
* if (err) {
* // Handle error.
* }
*
* console.log(emailTemplate.from); // '[email protected]'
* });
*
* @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(ManagementClient, 'updateEmailTemplate', 'emailTemplates.update');

/**
* Get the email provider.
*
Expand Down
24 changes: 24 additions & 0 deletions test/management/management-client.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var GrantsManager = require('../../src/management/GrantsManager');
var ConnectionsManager = require('../../src/management/ConnectionsManager');
var DeviceCredentialsManager = require('../../src/management/DeviceCredentialsManager');
var EmailProviderManager = require('../../src/management/EmailProviderManager');
var EmailTemplatesManager = require('../../src/management/EmailTemplatesManager');
var JobsManager = require('../../src/management/JobsManager');
var RulesManager = require('../../src/management/RulesManager');
var StatsManager = require('../../src/management/StatsManager');
Expand Down Expand Up @@ -171,6 +172,10 @@ describe('ManagementClient', function() {
property: 'emailProvider',
cls: EmailProviderManager
},
EmailTemplatesManager: {
property: 'emailTemplates',
cls: EmailTemplatesManager
},
JobsManager: {
property: 'jobs',
cls: JobsManager
Expand Down Expand Up @@ -289,6 +294,10 @@ describe('ManagementClient', function() {
requestHeaders
);

expect(client.emailTemplates.resource.restClient.restClient.options.headers).to.contain(
requestHeaders
);

expect(client.stats.resource.restClient.restClient.options.headers).to.contain(
requestHeaders
);
Expand Down Expand Up @@ -424,6 +433,10 @@ describe('ManagementClient', function() {
requestHeaders
);

expect(client.emailTemplates.resource.restClient.restClient.options.headers).to.contain(
requestHeaders
);

expect(client.stats.resource.restClient.restClient.options.headers).to.contain(
requestHeaders
);
Expand Down Expand Up @@ -557,6 +570,10 @@ describe('ManagementClient', function() {
client.emailProvider.resource.restClient.restClient.options.headers
).to.not.have.property('Auth0-Client');

expect(
client.emailTemplates.resource.restClient.restClient.options.headers
).to.not.have.property('Auth0-Client');

expect(client.stats.resource.restClient.restClient.options.headers).to.not.have.property(
'Auth0-Client'
);
Expand Down Expand Up @@ -693,6 +710,10 @@ describe('ManagementClient', function() {
client.emailProvider.resource.restClient.restClient.options.headers
).to.not.have.property('Auth0-Client');

expect(
client.emailTemplates.resource.restClient.restClient.options.headers
).to.not.have.property('Auth0-Client');

expect(client.stats.resource.restClient.restClient.options.headers).to.not.have.property(
'Auth0-Client'
);
Expand Down Expand Up @@ -790,6 +811,9 @@ describe('ManagementClient', function() {
'updateUser',
'getBlacklistedTokens',
'blacklistToken',
'createEmailTemplate',
'getEmailTemplate',
'updateEmailTemplate',
'getEmailProvider',
'configureEmailProvider',
'deleteEmailProvider',
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3195,9 +3195,9 @@ mississippi@^3.0.0:
through2 "^2.0.0"

mixin-deep@^1.2.0:
version "1.3.1"
resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe"
integrity sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==
version "1.3.2"
resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566"
integrity sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==
dependencies:
for-in "^1.0.2"
is-extendable "^1.0.1"
Expand Down Expand Up @@ -5219,9 +5219,9 @@ webpack-sources@^1.4.0, webpack-sources@^1.4.1:
source-map "~0.6.1"

webpack@^4.36.1:
version "4.39.2"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.39.2.tgz#c9aa5c1776d7c309d1b3911764f0288c8c2816aa"
integrity sha512-AKgTfz3xPSsEibH00JfZ9sHXGUwIQ6eZ9tLN8+VLzachk1Cw2LVmy+4R7ZiwTa9cZZ15tzySjeMui/UnSCAZhA==
version "4.39.3"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.39.3.tgz#a02179d1032156b713b6ec2da7e0df9d037def50"
integrity sha512-BXSI9M211JyCVc3JxHWDpze85CvjC842EvpRsVTc/d15YJGlox7GIDd38kJgWrb3ZluyvIjgenbLDMBQPDcxYQ==
dependencies:
"@webassemblyjs/ast" "1.8.5"
"@webassemblyjs/helper-module-context" "1.8.5"
Expand Down

0 comments on commit 72b3161

Please sign in to comment.