retab 0.0.35__py3-none-any.whl → 0.0.37__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.
- {uiform → retab}/_utils/ai_models.py +2 -2
- {uiform → retab}/_utils/benchmarking.py +15 -16
- {uiform → retab}/_utils/chat.py +9 -14
- {uiform → retab}/_utils/display.py +0 -3
- {uiform → retab}/_utils/json_schema.py +9 -14
- {uiform → retab}/_utils/mime.py +11 -14
- {uiform → retab}/_utils/responses.py +9 -3
- {uiform → retab}/_utils/stream_context_managers.py +1 -1
- {uiform → retab}/_utils/usage/usage.py +28 -28
- {uiform → retab}/client.py +32 -31
- {uiform → retab}/resources/consensus/client.py +17 -36
- {uiform → retab}/resources/consensus/completions.py +24 -47
- {uiform → retab}/resources/consensus/completions_stream.py +26 -38
- {uiform → retab}/resources/consensus/responses.py +31 -80
- {uiform → retab}/resources/consensus/responses_stream.py +31 -79
- {uiform → retab}/resources/documents/client.py +59 -45
- {uiform → retab}/resources/documents/extractions.py +181 -90
- {uiform → retab}/resources/evals.py +56 -43
- retab/resources/evaluations/__init__.py +3 -0
- retab/resources/evaluations/client.py +301 -0
- retab/resources/evaluations/documents.py +233 -0
- retab/resources/evaluations/iterations.py +452 -0
- {uiform → retab}/resources/files.py +2 -2
- {uiform → retab}/resources/jsonlUtils.py +220 -216
- retab/resources/models.py +73 -0
- retab/resources/processors/automations/client.py +244 -0
- {uiform → retab}/resources/processors/automations/endpoints.py +77 -118
- retab/resources/processors/automations/links.py +294 -0
- {uiform → retab}/resources/processors/automations/logs.py +30 -19
- {uiform → retab}/resources/processors/automations/mailboxes.py +136 -174
- retab/resources/processors/automations/outlook.py +337 -0
- {uiform → retab}/resources/processors/automations/tests.py +22 -25
- {uiform → retab}/resources/processors/client.py +179 -164
- {uiform → retab}/resources/schemas.py +78 -66
- {uiform → retab}/resources/secrets/external_api_keys.py +1 -5
- retab/resources/secrets/webhook.py +64 -0
- {uiform → retab}/resources/usage.py +39 -2
- {uiform → retab}/types/ai_models.py +13 -13
- {uiform → retab}/types/automations/cron.py +19 -12
- {uiform → retab}/types/automations/endpoints.py +7 -4
- {uiform → retab}/types/automations/links.py +7 -3
- {uiform → retab}/types/automations/mailboxes.py +9 -9
- {uiform → retab}/types/automations/outlook.py +15 -11
- retab/types/browser_canvas.py +3 -0
- {uiform → retab}/types/chat.py +2 -2
- {uiform → retab}/types/completions.py +9 -12
- retab/types/consensus.py +19 -0
- {uiform → retab}/types/db/annotations.py +3 -3
- {uiform → retab}/types/db/files.py +8 -6
- {uiform → retab}/types/documents/create_messages.py +18 -20
- {uiform → retab}/types/documents/extractions.py +69 -24
- {uiform → retab}/types/evals.py +5 -5
- retab/types/evaluations/__init__.py +31 -0
- retab/types/evaluations/documents.py +30 -0
- retab/types/evaluations/iterations.py +112 -0
- retab/types/evaluations/model.py +73 -0
- retab/types/events.py +79 -0
- {uiform → retab}/types/extractions.py +33 -10
- retab/types/inference_settings.py +15 -0
- retab/types/jobs/base.py +54 -0
- retab/types/jobs/batch_annotation.py +12 -0
- {uiform → retab}/types/jobs/evaluation.py +1 -2
- {uiform → retab}/types/logs.py +37 -34
- retab/types/metrics.py +32 -0
- {uiform → retab}/types/mime.py +22 -20
- {uiform → retab}/types/modalities.py +10 -10
- retab/types/predictions.py +19 -0
- {uiform → retab}/types/schemas/enhance.py +4 -2
- {uiform → retab}/types/schemas/evaluate.py +7 -4
- {uiform → retab}/types/schemas/generate.py +6 -3
- {uiform → retab}/types/schemas/layout.py +1 -1
- {uiform → retab}/types/schemas/object.py +13 -14
- {uiform → retab}/types/schemas/templates.py +1 -3
- {uiform → retab}/types/secrets/external_api_keys.py +0 -1
- {uiform → retab}/types/standards.py +18 -1
- {retab-0.0.35.dist-info → retab-0.0.37.dist-info}/METADATA +7 -6
- retab-0.0.37.dist-info/RECORD +107 -0
- retab-0.0.37.dist-info/top_level.txt +1 -0
- retab-0.0.35.dist-info/RECORD +0 -111
- retab-0.0.35.dist-info/top_level.txt +0 -1
- uiform/_utils/benchmarking copy.py +0 -588
- uiform/resources/deployments/__init__.py +0 -9
- uiform/resources/deployments/client.py +0 -78
- uiform/resources/deployments/endpoints.py +0 -322
- uiform/resources/deployments/links.py +0 -452
- uiform/resources/deployments/logs.py +0 -211
- uiform/resources/deployments/mailboxes.py +0 -496
- uiform/resources/deployments/outlook.py +0 -531
- uiform/resources/deployments/tests.py +0 -158
- uiform/resources/models.py +0 -45
- uiform/resources/processors/automations/client.py +0 -78
- uiform/resources/processors/automations/links.py +0 -356
- uiform/resources/processors/automations/outlook.py +0 -444
- uiform/resources/secrets/webhook.py +0 -62
- uiform/types/consensus.py +0 -10
- uiform/types/deployments/cron.py +0 -59
- uiform/types/deployments/endpoints.py +0 -28
- uiform/types/deployments/links.py +0 -36
- uiform/types/deployments/mailboxes.py +0 -67
- uiform/types/deployments/outlook.py +0 -76
- uiform/types/deployments/webhooks.py +0 -21
- uiform/types/events.py +0 -76
- uiform/types/jobs/base.py +0 -150
- uiform/types/jobs/batch_annotation.py +0 -22
- uiform/types/secrets/__init__.py +0 -0
- {uiform → retab}/__init__.py +0 -0
- {uiform → retab}/_resource.py +0 -0
- {uiform → retab}/_utils/__init__.py +0 -0
- {uiform → retab}/_utils/usage/__init__.py +0 -0
- {uiform → retab}/py.typed +0 -0
- {uiform → retab}/resources/__init__.py +0 -0
- {uiform → retab}/resources/consensus/__init__.py +0 -0
- {uiform → retab}/resources/documents/__init__.py +0 -0
- {uiform → retab}/resources/finetuning.py +0 -0
- {uiform → retab}/resources/openai_example.py +0 -0
- {uiform → retab}/resources/processors/__init__.py +0 -0
- {uiform → retab}/resources/processors/automations/__init__.py +0 -0
- {uiform → retab}/resources/prompt_optimization.py +0 -0
- {uiform → retab}/resources/secrets/__init__.py +0 -0
- {uiform → retab}/resources/secrets/client.py +0 -0
- {uiform → retab}/types/__init__.py +0 -0
- {uiform → retab}/types/automations/__init__.py +0 -0
- {uiform → retab}/types/automations/webhooks.py +0 -0
- {uiform → retab}/types/db/__init__.py +0 -0
- {uiform/types/deployments → retab/types/documents}/__init__.py +0 -0
- {uiform → retab}/types/documents/correct_orientation.py +0 -0
- {uiform/types/documents → retab/types/jobs}/__init__.py +0 -0
- {uiform → retab}/types/jobs/finetune.py +0 -0
- {uiform → retab}/types/jobs/prompt_optimization.py +0 -0
- {uiform → retab}/types/jobs/webcrawl.py +0 -0
- {uiform → retab}/types/pagination.py +0 -0
- {uiform/types/jobs → retab/types/schemas}/__init__.py +0 -0
- {uiform/types/schemas → retab/types/secrets}/__init__.py +0 -0
- {retab-0.0.35.dist-info → retab-0.0.37.dist-info}/WHEEL +0 -0
@@ -1,66 +1,45 @@
|
|
1
|
-
import datetime
|
2
|
-
import json
|
3
1
|
from io import IOBase
|
4
2
|
from pathlib import Path
|
5
|
-
from typing import Any,
|
3
|
+
from typing import Any, List, Literal, Optional
|
6
4
|
|
7
|
-
import
|
8
|
-
from
|
9
|
-
from PIL.Image import Image
|
10
|
-
from pydantic import HttpUrl
|
5
|
+
from pydantic import EmailStr, HttpUrl
|
6
|
+
from pydantic_core import PydanticUndefined
|
11
7
|
|
12
8
|
from ...._resource import AsyncAPIResource, SyncAPIResource
|
13
|
-
from ...._utils.ai_models import assert_valid_model_extraction
|
14
9
|
from ...._utils.mime import prepare_mime_document
|
15
10
|
from ....types.automations.mailboxes import ListMailboxes, Mailbox, UpdateMailboxRequest
|
16
|
-
from ....types.
|
17
|
-
from ....types.logs import AutomationLog, ExternalRequestLog
|
18
|
-
from ....types.mime import BaseMIMEData, EmailData, MIMEData
|
19
|
-
from ....types.modalities import Modality
|
11
|
+
from ....types.mime import EmailData, MIMEData
|
20
12
|
from ....types.standards import PreparedRequest
|
21
13
|
|
22
14
|
|
23
15
|
class MailBoxesMixin:
|
16
|
+
mailboxes_base_url: str = "/v1/processors/automations/mailboxes"
|
17
|
+
|
24
18
|
def prepare_create(
|
25
19
|
self,
|
26
20
|
email: str,
|
27
21
|
name: str,
|
28
|
-
|
29
|
-
webhook_url:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
# DocumentExtraction Config
|
36
|
-
image_resolution_dpi: int = 96,
|
37
|
-
browser_canvas: Literal['A3', 'A4', 'A5'] = 'A4',
|
38
|
-
modality: Modality = "native",
|
39
|
-
model: str = "gpt-4o-mini",
|
40
|
-
temperature: float = 0,
|
41
|
-
reasoning_effort: ChatCompletionReasoningEffort = "medium",
|
22
|
+
processor_id: str,
|
23
|
+
webhook_url: str,
|
24
|
+
authorized_domains: list[str] = PydanticUndefined, # type: ignore[assignment]
|
25
|
+
authorized_emails: list[EmailStr] = PydanticUndefined, # type: ignore[assignment]
|
26
|
+
webhook_headers: dict[str, str] = PydanticUndefined, # type: ignore[assignment]
|
27
|
+
default_language: str = PydanticUndefined, # type: ignore[assignment]
|
28
|
+
need_validation: bool = PydanticUndefined, # type: ignore[assignment]
|
42
29
|
) -> PreparedRequest:
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
"model": model,
|
57
|
-
"temperature": temperature,
|
58
|
-
"reasoning_effort": reasoning_effort,
|
59
|
-
}
|
60
|
-
|
61
|
-
# Validate the data
|
62
|
-
mailbox_data = Mailbox.model_validate(data)
|
63
|
-
return PreparedRequest(method="POST", url="/v1/deployments/mailboxes", data=mailbox_data.model_dump(mode="json"))
|
30
|
+
"""Create a new email automation configuration."""
|
31
|
+
mailbox = Mailbox(
|
32
|
+
name=name,
|
33
|
+
processor_id=processor_id,
|
34
|
+
default_language=default_language,
|
35
|
+
webhook_url=webhook_url,
|
36
|
+
webhook_headers=webhook_headers,
|
37
|
+
need_validation=need_validation,
|
38
|
+
email=email,
|
39
|
+
authorized_domains=authorized_domains,
|
40
|
+
authorized_emails=authorized_emails,
|
41
|
+
)
|
42
|
+
return PreparedRequest(method="POST", url=self.mailboxes_base_url, data=mailbox.model_dump(mode="json"))
|
64
43
|
|
65
44
|
def prepare_list(
|
66
45
|
self,
|
@@ -71,8 +50,6 @@ class MailBoxesMixin:
|
|
71
50
|
email: Optional[str] = None,
|
72
51
|
name: Optional[str] = None,
|
73
52
|
webhook_url: Optional[str] = None,
|
74
|
-
schema_id: Optional[str] = None,
|
75
|
-
schema_data_id: Optional[str] = None,
|
76
53
|
) -> PreparedRequest:
|
77
54
|
params = {
|
78
55
|
"before": before,
|
@@ -82,64 +59,44 @@ class MailBoxesMixin:
|
|
82
59
|
"email": email,
|
83
60
|
"name": name,
|
84
61
|
"webhook_url": webhook_url,
|
85
|
-
"schema_id": schema_id,
|
86
|
-
"schema_data_id": schema_data_id,
|
87
62
|
}
|
88
63
|
# Remove None values
|
89
64
|
params = {k: v for k, v in params.items() if v is not None}
|
90
65
|
|
91
|
-
return PreparedRequest(method="GET", url=
|
66
|
+
return PreparedRequest(method="GET", url=self.mailboxes_base_url, params=params)
|
92
67
|
|
93
68
|
def prepare_get(self, email: str) -> PreparedRequest:
|
94
|
-
return PreparedRequest(method="GET", url=f"/
|
69
|
+
return PreparedRequest(method="GET", url=f"{self.mailboxes_base_url}/{email}")
|
70
|
+
|
71
|
+
def prepare_get_from_id(self, mailbox_id: str) -> PreparedRequest:
|
72
|
+
return PreparedRequest(method="GET", url=f"{self.mailboxes_base_url}/from_id/{mailbox_id}")
|
95
73
|
|
96
74
|
def prepare_update(
|
97
75
|
self,
|
98
76
|
email: str,
|
99
|
-
name:
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
modality: Optional[Modality] = None,
|
107
|
-
model: Optional[str] = None,
|
108
|
-
temperature: Optional[float] = None,
|
109
|
-
reasoning_effort: Optional[ChatCompletionReasoningEffort] = None,
|
110
|
-
json_schema: Optional[Dict[str, Any]] = None,
|
77
|
+
name: str = PydanticUndefined, # type: ignore[assignment]
|
78
|
+
default_language: str = PydanticUndefined, # type: ignore[assignment]
|
79
|
+
webhook_url: str = PydanticUndefined, # type: ignore[assignment]
|
80
|
+
webhook_headers: dict[str, str] = PydanticUndefined, # type: ignore[assignment]
|
81
|
+
need_validation: bool = PydanticUndefined, # type: ignore[assignment]
|
82
|
+
authorized_domains: list[str] = PydanticUndefined, # type: ignore[assignment]
|
83
|
+
authorized_emails: list[str] = PydanticUndefined, # type: ignore[assignment]
|
111
84
|
) -> PreparedRequest:
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
"image_resolution_dpi": image_resolution_dpi,
|
121
|
-
"browser_canvas": browser_canvas,
|
122
|
-
"modality": modality,
|
123
|
-
"model": model,
|
124
|
-
"temperature": temperature,
|
125
|
-
"reasoning_effort": reasoning_effort,
|
126
|
-
"json_schema": json_schema,
|
127
|
-
}.items() if v is not None
|
128
|
-
}
|
129
|
-
|
130
|
-
if "model" in data:
|
131
|
-
assert_valid_model_extraction(data["model"])
|
132
|
-
|
133
|
-
update_mailbox_request = UpdateMailboxRequest.model_validate(data)
|
134
|
-
return PreparedRequest(
|
135
|
-
method="PUT",
|
136
|
-
url=f"/v1/processors/automations/mailboxes/{email}",
|
137
|
-
data=update_mailbox_request.model_dump(mode="json")
|
85
|
+
update_mailbox_request = UpdateMailboxRequest(
|
86
|
+
name=name,
|
87
|
+
default_language=default_language,
|
88
|
+
webhook_url=webhook_url,
|
89
|
+
webhook_headers=webhook_headers,
|
90
|
+
need_validation=need_validation,
|
91
|
+
authorized_domains=authorized_domains,
|
92
|
+
authorized_emails=authorized_emails,
|
138
93
|
)
|
94
|
+
return PreparedRequest(method="PUT", url=f"/v1/processors/automations/mailboxes/{email}", data=update_mailbox_request.model_dump(mode="json"))
|
139
95
|
|
140
96
|
def prepare_delete(self, email: str) -> PreparedRequest:
|
141
97
|
return PreparedRequest(method="DELETE", url=f"/v1/processors/automations/mailboxes/{email}", raise_for_status=True)
|
142
98
|
|
99
|
+
|
143
100
|
class Mailboxes(SyncAPIResource, MailBoxesMixin):
|
144
101
|
"""Emails API wrapper for managing email automation configurations"""
|
145
102
|
|
@@ -151,43 +108,39 @@ class Mailboxes(SyncAPIResource, MailBoxesMixin):
|
|
151
108
|
self,
|
152
109
|
email: str,
|
153
110
|
name: str,
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
# DocumentExtraction Config
|
162
|
-
image_resolution_dpi: int = 96,
|
163
|
-
browser_canvas: Literal['A3', 'A4', 'A5'] = 'A4',
|
164
|
-
modality: Modality = "native",
|
165
|
-
model: str = "gpt-4o-mini",
|
166
|
-
temperature: float = 0,
|
167
|
-
reasoning_effort: ChatCompletionReasoningEffort = "medium",
|
111
|
+
webhook_url: str,
|
112
|
+
processor_id: str,
|
113
|
+
authorized_domains: list[str] = PydanticUndefined, # type: ignore[assignment]
|
114
|
+
authorized_emails: list[EmailStr] = PydanticUndefined, # type: ignore[assignment]
|
115
|
+
webhook_headers: dict[str, str] = PydanticUndefined, # type: ignore[assignment]
|
116
|
+
default_language: str = PydanticUndefined, # type: ignore[assignment]
|
117
|
+
need_validation: bool = PydanticUndefined, # type: ignore[assignment]
|
168
118
|
) -> Mailbox:
|
169
119
|
"""Create a new email automation configuration.
|
170
120
|
|
171
121
|
Args:
|
172
122
|
email: Email address for the mailbox
|
173
|
-
|
123
|
+
name: Name of the mailbox
|
174
124
|
webhook_url: Webhook URL to receive processed emails
|
175
|
-
|
125
|
+
processor_id: ID of the processor to use for the mailbox
|
176
126
|
authorized_domains: List of authorized domains for the mailbox
|
177
127
|
authorized_emails: List of authorized emails for the mailbox
|
178
|
-
|
179
|
-
browser_canvas: Browser canvas size
|
180
|
-
modality: Processing modality (currently only "native" supported)
|
181
|
-
model: AI model to use for processing
|
182
|
-
temperature: Model temperature setting
|
183
|
-
reasoning_effort: The effort level for the model to reason about the input data.
|
128
|
+
webhook_headers: Webhook headers to send with processed emails
|
184
129
|
|
185
130
|
Returns:
|
186
131
|
Mailbox: The created mailbox configuration
|
187
132
|
"""
|
188
133
|
|
189
134
|
request = self.prepare_create(
|
190
|
-
email,
|
135
|
+
email=email,
|
136
|
+
name=name,
|
137
|
+
processor_id=processor_id,
|
138
|
+
webhook_url=webhook_url,
|
139
|
+
authorized_domains=authorized_domains,
|
140
|
+
authorized_emails=authorized_emails,
|
141
|
+
webhook_headers=webhook_headers,
|
142
|
+
default_language=default_language,
|
143
|
+
need_validation=need_validation,
|
191
144
|
)
|
192
145
|
response = self._client._prepared_request(request)
|
193
146
|
|
@@ -201,10 +154,9 @@ class Mailboxes(SyncAPIResource, MailBoxesMixin):
|
|
201
154
|
after: str | None = None,
|
202
155
|
limit: int = 10,
|
203
156
|
order: Literal["asc", "desc"] | None = "desc",
|
157
|
+
name: Optional[str] = None,
|
204
158
|
email: Optional[str] = None,
|
205
159
|
webhook_url: Optional[str] = None,
|
206
|
-
schema_id: Optional[str] = None,
|
207
|
-
schema_data_id: Optional[str] = None,
|
208
160
|
) -> ListMailboxes:
|
209
161
|
"""List all email automation configurations.
|
210
162
|
|
@@ -221,7 +173,15 @@ class Mailboxes(SyncAPIResource, MailBoxesMixin):
|
|
221
173
|
Returns:
|
222
174
|
ListMailboxes: List of mailbox configurations
|
223
175
|
"""
|
224
|
-
request = self.prepare_list(
|
176
|
+
request = self.prepare_list(
|
177
|
+
before=before,
|
178
|
+
after=after,
|
179
|
+
limit=limit,
|
180
|
+
order=order,
|
181
|
+
email=email,
|
182
|
+
name=name,
|
183
|
+
webhook_url=webhook_url,
|
184
|
+
)
|
225
185
|
response = self._client._prepared_request(request)
|
226
186
|
return ListMailboxes.model_validate(response)
|
227
187
|
|
@@ -241,43 +201,38 @@ class Mailboxes(SyncAPIResource, MailBoxesMixin):
|
|
241
201
|
def update(
|
242
202
|
self,
|
243
203
|
email: str,
|
244
|
-
name:
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
modality: Optional[Modality] = None,
|
252
|
-
model: Optional[str] = None,
|
253
|
-
temperature: Optional[float] = None,
|
254
|
-
reasoning_effort: Optional[ChatCompletionReasoningEffort] = None,
|
255
|
-
json_schema: Optional[Dict[str, Any]] = None,
|
204
|
+
name: str = PydanticUndefined, # type: ignore[assignment]
|
205
|
+
default_language: str = PydanticUndefined, # type: ignore[assignment]
|
206
|
+
webhook_url: str = PydanticUndefined, # type: ignore[assignment]
|
207
|
+
webhook_headers: dict[str, str] = PydanticUndefined, # type: ignore[assignment]
|
208
|
+
need_validation: bool = PydanticUndefined, # type: ignore[assignment]
|
209
|
+
authorized_domains: List[str] = PydanticUndefined, # type: ignore[assignment]
|
210
|
+
authorized_emails: List[str] = PydanticUndefined, # type: ignore[assignment]
|
256
211
|
) -> Mailbox:
|
257
212
|
"""Update an email automation configuration.
|
258
213
|
|
259
214
|
Args:
|
260
215
|
email: Email address of the mailbox to update
|
216
|
+
name: New name
|
217
|
+
default_language: New default language
|
261
218
|
webhook_url: New webhook configuration
|
262
219
|
webhook_headers: New webhook configuration
|
263
|
-
|
264
|
-
file_payload: New webhook configuration
|
265
|
-
follow_up: New webhook configuration
|
220
|
+
need_validation: New webhook configuration
|
266
221
|
authorized_domains: New webhook configuration
|
267
222
|
authorized_emails: New webhook configuration
|
268
|
-
image_resolution_dpi: New image resolution DPI
|
269
|
-
browser_canvas: New browser canvas size
|
270
|
-
modality: New processing modality
|
271
|
-
model: New AI model
|
272
|
-
temperature: New temperature setting
|
273
|
-
reasoning_effort: New reasoning effort
|
274
|
-
json_schema: New JSON schema
|
275
223
|
|
276
224
|
Returns:
|
277
225
|
Mailbox: The updated mailbox configuration
|
278
226
|
"""
|
279
227
|
request = self.prepare_update(
|
280
|
-
email,
|
228
|
+
email=email,
|
229
|
+
name=name,
|
230
|
+
default_language=default_language,
|
231
|
+
webhook_url=webhook_url,
|
232
|
+
webhook_headers=webhook_headers,
|
233
|
+
need_validation=need_validation,
|
234
|
+
authorized_domains=authorized_domains,
|
235
|
+
authorized_emails=authorized_emails,
|
281
236
|
)
|
282
237
|
response = self._client._prepared_request(request)
|
283
238
|
return Mailbox.model_validate(response)
|
@@ -289,9 +244,10 @@ class Mailboxes(SyncAPIResource, MailBoxesMixin):
|
|
289
244
|
email: Email address of the mailbox to delete
|
290
245
|
"""
|
291
246
|
request = self.prepare_delete(email)
|
292
|
-
|
247
|
+
self._client._prepared_request(request)
|
293
248
|
return None
|
294
249
|
|
250
|
+
|
295
251
|
class AsyncMailboxes(AsyncAPIResource, MailBoxesMixin):
|
296
252
|
def __init__(self, client: Any) -> None:
|
297
253
|
super().__init__(client=client)
|
@@ -301,20 +257,24 @@ class AsyncMailboxes(AsyncAPIResource, MailBoxesMixin):
|
|
301
257
|
self,
|
302
258
|
email: str,
|
303
259
|
name: str,
|
304
|
-
|
305
|
-
|
306
|
-
authorized_domains: List[str] = []
|
307
|
-
authorized_emails: List[
|
308
|
-
webhook_headers:
|
309
|
-
|
310
|
-
|
311
|
-
modality: Modality = "native",
|
312
|
-
model: str = "gpt-4o-mini",
|
313
|
-
temperature: float = 0,
|
314
|
-
reasoning_effort: ChatCompletionReasoningEffort = "medium",
|
260
|
+
webhook_url: str,
|
261
|
+
processor_id: str,
|
262
|
+
authorized_domains: List[str] = PydanticUndefined, # type: ignore[assignment]
|
263
|
+
authorized_emails: List[EmailStr] = PydanticUndefined, # type: ignore[assignment]
|
264
|
+
webhook_headers: dict[str, str] = PydanticUndefined, # type: ignore[assignment]
|
265
|
+
default_language: str = PydanticUndefined, # type: ignore[assignment]
|
266
|
+
need_validation: bool = PydanticUndefined, # type: ignore[assignment]
|
315
267
|
) -> Mailbox:
|
316
268
|
request = self.prepare_create(
|
317
|
-
|
269
|
+
email=email,
|
270
|
+
name=name,
|
271
|
+
processor_id=processor_id,
|
272
|
+
webhook_url=webhook_url,
|
273
|
+
authorized_domains=authorized_domains,
|
274
|
+
authorized_emails=authorized_emails,
|
275
|
+
webhook_headers=webhook_headers,
|
276
|
+
default_language=default_language,
|
277
|
+
need_validation=need_validation,
|
318
278
|
)
|
319
279
|
response = await self._client._prepared_request(request)
|
320
280
|
|
@@ -328,13 +288,11 @@ class AsyncMailboxes(AsyncAPIResource, MailBoxesMixin):
|
|
328
288
|
after: str | None = None,
|
329
289
|
limit: int = 10,
|
330
290
|
order: Literal["asc", "desc"] | None = "desc",
|
331
|
-
email:
|
332
|
-
name:
|
333
|
-
webhook_url:
|
334
|
-
schema_id: Optional[str] = None,
|
335
|
-
schema_data_id: Optional[str] = None,
|
291
|
+
email: str | None = None,
|
292
|
+
name: str | None = None,
|
293
|
+
webhook_url: str | None = None,
|
336
294
|
) -> ListMailboxes:
|
337
|
-
request = self.prepare_list(before, after, limit, order, email,
|
295
|
+
request = self.prepare_list(before=before, after=after, limit=limit, order=order, email=email, name=name, webhook_url=webhook_url)
|
338
296
|
response = await self._client._prepared_request(request)
|
339
297
|
return ListMailboxes.model_validate(response)
|
340
298
|
|
@@ -346,21 +304,23 @@ class AsyncMailboxes(AsyncAPIResource, MailBoxesMixin):
|
|
346
304
|
async def update(
|
347
305
|
self,
|
348
306
|
email: str,
|
349
|
-
name:
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
modality: Optional[Modality] = None,
|
357
|
-
model: Optional[str] = None,
|
358
|
-
temperature: Optional[float] = None,
|
359
|
-
reasoning_effort: Optional[ChatCompletionReasoningEffort] = None,
|
360
|
-
json_schema: Optional[Dict[str, Any]] = None,
|
307
|
+
name: str = PydanticUndefined, # type: ignore[assignment]
|
308
|
+
default_language: str = PydanticUndefined, # type: ignore[assignment]
|
309
|
+
webhook_url: str = PydanticUndefined, # type: ignore[assignment]
|
310
|
+
webhook_headers: dict[str, str] = PydanticUndefined, # type: ignore[assignment]
|
311
|
+
need_validation: bool = PydanticUndefined, # type: ignore[assignment]
|
312
|
+
authorized_domains: List[str] = PydanticUndefined, # type: ignore[assignment]
|
313
|
+
authorized_emails: List[str] = PydanticUndefined, # type: ignore[assignment]
|
361
314
|
) -> Mailbox:
|
362
315
|
request = self.prepare_update(
|
363
|
-
email,
|
316
|
+
email=email,
|
317
|
+
name=name,
|
318
|
+
default_language=default_language,
|
319
|
+
webhook_url=webhook_url,
|
320
|
+
webhook_headers=webhook_headers,
|
321
|
+
need_validation=need_validation,
|
322
|
+
authorized_domains=authorized_domains,
|
323
|
+
authorized_emails=authorized_emails,
|
364
324
|
)
|
365
325
|
response = await self._client._prepared_request(request)
|
366
326
|
return Mailbox.model_validate(response)
|
@@ -382,8 +342,8 @@ class TestMailboxesMixin:
|
|
382
342
|
return PreparedRequest(method="POST", url=f"/v1/processors/automations/mailboxes/tests/forward/{email}", data={"document": mime_document.model_dump()})
|
383
343
|
|
384
344
|
def print_forward_verbose(self, email_data: EmailData) -> None:
|
385
|
-
print(
|
386
|
-
print(
|
345
|
+
print("\nTEST EMAIL FORWARDING RESULTS:")
|
346
|
+
print("\n#########################")
|
387
347
|
print(f"Email ID: {email_data.id}")
|
388
348
|
print(f"Subject: {email_data.subject}")
|
389
349
|
print(f"From: {email_data.sender}")
|
@@ -396,6 +356,7 @@ class TestMailboxesMixin:
|
|
396
356
|
print("\nBody Preview:")
|
397
357
|
print(email_data.body_plain[:500] + "..." if len(email_data.body_plain) > 500 else email_data.body_plain)
|
398
358
|
|
359
|
+
|
399
360
|
class TestMailboxes(SyncAPIResource, TestMailboxesMixin):
|
400
361
|
def forward(
|
401
362
|
self,
|
@@ -420,6 +381,7 @@ class TestMailboxes(SyncAPIResource, TestMailboxesMixin):
|
|
420
381
|
self.print_forward_verbose(email_data)
|
421
382
|
return email_data
|
422
383
|
|
384
|
+
|
423
385
|
class AsyncTestMailboxes(AsyncAPIResource, TestMailboxesMixin):
|
424
386
|
async def forward(
|
425
387
|
self,
|