Skip to content

feat: add domain claims endpoints#228

Open
drish wants to merge 1 commit into
mainfrom
feat/domain-claims
Open

feat: add domain claims endpoints#228
drish wants to merge 1 commit into
mainfrom
feat/domain-claims

Conversation

@drish

@drish drish commented Jul 3, 2026

Copy link
Copy Markdown
Member

Adds Domains.Claims sub-resource with create, get, and verify methods (plus _async variants) covering the new Domain Claims API:

  • POST /domains/claim
  • GET /domains/{domain_id}/claim
  • POST /domains/{domain_id}/claim/verify

Summary by cubic

Add Domain Claims API support with Domains.Claims methods to create, get, and verify claims (sync and async) so users can claim already-verified domains. Exposes claim types in resend and includes an example and tests.

  • New Features
    • Domains.Claims.create(params) → POST /domains/claim
    • Domains.Claims.get(domain_id) → GET /domains/{domain_id}/claim
    • Domains.Claims.verify(domain_id) → POST /domains/{domain_id}/claim/verify
    • Async variants: create_async, get_async, verify_async
    • Exported in resend: DomainClaims, DomainClaim, DomainClaimRecord
    • Added examples/domain_claims.py and sync/async tests

Written for commit 59a6e64. Summary will update on new commits.

Review in cubic

Adds Domains.Claims sub-resource with create, get, and verify methods
(plus _async variants) covering the new Domain Claims API:
- POST /domains/claim
- GET /domains/{domain_id}/claim
- POST /domains/{domain_id}/claim/verify
@drish drish requested a review from joaopcm July 3, 2026 21:18

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

4 issues found across 8 files

Confidence score: 4/5

  • The biggest risk is in tests/domain_claims_async_test.py: there’s no async test covering create with all optional parameters, so async-specific regressions in custom_return_path, tracking flags, or tracking_subdomain could slip through unnoticed—add a parity test matching the sync test_domain_claims_create_with_options before merging.
  • Also in tests/domain_claims_async_test.py, multiple test names use should, which conflicts with repo conventions and can add churn in future test maintenance/reviews—rename these tests to direct declarative names to align with project standards.
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="tests/domain_claims_async_test.py">

<violation number="1" location="tests/domain_claims_async_test.py:1">
P2: Missing async test for create with all optional parameters. The sync file has `test_domain_claims_create_with_options` that exercises `custom_return_path`, `open_tracking`, `click_tracking`, and `tracking_subdomain`. The async file should include an equivalent test to catch serialization or handling bugs in the async request path for these optional fields.</violation>

<violation number="2" location="tests/domain_claims_async_test.py:44">
P2: Custom agent: **No `should` in tests**

These test method names include the word 'should', which goes against the project's convention of avoiding 'should' in test descriptions. Use direct, declarative language instead. For example, rename `test_should_create_domain_claim_async_raise_exception_when_no_content` to something like `test_create_domain_claim_async_raises_exception_when_no_content`.</violation>

<violation number="3" location="tests/domain_claims_async_test.py:75">
P2: Custom agent: **No `should` in tests**

This test method name includes 'should', which goes against the project's convention of avoiding 'should' in test descriptions. Use direct, declarative language instead, such as `test_get_domain_claim_async_raises_exception_when_no_content`.</violation>

<violation number="4" location="tests/domain_claims_async_test.py:102">
P2: Custom agent: **No `should` in tests**

This test method name includes 'should', which goes against the project's convention of avoiding 'should' in test descriptions. Use direct, declarative language instead, such as `test_verify_domain_claim_async_raises_exception_when_no_content`.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

@@ -0,0 +1,109 @@
import pytest

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: Missing async test for create with all optional parameters. The sync file has test_domain_claims_create_with_options that exercises custom_return_path, open_tracking, click_tracking, and tracking_subdomain. The async file should include an equivalent test to catch serialization or handling bugs in the async request path for these optional fields.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/domain_claims_async_test.py:

<comment>Missing async test for create with all optional parameters. The sync file has `test_domain_claims_create_with_options` that exercises `custom_return_path`, `open_tracking`, `click_tracking`, and `tracking_subdomain`. The async file should include an equivalent test to catch serialization or handling bugs in the async request path for these optional fields.</comment>

<file context>
@@ -0,0 +1,109 @@
+import pytest
+
+import resend
+from resend.exceptions import NoContentError
+from tests.conftest import AsyncResendBaseTest
+
+# flake8: noqa
+
+pytestmark = pytest.mark.asyncio
</file context>

assert claim["id"] == "dacf4072-4119-4d88-932f-6c6126d3a9d1"
assert claim["status"] == "pending"

async def test_should_verify_domain_claim_async_raise_exception_when_no_content(

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: Custom agent: No should in tests

This test method name includes 'should', which goes against the project's convention of avoiding 'should' in test descriptions. Use direct, declarative language instead, such as test_verify_domain_claim_async_raises_exception_when_no_content.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/domain_claims_async_test.py, line 102:

<comment>This test method name includes 'should', which goes against the project's convention of avoiding 'should' in test descriptions. Use direct, declarative language instead, such as `test_verify_domain_claim_async_raises_exception_when_no_content`.</comment>

<file context>
@@ -0,0 +1,109 @@
+        assert claim["id"] == "dacf4072-4119-4d88-932f-6c6126d3a9d1"
+        assert claim["status"] == "pending"
+
+    async def test_should_verify_domain_claim_async_raise_exception_when_no_content(
+        self,
+    ) -> None:
</file context>
Suggested change
async def test_should_verify_domain_claim_async_raise_exception_when_no_content(
async def test_verify_domain_claim_async_raises_exception_when_no_content(

assert claim["status"] == "blocked"
assert claim["blocked_reason"] == "grace_period"

async def test_should_get_domain_claim_async_raise_exception_when_no_content(

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: Custom agent: No should in tests

This test method name includes 'should', which goes against the project's convention of avoiding 'should' in test descriptions. Use direct, declarative language instead, such as test_get_domain_claim_async_raises_exception_when_no_content.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/domain_claims_async_test.py, line 75:

<comment>This test method name includes 'should', which goes against the project's convention of avoiding 'should' in test descriptions. Use direct, declarative language instead, such as `test_get_domain_claim_async_raises_exception_when_no_content`.</comment>

<file context>
@@ -0,0 +1,109 @@
+        assert claim["status"] == "blocked"
+        assert claim["blocked_reason"] == "grace_period"
+
+    async def test_should_get_domain_claim_async_raise_exception_when_no_content(
+        self,
+    ) -> None:
</file context>
Suggested change
async def test_should_get_domain_claim_async_raise_exception_when_no_content(
async def test_get_domain_claim_async_raises_exception_when_no_content(

assert claim["status"] == "pending"
assert claim["record"]["type"] == "TXT"

async def test_should_create_domain_claim_async_raise_exception_when_no_content(

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: Custom agent: No should in tests

These test method names include the word 'should', which goes against the project's convention of avoiding 'should' in test descriptions. Use direct, declarative language instead. For example, rename test_should_create_domain_claim_async_raise_exception_when_no_content to something like test_create_domain_claim_async_raises_exception_when_no_content.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/domain_claims_async_test.py, line 44:

<comment>These test method names include the word 'should', which goes against the project's convention of avoiding 'should' in test descriptions. Use direct, declarative language instead. For example, rename `test_should_create_domain_claim_async_raise_exception_when_no_content` to something like `test_create_domain_claim_async_raises_exception_when_no_content`.</comment>

<file context>
@@ -0,0 +1,109 @@
+        assert claim["status"] == "pending"
+        assert claim["record"]["type"] == "TXT"
+
+    async def test_should_create_domain_claim_async_raise_exception_when_no_content(
+        self,
+    ) -> None:
</file context>
Suggested change
async def test_should_create_domain_claim_async_raise_exception_when_no_content(
async def test_create_domain_claim_async_raises_exception_when_no_content(

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.

1 participant