studyfetch-sdk 0.1.0a19__py3-none-any.whl → 0.1.0a21__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 +23 -2
- studyfetch_sdk/_version.py +1 -1
- studyfetch_sdk/resources/v1/__init__.py +6 -104
- studyfetch_sdk/resources/v1/chat.py +246 -0
- studyfetch_sdk/resources/v1/materials/materials.py +304 -0
- studyfetch_sdk/resources/v1/materials/upload.py +30 -14
- studyfetch_sdk/resources/v1/v1.py +20 -244
- studyfetch_sdk/types/v1/__init__.py +3 -22
- studyfetch_sdk/types/v1/chat_stream_params.py +39 -7
- studyfetch_sdk/types/v1/component_create_params.py +24 -0
- studyfetch_sdk/types/v1/component_generate_embed_params.py +7 -1
- studyfetch_sdk/types/v1/generated_material.py +65 -0
- studyfetch_sdk/types/v1/material_generate_and_process_params.py +38 -0
- studyfetch_sdk/types/v1/material_generate_params.py +32 -0
- studyfetch_sdk/types/v1/materials/upload_complete_upload_params.py +2 -5
- studyfetch_sdk/types/v1/materials/upload_create_presigned_url_params.py +3 -0
- studyfetch_sdk/types/v1/materials/upload_upload_file_and_process_params.py +4 -1
- studyfetch_sdk/types/v1/materials/upload_upload_file_params.py +3 -0
- {studyfetch_sdk-0.1.0a19.dist-info → studyfetch_sdk-0.1.0a21.dist-info}/METADATA +1 -1
- {studyfetch_sdk-0.1.0a19.dist-info → studyfetch_sdk-0.1.0a21.dist-info}/RECORD +22 -83
- studyfetch_sdk/resources/v1/audio_recaps/__init__.py +0 -33
- studyfetch_sdk/resources/v1/audio_recaps/audio_recaps.py +0 -328
- studyfetch_sdk/resources/v1/audio_recaps/sections.py +0 -250
- studyfetch_sdk/resources/v1/chat/__init__.py +0 -47
- studyfetch_sdk/resources/v1/chat/chat.py +0 -574
- studyfetch_sdk/resources/v1/chat/sessions.py +0 -222
- studyfetch_sdk/resources/v1/chat/test.py +0 -190
- studyfetch_sdk/resources/v1/data_analyst/__init__.py +0 -47
- studyfetch_sdk/resources/v1/data_analyst/data_analyst.py +0 -582
- studyfetch_sdk/resources/v1/data_analyst/sessions.py +0 -222
- studyfetch_sdk/resources/v1/data_analyst/test.py +0 -190
- studyfetch_sdk/resources/v1/explainers.py +0 -441
- studyfetch_sdk/resources/v1/flashcards.py +0 -783
- studyfetch_sdk/resources/v1/scenarios/__init__.py +0 -61
- studyfetch_sdk/resources/v1/scenarios/component.py +0 -426
- studyfetch_sdk/resources/v1/scenarios/scenarios.py +0 -936
- studyfetch_sdk/resources/v1/scenarios/sessions.py +0 -236
- studyfetch_sdk/resources/v1/scenarios/submissions/__init__.py +0 -33
- studyfetch_sdk/resources/v1/scenarios/submissions/submissions.py +0 -102
- studyfetch_sdk/resources/v1/scenarios/submissions/user.py +0 -210
- studyfetch_sdk/resources/v1/tests/__init__.py +0 -33
- studyfetch_sdk/resources/v1/tests/component.py +0 -160
- studyfetch_sdk/resources/v1/tests/tests.py +0 -682
- studyfetch_sdk/resources/v1/upload/__init__.py +0 -33
- studyfetch_sdk/resources/v1/upload/component.py +0 -572
- studyfetch_sdk/resources/v1/upload/upload.py +0 -102
- studyfetch_sdk/types/v1/audio_recaps/__init__.py +0 -3
- studyfetch_sdk/types/v1/chat/__init__.py +0 -5
- studyfetch_sdk/types/v1/chat/session_retrieve_params.py +0 -11
- studyfetch_sdk/types/v1/chat_get_session_params.py +0 -13
- studyfetch_sdk/types/v1/chat_send_message_params.py +0 -54
- studyfetch_sdk/types/v1/data_analyst/__init__.py +0 -5
- studyfetch_sdk/types/v1/data_analyst/session_retrieve_params.py +0 -11
- studyfetch_sdk/types/v1/data_analyst_retrieve_session_params.py +0 -13
- studyfetch_sdk/types/v1/data_analyst_send_message_params.py +0 -54
- studyfetch_sdk/types/v1/data_analyst_stream_params.py +0 -28
- studyfetch_sdk/types/v1/explainer_create_params.py +0 -45
- studyfetch_sdk/types/v1/explainer_handle_webhook_params.py +0 -53
- studyfetch_sdk/types/v1/flashcard_batch_process_params.py +0 -36
- studyfetch_sdk/types/v1/flashcard_batch_process_response.py +0 -39
- studyfetch_sdk/types/v1/flashcard_get_algorithm_response.py +0 -37
- studyfetch_sdk/types/v1/flashcard_get_all_params.py +0 -23
- studyfetch_sdk/types/v1/flashcard_get_due_params.py +0 -19
- studyfetch_sdk/types/v1/flashcard_get_stats_params.py +0 -17
- studyfetch_sdk/types/v1/flashcard_get_types_response.py +0 -14
- studyfetch_sdk/types/v1/flashcard_rate_params.py +0 -23
- studyfetch_sdk/types/v1/scenario_create_params.py +0 -48
- studyfetch_sdk/types/v1/scenario_submit_answer_params.py +0 -18
- studyfetch_sdk/types/v1/scenario_update_params.py +0 -45
- studyfetch_sdk/types/v1/scenarios/__init__.py +0 -5
- studyfetch_sdk/types/v1/scenarios/component_update_params.py +0 -45
- studyfetch_sdk/types/v1/scenarios/submissions/__init__.py +0 -3
- studyfetch_sdk/types/v1/test_create_params.py +0 -20
- studyfetch_sdk/types/v1/test_retake_params.py +0 -14
- studyfetch_sdk/types/v1/test_submit_answer_params.py +0 -20
- studyfetch_sdk/types/v1/test_submit_params.py +0 -14
- studyfetch_sdk/types/v1/tests/__init__.py +0 -3
- studyfetch_sdk/types/v1/upload/__init__.py +0 -11
- studyfetch_sdk/types/v1/upload/component_complete_upload_params.py +0 -20
- studyfetch_sdk/types/v1/upload/component_complete_upload_response.py +0 -16
- studyfetch_sdk/types/v1/upload/component_get_presigned_url_params.py +0 -23
- studyfetch_sdk/types/v1/upload/component_get_presigned_url_response.py +0 -15
- studyfetch_sdk/types/v1/upload/component_upload_file_params.py +0 -21
- studyfetch_sdk/types/v1/upload/component_upload_url_params.py +0 -23
- studyfetch_sdk/types/v1/upload/file_upload_response.py +0 -24
- {studyfetch_sdk-0.1.0a19.dist-info → studyfetch_sdk-0.1.0a21.dist-info}/WHEEL +0 -0
- {studyfetch_sdk-0.1.0a19.dist-info → studyfetch_sdk-0.1.0a21.dist-info}/licenses/LICENSE +0 -0
@@ -1,33 +0,0 @@
|
|
1
|
-
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
-
|
3
|
-
from .upload import (
|
4
|
-
UploadResource,
|
5
|
-
AsyncUploadResource,
|
6
|
-
UploadResourceWithRawResponse,
|
7
|
-
AsyncUploadResourceWithRawResponse,
|
8
|
-
UploadResourceWithStreamingResponse,
|
9
|
-
AsyncUploadResourceWithStreamingResponse,
|
10
|
-
)
|
11
|
-
from .component import (
|
12
|
-
ComponentResource,
|
13
|
-
AsyncComponentResource,
|
14
|
-
ComponentResourceWithRawResponse,
|
15
|
-
AsyncComponentResourceWithRawResponse,
|
16
|
-
ComponentResourceWithStreamingResponse,
|
17
|
-
AsyncComponentResourceWithStreamingResponse,
|
18
|
-
)
|
19
|
-
|
20
|
-
__all__ = [
|
21
|
-
"ComponentResource",
|
22
|
-
"AsyncComponentResource",
|
23
|
-
"ComponentResourceWithRawResponse",
|
24
|
-
"AsyncComponentResourceWithRawResponse",
|
25
|
-
"ComponentResourceWithStreamingResponse",
|
26
|
-
"AsyncComponentResourceWithStreamingResponse",
|
27
|
-
"UploadResource",
|
28
|
-
"AsyncUploadResource",
|
29
|
-
"UploadResourceWithRawResponse",
|
30
|
-
"AsyncUploadResourceWithRawResponse",
|
31
|
-
"UploadResourceWithStreamingResponse",
|
32
|
-
"AsyncUploadResourceWithStreamingResponse",
|
33
|
-
]
|
@@ -1,572 +0,0 @@
|
|
1
|
-
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
-
|
3
|
-
from __future__ import annotations
|
4
|
-
|
5
|
-
from typing import Mapping, cast
|
6
|
-
|
7
|
-
import httpx
|
8
|
-
|
9
|
-
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes
|
10
|
-
from ...._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform
|
11
|
-
from ...._compat import cached_property
|
12
|
-
from ...._resource import SyncAPIResource, AsyncAPIResource
|
13
|
-
from ...._response import (
|
14
|
-
to_raw_response_wrapper,
|
15
|
-
to_streamed_response_wrapper,
|
16
|
-
async_to_raw_response_wrapper,
|
17
|
-
async_to_streamed_response_wrapper,
|
18
|
-
)
|
19
|
-
from ...._base_client import make_request_options
|
20
|
-
from ....types.v1.upload import (
|
21
|
-
component_upload_url_params,
|
22
|
-
component_upload_file_params,
|
23
|
-
component_complete_upload_params,
|
24
|
-
component_get_presigned_url_params,
|
25
|
-
)
|
26
|
-
from ....types.v1.upload.file_upload_response import FileUploadResponse
|
27
|
-
from ....types.v1.upload.component_complete_upload_response import ComponentCompleteUploadResponse
|
28
|
-
from ....types.v1.upload.component_get_presigned_url_response import ComponentGetPresignedURLResponse
|
29
|
-
|
30
|
-
__all__ = ["ComponentResource", "AsyncComponentResource"]
|
31
|
-
|
32
|
-
|
33
|
-
class ComponentResource(SyncAPIResource):
|
34
|
-
@cached_property
|
35
|
-
def with_raw_response(self) -> ComponentResourceWithRawResponse:
|
36
|
-
"""
|
37
|
-
This property can be used as a prefix for any HTTP method call to return
|
38
|
-
the raw response object instead of the parsed content.
|
39
|
-
|
40
|
-
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#accessing-raw-response-data-eg-headers
|
41
|
-
"""
|
42
|
-
return ComponentResourceWithRawResponse(self)
|
43
|
-
|
44
|
-
@cached_property
|
45
|
-
def with_streaming_response(self) -> ComponentResourceWithStreamingResponse:
|
46
|
-
"""
|
47
|
-
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
48
|
-
|
49
|
-
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#with_streaming_response
|
50
|
-
"""
|
51
|
-
return ComponentResourceWithStreamingResponse(self)
|
52
|
-
|
53
|
-
def complete_upload(
|
54
|
-
self,
|
55
|
-
component_id: str,
|
56
|
-
*,
|
57
|
-
material_id: str,
|
58
|
-
organization_id: str,
|
59
|
-
s3_key: str,
|
60
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
61
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
62
|
-
extra_headers: Headers | None = None,
|
63
|
-
extra_query: Query | None = None,
|
64
|
-
extra_body: Body | None = None,
|
65
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
66
|
-
) -> ComponentCompleteUploadResponse:
|
67
|
-
"""
|
68
|
-
Complete a file 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
|
-
"""
|
85
|
-
if not component_id:
|
86
|
-
raise ValueError(f"Expected a non-empty value for `component_id` but received {component_id!r}")
|
87
|
-
return self._post(
|
88
|
-
f"/api/v1/upload/component/{component_id}/complete",
|
89
|
-
body=maybe_transform(
|
90
|
-
{
|
91
|
-
"material_id": material_id,
|
92
|
-
"organization_id": organization_id,
|
93
|
-
"s3_key": s3_key,
|
94
|
-
},
|
95
|
-
component_complete_upload_params.ComponentCompleteUploadParams,
|
96
|
-
),
|
97
|
-
options=make_request_options(
|
98
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
99
|
-
),
|
100
|
-
cast_to=ComponentCompleteUploadResponse,
|
101
|
-
)
|
102
|
-
|
103
|
-
def get_presigned_url(
|
104
|
-
self,
|
105
|
-
component_id: str,
|
106
|
-
*,
|
107
|
-
content_type: str,
|
108
|
-
filename: str,
|
109
|
-
folder_id: str,
|
110
|
-
organization_id: str,
|
111
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
112
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
113
|
-
extra_headers: Headers | None = None,
|
114
|
-
extra_query: Query | None = None,
|
115
|
-
extra_body: Body | None = None,
|
116
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
117
|
-
) -> ComponentGetPresignedURLResponse:
|
118
|
-
"""
|
119
|
-
Get a presigned URL for direct file upload
|
120
|
-
|
121
|
-
Args:
|
122
|
-
content_type: The MIME type of the file
|
123
|
-
|
124
|
-
filename: The name of the file to upload
|
125
|
-
|
126
|
-
folder_id: The ID of the folder to upload to
|
127
|
-
|
128
|
-
organization_id: The ID of the organization
|
129
|
-
|
130
|
-
extra_headers: Send extra headers
|
131
|
-
|
132
|
-
extra_query: Add additional query parameters to the request
|
133
|
-
|
134
|
-
extra_body: Add additional JSON properties to the request
|
135
|
-
|
136
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
137
|
-
"""
|
138
|
-
if not component_id:
|
139
|
-
raise ValueError(f"Expected a non-empty value for `component_id` but received {component_id!r}")
|
140
|
-
return self._post(
|
141
|
-
f"/api/v1/upload/component/{component_id}/presigned-url",
|
142
|
-
body=maybe_transform(
|
143
|
-
{
|
144
|
-
"content_type": content_type,
|
145
|
-
"filename": filename,
|
146
|
-
"folder_id": folder_id,
|
147
|
-
"organization_id": organization_id,
|
148
|
-
},
|
149
|
-
component_get_presigned_url_params.ComponentGetPresignedURLParams,
|
150
|
-
),
|
151
|
-
options=make_request_options(
|
152
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
153
|
-
),
|
154
|
-
cast_to=ComponentGetPresignedURLResponse,
|
155
|
-
)
|
156
|
-
|
157
|
-
def upload_file(
|
158
|
-
self,
|
159
|
-
component_id: str,
|
160
|
-
*,
|
161
|
-
file: FileTypes,
|
162
|
-
folder_id: str,
|
163
|
-
organization_id: str,
|
164
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
165
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
166
|
-
extra_headers: Headers | None = None,
|
167
|
-
extra_query: Query | None = None,
|
168
|
-
extra_body: Body | None = None,
|
169
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
170
|
-
) -> FileUploadResponse:
|
171
|
-
"""
|
172
|
-
Upload a file to a component
|
173
|
-
|
174
|
-
Args:
|
175
|
-
file: The file to upload
|
176
|
-
|
177
|
-
folder_id: The ID of the folder to upload to
|
178
|
-
|
179
|
-
organization_id: The ID of the organization
|
180
|
-
|
181
|
-
extra_headers: Send extra headers
|
182
|
-
|
183
|
-
extra_query: Add additional query parameters to the request
|
184
|
-
|
185
|
-
extra_body: Add additional JSON properties to the request
|
186
|
-
|
187
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
188
|
-
"""
|
189
|
-
if not component_id:
|
190
|
-
raise ValueError(f"Expected a non-empty value for `component_id` but received {component_id!r}")
|
191
|
-
body = deepcopy_minimal(
|
192
|
-
{
|
193
|
-
"file": file,
|
194
|
-
"folder_id": folder_id,
|
195
|
-
"organization_id": organization_id,
|
196
|
-
}
|
197
|
-
)
|
198
|
-
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
|
199
|
-
# It should be noted that the actual Content-Type header that will be
|
200
|
-
# sent to the server will contain a `boundary` parameter, e.g.
|
201
|
-
# multipart/form-data; boundary=---abc--
|
202
|
-
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
203
|
-
return self._post(
|
204
|
-
f"/api/v1/upload/component/{component_id}/file",
|
205
|
-
body=maybe_transform(body, component_upload_file_params.ComponentUploadFileParams),
|
206
|
-
files=files,
|
207
|
-
options=make_request_options(
|
208
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
209
|
-
),
|
210
|
-
cast_to=FileUploadResponse,
|
211
|
-
)
|
212
|
-
|
213
|
-
def upload_url(
|
214
|
-
self,
|
215
|
-
component_id: str,
|
216
|
-
*,
|
217
|
-
folder_id: str,
|
218
|
-
name: str,
|
219
|
-
organization_id: str,
|
220
|
-
url: str,
|
221
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
222
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
223
|
-
extra_headers: Headers | None = None,
|
224
|
-
extra_query: Query | None = None,
|
225
|
-
extra_body: Body | None = None,
|
226
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
227
|
-
) -> FileUploadResponse:
|
228
|
-
"""
|
229
|
-
Upload a file from URL to a component
|
230
|
-
|
231
|
-
Args:
|
232
|
-
folder_id: The ID of the folder to upload to
|
233
|
-
|
234
|
-
name: The name for the uploaded file
|
235
|
-
|
236
|
-
organization_id: The ID of the organization
|
237
|
-
|
238
|
-
url: The URL of the file to upload
|
239
|
-
|
240
|
-
extra_headers: Send extra headers
|
241
|
-
|
242
|
-
extra_query: Add additional query parameters to the request
|
243
|
-
|
244
|
-
extra_body: Add additional JSON properties to the request
|
245
|
-
|
246
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
247
|
-
"""
|
248
|
-
if not component_id:
|
249
|
-
raise ValueError(f"Expected a non-empty value for `component_id` but received {component_id!r}")
|
250
|
-
return self._post(
|
251
|
-
f"/api/v1/upload/component/{component_id}/url",
|
252
|
-
body=maybe_transform(
|
253
|
-
{
|
254
|
-
"folder_id": folder_id,
|
255
|
-
"name": name,
|
256
|
-
"organization_id": organization_id,
|
257
|
-
"url": url,
|
258
|
-
},
|
259
|
-
component_upload_url_params.ComponentUploadURLParams,
|
260
|
-
),
|
261
|
-
options=make_request_options(
|
262
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
263
|
-
),
|
264
|
-
cast_to=FileUploadResponse,
|
265
|
-
)
|
266
|
-
|
267
|
-
|
268
|
-
class AsyncComponentResource(AsyncAPIResource):
|
269
|
-
@cached_property
|
270
|
-
def with_raw_response(self) -> AsyncComponentResourceWithRawResponse:
|
271
|
-
"""
|
272
|
-
This property can be used as a prefix for any HTTP method call to return
|
273
|
-
the raw response object instead of the parsed content.
|
274
|
-
|
275
|
-
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#accessing-raw-response-data-eg-headers
|
276
|
-
"""
|
277
|
-
return AsyncComponentResourceWithRawResponse(self)
|
278
|
-
|
279
|
-
@cached_property
|
280
|
-
def with_streaming_response(self) -> AsyncComponentResourceWithStreamingResponse:
|
281
|
-
"""
|
282
|
-
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
283
|
-
|
284
|
-
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#with_streaming_response
|
285
|
-
"""
|
286
|
-
return AsyncComponentResourceWithStreamingResponse(self)
|
287
|
-
|
288
|
-
async def complete_upload(
|
289
|
-
self,
|
290
|
-
component_id: str,
|
291
|
-
*,
|
292
|
-
material_id: str,
|
293
|
-
organization_id: str,
|
294
|
-
s3_key: str,
|
295
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
296
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
297
|
-
extra_headers: Headers | None = None,
|
298
|
-
extra_query: Query | None = None,
|
299
|
-
extra_body: Body | None = None,
|
300
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
301
|
-
) -> ComponentCompleteUploadResponse:
|
302
|
-
"""
|
303
|
-
Complete a file upload after using presigned URL
|
304
|
-
|
305
|
-
Args:
|
306
|
-
material_id: The ID of the material that was uploaded
|
307
|
-
|
308
|
-
organization_id: The ID of the organization
|
309
|
-
|
310
|
-
s3_key: The S3 key of the uploaded file
|
311
|
-
|
312
|
-
extra_headers: Send extra headers
|
313
|
-
|
314
|
-
extra_query: Add additional query parameters to the request
|
315
|
-
|
316
|
-
extra_body: Add additional JSON properties to the request
|
317
|
-
|
318
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
319
|
-
"""
|
320
|
-
if not component_id:
|
321
|
-
raise ValueError(f"Expected a non-empty value for `component_id` but received {component_id!r}")
|
322
|
-
return await self._post(
|
323
|
-
f"/api/v1/upload/component/{component_id}/complete",
|
324
|
-
body=await async_maybe_transform(
|
325
|
-
{
|
326
|
-
"material_id": material_id,
|
327
|
-
"organization_id": organization_id,
|
328
|
-
"s3_key": s3_key,
|
329
|
-
},
|
330
|
-
component_complete_upload_params.ComponentCompleteUploadParams,
|
331
|
-
),
|
332
|
-
options=make_request_options(
|
333
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
334
|
-
),
|
335
|
-
cast_to=ComponentCompleteUploadResponse,
|
336
|
-
)
|
337
|
-
|
338
|
-
async def get_presigned_url(
|
339
|
-
self,
|
340
|
-
component_id: str,
|
341
|
-
*,
|
342
|
-
content_type: str,
|
343
|
-
filename: str,
|
344
|
-
folder_id: str,
|
345
|
-
organization_id: str,
|
346
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
347
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
348
|
-
extra_headers: Headers | None = None,
|
349
|
-
extra_query: Query | None = None,
|
350
|
-
extra_body: Body | None = None,
|
351
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
352
|
-
) -> ComponentGetPresignedURLResponse:
|
353
|
-
"""
|
354
|
-
Get a presigned URL for direct file upload
|
355
|
-
|
356
|
-
Args:
|
357
|
-
content_type: The MIME type of the file
|
358
|
-
|
359
|
-
filename: The name of the file to upload
|
360
|
-
|
361
|
-
folder_id: The ID of the folder to upload to
|
362
|
-
|
363
|
-
organization_id: The ID of the organization
|
364
|
-
|
365
|
-
extra_headers: Send extra headers
|
366
|
-
|
367
|
-
extra_query: Add additional query parameters to the request
|
368
|
-
|
369
|
-
extra_body: Add additional JSON properties to the request
|
370
|
-
|
371
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
372
|
-
"""
|
373
|
-
if not component_id:
|
374
|
-
raise ValueError(f"Expected a non-empty value for `component_id` but received {component_id!r}")
|
375
|
-
return await self._post(
|
376
|
-
f"/api/v1/upload/component/{component_id}/presigned-url",
|
377
|
-
body=await async_maybe_transform(
|
378
|
-
{
|
379
|
-
"content_type": content_type,
|
380
|
-
"filename": filename,
|
381
|
-
"folder_id": folder_id,
|
382
|
-
"organization_id": organization_id,
|
383
|
-
},
|
384
|
-
component_get_presigned_url_params.ComponentGetPresignedURLParams,
|
385
|
-
),
|
386
|
-
options=make_request_options(
|
387
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
388
|
-
),
|
389
|
-
cast_to=ComponentGetPresignedURLResponse,
|
390
|
-
)
|
391
|
-
|
392
|
-
async def upload_file(
|
393
|
-
self,
|
394
|
-
component_id: str,
|
395
|
-
*,
|
396
|
-
file: FileTypes,
|
397
|
-
folder_id: str,
|
398
|
-
organization_id: str,
|
399
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
400
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
401
|
-
extra_headers: Headers | None = None,
|
402
|
-
extra_query: Query | None = None,
|
403
|
-
extra_body: Body | None = None,
|
404
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
405
|
-
) -> FileUploadResponse:
|
406
|
-
"""
|
407
|
-
Upload a file to a component
|
408
|
-
|
409
|
-
Args:
|
410
|
-
file: The file to upload
|
411
|
-
|
412
|
-
folder_id: The ID of the folder to upload to
|
413
|
-
|
414
|
-
organization_id: The ID of the organization
|
415
|
-
|
416
|
-
extra_headers: Send extra headers
|
417
|
-
|
418
|
-
extra_query: Add additional query parameters to the request
|
419
|
-
|
420
|
-
extra_body: Add additional JSON properties to the request
|
421
|
-
|
422
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
423
|
-
"""
|
424
|
-
if not component_id:
|
425
|
-
raise ValueError(f"Expected a non-empty value for `component_id` but received {component_id!r}")
|
426
|
-
body = deepcopy_minimal(
|
427
|
-
{
|
428
|
-
"file": file,
|
429
|
-
"folder_id": folder_id,
|
430
|
-
"organization_id": organization_id,
|
431
|
-
}
|
432
|
-
)
|
433
|
-
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
|
434
|
-
# It should be noted that the actual Content-Type header that will be
|
435
|
-
# sent to the server will contain a `boundary` parameter, e.g.
|
436
|
-
# multipart/form-data; boundary=---abc--
|
437
|
-
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
438
|
-
return await self._post(
|
439
|
-
f"/api/v1/upload/component/{component_id}/file",
|
440
|
-
body=await async_maybe_transform(body, component_upload_file_params.ComponentUploadFileParams),
|
441
|
-
files=files,
|
442
|
-
options=make_request_options(
|
443
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
444
|
-
),
|
445
|
-
cast_to=FileUploadResponse,
|
446
|
-
)
|
447
|
-
|
448
|
-
async def upload_url(
|
449
|
-
self,
|
450
|
-
component_id: str,
|
451
|
-
*,
|
452
|
-
folder_id: str,
|
453
|
-
name: str,
|
454
|
-
organization_id: str,
|
455
|
-
url: str,
|
456
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
457
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
458
|
-
extra_headers: Headers | None = None,
|
459
|
-
extra_query: Query | None = None,
|
460
|
-
extra_body: Body | None = None,
|
461
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
462
|
-
) -> FileUploadResponse:
|
463
|
-
"""
|
464
|
-
Upload a file from URL to a component
|
465
|
-
|
466
|
-
Args:
|
467
|
-
folder_id: The ID of the folder to upload to
|
468
|
-
|
469
|
-
name: The name for the uploaded file
|
470
|
-
|
471
|
-
organization_id: The ID of the organization
|
472
|
-
|
473
|
-
url: The URL of the file to upload
|
474
|
-
|
475
|
-
extra_headers: Send extra headers
|
476
|
-
|
477
|
-
extra_query: Add additional query parameters to the request
|
478
|
-
|
479
|
-
extra_body: Add additional JSON properties to the request
|
480
|
-
|
481
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
482
|
-
"""
|
483
|
-
if not component_id:
|
484
|
-
raise ValueError(f"Expected a non-empty value for `component_id` but received {component_id!r}")
|
485
|
-
return await self._post(
|
486
|
-
f"/api/v1/upload/component/{component_id}/url",
|
487
|
-
body=await async_maybe_transform(
|
488
|
-
{
|
489
|
-
"folder_id": folder_id,
|
490
|
-
"name": name,
|
491
|
-
"organization_id": organization_id,
|
492
|
-
"url": url,
|
493
|
-
},
|
494
|
-
component_upload_url_params.ComponentUploadURLParams,
|
495
|
-
),
|
496
|
-
options=make_request_options(
|
497
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
498
|
-
),
|
499
|
-
cast_to=FileUploadResponse,
|
500
|
-
)
|
501
|
-
|
502
|
-
|
503
|
-
class ComponentResourceWithRawResponse:
|
504
|
-
def __init__(self, component: ComponentResource) -> None:
|
505
|
-
self._component = component
|
506
|
-
|
507
|
-
self.complete_upload = to_raw_response_wrapper(
|
508
|
-
component.complete_upload,
|
509
|
-
)
|
510
|
-
self.get_presigned_url = to_raw_response_wrapper(
|
511
|
-
component.get_presigned_url,
|
512
|
-
)
|
513
|
-
self.upload_file = to_raw_response_wrapper(
|
514
|
-
component.upload_file,
|
515
|
-
)
|
516
|
-
self.upload_url = to_raw_response_wrapper(
|
517
|
-
component.upload_url,
|
518
|
-
)
|
519
|
-
|
520
|
-
|
521
|
-
class AsyncComponentResourceWithRawResponse:
|
522
|
-
def __init__(self, component: AsyncComponentResource) -> None:
|
523
|
-
self._component = component
|
524
|
-
|
525
|
-
self.complete_upload = async_to_raw_response_wrapper(
|
526
|
-
component.complete_upload,
|
527
|
-
)
|
528
|
-
self.get_presigned_url = async_to_raw_response_wrapper(
|
529
|
-
component.get_presigned_url,
|
530
|
-
)
|
531
|
-
self.upload_file = async_to_raw_response_wrapper(
|
532
|
-
component.upload_file,
|
533
|
-
)
|
534
|
-
self.upload_url = async_to_raw_response_wrapper(
|
535
|
-
component.upload_url,
|
536
|
-
)
|
537
|
-
|
538
|
-
|
539
|
-
class ComponentResourceWithStreamingResponse:
|
540
|
-
def __init__(self, component: ComponentResource) -> None:
|
541
|
-
self._component = component
|
542
|
-
|
543
|
-
self.complete_upload = to_streamed_response_wrapper(
|
544
|
-
component.complete_upload,
|
545
|
-
)
|
546
|
-
self.get_presigned_url = to_streamed_response_wrapper(
|
547
|
-
component.get_presigned_url,
|
548
|
-
)
|
549
|
-
self.upload_file = to_streamed_response_wrapper(
|
550
|
-
component.upload_file,
|
551
|
-
)
|
552
|
-
self.upload_url = to_streamed_response_wrapper(
|
553
|
-
component.upload_url,
|
554
|
-
)
|
555
|
-
|
556
|
-
|
557
|
-
class AsyncComponentResourceWithStreamingResponse:
|
558
|
-
def __init__(self, component: AsyncComponentResource) -> None:
|
559
|
-
self._component = component
|
560
|
-
|
561
|
-
self.complete_upload = async_to_streamed_response_wrapper(
|
562
|
-
component.complete_upload,
|
563
|
-
)
|
564
|
-
self.get_presigned_url = async_to_streamed_response_wrapper(
|
565
|
-
component.get_presigned_url,
|
566
|
-
)
|
567
|
-
self.upload_file = async_to_streamed_response_wrapper(
|
568
|
-
component.upload_file,
|
569
|
-
)
|
570
|
-
self.upload_url = async_to_streamed_response_wrapper(
|
571
|
-
component.upload_url,
|
572
|
-
)
|