Skip to content

fix(emails): add object, scheduled_at and tags to the Email type - #329

Open
Abhishek-B-R wants to merge 1 commit into
resend:mainfrom
Abhishek-B-R:fix/email-type-missing-fields
Open

Abhishek-B-R wants to merge 1 commit into
resend:mainfrom
Abhishek-B-R:fix/email-type-missing-fields

Conversation

@Abhishek-B-R

@Abhishek-B-R Abhishek-B-R commented Dec 6, 2026 •

Copy link
Copy Markdown

The retrieve email response documents object, scheduled_at and tags, but the Email type has none of them. Under mypy --strict this fails even though the API returns the keys:

email = resend.Emails.get(email_id="4ef9a417-02e9-4d39-ad75-9611e0fcc33c")
email["scheduled_at"]  # TypedDict "Email" has no key "scheduled_at"
email["tags"]          # TypedDict "Email" has no key "tags"

I added the three keys to Email as NotRequired, since the list endpoint returns the same shape without object and tags. scheduled_at is Optional[str] because the docs example returns null for unscheduled emails.

Checked against https://resend.com/docs/api-reference/emails/retrieve-email and https://resend.com/docs/api-reference/emails/list-emails.

I extended test_email_get to read the three keys. On main, mypy on tests/ reports three TypedDict "Email" has no key errors for it. With the change that is gone and the full suite passes (905 tests). flake8, black and isort are clean on the files I touched. mypy still reports 7 unused type: ignore errors in other test files, which are the same on main.


Summary by cubic

Adds the object, scheduled_at, and tags fields to the Email type so mypy --strict no longer rejects accessing them, matching the retrieve email API response. The fields are NotRequired since the list endpoint omits object and tags, and scheduled_at is Optional[str] since unscheduled emails return null. Tests now read the three keys.

Written for commit 401f997. Summary will update on new commits.

View guided diff

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.

1 participant