aiinbx 0.7.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.
Potentially problematic release.
This version of aiinbx might be problematic. Click here for more details.
- aiinbx/__init__.py +92 -0
- aiinbx/_base_client.py +1995 -0
- aiinbx/_client.py +422 -0
- aiinbx/_compat.py +219 -0
- aiinbx/_constants.py +14 -0
- aiinbx/_exceptions.py +108 -0
- aiinbx/_files.py +123 -0
- aiinbx/_models.py +835 -0
- aiinbx/_qs.py +150 -0
- aiinbx/_resource.py +43 -0
- aiinbx/_response.py +830 -0
- aiinbx/_streaming.py +331 -0
- aiinbx/_types.py +260 -0
- aiinbx/_utils/__init__.py +64 -0
- aiinbx/_utils/_compat.py +45 -0
- aiinbx/_utils/_datetime_parse.py +136 -0
- aiinbx/_utils/_logs.py +25 -0
- aiinbx/_utils/_proxy.py +65 -0
- aiinbx/_utils/_reflection.py +42 -0
- aiinbx/_utils/_resources_proxy.py +24 -0
- aiinbx/_utils/_streams.py +12 -0
- aiinbx/_utils/_sync.py +86 -0
- aiinbx/_utils/_transform.py +457 -0
- aiinbx/_utils/_typing.py +156 -0
- aiinbx/_utils/_utils.py +421 -0
- aiinbx/_version.py +4 -0
- aiinbx/lib/.keep +4 -0
- aiinbx/py.typed +0 -0
- aiinbx/resources/__init__.py +64 -0
- aiinbx/resources/domains.py +455 -0
- aiinbx/resources/emails.py +451 -0
- aiinbx/resources/meta.py +147 -0
- aiinbx/resources/threads.py +468 -0
- aiinbx/resources/webhooks.py +34 -0
- aiinbx/types/__init__.py +35 -0
- aiinbx/types/domain_create_params.py +11 -0
- aiinbx/types/domain_create_response.py +26 -0
- aiinbx/types/domain_delete_response.py +11 -0
- aiinbx/types/domain_list_response.py +50 -0
- aiinbx/types/domain_retrieve_response.py +46 -0
- aiinbx/types/domain_verify_response.py +149 -0
- aiinbx/types/email_reply_params.py +47 -0
- aiinbx/types/email_reply_response.py +15 -0
- aiinbx/types/email_retrieve_response.py +90 -0
- aiinbx/types/email_send_params.py +53 -0
- aiinbx/types/email_send_response.py +15 -0
- aiinbx/types/inbound_email_received_webhook_event.py +113 -0
- aiinbx/types/meta_webhooks_schema_response.py +298 -0
- aiinbx/types/outbound_email_bounced_webhook_event.py +44 -0
- aiinbx/types/outbound_email_clicked_webhook_event.py +36 -0
- aiinbx/types/outbound_email_complained_webhook_event.py +36 -0
- aiinbx/types/outbound_email_delivered_webhook_event.py +36 -0
- aiinbx/types/outbound_email_opened_webhook_event.py +32 -0
- aiinbx/types/outbound_email_rejected_webhook_event.py +30 -0
- aiinbx/types/thread_forward_params.py +43 -0
- aiinbx/types/thread_forward_response.py +15 -0
- aiinbx/types/thread_retrieve_response.py +100 -0
- aiinbx/types/thread_search_params.py +61 -0
- aiinbx/types/thread_search_response.py +43 -0
- aiinbx/types/unwrap_webhook_event.py +24 -0
- aiinbx-0.7.0.dist-info/METADATA +398 -0
- aiinbx-0.7.0.dist-info/RECORD +64 -0
- aiinbx-0.7.0.dist-info/WHEEL +4 -0
- aiinbx-0.7.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Union, Iterable
|
|
6
|
+
from typing_extensions import Literal
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
|
|
10
|
+
from ..types import thread_search_params, thread_forward_params
|
|
11
|
+
from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
|
|
12
|
+
from .._utils import maybe_transform, async_maybe_transform
|
|
13
|
+
from .._compat import cached_property
|
|
14
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
15
|
+
from .._response import (
|
|
16
|
+
to_raw_response_wrapper,
|
|
17
|
+
to_streamed_response_wrapper,
|
|
18
|
+
async_to_raw_response_wrapper,
|
|
19
|
+
async_to_streamed_response_wrapper,
|
|
20
|
+
)
|
|
21
|
+
from .._base_client import make_request_options
|
|
22
|
+
from ..types.thread_search_response import ThreadSearchResponse
|
|
23
|
+
from ..types.thread_forward_response import ThreadForwardResponse
|
|
24
|
+
from ..types.thread_retrieve_response import ThreadRetrieveResponse
|
|
25
|
+
|
|
26
|
+
__all__ = ["ThreadsResource", "AsyncThreadsResource"]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class ThreadsResource(SyncAPIResource):
|
|
30
|
+
@cached_property
|
|
31
|
+
def with_raw_response(self) -> ThreadsResourceWithRawResponse:
|
|
32
|
+
"""
|
|
33
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
34
|
+
the raw response object instead of the parsed content.
|
|
35
|
+
|
|
36
|
+
For more information, see https://www.github.com/aiinbx/aiinbx-py#accessing-raw-response-data-eg-headers
|
|
37
|
+
"""
|
|
38
|
+
return ThreadsResourceWithRawResponse(self)
|
|
39
|
+
|
|
40
|
+
@cached_property
|
|
41
|
+
def with_streaming_response(self) -> ThreadsResourceWithStreamingResponse:
|
|
42
|
+
"""
|
|
43
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
44
|
+
|
|
45
|
+
For more information, see https://www.github.com/aiinbx/aiinbx-py#with_streaming_response
|
|
46
|
+
"""
|
|
47
|
+
return ThreadsResourceWithStreamingResponse(self)
|
|
48
|
+
|
|
49
|
+
def retrieve(
|
|
50
|
+
self,
|
|
51
|
+
thread_id: str,
|
|
52
|
+
*,
|
|
53
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
54
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
55
|
+
extra_headers: Headers | None = None,
|
|
56
|
+
extra_query: Query | None = None,
|
|
57
|
+
extra_body: Body | None = None,
|
|
58
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
59
|
+
) -> ThreadRetrieveResponse:
|
|
60
|
+
"""
|
|
61
|
+
Retrieve a specific thread with all its emails by thread ID using API key
|
|
62
|
+
authentication
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
extra_headers: Send extra headers
|
|
66
|
+
|
|
67
|
+
extra_query: Add additional query parameters to the request
|
|
68
|
+
|
|
69
|
+
extra_body: Add additional JSON properties to the request
|
|
70
|
+
|
|
71
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
72
|
+
"""
|
|
73
|
+
if not thread_id:
|
|
74
|
+
raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}")
|
|
75
|
+
return self._get(
|
|
76
|
+
f"/threads/{thread_id}",
|
|
77
|
+
options=make_request_options(
|
|
78
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
79
|
+
),
|
|
80
|
+
cast_to=ThreadRetrieveResponse,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
def forward(
|
|
84
|
+
self,
|
|
85
|
+
thread_id: str,
|
|
86
|
+
*,
|
|
87
|
+
to: Union[str, SequenceNotStr[str]],
|
|
88
|
+
attachments: Iterable[thread_forward_params.Attachment] | Omit = omit,
|
|
89
|
+
bcc: Union[str, SequenceNotStr[str]] | Omit = omit,
|
|
90
|
+
cc: Union[str, SequenceNotStr[str]] | Omit = omit,
|
|
91
|
+
from_: str | Omit = omit,
|
|
92
|
+
from_name: str | Omit = omit,
|
|
93
|
+
include_attachments: bool | Omit = omit,
|
|
94
|
+
is_draft: bool | Omit = omit,
|
|
95
|
+
note: str | Omit = omit,
|
|
96
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
97
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
98
|
+
extra_headers: Headers | None = None,
|
|
99
|
+
extra_query: Query | None = None,
|
|
100
|
+
extra_body: Body | None = None,
|
|
101
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
102
|
+
) -> ThreadForwardResponse:
|
|
103
|
+
"""
|
|
104
|
+
Forward the entire thread as a readable transcript.
|
|
105
|
+
|
|
106
|
+
Args:
|
|
107
|
+
extra_headers: Send extra headers
|
|
108
|
+
|
|
109
|
+
extra_query: Add additional query parameters to the request
|
|
110
|
+
|
|
111
|
+
extra_body: Add additional JSON properties to the request
|
|
112
|
+
|
|
113
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
114
|
+
"""
|
|
115
|
+
if not thread_id:
|
|
116
|
+
raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}")
|
|
117
|
+
return self._post(
|
|
118
|
+
f"/threads/{thread_id}/forward",
|
|
119
|
+
body=maybe_transform(
|
|
120
|
+
{
|
|
121
|
+
"to": to,
|
|
122
|
+
"attachments": attachments,
|
|
123
|
+
"bcc": bcc,
|
|
124
|
+
"cc": cc,
|
|
125
|
+
"from_": from_,
|
|
126
|
+
"from_name": from_name,
|
|
127
|
+
"include_attachments": include_attachments,
|
|
128
|
+
"is_draft": is_draft,
|
|
129
|
+
"note": note,
|
|
130
|
+
},
|
|
131
|
+
thread_forward_params.ThreadForwardParams,
|
|
132
|
+
),
|
|
133
|
+
options=make_request_options(
|
|
134
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
135
|
+
),
|
|
136
|
+
cast_to=ThreadForwardResponse,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
def search(
|
|
140
|
+
self,
|
|
141
|
+
*,
|
|
142
|
+
conversation_state: Literal["awaiting_reply", "needs_reply", "active", "stale"] | Omit = omit,
|
|
143
|
+
created_after: str | Omit = omit,
|
|
144
|
+
created_before: str | Omit = omit,
|
|
145
|
+
has_email_from_address: str | Omit = omit,
|
|
146
|
+
has_email_to_address: str | Omit = omit,
|
|
147
|
+
has_participant_emails: SequenceNotStr[str] | Omit = omit,
|
|
148
|
+
last_email_after: str | Omit = omit,
|
|
149
|
+
last_email_before: str | Omit = omit,
|
|
150
|
+
limit: float | Omit = omit,
|
|
151
|
+
offset: float | Omit = omit,
|
|
152
|
+
some_email_has_direction: Literal["INBOUND", "OUTBOUND"] | Omit = omit,
|
|
153
|
+
some_email_has_status: Literal[
|
|
154
|
+
"DRAFT",
|
|
155
|
+
"QUEUED",
|
|
156
|
+
"ACCEPTED",
|
|
157
|
+
"SENT",
|
|
158
|
+
"RECEIVED",
|
|
159
|
+
"FAILED",
|
|
160
|
+
"BOUNCED",
|
|
161
|
+
"COMPLAINED",
|
|
162
|
+
"REJECTED",
|
|
163
|
+
"READ",
|
|
164
|
+
"ARCHIVED",
|
|
165
|
+
]
|
|
166
|
+
| Omit = omit,
|
|
167
|
+
sort_by: Literal["createdAt", "lastEmailAt", "subject"] | Omit = omit,
|
|
168
|
+
sort_order: Literal["asc", "desc"] | Omit = omit,
|
|
169
|
+
stale_threshold_days: float | Omit = omit,
|
|
170
|
+
subject_contains: str | Omit = omit,
|
|
171
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
172
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
173
|
+
extra_headers: Headers | None = None,
|
|
174
|
+
extra_query: Query | None = None,
|
|
175
|
+
extra_body: Body | None = None,
|
|
176
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
177
|
+
) -> ThreadSearchResponse:
|
|
178
|
+
"""
|
|
179
|
+
Search threads with various filtering options optimized for AI agents
|
|
180
|
+
|
|
181
|
+
Args:
|
|
182
|
+
extra_headers: Send extra headers
|
|
183
|
+
|
|
184
|
+
extra_query: Add additional query parameters to the request
|
|
185
|
+
|
|
186
|
+
extra_body: Add additional JSON properties to the request
|
|
187
|
+
|
|
188
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
189
|
+
"""
|
|
190
|
+
return self._post(
|
|
191
|
+
"/threads/search",
|
|
192
|
+
body=maybe_transform(
|
|
193
|
+
{
|
|
194
|
+
"conversation_state": conversation_state,
|
|
195
|
+
"created_after": created_after,
|
|
196
|
+
"created_before": created_before,
|
|
197
|
+
"has_email_from_address": has_email_from_address,
|
|
198
|
+
"has_email_to_address": has_email_to_address,
|
|
199
|
+
"has_participant_emails": has_participant_emails,
|
|
200
|
+
"last_email_after": last_email_after,
|
|
201
|
+
"last_email_before": last_email_before,
|
|
202
|
+
"limit": limit,
|
|
203
|
+
"offset": offset,
|
|
204
|
+
"some_email_has_direction": some_email_has_direction,
|
|
205
|
+
"some_email_has_status": some_email_has_status,
|
|
206
|
+
"sort_by": sort_by,
|
|
207
|
+
"sort_order": sort_order,
|
|
208
|
+
"stale_threshold_days": stale_threshold_days,
|
|
209
|
+
"subject_contains": subject_contains,
|
|
210
|
+
},
|
|
211
|
+
thread_search_params.ThreadSearchParams,
|
|
212
|
+
),
|
|
213
|
+
options=make_request_options(
|
|
214
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
215
|
+
),
|
|
216
|
+
cast_to=ThreadSearchResponse,
|
|
217
|
+
)
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
class AsyncThreadsResource(AsyncAPIResource):
|
|
221
|
+
@cached_property
|
|
222
|
+
def with_raw_response(self) -> AsyncThreadsResourceWithRawResponse:
|
|
223
|
+
"""
|
|
224
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
225
|
+
the raw response object instead of the parsed content.
|
|
226
|
+
|
|
227
|
+
For more information, see https://www.github.com/aiinbx/aiinbx-py#accessing-raw-response-data-eg-headers
|
|
228
|
+
"""
|
|
229
|
+
return AsyncThreadsResourceWithRawResponse(self)
|
|
230
|
+
|
|
231
|
+
@cached_property
|
|
232
|
+
def with_streaming_response(self) -> AsyncThreadsResourceWithStreamingResponse:
|
|
233
|
+
"""
|
|
234
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
235
|
+
|
|
236
|
+
For more information, see https://www.github.com/aiinbx/aiinbx-py#with_streaming_response
|
|
237
|
+
"""
|
|
238
|
+
return AsyncThreadsResourceWithStreamingResponse(self)
|
|
239
|
+
|
|
240
|
+
async def retrieve(
|
|
241
|
+
self,
|
|
242
|
+
thread_id: str,
|
|
243
|
+
*,
|
|
244
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
245
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
246
|
+
extra_headers: Headers | None = None,
|
|
247
|
+
extra_query: Query | None = None,
|
|
248
|
+
extra_body: Body | None = None,
|
|
249
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
250
|
+
) -> ThreadRetrieveResponse:
|
|
251
|
+
"""
|
|
252
|
+
Retrieve a specific thread with all its emails by thread ID using API key
|
|
253
|
+
authentication
|
|
254
|
+
|
|
255
|
+
Args:
|
|
256
|
+
extra_headers: Send extra headers
|
|
257
|
+
|
|
258
|
+
extra_query: Add additional query parameters to the request
|
|
259
|
+
|
|
260
|
+
extra_body: Add additional JSON properties to the request
|
|
261
|
+
|
|
262
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
263
|
+
"""
|
|
264
|
+
if not thread_id:
|
|
265
|
+
raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}")
|
|
266
|
+
return await self._get(
|
|
267
|
+
f"/threads/{thread_id}",
|
|
268
|
+
options=make_request_options(
|
|
269
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
270
|
+
),
|
|
271
|
+
cast_to=ThreadRetrieveResponse,
|
|
272
|
+
)
|
|
273
|
+
|
|
274
|
+
async def forward(
|
|
275
|
+
self,
|
|
276
|
+
thread_id: str,
|
|
277
|
+
*,
|
|
278
|
+
to: Union[str, SequenceNotStr[str]],
|
|
279
|
+
attachments: Iterable[thread_forward_params.Attachment] | Omit = omit,
|
|
280
|
+
bcc: Union[str, SequenceNotStr[str]] | Omit = omit,
|
|
281
|
+
cc: Union[str, SequenceNotStr[str]] | Omit = omit,
|
|
282
|
+
from_: str | Omit = omit,
|
|
283
|
+
from_name: str | Omit = omit,
|
|
284
|
+
include_attachments: bool | Omit = omit,
|
|
285
|
+
is_draft: bool | Omit = omit,
|
|
286
|
+
note: str | Omit = omit,
|
|
287
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
288
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
289
|
+
extra_headers: Headers | None = None,
|
|
290
|
+
extra_query: Query | None = None,
|
|
291
|
+
extra_body: Body | None = None,
|
|
292
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
293
|
+
) -> ThreadForwardResponse:
|
|
294
|
+
"""
|
|
295
|
+
Forward the entire thread as a readable transcript.
|
|
296
|
+
|
|
297
|
+
Args:
|
|
298
|
+
extra_headers: Send extra headers
|
|
299
|
+
|
|
300
|
+
extra_query: Add additional query parameters to the request
|
|
301
|
+
|
|
302
|
+
extra_body: Add additional JSON properties to the request
|
|
303
|
+
|
|
304
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
305
|
+
"""
|
|
306
|
+
if not thread_id:
|
|
307
|
+
raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}")
|
|
308
|
+
return await self._post(
|
|
309
|
+
f"/threads/{thread_id}/forward",
|
|
310
|
+
body=await async_maybe_transform(
|
|
311
|
+
{
|
|
312
|
+
"to": to,
|
|
313
|
+
"attachments": attachments,
|
|
314
|
+
"bcc": bcc,
|
|
315
|
+
"cc": cc,
|
|
316
|
+
"from_": from_,
|
|
317
|
+
"from_name": from_name,
|
|
318
|
+
"include_attachments": include_attachments,
|
|
319
|
+
"is_draft": is_draft,
|
|
320
|
+
"note": note,
|
|
321
|
+
},
|
|
322
|
+
thread_forward_params.ThreadForwardParams,
|
|
323
|
+
),
|
|
324
|
+
options=make_request_options(
|
|
325
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
326
|
+
),
|
|
327
|
+
cast_to=ThreadForwardResponse,
|
|
328
|
+
)
|
|
329
|
+
|
|
330
|
+
async def search(
|
|
331
|
+
self,
|
|
332
|
+
*,
|
|
333
|
+
conversation_state: Literal["awaiting_reply", "needs_reply", "active", "stale"] | Omit = omit,
|
|
334
|
+
created_after: str | Omit = omit,
|
|
335
|
+
created_before: str | Omit = omit,
|
|
336
|
+
has_email_from_address: str | Omit = omit,
|
|
337
|
+
has_email_to_address: str | Omit = omit,
|
|
338
|
+
has_participant_emails: SequenceNotStr[str] | Omit = omit,
|
|
339
|
+
last_email_after: str | Omit = omit,
|
|
340
|
+
last_email_before: str | Omit = omit,
|
|
341
|
+
limit: float | Omit = omit,
|
|
342
|
+
offset: float | Omit = omit,
|
|
343
|
+
some_email_has_direction: Literal["INBOUND", "OUTBOUND"] | Omit = omit,
|
|
344
|
+
some_email_has_status: Literal[
|
|
345
|
+
"DRAFT",
|
|
346
|
+
"QUEUED",
|
|
347
|
+
"ACCEPTED",
|
|
348
|
+
"SENT",
|
|
349
|
+
"RECEIVED",
|
|
350
|
+
"FAILED",
|
|
351
|
+
"BOUNCED",
|
|
352
|
+
"COMPLAINED",
|
|
353
|
+
"REJECTED",
|
|
354
|
+
"READ",
|
|
355
|
+
"ARCHIVED",
|
|
356
|
+
]
|
|
357
|
+
| Omit = omit,
|
|
358
|
+
sort_by: Literal["createdAt", "lastEmailAt", "subject"] | Omit = omit,
|
|
359
|
+
sort_order: Literal["asc", "desc"] | Omit = omit,
|
|
360
|
+
stale_threshold_days: float | Omit = omit,
|
|
361
|
+
subject_contains: str | Omit = omit,
|
|
362
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
363
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
364
|
+
extra_headers: Headers | None = None,
|
|
365
|
+
extra_query: Query | None = None,
|
|
366
|
+
extra_body: Body | None = None,
|
|
367
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
368
|
+
) -> ThreadSearchResponse:
|
|
369
|
+
"""
|
|
370
|
+
Search threads with various filtering options optimized for AI agents
|
|
371
|
+
|
|
372
|
+
Args:
|
|
373
|
+
extra_headers: Send extra headers
|
|
374
|
+
|
|
375
|
+
extra_query: Add additional query parameters to the request
|
|
376
|
+
|
|
377
|
+
extra_body: Add additional JSON properties to the request
|
|
378
|
+
|
|
379
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
380
|
+
"""
|
|
381
|
+
return await self._post(
|
|
382
|
+
"/threads/search",
|
|
383
|
+
body=await async_maybe_transform(
|
|
384
|
+
{
|
|
385
|
+
"conversation_state": conversation_state,
|
|
386
|
+
"created_after": created_after,
|
|
387
|
+
"created_before": created_before,
|
|
388
|
+
"has_email_from_address": has_email_from_address,
|
|
389
|
+
"has_email_to_address": has_email_to_address,
|
|
390
|
+
"has_participant_emails": has_participant_emails,
|
|
391
|
+
"last_email_after": last_email_after,
|
|
392
|
+
"last_email_before": last_email_before,
|
|
393
|
+
"limit": limit,
|
|
394
|
+
"offset": offset,
|
|
395
|
+
"some_email_has_direction": some_email_has_direction,
|
|
396
|
+
"some_email_has_status": some_email_has_status,
|
|
397
|
+
"sort_by": sort_by,
|
|
398
|
+
"sort_order": sort_order,
|
|
399
|
+
"stale_threshold_days": stale_threshold_days,
|
|
400
|
+
"subject_contains": subject_contains,
|
|
401
|
+
},
|
|
402
|
+
thread_search_params.ThreadSearchParams,
|
|
403
|
+
),
|
|
404
|
+
options=make_request_options(
|
|
405
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
406
|
+
),
|
|
407
|
+
cast_to=ThreadSearchResponse,
|
|
408
|
+
)
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
class ThreadsResourceWithRawResponse:
|
|
412
|
+
def __init__(self, threads: ThreadsResource) -> None:
|
|
413
|
+
self._threads = threads
|
|
414
|
+
|
|
415
|
+
self.retrieve = to_raw_response_wrapper(
|
|
416
|
+
threads.retrieve,
|
|
417
|
+
)
|
|
418
|
+
self.forward = to_raw_response_wrapper(
|
|
419
|
+
threads.forward,
|
|
420
|
+
)
|
|
421
|
+
self.search = to_raw_response_wrapper(
|
|
422
|
+
threads.search,
|
|
423
|
+
)
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
class AsyncThreadsResourceWithRawResponse:
|
|
427
|
+
def __init__(self, threads: AsyncThreadsResource) -> None:
|
|
428
|
+
self._threads = threads
|
|
429
|
+
|
|
430
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
431
|
+
threads.retrieve,
|
|
432
|
+
)
|
|
433
|
+
self.forward = async_to_raw_response_wrapper(
|
|
434
|
+
threads.forward,
|
|
435
|
+
)
|
|
436
|
+
self.search = async_to_raw_response_wrapper(
|
|
437
|
+
threads.search,
|
|
438
|
+
)
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
class ThreadsResourceWithStreamingResponse:
|
|
442
|
+
def __init__(self, threads: ThreadsResource) -> None:
|
|
443
|
+
self._threads = threads
|
|
444
|
+
|
|
445
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
446
|
+
threads.retrieve,
|
|
447
|
+
)
|
|
448
|
+
self.forward = to_streamed_response_wrapper(
|
|
449
|
+
threads.forward,
|
|
450
|
+
)
|
|
451
|
+
self.search = to_streamed_response_wrapper(
|
|
452
|
+
threads.search,
|
|
453
|
+
)
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
class AsyncThreadsResourceWithStreamingResponse:
|
|
457
|
+
def __init__(self, threads: AsyncThreadsResource) -> None:
|
|
458
|
+
self._threads = threads
|
|
459
|
+
|
|
460
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
461
|
+
threads.retrieve,
|
|
462
|
+
)
|
|
463
|
+
self.forward = async_to_streamed_response_wrapper(
|
|
464
|
+
threads.forward,
|
|
465
|
+
)
|
|
466
|
+
self.search = async_to_streamed_response_wrapper(
|
|
467
|
+
threads.search,
|
|
468
|
+
)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from typing import cast
|
|
7
|
+
|
|
8
|
+
from .._models import construct_type
|
|
9
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
10
|
+
from ..types.unwrap_webhook_event import UnwrapWebhookEvent
|
|
11
|
+
|
|
12
|
+
__all__ = ["WebhooksResource", "AsyncWebhooksResource"]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class WebhooksResource(SyncAPIResource):
|
|
16
|
+
def unwrap(self, payload: str) -> UnwrapWebhookEvent:
|
|
17
|
+
return cast(
|
|
18
|
+
UnwrapWebhookEvent,
|
|
19
|
+
construct_type(
|
|
20
|
+
type_=UnwrapWebhookEvent,
|
|
21
|
+
value=json.loads(payload),
|
|
22
|
+
),
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class AsyncWebhooksResource(AsyncAPIResource):
|
|
27
|
+
def unwrap(self, payload: str) -> UnwrapWebhookEvent:
|
|
28
|
+
return cast(
|
|
29
|
+
UnwrapWebhookEvent,
|
|
30
|
+
construct_type(
|
|
31
|
+
type_=UnwrapWebhookEvent,
|
|
32
|
+
value=json.loads(payload),
|
|
33
|
+
),
|
|
34
|
+
)
|
aiinbx/types/__init__.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .email_send_params import EmailSendParams as EmailSendParams
|
|
6
|
+
from .email_reply_params import EmailReplyParams as EmailReplyParams
|
|
7
|
+
from .email_send_response import EmailSendResponse as EmailSendResponse
|
|
8
|
+
from .domain_create_params import DomainCreateParams as DomainCreateParams
|
|
9
|
+
from .domain_list_response import DomainListResponse as DomainListResponse
|
|
10
|
+
from .email_reply_response import EmailReplyResponse as EmailReplyResponse
|
|
11
|
+
from .thread_search_params import ThreadSearchParams as ThreadSearchParams
|
|
12
|
+
from .unwrap_webhook_event import UnwrapWebhookEvent as UnwrapWebhookEvent
|
|
13
|
+
from .thread_forward_params import ThreadForwardParams as ThreadForwardParams
|
|
14
|
+
from .domain_create_response import DomainCreateResponse as DomainCreateResponse
|
|
15
|
+
from .domain_delete_response import DomainDeleteResponse as DomainDeleteResponse
|
|
16
|
+
from .domain_verify_response import DomainVerifyResponse as DomainVerifyResponse
|
|
17
|
+
from .thread_search_response import ThreadSearchResponse as ThreadSearchResponse
|
|
18
|
+
from .email_retrieve_response import EmailRetrieveResponse as EmailRetrieveResponse
|
|
19
|
+
from .thread_forward_response import ThreadForwardResponse as ThreadForwardResponse
|
|
20
|
+
from .domain_retrieve_response import DomainRetrieveResponse as DomainRetrieveResponse
|
|
21
|
+
from .thread_retrieve_response import ThreadRetrieveResponse as ThreadRetrieveResponse
|
|
22
|
+
from .meta_webhooks_schema_response import MetaWebhooksSchemaResponse as MetaWebhooksSchemaResponse
|
|
23
|
+
from .outbound_email_opened_webhook_event import OutboundEmailOpenedWebhookEvent as OutboundEmailOpenedWebhookEvent
|
|
24
|
+
from .inbound_email_received_webhook_event import InboundEmailReceivedWebhookEvent as InboundEmailReceivedWebhookEvent
|
|
25
|
+
from .outbound_email_bounced_webhook_event import OutboundEmailBouncedWebhookEvent as OutboundEmailBouncedWebhookEvent
|
|
26
|
+
from .outbound_email_clicked_webhook_event import OutboundEmailClickedWebhookEvent as OutboundEmailClickedWebhookEvent
|
|
27
|
+
from .outbound_email_rejected_webhook_event import (
|
|
28
|
+
OutboundEmailRejectedWebhookEvent as OutboundEmailRejectedWebhookEvent,
|
|
29
|
+
)
|
|
30
|
+
from .outbound_email_delivered_webhook_event import (
|
|
31
|
+
OutboundEmailDeliveredWebhookEvent as OutboundEmailDeliveredWebhookEvent,
|
|
32
|
+
)
|
|
33
|
+
from .outbound_email_complained_webhook_event import (
|
|
34
|
+
OutboundEmailComplainedWebhookEvent as OutboundEmailComplainedWebhookEvent,
|
|
35
|
+
)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Required, TypedDict
|
|
6
|
+
|
|
7
|
+
__all__ = ["DomainCreateParams"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class DomainCreateParams(TypedDict, total=False):
|
|
11
|
+
domain: Required[str]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List, Optional
|
|
4
|
+
from typing_extensions import Literal
|
|
5
|
+
|
|
6
|
+
from pydantic import Field as FieldInfo
|
|
7
|
+
|
|
8
|
+
from .._models import BaseModel
|
|
9
|
+
|
|
10
|
+
__all__ = ["DomainCreateResponse", "Record"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Record(BaseModel):
|
|
14
|
+
name: str
|
|
15
|
+
|
|
16
|
+
type: Literal["TXT", "CNAME", "MX"]
|
|
17
|
+
|
|
18
|
+
value: str
|
|
19
|
+
|
|
20
|
+
priority: Optional[float] = None
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class DomainCreateResponse(BaseModel):
|
|
24
|
+
domain_id: str = FieldInfo(alias="domainId")
|
|
25
|
+
|
|
26
|
+
records: List[Record]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing_extensions import Literal
|
|
4
|
+
|
|
5
|
+
from .._models import BaseModel
|
|
6
|
+
|
|
7
|
+
__all__ = ["DomainDeleteResponse"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class DomainDeleteResponse(BaseModel):
|
|
11
|
+
success: Literal[True]
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List, Optional
|
|
4
|
+
from typing_extensions import Literal
|
|
5
|
+
|
|
6
|
+
from pydantic import Field as FieldInfo
|
|
7
|
+
|
|
8
|
+
from .._models import BaseModel
|
|
9
|
+
|
|
10
|
+
__all__ = ["DomainListResponse", "Domain", "DomainDNSRecord"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class DomainDNSRecord(BaseModel):
|
|
14
|
+
name: str
|
|
15
|
+
|
|
16
|
+
type: Literal["TXT", "CNAME", "MX"]
|
|
17
|
+
|
|
18
|
+
value: str
|
|
19
|
+
|
|
20
|
+
is_verified: Optional[bool] = FieldInfo(alias="isVerified", default=None)
|
|
21
|
+
|
|
22
|
+
last_checked_at: Optional[str] = FieldInfo(alias="lastCheckedAt", default=None)
|
|
23
|
+
|
|
24
|
+
priority: Optional[float] = None
|
|
25
|
+
|
|
26
|
+
verification_status: Optional[Literal["verified", "missing", "pending"]] = FieldInfo(
|
|
27
|
+
alias="verificationStatus", default=None
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class Domain(BaseModel):
|
|
32
|
+
id: str
|
|
33
|
+
|
|
34
|
+
created_at: str = FieldInfo(alias="createdAt")
|
|
35
|
+
|
|
36
|
+
domain: str
|
|
37
|
+
|
|
38
|
+
is_managed_default: bool = FieldInfo(alias="isManagedDefault")
|
|
39
|
+
|
|
40
|
+
status: Literal["VERIFIED", "PENDING_VERIFICATION", "NOT_REGISTERED"]
|
|
41
|
+
|
|
42
|
+
updated_at: str = FieldInfo(alias="updatedAt")
|
|
43
|
+
|
|
44
|
+
verified_at: Optional[str] = FieldInfo(alias="verifiedAt", default=None)
|
|
45
|
+
|
|
46
|
+
dns_records: Optional[List[DomainDNSRecord]] = FieldInfo(alias="dnsRecords", default=None)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class DomainListResponse(BaseModel):
|
|
50
|
+
domains: List[Domain]
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List, Optional
|
|
4
|
+
from typing_extensions import Literal
|
|
5
|
+
|
|
6
|
+
from pydantic import Field as FieldInfo
|
|
7
|
+
|
|
8
|
+
from .._models import BaseModel
|
|
9
|
+
|
|
10
|
+
__all__ = ["DomainRetrieveResponse", "DNSRecord"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class DNSRecord(BaseModel):
|
|
14
|
+
name: str
|
|
15
|
+
|
|
16
|
+
type: Literal["TXT", "CNAME", "MX"]
|
|
17
|
+
|
|
18
|
+
value: str
|
|
19
|
+
|
|
20
|
+
is_verified: Optional[bool] = FieldInfo(alias="isVerified", default=None)
|
|
21
|
+
|
|
22
|
+
last_checked_at: Optional[str] = FieldInfo(alias="lastCheckedAt", default=None)
|
|
23
|
+
|
|
24
|
+
priority: Optional[float] = None
|
|
25
|
+
|
|
26
|
+
verification_status: Optional[Literal["verified", "missing", "pending"]] = FieldInfo(
|
|
27
|
+
alias="verificationStatus", default=None
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class DomainRetrieveResponse(BaseModel):
|
|
32
|
+
id: str
|
|
33
|
+
|
|
34
|
+
created_at: str = FieldInfo(alias="createdAt")
|
|
35
|
+
|
|
36
|
+
domain: str
|
|
37
|
+
|
|
38
|
+
is_managed_default: bool = FieldInfo(alias="isManagedDefault")
|
|
39
|
+
|
|
40
|
+
status: Literal["VERIFIED", "PENDING_VERIFICATION", "NOT_REGISTERED"]
|
|
41
|
+
|
|
42
|
+
updated_at: str = FieldInfo(alias="updatedAt")
|
|
43
|
+
|
|
44
|
+
verified_at: Optional[str] = FieldInfo(alias="verifiedAt", default=None)
|
|
45
|
+
|
|
46
|
+
dns_records: Optional[List[DNSRecord]] = FieldInfo(alias="dnsRecords", default=None)
|