diff --git a/examples/domains.py b/examples/domains.py index 9ed0d3a..119d6fb 100644 --- a/examples/domains.py +++ b/examples/domains.py @@ -15,8 +15,6 @@ print(domain) retrieved: resend.Domain = resend.Domains.get(domain_id=domain["id"]) -print(retrieved) - if retrieved["records"] is not None: for record in retrieved["records"]: print(record) @@ -25,6 +23,7 @@ "id": domain["id"], "open_tracking": True, "click_tracking": True, + "tls": "enforced", } updated_domain: resend.Domain = resend.Domains.update(update_params) diff --git a/resend/domains/_domains.py b/resend/domains/_domains.py index 689899a..83425f5 100644 --- a/resend/domains/_domains.py +++ b/resend/domains/_domains.py @@ -1,10 +1,12 @@ from typing import Any, Dict, List, cast -from typing_extensions import NotRequired, TypedDict +from typing_extensions import Literal, NotRequired, TypedDict from resend import request from resend.domains._domain import Domain +TlsOptions = Literal["enforced", "opportunistic"] + class _ListResponse(TypedDict): data: List[Domain] @@ -36,6 +38,17 @@ class UpdateParams(TypedDict): """ Track the open rate of each email. """ + tls: NotRequired[TlsOptions] + """ + default: "opportunistic" + opportunistic: Opportunistic TLS means that it always attempts to make a + secure connection to the receiving mail server. + If it can't establish a secure connection, it sends the message unencrypted. + + enforced: Enforced TLS on the other hand, requires that the email + communication must use TLS no matter what. + If the receiving server does not support TLS, the email will not be sent. + """ class CreateParams(TypedDict): name: str diff --git a/resend/version.py b/resend/version.py index 3763972..61eca4f 100644 --- a/resend/version.py +++ b/resend/version.py @@ -1,4 +1,4 @@ -__version__ = "2.0.0" +__version__ = "2.1.0" def get_version() -> str: diff --git a/tests/domains_test.py b/tests/domains_test.py index 814b887..3204b2d 100644 --- a/tests/domains_test.py +++ b/tests/domains_test.py @@ -184,6 +184,7 @@ def test_domains_update(self) -> None: "id": "479e3145-dd38-476b-932c-529ceb705947", "open_tracking": True, "click_tracking": True, + "tls": "opportunistic", } domain = resend.Domains.update(params) assert domain["id"] == "479e3145-dd38-476b-932c-529ceb705947"