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
@@ -0,0 +1,294 @@
|
|
1
|
+
from typing import Any, Literal, Optional
|
2
|
+
|
3
|
+
from pydantic_core import PydanticUndefined
|
4
|
+
|
5
|
+
from ...._resource import AsyncAPIResource, SyncAPIResource
|
6
|
+
from ....types.automations.links import Link, ListLinks, UpdateLinkRequest
|
7
|
+
from ....types.standards import PreparedRequest
|
8
|
+
|
9
|
+
|
10
|
+
class LinksMixin:
|
11
|
+
links_base_url: str = "/v1/processors/automations/links"
|
12
|
+
|
13
|
+
def prepare_create(
|
14
|
+
self,
|
15
|
+
processor_id: str,
|
16
|
+
name: str,
|
17
|
+
webhook_url: str,
|
18
|
+
webhook_headers: dict[str, str] = PydanticUndefined, # type: ignore[assignment]
|
19
|
+
need_validation: bool = PydanticUndefined, # type: ignore[assignment]
|
20
|
+
password: str | None = PydanticUndefined, # type: ignore[assignment]
|
21
|
+
) -> PreparedRequest:
|
22
|
+
request = Link(
|
23
|
+
processor_id=processor_id,
|
24
|
+
name=name,
|
25
|
+
webhook_url=webhook_url,
|
26
|
+
webhook_headers=webhook_headers,
|
27
|
+
need_validation=need_validation,
|
28
|
+
password=password,
|
29
|
+
)
|
30
|
+
return PreparedRequest(method="POST", url=self.links_base_url, data=request.model_dump(mode="json"))
|
31
|
+
|
32
|
+
def prepare_list(
|
33
|
+
self,
|
34
|
+
before: Optional[str] = None,
|
35
|
+
after: Optional[str] = None,
|
36
|
+
limit: Optional[int] = 10,
|
37
|
+
order: Optional[Literal["asc", "desc"]] = "desc",
|
38
|
+
# Filtering parameters
|
39
|
+
processor_id: Optional[str] = None,
|
40
|
+
name: Optional[str] = None,
|
41
|
+
) -> PreparedRequest:
|
42
|
+
params = {
|
43
|
+
"before": before,
|
44
|
+
"after": after,
|
45
|
+
"limit": limit,
|
46
|
+
"order": order,
|
47
|
+
"processor_id": processor_id,
|
48
|
+
"name": name,
|
49
|
+
}
|
50
|
+
# Remove None values
|
51
|
+
params = {k: v for k, v in params.items() if v is not None}
|
52
|
+
|
53
|
+
return PreparedRequest(method="GET", url=self.links_base_url, params=params)
|
54
|
+
|
55
|
+
def prepare_get(self, link_id: str) -> PreparedRequest:
|
56
|
+
"""Get a specific extraction link configuration.
|
57
|
+
|
58
|
+
Args:
|
59
|
+
link_id: ID of the extraction link
|
60
|
+
|
61
|
+
Returns:
|
62
|
+
Link: The extraction link configuration
|
63
|
+
"""
|
64
|
+
return PreparedRequest(method="GET", url=f"{self.links_base_url}/{link_id}")
|
65
|
+
|
66
|
+
def prepare_update(
|
67
|
+
self,
|
68
|
+
link_id: str,
|
69
|
+
name: str = PydanticUndefined, # type: ignore[assignment]
|
70
|
+
webhook_url: str = PydanticUndefined, # type: ignore[assignment]
|
71
|
+
webhook_headers: dict[str, str] = PydanticUndefined, # type: ignore[assignment]
|
72
|
+
need_validation: bool = PydanticUndefined, # type: ignore[assignment]
|
73
|
+
password: str | None = PydanticUndefined, # type: ignore[assignment]
|
74
|
+
) -> PreparedRequest:
|
75
|
+
request = UpdateLinkRequest(
|
76
|
+
name=name,
|
77
|
+
webhook_url=webhook_url,
|
78
|
+
webhook_headers=webhook_headers,
|
79
|
+
need_validation=need_validation,
|
80
|
+
password=password,
|
81
|
+
)
|
82
|
+
return PreparedRequest(method="PUT", url=f"{self.links_base_url}/{link_id}", data=request.model_dump(mode="json", exclude_unset=True, exclude_defaults=True))
|
83
|
+
|
84
|
+
def prepare_delete(self, link_id: str) -> PreparedRequest:
|
85
|
+
return PreparedRequest(method="DELETE", url=f"{self.links_base_url}/{link_id}", raise_for_status=True)
|
86
|
+
|
87
|
+
|
88
|
+
class Links(SyncAPIResource, LinksMixin):
|
89
|
+
"""Extraction Link API wrapper for managing extraction link configurations"""
|
90
|
+
|
91
|
+
def __init__(self, client: Any) -> None:
|
92
|
+
super().__init__(client=client)
|
93
|
+
|
94
|
+
def create(
|
95
|
+
self,
|
96
|
+
processor_id: str,
|
97
|
+
name: str,
|
98
|
+
webhook_url: str,
|
99
|
+
webhook_headers: dict[str, str] = PydanticUndefined, # type: ignore[assignment]
|
100
|
+
need_validation: bool = PydanticUndefined, # type: ignore[assignment]
|
101
|
+
password: str | None = PydanticUndefined, # type: ignore[assignment]
|
102
|
+
) -> Link:
|
103
|
+
"""Create a new extraction link configuration.
|
104
|
+
|
105
|
+
Args:
|
106
|
+
name: Name of the extraction link
|
107
|
+
json_schema: JSON schema to validate extracted data
|
108
|
+
webhook_url: Webhook endpoint for forwarding processed files
|
109
|
+
webhook_headers: Optional HTTP headers for webhook requests
|
110
|
+
password: Optional password for protected links
|
111
|
+
image_resolution_dpi: Optional image resolution DPI
|
112
|
+
browser_canvas: Optional browser canvas
|
113
|
+
modality: Processing modality (currently only "native" supported)
|
114
|
+
model: AI model to use for processing
|
115
|
+
temperature: Model temperature setting
|
116
|
+
reasoning_effort: The effort level for the model to reason about the input data.
|
117
|
+
Returns:
|
118
|
+
Link: The created extraction link configuration
|
119
|
+
"""
|
120
|
+
|
121
|
+
request = self.prepare_create(
|
122
|
+
processor_id=processor_id,
|
123
|
+
name=name,
|
124
|
+
webhook_url=webhook_url,
|
125
|
+
webhook_headers=webhook_headers,
|
126
|
+
need_validation=need_validation,
|
127
|
+
password=password,
|
128
|
+
)
|
129
|
+
response = self._client._prepared_request(request)
|
130
|
+
|
131
|
+
print(f"Extraction Link Created. Link available at https://www.uiform.com/dashboard/processors/{response['id']}")
|
132
|
+
return Link.model_validate(response)
|
133
|
+
|
134
|
+
def list(
|
135
|
+
self,
|
136
|
+
before: Optional[str] = None,
|
137
|
+
after: Optional[str] = None,
|
138
|
+
limit: Optional[int] = 10,
|
139
|
+
order: Optional[Literal["asc", "desc"]] = "desc",
|
140
|
+
# Filtering parameters
|
141
|
+
processor_id: Optional[str] = None,
|
142
|
+
name: Optional[str] = None,
|
143
|
+
) -> ListLinks:
|
144
|
+
"""List extraction link configurations with pagination support.
|
145
|
+
|
146
|
+
Args:
|
147
|
+
before: Optional cursor for pagination before a specific link ID
|
148
|
+
after: Optional cursor for pagination after a specific link ID
|
149
|
+
limit: Optional limit on number of results (max 100)
|
150
|
+
order: Optional sort order ("asc" or "desc")
|
151
|
+
processor_id: Optional filter by processor ID
|
152
|
+
name: Optional filter by link name
|
153
|
+
|
154
|
+
Returns:
|
155
|
+
ListLinks: Paginated list of extraction link configurations with metadata
|
156
|
+
"""
|
157
|
+
request = self.prepare_list(before=before, after=after, limit=limit, order=order, processor_id=processor_id, name=name)
|
158
|
+
response = self._client._prepared_request(request)
|
159
|
+
return ListLinks.model_validate(response)
|
160
|
+
|
161
|
+
def get(self, link_id: str) -> Link:
|
162
|
+
"""Get a specific extraction link configuration.
|
163
|
+
|
164
|
+
Args:
|
165
|
+
link_id: ID of the extraction link
|
166
|
+
|
167
|
+
Returns:
|
168
|
+
Link: The extraction link configuration
|
169
|
+
"""
|
170
|
+
request = self.prepare_get(link_id)
|
171
|
+
response = self._client._prepared_request(request)
|
172
|
+
return Link.model_validate(response)
|
173
|
+
|
174
|
+
def update(
|
175
|
+
self,
|
176
|
+
link_id: str,
|
177
|
+
name: str = PydanticUndefined, # type: ignore[assignment]
|
178
|
+
webhook_url: str = PydanticUndefined, # type: ignore[assignment]
|
179
|
+
webhook_headers: dict[str, str] = PydanticUndefined, # type: ignore[assignment]
|
180
|
+
password: str | None = PydanticUndefined, # type: ignore[assignment]
|
181
|
+
need_validation: bool = PydanticUndefined, # type: ignore[assignment]
|
182
|
+
) -> Link:
|
183
|
+
"""Update an extraction link configuration.
|
184
|
+
|
185
|
+
Args:
|
186
|
+
link_id: ID of the extraction link to update
|
187
|
+
name: New name for the link
|
188
|
+
webhook_url: New webhook endpoint URL
|
189
|
+
webhook_headers: New webhook headers
|
190
|
+
password: New password for protected links
|
191
|
+
image_resolution_dpi: New image resolution DPI
|
192
|
+
browser_canvas: New browser canvas
|
193
|
+
modality: New processing modality
|
194
|
+
model: New AI model
|
195
|
+
temperature: New temperature setting
|
196
|
+
reasoning_effort: The effort level for the model to reason about the input data.
|
197
|
+
json_schema: New JSON schema
|
198
|
+
|
199
|
+
Returns:
|
200
|
+
Link: The updated extraction link configuration
|
201
|
+
"""
|
202
|
+
|
203
|
+
request = self.prepare_update(
|
204
|
+
link_id=link_id,
|
205
|
+
name=name,
|
206
|
+
webhook_url=webhook_url,
|
207
|
+
webhook_headers=webhook_headers,
|
208
|
+
password=password,
|
209
|
+
need_validation=need_validation,
|
210
|
+
)
|
211
|
+
response = self._client._prepared_request(request)
|
212
|
+
return Link.model_validate(response)
|
213
|
+
|
214
|
+
def delete(self, link_id: str) -> None:
|
215
|
+
"""Delete an extraction link configuration.
|
216
|
+
|
217
|
+
Args:
|
218
|
+
link_id: ID of the extraction link to delete
|
219
|
+
|
220
|
+
Returns:
|
221
|
+
Dict[str, str]: Response message confirming deletion
|
222
|
+
"""
|
223
|
+
request = self.prepare_delete(link_id)
|
224
|
+
self._client._prepared_request(request)
|
225
|
+
|
226
|
+
|
227
|
+
class AsyncLinks(AsyncAPIResource, LinksMixin):
|
228
|
+
"""Async Extraction Link API wrapper for managing extraction link configurations"""
|
229
|
+
|
230
|
+
def __init__(self, client: Any) -> None:
|
231
|
+
super().__init__(client=client)
|
232
|
+
|
233
|
+
async def create(
|
234
|
+
self,
|
235
|
+
processor_id: str,
|
236
|
+
name: str,
|
237
|
+
webhook_url: str,
|
238
|
+
webhook_headers: dict[str, str] = PydanticUndefined, # type: ignore[assignment]
|
239
|
+
need_validation: bool = PydanticUndefined, # type: ignore[assignment]
|
240
|
+
password: str | None = PydanticUndefined, # type: ignore[assignment]
|
241
|
+
) -> Link:
|
242
|
+
request = self.prepare_create(
|
243
|
+
processor_id=processor_id,
|
244
|
+
name=name,
|
245
|
+
webhook_url=webhook_url,
|
246
|
+
webhook_headers=webhook_headers,
|
247
|
+
need_validation=need_validation,
|
248
|
+
password=password,
|
249
|
+
)
|
250
|
+
response = await self._client._prepared_request(request)
|
251
|
+
print(f"Extraction Link Created. Link available at https://www.uiform.com/dashboard/processors/{response['id']}")
|
252
|
+
return Link.model_validate(response)
|
253
|
+
|
254
|
+
async def list(
|
255
|
+
self,
|
256
|
+
before: Optional[str] = None,
|
257
|
+
after: Optional[str] = None,
|
258
|
+
limit: Optional[int] = 10,
|
259
|
+
order: Optional[Literal["asc", "desc"]] = "desc",
|
260
|
+
processor_id: Optional[str] = None,
|
261
|
+
name: Optional[str] = None,
|
262
|
+
) -> ListLinks:
|
263
|
+
request = self.prepare_list(before=before, after=after, limit=limit, order=order, processor_id=processor_id, name=name)
|
264
|
+
response = await self._client._prepared_request(request)
|
265
|
+
return ListLinks.model_validate(response)
|
266
|
+
|
267
|
+
async def get(self, link_id: str) -> Link:
|
268
|
+
request = self.prepare_get(link_id)
|
269
|
+
response = await self._client._prepared_request(request)
|
270
|
+
return Link.model_validate(response)
|
271
|
+
|
272
|
+
async def update(
|
273
|
+
self,
|
274
|
+
link_id: str,
|
275
|
+
name: str = PydanticUndefined, # type: ignore[assignment]
|
276
|
+
webhook_url: str = PydanticUndefined, # type: ignore[assignment]
|
277
|
+
webhook_headers: dict[str, str] = PydanticUndefined, # type: ignore[assignment]
|
278
|
+
password: str | None = PydanticUndefined, # type: ignore[assignment]
|
279
|
+
need_validation: bool = PydanticUndefined, # type: ignore[assignment]
|
280
|
+
) -> Link:
|
281
|
+
request = self.prepare_update(
|
282
|
+
link_id=link_id,
|
283
|
+
name=name,
|
284
|
+
webhook_url=webhook_url,
|
285
|
+
webhook_headers=webhook_headers,
|
286
|
+
password=password,
|
287
|
+
need_validation=need_validation,
|
288
|
+
)
|
289
|
+
response = await self._client._prepared_request(request)
|
290
|
+
return Link.model_validate(response)
|
291
|
+
|
292
|
+
async def delete(self, link_id: str) -> None:
|
293
|
+
request = self.prepare_delete(link_id)
|
294
|
+
await self._client._prepared_request(request)
|
@@ -1,24 +1,26 @@
|
|
1
|
-
from typing import
|
1
|
+
from typing import Literal, Optional
|
2
2
|
|
3
|
-
from ...._resource import
|
3
|
+
from ...._resource import AsyncAPIResource, SyncAPIResource
|
4
4
|
from ....types.logs import AutomationLog, ExternalRequestLog, ListLogs
|
5
5
|
from ....types.standards import PreparedRequest
|
6
6
|
|
7
7
|
|
8
8
|
class LogsMixin:
|
9
|
-
def prepare_get(self, log_id: str) -> PreparedRequest:
|
9
|
+
def prepare_get(self, processor_id: str, log_id: str) -> PreparedRequest:
|
10
10
|
"""Get a specific automation log by ID.
|
11
11
|
|
12
12
|
Args:
|
13
|
+
processor_id: ID of the processor
|
13
14
|
log_id: ID of the log to retrieve
|
14
15
|
|
15
16
|
Returns:
|
16
17
|
PreparedRequest: The prepared request
|
17
18
|
"""
|
18
|
-
return PreparedRequest(method="GET", url=f"/v1/processors/automations/logs/{log_id}")
|
19
|
+
return PreparedRequest(method="GET", url=f"/v1/processors/{processor_id}/automations/logs/{log_id}")
|
19
20
|
|
20
21
|
def prepare_list(
|
21
22
|
self,
|
23
|
+
processor_id: str,
|
22
24
|
before: Optional[str] = None,
|
23
25
|
after: Optional[str] = None,
|
24
26
|
limit: Optional[int] = 10,
|
@@ -34,6 +36,7 @@ class LogsMixin:
|
|
34
36
|
"""List automation logs with pagination support.
|
35
37
|
|
36
38
|
Args:
|
39
|
+
processor_id: ID of the processor
|
37
40
|
before: Optional cursor for pagination before a specific log ID
|
38
41
|
after: Optional cursor for pagination after a specific log ID
|
39
42
|
limit: Optional limit on number of results (max 100)
|
@@ -63,38 +66,41 @@ class LogsMixin:
|
|
63
66
|
# Remove None values
|
64
67
|
params = {k: v for k, v in params.items() if v is not None}
|
65
68
|
|
66
|
-
return PreparedRequest(method="GET", url="/v1/processors/automations/logs", params=params)
|
69
|
+
return PreparedRequest(method="GET", url=f"/v1/processors/{processor_id}/automations/logs", params=params)
|
67
70
|
|
68
|
-
def prepare_rerun(self, log_id: str) -> PreparedRequest:
|
71
|
+
def prepare_rerun(self, processor_id: str, log_id: str) -> PreparedRequest:
|
69
72
|
"""Rerun a webhook from an existing AutomationLog.
|
70
73
|
|
71
74
|
Args:
|
75
|
+
processor_id: ID of the processor
|
72
76
|
log_id: ID of the log to rerun
|
73
77
|
|
74
78
|
Returns:
|
75
79
|
PreparedRequest: The prepared request
|
76
80
|
"""
|
77
|
-
return PreparedRequest(method="POST", url=f"/v1/processors/automations/logs/{log_id}/rerun")
|
81
|
+
return PreparedRequest(method="POST", url=f"/v1/processors/{processor_id}/automations/logs/{log_id}/rerun")
|
78
82
|
|
79
83
|
|
80
84
|
class Logs(SyncAPIResource, LogsMixin):
|
81
85
|
"""Logs API wrapper for managing automation logs"""
|
82
86
|
|
83
|
-
def get(self, log_id: str) -> AutomationLog:
|
87
|
+
def get(self, processor_id: str, log_id: str) -> AutomationLog:
|
84
88
|
"""Get a specific automation log by ID.
|
85
89
|
|
86
90
|
Args:
|
91
|
+
processor_id: ID of the processor
|
87
92
|
log_id: ID of the log to retrieve
|
88
93
|
|
89
94
|
Returns:
|
90
95
|
AutomationLog: The automation log
|
91
96
|
"""
|
92
|
-
request = self.prepare_get(log_id)
|
97
|
+
request = self.prepare_get(processor_id, log_id)
|
93
98
|
response = self._client._prepared_request(request)
|
94
99
|
return AutomationLog.model_validate(response)
|
95
100
|
|
96
101
|
def list(
|
97
102
|
self,
|
103
|
+
processor_id: str,
|
98
104
|
before: Optional[str] = None,
|
99
105
|
after: Optional[str] = None,
|
100
106
|
limit: Optional[int] = 10,
|
@@ -109,6 +115,7 @@ class Logs(SyncAPIResource, LogsMixin):
|
|
109
115
|
"""List automation logs with pagination support.
|
110
116
|
|
111
117
|
Args:
|
118
|
+
processor_id: ID of the processor
|
112
119
|
before: Optional cursor for pagination before a specific log ID
|
113
120
|
after: Optional cursor for pagination after a specific log ID
|
114
121
|
limit: Optional limit on number of results (max 100)
|
@@ -123,23 +130,24 @@ class Logs(SyncAPIResource, LogsMixin):
|
|
123
130
|
Returns:
|
124
131
|
ListLogs: Paginated list of automation logs with metadata
|
125
132
|
"""
|
126
|
-
request = self.prepare_list(before, after, limit, order, status_code, status_class, automation_id, webhook_url, schema_id, schema_data_id)
|
133
|
+
request = self.prepare_list(processor_id, before, after, limit, order, status_code, status_class, automation_id, webhook_url, schema_id, schema_data_id)
|
127
134
|
response = self._client._prepared_request(request)
|
128
135
|
return ListLogs.model_validate(response)
|
129
136
|
|
130
|
-
def rerun(self, log_id: str) -> ExternalRequestLog:
|
137
|
+
def rerun(self, processor_id: str, log_id: str) -> ExternalRequestLog:
|
131
138
|
"""Rerun a webhook from an existing AutomationLog.
|
132
139
|
|
133
140
|
Args:
|
141
|
+
processor_id: ID of the processor
|
134
142
|
log_id: ID of the log to rerun
|
135
143
|
|
136
144
|
Returns:
|
137
145
|
ExternalRequestLog: The result of the rerun webhook call
|
138
146
|
"""
|
139
|
-
request = self.prepare_rerun(log_id)
|
147
|
+
request = self.prepare_rerun(processor_id, log_id)
|
140
148
|
response = self._client._prepared_request(request)
|
141
149
|
|
142
|
-
print(f"Webhook call run successfully. Log available at https://
|
150
|
+
print(f"Webhook call run successfully. Log available at https://www.uiform.com/dashboard/processors/{processor_id}/logs/{log_id}")
|
143
151
|
|
144
152
|
return ExternalRequestLog.model_validate(response)
|
145
153
|
|
@@ -147,21 +155,23 @@ class Logs(SyncAPIResource, LogsMixin):
|
|
147
155
|
class AsyncLogs(AsyncAPIResource, LogsMixin):
|
148
156
|
"""Async Logs API wrapper for managing automation logs"""
|
149
157
|
|
150
|
-
async def get(self, log_id: str) -> AutomationLog:
|
158
|
+
async def get(self, processor_id: str, log_id: str) -> AutomationLog:
|
151
159
|
"""Get a specific automation log by ID.
|
152
160
|
|
153
161
|
Args:
|
162
|
+
processor_id: ID of the processor
|
154
163
|
log_id: ID of the log to retrieve
|
155
164
|
|
156
165
|
Returns:
|
157
166
|
AutomationLog: The automation log
|
158
167
|
"""
|
159
|
-
request = self.prepare_get(log_id)
|
168
|
+
request = self.prepare_get(processor_id, log_id)
|
160
169
|
response = await self._client._prepared_request(request)
|
161
170
|
return AutomationLog.model_validate(response)
|
162
171
|
|
163
172
|
async def list(
|
164
173
|
self,
|
174
|
+
processor_id: str,
|
165
175
|
before: Optional[str] = None,
|
166
176
|
after: Optional[str] = None,
|
167
177
|
limit: Optional[int] = 10,
|
@@ -190,22 +200,23 @@ class AsyncLogs(AsyncAPIResource, LogsMixin):
|
|
190
200
|
Returns:
|
191
201
|
ListLogs: Paginated list of automation logs with metadata
|
192
202
|
"""
|
193
|
-
request = self.prepare_list(before, after, limit, order, status_code, status_class, automation_id, webhook_url, schema_id, schema_data_id)
|
203
|
+
request = self.prepare_list(processor_id, before, after, limit, order, status_code, status_class, automation_id, webhook_url, schema_id, schema_data_id)
|
194
204
|
response = await self._client._prepared_request(request)
|
195
205
|
return ListLogs.model_validate(response)
|
196
206
|
|
197
|
-
async def rerun(self, log_id: str) -> ExternalRequestLog:
|
207
|
+
async def rerun(self, processor_id: str, log_id: str) -> ExternalRequestLog:
|
198
208
|
"""Rerun a webhook from an existing AutomationLog.
|
199
209
|
|
200
210
|
Args:
|
211
|
+
processor_id: ID of the processor
|
201
212
|
log_id: ID of the log to rerun
|
202
213
|
|
203
214
|
Returns:
|
204
215
|
ExternalRequestLog: The result of the rerun webhook call
|
205
216
|
"""
|
206
|
-
request = self.prepare_rerun(log_id)
|
217
|
+
request = self.prepare_rerun(processor_id, log_id)
|
207
218
|
response = await self._client._prepared_request(request)
|
208
219
|
|
209
|
-
print(f"Webhook call run successfully. Log available at https://
|
220
|
+
print(f"Webhook call run successfully. Log available at https://www.uiform.com/dashboard/processors/{processor_id}/logs/{log_id}")
|
210
221
|
|
211
222
|
return ExternalRequestLog.model_validate(response)
|