sendio 1.0.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 (104) hide show
  1. sendio/__init__.py +302 -0
  2. sendio/_base_response.py +16 -0
  3. sendio/api_keys/__init__.py +0 -0
  4. sendio/api_keys/_api_key.py +22 -0
  5. sendio/api_keys/_api_keys.py +301 -0
  6. sendio/api_keys/py.typed +0 -0
  7. sendio/async_request.py +179 -0
  8. sendio/audiences/__init__.py +0 -0
  9. sendio/audiences/_audience.py +16 -0
  10. sendio/audiences/_audiences.py +285 -0
  11. sendio/audiences/py.typed +0 -0
  12. sendio/automations/__init__.py +47 -0
  13. sendio/automations/_automation.py +365 -0
  14. sendio/automations/_automation_template.py +236 -0
  15. sendio/automations/_automations.py +961 -0
  16. sendio/broadcasts/__init__.py +0 -0
  17. sendio/broadcasts/_broadcast.py +121 -0
  18. sendio/broadcasts/_broadcast_recipient.py +80 -0
  19. sendio/broadcasts/_broadcast_version.py +56 -0
  20. sendio/broadcasts/_broadcasts.py +1304 -0
  21. sendio/broadcasts/_clicked_link.py +21 -0
  22. sendio/broadcasts/py.typed +0 -0
  23. sendio/contact_properties/__init__.py +0 -0
  24. sendio/contact_properties/_contact_properties.py +362 -0
  25. sendio/contact_properties/_contact_property.py +43 -0
  26. sendio/contacts/__init__.py +4 -0
  27. sendio/contacts/_contact.py +45 -0
  28. sendio/contacts/_contact_topic.py +49 -0
  29. sendio/contacts/_contacts.py +567 -0
  30. sendio/contacts/_topics.py +257 -0
  31. sendio/contacts/imports/__init__.py +4 -0
  32. sendio/contacts/imports/_contact_import.py +44 -0
  33. sendio/contacts/imports/_contact_imports.py +243 -0
  34. sendio/contacts/py.typed +0 -0
  35. sendio/contacts/segments/__init__.py +0 -0
  36. sendio/contacts/segments/_contact_segment.py +16 -0
  37. sendio/contacts/segments/_contact_segments.py +332 -0
  38. sendio/contacts/segments/py.typed +0 -0
  39. sendio/domains/__init__.py +0 -0
  40. sendio/domains/_domain.py +77 -0
  41. sendio/domains/_domains.py +416 -0
  42. sendio/domains/_record.py +41 -0
  43. sendio/domains/py.typed +0 -0
  44. sendio/emails/__init__.py +0 -0
  45. sendio/emails/_attachment.py +52 -0
  46. sendio/emails/_attachments.py +163 -0
  47. sendio/emails/_batch.py +128 -0
  48. sendio/emails/_email.py +78 -0
  49. sendio/emails/_emails.py +795 -0
  50. sendio/emails/_received_email.py +280 -0
  51. sendio/emails/_receiving.py +338 -0
  52. sendio/emails/_tag.py +18 -0
  53. sendio/emails/py.typed +0 -0
  54. sendio/events/__init__.py +11 -0
  55. sendio/events/_event.py +88 -0
  56. sendio/events/_events.py +451 -0
  57. sendio/exceptions.py +322 -0
  58. sendio/http_client.py +22 -0
  59. sendio/http_client_async.py +22 -0
  60. sendio/http_client_httpx.py +47 -0
  61. sendio/http_client_requests.py +48 -0
  62. sendio/logs/__init__.py +4 -0
  63. sendio/logs/_log.py +38 -0
  64. sendio/logs/_logs.py +193 -0
  65. sendio/mailboxes/__init__.py +14 -0
  66. sendio/mailboxes/_mailbox.py +131 -0
  67. sendio/mailboxes/_mailboxes.py +332 -0
  68. sendio/oauth_grants/__init__.py +4 -0
  69. sendio/oauth_grants/_oauth_grant.py +45 -0
  70. sendio/oauth_grants/_oauth_grants.py +165 -0
  71. sendio/oauth_grants/py.typed +0 -0
  72. sendio/pagination_helper.py +34 -0
  73. sendio/py.typed +0 -0
  74. sendio/request.py +164 -0
  75. sendio/response.py +18 -0
  76. sendio/segments/__init__.py +0 -0
  77. sendio/segments/_segment.py +16 -0
  78. sendio/segments/_segments.py +328 -0
  79. sendio/segments/py.typed +0 -0
  80. sendio/suppressions/__init__.py +14 -0
  81. sendio/suppressions/_suppression.py +55 -0
  82. sendio/suppressions/_suppressions.py +259 -0
  83. sendio/suppressions/batch/__init__.py +4 -0
  84. sendio/suppressions/batch/_suppressions_batch.py +187 -0
  85. sendio/suppressions/py.typed +0 -0
  86. sendio/templates/__init__.py +1 -0
  87. sendio/templates/_template.py +133 -0
  88. sendio/templates/_templates.py +465 -0
  89. sendio/topics/__init__.py +0 -0
  90. sendio/topics/_topic.py +24 -0
  91. sendio/topics/_topics.py +329 -0
  92. sendio/usage/__init__.py +19 -0
  93. sendio/usage/_usage.py +331 -0
  94. sendio/version.py +8 -0
  95. sendio/webhooks/__init__.py +0 -0
  96. sendio/webhooks/_webhook.py +128 -0
  97. sendio/webhooks/_webhook_event.py +643 -0
  98. sendio/webhooks/_webhooks.py +830 -0
  99. sendio-1.0.0.dist-info/METADATA +281 -0
  100. sendio-1.0.0.dist-info/RECORD +104 -0
  101. sendio-1.0.0.dist-info/WHEEL +5 -0
  102. sendio-1.0.0.dist-info/licenses/LICENSE.md +23 -0
  103. sendio-1.0.0.dist-info/licenses/NOTICE +2 -0
  104. sendio-1.0.0.dist-info/top_level.txt +1 -0
sendio/__init__.py ADDED
@@ -0,0 +1,302 @@
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, WebhookFormField,
16
+ WebhookHeader, WebhookStepConfig)
17
+ from .automations._automation_template import (AutomationEmail,
18
+ AutomationTemplate,
19
+ AutomationTemplateCategory,
20
+ AutomationTemplateDetail,
21
+ AutomationTemplateEmail,
22
+ AutomationTemplateEvent,
23
+ AutomationTemplateEventDetail,
24
+ AutomationTemplateKind,
25
+ AutomationTemplateParam,
26
+ AutomationTemplateStep)
27
+ from .automations._automations import Automations
28
+ from .broadcasts._broadcast import Broadcast
29
+ from .broadcasts._broadcast_recipient import (BroadcastRecipient,
30
+ BroadcastRecipientBounceType,
31
+ BroadcastRecipientClickedLink,
32
+ BroadcastRecipientEventType)
33
+ from .broadcasts._broadcast_version import BroadcastVersion
34
+ from .broadcasts._broadcasts import Broadcasts
35
+ from .broadcasts._clicked_link import ClickedLink
36
+ from .contact_properties._contact_properties import ContactProperties
37
+ from .contact_properties._contact_property import ContactProperty
38
+ from .contacts._contact import Contact
39
+ from .contacts._contact_topic import ContactTopic, TopicSubscriptionUpdate
40
+ from .contacts._contacts import Contacts
41
+ from .contacts._topics import Topics as ContactsTopics
42
+ from .contacts.imports._contact_import import (ContactImport,
43
+ ContactImportCounts)
44
+ from .contacts.imports._contact_imports import ContactImports
45
+ from .contacts.segments._contact_segment import ContactSegment
46
+ from .contacts.segments._contact_segments import ContactSegments
47
+ from .domains._domain import Domain, DomainCapabilities, DomainCapabilityStatus
48
+ from .domains._domains import Domains
49
+ from .emails._attachment import Attachment, RemoteAttachment
50
+ from .emails._attachments import Attachments as EmailAttachments
51
+ from .emails._batch import Batch, BatchValidationError
52
+ from .emails._email import Email
53
+ from .emails._emails import Emails, EmailTemplate
54
+ from .emails._received_email import (AttachmentWithSignedUrl, EmailAttachment,
55
+ EmailAttachmentDetails, ListReceivedEmail,
56
+ ReceivedEmail)
57
+ from .emails._receiving import Receiving as EmailsReceiving
58
+ from .emails._tag import Tag
59
+ from .events._event import (Event, EventListItem, EventSchema,
60
+ EventSchemaFieldType)
61
+ from .events._events import Events
62
+ from .http_client import HTTPClient
63
+ from .http_client_async import \
64
+ AsyncHTTPClient # Okay to import AsyncHTTPClient since it is just an interface.
65
+ from .http_client_requests import RequestsClient
66
+ from .logs._log import Log
67
+ from .logs._logs import Logs
68
+ from .mailboxes._mailbox import (Mailbox, MailboxCredentials, MailboxHealth,
69
+ MailboxImapSmtpStatus, MailboxKind,
70
+ MailboxServer)
71
+ from .mailboxes._mailboxes import Mailboxes
72
+ from .oauth_grants._oauth_grant import OAuthGrant, OAuthGrantClient
73
+ from .oauth_grants._oauth_grants import OAuthGrants
74
+ from .request import Request
75
+ from .segments._segment import Segment
76
+ from .segments._segments import Segments
77
+ from .suppressions._suppression import (Suppression, SuppressionListItem,
78
+ SuppressionOrigin)
79
+ from .suppressions._suppressions import Suppressions
80
+ from .suppressions.batch._suppressions_batch import (BatchRemovedSuppression,
81
+ BatchSuppression,
82
+ SuppressionsBatch)
83
+ from .templates._template import Template, TemplateListItem, Variable
84
+ from .templates._templates import Templates
85
+ from .topics._topic import Topic
86
+ from .topics._topics import Topics
87
+ from .usage._usage import (AiCreditsUsage, AutomationRunsUsage,
88
+ BroadcastsUsage, ContactsUsage, DomainsUsage,
89
+ EmailsDailyUsage, EmailsMonthlyUsage, EmailsUsage,
90
+ RateLimitUsage, SegmentsUsage, Usage)
91
+ from .version import __version__, get_version
92
+ from .webhooks._webhook import (VerifyWebhookOptions, Webhook, WebhookEvent,
93
+ WebhookHeaders, WebhookStatus)
94
+ from .webhooks._webhook_event import (BaseEmailEventData, ContactCreatedEvent,
95
+ ContactDeletedEvent, ContactEventData,
96
+ ContactTopicsEventData,
97
+ ContactTopicSubscription,
98
+ ContactTopicsUpdatedEvent,
99
+ ContactUpdatedEvent, DomainCreatedEvent,
100
+ DomainDeletedEvent, DomainEventData,
101
+ DomainUpdatedEvent, EmailBouncedEvent,
102
+ EmailClickedEvent, EmailComplainedEvent,
103
+ EmailDeliveredEvent,
104
+ EmailDeliveryDelayedEvent,
105
+ EmailFailedEvent, EmailOpenedEvent,
106
+ EmailReceivedEvent, EmailScheduledEvent,
107
+ EmailSentEvent, EmailSuppressedEvent,
108
+ ReceivedEmailEventData,
109
+ SuppressionAddedEvent,
110
+ SuppressionEventData,
111
+ SuppressionRemovedEvent,
112
+ TopicCreatedEvent, TopicDeletedEvent,
113
+ TopicEventData, TopicUpdatedEvent,
114
+ WebhookEventPayload)
115
+ from .webhooks._webhooks import Webhooks
116
+
117
+ # Type for clients that support both sync and async
118
+ SendioHTTPClient = Union[HTTPClient, AsyncHTTPClient]
119
+
120
+ # Sync HTTP client — always set, can be overridden with a custom HTTPClient.
121
+ default_http_client: SendioHTTPClient = RequestsClient()
122
+
123
+ # Async HTTP client — auto-detected if httpx is installed, can be overridden
124
+ # with any AsyncHTTPClient subclass. Set to None if no async library is available.
125
+ default_async_http_client: Optional[AsyncHTTPClient] = None
126
+
127
+ # Config vars
128
+ api_key = os.environ.get("SENDIO_API_KEY")
129
+ api_url = os.environ.get("SENDIO_BASE_URL", "https://api.send.io")
130
+
131
+
132
+ __all__ = [
133
+ "__version__",
134
+ "get_version",
135
+ "Request",
136
+ "Emails",
137
+ "ApiKeys",
138
+ "Domains",
139
+ "Batch",
140
+ "Audiences",
141
+ "Automations",
142
+ "Contacts",
143
+ "ContactImports",
144
+ "ContactProperties",
145
+ "Broadcasts",
146
+ "Events",
147
+ "Segments",
148
+ "Templates",
149
+ "Webhooks",
150
+ "Topics",
151
+ "Logs",
152
+ "Mailboxes",
153
+ "OAuthGrants",
154
+ "Suppressions",
155
+ "SuppressionsBatch",
156
+ "Usage",
157
+ # Types
158
+ "Audience",
159
+ "Automation",
160
+ "AutomationConnection",
161
+ "AutomationConnectionType",
162
+ "AutomationListItem",
163
+ "AutomationResponseStep",
164
+ "AutomationRun",
165
+ "AutomationRunListItem",
166
+ "AutomationRunStatus",
167
+ "AutomationRunStep",
168
+ "AutomationStatus",
169
+ "AutomationStep",
170
+ "AutomationStepType",
171
+ "AutomationEmail",
172
+ "AutomationTemplate",
173
+ "AutomationTemplateCategory",
174
+ "AutomationTemplateDetail",
175
+ "AutomationTemplateEmail",
176
+ "AutomationTemplateEvent",
177
+ "AutomationTemplateEventDetail",
178
+ "AutomationTemplateKind",
179
+ "AutomationTemplateParam",
180
+ "AutomationTemplateStep",
181
+ "WebhookFormField",
182
+ "WebhookHeader",
183
+ "WebhookStepConfig",
184
+ "Event",
185
+ "EventListItem",
186
+ "EventSchema",
187
+ "EventSchemaFieldType",
188
+ "Contact",
189
+ "ContactImport",
190
+ "ContactImportCounts",
191
+ "ContactSegment",
192
+ "ContactSegments",
193
+ "ContactProperty",
194
+ "ContactTopic",
195
+ "TopicSubscriptionUpdate",
196
+ "Domain",
197
+ "DomainCapabilities",
198
+ "DomainCapabilityStatus",
199
+ "ApiKey",
200
+ "Log",
201
+ "Mailbox",
202
+ "MailboxCredentials",
203
+ "MailboxHealth",
204
+ "MailboxImapSmtpStatus",
205
+ "MailboxKind",
206
+ "MailboxServer",
207
+ "Email",
208
+ "Attachment",
209
+ "RemoteAttachment",
210
+ "EmailTemplate",
211
+ "Tag",
212
+ "Broadcast",
213
+ "ClickedLink",
214
+ "BroadcastRecipient",
215
+ "BroadcastRecipientBounceType",
216
+ "BroadcastRecipientClickedLink",
217
+ "BroadcastRecipientEventType",
218
+ "BroadcastVersion",
219
+ "Segment",
220
+ "Suppression",
221
+ "SuppressionListItem",
222
+ "SuppressionOrigin",
223
+ "BatchSuppression",
224
+ "BatchRemovedSuppression",
225
+ "Template",
226
+ "TemplateListItem",
227
+ "Variable",
228
+ "Webhook",
229
+ "WebhookEvent",
230
+ "WebhookEventPayload",
231
+ "WebhookHeaders",
232
+ "WebhookStatus",
233
+ "VerifyWebhookOptions",
234
+ "BaseEmailEventData",
235
+ "ReceivedEmailEventData",
236
+ "ContactEventData",
237
+ "DomainEventData",
238
+ "EmailSentEvent",
239
+ "EmailScheduledEvent",
240
+ "EmailDeliveredEvent",
241
+ "EmailDeliveryDelayedEvent",
242
+ "EmailComplainedEvent",
243
+ "EmailBouncedEvent",
244
+ "EmailOpenedEvent",
245
+ "EmailClickedEvent",
246
+ "EmailReceivedEvent",
247
+ "EmailFailedEvent",
248
+ "EmailSuppressedEvent",
249
+ "ContactCreatedEvent",
250
+ "ContactUpdatedEvent",
251
+ "ContactDeletedEvent",
252
+ "ContactTopicsEventData",
253
+ "ContactTopicsUpdatedEvent",
254
+ "ContactTopicSubscription",
255
+ "DomainCreatedEvent",
256
+ "DomainUpdatedEvent",
257
+ "DomainDeletedEvent",
258
+ "SuppressionEventData",
259
+ "SuppressionAddedEvent",
260
+ "SuppressionRemovedEvent",
261
+ "TopicEventData",
262
+ "TopicCreatedEvent",
263
+ "TopicUpdatedEvent",
264
+ "TopicDeletedEvent",
265
+ "Topic",
266
+ "OAuthGrant",
267
+ "OAuthGrantClient",
268
+ "BatchValidationError",
269
+ "ReceivedEmail",
270
+ "EmailAttachment",
271
+ "AttachmentWithSignedUrl",
272
+ "EmailAttachmentDetails",
273
+ "ListReceivedEmail",
274
+ # Receiving types (for type hints)
275
+ "EmailsReceiving",
276
+ "EmailAttachments",
277
+ "ContactsTopics",
278
+ "EmailsUsage",
279
+ "EmailsDailyUsage",
280
+ "EmailsMonthlyUsage",
281
+ "ContactsUsage",
282
+ "SegmentsUsage",
283
+ "BroadcastsUsage",
284
+ "AiCreditsUsage",
285
+ "AutomationRunsUsage",
286
+ "DomainsUsage",
287
+ "RateLimitUsage",
288
+ # HTTP Clients
289
+ "HTTPClient",
290
+ # Default HTTP Client
291
+ "RequestsClient",
292
+ ]
293
+
294
+ # Add async exports and auto-detect async client if httpx is available
295
+ try:
296
+ from .async_request import AsyncRequest # noqa: F401
297
+ from .http_client_httpx import HTTPXClient # noqa: F401
298
+
299
+ default_async_http_client = HTTPXClient()
300
+ __all__.extend(["AsyncHTTPClient", "HTTPXClient", "AsyncRequest"])
301
+ except ImportError:
302
+ pass
@@ -0,0 +1,16 @@
1
+ """Base response type for all send.io 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
+ """
@@ -0,0 +1,301 @@
1
+ from typing import Any, Dict, List, Optional, cast
2
+
3
+ from typing_extensions import NotRequired, TypedDict
4
+
5
+ from sendio import request
6
+ from sendio._base_response import BaseResponse
7
+ from sendio.api_keys._api_key import ApiKey
8
+ from sendio.pagination_helper import PaginationHelper
9
+
10
+ # Async imports (optional - only available with pip install sendio[async])
11
+ try:
12
+ from sendio.async_request import AsyncRequest
13
+ except ImportError:
14
+ pass
15
+
16
+
17
+ class ApiKeys:
18
+
19
+ class ListResponse(BaseResponse):
20
+ """
21
+ ListResponse type that wraps a list of API key objects with pagination metadata
22
+
23
+ Attributes:
24
+ object (str): The object type, always "list"
25
+ data (List[ApiKey]): A list of API key objects
26
+ has_more (bool): Whether there are more results available
27
+ """
28
+
29
+ object: str
30
+ """
31
+ The object type, always "list"
32
+ """
33
+ data: List[ApiKey]
34
+ """
35
+ A list of API key objects
36
+ """
37
+ has_more: bool
38
+ """
39
+ Whether there are more results available for pagination
40
+ """
41
+
42
+ class CreateApiKeyResponse(BaseResponse):
43
+ """
44
+ CreateApiKeyResponse is the type that wraps the response of the API key that was created
45
+
46
+ Attributes:
47
+ id (str): The ID of the created API key
48
+ token (str): The token of the created API key
49
+ """
50
+
51
+ id: str
52
+ """
53
+ The ID of the created API key
54
+ """
55
+ token: str
56
+ """
57
+ The token of the created API key
58
+ """
59
+
60
+ class DeleteApiKeyResponse(BaseResponse):
61
+ """
62
+ DeleteApiKeyResponse is the type that wraps the deleted API key response.
63
+
64
+ Attributes:
65
+ object (str): The object type, always "api_key"
66
+ id (str): The ID of the deleted API key
67
+ deleted (bool): Whether the API key was deleted
68
+ """
69
+
70
+ object: str
71
+ """
72
+ The object type, always "api_key"
73
+ """
74
+ id: str
75
+ """
76
+ The ID of the deleted API key
77
+ """
78
+ deleted: bool
79
+ """
80
+ Whether the API key was deleted
81
+ """
82
+
83
+ class UpdateApiKeyResponse(BaseResponse):
84
+ """
85
+ UpdateApiKeyResponse is the type that wraps the response of the API key that was updated
86
+
87
+ Attributes:
88
+ object (str): The object type, always "api_key"
89
+ id (str): The ID of the updated API key
90
+ """
91
+
92
+ object: str
93
+ """
94
+ The object type, always "api_key"
95
+ """
96
+ id: str
97
+ """
98
+ The ID of the updated API key
99
+ """
100
+
101
+ class ListParams(TypedDict):
102
+ limit: NotRequired[int]
103
+ """
104
+ Number of API keys to retrieve. Maximum is 100, and minimum is 1.
105
+ """
106
+ after: NotRequired[str]
107
+ """
108
+ The ID after which we'll retrieve more API keys (for pagination).
109
+ This ID will not be included in the returned list.
110
+ Cannot be used with the before parameter.
111
+ """
112
+ before: NotRequired[str]
113
+ """
114
+ The ID before which we'll retrieve more API keys (for pagination).
115
+ This ID will not be included in the returned list.
116
+ Cannot be used with the after parameter.
117
+ """
118
+
119
+ class CreateParams(TypedDict):
120
+ name: str
121
+ """
122
+ The API key name.
123
+ """
124
+ permission: NotRequired[str]
125
+ """
126
+ The API key can have full access to Sendio's API or be only
127
+ restricted to send emails. * full_access: Can create, delete, get,
128
+ and update any resource. * sending_access: Can only send emails.
129
+ """
130
+ domain_id: NotRequired[str]
131
+ """
132
+ Restrict an API key to send emails only from a specific domain.
133
+ This is only used when the permission is set to sending_access.
134
+ """
135
+
136
+ class UpdateParams(TypedDict):
137
+ id: str
138
+ """
139
+ The API key ID.
140
+ """
141
+ name: str
142
+ """
143
+ The API key name.
144
+ """
145
+
146
+ @classmethod
147
+ def create(cls, params: CreateParams) -> CreateApiKeyResponse:
148
+ """
149
+ Add a new API key to authenticate communications with Sendio.
150
+ see more: https://developer.send.io/docs/api
151
+
152
+ Args:
153
+ params (CreateParams): The API key creation parameters
154
+
155
+ Returns:
156
+ CreateApiKeyResponse: The created API key response with id and token
157
+ """
158
+ path = "/api-keys"
159
+ resp = request.Request[ApiKeys.CreateApiKeyResponse](
160
+ path=path, params=cast(Dict[Any, Any], params), verb="post"
161
+ ).perform_with_content()
162
+ return resp
163
+
164
+ @classmethod
165
+ def update(cls, params: UpdateParams) -> UpdateApiKeyResponse:
166
+ """
167
+ Update an existing API key's name.
168
+ see more: https://developer.send.io/docs/api
169
+
170
+ Args:
171
+ params (UpdateParams): The API key update parameters
172
+ - id: The API key ID
173
+ - name: The new API key name
174
+
175
+ Returns:
176
+ UpdateApiKeyResponse: The updated API key response with id
177
+ """
178
+ api_key_id = params["id"]
179
+ path = f"/api-keys/{api_key_id}"
180
+ resp = request.Request[ApiKeys.UpdateApiKeyResponse](
181
+ path=path, params={"name": params["name"]}, verb="patch"
182
+ ).perform_with_content()
183
+ return resp
184
+
185
+ @classmethod
186
+ def list(cls, params: Optional[ListParams] = None) -> ListResponse:
187
+ """
188
+ Retrieve a list of API keys for the authenticated user.
189
+ see more: https://developer.send.io/docs/api
190
+
191
+ Args:
192
+ params (Optional[ListParams]): Optional pagination parameters
193
+ - limit: Number of API keys to retrieve (max 100, min 1)
194
+ - after: ID after which to retrieve more API keys
195
+ - before: ID before which to retrieve more API keys
196
+
197
+ Returns:
198
+ ListResponse: A list of API key objects
199
+ """
200
+ base_path = "/api-keys"
201
+ query_params = cast(Dict[Any, Any], params) if params else None
202
+ path = PaginationHelper.build_paginated_path(base_path, query_params)
203
+ resp = request.Request[ApiKeys.ListResponse](
204
+ path=path, params={}, verb="get"
205
+ ).perform_with_content()
206
+ return resp
207
+
208
+ @classmethod
209
+ def remove(cls, api_key_id: str) -> DeleteApiKeyResponse:
210
+ """
211
+ Remove an existing API key.
212
+ see more: https://developer.send.io/docs/api
213
+
214
+ Args:
215
+ api_key_id (str): The ID of the API key to remove
216
+
217
+ Returns:
218
+ DeleteApiKeyResponse: The deleted API key response
219
+ """
220
+ path = f"/api-keys/{api_key_id}"
221
+ resp = request.Request[ApiKeys.DeleteApiKeyResponse](
222
+ path=path, params={}, verb="delete"
223
+ ).perform_with_content()
224
+ return resp
225
+
226
+ @classmethod
227
+ async def create_async(cls, params: CreateParams) -> CreateApiKeyResponse:
228
+ """
229
+ Add a new API key to authenticate communications with Sendio (async).
230
+ see more: https://developer.send.io/docs/api
231
+
232
+ Args:
233
+ params (CreateParams): The API key creation parameters
234
+
235
+ Returns:
236
+ CreateApiKeyResponse: The created API key response with id and token
237
+ """
238
+ path = "/api-keys"
239
+ resp = await AsyncRequest[ApiKeys.CreateApiKeyResponse](
240
+ path=path, params=cast(Dict[Any, Any], params), verb="post"
241
+ ).perform_with_content()
242
+ return resp
243
+
244
+ @classmethod
245
+ async def update_async(cls, params: UpdateParams) -> UpdateApiKeyResponse:
246
+ """
247
+ Update an existing API key's name (async).
248
+ see more: https://developer.send.io/docs/api
249
+
250
+ Args:
251
+ params (UpdateParams): The API key update parameters
252
+ - id: The API key ID
253
+ - name: The new API key name
254
+
255
+ Returns:
256
+ UpdateApiKeyResponse: The updated API key response with id
257
+ """
258
+ api_key_id = params["id"]
259
+ path = f"/api-keys/{api_key_id}"
260
+ resp = await AsyncRequest[ApiKeys.UpdateApiKeyResponse](
261
+ path=path, params={"name": params["name"]}, verb="patch"
262
+ ).perform_with_content()
263
+ return resp
264
+
265
+ @classmethod
266
+ async def list_async(cls, params: Optional[ListParams] = None) -> ListResponse:
267
+ """
268
+ Retrieve a list of API keys for the authenticated user (async).
269
+ see more: https://developer.send.io/docs/api
270
+
271
+ Args:
272
+ params (Optional[ListParams]): Optional pagination parameters
273
+
274
+ Returns:
275
+ ListResponse: A list of API key objects
276
+ """
277
+ base_path = "/api-keys"
278
+ query_params = cast(Dict[Any, Any], params) if params else None
279
+ path = PaginationHelper.build_paginated_path(base_path, query_params)
280
+ resp = await AsyncRequest[ApiKeys.ListResponse](
281
+ path=path, params={}, verb="get"
282
+ ).perform_with_content()
283
+ return resp
284
+
285
+ @classmethod
286
+ async def remove_async(cls, api_key_id: str) -> DeleteApiKeyResponse:
287
+ """
288
+ Remove an existing API key (async).
289
+ see more: https://developer.send.io/docs/api
290
+
291
+ Args:
292
+ api_key_id (str): The ID of the API key to remove
293
+
294
+ Returns:
295
+ DeleteApiKeyResponse: The deleted API key response
296
+ """
297
+ path = f"/api-keys/{api_key_id}"
298
+ resp = await AsyncRequest[ApiKeys.DeleteApiKeyResponse](
299
+ path=path, params={}, verb="delete"
300
+ ).perform_with_content()
301
+ return resp
File without changes