-
Notifications
You must be signed in to change notification settings - Fork 1
feat: update send and batch email method to also support templates #71
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 issues found across 4 files
Prompt for AI agents (all 2 issues)
Understand the root cause of the following 2 issues and fix them.
<file name="src/main/java/com/resend/services/emails/model/Template.java">
<violation number="1" location="src/main/java/com/resend/services/emails/model/Template.java:25">
The Template constructor stores the builder's mutable variables map by reference, so reusing the builder mutates previously built Template instances. Make a defensive copy when assigning.</violation>
</file>
<file name="src/test/java/com/resend/services/emails/EmailsTest.java">
<violation number="1" location="src/test/java/com/resend/services/emails/EmailsTest.java:235">
Rule violated: **API Key Permission Check SDK Methods**
This new template-based send path exercises additional Resend SDK capabilities, but nothing here confirms the production API keys cover the template permissions required by the API. Please verify those credentials so template sends don’t start failing after release.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
| */ | ||
| private Template(Builder builder) { | ||
| this.id = builder.id; | ||
| this.variables = builder.variables; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Template constructor stores the builder's mutable variables map by reference, so reusing the builder mutates previously built Template instances. Make a defensive copy when assigning.
Prompt for AI agents
Address the following comment on src/main/java/com/resend/services/emails/model/Template.java at line 25:
<comment>The Template constructor stores the builder's mutable variables map by reference, so reusing the builder mutates previously built Template instances. Make a defensive copy when assigning.</comment>
<file context>
@@ -0,0 +1,172 @@
+ */
+ private Template(Builder builder) {
+ this.id = builder.id;
+ this.variables = builder.variables;
+ }
+
</file context>
| .from("Acme <onboarding@resend.dev>") | ||
| .to("john.doe@example.com") | ||
| .subject("Welcome John!") | ||
| .template(template) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rule violated: API Key Permission Check SDK Methods
This new template-based send path exercises additional Resend SDK capabilities, but nothing here confirms the production API keys cover the template permissions required by the API. Please verify those credentials so template sends don’t start failing after release.
Prompt for AI agents
Address the following comment on src/test/java/com/resend/services/emails/EmailsTest.java at line 235:
<comment>This new template-based send path exercises additional Resend SDK capabilities, but nothing here confirms the production API keys cover the template permissions required by the API. Please verify those credentials so template sends don’t start failing after release.</comment>
<file context>
@@ -218,4 +218,71 @@ public void testListAttachmentsWithPagination_Success() throws ResendException {
+ .from("Acme <onboarding@resend.dev>")
+ .to("john.doe@example.com")
+ .subject("Welcome John!")
+ .template(template)
+ .build();
+
</file context>
CarolinaMoraes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
Summary by cubic
Add template support to send and batch email methods. You can now send emails using a published template with variables.
Written for commit 5648dbd. Summary will update automatically on new commits.