studyfetch-sdk 0.1.0a18__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/materials.py +130 -2
- studyfetch_sdk/resources/v1/materials/upload.py +262 -0
- studyfetch_sdk/resources/v1/usage/analyst.py +143 -15
- studyfetch_sdk/resources/v1/v1.py +98 -0
- studyfetch_sdk/types/v1/__init__.py +5 -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_create_and_process_params.py +27 -0
- studyfetch_sdk/types/v1/material_create_params.py +4 -17
- studyfetch_sdk/types/v1/materials/__init__.py +2 -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.0a18.dist-info → studyfetch_sdk-0.1.0a19.dist-info}/METADATA +1 -1
- {studyfetch_sdk-0.1.0a18.dist-info → studyfetch_sdk-0.1.0a19.dist-info}/RECORD +38 -22
- {studyfetch_sdk-0.1.0a18.dist-info → studyfetch_sdk-0.1.0a19.dist-info}/WHEEL +0 -0
- {studyfetch_sdk-0.1.0a18.dist-info → studyfetch_sdk-0.1.0a19.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,222 @@
|
|
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 ...._utils import maybe_transform, async_maybe_transform
|
9
|
+
from ...._compat import cached_property
|
10
|
+
from ...._resource import SyncAPIResource, AsyncAPIResource
|
11
|
+
from ...._response import (
|
12
|
+
to_raw_response_wrapper,
|
13
|
+
to_streamed_response_wrapper,
|
14
|
+
async_to_raw_response_wrapper,
|
15
|
+
async_to_streamed_response_wrapper,
|
16
|
+
)
|
17
|
+
from ...._base_client import make_request_options
|
18
|
+
from ....types.v1.data_analyst import session_retrieve_params
|
19
|
+
|
20
|
+
__all__ = ["SessionsResource", "AsyncSessionsResource"]
|
21
|
+
|
22
|
+
|
23
|
+
class SessionsResource(SyncAPIResource):
|
24
|
+
@cached_property
|
25
|
+
def with_raw_response(self) -> SessionsResourceWithRawResponse:
|
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 SessionsResourceWithRawResponse(self)
|
33
|
+
|
34
|
+
@cached_property
|
35
|
+
def with_streaming_response(self) -> SessionsResourceWithStreamingResponse:
|
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 SessionsResourceWithStreamingResponse(self)
|
42
|
+
|
43
|
+
def create(
|
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/data-analyst/sessions/create",
|
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 retrieve(
|
63
|
+
self,
|
64
|
+
user_id: str,
|
65
|
+
*,
|
66
|
+
limit: str,
|
67
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
68
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
69
|
+
extra_headers: Headers | None = None,
|
70
|
+
extra_query: Query | None = None,
|
71
|
+
extra_body: Body | None = None,
|
72
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
73
|
+
) -> None:
|
74
|
+
"""
|
75
|
+
Args:
|
76
|
+
extra_headers: Send extra headers
|
77
|
+
|
78
|
+
extra_query: Add additional query parameters to the request
|
79
|
+
|
80
|
+
extra_body: Add additional JSON properties to the request
|
81
|
+
|
82
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
83
|
+
"""
|
84
|
+
if not user_id:
|
85
|
+
raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}")
|
86
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
87
|
+
return self._get(
|
88
|
+
f"/api/v1/data-analyst/sessions/{user_id}",
|
89
|
+
options=make_request_options(
|
90
|
+
extra_headers=extra_headers,
|
91
|
+
extra_query=extra_query,
|
92
|
+
extra_body=extra_body,
|
93
|
+
timeout=timeout,
|
94
|
+
query=maybe_transform({"limit": limit}, session_retrieve_params.SessionRetrieveParams),
|
95
|
+
),
|
96
|
+
cast_to=NoneType,
|
97
|
+
)
|
98
|
+
|
99
|
+
|
100
|
+
class AsyncSessionsResource(AsyncAPIResource):
|
101
|
+
@cached_property
|
102
|
+
def with_raw_response(self) -> AsyncSessionsResourceWithRawResponse:
|
103
|
+
"""
|
104
|
+
This property can be used as a prefix for any HTTP method call to return
|
105
|
+
the raw response object instead of the parsed content.
|
106
|
+
|
107
|
+
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#accessing-raw-response-data-eg-headers
|
108
|
+
"""
|
109
|
+
return AsyncSessionsResourceWithRawResponse(self)
|
110
|
+
|
111
|
+
@cached_property
|
112
|
+
def with_streaming_response(self) -> AsyncSessionsResourceWithStreamingResponse:
|
113
|
+
"""
|
114
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
115
|
+
|
116
|
+
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#with_streaming_response
|
117
|
+
"""
|
118
|
+
return AsyncSessionsResourceWithStreamingResponse(self)
|
119
|
+
|
120
|
+
async def create(
|
121
|
+
self,
|
122
|
+
*,
|
123
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
124
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
125
|
+
extra_headers: Headers | None = None,
|
126
|
+
extra_query: Query | None = None,
|
127
|
+
extra_body: Body | None = None,
|
128
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
129
|
+
) -> None:
|
130
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
131
|
+
return await self._post(
|
132
|
+
"/api/v1/data-analyst/sessions/create",
|
133
|
+
options=make_request_options(
|
134
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
135
|
+
),
|
136
|
+
cast_to=NoneType,
|
137
|
+
)
|
138
|
+
|
139
|
+
async def retrieve(
|
140
|
+
self,
|
141
|
+
user_id: str,
|
142
|
+
*,
|
143
|
+
limit: str,
|
144
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
145
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
146
|
+
extra_headers: Headers | None = None,
|
147
|
+
extra_query: Query | None = None,
|
148
|
+
extra_body: Body | None = None,
|
149
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
150
|
+
) -> None:
|
151
|
+
"""
|
152
|
+
Args:
|
153
|
+
extra_headers: Send extra headers
|
154
|
+
|
155
|
+
extra_query: Add additional query parameters to the request
|
156
|
+
|
157
|
+
extra_body: Add additional JSON properties to the request
|
158
|
+
|
159
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
160
|
+
"""
|
161
|
+
if not user_id:
|
162
|
+
raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}")
|
163
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
164
|
+
return await self._get(
|
165
|
+
f"/api/v1/data-analyst/sessions/{user_id}",
|
166
|
+
options=make_request_options(
|
167
|
+
extra_headers=extra_headers,
|
168
|
+
extra_query=extra_query,
|
169
|
+
extra_body=extra_body,
|
170
|
+
timeout=timeout,
|
171
|
+
query=await async_maybe_transform({"limit": limit}, session_retrieve_params.SessionRetrieveParams),
|
172
|
+
),
|
173
|
+
cast_to=NoneType,
|
174
|
+
)
|
175
|
+
|
176
|
+
|
177
|
+
class SessionsResourceWithRawResponse:
|
178
|
+
def __init__(self, sessions: SessionsResource) -> None:
|
179
|
+
self._sessions = sessions
|
180
|
+
|
181
|
+
self.create = to_raw_response_wrapper(
|
182
|
+
sessions.create,
|
183
|
+
)
|
184
|
+
self.retrieve = to_raw_response_wrapper(
|
185
|
+
sessions.retrieve,
|
186
|
+
)
|
187
|
+
|
188
|
+
|
189
|
+
class AsyncSessionsResourceWithRawResponse:
|
190
|
+
def __init__(self, sessions: AsyncSessionsResource) -> None:
|
191
|
+
self._sessions = sessions
|
192
|
+
|
193
|
+
self.create = async_to_raw_response_wrapper(
|
194
|
+
sessions.create,
|
195
|
+
)
|
196
|
+
self.retrieve = async_to_raw_response_wrapper(
|
197
|
+
sessions.retrieve,
|
198
|
+
)
|
199
|
+
|
200
|
+
|
201
|
+
class SessionsResourceWithStreamingResponse:
|
202
|
+
def __init__(self, sessions: SessionsResource) -> None:
|
203
|
+
self._sessions = sessions
|
204
|
+
|
205
|
+
self.create = to_streamed_response_wrapper(
|
206
|
+
sessions.create,
|
207
|
+
)
|
208
|
+
self.retrieve = to_streamed_response_wrapper(
|
209
|
+
sessions.retrieve,
|
210
|
+
)
|
211
|
+
|
212
|
+
|
213
|
+
class AsyncSessionsResourceWithStreamingResponse:
|
214
|
+
def __init__(self, sessions: AsyncSessionsResource) -> None:
|
215
|
+
self._sessions = sessions
|
216
|
+
|
217
|
+
self.create = async_to_streamed_response_wrapper(
|
218
|
+
sessions.create,
|
219
|
+
)
|
220
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
221
|
+
sessions.retrieve,
|
222
|
+
)
|
@@ -0,0 +1,190 @@
|
|
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 upload_image(
|
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/data-analyst/test/image",
|
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 upload_image_citation(
|
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/data-analyst/test/image-citation",
|
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
|
+
|
82
|
+
class AsyncTestResource(AsyncAPIResource):
|
83
|
+
@cached_property
|
84
|
+
def with_raw_response(self) -> AsyncTestResourceWithRawResponse:
|
85
|
+
"""
|
86
|
+
This property can be used as a prefix for any HTTP method call to return
|
87
|
+
the raw response object instead of the parsed content.
|
88
|
+
|
89
|
+
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#accessing-raw-response-data-eg-headers
|
90
|
+
"""
|
91
|
+
return AsyncTestResourceWithRawResponse(self)
|
92
|
+
|
93
|
+
@cached_property
|
94
|
+
def with_streaming_response(self) -> AsyncTestResourceWithStreamingResponse:
|
95
|
+
"""
|
96
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
97
|
+
|
98
|
+
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#with_streaming_response
|
99
|
+
"""
|
100
|
+
return AsyncTestResourceWithStreamingResponse(self)
|
101
|
+
|
102
|
+
async def upload_image(
|
103
|
+
self,
|
104
|
+
*,
|
105
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
106
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
107
|
+
extra_headers: Headers | None = None,
|
108
|
+
extra_query: Query | None = None,
|
109
|
+
extra_body: Body | None = None,
|
110
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
111
|
+
) -> None:
|
112
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
113
|
+
return await self._post(
|
114
|
+
"/api/v1/data-analyst/test/image",
|
115
|
+
options=make_request_options(
|
116
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
117
|
+
),
|
118
|
+
cast_to=NoneType,
|
119
|
+
)
|
120
|
+
|
121
|
+
async def upload_image_citation(
|
122
|
+
self,
|
123
|
+
*,
|
124
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
125
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
126
|
+
extra_headers: Headers | None = None,
|
127
|
+
extra_query: Query | None = None,
|
128
|
+
extra_body: Body | None = None,
|
129
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
130
|
+
) -> None:
|
131
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
132
|
+
return await self._post(
|
133
|
+
"/api/v1/data-analyst/test/image-citation",
|
134
|
+
options=make_request_options(
|
135
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
136
|
+
),
|
137
|
+
cast_to=NoneType,
|
138
|
+
)
|
139
|
+
|
140
|
+
|
141
|
+
class TestResourceWithRawResponse:
|
142
|
+
__test__ = False
|
143
|
+
|
144
|
+
def __init__(self, test: TestResource) -> None:
|
145
|
+
self._test = test
|
146
|
+
|
147
|
+
self.upload_image = to_raw_response_wrapper(
|
148
|
+
test.upload_image,
|
149
|
+
)
|
150
|
+
self.upload_image_citation = to_raw_response_wrapper(
|
151
|
+
test.upload_image_citation,
|
152
|
+
)
|
153
|
+
|
154
|
+
|
155
|
+
class AsyncTestResourceWithRawResponse:
|
156
|
+
def __init__(self, test: AsyncTestResource) -> None:
|
157
|
+
self._test = test
|
158
|
+
|
159
|
+
self.upload_image = async_to_raw_response_wrapper(
|
160
|
+
test.upload_image,
|
161
|
+
)
|
162
|
+
self.upload_image_citation = async_to_raw_response_wrapper(
|
163
|
+
test.upload_image_citation,
|
164
|
+
)
|
165
|
+
|
166
|
+
|
167
|
+
class TestResourceWithStreamingResponse:
|
168
|
+
__test__ = False
|
169
|
+
|
170
|
+
def __init__(self, test: TestResource) -> None:
|
171
|
+
self._test = test
|
172
|
+
|
173
|
+
self.upload_image = to_streamed_response_wrapper(
|
174
|
+
test.upload_image,
|
175
|
+
)
|
176
|
+
self.upload_image_citation = to_streamed_response_wrapper(
|
177
|
+
test.upload_image_citation,
|
178
|
+
)
|
179
|
+
|
180
|
+
|
181
|
+
class AsyncTestResourceWithStreamingResponse:
|
182
|
+
def __init__(self, test: AsyncTestResource) -> None:
|
183
|
+
self._test = test
|
184
|
+
|
185
|
+
self.upload_image = async_to_streamed_response_wrapper(
|
186
|
+
test.upload_image,
|
187
|
+
)
|
188
|
+
self.upload_image_citation = async_to_streamed_response_wrapper(
|
189
|
+
test.upload_image_citation,
|
190
|
+
)
|
@@ -41,6 +41,7 @@ from ....types.v1 import (
|
|
41
41
|
material_search_params,
|
42
42
|
material_batch_create_params,
|
43
43
|
material_get_download_url_params,
|
44
|
+
material_create_and_process_params,
|
44
45
|
)
|
45
46
|
from ...._resource import SyncAPIResource, AsyncAPIResource
|
46
47
|
from ...._response import (
|
@@ -51,6 +52,7 @@ from ...._response import (
|
|
51
52
|
)
|
52
53
|
from ...._base_client import make_request_options
|
53
54
|
from ....types.v1.material import Material
|
55
|
+
from ....types.v1.content_param import ContentParam
|
54
56
|
from ....types.v1.material_list_response import MaterialListResponse
|
55
57
|
from ....types.v1.material_debug_response import MaterialDebugResponse
|
56
58
|
from ....types.v1.material_search_response import MaterialSearchResponse
|
@@ -95,7 +97,7 @@ class MaterialsResource(SyncAPIResource):
|
|
95
97
|
def create(
|
96
98
|
self,
|
97
99
|
*,
|
98
|
-
content:
|
100
|
+
content: ContentParam,
|
99
101
|
name: str,
|
100
102
|
folder_id: str | NotGiven = NOT_GIVEN,
|
101
103
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
@@ -277,6 +279,63 @@ class MaterialsResource(SyncAPIResource):
|
|
277
279
|
cast_to=MaterialBatchCreateResponse,
|
278
280
|
)
|
279
281
|
|
282
|
+
def create_and_process(
|
283
|
+
self,
|
284
|
+
*,
|
285
|
+
content: ContentParam,
|
286
|
+
name: str,
|
287
|
+
folder_id: str | NotGiven = NOT_GIVEN,
|
288
|
+
poll_interval_ms: float | NotGiven = NOT_GIVEN,
|
289
|
+
timeout_ms: float | NotGiven = NOT_GIVEN,
|
290
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
291
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
292
|
+
extra_headers: Headers | None = None,
|
293
|
+
extra_query: Query | None = None,
|
294
|
+
extra_body: Body | None = None,
|
295
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
296
|
+
) -> Material:
|
297
|
+
"""Creates a material and waits for processing to finish before returning.
|
298
|
+
|
299
|
+
Useful
|
300
|
+
for synchronous API usage.
|
301
|
+
|
302
|
+
Args:
|
303
|
+
content: Content details
|
304
|
+
|
305
|
+
name: Name of the material
|
306
|
+
|
307
|
+
folder_id: Folder ID to place the material in
|
308
|
+
|
309
|
+
poll_interval_ms: Polling interval in milliseconds (default: 2 seconds)
|
310
|
+
|
311
|
+
timeout_ms: Maximum time to wait for processing in milliseconds (default: 5 minutes)
|
312
|
+
|
313
|
+
extra_headers: Send extra headers
|
314
|
+
|
315
|
+
extra_query: Add additional query parameters to the request
|
316
|
+
|
317
|
+
extra_body: Add additional JSON properties to the request
|
318
|
+
|
319
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
320
|
+
"""
|
321
|
+
return self._post(
|
322
|
+
"/api/v1/materials/upload-and-process",
|
323
|
+
body=maybe_transform(
|
324
|
+
{
|
325
|
+
"content": content,
|
326
|
+
"name": name,
|
327
|
+
"folder_id": folder_id,
|
328
|
+
"poll_interval_ms": poll_interval_ms,
|
329
|
+
"timeout_ms": timeout_ms,
|
330
|
+
},
|
331
|
+
material_create_and_process_params.MaterialCreateAndProcessParams,
|
332
|
+
),
|
333
|
+
options=make_request_options(
|
334
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
335
|
+
),
|
336
|
+
cast_to=Material,
|
337
|
+
)
|
338
|
+
|
280
339
|
def debug(
|
281
340
|
self,
|
282
341
|
id: str,
|
@@ -546,7 +605,7 @@ class AsyncMaterialsResource(AsyncAPIResource):
|
|
546
605
|
async def create(
|
547
606
|
self,
|
548
607
|
*,
|
549
|
-
content:
|
608
|
+
content: ContentParam,
|
550
609
|
name: str,
|
551
610
|
folder_id: str | NotGiven = NOT_GIVEN,
|
552
611
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
@@ -730,6 +789,63 @@ class AsyncMaterialsResource(AsyncAPIResource):
|
|
730
789
|
cast_to=MaterialBatchCreateResponse,
|
731
790
|
)
|
732
791
|
|
792
|
+
async def create_and_process(
|
793
|
+
self,
|
794
|
+
*,
|
795
|
+
content: ContentParam,
|
796
|
+
name: str,
|
797
|
+
folder_id: str | NotGiven = NOT_GIVEN,
|
798
|
+
poll_interval_ms: float | NotGiven = NOT_GIVEN,
|
799
|
+
timeout_ms: float | NotGiven = NOT_GIVEN,
|
800
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
801
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
802
|
+
extra_headers: Headers | None = None,
|
803
|
+
extra_query: Query | None = None,
|
804
|
+
extra_body: Body | None = None,
|
805
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
806
|
+
) -> Material:
|
807
|
+
"""Creates a material and waits for processing to finish before returning.
|
808
|
+
|
809
|
+
Useful
|
810
|
+
for synchronous API usage.
|
811
|
+
|
812
|
+
Args:
|
813
|
+
content: Content details
|
814
|
+
|
815
|
+
name: Name of the material
|
816
|
+
|
817
|
+
folder_id: Folder ID to place the material in
|
818
|
+
|
819
|
+
poll_interval_ms: Polling interval in milliseconds (default: 2 seconds)
|
820
|
+
|
821
|
+
timeout_ms: Maximum time to wait for processing in milliseconds (default: 5 minutes)
|
822
|
+
|
823
|
+
extra_headers: Send extra headers
|
824
|
+
|
825
|
+
extra_query: Add additional query parameters to the request
|
826
|
+
|
827
|
+
extra_body: Add additional JSON properties to the request
|
828
|
+
|
829
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
830
|
+
"""
|
831
|
+
return await self._post(
|
832
|
+
"/api/v1/materials/upload-and-process",
|
833
|
+
body=await async_maybe_transform(
|
834
|
+
{
|
835
|
+
"content": content,
|
836
|
+
"name": name,
|
837
|
+
"folder_id": folder_id,
|
838
|
+
"poll_interval_ms": poll_interval_ms,
|
839
|
+
"timeout_ms": timeout_ms,
|
840
|
+
},
|
841
|
+
material_create_and_process_params.MaterialCreateAndProcessParams,
|
842
|
+
),
|
843
|
+
options=make_request_options(
|
844
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
845
|
+
),
|
846
|
+
cast_to=Material,
|
847
|
+
)
|
848
|
+
|
733
849
|
async def debug(
|
734
850
|
self,
|
735
851
|
id: str,
|
@@ -983,6 +1099,9 @@ class MaterialsResourceWithRawResponse:
|
|
983
1099
|
self.batch_create = to_raw_response_wrapper(
|
984
1100
|
materials.batch_create,
|
985
1101
|
)
|
1102
|
+
self.create_and_process = to_raw_response_wrapper(
|
1103
|
+
materials.create_and_process,
|
1104
|
+
)
|
986
1105
|
self.debug = to_raw_response_wrapper(
|
987
1106
|
materials.debug,
|
988
1107
|
)
|
@@ -1034,6 +1153,9 @@ class AsyncMaterialsResourceWithRawResponse:
|
|
1034
1153
|
self.batch_create = async_to_raw_response_wrapper(
|
1035
1154
|
materials.batch_create,
|
1036
1155
|
)
|
1156
|
+
self.create_and_process = async_to_raw_response_wrapper(
|
1157
|
+
materials.create_and_process,
|
1158
|
+
)
|
1037
1159
|
self.debug = async_to_raw_response_wrapper(
|
1038
1160
|
materials.debug,
|
1039
1161
|
)
|
@@ -1085,6 +1207,9 @@ class MaterialsResourceWithStreamingResponse:
|
|
1085
1207
|
self.batch_create = to_streamed_response_wrapper(
|
1086
1208
|
materials.batch_create,
|
1087
1209
|
)
|
1210
|
+
self.create_and_process = to_streamed_response_wrapper(
|
1211
|
+
materials.create_and_process,
|
1212
|
+
)
|
1088
1213
|
self.debug = to_streamed_response_wrapper(
|
1089
1214
|
materials.debug,
|
1090
1215
|
)
|
@@ -1136,6 +1261,9 @@ class AsyncMaterialsResourceWithStreamingResponse:
|
|
1136
1261
|
self.batch_create = async_to_streamed_response_wrapper(
|
1137
1262
|
materials.batch_create,
|
1138
1263
|
)
|
1264
|
+
self.create_and_process = async_to_streamed_response_wrapper(
|
1265
|
+
materials.create_and_process,
|
1266
|
+
)
|
1139
1267
|
self.debug = async_to_streamed_response_wrapper(
|
1140
1268
|
materials.debug,
|
1141
1269
|
)
|