Skip to content

fix(domains): correct mutation response types - #317

Open
mayankbohradev wants to merge 2 commits into
resend:mainfrom
mayankbohradev:fix/domain-mutation-response-types
Open

mayankbohradev wants to merge 2 commits into
resend:mainfrom
mayankbohradev:fix/domain-mutation-response-types

Conversation

@mayankbohradev

@mayankbohradev mayankbohradev commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

What

Correct the return types of Domains.update, Domains.verify, and Domains.remove, including their async variants.

Why

The SDK types these responses as a full Domain. A caller can read Domains.verify(id)["status"] without a type error, but the API response has no status and the lookup can raise KeyError.

How

Testing

  • Sync and async tests use the documented response shapes and assert the inferred types.
  • tox -e lint,mypy,py passed (862 tests).

Notes for reviewers

This narrows the public type annotations. The request and response data are unchanged. Use Domains.get() to read the current status.


Summary by cubic

Corrects the return types of Domains.update, Domains.verify, and Domains.remove (sync and async) to match the documented API response shapes. Previously these were typed as a full Domain, so callers could read fields like status that aren't in the response and hit a KeyError.

  • Adds UpdateDomainResponse, VerifyDomainResponse, and RemoveDomainResponse types with only the fields the API actually returns.
  • Updates tests and examples to use the new types and assert them via assert_type.
  • Use Domains.get() to read a domain's current status; the request and response payloads are unchanged.

Written for commit 82886c4. Summary will update on new commits.

View guided diff

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.67%. Comparing base (7f1acd0) to head (650e8d0).
⚠️ Report is 254 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #317       +/-   ##
===========================================
+ Coverage   82.66%   97.67%   +15.00%     
===========================================
  Files           4       90       +86     
  Lines          75     5545     +5470     
===========================================
+ Hits           62     5416     +5354     
- Misses         13      129      +116     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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