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,1061 @@
|
|
|
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 Optional
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
10
|
+
from ..._utils import maybe_transform, 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 ...types.api import (
|
|
20
|
+
workspace_share_params,
|
|
21
|
+
workspace_update_params,
|
|
22
|
+
workspace_remove_user_params,
|
|
23
|
+
workspace_create_protected_params,
|
|
24
|
+
)
|
|
25
|
+
from ..._base_client import make_request_options
|
|
26
|
+
from ...types.api.workspace_response import WorkspaceResponse
|
|
27
|
+
from ...types.api.workspace_share_response import WorkspaceShareResponse
|
|
28
|
+
from ...types.api.workspace_delete_response import WorkspaceDeleteResponse
|
|
29
|
+
from ...types.api.workspace_get_tags_response import WorkspaceGetTagsResponse
|
|
30
|
+
from ...types.api.workspace_get_stats_response import WorkspaceGetStatsResponse
|
|
31
|
+
from ...types.api.workspace_get_users_response import WorkspaceGetUsersResponse
|
|
32
|
+
from ...types.api.workspace_get_doctags_response import WorkspaceGetDoctagsResponse
|
|
33
|
+
from ...types.api.workspace_remove_user_response import WorkspaceRemoveUserResponse
|
|
34
|
+
from ...types.api.workspace_get_documents_response import WorkspaceGetDocumentsResponse
|
|
35
|
+
from ...types.api.workspace_get_conversations_response import WorkspaceGetConversationsResponse
|
|
36
|
+
|
|
37
|
+
__all__ = ["WorkspaceResource", "AsyncWorkspaceResource"]
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class WorkspaceResource(SyncAPIResource):
|
|
41
|
+
@cached_property
|
|
42
|
+
def with_raw_response(self) -> WorkspaceResourceWithRawResponse:
|
|
43
|
+
"""
|
|
44
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
45
|
+
the raw response object instead of the parsed content.
|
|
46
|
+
|
|
47
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#accessing-raw-response-data-eg-headers
|
|
48
|
+
"""
|
|
49
|
+
return WorkspaceResourceWithRawResponse(self)
|
|
50
|
+
|
|
51
|
+
@cached_property
|
|
52
|
+
def with_streaming_response(self) -> WorkspaceResourceWithStreamingResponse:
|
|
53
|
+
"""
|
|
54
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
55
|
+
|
|
56
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#with_streaming_response
|
|
57
|
+
"""
|
|
58
|
+
return WorkspaceResourceWithStreamingResponse(self)
|
|
59
|
+
|
|
60
|
+
def update(
|
|
61
|
+
self,
|
|
62
|
+
workspace_ext_id: str,
|
|
63
|
+
*,
|
|
64
|
+
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
65
|
+
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
66
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
67
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
68
|
+
extra_headers: Headers | None = None,
|
|
69
|
+
extra_query: Query | None = None,
|
|
70
|
+
extra_body: Body | None = None,
|
|
71
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
72
|
+
) -> WorkspaceResponse:
|
|
73
|
+
"""Update workspace metadata such as name or description.
|
|
74
|
+
|
|
75
|
+
Changes are persisted to
|
|
76
|
+
the database.
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
extra_headers: Send extra headers
|
|
80
|
+
|
|
81
|
+
extra_query: Add additional query parameters to the request
|
|
82
|
+
|
|
83
|
+
extra_body: Add additional JSON properties to the request
|
|
84
|
+
|
|
85
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
86
|
+
"""
|
|
87
|
+
if not workspace_ext_id:
|
|
88
|
+
raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
|
|
89
|
+
return self._patch(
|
|
90
|
+
f"/api/workspace/{workspace_ext_id}",
|
|
91
|
+
body=maybe_transform(
|
|
92
|
+
{
|
|
93
|
+
"description": description,
|
|
94
|
+
"name": name,
|
|
95
|
+
},
|
|
96
|
+
workspace_update_params.WorkspaceUpdateParams,
|
|
97
|
+
),
|
|
98
|
+
options=make_request_options(
|
|
99
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
100
|
+
),
|
|
101
|
+
cast_to=WorkspaceResponse,
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
def delete(
|
|
105
|
+
self,
|
|
106
|
+
workspace_ext_id: str,
|
|
107
|
+
*,
|
|
108
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
109
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
110
|
+
extra_headers: Headers | None = None,
|
|
111
|
+
extra_query: Query | None = None,
|
|
112
|
+
extra_body: Body | None = None,
|
|
113
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
114
|
+
) -> WorkspaceDeleteResponse:
|
|
115
|
+
"""Delete a workspace.
|
|
116
|
+
|
|
117
|
+
Only the creator of the workspace is allowed to delete it.
|
|
118
|
+
|
|
119
|
+
If the workspace
|
|
120
|
+
deletion fails (e.g., due to RLS policy), the operation aborts.
|
|
121
|
+
|
|
122
|
+
Args:
|
|
123
|
+
extra_headers: Send extra headers
|
|
124
|
+
|
|
125
|
+
extra_query: Add additional query parameters to the request
|
|
126
|
+
|
|
127
|
+
extra_body: Add additional JSON properties to the request
|
|
128
|
+
|
|
129
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
130
|
+
"""
|
|
131
|
+
if not workspace_ext_id:
|
|
132
|
+
raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
|
|
133
|
+
return self._delete(
|
|
134
|
+
f"/api/workspace/{workspace_ext_id}",
|
|
135
|
+
options=make_request_options(
|
|
136
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
137
|
+
),
|
|
138
|
+
cast_to=WorkspaceDeleteResponse,
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
def create_protected(
|
|
142
|
+
self,
|
|
143
|
+
*,
|
|
144
|
+
name: str,
|
|
145
|
+
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
146
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
147
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
148
|
+
extra_headers: Headers | None = None,
|
|
149
|
+
extra_query: Query | None = None,
|
|
150
|
+
extra_body: Body | None = None,
|
|
151
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
152
|
+
) -> WorkspaceResponse:
|
|
153
|
+
"""Create a new workspace with encryption and access controls.
|
|
154
|
+
|
|
155
|
+
Sets up vector
|
|
156
|
+
storage and associates the creator as the initial workspace user.
|
|
157
|
+
|
|
158
|
+
Args:
|
|
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/workspace/create_protected",
|
|
169
|
+
body=maybe_transform(
|
|
170
|
+
{
|
|
171
|
+
"name": name,
|
|
172
|
+
"description": description,
|
|
173
|
+
},
|
|
174
|
+
workspace_create_protected_params.WorkspaceCreateProtectedParams,
|
|
175
|
+
),
|
|
176
|
+
options=make_request_options(
|
|
177
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
178
|
+
),
|
|
179
|
+
cast_to=WorkspaceResponse,
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
def get_conversations(
|
|
183
|
+
self,
|
|
184
|
+
workspace_ext_id: str,
|
|
185
|
+
*,
|
|
186
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
187
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
188
|
+
extra_headers: Headers | None = None,
|
|
189
|
+
extra_query: Query | None = None,
|
|
190
|
+
extra_body: Body | None = None,
|
|
191
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
192
|
+
) -> WorkspaceGetConversationsResponse:
|
|
193
|
+
"""
|
|
194
|
+
Retrieve conversations for a workspace where the current user is:
|
|
195
|
+
|
|
196
|
+
- The creator of the conversation, or
|
|
197
|
+
- Listed in the ConvoUsers table.
|
|
198
|
+
|
|
199
|
+
Return conversation metadata including:
|
|
200
|
+
|
|
201
|
+
- External ID
|
|
202
|
+
- Title
|
|
203
|
+
- Last updated date
|
|
204
|
+
- Number of messages
|
|
205
|
+
- Whether the current user is the creator
|
|
206
|
+
|
|
207
|
+
Args:
|
|
208
|
+
extra_headers: Send extra headers
|
|
209
|
+
|
|
210
|
+
extra_query: Add additional query parameters to the request
|
|
211
|
+
|
|
212
|
+
extra_body: Add additional JSON properties to the request
|
|
213
|
+
|
|
214
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
215
|
+
"""
|
|
216
|
+
if not workspace_ext_id:
|
|
217
|
+
raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
|
|
218
|
+
return self._get(
|
|
219
|
+
f"/api/workspace/{workspace_ext_id}/conversations",
|
|
220
|
+
options=make_request_options(
|
|
221
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
222
|
+
),
|
|
223
|
+
cast_to=WorkspaceGetConversationsResponse,
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
def get_doctags(
|
|
227
|
+
self,
|
|
228
|
+
workspace_ext_id: str,
|
|
229
|
+
*,
|
|
230
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
231
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
232
|
+
extra_headers: Headers | None = None,
|
|
233
|
+
extra_query: Query | None = None,
|
|
234
|
+
extra_body: Body | None = None,
|
|
235
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
236
|
+
) -> WorkspaceGetDoctagsResponse:
|
|
237
|
+
"""Get all doctags (document-tag associations) in a given workspace.
|
|
238
|
+
|
|
239
|
+
RLS is used to
|
|
240
|
+
enforce proper access controls.
|
|
241
|
+
|
|
242
|
+
Args:
|
|
243
|
+
extra_headers: Send extra headers
|
|
244
|
+
|
|
245
|
+
extra_query: Add additional query parameters to the request
|
|
246
|
+
|
|
247
|
+
extra_body: Add additional JSON properties to the request
|
|
248
|
+
|
|
249
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
250
|
+
"""
|
|
251
|
+
if not workspace_ext_id:
|
|
252
|
+
raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
|
|
253
|
+
return self._get(
|
|
254
|
+
f"/api/workspace/{workspace_ext_id}/doctags",
|
|
255
|
+
options=make_request_options(
|
|
256
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
257
|
+
),
|
|
258
|
+
cast_to=WorkspaceGetDoctagsResponse,
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
def get_documents(
|
|
262
|
+
self,
|
|
263
|
+
workspace_ext_id: str,
|
|
264
|
+
*,
|
|
265
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
266
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
267
|
+
extra_headers: Headers | None = None,
|
|
268
|
+
extra_query: Query | None = None,
|
|
269
|
+
extra_body: Body | None = None,
|
|
270
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
271
|
+
) -> WorkspaceGetDocumentsResponse:
|
|
272
|
+
"""Retrieve all documents in a workspace with proper access controls.
|
|
273
|
+
|
|
274
|
+
Decrypts
|
|
275
|
+
document metadata for authorized users.
|
|
276
|
+
|
|
277
|
+
Args:
|
|
278
|
+
extra_headers: Send extra headers
|
|
279
|
+
|
|
280
|
+
extra_query: Add additional query parameters to the request
|
|
281
|
+
|
|
282
|
+
extra_body: Add additional JSON properties to the request
|
|
283
|
+
|
|
284
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
285
|
+
"""
|
|
286
|
+
if not workspace_ext_id:
|
|
287
|
+
raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
|
|
288
|
+
return self._get(
|
|
289
|
+
f"/api/workspace/{workspace_ext_id}/documents",
|
|
290
|
+
options=make_request_options(
|
|
291
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
292
|
+
),
|
|
293
|
+
cast_to=WorkspaceGetDocumentsResponse,
|
|
294
|
+
)
|
|
295
|
+
|
|
296
|
+
def get_stats(
|
|
297
|
+
self,
|
|
298
|
+
workspace_ext_id: str,
|
|
299
|
+
*,
|
|
300
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
301
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
302
|
+
extra_headers: Headers | None = None,
|
|
303
|
+
extra_query: Query | None = None,
|
|
304
|
+
extra_body: Body | None = None,
|
|
305
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
306
|
+
) -> WorkspaceGetStatsResponse:
|
|
307
|
+
"""
|
|
308
|
+
Retrieves conversation and document counts for a specific workspace.
|
|
309
|
+
|
|
310
|
+
Args:
|
|
311
|
+
extra_headers: Send extra headers
|
|
312
|
+
|
|
313
|
+
extra_query: Add additional query parameters to the request
|
|
314
|
+
|
|
315
|
+
extra_body: Add additional JSON properties to the request
|
|
316
|
+
|
|
317
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
318
|
+
"""
|
|
319
|
+
if not workspace_ext_id:
|
|
320
|
+
raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
|
|
321
|
+
return self._get(
|
|
322
|
+
f"/api/workspace/{workspace_ext_id}/stats",
|
|
323
|
+
options=make_request_options(
|
|
324
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
325
|
+
),
|
|
326
|
+
cast_to=WorkspaceGetStatsResponse,
|
|
327
|
+
)
|
|
328
|
+
|
|
329
|
+
def get_tags(
|
|
330
|
+
self,
|
|
331
|
+
workspace_ext_id: str,
|
|
332
|
+
*,
|
|
333
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
334
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
335
|
+
extra_headers: Headers | None = None,
|
|
336
|
+
extra_query: Query | None = None,
|
|
337
|
+
extra_body: Body | None = None,
|
|
338
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
339
|
+
) -> WorkspaceGetTagsResponse:
|
|
340
|
+
"""
|
|
341
|
+
Get all tags in a given workspace created by the current user.
|
|
342
|
+
|
|
343
|
+
Args:
|
|
344
|
+
extra_headers: Send extra headers
|
|
345
|
+
|
|
346
|
+
extra_query: Add additional query parameters to the request
|
|
347
|
+
|
|
348
|
+
extra_body: Add additional JSON properties to the request
|
|
349
|
+
|
|
350
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
351
|
+
"""
|
|
352
|
+
if not workspace_ext_id:
|
|
353
|
+
raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
|
|
354
|
+
return self._get(
|
|
355
|
+
f"/api/workspace/{workspace_ext_id}/tags",
|
|
356
|
+
options=make_request_options(
|
|
357
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
358
|
+
),
|
|
359
|
+
cast_to=WorkspaceGetTagsResponse,
|
|
360
|
+
)
|
|
361
|
+
|
|
362
|
+
def get_users(
|
|
363
|
+
self,
|
|
364
|
+
workspace_ext_id: str,
|
|
365
|
+
*,
|
|
366
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
367
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
368
|
+
extra_headers: Headers | None = None,
|
|
369
|
+
extra_query: Query | None = None,
|
|
370
|
+
extra_body: Body | None = None,
|
|
371
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
372
|
+
) -> WorkspaceGetUsersResponse:
|
|
373
|
+
"""Retrieve users with access to a specific workspace.
|
|
374
|
+
|
|
375
|
+
Leverages RLS to enforce
|
|
376
|
+
appropriate access controls.
|
|
377
|
+
|
|
378
|
+
Args:
|
|
379
|
+
extra_headers: Send extra headers
|
|
380
|
+
|
|
381
|
+
extra_query: Add additional query parameters to the request
|
|
382
|
+
|
|
383
|
+
extra_body: Add additional JSON properties to the request
|
|
384
|
+
|
|
385
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
386
|
+
"""
|
|
387
|
+
if not workspace_ext_id:
|
|
388
|
+
raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
|
|
389
|
+
return self._get(
|
|
390
|
+
f"/api/workspace/{workspace_ext_id}/users",
|
|
391
|
+
options=make_request_options(
|
|
392
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
393
|
+
),
|
|
394
|
+
cast_to=WorkspaceGetUsersResponse,
|
|
395
|
+
)
|
|
396
|
+
|
|
397
|
+
def remove_user(
|
|
398
|
+
self,
|
|
399
|
+
workspace_ext_id: str,
|
|
400
|
+
*,
|
|
401
|
+
user_ext_id: str,
|
|
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
|
+
) -> WorkspaceRemoveUserResponse:
|
|
409
|
+
"""
|
|
410
|
+
Remove a user from a workspace.
|
|
411
|
+
|
|
412
|
+
RLS ensures the user can only modify workspaces they have access to.
|
|
413
|
+
|
|
414
|
+
Args:
|
|
415
|
+
extra_headers: Send extra headers
|
|
416
|
+
|
|
417
|
+
extra_query: Add additional query parameters to the request
|
|
418
|
+
|
|
419
|
+
extra_body: Add additional JSON properties to the request
|
|
420
|
+
|
|
421
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
422
|
+
"""
|
|
423
|
+
if not workspace_ext_id:
|
|
424
|
+
raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
|
|
425
|
+
return self._delete(
|
|
426
|
+
f"/api/workspace/{workspace_ext_id}/user",
|
|
427
|
+
body=maybe_transform({"user_ext_id": user_ext_id}, workspace_remove_user_params.WorkspaceRemoveUserParams),
|
|
428
|
+
options=make_request_options(
|
|
429
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
430
|
+
),
|
|
431
|
+
cast_to=WorkspaceRemoveUserResponse,
|
|
432
|
+
)
|
|
433
|
+
|
|
434
|
+
def share(
|
|
435
|
+
self,
|
|
436
|
+
workspace_ext_id: str,
|
|
437
|
+
*,
|
|
438
|
+
recipient_email: str,
|
|
439
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
440
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
441
|
+
extra_headers: Headers | None = None,
|
|
442
|
+
extra_query: Query | None = None,
|
|
443
|
+
extra_body: Body | None = None,
|
|
444
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
445
|
+
) -> WorkspaceShareResponse:
|
|
446
|
+
"""Share a workspace with another user via their email address.
|
|
447
|
+
|
|
448
|
+
Securely transfers
|
|
449
|
+
workspace encryption keys to the recipient.
|
|
450
|
+
|
|
451
|
+
Args:
|
|
452
|
+
extra_headers: Send extra headers
|
|
453
|
+
|
|
454
|
+
extra_query: Add additional query parameters to the request
|
|
455
|
+
|
|
456
|
+
extra_body: Add additional JSON properties to the request
|
|
457
|
+
|
|
458
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
459
|
+
"""
|
|
460
|
+
if not workspace_ext_id:
|
|
461
|
+
raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
|
|
462
|
+
return self._post(
|
|
463
|
+
f"/api/workspace/{workspace_ext_id}/share",
|
|
464
|
+
body=maybe_transform({"recipient_email": recipient_email}, workspace_share_params.WorkspaceShareParams),
|
|
465
|
+
options=make_request_options(
|
|
466
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
467
|
+
),
|
|
468
|
+
cast_to=WorkspaceShareResponse,
|
|
469
|
+
)
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
class AsyncWorkspaceResource(AsyncAPIResource):
|
|
473
|
+
@cached_property
|
|
474
|
+
def with_raw_response(self) -> AsyncWorkspaceResourceWithRawResponse:
|
|
475
|
+
"""
|
|
476
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
477
|
+
the raw response object instead of the parsed content.
|
|
478
|
+
|
|
479
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#accessing-raw-response-data-eg-headers
|
|
480
|
+
"""
|
|
481
|
+
return AsyncWorkspaceResourceWithRawResponse(self)
|
|
482
|
+
|
|
483
|
+
@cached_property
|
|
484
|
+
def with_streaming_response(self) -> AsyncWorkspaceResourceWithStreamingResponse:
|
|
485
|
+
"""
|
|
486
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
487
|
+
|
|
488
|
+
For more information, see https://www.github.com/arbitrationcity/arbi-python#with_streaming_response
|
|
489
|
+
"""
|
|
490
|
+
return AsyncWorkspaceResourceWithStreamingResponse(self)
|
|
491
|
+
|
|
492
|
+
async def update(
|
|
493
|
+
self,
|
|
494
|
+
workspace_ext_id: str,
|
|
495
|
+
*,
|
|
496
|
+
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
497
|
+
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
498
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
499
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
500
|
+
extra_headers: Headers | None = None,
|
|
501
|
+
extra_query: Query | None = None,
|
|
502
|
+
extra_body: Body | None = None,
|
|
503
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
504
|
+
) -> WorkspaceResponse:
|
|
505
|
+
"""Update workspace metadata such as name or description.
|
|
506
|
+
|
|
507
|
+
Changes are persisted to
|
|
508
|
+
the database.
|
|
509
|
+
|
|
510
|
+
Args:
|
|
511
|
+
extra_headers: Send extra headers
|
|
512
|
+
|
|
513
|
+
extra_query: Add additional query parameters to the request
|
|
514
|
+
|
|
515
|
+
extra_body: Add additional JSON properties to the request
|
|
516
|
+
|
|
517
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
518
|
+
"""
|
|
519
|
+
if not workspace_ext_id:
|
|
520
|
+
raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
|
|
521
|
+
return await self._patch(
|
|
522
|
+
f"/api/workspace/{workspace_ext_id}",
|
|
523
|
+
body=await async_maybe_transform(
|
|
524
|
+
{
|
|
525
|
+
"description": description,
|
|
526
|
+
"name": name,
|
|
527
|
+
},
|
|
528
|
+
workspace_update_params.WorkspaceUpdateParams,
|
|
529
|
+
),
|
|
530
|
+
options=make_request_options(
|
|
531
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
532
|
+
),
|
|
533
|
+
cast_to=WorkspaceResponse,
|
|
534
|
+
)
|
|
535
|
+
|
|
536
|
+
async def delete(
|
|
537
|
+
self,
|
|
538
|
+
workspace_ext_id: str,
|
|
539
|
+
*,
|
|
540
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
541
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
542
|
+
extra_headers: Headers | None = None,
|
|
543
|
+
extra_query: Query | None = None,
|
|
544
|
+
extra_body: Body | None = None,
|
|
545
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
546
|
+
) -> WorkspaceDeleteResponse:
|
|
547
|
+
"""Delete a workspace.
|
|
548
|
+
|
|
549
|
+
Only the creator of the workspace is allowed to delete it.
|
|
550
|
+
|
|
551
|
+
If the workspace
|
|
552
|
+
deletion fails (e.g., due to RLS policy), the operation aborts.
|
|
553
|
+
|
|
554
|
+
Args:
|
|
555
|
+
extra_headers: Send extra headers
|
|
556
|
+
|
|
557
|
+
extra_query: Add additional query parameters to the request
|
|
558
|
+
|
|
559
|
+
extra_body: Add additional JSON properties to the request
|
|
560
|
+
|
|
561
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
562
|
+
"""
|
|
563
|
+
if not workspace_ext_id:
|
|
564
|
+
raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
|
|
565
|
+
return await self._delete(
|
|
566
|
+
f"/api/workspace/{workspace_ext_id}",
|
|
567
|
+
options=make_request_options(
|
|
568
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
569
|
+
),
|
|
570
|
+
cast_to=WorkspaceDeleteResponse,
|
|
571
|
+
)
|
|
572
|
+
|
|
573
|
+
async def create_protected(
|
|
574
|
+
self,
|
|
575
|
+
*,
|
|
576
|
+
name: str,
|
|
577
|
+
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
578
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
579
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
580
|
+
extra_headers: Headers | None = None,
|
|
581
|
+
extra_query: Query | None = None,
|
|
582
|
+
extra_body: Body | None = None,
|
|
583
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
584
|
+
) -> WorkspaceResponse:
|
|
585
|
+
"""Create a new workspace with encryption and access controls.
|
|
586
|
+
|
|
587
|
+
Sets up vector
|
|
588
|
+
storage and associates the creator as the initial workspace user.
|
|
589
|
+
|
|
590
|
+
Args:
|
|
591
|
+
extra_headers: Send extra headers
|
|
592
|
+
|
|
593
|
+
extra_query: Add additional query parameters to the request
|
|
594
|
+
|
|
595
|
+
extra_body: Add additional JSON properties to the request
|
|
596
|
+
|
|
597
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
598
|
+
"""
|
|
599
|
+
return await self._post(
|
|
600
|
+
"/api/workspace/create_protected",
|
|
601
|
+
body=await async_maybe_transform(
|
|
602
|
+
{
|
|
603
|
+
"name": name,
|
|
604
|
+
"description": description,
|
|
605
|
+
},
|
|
606
|
+
workspace_create_protected_params.WorkspaceCreateProtectedParams,
|
|
607
|
+
),
|
|
608
|
+
options=make_request_options(
|
|
609
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
610
|
+
),
|
|
611
|
+
cast_to=WorkspaceResponse,
|
|
612
|
+
)
|
|
613
|
+
|
|
614
|
+
async def get_conversations(
|
|
615
|
+
self,
|
|
616
|
+
workspace_ext_id: str,
|
|
617
|
+
*,
|
|
618
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
619
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
620
|
+
extra_headers: Headers | None = None,
|
|
621
|
+
extra_query: Query | None = None,
|
|
622
|
+
extra_body: Body | None = None,
|
|
623
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
624
|
+
) -> WorkspaceGetConversationsResponse:
|
|
625
|
+
"""
|
|
626
|
+
Retrieve conversations for a workspace where the current user is:
|
|
627
|
+
|
|
628
|
+
- The creator of the conversation, or
|
|
629
|
+
- Listed in the ConvoUsers table.
|
|
630
|
+
|
|
631
|
+
Return conversation metadata including:
|
|
632
|
+
|
|
633
|
+
- External ID
|
|
634
|
+
- Title
|
|
635
|
+
- Last updated date
|
|
636
|
+
- Number of messages
|
|
637
|
+
- Whether the current user is the creator
|
|
638
|
+
|
|
639
|
+
Args:
|
|
640
|
+
extra_headers: Send extra headers
|
|
641
|
+
|
|
642
|
+
extra_query: Add additional query parameters to the request
|
|
643
|
+
|
|
644
|
+
extra_body: Add additional JSON properties to the request
|
|
645
|
+
|
|
646
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
647
|
+
"""
|
|
648
|
+
if not workspace_ext_id:
|
|
649
|
+
raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
|
|
650
|
+
return await self._get(
|
|
651
|
+
f"/api/workspace/{workspace_ext_id}/conversations",
|
|
652
|
+
options=make_request_options(
|
|
653
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
654
|
+
),
|
|
655
|
+
cast_to=WorkspaceGetConversationsResponse,
|
|
656
|
+
)
|
|
657
|
+
|
|
658
|
+
async def get_doctags(
|
|
659
|
+
self,
|
|
660
|
+
workspace_ext_id: str,
|
|
661
|
+
*,
|
|
662
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
663
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
664
|
+
extra_headers: Headers | None = None,
|
|
665
|
+
extra_query: Query | None = None,
|
|
666
|
+
extra_body: Body | None = None,
|
|
667
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
668
|
+
) -> WorkspaceGetDoctagsResponse:
|
|
669
|
+
"""Get all doctags (document-tag associations) in a given workspace.
|
|
670
|
+
|
|
671
|
+
RLS is used to
|
|
672
|
+
enforce proper access controls.
|
|
673
|
+
|
|
674
|
+
Args:
|
|
675
|
+
extra_headers: Send extra headers
|
|
676
|
+
|
|
677
|
+
extra_query: Add additional query parameters to the request
|
|
678
|
+
|
|
679
|
+
extra_body: Add additional JSON properties to the request
|
|
680
|
+
|
|
681
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
682
|
+
"""
|
|
683
|
+
if not workspace_ext_id:
|
|
684
|
+
raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
|
|
685
|
+
return await self._get(
|
|
686
|
+
f"/api/workspace/{workspace_ext_id}/doctags",
|
|
687
|
+
options=make_request_options(
|
|
688
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
689
|
+
),
|
|
690
|
+
cast_to=WorkspaceGetDoctagsResponse,
|
|
691
|
+
)
|
|
692
|
+
|
|
693
|
+
async def get_documents(
|
|
694
|
+
self,
|
|
695
|
+
workspace_ext_id: str,
|
|
696
|
+
*,
|
|
697
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
698
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
699
|
+
extra_headers: Headers | None = None,
|
|
700
|
+
extra_query: Query | None = None,
|
|
701
|
+
extra_body: Body | None = None,
|
|
702
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
703
|
+
) -> WorkspaceGetDocumentsResponse:
|
|
704
|
+
"""Retrieve all documents in a workspace with proper access controls.
|
|
705
|
+
|
|
706
|
+
Decrypts
|
|
707
|
+
document metadata for authorized users.
|
|
708
|
+
|
|
709
|
+
Args:
|
|
710
|
+
extra_headers: Send extra headers
|
|
711
|
+
|
|
712
|
+
extra_query: Add additional query parameters to the request
|
|
713
|
+
|
|
714
|
+
extra_body: Add additional JSON properties to the request
|
|
715
|
+
|
|
716
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
717
|
+
"""
|
|
718
|
+
if not workspace_ext_id:
|
|
719
|
+
raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
|
|
720
|
+
return await self._get(
|
|
721
|
+
f"/api/workspace/{workspace_ext_id}/documents",
|
|
722
|
+
options=make_request_options(
|
|
723
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
724
|
+
),
|
|
725
|
+
cast_to=WorkspaceGetDocumentsResponse,
|
|
726
|
+
)
|
|
727
|
+
|
|
728
|
+
async def get_stats(
|
|
729
|
+
self,
|
|
730
|
+
workspace_ext_id: str,
|
|
731
|
+
*,
|
|
732
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
733
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
734
|
+
extra_headers: Headers | None = None,
|
|
735
|
+
extra_query: Query | None = None,
|
|
736
|
+
extra_body: Body | None = None,
|
|
737
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
738
|
+
) -> WorkspaceGetStatsResponse:
|
|
739
|
+
"""
|
|
740
|
+
Retrieves conversation and document counts for a specific workspace.
|
|
741
|
+
|
|
742
|
+
Args:
|
|
743
|
+
extra_headers: Send extra headers
|
|
744
|
+
|
|
745
|
+
extra_query: Add additional query parameters to the request
|
|
746
|
+
|
|
747
|
+
extra_body: Add additional JSON properties to the request
|
|
748
|
+
|
|
749
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
750
|
+
"""
|
|
751
|
+
if not workspace_ext_id:
|
|
752
|
+
raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
|
|
753
|
+
return await self._get(
|
|
754
|
+
f"/api/workspace/{workspace_ext_id}/stats",
|
|
755
|
+
options=make_request_options(
|
|
756
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
757
|
+
),
|
|
758
|
+
cast_to=WorkspaceGetStatsResponse,
|
|
759
|
+
)
|
|
760
|
+
|
|
761
|
+
async def get_tags(
|
|
762
|
+
self,
|
|
763
|
+
workspace_ext_id: str,
|
|
764
|
+
*,
|
|
765
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
766
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
767
|
+
extra_headers: Headers | None = None,
|
|
768
|
+
extra_query: Query | None = None,
|
|
769
|
+
extra_body: Body | None = None,
|
|
770
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
771
|
+
) -> WorkspaceGetTagsResponse:
|
|
772
|
+
"""
|
|
773
|
+
Get all tags in a given workspace created by the current user.
|
|
774
|
+
|
|
775
|
+
Args:
|
|
776
|
+
extra_headers: Send extra headers
|
|
777
|
+
|
|
778
|
+
extra_query: Add additional query parameters to the request
|
|
779
|
+
|
|
780
|
+
extra_body: Add additional JSON properties to the request
|
|
781
|
+
|
|
782
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
783
|
+
"""
|
|
784
|
+
if not workspace_ext_id:
|
|
785
|
+
raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
|
|
786
|
+
return await self._get(
|
|
787
|
+
f"/api/workspace/{workspace_ext_id}/tags",
|
|
788
|
+
options=make_request_options(
|
|
789
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
790
|
+
),
|
|
791
|
+
cast_to=WorkspaceGetTagsResponse,
|
|
792
|
+
)
|
|
793
|
+
|
|
794
|
+
async def get_users(
|
|
795
|
+
self,
|
|
796
|
+
workspace_ext_id: str,
|
|
797
|
+
*,
|
|
798
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
799
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
800
|
+
extra_headers: Headers | None = None,
|
|
801
|
+
extra_query: Query | None = None,
|
|
802
|
+
extra_body: Body | None = None,
|
|
803
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
804
|
+
) -> WorkspaceGetUsersResponse:
|
|
805
|
+
"""Retrieve users with access to a specific workspace.
|
|
806
|
+
|
|
807
|
+
Leverages RLS to enforce
|
|
808
|
+
appropriate access controls.
|
|
809
|
+
|
|
810
|
+
Args:
|
|
811
|
+
extra_headers: Send extra headers
|
|
812
|
+
|
|
813
|
+
extra_query: Add additional query parameters to the request
|
|
814
|
+
|
|
815
|
+
extra_body: Add additional JSON properties to the request
|
|
816
|
+
|
|
817
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
818
|
+
"""
|
|
819
|
+
if not workspace_ext_id:
|
|
820
|
+
raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
|
|
821
|
+
return await self._get(
|
|
822
|
+
f"/api/workspace/{workspace_ext_id}/users",
|
|
823
|
+
options=make_request_options(
|
|
824
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
825
|
+
),
|
|
826
|
+
cast_to=WorkspaceGetUsersResponse,
|
|
827
|
+
)
|
|
828
|
+
|
|
829
|
+
async def remove_user(
|
|
830
|
+
self,
|
|
831
|
+
workspace_ext_id: str,
|
|
832
|
+
*,
|
|
833
|
+
user_ext_id: str,
|
|
834
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
835
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
836
|
+
extra_headers: Headers | None = None,
|
|
837
|
+
extra_query: Query | None = None,
|
|
838
|
+
extra_body: Body | None = None,
|
|
839
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
840
|
+
) -> WorkspaceRemoveUserResponse:
|
|
841
|
+
"""
|
|
842
|
+
Remove a user from a workspace.
|
|
843
|
+
|
|
844
|
+
RLS ensures the user can only modify workspaces they have access to.
|
|
845
|
+
|
|
846
|
+
Args:
|
|
847
|
+
extra_headers: Send extra headers
|
|
848
|
+
|
|
849
|
+
extra_query: Add additional query parameters to the request
|
|
850
|
+
|
|
851
|
+
extra_body: Add additional JSON properties to the request
|
|
852
|
+
|
|
853
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
854
|
+
"""
|
|
855
|
+
if not workspace_ext_id:
|
|
856
|
+
raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
|
|
857
|
+
return await self._delete(
|
|
858
|
+
f"/api/workspace/{workspace_ext_id}/user",
|
|
859
|
+
body=await async_maybe_transform(
|
|
860
|
+
{"user_ext_id": user_ext_id}, workspace_remove_user_params.WorkspaceRemoveUserParams
|
|
861
|
+
),
|
|
862
|
+
options=make_request_options(
|
|
863
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
864
|
+
),
|
|
865
|
+
cast_to=WorkspaceRemoveUserResponse,
|
|
866
|
+
)
|
|
867
|
+
|
|
868
|
+
async def share(
|
|
869
|
+
self,
|
|
870
|
+
workspace_ext_id: str,
|
|
871
|
+
*,
|
|
872
|
+
recipient_email: str,
|
|
873
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
874
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
875
|
+
extra_headers: Headers | None = None,
|
|
876
|
+
extra_query: Query | None = None,
|
|
877
|
+
extra_body: Body | None = None,
|
|
878
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
879
|
+
) -> WorkspaceShareResponse:
|
|
880
|
+
"""Share a workspace with another user via their email address.
|
|
881
|
+
|
|
882
|
+
Securely transfers
|
|
883
|
+
workspace encryption keys to the recipient.
|
|
884
|
+
|
|
885
|
+
Args:
|
|
886
|
+
extra_headers: Send extra headers
|
|
887
|
+
|
|
888
|
+
extra_query: Add additional query parameters to the request
|
|
889
|
+
|
|
890
|
+
extra_body: Add additional JSON properties to the request
|
|
891
|
+
|
|
892
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
893
|
+
"""
|
|
894
|
+
if not workspace_ext_id:
|
|
895
|
+
raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
|
|
896
|
+
return await self._post(
|
|
897
|
+
f"/api/workspace/{workspace_ext_id}/share",
|
|
898
|
+
body=await async_maybe_transform(
|
|
899
|
+
{"recipient_email": recipient_email}, workspace_share_params.WorkspaceShareParams
|
|
900
|
+
),
|
|
901
|
+
options=make_request_options(
|
|
902
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
903
|
+
),
|
|
904
|
+
cast_to=WorkspaceShareResponse,
|
|
905
|
+
)
|
|
906
|
+
|
|
907
|
+
|
|
908
|
+
class WorkspaceResourceWithRawResponse:
|
|
909
|
+
def __init__(self, workspace: WorkspaceResource) -> None:
|
|
910
|
+
self._workspace = workspace
|
|
911
|
+
|
|
912
|
+
self.update = to_raw_response_wrapper(
|
|
913
|
+
workspace.update,
|
|
914
|
+
)
|
|
915
|
+
self.delete = to_raw_response_wrapper(
|
|
916
|
+
workspace.delete,
|
|
917
|
+
)
|
|
918
|
+
self.create_protected = to_raw_response_wrapper(
|
|
919
|
+
workspace.create_protected,
|
|
920
|
+
)
|
|
921
|
+
self.get_conversations = to_raw_response_wrapper(
|
|
922
|
+
workspace.get_conversations,
|
|
923
|
+
)
|
|
924
|
+
self.get_doctags = to_raw_response_wrapper(
|
|
925
|
+
workspace.get_doctags,
|
|
926
|
+
)
|
|
927
|
+
self.get_documents = to_raw_response_wrapper(
|
|
928
|
+
workspace.get_documents,
|
|
929
|
+
)
|
|
930
|
+
self.get_stats = to_raw_response_wrapper(
|
|
931
|
+
workspace.get_stats,
|
|
932
|
+
)
|
|
933
|
+
self.get_tags = to_raw_response_wrapper(
|
|
934
|
+
workspace.get_tags,
|
|
935
|
+
)
|
|
936
|
+
self.get_users = to_raw_response_wrapper(
|
|
937
|
+
workspace.get_users,
|
|
938
|
+
)
|
|
939
|
+
self.remove_user = to_raw_response_wrapper(
|
|
940
|
+
workspace.remove_user,
|
|
941
|
+
)
|
|
942
|
+
self.share = to_raw_response_wrapper(
|
|
943
|
+
workspace.share,
|
|
944
|
+
)
|
|
945
|
+
|
|
946
|
+
|
|
947
|
+
class AsyncWorkspaceResourceWithRawResponse:
|
|
948
|
+
def __init__(self, workspace: AsyncWorkspaceResource) -> None:
|
|
949
|
+
self._workspace = workspace
|
|
950
|
+
|
|
951
|
+
self.update = async_to_raw_response_wrapper(
|
|
952
|
+
workspace.update,
|
|
953
|
+
)
|
|
954
|
+
self.delete = async_to_raw_response_wrapper(
|
|
955
|
+
workspace.delete,
|
|
956
|
+
)
|
|
957
|
+
self.create_protected = async_to_raw_response_wrapper(
|
|
958
|
+
workspace.create_protected,
|
|
959
|
+
)
|
|
960
|
+
self.get_conversations = async_to_raw_response_wrapper(
|
|
961
|
+
workspace.get_conversations,
|
|
962
|
+
)
|
|
963
|
+
self.get_doctags = async_to_raw_response_wrapper(
|
|
964
|
+
workspace.get_doctags,
|
|
965
|
+
)
|
|
966
|
+
self.get_documents = async_to_raw_response_wrapper(
|
|
967
|
+
workspace.get_documents,
|
|
968
|
+
)
|
|
969
|
+
self.get_stats = async_to_raw_response_wrapper(
|
|
970
|
+
workspace.get_stats,
|
|
971
|
+
)
|
|
972
|
+
self.get_tags = async_to_raw_response_wrapper(
|
|
973
|
+
workspace.get_tags,
|
|
974
|
+
)
|
|
975
|
+
self.get_users = async_to_raw_response_wrapper(
|
|
976
|
+
workspace.get_users,
|
|
977
|
+
)
|
|
978
|
+
self.remove_user = async_to_raw_response_wrapper(
|
|
979
|
+
workspace.remove_user,
|
|
980
|
+
)
|
|
981
|
+
self.share = async_to_raw_response_wrapper(
|
|
982
|
+
workspace.share,
|
|
983
|
+
)
|
|
984
|
+
|
|
985
|
+
|
|
986
|
+
class WorkspaceResourceWithStreamingResponse:
|
|
987
|
+
def __init__(self, workspace: WorkspaceResource) -> None:
|
|
988
|
+
self._workspace = workspace
|
|
989
|
+
|
|
990
|
+
self.update = to_streamed_response_wrapper(
|
|
991
|
+
workspace.update,
|
|
992
|
+
)
|
|
993
|
+
self.delete = to_streamed_response_wrapper(
|
|
994
|
+
workspace.delete,
|
|
995
|
+
)
|
|
996
|
+
self.create_protected = to_streamed_response_wrapper(
|
|
997
|
+
workspace.create_protected,
|
|
998
|
+
)
|
|
999
|
+
self.get_conversations = to_streamed_response_wrapper(
|
|
1000
|
+
workspace.get_conversations,
|
|
1001
|
+
)
|
|
1002
|
+
self.get_doctags = to_streamed_response_wrapper(
|
|
1003
|
+
workspace.get_doctags,
|
|
1004
|
+
)
|
|
1005
|
+
self.get_documents = to_streamed_response_wrapper(
|
|
1006
|
+
workspace.get_documents,
|
|
1007
|
+
)
|
|
1008
|
+
self.get_stats = to_streamed_response_wrapper(
|
|
1009
|
+
workspace.get_stats,
|
|
1010
|
+
)
|
|
1011
|
+
self.get_tags = to_streamed_response_wrapper(
|
|
1012
|
+
workspace.get_tags,
|
|
1013
|
+
)
|
|
1014
|
+
self.get_users = to_streamed_response_wrapper(
|
|
1015
|
+
workspace.get_users,
|
|
1016
|
+
)
|
|
1017
|
+
self.remove_user = to_streamed_response_wrapper(
|
|
1018
|
+
workspace.remove_user,
|
|
1019
|
+
)
|
|
1020
|
+
self.share = to_streamed_response_wrapper(
|
|
1021
|
+
workspace.share,
|
|
1022
|
+
)
|
|
1023
|
+
|
|
1024
|
+
|
|
1025
|
+
class AsyncWorkspaceResourceWithStreamingResponse:
|
|
1026
|
+
def __init__(self, workspace: AsyncWorkspaceResource) -> None:
|
|
1027
|
+
self._workspace = workspace
|
|
1028
|
+
|
|
1029
|
+
self.update = async_to_streamed_response_wrapper(
|
|
1030
|
+
workspace.update,
|
|
1031
|
+
)
|
|
1032
|
+
self.delete = async_to_streamed_response_wrapper(
|
|
1033
|
+
workspace.delete,
|
|
1034
|
+
)
|
|
1035
|
+
self.create_protected = async_to_streamed_response_wrapper(
|
|
1036
|
+
workspace.create_protected,
|
|
1037
|
+
)
|
|
1038
|
+
self.get_conversations = async_to_streamed_response_wrapper(
|
|
1039
|
+
workspace.get_conversations,
|
|
1040
|
+
)
|
|
1041
|
+
self.get_doctags = async_to_streamed_response_wrapper(
|
|
1042
|
+
workspace.get_doctags,
|
|
1043
|
+
)
|
|
1044
|
+
self.get_documents = async_to_streamed_response_wrapper(
|
|
1045
|
+
workspace.get_documents,
|
|
1046
|
+
)
|
|
1047
|
+
self.get_stats = async_to_streamed_response_wrapper(
|
|
1048
|
+
workspace.get_stats,
|
|
1049
|
+
)
|
|
1050
|
+
self.get_tags = async_to_streamed_response_wrapper(
|
|
1051
|
+
workspace.get_tags,
|
|
1052
|
+
)
|
|
1053
|
+
self.get_users = async_to_streamed_response_wrapper(
|
|
1054
|
+
workspace.get_users,
|
|
1055
|
+
)
|
|
1056
|
+
self.remove_user = async_to_streamed_response_wrapper(
|
|
1057
|
+
workspace.remove_user,
|
|
1058
|
+
)
|
|
1059
|
+
self.share = async_to_streamed_response_wrapper(
|
|
1060
|
+
workspace.share,
|
|
1061
|
+
)
|