Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add email-templates endpoints #117

Merged
merged 7 commits into from
Jun 4, 2018
Merged

Add email-templates endpoints #117

merged 7 commits into from
Jun 4, 2018

Conversation

lbalmaceda
Copy link
Contributor

Add the email-templates endpoints
https://auth0.com/docs/api/management/v2#!/Email_Templates/get_email_templates_by_templateName

Things open to discuss:

  • The use of constants. They can be provided by us or not. The problem is that the endpoint only accepts a given set of values. We can also use an Enum class instead. I've added this:
 public static final String TEMPLATE_VERIFY_EMAIL = "verify_email";
 public static final String TEMPLATE_RESET_EMAIL = "reset_email";
 public static final String TEMPLATE_WELCOME_EMAIL = "welcome_email";
 public static final String TEMPLATE_BLOCKED_ACCOUNT = "blocked_account";
 public static final String TEMPLATE_STOLEN_CREDENTIALS = "stolen_credentials";
 public static final String TEMPLATE_ENROLLMENT_EMAIL = "enrollment_email";
 public static final String TEMPLATE_CHANGE_PASSWORD = "change_password";
 public static final String TEMPLATE_PASSWORD_RESET = "password_reset";
 public static final String TEMPLATE_MFA_OOB_CODE = "mfa_oob_code";
  • Method visibility (scope) of the values that can't be changed once set. The template name ("template" property in the object) can't be changed once set. Since the same Template class is used on the create and update methods, does it make sense to have 2 constructors, one that accepts all the values required for creation (4 or 5 values, can be seen on the corresponding test) and one without any values so people uses the first one for creation and the other for existing templates update?

  • The methods were added following a REST pattern of parameters doAction(id, data). In this particular case, the "Template Id" is the template's name, used on the path. And it must match the one defined in data.template, or that property should be ignored at all when updating templates. WDYT?

@lbalmaceda lbalmaceda requested a review from cocojoe April 13, 2018 12:58
@lbalmaceda lbalmaceda added this to the v1-Next milestone Apr 13, 2018
}

/**
* Create a Rule. A token with scope create:rules is needed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wha

import com.fasterxml.jackson.annotation.JsonProperty;

/**
* Class that represents an Auth0 Guardian Factor object. Related to the {@link com.auth0.client.mgmt.GuardianEntity} entity.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's Guardian got to do with this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more copy paste issues 🙉

@JsonProperty("subject")
private String subject;
@JsonProperty("syntax")
private String syntax;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be an enum for additional validation? Although only supported value is liquid

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HMMM. I discussed this with the server guys. The only allowed value is liquid but they say the option is only there for backwards compatibility, so we shouldn't be hardcoding it to liquid and lowering the param count for example. I don't think offering an enum/constant helps but I don't mind adding one. Would you prefer me to add it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you set the param default to liquid ? Then they don't need to think about it but in the future if they need to, they can change.

Copy link
Member

@cocojoe cocojoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small things

@lbalmaceda lbalmaceda force-pushed the add-email-endpoints branch from f3e5fcd to 2f3555f Compare May 11, 2018 20:01
Copy link
Member

@cocojoe cocojoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cocojoe
Copy link
Member

cocojoe commented Jun 4, 2018

Waiting to merge?

@lbalmaceda lbalmaceda merged commit b894fff into master Jun 4, 2018
@lbalmaceda lbalmaceda deleted the add-email-endpoints branch June 4, 2018 15:27
@lbalmaceda lbalmaceda modified the milestones: v1-Next, 1.6.0 Jun 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants