Skip to content

fix(templates): add version fields to the template type - #323

Open
mayankbohradev wants to merge 1 commit into
resend:mainfrom
mayankbohradev:fix/template-version-fields
Open

mayankbohradev wants to merge 1 commit into
resend:mainfrom
mayankbohradev:fix/template-version-fields

Conversation

@mayankbohradev

@mayankbohradev mayankbohradev commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds current_version_id and has_unpublished_versions to the Template type.

Why

The retrieve template response contains both fields, and the SDK already returns them. The type did not declare them, so mypy reported template["has_unpublished_versions"] as an error.

How

  • Both keys are NotRequired, like the other optional Template fields, so code that builds a Template dict still type-checks.
  • TemplateListItem is unchanged, because the list response does not contain these fields.
  • No runtime change.

Testing

  • Before the change, mypy reported 12 errors on the new tests.
  • tox -e lint, tox -e mypy and tox -e py pass (868 tests).
  • New sync and async tests read both fields from the documented response.

Notes for reviewers

#321 and #322 also change resend/version.py; I can rebase whichever merges later.


Summary by cubic

Adds current_version_id and has_unpublished_versions to the Template type so code reading the documented retrieve template response type-checks under mypy.

  • Both fields are NotRequired, matching the other optional Template fields, so Template dict literals still type-check.
  • TemplateListItem stays unchanged since the list response doesn't include these fields.
  • Bumps the version to 2.54.1 and adds sync and async tests covering both fields.

Written for commit e6e88a1. Summary will update on new commits.

View guided diff

The retrieve template response contains `current_version_id` and
`has_unpublished_versions`. The SDK already returns them, but the
`Template` type did not declare them, so mypy reported a documented
key lookup as an error.

- Add `current_version_id` and `has_unpublished_versions` to `Template`.

Tested with tox lint, mypy and py (868 passed).
@github-actions github-actions Bot added the linear-synced PR has been synced to Linear label Nov 19, 2026

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

linear-synced PR has been synced to Linear

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant