resend 2.52.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. resend/__init__.py +365 -0
  2. resend/_base_response.py +16 -0
  3. resend/api_keys/__init__.py +0 -0
  4. resend/api_keys/_api_key.py +22 -0
  5. resend/api_keys/_api_keys.py +301 -0
  6. resend/api_keys/py.typed +0 -0
  7. resend/async_request.py +179 -0
  8. resend/audiences/__init__.py +0 -0
  9. resend/audiences/_audience.py +16 -0
  10. resend/audiences/_audiences.py +285 -0
  11. resend/audiences/py.typed +0 -0
  12. resend/automations/__init__.py +27 -0
  13. resend/automations/_automation.py +299 -0
  14. resend/automations/_automations.py +665 -0
  15. resend/broadcasts/__init__.py +0 -0
  16. resend/broadcasts/_broadcast.py +77 -0
  17. resend/broadcasts/_broadcast_recipient.py +80 -0
  18. resend/broadcasts/_broadcasts.py +829 -0
  19. resend/broadcasts/_clicked_link.py +21 -0
  20. resend/broadcasts/py.typed +0 -0
  21. resend/contact_properties/__init__.py +0 -0
  22. resend/contact_properties/_contact_properties.py +362 -0
  23. resend/contact_properties/_contact_property.py +43 -0
  24. resend/contacts/__init__.py +4 -0
  25. resend/contacts/_contact.py +45 -0
  26. resend/contacts/_contact_topic.py +49 -0
  27. resend/contacts/_contacts.py +567 -0
  28. resend/contacts/_topics.py +257 -0
  29. resend/contacts/imports/__init__.py +4 -0
  30. resend/contacts/imports/_contact_import.py +44 -0
  31. resend/contacts/imports/_contact_imports.py +243 -0
  32. resend/contacts/py.typed +0 -0
  33. resend/contacts/segments/__init__.py +0 -0
  34. resend/contacts/segments/_contact_segment.py +16 -0
  35. resend/contacts/segments/_contact_segments.py +332 -0
  36. resend/contacts/segments/py.typed +0 -0
  37. resend/domains/__init__.py +0 -0
  38. resend/domains/_domain.py +48 -0
  39. resend/domains/_domains.py +400 -0
  40. resend/domains/_record.py +32 -0
  41. resend/domains/claims/__init__.py +4 -0
  42. resend/domains/claims/_domain_claim.py +70 -0
  43. resend/domains/claims/_domain_claims.py +162 -0
  44. resend/domains/py.typed +0 -0
  45. resend/emails/__init__.py +0 -0
  46. resend/emails/_attachment.py +52 -0
  47. resend/emails/_attachments.py +163 -0
  48. resend/emails/_batch.py +128 -0
  49. resend/emails/_email.py +78 -0
  50. resend/emails/_emails.py +795 -0
  51. resend/emails/_received_email.py +280 -0
  52. resend/emails/_receiving.py +338 -0
  53. resend/emails/_tag.py +18 -0
  54. resend/emails/py.typed +0 -0
  55. resend/events/__init__.py +11 -0
  56. resend/events/_event.py +88 -0
  57. resend/events/_events.py +451 -0
  58. resend/exceptions.py +292 -0
  59. resend/http_client.py +22 -0
  60. resend/http_client_async.py +22 -0
  61. resend/http_client_httpx.py +47 -0
  62. resend/http_client_requests.py +48 -0
  63. resend/inboxes/__init__.py +53 -0
  64. resend/inboxes/_inbox.py +117 -0
  65. resend/inboxes/_inboxes.py +431 -0
  66. resend/inboxes/_query.py +51 -0
  67. resend/inboxes/agent/__init__.py +0 -0
  68. resend/inboxes/agent/_inbox_agent.py +151 -0
  69. resend/inboxes/agent/_inbox_agent_settings.py +52 -0
  70. resend/inboxes/drafts/__init__.py +0 -0
  71. resend/inboxes/drafts/_inbox_draft.py +155 -0
  72. resend/inboxes/drafts/_inbox_drafts.py +699 -0
  73. resend/inboxes/labels/__init__.py +0 -0
  74. resend/inboxes/labels/_inbox_label.py +24 -0
  75. resend/inboxes/labels/_inbox_labels.py +309 -0
  76. resend/inboxes/threads/__init__.py +0 -0
  77. resend/inboxes/threads/_inbox_thread.py +137 -0
  78. resend/inboxes/threads/_inbox_threads.py +498 -0
  79. resend/inboxes/threads/emails/__init__.py +0 -0
  80. resend/inboxes/threads/emails/_inbox_thread_email.py +96 -0
  81. resend/inboxes/threads/emails/_inbox_thread_emails.py +540 -0
  82. resend/inboxes/threads/labels/__init__.py +0 -0
  83. resend/inboxes/threads/labels/_inbox_thread_labels.py +226 -0
  84. resend/logs/__init__.py +4 -0
  85. resend/logs/_log.py +38 -0
  86. resend/logs/_logs.py +193 -0
  87. resend/oauth_grants/__init__.py +4 -0
  88. resend/oauth_grants/_oauth_grant.py +45 -0
  89. resend/oauth_grants/_oauth_grants.py +165 -0
  90. resend/oauth_grants/py.typed +0 -0
  91. resend/pagination_helper.py +34 -0
  92. resend/py.typed +0 -0
  93. resend/request.py +164 -0
  94. resend/response.py +18 -0
  95. resend/segments/__init__.py +0 -0
  96. resend/segments/_segment.py +16 -0
  97. resend/segments/_segments.py +328 -0
  98. resend/segments/py.typed +0 -0
  99. resend/suppressions/__init__.py +14 -0
  100. resend/suppressions/_suppression.py +55 -0
  101. resend/suppressions/_suppressions.py +259 -0
  102. resend/suppressions/batch/__init__.py +4 -0
  103. resend/suppressions/batch/_suppressions_batch.py +187 -0
  104. resend/suppressions/py.typed +0 -0
  105. resend/templates/__init__.py +1 -0
  106. resend/templates/_template.py +133 -0
  107. resend/templates/_templates.py +465 -0
  108. resend/topics/__init__.py +0 -0
  109. resend/topics/_topic.py +24 -0
  110. resend/topics/_topics.py +329 -0
  111. resend/usage/__init__.py +19 -0
  112. resend/usage/_usage.py +331 -0
  113. resend/version.py +8 -0
  114. resend/webhooks/__init__.py +0 -0
  115. resend/webhooks/_webhook.py +143 -0
  116. resend/webhooks/_webhook_event.py +1181 -0
  117. resend/webhooks/_webhooks.py +830 -0
  118. resend-2.52.0.dist-info/METADATA +148 -0
  119. resend-2.52.0.dist-info/RECORD +122 -0
  120. resend-2.52.0.dist-info/WHEEL +5 -0
  121. resend-2.52.0.dist-info/licenses/LICENSE.md +22 -0
  122. resend-2.52.0.dist-info/top_level.txt +1 -0
resend/__init__.py ADDED
@@ -0,0 +1,365 @@
1
+ import os
2
+ from typing import Optional, Union
3
+
4
+ from .api_keys._api_key import ApiKey
5
+ from .api_keys._api_keys import ApiKeys
6
+ from .audiences._audience import Audience
7
+ from .audiences._audiences import Audiences
8
+ from .automations._automation import (Automation, AutomationConnection,
9
+ AutomationConnectionType,
10
+ AutomationListItem,
11
+ AutomationResponseStep, AutomationRun,
12
+ AutomationRunListItem,
13
+ AutomationRunStatus, AutomationRunStep,
14
+ AutomationStatus, AutomationStep,
15
+ AutomationStepType)
16
+ from .automations._automations import Automations
17
+ from .broadcasts._broadcast import Broadcast
18
+ from .broadcasts._broadcast_recipient import (BroadcastRecipient,
19
+ BroadcastRecipientBounceType,
20
+ BroadcastRecipientClickedLink,
21
+ BroadcastRecipientEventType)
22
+ from .broadcasts._broadcasts import Broadcasts
23
+ from .broadcasts._clicked_link import ClickedLink
24
+ from .contact_properties._contact_properties import ContactProperties
25
+ from .contact_properties._contact_property import ContactProperty
26
+ from .contacts._contact import Contact
27
+ from .contacts._contact_topic import ContactTopic, TopicSubscriptionUpdate
28
+ from .contacts._contacts import Contacts
29
+ from .contacts._topics import Topics as ContactsTopics
30
+ from .contacts.imports._contact_import import (ContactImport,
31
+ ContactImportCounts)
32
+ from .contacts.imports._contact_imports import ContactImports
33
+ from .contacts.segments._contact_segment import ContactSegment
34
+ from .contacts.segments._contact_segments import ContactSegments
35
+ from .domains._domain import Domain
36
+ from .domains._domains import Domains
37
+ from .domains.claims._domain_claim import DomainClaim, DomainClaimRecord
38
+ from .domains.claims._domain_claims import DomainClaims
39
+ from .emails._attachment import Attachment, RemoteAttachment
40
+ from .emails._attachments import Attachments as EmailAttachments
41
+ from .emails._batch import Batch, BatchValidationError
42
+ from .emails._email import Email
43
+ from .emails._emails import Emails, EmailTemplate
44
+ from .emails._received_email import (AttachmentWithSignedUrl, EmailAttachment,
45
+ EmailAttachmentDetails, ListReceivedEmail,
46
+ ReceivedEmail)
47
+ from .emails._receiving import Receiving as EmailsReceiving
48
+ from .emails._tag import Tag
49
+ from .events._event import (Event, EventListItem, EventSchema,
50
+ EventSchemaFieldType)
51
+ from .events._events import Events
52
+ from .http_client import HTTPClient
53
+ from .http_client_async import \
54
+ AsyncHTTPClient # Okay to import AsyncHTTPClient since it is just an interface.
55
+ from .http_client_requests import RequestsClient
56
+ from .inboxes._inbox import (Inbox, InboxListItem, InboxMessageFolder,
57
+ MoveThreadFolder)
58
+ from .inboxes._inboxes import Inboxes
59
+ from .inboxes.agent._inbox_agent import InboxAgent
60
+ from .inboxes.agent._inbox_agent_settings import (InboxAgentAction,
61
+ InboxAgentSettings,
62
+ InboxAgentTone)
63
+ from .inboxes.drafts._inbox_draft import (InboxDraft, InboxDraftAttachment,
64
+ InboxDraftListItem, InboxDraftType)
65
+ from .inboxes.drafts._inbox_drafts import InboxDrafts
66
+ from .inboxes.labels._inbox_label import InboxLabel
67
+ from .inboxes.labels._inbox_labels import InboxLabels
68
+ from .inboxes.threads._inbox_thread import (InboxThread, InboxThreadLabel,
69
+ InboxThreadSearchResult,
70
+ InboxThreadSummary)
71
+ from .inboxes.threads._inbox_threads import InboxThreads
72
+ from .inboxes.threads.emails._inbox_thread_email import (
73
+ InboxThreadEmail, InboxThreadEmailAttachment)
74
+ from .inboxes.threads.emails._inbox_thread_emails import InboxThreadEmails
75
+ from .inboxes.threads.labels._inbox_thread_labels import InboxThreadLabels
76
+ from .logs._log import Log
77
+ from .logs._logs import Logs
78
+ from .oauth_grants._oauth_grant import OAuthGrant, OAuthGrantClient
79
+ from .oauth_grants._oauth_grants import OAuthGrants
80
+ from .request import Request
81
+ from .segments._segment import Segment
82
+ from .segments._segments import Segments
83
+ from .suppressions._suppression import (Suppression, SuppressionListItem,
84
+ SuppressionOrigin)
85
+ from .suppressions._suppressions import Suppressions
86
+ from .suppressions.batch._suppressions_batch import (BatchRemovedSuppression,
87
+ BatchSuppression,
88
+ SuppressionsBatch)
89
+ from .templates._template import Template, TemplateListItem, Variable
90
+ from .templates._templates import Templates
91
+ from .topics._topic import Topic
92
+ from .topics._topics import Topics
93
+ from .usage._usage import (AiCreditsUsage, AutomationRunsUsage,
94
+ BroadcastsUsage, ContactsUsage, DomainsUsage,
95
+ EmailsDailyUsage, EmailsMonthlyUsage, EmailsUsage,
96
+ RateLimitUsage, SegmentsUsage, Usage)
97
+ from .version import __version__, get_version
98
+ from .webhooks._webhook import (VerifyWebhookOptions, Webhook, WebhookEvent,
99
+ WebhookHeaders, WebhookStatus)
100
+ from .webhooks._webhook_event import (BaseEmailEventData, ContactCreatedEvent,
101
+ ContactDeletedEvent, ContactEventData,
102
+ ContactTopicsEventData,
103
+ ContactTopicSubscription,
104
+ ContactTopicsUpdatedEvent,
105
+ ContactUpdatedEvent, DomainCreatedEvent,
106
+ DomainDeletedEvent, DomainEventData,
107
+ DomainUpdatedEvent, EmailBouncedEvent,
108
+ EmailClickedEvent, EmailComplainedEvent,
109
+ EmailDeliveredEvent,
110
+ EmailDeliveryDelayedEvent,
111
+ EmailFailedEvent, EmailOpenedEvent,
112
+ EmailReceivedEvent, EmailScheduledEvent,
113
+ EmailSentEvent, EmailSuppressedEvent,
114
+ InboxCreatedEvent, InboxDeletedEvent,
115
+ InboxDeletedEventData,
116
+ InboxDraftCreatedEvent,
117
+ InboxDraftDeletedEvent,
118
+ InboxDraftEventData, InboxDraftSentEvent,
119
+ InboxDraftSentEventData,
120
+ InboxDraftUpdatedEvent,
121
+ InboxEmailReceivedEvent,
122
+ InboxEmailSentEvent, InboxEventData,
123
+ InboxEventDraft, InboxEventEmail,
124
+ InboxEventEmailAttachment,
125
+ InboxEventSource,
126
+ InboxThreadAssignedEvent,
127
+ InboxThreadAssignedEventData,
128
+ InboxThreadCreatedEvent,
129
+ InboxThreadEmailEventData,
130
+ InboxThreadFolderUpdatedEvent,
131
+ InboxThreadFolderUpdatedEventData,
132
+ InboxThreadLabelsUpdatedEvent,
133
+ InboxThreadLabelsUpdatedEventData,
134
+ InboxThreadUnassignedEvent,
135
+ InboxThreadUnassignedEventData,
136
+ InboxUpdatedEvent,
137
+ ReceivedEmailEventData,
138
+ SuppressionAddedEvent,
139
+ SuppressionEventData,
140
+ SuppressionRemovedEvent,
141
+ TopicCreatedEvent, TopicDeletedEvent,
142
+ TopicEventData, TopicUpdatedEvent,
143
+ WebhookEventPayload)
144
+ from .webhooks._webhooks import Webhooks
145
+
146
+ # Type for clients that support both sync and async
147
+ ResendHTTPClient = Union[HTTPClient, AsyncHTTPClient]
148
+
149
+ # Sync HTTP client — always set, can be overridden with a custom HTTPClient.
150
+ default_http_client: ResendHTTPClient = RequestsClient()
151
+
152
+ # Async HTTP client — auto-detected if httpx is installed, can be overridden
153
+ # with any AsyncHTTPClient subclass. Set to None if no async library is available.
154
+ default_async_http_client: Optional[AsyncHTTPClient] = None
155
+ _auto_async_http_client: Optional[AsyncHTTPClient] = None
156
+
157
+ # Config vars
158
+ api_key = os.environ.get("RESEND_API_KEY")
159
+ api_url = os.environ.get("RESEND_API_URL", "https://api.resend.com")
160
+
161
+
162
+ __all__ = [
163
+ "__version__",
164
+ "get_version",
165
+ "Request",
166
+ "Emails",
167
+ "ApiKeys",
168
+ "Domains",
169
+ "DomainClaims",
170
+ "Batch",
171
+ "Audiences",
172
+ "Automations",
173
+ "Contacts",
174
+ "ContactImports",
175
+ "ContactProperties",
176
+ "Broadcasts",
177
+ "Events",
178
+ "Segments",
179
+ "Templates",
180
+ "Webhooks",
181
+ "Topics",
182
+ "Logs",
183
+ "OAuthGrants",
184
+ "Suppressions",
185
+ "SuppressionsBatch",
186
+ "Usage",
187
+ "Inboxes",
188
+ "InboxAgent",
189
+ "InboxLabels",
190
+ "InboxThreads",
191
+ "InboxThreadEmails",
192
+ "InboxThreadLabels",
193
+ "InboxDrafts",
194
+ # Types
195
+ "Audience",
196
+ "Automation",
197
+ "AutomationConnection",
198
+ "AutomationConnectionType",
199
+ "AutomationListItem",
200
+ "AutomationResponseStep",
201
+ "AutomationRun",
202
+ "AutomationRunListItem",
203
+ "AutomationRunStatus",
204
+ "AutomationRunStep",
205
+ "AutomationStatus",
206
+ "AutomationStep",
207
+ "AutomationStepType",
208
+ "Event",
209
+ "EventListItem",
210
+ "EventSchema",
211
+ "EventSchemaFieldType",
212
+ "Contact",
213
+ "ContactImport",
214
+ "ContactImportCounts",
215
+ "ContactSegment",
216
+ "ContactSegments",
217
+ "ContactProperty",
218
+ "ContactTopic",
219
+ "TopicSubscriptionUpdate",
220
+ "Domain",
221
+ "DomainClaim",
222
+ "DomainClaimRecord",
223
+ "ApiKey",
224
+ "Log",
225
+ "Email",
226
+ "Attachment",
227
+ "RemoteAttachment",
228
+ "EmailTemplate",
229
+ "Tag",
230
+ "Broadcast",
231
+ "ClickedLink",
232
+ "BroadcastRecipient",
233
+ "BroadcastRecipientBounceType",
234
+ "BroadcastRecipientClickedLink",
235
+ "BroadcastRecipientEventType",
236
+ "Segment",
237
+ "Suppression",
238
+ "SuppressionListItem",
239
+ "SuppressionOrigin",
240
+ "BatchSuppression",
241
+ "BatchRemovedSuppression",
242
+ "Template",
243
+ "TemplateListItem",
244
+ "Variable",
245
+ "Webhook",
246
+ "WebhookEvent",
247
+ "WebhookEventPayload",
248
+ "WebhookHeaders",
249
+ "WebhookStatus",
250
+ "VerifyWebhookOptions",
251
+ "BaseEmailEventData",
252
+ "ReceivedEmailEventData",
253
+ "ContactEventData",
254
+ "DomainEventData",
255
+ "EmailSentEvent",
256
+ "EmailScheduledEvent",
257
+ "EmailDeliveredEvent",
258
+ "EmailDeliveryDelayedEvent",
259
+ "EmailComplainedEvent",
260
+ "EmailBouncedEvent",
261
+ "EmailOpenedEvent",
262
+ "EmailClickedEvent",
263
+ "EmailReceivedEvent",
264
+ "EmailFailedEvent",
265
+ "EmailSuppressedEvent",
266
+ "ContactCreatedEvent",
267
+ "ContactUpdatedEvent",
268
+ "ContactDeletedEvent",
269
+ "ContactTopicsEventData",
270
+ "ContactTopicsUpdatedEvent",
271
+ "ContactTopicSubscription",
272
+ "DomainCreatedEvent",
273
+ "DomainUpdatedEvent",
274
+ "DomainDeletedEvent",
275
+ "SuppressionEventData",
276
+ "SuppressionAddedEvent",
277
+ "SuppressionRemovedEvent",
278
+ "TopicEventData",
279
+ "TopicCreatedEvent",
280
+ "TopicUpdatedEvent",
281
+ "TopicDeletedEvent",
282
+ "InboxEventSource",
283
+ "InboxEventEmail",
284
+ "InboxEventEmailAttachment",
285
+ "InboxEventDraft",
286
+ "InboxEventData",
287
+ "InboxDeletedEventData",
288
+ "InboxThreadEmailEventData",
289
+ "InboxThreadFolderUpdatedEventData",
290
+ "InboxThreadAssignedEventData",
291
+ "InboxThreadUnassignedEventData",
292
+ "InboxThreadLabelsUpdatedEventData",
293
+ "InboxDraftEventData",
294
+ "InboxDraftSentEventData",
295
+ "InboxCreatedEvent",
296
+ "InboxUpdatedEvent",
297
+ "InboxDeletedEvent",
298
+ "InboxThreadCreatedEvent",
299
+ "InboxEmailReceivedEvent",
300
+ "InboxEmailSentEvent",
301
+ "InboxThreadFolderUpdatedEvent",
302
+ "InboxThreadAssignedEvent",
303
+ "InboxThreadUnassignedEvent",
304
+ "InboxThreadLabelsUpdatedEvent",
305
+ "InboxDraftCreatedEvent",
306
+ "InboxDraftUpdatedEvent",
307
+ "InboxDraftSentEvent",
308
+ "InboxDraftDeletedEvent",
309
+ "Inbox",
310
+ "InboxListItem",
311
+ "InboxMessageFolder",
312
+ "MoveThreadFolder",
313
+ "InboxAgentAction",
314
+ "InboxAgentSettings",
315
+ "InboxAgentTone",
316
+ "InboxLabel",
317
+ "InboxThread",
318
+ "InboxThreadLabel",
319
+ "InboxThreadSearchResult",
320
+ "InboxThreadSummary",
321
+ "InboxThreadEmail",
322
+ "InboxThreadEmailAttachment",
323
+ "InboxDraft",
324
+ "InboxDraftAttachment",
325
+ "InboxDraftListItem",
326
+ "InboxDraftType",
327
+ "Topic",
328
+ "OAuthGrant",
329
+ "OAuthGrantClient",
330
+ "BatchValidationError",
331
+ "ReceivedEmail",
332
+ "EmailAttachment",
333
+ "AttachmentWithSignedUrl",
334
+ "EmailAttachmentDetails",
335
+ "ListReceivedEmail",
336
+ # Receiving types (for type hints)
337
+ "EmailsReceiving",
338
+ "EmailAttachments",
339
+ "ContactsTopics",
340
+ "EmailsUsage",
341
+ "EmailsDailyUsage",
342
+ "EmailsMonthlyUsage",
343
+ "ContactsUsage",
344
+ "SegmentsUsage",
345
+ "BroadcastsUsage",
346
+ "AiCreditsUsage",
347
+ "AutomationRunsUsage",
348
+ "DomainsUsage",
349
+ "RateLimitUsage",
350
+ # HTTP Clients
351
+ "HTTPClient",
352
+ # Default HTTP Client
353
+ "RequestsClient",
354
+ ]
355
+
356
+ # Add async exports and auto-detect async client if httpx is available
357
+ try:
358
+ from .async_request import AsyncRequest # noqa: F401
359
+ from .http_client_httpx import HTTPXClient # noqa: F401
360
+
361
+ _auto_async_http_client = HTTPXClient()
362
+ default_async_http_client = _auto_async_http_client
363
+ __all__.extend(["AsyncHTTPClient", "HTTPXClient", "AsyncRequest"])
364
+ except ImportError:
365
+ pass
@@ -0,0 +1,16 @@
1
+ """Base response type for all Resend API responses."""
2
+
3
+ from typing import Dict
4
+
5
+ from typing_extensions import NotRequired, TypedDict
6
+
7
+
8
+ class BaseResponse(TypedDict):
9
+ """Base response type that all API responses inherit from.
10
+
11
+ Attributes:
12
+ http_headers: HTTP response headers including rate limit info, request IDs, etc.
13
+ Optional field that may not be present in all responses.
14
+ """
15
+
16
+ http_headers: NotRequired[Dict[str, str]]
File without changes
@@ -0,0 +1,22 @@
1
+ from typing import Optional
2
+
3
+ from typing_extensions import TypedDict
4
+
5
+
6
+ class ApiKey(TypedDict):
7
+ id: str
8
+ """
9
+ The API key ID
10
+ """
11
+ name: str
12
+ """
13
+ The API key name
14
+ """
15
+ created_at: str
16
+ """
17
+ The API key creation date
18
+ """
19
+ last_used_at: Optional[str]
20
+ """
21
+ The date and time the API key was last used, or None if never used
22
+ """