async-task-api-client 0.1.0rc1__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.
- async_task_api_client/__init__.py +4 -0
- async_task_api_client/_errors.py +294 -0
- async_task_api_client/_files.py +162 -0
- async_task_api_client/_generated.py +488 -0
- async_task_api_client/_http.py +617 -0
- async_task_api_client/_me.py +79 -0
- async_task_api_client/_services.py +140 -0
- async_task_api_client/_storage.py +527 -0
- async_task_api_client/_tasks.py +596 -0
- async_task_api_client/py.typed +0 -0
- async_task_api_client/raw.py +97 -0
- async_task_api_client-0.1.0rc1.dist-info/METADATA +465 -0
- async_task_api_client-0.1.0rc1.dist-info/RECORD +15 -0
- async_task_api_client-0.1.0rc1.dist-info/WHEEL +4 -0
- async_task_api_client-0.1.0rc1.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
# Generated from docs/protocol/openapi.json by scripts/generate.py: do not edit by hand.
|
|
2
|
+
|
|
3
|
+
from typing_extensions import NotRequired, TypedDict
|
|
4
|
+
from typing import Any, Literal, TypeAlias
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AuthorizationResponse(TypedDict):
|
|
8
|
+
service: str
|
|
9
|
+
"""
|
|
10
|
+
Name of the authorized service, or `all` for every service
|
|
11
|
+
"""
|
|
12
|
+
quotas: NotRequired[int | None]
|
|
13
|
+
"""
|
|
14
|
+
Quota of concurrent tasks for this service, if any
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Callback(TypedDict):
|
|
19
|
+
url: NotRequired[str | None]
|
|
20
|
+
"""
|
|
21
|
+
URL (HTTP callback) or AMQP DSN (AMQP callback) to call when the task ends
|
|
22
|
+
"""
|
|
23
|
+
type: NotRequired[Literal["http", "amqp"] | None]
|
|
24
|
+
"""
|
|
25
|
+
Callback type: `http` or `amqp`
|
|
26
|
+
"""
|
|
27
|
+
queue: NotRequired[str | None]
|
|
28
|
+
"""
|
|
29
|
+
Name of the queue to publish to, for AMQP callbacks
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class Issue(TypedDict):
|
|
34
|
+
loc: list[str | int]
|
|
35
|
+
"""
|
|
36
|
+
Path of the invalid field (for instance `["body", "filename"]`)
|
|
37
|
+
"""
|
|
38
|
+
msg: str
|
|
39
|
+
"""
|
|
40
|
+
Human-readable error message
|
|
41
|
+
"""
|
|
42
|
+
type: str
|
|
43
|
+
"""
|
|
44
|
+
Pydantic error type (for instance `missing`, `literal_error`)
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class MeResponse(TypedDict):
|
|
49
|
+
"""
|
|
50
|
+
Identity of the authenticated client and the services it can access.
|
|
51
|
+
|
|
52
|
+
Returned by `GET /v1/me`. A read-only endpoint whose only purpose is to let a client (for instance an n8n node)
|
|
53
|
+
validate its credentials and learn which services it can actually call (to filter a UI). It never exposes
|
|
54
|
+
information about another client.
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
client_id: str
|
|
58
|
+
"""
|
|
59
|
+
Identifier of the authenticated client
|
|
60
|
+
"""
|
|
61
|
+
authorizations: list[AuthorizationResponse]
|
|
62
|
+
"""
|
|
63
|
+
Services authorized for this client (with their quotas, if any). Empty if none. An authorization `service: "all"` is returned **literally** (not expanded) and means "every service": a consumer (for instance an n8n node) must handle that case.
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class PresignedDownloadRequest(TypedDict):
|
|
68
|
+
file_id: str
|
|
69
|
+
"""
|
|
70
|
+
Identifier of the file to download: an upload or an output of one of your tasks (`f_<uuid hex>`).
|
|
71
|
+
"""
|
|
72
|
+
expires_in_seconds: NotRequired[int | None]
|
|
73
|
+
"""
|
|
74
|
+
Optional validity of the presigned URL in seconds, to get a URL shorter-lived than the default one: between the minimum and the default validity (see the route description), else `422 PRESIGNED_TTL_OUT_OF_RANGE`. Absent or `null`, the default validity applies.
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class PresignedDownloadResponse(TypedDict):
|
|
79
|
+
file_id: str
|
|
80
|
+
"""
|
|
81
|
+
Identifier of the file, echoed back so that a client can match the response to its request
|
|
82
|
+
"""
|
|
83
|
+
url: str
|
|
84
|
+
"""
|
|
85
|
+
Presigned S3 URL to fetch with a `GET`. No other authentication is needed.
|
|
86
|
+
"""
|
|
87
|
+
expires_in_seconds: int
|
|
88
|
+
"""
|
|
89
|
+
Validity of the presigned URL in seconds, counted from the response
|
|
90
|
+
"""
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class PresignedUploadRequest(TypedDict):
|
|
94
|
+
filename: str
|
|
95
|
+
"""
|
|
96
|
+
Name of the file to upload (kept as the file's display name; any path is ignored)
|
|
97
|
+
"""
|
|
98
|
+
mime_type: str
|
|
99
|
+
"""
|
|
100
|
+
MIME type of the file. It is signed into the presigned URL: send it as is as `Content-Type`.
|
|
101
|
+
"""
|
|
102
|
+
size_bytes: int
|
|
103
|
+
"""
|
|
104
|
+
Exact size of the file in bytes. The presigned PUT signs it as `Content-Length`: S3 refuses a body of another size.
|
|
105
|
+
"""
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
class PresignedUploadResponse(TypedDict):
|
|
109
|
+
file_id: str
|
|
110
|
+
"""
|
|
111
|
+
Identifier of the reserved file (`f_<uuid hex>`), to put in the file property of a task body. Bound to the calling client, and single-use: one task can claim it.
|
|
112
|
+
"""
|
|
113
|
+
url: str
|
|
114
|
+
"""
|
|
115
|
+
Presigned S3 URL of the upload: send a `PUT` with the raw bytes of the file as the body and `headers`. No other authentication is needed.
|
|
116
|
+
"""
|
|
117
|
+
method: NotRequired[Literal["PUT"]]
|
|
118
|
+
"""
|
|
119
|
+
HTTP method of the upload: always `PUT`, the raw file as the body
|
|
120
|
+
"""
|
|
121
|
+
headers: dict[str, str]
|
|
122
|
+
"""
|
|
123
|
+
Headers to send with the PUT, exactly as given: they are part of the signature (`Content-Type` and `Content-Length`).
|
|
124
|
+
"""
|
|
125
|
+
expires_in_seconds: int
|
|
126
|
+
"""
|
|
127
|
+
Validity of the presigned URL in seconds, counted from the response
|
|
128
|
+
"""
|
|
129
|
+
expires_at: str
|
|
130
|
+
"""
|
|
131
|
+
Until when the reserved `file_id` can be submitted; past it, an unclaimed upload is purged
|
|
132
|
+
"""
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class ReadyComponent(TypedDict):
|
|
136
|
+
status: str
|
|
137
|
+
"""
|
|
138
|
+
State of the dependency: `ok` or `error`
|
|
139
|
+
"""
|
|
140
|
+
details: NotRequired[str | None]
|
|
141
|
+
"""
|
|
142
|
+
Why the dependency is not ready, if it is not
|
|
143
|
+
"""
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
class ErrorDetail(TypedDict):
|
|
147
|
+
code: str
|
|
148
|
+
"""
|
|
149
|
+
Stable canonical error identifier (SCREAMING_SNAKE_CASE). Match on it, not on the message.
|
|
150
|
+
"""
|
|
151
|
+
message: str
|
|
152
|
+
"""
|
|
153
|
+
Human-readable message describing the error
|
|
154
|
+
"""
|
|
155
|
+
issues: NotRequired[list[Issue] | None]
|
|
156
|
+
"""
|
|
157
|
+
Multi-field validation detail (only on validation errors, HTTP 422)
|
|
158
|
+
"""
|
|
159
|
+
components: NotRequired[dict[str, ReadyComponent] | None]
|
|
160
|
+
"""
|
|
161
|
+
State of each dependency (only on `DEPENDENCIES_NOT_READY`, HTTP 503)
|
|
162
|
+
"""
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
class ErrorResponse(TypedDict):
|
|
166
|
+
status: NotRequired[str]
|
|
167
|
+
"""
|
|
168
|
+
Status of the response (always `error`)
|
|
169
|
+
"""
|
|
170
|
+
error: ErrorDetail
|
|
171
|
+
"""
|
|
172
|
+
Details of the error
|
|
173
|
+
"""
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
ServiceClass: TypeAlias = Literal["immediate", "short", "long"]
|
|
177
|
+
"""
|
|
178
|
+
Order of magnitude of the processing: `immediate` (under 1 s), `short` (under 10 s) or `long` (up to 5 min).
|
|
179
|
+
"""
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
ServiceDetail = TypedDict(
|
|
183
|
+
"ServiceDetail",
|
|
184
|
+
{
|
|
185
|
+
"name": str,
|
|
186
|
+
"title": NotRequired[str | None],
|
|
187
|
+
"description": NotRequired[str | None],
|
|
188
|
+
"short_description": NotRequired[str | None],
|
|
189
|
+
"icon": NotRequired[str | None],
|
|
190
|
+
"class": NotRequired[ServiceClass],
|
|
191
|
+
"gpu": NotRequired[bool],
|
|
192
|
+
"max_file_size_mib": NotRequired[int | None],
|
|
193
|
+
"files_enabled": NotRequired[bool],
|
|
194
|
+
"file_fields": NotRequired[list[str]],
|
|
195
|
+
"input_schema": NotRequired[dict[str, Any] | None],
|
|
196
|
+
"output_schema": NotRequired[dict[str, Any] | None],
|
|
197
|
+
},
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
ServiceSummary = TypedDict(
|
|
202
|
+
"ServiceSummary",
|
|
203
|
+
{
|
|
204
|
+
"name": str,
|
|
205
|
+
"title": NotRequired[str | None],
|
|
206
|
+
"description": NotRequired[str | None],
|
|
207
|
+
"short_description": NotRequired[str | None],
|
|
208
|
+
"icon": NotRequired[str | None],
|
|
209
|
+
"class": NotRequired[ServiceClass],
|
|
210
|
+
"gpu": NotRequired[bool],
|
|
211
|
+
"max_file_size_mib": NotRequired[int | None],
|
|
212
|
+
"files_enabled": NotRequired[bool],
|
|
213
|
+
},
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
class TaskError(TypedDict):
|
|
218
|
+
"""
|
|
219
|
+
Why a task failed: a stable code to match on, and a human-readable message.
|
|
220
|
+
"""
|
|
221
|
+
|
|
222
|
+
code: str
|
|
223
|
+
"""
|
|
224
|
+
Stable SCREAMING_SNAKE error code. Match on this, not on the message.
|
|
225
|
+
"""
|
|
226
|
+
message: str
|
|
227
|
+
"""
|
|
228
|
+
Human-readable description of the error.
|
|
229
|
+
"""
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
class TaskFileInfo(TypedDict):
|
|
233
|
+
"""
|
|
234
|
+
A file of a task, as the poll and the callback report it: its inputs and the outputs the worker wrote.
|
|
235
|
+
"""
|
|
236
|
+
|
|
237
|
+
file_id: str
|
|
238
|
+
"""
|
|
239
|
+
File identifier (`f_...`), to pass to `/storage/presigned-download`
|
|
240
|
+
"""
|
|
241
|
+
name: str
|
|
242
|
+
"""
|
|
243
|
+
File name
|
|
244
|
+
"""
|
|
245
|
+
content_type: str
|
|
246
|
+
"""
|
|
247
|
+
MIME type
|
|
248
|
+
"""
|
|
249
|
+
size_bytes: int
|
|
250
|
+
"""
|
|
251
|
+
Size in bytes
|
|
252
|
+
"""
|
|
253
|
+
role: Literal["input", "output"]
|
|
254
|
+
"""
|
|
255
|
+
`input` (provided to the task) or `output` (produced by the module)
|
|
256
|
+
"""
|
|
257
|
+
expires_at: str
|
|
258
|
+
"""
|
|
259
|
+
End of retention, UTC: the file is deleted afterwards
|
|
260
|
+
"""
|
|
261
|
+
status: Literal["available", "expired"]
|
|
262
|
+
"""
|
|
263
|
+
`expired` once the retention has passed
|
|
264
|
+
"""
|
|
265
|
+
field: NotRequired[str | None]
|
|
266
|
+
"""
|
|
267
|
+
Where the task names this file: for an input, the request property that held it (`file_id`); for an output, the path of the result field that references it (`output_file_id`, `documents[2].file_id`). `null` for an output no result field references
|
|
268
|
+
"""
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
class TaskRequest(TypedDict):
|
|
272
|
+
body: dict[str, Any]
|
|
273
|
+
"""
|
|
274
|
+
Parameters to pass to the target service: their shape depends on the service
|
|
275
|
+
"""
|
|
276
|
+
callback: NotRequired[Callback | None]
|
|
277
|
+
"""
|
|
278
|
+
Optional callback to call when the task ends
|
|
279
|
+
"""
|
|
280
|
+
session_id: NotRequired[str | None]
|
|
281
|
+
"""
|
|
282
|
+
Free label to group several tasks (a batch, an application session, a case file) and find them again through the list route. Purely organizational: it grants no right and always stays limited to the calling consumer's tasks.
|
|
283
|
+
"""
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
TaskStatus: TypeAlias = Literal["pending", "in_progress", "success", "failure"]
|
|
287
|
+
"""
|
|
288
|
+
Status codes for the application.
|
|
289
|
+
"""
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
class TaskDataFailed(TypedDict):
|
|
293
|
+
task_id: str
|
|
294
|
+
"""
|
|
295
|
+
Unique identifier of the task
|
|
296
|
+
"""
|
|
297
|
+
status: NotRequired[TaskStatus]
|
|
298
|
+
"""
|
|
299
|
+
Status of the task: `failure`
|
|
300
|
+
"""
|
|
301
|
+
error_message: str | None
|
|
302
|
+
"""
|
|
303
|
+
Error rendered as `<CODE>: <message>`. Kept for compatibility: prefer `error`.
|
|
304
|
+
"""
|
|
305
|
+
error: NotRequired[TaskError | None]
|
|
306
|
+
"""
|
|
307
|
+
Structured error of the task: `{code, message}`. Null when no error was recorded.
|
|
308
|
+
"""
|
|
309
|
+
submission_date: NotRequired[str | None]
|
|
310
|
+
"""
|
|
311
|
+
Submission date of the task
|
|
312
|
+
"""
|
|
313
|
+
start_date: NotRequired[str | None]
|
|
314
|
+
"""
|
|
315
|
+
Start date of the task
|
|
316
|
+
"""
|
|
317
|
+
end_date: NotRequired[str | None]
|
|
318
|
+
"""
|
|
319
|
+
End date of the task
|
|
320
|
+
"""
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
class TaskDataPending(TypedDict):
|
|
324
|
+
task_id: str
|
|
325
|
+
"""
|
|
326
|
+
Unique identifier of the task
|
|
327
|
+
"""
|
|
328
|
+
status: NotRequired[TaskStatus]
|
|
329
|
+
"""
|
|
330
|
+
Status of the task: `pending`
|
|
331
|
+
"""
|
|
332
|
+
task_position: NotRequired[int | None]
|
|
333
|
+
"""
|
|
334
|
+
Position of the task in the queue
|
|
335
|
+
"""
|
|
336
|
+
submission_date: NotRequired[str | None]
|
|
337
|
+
"""
|
|
338
|
+
Submission date of the task
|
|
339
|
+
"""
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
class TaskDataProgress(TypedDict):
|
|
343
|
+
task_id: str
|
|
344
|
+
"""
|
|
345
|
+
Unique identifier of the task
|
|
346
|
+
"""
|
|
347
|
+
status: NotRequired[TaskStatus]
|
|
348
|
+
"""
|
|
349
|
+
Status of the task: `in_progress`
|
|
350
|
+
"""
|
|
351
|
+
progress: NotRequired[float | None]
|
|
352
|
+
"""
|
|
353
|
+
Progress of the task (0.0 to 1.0)
|
|
354
|
+
"""
|
|
355
|
+
submission_date: NotRequired[str | None]
|
|
356
|
+
"""
|
|
357
|
+
Submission date of the task
|
|
358
|
+
"""
|
|
359
|
+
start_date: NotRequired[str | None]
|
|
360
|
+
"""
|
|
361
|
+
Start date of the task
|
|
362
|
+
"""
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
class TaskDataSuccess(TypedDict):
|
|
366
|
+
task_id: str
|
|
367
|
+
"""
|
|
368
|
+
Unique identifier of the task
|
|
369
|
+
"""
|
|
370
|
+
status: NotRequired[TaskStatus]
|
|
371
|
+
"""
|
|
372
|
+
Status of the task: `success`
|
|
373
|
+
"""
|
|
374
|
+
result: NotRequired[Any]
|
|
375
|
+
"""
|
|
376
|
+
Result of the task: its shape depends on the service (see the service documentation)
|
|
377
|
+
"""
|
|
378
|
+
submission_date: NotRequired[str | None]
|
|
379
|
+
"""
|
|
380
|
+
Submission date of the task
|
|
381
|
+
"""
|
|
382
|
+
start_date: NotRequired[str | None]
|
|
383
|
+
"""
|
|
384
|
+
Start date of the task
|
|
385
|
+
"""
|
|
386
|
+
end_date: NotRequired[str | None]
|
|
387
|
+
"""
|
|
388
|
+
End date of the task
|
|
389
|
+
"""
|
|
390
|
+
files: NotRequired[list[TaskFileInfo]]
|
|
391
|
+
"""
|
|
392
|
+
Task files: inputs and outputs. Absent when the task has none (a service without files, or inline input and output)
|
|
393
|
+
"""
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
class TaskResponseInput(TypedDict):
|
|
397
|
+
data: TaskDataSuccess | TaskDataFailed | TaskDataPending | TaskDataProgress
|
|
398
|
+
"""
|
|
399
|
+
Data of the task: its state, and its result or error depending on the status
|
|
400
|
+
"""
|
|
401
|
+
status: NotRequired[TaskStatus]
|
|
402
|
+
"""
|
|
403
|
+
Status of the request: `success` when the task was created or read (state is `data.status`)
|
|
404
|
+
"""
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
class TaskResponseOutput(TypedDict):
|
|
408
|
+
data: TaskDataSuccess | TaskDataFailed | TaskDataPending | TaskDataProgress
|
|
409
|
+
"""
|
|
410
|
+
Data of the task: its state, and its result or error depending on the status
|
|
411
|
+
"""
|
|
412
|
+
status: NotRequired[TaskStatus]
|
|
413
|
+
"""
|
|
414
|
+
Status of the request: `success` when the task was created or read (state is `data.status`)
|
|
415
|
+
"""
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
class TaskSummary(TypedDict):
|
|
419
|
+
"""
|
|
420
|
+
One line of a consumer's task list.
|
|
421
|
+
|
|
422
|
+
Deliberately without `request` or `result`: the list says *where the tasks stand*, it does not fetch their
|
|
423
|
+
content. The payloads are fetched one by one on the polling route, which keeps a list call from becoming the
|
|
424
|
+
most expensive point of the API.
|
|
425
|
+
"""
|
|
426
|
+
|
|
427
|
+
task_id: str
|
|
428
|
+
"""
|
|
429
|
+
Unique identifier of the task
|
|
430
|
+
"""
|
|
431
|
+
status: TaskStatus
|
|
432
|
+
"""
|
|
433
|
+
Current status of the task
|
|
434
|
+
"""
|
|
435
|
+
session_id: NotRequired[str | None]
|
|
436
|
+
"""
|
|
437
|
+
Correlation label declared at submission
|
|
438
|
+
"""
|
|
439
|
+
progress: NotRequired[float | None]
|
|
440
|
+
"""
|
|
441
|
+
Progress of the task (0.0 to 1.0)
|
|
442
|
+
"""
|
|
443
|
+
submission_date: NotRequired[str | None]
|
|
444
|
+
"""
|
|
445
|
+
Submission date of the task
|
|
446
|
+
"""
|
|
447
|
+
start_date: NotRequired[str | None]
|
|
448
|
+
"""
|
|
449
|
+
Start date of the task
|
|
450
|
+
"""
|
|
451
|
+
end_date: NotRequired[str | None]
|
|
452
|
+
"""
|
|
453
|
+
End date of the task
|
|
454
|
+
"""
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
class TaskListData(TypedDict):
|
|
458
|
+
"""
|
|
459
|
+
One page of the task list.
|
|
460
|
+
"""
|
|
461
|
+
|
|
462
|
+
tasks: list[TaskSummary]
|
|
463
|
+
"""
|
|
464
|
+
The consumer's tasks, most recent first
|
|
465
|
+
"""
|
|
466
|
+
count: int
|
|
467
|
+
"""
|
|
468
|
+
Number of tasks returned in this page
|
|
469
|
+
"""
|
|
470
|
+
limit: int
|
|
471
|
+
"""
|
|
472
|
+
Page size applied
|
|
473
|
+
"""
|
|
474
|
+
offset: int
|
|
475
|
+
"""
|
|
476
|
+
Offset applied
|
|
477
|
+
"""
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
class TaskListResponse(TypedDict):
|
|
481
|
+
data: TaskListData
|
|
482
|
+
"""
|
|
483
|
+
Page of the consumer's tasks
|
|
484
|
+
"""
|
|
485
|
+
status: NotRequired[TaskStatus]
|
|
486
|
+
"""
|
|
487
|
+
Status of the request: `success` when the list was read
|
|
488
|
+
"""
|