studyfetch-sdk 0.1.0a17__py3-none-any.whl → 0.1.0a19__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.
- studyfetch_sdk/_models.py +1 -1
- studyfetch_sdk/_version.py +1 -1
- studyfetch_sdk/resources/v1/__init__.py +14 -0
- studyfetch_sdk/resources/v1/assignment_grader.py +81 -1
- studyfetch_sdk/resources/v1/components.py +36 -4
- studyfetch_sdk/resources/v1/data_analyst/__init__.py +47 -0
- studyfetch_sdk/resources/v1/data_analyst/data_analyst.py +582 -0
- studyfetch_sdk/resources/v1/data_analyst/sessions.py +222 -0
- studyfetch_sdk/resources/v1/data_analyst/test.py +190 -0
- studyfetch_sdk/resources/v1/materials/bulk.py +60 -7
- studyfetch_sdk/resources/v1/materials/materials.py +250 -57
- studyfetch_sdk/resources/v1/materials/test.py +29 -25
- studyfetch_sdk/resources/v1/materials/upload.py +402 -14
- studyfetch_sdk/resources/v1/usage/analyst.py +143 -15
- studyfetch_sdk/resources/v1/v1.py +98 -0
- studyfetch_sdk/types/v1/__init__.py +12 -0
- studyfetch_sdk/types/v1/assignment_grader_response.py +20 -1
- studyfetch_sdk/types/v1/component.py +9 -1
- studyfetch_sdk/types/v1/component_create_params.py +57 -1
- studyfetch_sdk/types/v1/component_list_params.py +9 -1
- studyfetch_sdk/types/v1/content_param.py +23 -0
- studyfetch_sdk/types/v1/data_analyst/__init__.py +5 -0
- studyfetch_sdk/types/v1/data_analyst/session_retrieve_params.py +11 -0
- studyfetch_sdk/types/v1/data_analyst_retrieve_session_params.py +13 -0
- studyfetch_sdk/types/v1/data_analyst_send_message_params.py +54 -0
- studyfetch_sdk/types/v1/data_analyst_stream_params.py +28 -0
- studyfetch_sdk/types/v1/material_batch_create_params.py +29 -0
- studyfetch_sdk/types/v1/material_batch_create_response.py +27 -0
- studyfetch_sdk/types/v1/material_create_and_process_params.py +27 -0
- studyfetch_sdk/types/v1/material_create_params.py +4 -17
- studyfetch_sdk/types/v1/material_debug_response.py +47 -0
- studyfetch_sdk/types/v1/material_get_download_url_params.py +3 -2
- studyfetch_sdk/types/v1/material_get_download_url_response.py +12 -0
- studyfetch_sdk/types/v1/material_move_params.py +15 -0
- studyfetch_sdk/types/v1/material_rename_params.py +12 -0
- studyfetch_sdk/types/v1/material_search_params.py +3 -6
- studyfetch_sdk/types/v1/material_search_response.py +54 -0
- studyfetch_sdk/types/v1/materials/__init__.py +11 -0
- studyfetch_sdk/types/v1/materials/bulk_move_params.py +18 -0
- studyfetch_sdk/types/v1/materials/bulk_move_response.py +15 -0
- studyfetch_sdk/types/v1/materials/test_perform_ocr_response.py +19 -0
- studyfetch_sdk/types/v1/materials/test_process_epub_response.py +30 -0
- studyfetch_sdk/types/v1/materials/test_process_image_response.py +30 -0
- studyfetch_sdk/types/v1/materials/test_process_video_response.py +25 -0
- studyfetch_sdk/types/v1/materials/upload_complete_upload_params.py +20 -0
- studyfetch_sdk/types/v1/materials/upload_create_presigned_url_params.py +23 -0
- studyfetch_sdk/types/v1/materials/upload_create_presigned_url_response.py +18 -0
- studyfetch_sdk/types/v1/materials/upload_upload_file_and_process_params.py +26 -0
- studyfetch_sdk/types/v1/materials/upload_upload_url_and_process_params.py +26 -0
- studyfetch_sdk/types/v1/usage/__init__.py +3 -0
- studyfetch_sdk/types/v1/usage/analyst_get_test_questions_params.py +18 -0
- studyfetch_sdk/types/v1/usage/analyst_list_chat_messages_params.py +18 -0
- studyfetch_sdk/types/v1/usage/analyst_list_chat_messages_response.py +35 -0
- studyfetch_sdk/types/v1/usage/analyst_list_events_params.py +7 -0
- {studyfetch_sdk-0.1.0a17.dist-info → studyfetch_sdk-0.1.0a19.dist-info}/METADATA +1 -1
- {studyfetch_sdk-0.1.0a17.dist-info → studyfetch_sdk-0.1.0a19.dist-info}/RECORD +58 -26
- {studyfetch_sdk-0.1.0a17.dist-info → studyfetch_sdk-0.1.0a19.dist-info}/WHEEL +0 -0
- {studyfetch_sdk-0.1.0a17.dist-info → studyfetch_sdk-0.1.0a19.dist-info}/licenses/LICENSE +0 -0
@@ -6,7 +6,7 @@ from typing import Mapping, cast
|
|
6
6
|
|
7
7
|
import httpx
|
8
8
|
|
9
|
-
from ...._types import NOT_GIVEN, Body, Query, Headers,
|
9
|
+
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes
|
10
10
|
from ...._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform
|
11
11
|
from ...._compat import cached_property
|
12
12
|
from ...._resource import SyncAPIResource, AsyncAPIResource
|
@@ -18,7 +18,15 @@ from ...._response import (
|
|
18
18
|
)
|
19
19
|
from ...._base_client import make_request_options
|
20
20
|
from ....types.v1.material import Material
|
21
|
-
from ....types.v1.materials import
|
21
|
+
from ....types.v1.materials import (
|
22
|
+
upload_upload_file_params,
|
23
|
+
upload_complete_upload_params,
|
24
|
+
upload_upload_from_url_params,
|
25
|
+
upload_create_presigned_url_params,
|
26
|
+
upload_upload_url_and_process_params,
|
27
|
+
upload_upload_file_and_process_params,
|
28
|
+
)
|
29
|
+
from ....types.v1.materials.upload_create_presigned_url_response import UploadCreatePresignedURLResponse
|
22
30
|
|
23
31
|
__all__ = ["UploadResource", "AsyncUploadResource"]
|
24
32
|
|
@@ -46,39 +54,99 @@ class UploadResource(SyncAPIResource):
|
|
46
54
|
def complete_upload(
|
47
55
|
self,
|
48
56
|
*,
|
57
|
+
material_id: str,
|
58
|
+
organization_id: str,
|
59
|
+
s3_key: str,
|
49
60
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
50
61
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
51
62
|
extra_headers: Headers | None = None,
|
52
63
|
extra_query: Query | None = None,
|
53
64
|
extra_body: Body | None = None,
|
54
65
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
55
|
-
) ->
|
56
|
-
|
66
|
+
) -> Material:
|
67
|
+
"""
|
68
|
+
Complete upload after using presigned URL
|
69
|
+
|
70
|
+
Args:
|
71
|
+
material_id: The ID of the material that was uploaded
|
72
|
+
|
73
|
+
organization_id: The ID of the organization
|
74
|
+
|
75
|
+
s3_key: The S3 key of the uploaded file
|
76
|
+
|
77
|
+
extra_headers: Send extra headers
|
78
|
+
|
79
|
+
extra_query: Add additional query parameters to the request
|
80
|
+
|
81
|
+
extra_body: Add additional JSON properties to the request
|
82
|
+
|
83
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
84
|
+
"""
|
57
85
|
return self._post(
|
58
86
|
"/api/v1/materials/upload/complete",
|
87
|
+
body=maybe_transform(
|
88
|
+
{
|
89
|
+
"material_id": material_id,
|
90
|
+
"organization_id": organization_id,
|
91
|
+
"s3_key": s3_key,
|
92
|
+
},
|
93
|
+
upload_complete_upload_params.UploadCompleteUploadParams,
|
94
|
+
),
|
59
95
|
options=make_request_options(
|
60
96
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
61
97
|
),
|
62
|
-
cast_to=
|
98
|
+
cast_to=Material,
|
63
99
|
)
|
64
100
|
|
65
101
|
def create_presigned_url(
|
66
102
|
self,
|
67
103
|
*,
|
104
|
+
content_type: str,
|
105
|
+
filename: str,
|
106
|
+
name: str,
|
107
|
+
folder_id: str | NotGiven = NOT_GIVEN,
|
68
108
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
69
109
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
70
110
|
extra_headers: Headers | None = None,
|
71
111
|
extra_query: Query | None = None,
|
72
112
|
extra_body: Body | None = None,
|
73
113
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
74
|
-
) ->
|
75
|
-
|
114
|
+
) -> UploadCreatePresignedURLResponse:
|
115
|
+
"""
|
116
|
+
Get presigned URL for direct S3 upload
|
117
|
+
|
118
|
+
Args:
|
119
|
+
content_type: MIME type of the file
|
120
|
+
|
121
|
+
filename: Filename to upload
|
122
|
+
|
123
|
+
name: Display name for the material
|
124
|
+
|
125
|
+
folder_id: Folder ID to place the material in
|
126
|
+
|
127
|
+
extra_headers: Send extra headers
|
128
|
+
|
129
|
+
extra_query: Add additional query parameters to the request
|
130
|
+
|
131
|
+
extra_body: Add additional JSON properties to the request
|
132
|
+
|
133
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
134
|
+
"""
|
76
135
|
return self._post(
|
77
136
|
"/api/v1/materials/upload/presigned-url",
|
137
|
+
body=maybe_transform(
|
138
|
+
{
|
139
|
+
"content_type": content_type,
|
140
|
+
"filename": filename,
|
141
|
+
"name": name,
|
142
|
+
"folder_id": folder_id,
|
143
|
+
},
|
144
|
+
upload_create_presigned_url_params.UploadCreatePresignedURLParams,
|
145
|
+
),
|
78
146
|
options=make_request_options(
|
79
147
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
80
148
|
),
|
81
|
-
cast_to=
|
149
|
+
cast_to=UploadCreatePresignedURLResponse,
|
82
150
|
)
|
83
151
|
|
84
152
|
def upload_file(
|
@@ -132,6 +200,67 @@ class UploadResource(SyncAPIResource):
|
|
132
200
|
cast_to=Material,
|
133
201
|
)
|
134
202
|
|
203
|
+
def upload_file_and_process(
|
204
|
+
self,
|
205
|
+
*,
|
206
|
+
file: FileTypes,
|
207
|
+
name: str,
|
208
|
+
folder_id: str | NotGiven = NOT_GIVEN,
|
209
|
+
poll_interval_ms: float | NotGiven = NOT_GIVEN,
|
210
|
+
timeout_ms: float | NotGiven = NOT_GIVEN,
|
211
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
212
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
213
|
+
extra_headers: Headers | None = None,
|
214
|
+
extra_query: Query | None = None,
|
215
|
+
extra_body: Body | None = None,
|
216
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
217
|
+
) -> Material:
|
218
|
+
"""Uploads a file and waits for processing to finish before returning.
|
219
|
+
|
220
|
+
Useful for
|
221
|
+
synchronous API usage.
|
222
|
+
|
223
|
+
Args:
|
224
|
+
name: Material name
|
225
|
+
|
226
|
+
folder_id: Folder ID (optional)
|
227
|
+
|
228
|
+
poll_interval_ms: Polling interval in milliseconds (default: 2000)
|
229
|
+
|
230
|
+
timeout_ms: Processing timeout in milliseconds (default: 300000)
|
231
|
+
|
232
|
+
extra_headers: Send extra headers
|
233
|
+
|
234
|
+
extra_query: Add additional query parameters to the request
|
235
|
+
|
236
|
+
extra_body: Add additional JSON properties to the request
|
237
|
+
|
238
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
239
|
+
"""
|
240
|
+
body = deepcopy_minimal(
|
241
|
+
{
|
242
|
+
"file": file,
|
243
|
+
"name": name,
|
244
|
+
"folder_id": folder_id,
|
245
|
+
"poll_interval_ms": poll_interval_ms,
|
246
|
+
"timeout_ms": timeout_ms,
|
247
|
+
}
|
248
|
+
)
|
249
|
+
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
|
250
|
+
# It should be noted that the actual Content-Type header that will be
|
251
|
+
# sent to the server will contain a `boundary` parameter, e.g.
|
252
|
+
# multipart/form-data; boundary=---abc--
|
253
|
+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
254
|
+
return self._post(
|
255
|
+
"/api/v1/materials/upload/file-and-process",
|
256
|
+
body=maybe_transform(body, upload_upload_file_and_process_params.UploadUploadFileAndProcessParams),
|
257
|
+
files=files,
|
258
|
+
options=make_request_options(
|
259
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
260
|
+
),
|
261
|
+
cast_to=Material,
|
262
|
+
)
|
263
|
+
|
135
264
|
def upload_from_url(
|
136
265
|
self,
|
137
266
|
*,
|
@@ -179,6 +308,62 @@ class UploadResource(SyncAPIResource):
|
|
179
308
|
cast_to=Material,
|
180
309
|
)
|
181
310
|
|
311
|
+
def upload_url_and_process(
|
312
|
+
self,
|
313
|
+
*,
|
314
|
+
name: str,
|
315
|
+
url: str,
|
316
|
+
folder_id: str | NotGiven = NOT_GIVEN,
|
317
|
+
poll_interval_ms: float | NotGiven = NOT_GIVEN,
|
318
|
+
timeout_ms: float | NotGiven = NOT_GIVEN,
|
319
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
320
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
321
|
+
extra_headers: Headers | None = None,
|
322
|
+
extra_query: Query | None = None,
|
323
|
+
extra_body: Body | None = None,
|
324
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
325
|
+
) -> Material:
|
326
|
+
"""
|
327
|
+
Fetches content from URL and waits for processing to finish before returning.
|
328
|
+
Useful for synchronous API usage.
|
329
|
+
|
330
|
+
Args:
|
331
|
+
name: Material name
|
332
|
+
|
333
|
+
url: URL to fetch content from
|
334
|
+
|
335
|
+
folder_id: Folder ID (optional)
|
336
|
+
|
337
|
+
poll_interval_ms: Polling interval in milliseconds (default: 2 seconds)
|
338
|
+
|
339
|
+
timeout_ms: Maximum time to wait for processing in milliseconds (default: 5 minutes)
|
340
|
+
|
341
|
+
extra_headers: Send extra headers
|
342
|
+
|
343
|
+
extra_query: Add additional query parameters to the request
|
344
|
+
|
345
|
+
extra_body: Add additional JSON properties to the request
|
346
|
+
|
347
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
348
|
+
"""
|
349
|
+
return self._post(
|
350
|
+
"/api/v1/materials/upload/url-and-process",
|
351
|
+
body=maybe_transform(
|
352
|
+
{
|
353
|
+
"name": name,
|
354
|
+
"url": url,
|
355
|
+
"folder_id": folder_id,
|
356
|
+
"poll_interval_ms": poll_interval_ms,
|
357
|
+
"timeout_ms": timeout_ms,
|
358
|
+
},
|
359
|
+
upload_upload_url_and_process_params.UploadUploadURLAndProcessParams,
|
360
|
+
),
|
361
|
+
options=make_request_options(
|
362
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
363
|
+
),
|
364
|
+
cast_to=Material,
|
365
|
+
)
|
366
|
+
|
182
367
|
|
183
368
|
class AsyncUploadResource(AsyncAPIResource):
|
184
369
|
@cached_property
|
@@ -203,39 +388,99 @@ class AsyncUploadResource(AsyncAPIResource):
|
|
203
388
|
async def complete_upload(
|
204
389
|
self,
|
205
390
|
*,
|
391
|
+
material_id: str,
|
392
|
+
organization_id: str,
|
393
|
+
s3_key: str,
|
206
394
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
207
395
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
208
396
|
extra_headers: Headers | None = None,
|
209
397
|
extra_query: Query | None = None,
|
210
398
|
extra_body: Body | None = None,
|
211
399
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
212
|
-
) ->
|
213
|
-
|
400
|
+
) -> Material:
|
401
|
+
"""
|
402
|
+
Complete upload after using presigned URL
|
403
|
+
|
404
|
+
Args:
|
405
|
+
material_id: The ID of the material that was uploaded
|
406
|
+
|
407
|
+
organization_id: The ID of the organization
|
408
|
+
|
409
|
+
s3_key: The S3 key of the uploaded file
|
410
|
+
|
411
|
+
extra_headers: Send extra headers
|
412
|
+
|
413
|
+
extra_query: Add additional query parameters to the request
|
414
|
+
|
415
|
+
extra_body: Add additional JSON properties to the request
|
416
|
+
|
417
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
418
|
+
"""
|
214
419
|
return await self._post(
|
215
420
|
"/api/v1/materials/upload/complete",
|
421
|
+
body=await async_maybe_transform(
|
422
|
+
{
|
423
|
+
"material_id": material_id,
|
424
|
+
"organization_id": organization_id,
|
425
|
+
"s3_key": s3_key,
|
426
|
+
},
|
427
|
+
upload_complete_upload_params.UploadCompleteUploadParams,
|
428
|
+
),
|
216
429
|
options=make_request_options(
|
217
430
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
218
431
|
),
|
219
|
-
cast_to=
|
432
|
+
cast_to=Material,
|
220
433
|
)
|
221
434
|
|
222
435
|
async def create_presigned_url(
|
223
436
|
self,
|
224
437
|
*,
|
438
|
+
content_type: str,
|
439
|
+
filename: str,
|
440
|
+
name: str,
|
441
|
+
folder_id: str | NotGiven = NOT_GIVEN,
|
225
442
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
226
443
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
227
444
|
extra_headers: Headers | None = None,
|
228
445
|
extra_query: Query | None = None,
|
229
446
|
extra_body: Body | None = None,
|
230
447
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
231
|
-
) ->
|
232
|
-
|
448
|
+
) -> UploadCreatePresignedURLResponse:
|
449
|
+
"""
|
450
|
+
Get presigned URL for direct S3 upload
|
451
|
+
|
452
|
+
Args:
|
453
|
+
content_type: MIME type of the file
|
454
|
+
|
455
|
+
filename: Filename to upload
|
456
|
+
|
457
|
+
name: Display name for the material
|
458
|
+
|
459
|
+
folder_id: Folder ID to place the material in
|
460
|
+
|
461
|
+
extra_headers: Send extra headers
|
462
|
+
|
463
|
+
extra_query: Add additional query parameters to the request
|
464
|
+
|
465
|
+
extra_body: Add additional JSON properties to the request
|
466
|
+
|
467
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
468
|
+
"""
|
233
469
|
return await self._post(
|
234
470
|
"/api/v1/materials/upload/presigned-url",
|
471
|
+
body=await async_maybe_transform(
|
472
|
+
{
|
473
|
+
"content_type": content_type,
|
474
|
+
"filename": filename,
|
475
|
+
"name": name,
|
476
|
+
"folder_id": folder_id,
|
477
|
+
},
|
478
|
+
upload_create_presigned_url_params.UploadCreatePresignedURLParams,
|
479
|
+
),
|
235
480
|
options=make_request_options(
|
236
481
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
237
482
|
),
|
238
|
-
cast_to=
|
483
|
+
cast_to=UploadCreatePresignedURLResponse,
|
239
484
|
)
|
240
485
|
|
241
486
|
async def upload_file(
|
@@ -289,6 +534,69 @@ class AsyncUploadResource(AsyncAPIResource):
|
|
289
534
|
cast_to=Material,
|
290
535
|
)
|
291
536
|
|
537
|
+
async def upload_file_and_process(
|
538
|
+
self,
|
539
|
+
*,
|
540
|
+
file: FileTypes,
|
541
|
+
name: str,
|
542
|
+
folder_id: str | NotGiven = NOT_GIVEN,
|
543
|
+
poll_interval_ms: float | NotGiven = NOT_GIVEN,
|
544
|
+
timeout_ms: float | NotGiven = NOT_GIVEN,
|
545
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
546
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
547
|
+
extra_headers: Headers | None = None,
|
548
|
+
extra_query: Query | None = None,
|
549
|
+
extra_body: Body | None = None,
|
550
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
551
|
+
) -> Material:
|
552
|
+
"""Uploads a file and waits for processing to finish before returning.
|
553
|
+
|
554
|
+
Useful for
|
555
|
+
synchronous API usage.
|
556
|
+
|
557
|
+
Args:
|
558
|
+
name: Material name
|
559
|
+
|
560
|
+
folder_id: Folder ID (optional)
|
561
|
+
|
562
|
+
poll_interval_ms: Polling interval in milliseconds (default: 2000)
|
563
|
+
|
564
|
+
timeout_ms: Processing timeout in milliseconds (default: 300000)
|
565
|
+
|
566
|
+
extra_headers: Send extra headers
|
567
|
+
|
568
|
+
extra_query: Add additional query parameters to the request
|
569
|
+
|
570
|
+
extra_body: Add additional JSON properties to the request
|
571
|
+
|
572
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
573
|
+
"""
|
574
|
+
body = deepcopy_minimal(
|
575
|
+
{
|
576
|
+
"file": file,
|
577
|
+
"name": name,
|
578
|
+
"folder_id": folder_id,
|
579
|
+
"poll_interval_ms": poll_interval_ms,
|
580
|
+
"timeout_ms": timeout_ms,
|
581
|
+
}
|
582
|
+
)
|
583
|
+
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
|
584
|
+
# It should be noted that the actual Content-Type header that will be
|
585
|
+
# sent to the server will contain a `boundary` parameter, e.g.
|
586
|
+
# multipart/form-data; boundary=---abc--
|
587
|
+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
588
|
+
return await self._post(
|
589
|
+
"/api/v1/materials/upload/file-and-process",
|
590
|
+
body=await async_maybe_transform(
|
591
|
+
body, upload_upload_file_and_process_params.UploadUploadFileAndProcessParams
|
592
|
+
),
|
593
|
+
files=files,
|
594
|
+
options=make_request_options(
|
595
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
596
|
+
),
|
597
|
+
cast_to=Material,
|
598
|
+
)
|
599
|
+
|
292
600
|
async def upload_from_url(
|
293
601
|
self,
|
294
602
|
*,
|
@@ -336,6 +644,62 @@ class AsyncUploadResource(AsyncAPIResource):
|
|
336
644
|
cast_to=Material,
|
337
645
|
)
|
338
646
|
|
647
|
+
async def upload_url_and_process(
|
648
|
+
self,
|
649
|
+
*,
|
650
|
+
name: str,
|
651
|
+
url: str,
|
652
|
+
folder_id: str | NotGiven = NOT_GIVEN,
|
653
|
+
poll_interval_ms: float | NotGiven = NOT_GIVEN,
|
654
|
+
timeout_ms: float | NotGiven = NOT_GIVEN,
|
655
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
656
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
657
|
+
extra_headers: Headers | None = None,
|
658
|
+
extra_query: Query | None = None,
|
659
|
+
extra_body: Body | None = None,
|
660
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
661
|
+
) -> Material:
|
662
|
+
"""
|
663
|
+
Fetches content from URL and waits for processing to finish before returning.
|
664
|
+
Useful for synchronous API usage.
|
665
|
+
|
666
|
+
Args:
|
667
|
+
name: Material name
|
668
|
+
|
669
|
+
url: URL to fetch content from
|
670
|
+
|
671
|
+
folder_id: Folder ID (optional)
|
672
|
+
|
673
|
+
poll_interval_ms: Polling interval in milliseconds (default: 2 seconds)
|
674
|
+
|
675
|
+
timeout_ms: Maximum time to wait for processing in milliseconds (default: 5 minutes)
|
676
|
+
|
677
|
+
extra_headers: Send extra headers
|
678
|
+
|
679
|
+
extra_query: Add additional query parameters to the request
|
680
|
+
|
681
|
+
extra_body: Add additional JSON properties to the request
|
682
|
+
|
683
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
684
|
+
"""
|
685
|
+
return await self._post(
|
686
|
+
"/api/v1/materials/upload/url-and-process",
|
687
|
+
body=await async_maybe_transform(
|
688
|
+
{
|
689
|
+
"name": name,
|
690
|
+
"url": url,
|
691
|
+
"folder_id": folder_id,
|
692
|
+
"poll_interval_ms": poll_interval_ms,
|
693
|
+
"timeout_ms": timeout_ms,
|
694
|
+
},
|
695
|
+
upload_upload_url_and_process_params.UploadUploadURLAndProcessParams,
|
696
|
+
),
|
697
|
+
options=make_request_options(
|
698
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
699
|
+
),
|
700
|
+
cast_to=Material,
|
701
|
+
)
|
702
|
+
|
339
703
|
|
340
704
|
class UploadResourceWithRawResponse:
|
341
705
|
def __init__(self, upload: UploadResource) -> None:
|
@@ -350,9 +714,15 @@ class UploadResourceWithRawResponse:
|
|
350
714
|
self.upload_file = to_raw_response_wrapper(
|
351
715
|
upload.upload_file,
|
352
716
|
)
|
717
|
+
self.upload_file_and_process = to_raw_response_wrapper(
|
718
|
+
upload.upload_file_and_process,
|
719
|
+
)
|
353
720
|
self.upload_from_url = to_raw_response_wrapper(
|
354
721
|
upload.upload_from_url,
|
355
722
|
)
|
723
|
+
self.upload_url_and_process = to_raw_response_wrapper(
|
724
|
+
upload.upload_url_and_process,
|
725
|
+
)
|
356
726
|
|
357
727
|
|
358
728
|
class AsyncUploadResourceWithRawResponse:
|
@@ -368,9 +738,15 @@ class AsyncUploadResourceWithRawResponse:
|
|
368
738
|
self.upload_file = async_to_raw_response_wrapper(
|
369
739
|
upload.upload_file,
|
370
740
|
)
|
741
|
+
self.upload_file_and_process = async_to_raw_response_wrapper(
|
742
|
+
upload.upload_file_and_process,
|
743
|
+
)
|
371
744
|
self.upload_from_url = async_to_raw_response_wrapper(
|
372
745
|
upload.upload_from_url,
|
373
746
|
)
|
747
|
+
self.upload_url_and_process = async_to_raw_response_wrapper(
|
748
|
+
upload.upload_url_and_process,
|
749
|
+
)
|
374
750
|
|
375
751
|
|
376
752
|
class UploadResourceWithStreamingResponse:
|
@@ -386,9 +762,15 @@ class UploadResourceWithStreamingResponse:
|
|
386
762
|
self.upload_file = to_streamed_response_wrapper(
|
387
763
|
upload.upload_file,
|
388
764
|
)
|
765
|
+
self.upload_file_and_process = to_streamed_response_wrapper(
|
766
|
+
upload.upload_file_and_process,
|
767
|
+
)
|
389
768
|
self.upload_from_url = to_streamed_response_wrapper(
|
390
769
|
upload.upload_from_url,
|
391
770
|
)
|
771
|
+
self.upload_url_and_process = to_streamed_response_wrapper(
|
772
|
+
upload.upload_url_and_process,
|
773
|
+
)
|
392
774
|
|
393
775
|
|
394
776
|
class AsyncUploadResourceWithStreamingResponse:
|
@@ -404,6 +786,12 @@ class AsyncUploadResourceWithStreamingResponse:
|
|
404
786
|
self.upload_file = async_to_streamed_response_wrapper(
|
405
787
|
upload.upload_file,
|
406
788
|
)
|
789
|
+
self.upload_file_and_process = async_to_streamed_response_wrapper(
|
790
|
+
upload.upload_file_and_process,
|
791
|
+
)
|
407
792
|
self.upload_from_url = async_to_streamed_response_wrapper(
|
408
793
|
upload.upload_from_url,
|
409
794
|
)
|
795
|
+
self.upload_url_and_process = async_to_streamed_response_wrapper(
|
796
|
+
upload.upload_url_and_process,
|
797
|
+
)
|