studyfetch-sdk 0.1.0a1__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/__init__.py +100 -0
- studyfetch_sdk/_base_client.py +1992 -0
- studyfetch_sdk/_client.py +403 -0
- studyfetch_sdk/_compat.py +219 -0
- studyfetch_sdk/_constants.py +14 -0
- studyfetch_sdk/_exceptions.py +108 -0
- studyfetch_sdk/_files.py +123 -0
- studyfetch_sdk/_models.py +808 -0
- studyfetch_sdk/_qs.py +150 -0
- studyfetch_sdk/_resource.py +43 -0
- studyfetch_sdk/_response.py +832 -0
- studyfetch_sdk/_streaming.py +333 -0
- studyfetch_sdk/_types.py +219 -0
- studyfetch_sdk/_utils/__init__.py +57 -0
- studyfetch_sdk/_utils/_logs.py +25 -0
- studyfetch_sdk/_utils/_proxy.py +65 -0
- studyfetch_sdk/_utils/_reflection.py +42 -0
- studyfetch_sdk/_utils/_resources_proxy.py +24 -0
- studyfetch_sdk/_utils/_streams.py +12 -0
- studyfetch_sdk/_utils/_sync.py +86 -0
- studyfetch_sdk/_utils/_transform.py +447 -0
- studyfetch_sdk/_utils/_typing.py +151 -0
- studyfetch_sdk/_utils/_utils.py +422 -0
- studyfetch_sdk/_version.py +4 -0
- studyfetch_sdk/lib/.keep +4 -0
- studyfetch_sdk/py.typed +0 -0
- studyfetch_sdk/resources/__init__.py +19 -0
- studyfetch_sdk/resources/v1/__init__.py +215 -0
- studyfetch_sdk/resources/v1/audio_recaps/__init__.py +33 -0
- studyfetch_sdk/resources/v1/audio_recaps/audio_recaps.py +328 -0
- studyfetch_sdk/resources/v1/audio_recaps/sections.py +250 -0
- studyfetch_sdk/resources/v1/auth/__init__.py +61 -0
- studyfetch_sdk/resources/v1/auth/auth.py +620 -0
- studyfetch_sdk/resources/v1/auth/login.py +374 -0
- studyfetch_sdk/resources/v1/auth/number_2fa.py +457 -0
- studyfetch_sdk/resources/v1/auth/organization_invites.py +160 -0
- studyfetch_sdk/resources/v1/chat/__init__.py +47 -0
- studyfetch_sdk/resources/v1/chat/chat.py +576 -0
- studyfetch_sdk/resources/v1/chat/sessions.py +222 -0
- studyfetch_sdk/resources/v1/chat/test.py +190 -0
- studyfetch_sdk/resources/v1/components.py +943 -0
- studyfetch_sdk/resources/v1/embed/__init__.py +33 -0
- studyfetch_sdk/resources/v1/embed/component.py +278 -0
- studyfetch_sdk/resources/v1/embed/embed.py +346 -0
- studyfetch_sdk/resources/v1/explainers.py +216 -0
- studyfetch_sdk/resources/v1/flashcards.py +783 -0
- studyfetch_sdk/resources/v1/folders.py +744 -0
- studyfetch_sdk/resources/v1/materials/__init__.py +61 -0
- studyfetch_sdk/resources/v1/materials/bulk.py +134 -0
- studyfetch_sdk/resources/v1/materials/materials.py +1029 -0
- studyfetch_sdk/resources/v1/materials/test.py +290 -0
- studyfetch_sdk/resources/v1/materials/upload.py +410 -0
- studyfetch_sdk/resources/v1/organizations/__init__.py +103 -0
- studyfetch_sdk/resources/v1/organizations/api_keys.py +260 -0
- studyfetch_sdk/resources/v1/organizations/logo/__init__.py +33 -0
- studyfetch_sdk/resources/v1/organizations/logo/logo.py +166 -0
- studyfetch_sdk/resources/v1/organizations/logo/upload.py +184 -0
- studyfetch_sdk/resources/v1/organizations/organizations.py +428 -0
- studyfetch_sdk/resources/v1/organizations/profile/__init__.py +47 -0
- studyfetch_sdk/resources/v1/organizations/profile/models.py +134 -0
- studyfetch_sdk/resources/v1/organizations/profile/profile.py +248 -0
- studyfetch_sdk/resources/v1/organizations/profile/team.py +462 -0
- studyfetch_sdk/resources/v1/organizations/team/__init__.py +33 -0
- studyfetch_sdk/resources/v1/organizations/team/invite.py +236 -0
- studyfetch_sdk/resources/v1/organizations/team/team.py +564 -0
- studyfetch_sdk/resources/v1/organizations/theme.py +184 -0
- studyfetch_sdk/resources/v1/organizations/usage.py +160 -0
- studyfetch_sdk/resources/v1/scenarios/__init__.py +61 -0
- studyfetch_sdk/resources/v1/scenarios/component.py +330 -0
- studyfetch_sdk/resources/v1/scenarios/scenarios.py +708 -0
- studyfetch_sdk/resources/v1/scenarios/sessions.py +236 -0
- studyfetch_sdk/resources/v1/scenarios/submissions/__init__.py +33 -0
- studyfetch_sdk/resources/v1/scenarios/submissions/submissions.py +102 -0
- studyfetch_sdk/resources/v1/scenarios/submissions/user.py +210 -0
- studyfetch_sdk/resources/v1/tests/__init__.py +33 -0
- studyfetch_sdk/resources/v1/tests/component.py +160 -0
- studyfetch_sdk/resources/v1/tests/tests.py +682 -0
- studyfetch_sdk/resources/v1/upload/__init__.py +33 -0
- studyfetch_sdk/resources/v1/upload/component.py +388 -0
- studyfetch_sdk/resources/v1/upload/upload.py +102 -0
- studyfetch_sdk/resources/v1/usage.py +1126 -0
- studyfetch_sdk/resources/v1/v1.py +518 -0
- studyfetch_sdk/types/__init__.py +3 -0
- studyfetch_sdk/types/v1/__init__.py +52 -0
- studyfetch_sdk/types/v1/admin/__init__.py +3 -0
- studyfetch_sdk/types/v1/admin/organizations/__init__.py +3 -0
- studyfetch_sdk/types/v1/admin/organizations/models/__init__.py +3 -0
- studyfetch_sdk/types/v1/audio_recaps/__init__.py +3 -0
- studyfetch_sdk/types/v1/auth/__init__.py +13 -0
- studyfetch_sdk/types/v1/auth/login_authenticate_params.py +15 -0
- studyfetch_sdk/types/v1/auth/login_verify_2fa_params.py +15 -0
- studyfetch_sdk/types/v1/auth/login_verify_backup_code_params.py +17 -0
- studyfetch_sdk/types/v1/auth/number_2fa_disable_params.py +12 -0
- studyfetch_sdk/types/v1/auth/number_2fa_enable_params.py +12 -0
- studyfetch_sdk/types/v1/auth/number_2fa_regenerate_backup_codes_params.py +12 -0
- studyfetch_sdk/types/v1/auth/number_2fa_send_code_params.py +12 -0
- studyfetch_sdk/types/v1/auth_register_new_user_params.py +23 -0
- studyfetch_sdk/types/v1/auth_request_password_reset_params.py +12 -0
- studyfetch_sdk/types/v1/auth_reset_password_params.py +17 -0
- studyfetch_sdk/types/v1/chat/__init__.py +5 -0
- studyfetch_sdk/types/v1/chat/session_retrieve_params.py +11 -0
- studyfetch_sdk/types/v1/chat_retrieve_session_params.py +13 -0
- studyfetch_sdk/types/v1/chat_send_message_params.py +54 -0
- studyfetch_sdk/types/v1/chat_stream_params.py +28 -0
- studyfetch_sdk/types/v1/component_create_params.py +29 -0
- studyfetch_sdk/types/v1/component_create_response.py +46 -0
- studyfetch_sdk/types/v1/component_embed_params.py +99 -0
- studyfetch_sdk/types/v1/component_embed_response.py +38 -0
- studyfetch_sdk/types/v1/component_list_params.py +14 -0
- studyfetch_sdk/types/v1/component_list_response.py +49 -0
- studyfetch_sdk/types/v1/component_retrieve_response.py +46 -0
- studyfetch_sdk/types/v1/component_update_params.py +12 -0
- studyfetch_sdk/types/v1/component_update_response.py +46 -0
- studyfetch_sdk/types/v1/embed/__init__.py +6 -0
- studyfetch_sdk/types/v1/embed/component_interact_params.py +14 -0
- studyfetch_sdk/types/v1/embed/component_retrieve_params.py +12 -0
- studyfetch_sdk/types/v1/embed_get_theme_params.py +12 -0
- studyfetch_sdk/types/v1/embed_verify_params.py +12 -0
- studyfetch_sdk/types/v1/explainer_handle_webhook_params.py +11 -0
- studyfetch_sdk/types/v1/flashcard_batch_process_params.py +36 -0
- studyfetch_sdk/types/v1/flashcard_batch_process_response.py +39 -0
- studyfetch_sdk/types/v1/flashcard_get_algorithm_info_response.py +37 -0
- studyfetch_sdk/types/v1/flashcard_get_all_params.py +23 -0
- studyfetch_sdk/types/v1/flashcard_get_due_params.py +19 -0
- studyfetch_sdk/types/v1/flashcard_get_stats_params.py +17 -0
- studyfetch_sdk/types/v1/flashcard_get_types_response.py +14 -0
- studyfetch_sdk/types/v1/flashcard_rate_params.py +23 -0
- studyfetch_sdk/types/v1/folder_create_params.py +17 -0
- studyfetch_sdk/types/v1/folder_list_params.py +14 -0
- studyfetch_sdk/types/v1/folder_update_params.py +17 -0
- studyfetch_sdk/types/v1/material_create_params.py +34 -0
- studyfetch_sdk/types/v1/material_create_response.py +62 -0
- studyfetch_sdk/types/v1/material_get_download_url_params.py +13 -0
- studyfetch_sdk/types/v1/material_list_params.py +14 -0
- studyfetch_sdk/types/v1/material_list_response.py +65 -0
- studyfetch_sdk/types/v1/material_retrieve_response.py +62 -0
- studyfetch_sdk/types/v1/materials/__init__.py +8 -0
- studyfetch_sdk/types/v1/materials/upload_upload_file_params.py +20 -0
- studyfetch_sdk/types/v1/materials/upload_upload_file_response.py +62 -0
- studyfetch_sdk/types/v1/materials/upload_upload_from_url_params.py +20 -0
- studyfetch_sdk/types/v1/materials/upload_upload_from_url_response.py +62 -0
- studyfetch_sdk/types/v1/organizations/__init__.py +3 -0
- studyfetch_sdk/types/v1/organizations/logo/__init__.py +3 -0
- studyfetch_sdk/types/v1/organizations/profile/__init__.py +3 -0
- studyfetch_sdk/types/v1/organizations/team/__init__.py +3 -0
- studyfetch_sdk/types/v1/scenario_create_params.py +11 -0
- studyfetch_sdk/types/v1/scenario_update_params.py +11 -0
- studyfetch_sdk/types/v1/scenarios/__init__.py +5 -0
- studyfetch_sdk/types/v1/scenarios/component_update_params.py +11 -0
- studyfetch_sdk/types/v1/scenarios/submissions/__init__.py +3 -0
- studyfetch_sdk/types/v1/test_create_params.py +20 -0
- studyfetch_sdk/types/v1/test_retake_params.py +14 -0
- studyfetch_sdk/types/v1/test_submit_answer_params.py +20 -0
- studyfetch_sdk/types/v1/test_submit_params.py +14 -0
- studyfetch_sdk/types/v1/tests/__init__.py +3 -0
- studyfetch_sdk/types/v1/upload/__init__.py +3 -0
- studyfetch_sdk/types/v1/usage_get_stats_params.py +23 -0
- studyfetch_sdk/types/v1/usage_get_summary_params.py +23 -0
- studyfetch_sdk/types/v1/usage_list_events_params.py +61 -0
- studyfetch_sdk/types/v1/usage_track_chat_params.py +54 -0
- studyfetch_sdk/types/v1/usage_track_event_params.py +128 -0
- studyfetch_sdk-0.1.0a1.dist-info/METADATA +453 -0
- studyfetch_sdk-0.1.0a1.dist-info/RECORD +165 -0
- studyfetch_sdk-0.1.0a1.dist-info/WHEEL +4 -0
- studyfetch_sdk-0.1.0a1.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,290 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
import httpx
|
6
|
+
|
7
|
+
from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
|
8
|
+
from ...._compat import cached_property
|
9
|
+
from ...._resource import SyncAPIResource, AsyncAPIResource
|
10
|
+
from ...._response import (
|
11
|
+
to_raw_response_wrapper,
|
12
|
+
to_streamed_response_wrapper,
|
13
|
+
async_to_raw_response_wrapper,
|
14
|
+
async_to_streamed_response_wrapper,
|
15
|
+
)
|
16
|
+
from ...._base_client import make_request_options
|
17
|
+
|
18
|
+
__all__ = ["TestResource", "AsyncTestResource"]
|
19
|
+
|
20
|
+
|
21
|
+
class TestResource(SyncAPIResource):
|
22
|
+
__test__ = False
|
23
|
+
|
24
|
+
@cached_property
|
25
|
+
def with_raw_response(self) -> TestResourceWithRawResponse:
|
26
|
+
"""
|
27
|
+
This property can be used as a prefix for any HTTP method call to return
|
28
|
+
the raw response object instead of the parsed content.
|
29
|
+
|
30
|
+
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#accessing-raw-response-data-eg-headers
|
31
|
+
"""
|
32
|
+
return TestResourceWithRawResponse(self)
|
33
|
+
|
34
|
+
@cached_property
|
35
|
+
def with_streaming_response(self) -> TestResourceWithStreamingResponse:
|
36
|
+
"""
|
37
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
38
|
+
|
39
|
+
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#with_streaming_response
|
40
|
+
"""
|
41
|
+
return TestResourceWithStreamingResponse(self)
|
42
|
+
|
43
|
+
def perform_ocr(
|
44
|
+
self,
|
45
|
+
*,
|
46
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
47
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
48
|
+
extra_headers: Headers | None = None,
|
49
|
+
extra_query: Query | None = None,
|
50
|
+
extra_body: Body | None = None,
|
51
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
52
|
+
) -> None:
|
53
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
54
|
+
return self._post(
|
55
|
+
"/api/v1/materials/test/ocr",
|
56
|
+
options=make_request_options(
|
57
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
58
|
+
),
|
59
|
+
cast_to=NoneType,
|
60
|
+
)
|
61
|
+
|
62
|
+
def process_epub(
|
63
|
+
self,
|
64
|
+
*,
|
65
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
66
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
67
|
+
extra_headers: Headers | None = None,
|
68
|
+
extra_query: Query | None = None,
|
69
|
+
extra_body: Body | None = None,
|
70
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
71
|
+
) -> None:
|
72
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
73
|
+
return self._post(
|
74
|
+
"/api/v1/materials/test/epub-processing",
|
75
|
+
options=make_request_options(
|
76
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
77
|
+
),
|
78
|
+
cast_to=NoneType,
|
79
|
+
)
|
80
|
+
|
81
|
+
def process_image(
|
82
|
+
self,
|
83
|
+
*,
|
84
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
85
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
86
|
+
extra_headers: Headers | None = None,
|
87
|
+
extra_query: Query | None = None,
|
88
|
+
extra_body: Body | None = None,
|
89
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
90
|
+
) -> None:
|
91
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
92
|
+
return self._post(
|
93
|
+
"/api/v1/materials/test/image-processing",
|
94
|
+
options=make_request_options(
|
95
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
96
|
+
),
|
97
|
+
cast_to=NoneType,
|
98
|
+
)
|
99
|
+
|
100
|
+
def process_video(
|
101
|
+
self,
|
102
|
+
*,
|
103
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
104
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
105
|
+
extra_headers: Headers | None = None,
|
106
|
+
extra_query: Query | None = None,
|
107
|
+
extra_body: Body | None = None,
|
108
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
109
|
+
) -> None:
|
110
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
111
|
+
return self._post(
|
112
|
+
"/api/v1/materials/test/video-processing",
|
113
|
+
options=make_request_options(
|
114
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
115
|
+
),
|
116
|
+
cast_to=NoneType,
|
117
|
+
)
|
118
|
+
|
119
|
+
|
120
|
+
class AsyncTestResource(AsyncAPIResource):
|
121
|
+
@cached_property
|
122
|
+
def with_raw_response(self) -> AsyncTestResourceWithRawResponse:
|
123
|
+
"""
|
124
|
+
This property can be used as a prefix for any HTTP method call to return
|
125
|
+
the raw response object instead of the parsed content.
|
126
|
+
|
127
|
+
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#accessing-raw-response-data-eg-headers
|
128
|
+
"""
|
129
|
+
return AsyncTestResourceWithRawResponse(self)
|
130
|
+
|
131
|
+
@cached_property
|
132
|
+
def with_streaming_response(self) -> AsyncTestResourceWithStreamingResponse:
|
133
|
+
"""
|
134
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
135
|
+
|
136
|
+
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#with_streaming_response
|
137
|
+
"""
|
138
|
+
return AsyncTestResourceWithStreamingResponse(self)
|
139
|
+
|
140
|
+
async def perform_ocr(
|
141
|
+
self,
|
142
|
+
*,
|
143
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
144
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
145
|
+
extra_headers: Headers | None = None,
|
146
|
+
extra_query: Query | None = None,
|
147
|
+
extra_body: Body | None = None,
|
148
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
149
|
+
) -> None:
|
150
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
151
|
+
return await self._post(
|
152
|
+
"/api/v1/materials/test/ocr",
|
153
|
+
options=make_request_options(
|
154
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
155
|
+
),
|
156
|
+
cast_to=NoneType,
|
157
|
+
)
|
158
|
+
|
159
|
+
async def process_epub(
|
160
|
+
self,
|
161
|
+
*,
|
162
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
163
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
164
|
+
extra_headers: Headers | None = None,
|
165
|
+
extra_query: Query | None = None,
|
166
|
+
extra_body: Body | None = None,
|
167
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
168
|
+
) -> None:
|
169
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
170
|
+
return await self._post(
|
171
|
+
"/api/v1/materials/test/epub-processing",
|
172
|
+
options=make_request_options(
|
173
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
174
|
+
),
|
175
|
+
cast_to=NoneType,
|
176
|
+
)
|
177
|
+
|
178
|
+
async def process_image(
|
179
|
+
self,
|
180
|
+
*,
|
181
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
182
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
183
|
+
extra_headers: Headers | None = None,
|
184
|
+
extra_query: Query | None = None,
|
185
|
+
extra_body: Body | None = None,
|
186
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
187
|
+
) -> None:
|
188
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
189
|
+
return await self._post(
|
190
|
+
"/api/v1/materials/test/image-processing",
|
191
|
+
options=make_request_options(
|
192
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
193
|
+
),
|
194
|
+
cast_to=NoneType,
|
195
|
+
)
|
196
|
+
|
197
|
+
async def process_video(
|
198
|
+
self,
|
199
|
+
*,
|
200
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
201
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
202
|
+
extra_headers: Headers | None = None,
|
203
|
+
extra_query: Query | None = None,
|
204
|
+
extra_body: Body | None = None,
|
205
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
206
|
+
) -> None:
|
207
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
208
|
+
return await self._post(
|
209
|
+
"/api/v1/materials/test/video-processing",
|
210
|
+
options=make_request_options(
|
211
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
212
|
+
),
|
213
|
+
cast_to=NoneType,
|
214
|
+
)
|
215
|
+
|
216
|
+
|
217
|
+
class TestResourceWithRawResponse:
|
218
|
+
__test__ = False
|
219
|
+
|
220
|
+
def __init__(self, test: TestResource) -> None:
|
221
|
+
self._test = test
|
222
|
+
|
223
|
+
self.perform_ocr = to_raw_response_wrapper(
|
224
|
+
test.perform_ocr,
|
225
|
+
)
|
226
|
+
self.process_epub = to_raw_response_wrapper(
|
227
|
+
test.process_epub,
|
228
|
+
)
|
229
|
+
self.process_image = to_raw_response_wrapper(
|
230
|
+
test.process_image,
|
231
|
+
)
|
232
|
+
self.process_video = to_raw_response_wrapper(
|
233
|
+
test.process_video,
|
234
|
+
)
|
235
|
+
|
236
|
+
|
237
|
+
class AsyncTestResourceWithRawResponse:
|
238
|
+
def __init__(self, test: AsyncTestResource) -> None:
|
239
|
+
self._test = test
|
240
|
+
|
241
|
+
self.perform_ocr = async_to_raw_response_wrapper(
|
242
|
+
test.perform_ocr,
|
243
|
+
)
|
244
|
+
self.process_epub = async_to_raw_response_wrapper(
|
245
|
+
test.process_epub,
|
246
|
+
)
|
247
|
+
self.process_image = async_to_raw_response_wrapper(
|
248
|
+
test.process_image,
|
249
|
+
)
|
250
|
+
self.process_video = async_to_raw_response_wrapper(
|
251
|
+
test.process_video,
|
252
|
+
)
|
253
|
+
|
254
|
+
|
255
|
+
class TestResourceWithStreamingResponse:
|
256
|
+
__test__ = False
|
257
|
+
|
258
|
+
def __init__(self, test: TestResource) -> None:
|
259
|
+
self._test = test
|
260
|
+
|
261
|
+
self.perform_ocr = to_streamed_response_wrapper(
|
262
|
+
test.perform_ocr,
|
263
|
+
)
|
264
|
+
self.process_epub = to_streamed_response_wrapper(
|
265
|
+
test.process_epub,
|
266
|
+
)
|
267
|
+
self.process_image = to_streamed_response_wrapper(
|
268
|
+
test.process_image,
|
269
|
+
)
|
270
|
+
self.process_video = to_streamed_response_wrapper(
|
271
|
+
test.process_video,
|
272
|
+
)
|
273
|
+
|
274
|
+
|
275
|
+
class AsyncTestResourceWithStreamingResponse:
|
276
|
+
def __init__(self, test: AsyncTestResource) -> None:
|
277
|
+
self._test = test
|
278
|
+
|
279
|
+
self.perform_ocr = async_to_streamed_response_wrapper(
|
280
|
+
test.perform_ocr,
|
281
|
+
)
|
282
|
+
self.process_epub = async_to_streamed_response_wrapper(
|
283
|
+
test.process_epub,
|
284
|
+
)
|
285
|
+
self.process_image = async_to_streamed_response_wrapper(
|
286
|
+
test.process_image,
|
287
|
+
)
|
288
|
+
self.process_video = async_to_streamed_response_wrapper(
|
289
|
+
test.process_video,
|
290
|
+
)
|
@@ -0,0 +1,410 @@
|
|
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, NoneType, 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.materials import upload_upload_file_params, upload_upload_from_url_params
|
21
|
+
from ....types.v1.materials.upload_upload_file_response import UploadUploadFileResponse
|
22
|
+
from ....types.v1.materials.upload_upload_from_url_response import UploadUploadFromURLResponse
|
23
|
+
|
24
|
+
__all__ = ["UploadResource", "AsyncUploadResource"]
|
25
|
+
|
26
|
+
|
27
|
+
class UploadResource(SyncAPIResource):
|
28
|
+
@cached_property
|
29
|
+
def with_raw_response(self) -> UploadResourceWithRawResponse:
|
30
|
+
"""
|
31
|
+
This property can be used as a prefix for any HTTP method call to return
|
32
|
+
the raw response object instead of the parsed content.
|
33
|
+
|
34
|
+
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#accessing-raw-response-data-eg-headers
|
35
|
+
"""
|
36
|
+
return UploadResourceWithRawResponse(self)
|
37
|
+
|
38
|
+
@cached_property
|
39
|
+
def with_streaming_response(self) -> UploadResourceWithStreamingResponse:
|
40
|
+
"""
|
41
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
42
|
+
|
43
|
+
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#with_streaming_response
|
44
|
+
"""
|
45
|
+
return UploadResourceWithStreamingResponse(self)
|
46
|
+
|
47
|
+
def complete_upload(
|
48
|
+
self,
|
49
|
+
*,
|
50
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
51
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
52
|
+
extra_headers: Headers | None = None,
|
53
|
+
extra_query: Query | None = None,
|
54
|
+
extra_body: Body | None = None,
|
55
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
56
|
+
) -> None:
|
57
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
58
|
+
return self._post(
|
59
|
+
"/api/v1/materials/upload/complete",
|
60
|
+
options=make_request_options(
|
61
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
62
|
+
),
|
63
|
+
cast_to=NoneType,
|
64
|
+
)
|
65
|
+
|
66
|
+
def get_presigned_url(
|
67
|
+
self,
|
68
|
+
*,
|
69
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
70
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
71
|
+
extra_headers: Headers | None = None,
|
72
|
+
extra_query: Query | None = None,
|
73
|
+
extra_body: Body | None = None,
|
74
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
75
|
+
) -> None:
|
76
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
77
|
+
return self._post(
|
78
|
+
"/api/v1/materials/upload/presigned-url",
|
79
|
+
options=make_request_options(
|
80
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
81
|
+
),
|
82
|
+
cast_to=NoneType,
|
83
|
+
)
|
84
|
+
|
85
|
+
def upload_file(
|
86
|
+
self,
|
87
|
+
*,
|
88
|
+
file: FileTypes,
|
89
|
+
name: str,
|
90
|
+
folder_id: str | NotGiven = NOT_GIVEN,
|
91
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
92
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
93
|
+
extra_headers: Headers | None = None,
|
94
|
+
extra_query: Query | None = None,
|
95
|
+
extra_body: Body | None = None,
|
96
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
97
|
+
) -> UploadUploadFileResponse:
|
98
|
+
"""
|
99
|
+
Upload a material file
|
100
|
+
|
101
|
+
Args:
|
102
|
+
name: Material name
|
103
|
+
|
104
|
+
folder_id: Folder ID (optional)
|
105
|
+
|
106
|
+
extra_headers: Send extra headers
|
107
|
+
|
108
|
+
extra_query: Add additional query parameters to the request
|
109
|
+
|
110
|
+
extra_body: Add additional JSON properties to the request
|
111
|
+
|
112
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
113
|
+
"""
|
114
|
+
body = deepcopy_minimal(
|
115
|
+
{
|
116
|
+
"file": file,
|
117
|
+
"name": name,
|
118
|
+
"folder_id": folder_id,
|
119
|
+
}
|
120
|
+
)
|
121
|
+
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
|
122
|
+
# It should be noted that the actual Content-Type header that will be
|
123
|
+
# sent to the server will contain a `boundary` parameter, e.g.
|
124
|
+
# multipart/form-data; boundary=---abc--
|
125
|
+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
126
|
+
return self._post(
|
127
|
+
"/api/v1/materials/upload",
|
128
|
+
body=maybe_transform(body, upload_upload_file_params.UploadUploadFileParams),
|
129
|
+
files=files,
|
130
|
+
options=make_request_options(
|
131
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
132
|
+
),
|
133
|
+
cast_to=UploadUploadFileResponse,
|
134
|
+
)
|
135
|
+
|
136
|
+
def upload_from_url(
|
137
|
+
self,
|
138
|
+
*,
|
139
|
+
name: str,
|
140
|
+
url: str,
|
141
|
+
folder_id: str | NotGiven = NOT_GIVEN,
|
142
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
143
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
144
|
+
extra_headers: Headers | None = None,
|
145
|
+
extra_query: Query | None = None,
|
146
|
+
extra_body: Body | None = None,
|
147
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
148
|
+
) -> UploadUploadFromURLResponse:
|
149
|
+
"""
|
150
|
+
Upload material from URL
|
151
|
+
|
152
|
+
Args:
|
153
|
+
name: Material name
|
154
|
+
|
155
|
+
url: URL to fetch content from
|
156
|
+
|
157
|
+
folder_id: Folder ID (optional)
|
158
|
+
|
159
|
+
extra_headers: Send extra headers
|
160
|
+
|
161
|
+
extra_query: Add additional query parameters to the request
|
162
|
+
|
163
|
+
extra_body: Add additional JSON properties to the request
|
164
|
+
|
165
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
166
|
+
"""
|
167
|
+
return self._post(
|
168
|
+
"/api/v1/materials/upload/url",
|
169
|
+
body=maybe_transform(
|
170
|
+
{
|
171
|
+
"name": name,
|
172
|
+
"url": url,
|
173
|
+
"folder_id": folder_id,
|
174
|
+
},
|
175
|
+
upload_upload_from_url_params.UploadUploadFromURLParams,
|
176
|
+
),
|
177
|
+
options=make_request_options(
|
178
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
179
|
+
),
|
180
|
+
cast_to=UploadUploadFromURLResponse,
|
181
|
+
)
|
182
|
+
|
183
|
+
|
184
|
+
class AsyncUploadResource(AsyncAPIResource):
|
185
|
+
@cached_property
|
186
|
+
def with_raw_response(self) -> AsyncUploadResourceWithRawResponse:
|
187
|
+
"""
|
188
|
+
This property can be used as a prefix for any HTTP method call to return
|
189
|
+
the raw response object instead of the parsed content.
|
190
|
+
|
191
|
+
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#accessing-raw-response-data-eg-headers
|
192
|
+
"""
|
193
|
+
return AsyncUploadResourceWithRawResponse(self)
|
194
|
+
|
195
|
+
@cached_property
|
196
|
+
def with_streaming_response(self) -> AsyncUploadResourceWithStreamingResponse:
|
197
|
+
"""
|
198
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
199
|
+
|
200
|
+
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#with_streaming_response
|
201
|
+
"""
|
202
|
+
return AsyncUploadResourceWithStreamingResponse(self)
|
203
|
+
|
204
|
+
async def complete_upload(
|
205
|
+
self,
|
206
|
+
*,
|
207
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
208
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
209
|
+
extra_headers: Headers | None = None,
|
210
|
+
extra_query: Query | None = None,
|
211
|
+
extra_body: Body | None = None,
|
212
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
213
|
+
) -> None:
|
214
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
215
|
+
return await self._post(
|
216
|
+
"/api/v1/materials/upload/complete",
|
217
|
+
options=make_request_options(
|
218
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
219
|
+
),
|
220
|
+
cast_to=NoneType,
|
221
|
+
)
|
222
|
+
|
223
|
+
async def get_presigned_url(
|
224
|
+
self,
|
225
|
+
*,
|
226
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
227
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
228
|
+
extra_headers: Headers | None = None,
|
229
|
+
extra_query: Query | None = None,
|
230
|
+
extra_body: Body | None = None,
|
231
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
232
|
+
) -> None:
|
233
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
234
|
+
return await self._post(
|
235
|
+
"/api/v1/materials/upload/presigned-url",
|
236
|
+
options=make_request_options(
|
237
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
238
|
+
),
|
239
|
+
cast_to=NoneType,
|
240
|
+
)
|
241
|
+
|
242
|
+
async def upload_file(
|
243
|
+
self,
|
244
|
+
*,
|
245
|
+
file: FileTypes,
|
246
|
+
name: str,
|
247
|
+
folder_id: str | NotGiven = NOT_GIVEN,
|
248
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
249
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
250
|
+
extra_headers: Headers | None = None,
|
251
|
+
extra_query: Query | None = None,
|
252
|
+
extra_body: Body | None = None,
|
253
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
254
|
+
) -> UploadUploadFileResponse:
|
255
|
+
"""
|
256
|
+
Upload a material file
|
257
|
+
|
258
|
+
Args:
|
259
|
+
name: Material name
|
260
|
+
|
261
|
+
folder_id: Folder ID (optional)
|
262
|
+
|
263
|
+
extra_headers: Send extra headers
|
264
|
+
|
265
|
+
extra_query: Add additional query parameters to the request
|
266
|
+
|
267
|
+
extra_body: Add additional JSON properties to the request
|
268
|
+
|
269
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
270
|
+
"""
|
271
|
+
body = deepcopy_minimal(
|
272
|
+
{
|
273
|
+
"file": file,
|
274
|
+
"name": name,
|
275
|
+
"folder_id": folder_id,
|
276
|
+
}
|
277
|
+
)
|
278
|
+
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
|
279
|
+
# It should be noted that the actual Content-Type header that will be
|
280
|
+
# sent to the server will contain a `boundary` parameter, e.g.
|
281
|
+
# multipart/form-data; boundary=---abc--
|
282
|
+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
283
|
+
return await self._post(
|
284
|
+
"/api/v1/materials/upload",
|
285
|
+
body=await async_maybe_transform(body, upload_upload_file_params.UploadUploadFileParams),
|
286
|
+
files=files,
|
287
|
+
options=make_request_options(
|
288
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
289
|
+
),
|
290
|
+
cast_to=UploadUploadFileResponse,
|
291
|
+
)
|
292
|
+
|
293
|
+
async def upload_from_url(
|
294
|
+
self,
|
295
|
+
*,
|
296
|
+
name: str,
|
297
|
+
url: str,
|
298
|
+
folder_id: str | NotGiven = NOT_GIVEN,
|
299
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
300
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
301
|
+
extra_headers: Headers | None = None,
|
302
|
+
extra_query: Query | None = None,
|
303
|
+
extra_body: Body | None = None,
|
304
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
305
|
+
) -> UploadUploadFromURLResponse:
|
306
|
+
"""
|
307
|
+
Upload material from URL
|
308
|
+
|
309
|
+
Args:
|
310
|
+
name: Material name
|
311
|
+
|
312
|
+
url: URL to fetch content from
|
313
|
+
|
314
|
+
folder_id: Folder ID (optional)
|
315
|
+
|
316
|
+
extra_headers: Send extra headers
|
317
|
+
|
318
|
+
extra_query: Add additional query parameters to the request
|
319
|
+
|
320
|
+
extra_body: Add additional JSON properties to the request
|
321
|
+
|
322
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
323
|
+
"""
|
324
|
+
return await self._post(
|
325
|
+
"/api/v1/materials/upload/url",
|
326
|
+
body=await async_maybe_transform(
|
327
|
+
{
|
328
|
+
"name": name,
|
329
|
+
"url": url,
|
330
|
+
"folder_id": folder_id,
|
331
|
+
},
|
332
|
+
upload_upload_from_url_params.UploadUploadFromURLParams,
|
333
|
+
),
|
334
|
+
options=make_request_options(
|
335
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
336
|
+
),
|
337
|
+
cast_to=UploadUploadFromURLResponse,
|
338
|
+
)
|
339
|
+
|
340
|
+
|
341
|
+
class UploadResourceWithRawResponse:
|
342
|
+
def __init__(self, upload: UploadResource) -> None:
|
343
|
+
self._upload = upload
|
344
|
+
|
345
|
+
self.complete_upload = to_raw_response_wrapper(
|
346
|
+
upload.complete_upload,
|
347
|
+
)
|
348
|
+
self.get_presigned_url = to_raw_response_wrapper(
|
349
|
+
upload.get_presigned_url,
|
350
|
+
)
|
351
|
+
self.upload_file = to_raw_response_wrapper(
|
352
|
+
upload.upload_file,
|
353
|
+
)
|
354
|
+
self.upload_from_url = to_raw_response_wrapper(
|
355
|
+
upload.upload_from_url,
|
356
|
+
)
|
357
|
+
|
358
|
+
|
359
|
+
class AsyncUploadResourceWithRawResponse:
|
360
|
+
def __init__(self, upload: AsyncUploadResource) -> None:
|
361
|
+
self._upload = upload
|
362
|
+
|
363
|
+
self.complete_upload = async_to_raw_response_wrapper(
|
364
|
+
upload.complete_upload,
|
365
|
+
)
|
366
|
+
self.get_presigned_url = async_to_raw_response_wrapper(
|
367
|
+
upload.get_presigned_url,
|
368
|
+
)
|
369
|
+
self.upload_file = async_to_raw_response_wrapper(
|
370
|
+
upload.upload_file,
|
371
|
+
)
|
372
|
+
self.upload_from_url = async_to_raw_response_wrapper(
|
373
|
+
upload.upload_from_url,
|
374
|
+
)
|
375
|
+
|
376
|
+
|
377
|
+
class UploadResourceWithStreamingResponse:
|
378
|
+
def __init__(self, upload: UploadResource) -> None:
|
379
|
+
self._upload = upload
|
380
|
+
|
381
|
+
self.complete_upload = to_streamed_response_wrapper(
|
382
|
+
upload.complete_upload,
|
383
|
+
)
|
384
|
+
self.get_presigned_url = to_streamed_response_wrapper(
|
385
|
+
upload.get_presigned_url,
|
386
|
+
)
|
387
|
+
self.upload_file = to_streamed_response_wrapper(
|
388
|
+
upload.upload_file,
|
389
|
+
)
|
390
|
+
self.upload_from_url = to_streamed_response_wrapper(
|
391
|
+
upload.upload_from_url,
|
392
|
+
)
|
393
|
+
|
394
|
+
|
395
|
+
class AsyncUploadResourceWithStreamingResponse:
|
396
|
+
def __init__(self, upload: AsyncUploadResource) -> None:
|
397
|
+
self._upload = upload
|
398
|
+
|
399
|
+
self.complete_upload = async_to_streamed_response_wrapper(
|
400
|
+
upload.complete_upload,
|
401
|
+
)
|
402
|
+
self.get_presigned_url = async_to_streamed_response_wrapper(
|
403
|
+
upload.get_presigned_url,
|
404
|
+
)
|
405
|
+
self.upload_file = async_to_streamed_response_wrapper(
|
406
|
+
upload.upload_file,
|
407
|
+
)
|
408
|
+
self.upload_from_url = async_to_streamed_response_wrapper(
|
409
|
+
upload.upload_from_url,
|
410
|
+
)
|