diff --git a/src/management/__generated/managers/emails-manager.ts b/src/management/__generated/managers/emails-manager.ts
index b31172386..50d998e7a 100644
--- a/src/management/__generated/managers/emails-manager.ts
+++ b/src/management/__generated/managers/emails-manager.ts
@@ -48,10 +48,46 @@ export class EmailsManager extends BaseAPI {
}
/**
- * Update an email provider.
- * The credentials
object requires different properties depending on the email provider (which is specified using the name
property):
- *
mandrill
requires api_key
sendgrid
requires api_key
sparkpost
requires api_key
. Optionally, set region
to eu
to use the SparkPost service hosted in Western Europe; set to null
to use the SparkPost service hosted in North America. eu
or null
are the only valid values for region
.mailgun
requires api_key
and domain
. Optionally, set region
to eu
to use the Mailgun service hosted in Europe; set to null
otherwise. eu
or null
are the only valid values for region
.ses
requires accessKeyId
, secretAccessKey
, and region
smtp
requires smtp_host
, smtp_port
, smtp_user
, and smtp_pass
settings
object with different configuration options, which will be used when sending an email:
- * smtp
provider, settings
may contain headers
object. When using AWS SES SMTP host, you may provide a name of configuration set in X-SES-Configuration-Set
header. Value must be a string.ses
provider, settings
may contain message
object, where you can provide a name of configuration set in configuration_set_name
property. Value must be a string.credentials
object
+ * requires different properties depending on the email provider (which is specified using the name
property):
+ * mandrill
requires api_key
sendgrid
requires api_key
sparkpost
requires api_key
. Optionally, set region
to eu
to use
+ * the SparkPost service hosted in Western Europe; set to null
to use the SparkPost service hosted in
+ * North America. eu
or null
are the only valid values for region
.
+ * mailgun
requires api_key
and domain
. Optionally, set region
to
+ * eu
to use the Mailgun service hosted in Europe; set to null
otherwise. eu
or
+ * null
are the only valid values for region
.
+ * ses
requires accessKeyId
, secretAccessKey
, and region
smtp
requires smtp_host
, smtp_port
, smtp_user
, and
+ * smtp_pass
+ * settings
object with different configuration
+ * options, which will be used when sending an email:
+ * smtp
provider, settings
may contain headers
object.
+ * X-SES-Configuration-Set
header. Value must be a string.
+ * X-MSYS_API
header. Value must be an object.
+ * ses
provider, settings
may contain message
object, where you can provide
+ * a name of configuration set in configuration_set_name
property. Value must be a string.
+ * credentials
object requires different properties depending on the email provider (which is specified using the name
property):
- * mandrill
requires api_key
sendgrid
requires api_key
sparkpost
requires api_key
. Optionally, set region
to eu
to use the SparkPost service hosted in Western Europe; set to null
to use the SparkPost service hosted in North America. eu
or null
are the only valid values for region
.mailgun
requires api_key
and domain
. Optionally, set region
to eu
to use the Mailgun service hosted in Europe; set to null
otherwise. eu
or null
are the only valid values for region
.ses
requires accessKeyId
, secretAccessKey
, and region
smtp
requires smtp_host
, smtp_port
, smtp_user
, and smtp_pass
settings
object with different configuration options, which will be used when sending an email:
- * smtp
provider, settings
may contain headers
object. When using AWS SES SMTP host, you may provide a name of configuration set in X-SES-Configuration-Set
header. Value must be a string.ses
provider, settings
may contain message
object, where you can provide a name of configuration set in configuration_set_name
property. Value must be a string.credentials
object
+ * requires different properties depending on the email provider (which is specified using the name
property):
+ * mandrill
requires api_key
sendgrid
requires api_key
sparkpost
requires api_key
. Optionally, set region
to eu
to use
+ * the SparkPost service hosted in Western Europe; set to null
to use the SparkPost service hosted in
+ * North America. eu
or null
are the only valid values for region
.
+ * mailgun
requires api_key
and domain
. Optionally, set region
to
+ * eu
to use the Mailgun service hosted in Europe; set to null
otherwise. eu
or
+ * null
are the only valid values for region
.
+ * ses
requires accessKeyId
, secretAccessKey
, and region
smtp
requires smtp_host
, smtp_port
, smtp_user
, and
+ * smtp_pass
+ * settings
object with different configuration
+ * options, which will be used when sending an email:
+ * smtp
provider, settings
may contain headers
object.
+ * X-SES-Configuration-Set
header. Value must be a string.
+ * X-MSYS_API
header. Value must be an object.
+ * ses
provider, settings
may contain message
object, where you can provide
+ * a name of configuration set in configuration_set_name
property. Value must be a string.
+ * post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge
+ * An actions extensibility point. Acceptable values: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, custom-email-provider, password-reset-post-challenge
*/
export type GetActions200ResponseActionsInnerSupportedTriggersInnerId =
GetActions200ResponseActionsInnerSupportedTriggersInnerIdAnyOf;
@@ -4648,6 +4650,7 @@ export const GetActions200ResponseActionsInnerSupportedTriggersInnerIdAnyOf = {
iga_certification: 'iga-certification',
iga_fulfillment_assignment: 'iga-fulfillment-assignment',
iga_fulfillment_execution: 'iga-fulfillment-execution',
+ custom_email_provider: 'custom-email-provider',
password_reset_post_challenge: 'password-reset-post-challenge',
} as const;
export type GetActions200ResponseActionsInnerSupportedTriggersInnerIdAnyOf =
@@ -16404,7 +16407,7 @@ export interface GetActionsRequest {
*/
export interface GetBindingsRequest {
/**
- * An actions extensibility point. Acceptable values: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge
+ * An actions extensibility point. Acceptable values: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, custom-email-provider, password-reset-post-challenge
*
*/
triggerId: string;
@@ -16444,7 +16447,7 @@ export interface PatchActionOperationRequest {
*/
export interface PatchBindingsOperationRequest {
/**
- * An actions extensibility point. Acceptable values: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge
+ * An actions extensibility point. Acceptable values: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, custom-email-provider, password-reset-post-challenge
*
*/
triggerId: string;
diff --git a/test/management/email-provider.test.ts b/test/management/email-provider.test.ts
index 3cb7cdd58..c5e19a50f 100644
--- a/test/management/email-provider.test.ts
+++ b/test/management/email-provider.test.ts
@@ -248,6 +248,87 @@ describe('EmailProviderManager', () => {
});
});
+ describe('#configure.custom', () => {
+ const data: PostProviderRequest = {
+ name: PostProviderRequestNameEnum.custom,
+ enabled: true,
+ default_from_address: 'from@test.com',
+ credentials: {},
+ };
+ const response = {
+ name: PostProviderRequestNameEnum.custom,
+ enabled: true,
+ default_from_address: 'from@test.com',
+ credentials: {},
+ };
+ let request: nock.Scope;
+
+ beforeEach(() => {
+ request = nock(API_URL)
+ .post('/emails/provider', data as any)
+ .reply(200, response);
+ });
+
+ it('should return a promise if no callback is given', (done) => {
+ emails.configure(data).then(done.bind(null, null)).catch(done.bind(null, null));
+ });
+
+ it('should pass any errors to the promise catch handler', (done) => {
+ nock.cleanAll();
+
+ nock(API_URL).post('/emails/provider').reply(500, {});
+
+ emails.configure(data).catch((err) => {
+ expect(err).toBeDefined();
+
+ done();
+ });
+ });
+
+ it('should perform a POST request to /api/v2/emails/provider', (done) => {
+ emails.configure(data).then(() => {
+ expect(request.isDone()).toBe(true);
+
+ done();
+ });
+ });
+
+ it('should pass the data in the body of the request', (done) => {
+ emails.configure(data).then(() => {
+ expect(request.isDone()).toBe(true);
+
+ done();
+ });
+ });
+
+ it('should pass the body of the response to the "then" handler', (done) => {
+ emails.configure(data).then((provider) => {
+ expect(provider.data.name).toBe(response.name);
+ expect(provider.data.enabled).toBe(response.enabled);
+ expect(provider.data.default_from_address).toBe(response.default_from_address);
+
+ expect(provider.data.credentials).toStrictEqual(response.credentials);
+
+ done();
+ });
+ });
+
+ it('should include the token in the Authorization header', (done) => {
+ nock.cleanAll();
+
+ const request = nock(API_URL)
+ .post('/emails/provider')
+ .matchHeader('Authorization', `Bearer ${token}`)
+ .reply(200, response);
+
+ emails.configure(data).then(() => {
+ expect(request.isDone()).toBe(true);
+
+ done();
+ });
+ });
+ });
+
describe('#update', () => {
const data: PatchProviderRequest = {
name: PatchProviderRequestNameEnum.smtp,