Repository navigation
feat(domains): add tracking, TLS and capabilities to domain create - #145
Merged
Merged
Conversation
Add openTracking, clickTracking, tls and capabilities to CreateDomainOptions. The API accepts these fields on POST /domains. Add DomainCapabilities and DomainCapabilityStatus for the capabilities object. Fix the Tls enum to serialize as its lowercase API value. Before this change, the SDK sent "ENFORCED" or "OPPORTUNISTIC", and the API accepts only "enforced" or "opportunistic".
Contributor
There was a problem hiding this comment.
1 issue found across 5 files
Confidence score: 3/5
DomainCapabilities.Builder.build()can produce an empty or all-disabled configuration thatPOST /domainsrejects, causing the request to fail; reject this invalid state before sending it.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/main/java/com/resend/services/domains/model/DomainCapabilities.java">
<violation number="1" location="src/main/java/com/resend/services/domains/model/DomainCapabilities.java:95">
P2: `DomainCapabilities.Builder.build()` accepts an empty or all-disabled capabilities object, but `POST /domains` requires at least one capability to be enabled. Reject that invalid state before sending the request.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Comment on lines
+95
to
+97
| public DomainCapabilities build() { | ||
| return new DomainCapabilities(this); | ||
| } |
Contributor
There was a problem hiding this comment.
P2: DomainCapabilities.Builder.build() accepts an empty or all-disabled capabilities object, but POST /domains requires at least one capability to be enabled. Reject that invalid state before sending the request.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/main/java/com/resend/services/domains/model/DomainCapabilities.java, line 95:
<comment>`DomainCapabilities.Builder.build()` accepts an empty or all-disabled capabilities object, but `POST /domains` requires at least one capability to be enabled. Reject that invalid state before sending the request.</comment>
<file context>
@@ -0,0 +1,99 @@
+ *
+ * @return A new DomainCapabilities object.
+ */
+ public DomainCapabilities build() {
+ return new DomainCapabilities(this);
+ }
</file context>
Suggested change
| public DomainCapabilities build() { | |
| return new DomainCapabilities(this); | |
| } | |
| public DomainCapabilities build() { | |
| if (sending != DomainCapabilityStatus.ENABLED && receiving != DomainCapabilityStatus.ENABLED) { | |
| throw new IllegalArgumentException("At least one domain capability must be enabled."); | |
| } | |
| return new DomainCapabilities(this); | |
| } |
kewynakshlley
approved these changes
Sep 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
openTracking,clickTracking,tlsandcapabilitiestoCreateDomainOptions, with newDomainCapabilitiesandDomainCapabilityStatustypes for the capabilities object. The docs show open and click tracking on domain create and the API accepts all four fields onPOST /domains, but the Java SDK could only set tracking and TLS on update. This PR also fixesTlsto serialize as"enforced"or"opportunistic", because the SDK sent"ENFORCED"or"OPPORTUNISTIC", which the API rejects on update too.Summary by cubic
Adds
openTracking,clickTracking,tls, andcapabilitiestoCreateDomainOptionsso domain creation can set these options, not just updates.DomainCapabilitiesandDomainCapabilityStatustypes for the capabilities object.Tlsto serialize as"enforced"or"opportunistic"instead of"ENFORCED"or"OPPORTUNISTIC", which the API rejects.Written for commit 2bc6d1c. Summary will update on new commits.