fix(templates): add version fields to the template type
MA
1d ago+87+87+01234567890123456789-1-1-0123456789
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 optionalTemplatefields, so code that builds aTemplatedict still type-checks. TemplateListItemis 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 mypyandtox -e pypass (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 optionalTemplatefields, soTemplatedict literals still type-check. TemplateListItemstays unchanged since the list response doesn't include these fields.- Bumps the version to
2.54.1and adds sync and async tests covering both fields.