Skip to content

Commit 4704263

Browse files
committed
doc: small tweak
1 parent 7e4fbeb commit 4704263

12 files changed

Lines changed: 39 additions & 26 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ params: resend.Emails.SendParams = {
5252
],
5353
}
5454

55-
email: resend.Email = resend.Emails.send(params)
55+
email: resend.Emails.SendResponse = resend.Emails.send(params)
5656
print(email)
5757
```

examples/scheduled_email.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# Here is an example on how to create a date in the ISO 8601 format:
2020
# from datetime import datetime
2121
# datetime.now().isoformat()
22-
email: resend.Email = resend.Emails.send(params)
22+
email: resend.Emails.SendResponse = resend.Emails.send(params)
2323

2424
print(f"Email scheduled: {email['id']}")
2525

examples/simple_email.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121

2222

2323
# Without Idempotency Key
24-
email_non_idempotent: resend.Email = resend.Emails.send(params)
24+
email_non_idempotent: resend.Emails.SendResponse = resend.Emails.send(params)
2525
print(f"Sent email without idempotency key: {email_non_idempotent['id']}")
2626

2727
# With Idempotency Key
2828
options: resend.Emails.SendOptions = {
2929
"idempotency_key": "44",
3030
}
31-
email_idempotent: resend.Email = resend.Emails.send(params, options)
31+
email_idempotent: resend.Emails.SendResponse = resend.Emails.send(params, options)
3232
print(f"Sent email with idempotency key: {email_idempotent['id']}")
3333

3434
email_resp: resend.Email = resend.Emails.get(email_id=email_non_idempotent["id"])

examples/with_attachments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@
2727
"attachments": [attachment],
2828
}
2929

30-
email: resend.Email = resend.Emails.send(params)
30+
email: resend.Emails.SendResponse = resend.Emails.send(params)
3131
print("Sent email with attachment")
3232
print(email)

examples/with_b64_attachments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
}
2929

3030
# Send email
31-
email: resend.Email = resend.Emails.send(params)
31+
email: resend.Emails.SendResponse = resend.Emails.send(params)
3232
print("Email sent with base64 string attachment")
3333
print(email)

examples/with_custom_http_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,5 @@ def request(
5858
}
5959

6060

61-
email: resend.Email = resend.Emails.send(params)
61+
email: resend.Emails.SendResponse = resend.Emails.send(params)
6262
print(f"{email}")

examples/with_exception.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
}
1515

1616
try:
17-
email: resend.Email = resend.Emails.send(params)
17+
email: resend.Emails.SendResponse = resend.Emails.send(params)
1818
except resend.exceptions.ResendError as e:
1919
print(f"Error sending email: {e}")

examples/with_html_file_as_b64_attachment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
}
2929

3030
# Send email
31-
email: resend.Email = resend.Emails.send(params)
31+
email: resend.Emails.SendResponse = resend.Emails.send(params)
3232
print("Sent email with base64 string attachment")
3333
print("Email ID: ", email["id"])

examples/with_inline_attachments.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"attachments": [local_attachment],
2828
}
2929

30-
local_email: resend.Email = resend.Emails.send(local_params)
30+
local_email: resend.Emails.SendResponse = resend.Emails.send(local_params)
3131
print("Sent email with local inline attachment")
3232
print(local_email)
3333

@@ -46,6 +46,6 @@
4646
"attachments": [remote_attachment],
4747
}
4848

49-
remote_email: resend.Email = resend.Emails.send(remote_params)
49+
remote_email: resend.Emails.SendResponse = resend.Emails.send(remote_params)
5050
print("Sent email with remote inline attachment")
5151
print(remote_email)

resend/emails/_batch.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ class SendEmailResponse(TypedDict):
1717
class Batch:
1818

1919
class SendOptions(TypedDict):
20-
idempotency_key: NotRequired[str]
2120
"""
2221
SendOptions is the class that wraps the options for the batch send method.
2322
@@ -27,6 +26,13 @@ class SendOptions(TypedDict):
2726
If provided, will be sent as the `Idempotency-Key` header.
2827
"""
2928

29+
idempotency_key: NotRequired[str]
30+
"""
31+
Unique key that ensures the same operation is not processed multiple times.
32+
Allows for safe retries without duplicating operations.
33+
If provided, will be sent as the `Idempotency-Key` header.
34+
"""
35+
3036
class SendResponse(TypedDict):
3137
data: List[SendEmailResponse]
3238
"""

0 commit comments

Comments
 (0)