Skip to content

feat(domains): add tracking, TLS and capabilities to domain create - #145

Merged
kewynakshlley merged 1 commit into
mainfrom
feat/domain-create-options
Sep 24, 2026
Merged

kewynakshlley merged 1 commit into
mainfrom
feat/domain-create-options

Conversation

@felipefreitag

@felipefreitag felipefreitag commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Add openTracking, clickTracking, tls and capabilities to CreateDomainOptions, with new DomainCapabilities and DomainCapabilityStatus types for the capabilities object. The docs show open and click tracking on domain create and the API accepts all four fields on POST /domains, but the Java SDK could only set tracking and TLS on update. This PR also fixes Tls to 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, and capabilities to CreateDomainOptions so domain creation can set these options, not just updates.

  • Adds new DomainCapabilities and DomainCapabilityStatus types for the capabilities object.
  • Fixes Tls to serialize as "enforced" or "opportunistic" instead of "ENFORCED" or "OPPORTUNISTIC", which the API rejects.

Written for commit 2bc6d1c. Summary will update on new commits.

Review in cubic

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".

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 5 files

Confidence score: 3/5

  • DomainCapabilities.Builder.build() can produce an empty or all-disabled configuration that POST /domains rejects, 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);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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
kewynakshlley merged commit 1408299 into main Sep 24, 2026
4 checks passed
@kewynakshlley
kewynakshlley deleted the feat/domain-create-options branch September 24, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants