arbi 0.1.0__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.
Potentially problematic release.
This version of arbi might be problematic. Click here for more details.
- arbi/__init__.py +90 -0
- arbi/_base_client.py +1995 -0
- arbi/_client.py +394 -0
- arbi/_compat.py +219 -0
- arbi/_constants.py +14 -0
- arbi/_exceptions.py +108 -0
- arbi/_files.py +123 -0
- arbi/_models.py +829 -0
- arbi/_qs.py +150 -0
- arbi/_resource.py +43 -0
- arbi/_response.py +830 -0
- arbi/_streaming.py +333 -0
- arbi/_types.py +219 -0
- arbi/_utils/__init__.py +57 -0
- arbi/_utils/_logs.py +25 -0
- arbi/_utils/_proxy.py +65 -0
- arbi/_utils/_reflection.py +42 -0
- arbi/_utils/_resources_proxy.py +24 -0
- arbi/_utils/_streams.py +12 -0
- arbi/_utils/_sync.py +86 -0
- arbi/_utils/_transform.py +447 -0
- arbi/_utils/_typing.py +151 -0
- arbi/_utils/_utils.py +422 -0
- arbi/_version.py +4 -0
- arbi/lib/.keep +4 -0
- arbi/py.typed +0 -0
- arbi/resources/__init__.py +19 -0
- arbi/resources/api/__init__.py +145 -0
- arbi/resources/api/api.py +422 -0
- arbi/resources/api/assistant.py +300 -0
- arbi/resources/api/configs.py +499 -0
- arbi/resources/api/conversation/__init__.py +33 -0
- arbi/resources/api/conversation/conversation.py +555 -0
- arbi/resources/api/conversation/user.py +270 -0
- arbi/resources/api/document/__init__.py +33 -0
- arbi/resources/api/document/annotation.py +384 -0
- arbi/resources/api/document/document.py +873 -0
- arbi/resources/api/health.py +304 -0
- arbi/resources/api/sso.py +333 -0
- arbi/resources/api/tag.py +614 -0
- arbi/resources/api/user/__init__.py +33 -0
- arbi/resources/api/user/settings.py +251 -0
- arbi/resources/api/user/user.py +532 -0
- arbi/resources/api/workspace.py +1061 -0
- arbi/types/__init__.py +8 -0
- arbi/types/api/__init__.py +84 -0
- arbi/types/api/assistant_query_params.py +59 -0
- arbi/types/api/assistant_retrieve_params.py +59 -0
- arbi/types/api/chunker_config_param.py +9 -0
- arbi/types/api/config_create_params.py +45 -0
- arbi/types/api/config_create_response.py +15 -0
- arbi/types/api/config_delete_response.py +11 -0
- arbi/types/api/config_get_versions_response.py +19 -0
- arbi/types/api/config_retrieve_response.py +46 -0
- arbi/types/api/conversation/__init__.py +8 -0
- arbi/types/api/conversation/user_add_params.py +11 -0
- arbi/types/api/conversation/user_add_response.py +11 -0
- arbi/types/api/conversation/user_remove_params.py +11 -0
- arbi/types/api/conversation/user_remove_response.py +11 -0
- arbi/types/api/conversation_delete_message_response.py +11 -0
- arbi/types/api/conversation_delete_response.py +11 -0
- arbi/types/api/conversation_retrieve_threads_response.py +91 -0
- arbi/types/api/conversation_share_response.py +11 -0
- arbi/types/api/conversation_update_title_params.py +12 -0
- arbi/types/api/conversation_update_title_response.py +13 -0
- arbi/types/api/doc_response.py +48 -0
- arbi/types/api/document/__init__.py +8 -0
- arbi/types/api/document/annotation_create_params.py +16 -0
- arbi/types/api/document/annotation_delete_response.py +11 -0
- arbi/types/api/document/annotation_update_params.py +16 -0
- arbi/types/api/document/doc_tag_response.py +26 -0
- arbi/types/api/document_date_extractor_llm_config.py +29 -0
- arbi/types/api/document_date_extractor_llm_config_param.py +28 -0
- arbi/types/api/document_delete_response.py +11 -0
- arbi/types/api/document_get_parsed_response.py +26 -0
- arbi/types/api/document_get_tags_response.py +10 -0
- arbi/types/api/document_update_params.py +19 -0
- arbi/types/api/document_update_response.py +22 -0
- arbi/types/api/document_upload_params.py +23 -0
- arbi/types/api/document_view_params.py +13 -0
- arbi/types/api/embedder_config.py +18 -0
- arbi/types/api/embedder_config_param.py +17 -0
- arbi/types/api/health_check_app_response.py +9 -0
- arbi/types/api/health_check_models_response.py +21 -0
- arbi/types/api/health_check_services_response.py +23 -0
- arbi/types/api/health_get_models_response.py +19 -0
- arbi/types/api/model_citation_config.py +23 -0
- arbi/types/api/model_citation_config_param.py +23 -0
- arbi/types/api/parser_config_param.py +9 -0
- arbi/types/api/query_llm_config.py +30 -0
- arbi/types/api/query_llm_config_param.py +29 -0
- arbi/types/api/reranker_config.py +21 -0
- arbi/types/api/reranker_config_param.py +20 -0
- arbi/types/api/retriever_config.py +23 -0
- arbi/types/api/retriever_config_param.py +23 -0
- arbi/types/api/sso_invite_params.py +11 -0
- arbi/types/api/sso_invite_response.py +11 -0
- arbi/types/api/sso_login_params.py +16 -0
- arbi/types/api/sso_login_response.py +15 -0
- arbi/types/api/sso_rotate_passcode_response.py +11 -0
- arbi/types/api/tag_apply_to_docs_params.py +12 -0
- arbi/types/api/tag_apply_to_docs_response.py +13 -0
- arbi/types/api/tag_create_params.py +18 -0
- arbi/types/api/tag_create_response.py +11 -0
- arbi/types/api/tag_delete_response.py +9 -0
- arbi/types/api/tag_get_docs_response.py +10 -0
- arbi/types/api/tag_remove_from_docs_params.py +12 -0
- arbi/types/api/tag_remove_from_docs_response.py +13 -0
- arbi/types/api/tag_update_params.py +14 -0
- arbi/types/api/tag_update_response.py +17 -0
- arbi/types/api/title_llm_config.py +29 -0
- arbi/types/api/title_llm_config_param.py +28 -0
- arbi/types/api/token.py +13 -0
- arbi/types/api/user/__init__.py +6 -0
- arbi/types/api/user/setting_retrieve_response.py +36 -0
- arbi/types/api/user/setting_update_params.py +24 -0
- arbi/types/api/user_list_workspaces_response.py +10 -0
- arbi/types/api/user_login_params.py +13 -0
- arbi/types/api/user_logout_response.py +9 -0
- arbi/types/api/user_register_params.py +17 -0
- arbi/types/api/user_response.py +19 -0
- arbi/types/api/workspace_create_protected_params.py +14 -0
- arbi/types/api/workspace_delete_response.py +9 -0
- arbi/types/api/workspace_get_conversations_response.py +28 -0
- arbi/types/api/workspace_get_doctags_response.py +10 -0
- arbi/types/api/workspace_get_documents_response.py +10 -0
- arbi/types/api/workspace_get_stats_response.py +13 -0
- arbi/types/api/workspace_get_tags_response.py +30 -0
- arbi/types/api/workspace_get_users_response.py +17 -0
- arbi/types/api/workspace_remove_user_params.py +11 -0
- arbi/types/api/workspace_remove_user_response.py +11 -0
- arbi/types/api/workspace_response.py +24 -0
- arbi/types/api/workspace_share_params.py +11 -0
- arbi/types/api/workspace_share_response.py +21 -0
- arbi/types/api/workspace_update_params.py +14 -0
- arbi/types/chunk.py +12 -0
- arbi/types/chunk_metadata.py +31 -0
- arbi/types/chunk_metadata_param.py +32 -0
- arbi/types/chunk_param.py +15 -0
- arbi-0.1.0.dist-info/METADATA +410 -0
- arbi-0.1.0.dist-info/RECORD +143 -0
- arbi-0.1.0.dist-info/WHEEL +4 -0
- arbi-0.1.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,532 @@
|
|
|
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 .settings import (
|
|
8
|
+
SettingsResource,
|
|
9
|
+
AsyncSettingsResource,
|
|
10
|
+
SettingsResourceWithRawResponse,
|
|
11
|
+
AsyncSettingsResourceWithRawResponse,
|
|
12
|
+
SettingsResourceWithStreamingResponse,
|
|
13
|
+
AsyncSettingsResourceWithStreamingResponse,
|
|
14
|
+
)
|
|
15
|
+
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
16
|
+
from ...._utils import maybe_transform, async_maybe_transform
|
|
17
|
+
from ...._compat import cached_property
|
|
18
|
+
from ...._resource import SyncAPIResource, AsyncAPIResource
|
|
19
|
+
from ...._response import (
|
|
20
|
+
to_raw_response_wrapper,
|
|
21
|
+
to_streamed_response_wrapper,
|
|
22
|
+
async_to_raw_response_wrapper,
|
|
23
|
+
async_to_streamed_response_wrapper,
|
|
24
|
+
)
|
|
25
|
+
from ....types.api import user_login_params, user_register_params
|
|
26
|
+
from ...._base_client import make_request_options
|
|
27
|
+
from ....types.api.token import Token
|
|
28
|
+
from ....types.api.user_response import UserResponse
|
|
29
|
+
from ....types.api.user_logout_response import UserLogoutResponse
|
|
30
|
+
from ....types.api.user_list_workspaces_response import UserListWorkspacesResponse
|
|
31
|
+
|
|
32
|
+
__all__ = ["UserResource", "AsyncUserResource"]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class UserResource(SyncAPIResource):
|
|
36
|
+
@cached_property
|
|
37
|
+
def settings(self) -> SettingsResource:
|
|
38
|
+
return SettingsResource(self._client)
|
|
39
|
+
|
|
40
|
+
@cached_property
|
|
41
|
+
def with_raw_response(self) -> UserResourceWithRawResponse:
|
|
42
|
+
"""
|
|
43
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
44
|
+
the raw response object instead of the parsed content.
|
|
45
|
+
|
|
46
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#accessing-raw-response-data-eg-headers
|
|
47
|
+
"""
|
|
48
|
+
return UserResourceWithRawResponse(self)
|
|
49
|
+
|
|
50
|
+
@cached_property
|
|
51
|
+
def with_streaming_response(self) -> UserResourceWithStreamingResponse:
|
|
52
|
+
"""
|
|
53
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
54
|
+
|
|
55
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#with_streaming_response
|
|
56
|
+
"""
|
|
57
|
+
return UserResourceWithStreamingResponse(self)
|
|
58
|
+
|
|
59
|
+
def list_workspaces(
|
|
60
|
+
self,
|
|
61
|
+
*,
|
|
62
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
63
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
64
|
+
extra_headers: Headers | None = None,
|
|
65
|
+
extra_query: Query | None = None,
|
|
66
|
+
extra_body: Body | None = None,
|
|
67
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
68
|
+
) -> UserListWorkspacesResponse:
|
|
69
|
+
"""
|
|
70
|
+
Retrieve the list of workspaces associated with the current authenticated user.
|
|
71
|
+
Leverages RLS to enforce access control.
|
|
72
|
+
"""
|
|
73
|
+
return self._get(
|
|
74
|
+
"/api/user/workspaces",
|
|
75
|
+
options=make_request_options(
|
|
76
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
77
|
+
),
|
|
78
|
+
cast_to=UserListWorkspacesResponse,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
def login(
|
|
82
|
+
self,
|
|
83
|
+
*,
|
|
84
|
+
email: str,
|
|
85
|
+
password: str,
|
|
86
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
87
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
88
|
+
extra_headers: Headers | None = None,
|
|
89
|
+
extra_query: Query | None = None,
|
|
90
|
+
extra_body: Body | None = None,
|
|
91
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
92
|
+
) -> Token:
|
|
93
|
+
"""
|
|
94
|
+
Login a user and return a JWT token.
|
|
95
|
+
|
|
96
|
+
Args:
|
|
97
|
+
extra_headers: Send extra headers
|
|
98
|
+
|
|
99
|
+
extra_query: Add additional query parameters to the request
|
|
100
|
+
|
|
101
|
+
extra_body: Add additional JSON properties to the request
|
|
102
|
+
|
|
103
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
104
|
+
"""
|
|
105
|
+
return self._post(
|
|
106
|
+
"/api/user/login",
|
|
107
|
+
body=maybe_transform(
|
|
108
|
+
{
|
|
109
|
+
"email": email,
|
|
110
|
+
"password": password,
|
|
111
|
+
},
|
|
112
|
+
user_login_params.UserLoginParams,
|
|
113
|
+
),
|
|
114
|
+
options=make_request_options(
|
|
115
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
116
|
+
),
|
|
117
|
+
cast_to=Token,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
def logout(
|
|
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
|
+
) -> UserLogoutResponse:
|
|
130
|
+
"""Log out the current user by clearing cached keys and refresh token cookie."""
|
|
131
|
+
return self._post(
|
|
132
|
+
"/api/user/logout",
|
|
133
|
+
options=make_request_options(
|
|
134
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
135
|
+
),
|
|
136
|
+
cast_to=UserLogoutResponse,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
def refresh_token(
|
|
140
|
+
self,
|
|
141
|
+
*,
|
|
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
|
+
) -> Token:
|
|
149
|
+
"""Refresh an expired access token using the refresh token cookie.
|
|
150
|
+
|
|
151
|
+
Validates the
|
|
152
|
+
refresh token and issues a new access token.
|
|
153
|
+
"""
|
|
154
|
+
return self._post(
|
|
155
|
+
"/api/user/token_refresh",
|
|
156
|
+
options=make_request_options(
|
|
157
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
158
|
+
),
|
|
159
|
+
cast_to=Token,
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
def register(
|
|
163
|
+
self,
|
|
164
|
+
*,
|
|
165
|
+
email: str,
|
|
166
|
+
last_name: str,
|
|
167
|
+
name: str,
|
|
168
|
+
password: str,
|
|
169
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
170
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
171
|
+
extra_headers: Headers | None = None,
|
|
172
|
+
extra_query: Query | None = None,
|
|
173
|
+
extra_body: Body | None = None,
|
|
174
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
175
|
+
) -> UserResponse:
|
|
176
|
+
"""
|
|
177
|
+
Register a new user.
|
|
178
|
+
|
|
179
|
+
Args:
|
|
180
|
+
extra_headers: Send extra headers
|
|
181
|
+
|
|
182
|
+
extra_query: Add additional query parameters to the request
|
|
183
|
+
|
|
184
|
+
extra_body: Add additional JSON properties to the request
|
|
185
|
+
|
|
186
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
187
|
+
"""
|
|
188
|
+
return self._post(
|
|
189
|
+
"/api/user/register",
|
|
190
|
+
body=maybe_transform(
|
|
191
|
+
{
|
|
192
|
+
"email": email,
|
|
193
|
+
"last_name": last_name,
|
|
194
|
+
"name": name,
|
|
195
|
+
"password": password,
|
|
196
|
+
},
|
|
197
|
+
user_register_params.UserRegisterParams,
|
|
198
|
+
),
|
|
199
|
+
options=make_request_options(
|
|
200
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
201
|
+
),
|
|
202
|
+
cast_to=UserResponse,
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
def retrieve_me(
|
|
206
|
+
self,
|
|
207
|
+
*,
|
|
208
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
209
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
210
|
+
extra_headers: Headers | None = None,
|
|
211
|
+
extra_query: Query | None = None,
|
|
212
|
+
extra_body: Body | None = None,
|
|
213
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
214
|
+
) -> UserResponse:
|
|
215
|
+
"""Retrieve current authenticated user information.
|
|
216
|
+
|
|
217
|
+
This endpoint is useful for
|
|
218
|
+
validating tokens and checking authentication status.
|
|
219
|
+
"""
|
|
220
|
+
return self._get(
|
|
221
|
+
"/api/user/me",
|
|
222
|
+
options=make_request_options(
|
|
223
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
224
|
+
),
|
|
225
|
+
cast_to=UserResponse,
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
class AsyncUserResource(AsyncAPIResource):
|
|
230
|
+
@cached_property
|
|
231
|
+
def settings(self) -> AsyncSettingsResource:
|
|
232
|
+
return AsyncSettingsResource(self._client)
|
|
233
|
+
|
|
234
|
+
@cached_property
|
|
235
|
+
def with_raw_response(self) -> AsyncUserResourceWithRawResponse:
|
|
236
|
+
"""
|
|
237
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
238
|
+
the raw response object instead of the parsed content.
|
|
239
|
+
|
|
240
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#accessing-raw-response-data-eg-headers
|
|
241
|
+
"""
|
|
242
|
+
return AsyncUserResourceWithRawResponse(self)
|
|
243
|
+
|
|
244
|
+
@cached_property
|
|
245
|
+
def with_streaming_response(self) -> AsyncUserResourceWithStreamingResponse:
|
|
246
|
+
"""
|
|
247
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
248
|
+
|
|
249
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#with_streaming_response
|
|
250
|
+
"""
|
|
251
|
+
return AsyncUserResourceWithStreamingResponse(self)
|
|
252
|
+
|
|
253
|
+
async def list_workspaces(
|
|
254
|
+
self,
|
|
255
|
+
*,
|
|
256
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
257
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
258
|
+
extra_headers: Headers | None = None,
|
|
259
|
+
extra_query: Query | None = None,
|
|
260
|
+
extra_body: Body | None = None,
|
|
261
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
262
|
+
) -> UserListWorkspacesResponse:
|
|
263
|
+
"""
|
|
264
|
+
Retrieve the list of workspaces associated with the current authenticated user.
|
|
265
|
+
Leverages RLS to enforce access control.
|
|
266
|
+
"""
|
|
267
|
+
return await self._get(
|
|
268
|
+
"/api/user/workspaces",
|
|
269
|
+
options=make_request_options(
|
|
270
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
271
|
+
),
|
|
272
|
+
cast_to=UserListWorkspacesResponse,
|
|
273
|
+
)
|
|
274
|
+
|
|
275
|
+
async def login(
|
|
276
|
+
self,
|
|
277
|
+
*,
|
|
278
|
+
email: str,
|
|
279
|
+
password: str,
|
|
280
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
281
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
282
|
+
extra_headers: Headers | None = None,
|
|
283
|
+
extra_query: Query | None = None,
|
|
284
|
+
extra_body: Body | None = None,
|
|
285
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
286
|
+
) -> Token:
|
|
287
|
+
"""
|
|
288
|
+
Login a user and return a JWT token.
|
|
289
|
+
|
|
290
|
+
Args:
|
|
291
|
+
extra_headers: Send extra headers
|
|
292
|
+
|
|
293
|
+
extra_query: Add additional query parameters to the request
|
|
294
|
+
|
|
295
|
+
extra_body: Add additional JSON properties to the request
|
|
296
|
+
|
|
297
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
298
|
+
"""
|
|
299
|
+
return await self._post(
|
|
300
|
+
"/api/user/login",
|
|
301
|
+
body=await async_maybe_transform(
|
|
302
|
+
{
|
|
303
|
+
"email": email,
|
|
304
|
+
"password": password,
|
|
305
|
+
},
|
|
306
|
+
user_login_params.UserLoginParams,
|
|
307
|
+
),
|
|
308
|
+
options=make_request_options(
|
|
309
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
310
|
+
),
|
|
311
|
+
cast_to=Token,
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
async def logout(
|
|
315
|
+
self,
|
|
316
|
+
*,
|
|
317
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
318
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
319
|
+
extra_headers: Headers | None = None,
|
|
320
|
+
extra_query: Query | None = None,
|
|
321
|
+
extra_body: Body | None = None,
|
|
322
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
323
|
+
) -> UserLogoutResponse:
|
|
324
|
+
"""Log out the current user by clearing cached keys and refresh token cookie."""
|
|
325
|
+
return await self._post(
|
|
326
|
+
"/api/user/logout",
|
|
327
|
+
options=make_request_options(
|
|
328
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
329
|
+
),
|
|
330
|
+
cast_to=UserLogoutResponse,
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
async def refresh_token(
|
|
334
|
+
self,
|
|
335
|
+
*,
|
|
336
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
337
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
338
|
+
extra_headers: Headers | None = None,
|
|
339
|
+
extra_query: Query | None = None,
|
|
340
|
+
extra_body: Body | None = None,
|
|
341
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
342
|
+
) -> Token:
|
|
343
|
+
"""Refresh an expired access token using the refresh token cookie.
|
|
344
|
+
|
|
345
|
+
Validates the
|
|
346
|
+
refresh token and issues a new access token.
|
|
347
|
+
"""
|
|
348
|
+
return await self._post(
|
|
349
|
+
"/api/user/token_refresh",
|
|
350
|
+
options=make_request_options(
|
|
351
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
352
|
+
),
|
|
353
|
+
cast_to=Token,
|
|
354
|
+
)
|
|
355
|
+
|
|
356
|
+
async def register(
|
|
357
|
+
self,
|
|
358
|
+
*,
|
|
359
|
+
email: str,
|
|
360
|
+
last_name: str,
|
|
361
|
+
name: str,
|
|
362
|
+
password: str,
|
|
363
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
364
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
365
|
+
extra_headers: Headers | None = None,
|
|
366
|
+
extra_query: Query | None = None,
|
|
367
|
+
extra_body: Body | None = None,
|
|
368
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
369
|
+
) -> UserResponse:
|
|
370
|
+
"""
|
|
371
|
+
Register a new user.
|
|
372
|
+
|
|
373
|
+
Args:
|
|
374
|
+
extra_headers: Send extra headers
|
|
375
|
+
|
|
376
|
+
extra_query: Add additional query parameters to the request
|
|
377
|
+
|
|
378
|
+
extra_body: Add additional JSON properties to the request
|
|
379
|
+
|
|
380
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
381
|
+
"""
|
|
382
|
+
return await self._post(
|
|
383
|
+
"/api/user/register",
|
|
384
|
+
body=await async_maybe_transform(
|
|
385
|
+
{
|
|
386
|
+
"email": email,
|
|
387
|
+
"last_name": last_name,
|
|
388
|
+
"name": name,
|
|
389
|
+
"password": password,
|
|
390
|
+
},
|
|
391
|
+
user_register_params.UserRegisterParams,
|
|
392
|
+
),
|
|
393
|
+
options=make_request_options(
|
|
394
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
395
|
+
),
|
|
396
|
+
cast_to=UserResponse,
|
|
397
|
+
)
|
|
398
|
+
|
|
399
|
+
async def retrieve_me(
|
|
400
|
+
self,
|
|
401
|
+
*,
|
|
402
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
403
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
404
|
+
extra_headers: Headers | None = None,
|
|
405
|
+
extra_query: Query | None = None,
|
|
406
|
+
extra_body: Body | None = None,
|
|
407
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
408
|
+
) -> UserResponse:
|
|
409
|
+
"""Retrieve current authenticated user information.
|
|
410
|
+
|
|
411
|
+
This endpoint is useful for
|
|
412
|
+
validating tokens and checking authentication status.
|
|
413
|
+
"""
|
|
414
|
+
return await self._get(
|
|
415
|
+
"/api/user/me",
|
|
416
|
+
options=make_request_options(
|
|
417
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
418
|
+
),
|
|
419
|
+
cast_to=UserResponse,
|
|
420
|
+
)
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
class UserResourceWithRawResponse:
|
|
424
|
+
def __init__(self, user: UserResource) -> None:
|
|
425
|
+
self._user = user
|
|
426
|
+
|
|
427
|
+
self.list_workspaces = to_raw_response_wrapper(
|
|
428
|
+
user.list_workspaces,
|
|
429
|
+
)
|
|
430
|
+
self.login = to_raw_response_wrapper(
|
|
431
|
+
user.login,
|
|
432
|
+
)
|
|
433
|
+
self.logout = to_raw_response_wrapper(
|
|
434
|
+
user.logout,
|
|
435
|
+
)
|
|
436
|
+
self.refresh_token = to_raw_response_wrapper(
|
|
437
|
+
user.refresh_token,
|
|
438
|
+
)
|
|
439
|
+
self.register = to_raw_response_wrapper(
|
|
440
|
+
user.register,
|
|
441
|
+
)
|
|
442
|
+
self.retrieve_me = to_raw_response_wrapper(
|
|
443
|
+
user.retrieve_me,
|
|
444
|
+
)
|
|
445
|
+
|
|
446
|
+
@cached_property
|
|
447
|
+
def settings(self) -> SettingsResourceWithRawResponse:
|
|
448
|
+
return SettingsResourceWithRawResponse(self._user.settings)
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
class AsyncUserResourceWithRawResponse:
|
|
452
|
+
def __init__(self, user: AsyncUserResource) -> None:
|
|
453
|
+
self._user = user
|
|
454
|
+
|
|
455
|
+
self.list_workspaces = async_to_raw_response_wrapper(
|
|
456
|
+
user.list_workspaces,
|
|
457
|
+
)
|
|
458
|
+
self.login = async_to_raw_response_wrapper(
|
|
459
|
+
user.login,
|
|
460
|
+
)
|
|
461
|
+
self.logout = async_to_raw_response_wrapper(
|
|
462
|
+
user.logout,
|
|
463
|
+
)
|
|
464
|
+
self.refresh_token = async_to_raw_response_wrapper(
|
|
465
|
+
user.refresh_token,
|
|
466
|
+
)
|
|
467
|
+
self.register = async_to_raw_response_wrapper(
|
|
468
|
+
user.register,
|
|
469
|
+
)
|
|
470
|
+
self.retrieve_me = async_to_raw_response_wrapper(
|
|
471
|
+
user.retrieve_me,
|
|
472
|
+
)
|
|
473
|
+
|
|
474
|
+
@cached_property
|
|
475
|
+
def settings(self) -> AsyncSettingsResourceWithRawResponse:
|
|
476
|
+
return AsyncSettingsResourceWithRawResponse(self._user.settings)
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
class UserResourceWithStreamingResponse:
|
|
480
|
+
def __init__(self, user: UserResource) -> None:
|
|
481
|
+
self._user = user
|
|
482
|
+
|
|
483
|
+
self.list_workspaces = to_streamed_response_wrapper(
|
|
484
|
+
user.list_workspaces,
|
|
485
|
+
)
|
|
486
|
+
self.login = to_streamed_response_wrapper(
|
|
487
|
+
user.login,
|
|
488
|
+
)
|
|
489
|
+
self.logout = to_streamed_response_wrapper(
|
|
490
|
+
user.logout,
|
|
491
|
+
)
|
|
492
|
+
self.refresh_token = to_streamed_response_wrapper(
|
|
493
|
+
user.refresh_token,
|
|
494
|
+
)
|
|
495
|
+
self.register = to_streamed_response_wrapper(
|
|
496
|
+
user.register,
|
|
497
|
+
)
|
|
498
|
+
self.retrieve_me = to_streamed_response_wrapper(
|
|
499
|
+
user.retrieve_me,
|
|
500
|
+
)
|
|
501
|
+
|
|
502
|
+
@cached_property
|
|
503
|
+
def settings(self) -> SettingsResourceWithStreamingResponse:
|
|
504
|
+
return SettingsResourceWithStreamingResponse(self._user.settings)
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
class AsyncUserResourceWithStreamingResponse:
|
|
508
|
+
def __init__(self, user: AsyncUserResource) -> None:
|
|
509
|
+
self._user = user
|
|
510
|
+
|
|
511
|
+
self.list_workspaces = async_to_streamed_response_wrapper(
|
|
512
|
+
user.list_workspaces,
|
|
513
|
+
)
|
|
514
|
+
self.login = async_to_streamed_response_wrapper(
|
|
515
|
+
user.login,
|
|
516
|
+
)
|
|
517
|
+
self.logout = async_to_streamed_response_wrapper(
|
|
518
|
+
user.logout,
|
|
519
|
+
)
|
|
520
|
+
self.refresh_token = async_to_streamed_response_wrapper(
|
|
521
|
+
user.refresh_token,
|
|
522
|
+
)
|
|
523
|
+
self.register = async_to_streamed_response_wrapper(
|
|
524
|
+
user.register,
|
|
525
|
+
)
|
|
526
|
+
self.retrieve_me = async_to_streamed_response_wrapper(
|
|
527
|
+
user.retrieve_me,
|
|
528
|
+
)
|
|
529
|
+
|
|
530
|
+
@cached_property
|
|
531
|
+
def settings(self) -> AsyncSettingsResourceWithStreamingResponse:
|
|
532
|
+
return AsyncSettingsResourceWithStreamingResponse(self._user.settings)
|