Add Resend verification email functionality#120
Conversation
| private String id; | ||
|
|
||
| @JsonCreator | ||
| public Job(@JsonProperty("status") String status, @JsonProperty("type") String type, @JsonProperty("id") String id) { |
There was a problem hiding this comment.
I think for the time being, this doesn't need to be public. Can you try making it private or package protected at least? See if Jackson complains.
| } | ||
|
|
||
| @JsonProperty("created_at") | ||
| public void setCreatedAt(String createdAt) { |
There was a problem hiding this comment.
I don't see any sample values for this created_at field in the api docs. But probably would be better to just use a Date and make Jackson convert between the types. I think the API already makes use of the ISO-8601 format. See the User's class created_at method. If this is the case, then you'll also need to update the JSON samples used in the introduced tests.
| * @param recipient the email verification recipient. | ||
| * @return a Request to execute. | ||
| */ | ||
| public Request<Job> sendVerificationEmail(EmailRecipient recipient) { |
There was a problem hiding this comment.
2 parameters seems fine to have them expanded on the signature. Why do you suggest to use this new EmailRecipient class? Maybe it's more straight forward to validate the user id value (non-null) and let the client id one be optional (nullable). Java-docs would clarify each one's validation respectively.
|
@minhlongdo are you still interested on this? |
|
@lbalmaceda Yes, I am looking at it now. Sorry for the delay. |
…h0-java into resend-verification-email
…clientId, incl. update tests
…h0-java into resend-verification-email
|
@lbalmaceda could you try to kick off the CI again please? It compiles on my laptop. Thanks! :) |
|
@minhlongdo because we still support JDK 7 you need to change this line https://github.com/auth0/auth0-java/pull/120/files#diff-a5e9c9a379e91d2a7b2790bae000ed6bR35 and cast the second parameter to |
|
@lbalmaceda ok thank you for pointing it out, I am unable to test it with JDK 7 :( |
…clientId, incl. update tests
…h0-java into resend-verification-email
|
@lbalmaceda Do you want me to do some squashing? |
|
I'll review this PR again tomorrow. You can squash them if you want or I can do that myself when I merge it. ⚡️ |
lbalmaceda
left a comment
There was a problem hiding this comment.
I left some final comments. Most of them are just string or docs changes.
| * @return a Request to execute. | ||
| */ | ||
| public Request<Job> sendVerificationEmail(String userId, String clientId) { | ||
| Asserts.assertNotNull(userId, "recipient"); |
There was a problem hiding this comment.
I get what you mean by recipient, but the parameter is called userId so this exception message is a bit miss-leading. Either change the string in this line to "user id" or clarify in the param's javadoc that the value is the recipient of the email.
| CustomRequest<Job> request = new CustomRequest<>(client, url, "POST", new TypeReference<Job>() { | ||
| }); | ||
| request.addHeader("Authorization", "Bearer " + apiToken); | ||
| request.setBody((Object) requestBody); |
There was a problem hiding this comment.
this one doesn't need to be casted to Object.
| } | ||
|
|
||
| /** | ||
| * Getter for Jobs entity. |
There was a problem hiding this comment.
Getter for the Jobs entity
|
|
||
| @Test | ||
| public void shouldSendUserAVerificationEmailWithClientId() throws Exception { | ||
| Request<Job> request = api.jobs().sendVerificationEmail("google-oauth2|1234", "google-oauth2|client-id"); |
There was a problem hiding this comment.
I know this is just a test, but a client id value looks different. Try something similar to AaiyAPdpYdesoKnqjj8HJqRn4T5titww as used in another test please.
| } | ||
|
|
||
| @Test | ||
| public void shouldThrowOnNullEmailRecipient() throws Exception { |
There was a problem hiding this comment.
Depending on what you choose to fix the other comment, this test might need to be renamed.
No description provided.