arbi 0.18.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.
Files changed (165) hide show
  1. arbi/__init__.py +92 -0
  2. arbi/_base_client.py +2124 -0
  3. arbi/_client.py +442 -0
  4. arbi/_compat.py +219 -0
  5. arbi/_constants.py +14 -0
  6. arbi/_exceptions.py +108 -0
  7. arbi/_files.py +123 -0
  8. arbi/_models.py +872 -0
  9. arbi/_qs.py +150 -0
  10. arbi/_resource.py +43 -0
  11. arbi/_response.py +830 -0
  12. arbi/_streaming.py +333 -0
  13. arbi/_types.py +270 -0
  14. arbi/_utils/__init__.py +64 -0
  15. arbi/_utils/_compat.py +45 -0
  16. arbi/_utils/_datetime_parse.py +136 -0
  17. arbi/_utils/_logs.py +25 -0
  18. arbi/_utils/_proxy.py +65 -0
  19. arbi/_utils/_reflection.py +42 -0
  20. arbi/_utils/_resources_proxy.py +24 -0
  21. arbi/_utils/_streams.py +12 -0
  22. arbi/_utils/_sync.py +58 -0
  23. arbi/_utils/_transform.py +457 -0
  24. arbi/_utils/_typing.py +156 -0
  25. arbi/_utils/_utils.py +421 -0
  26. arbi/_version.py +4 -0
  27. arbi/lib/.keep +4 -0
  28. arbi/py.typed +0 -0
  29. arbi/resources/__init__.py +19 -0
  30. arbi/resources/api/__init__.py +145 -0
  31. arbi/resources/api/api.py +422 -0
  32. arbi/resources/api/assistant.py +312 -0
  33. arbi/resources/api/configs.py +533 -0
  34. arbi/resources/api/conversation/__init__.py +33 -0
  35. arbi/resources/api/conversation/conversation.py +648 -0
  36. arbi/resources/api/conversation/user.py +270 -0
  37. arbi/resources/api/document/__init__.py +33 -0
  38. arbi/resources/api/document/doctag.py +516 -0
  39. arbi/resources/api/document/document.py +929 -0
  40. arbi/resources/api/health.py +253 -0
  41. arbi/resources/api/notifications.py +478 -0
  42. arbi/resources/api/tag.py +409 -0
  43. arbi/resources/api/user/__init__.py +61 -0
  44. arbi/resources/api/user/contacts.py +322 -0
  45. arbi/resources/api/user/settings.py +283 -0
  46. arbi/resources/api/user/subscription.py +230 -0
  47. arbi/resources/api/user/user.py +943 -0
  48. arbi/resources/api/workspace.py +1198 -0
  49. arbi/types/__init__.py +8 -0
  50. arbi/types/api/__init__.py +94 -0
  51. arbi/types/api/assistant_query_params.py +95 -0
  52. arbi/types/api/assistant_retrieve_params.py +95 -0
  53. arbi/types/api/chunker_config_param.py +9 -0
  54. arbi/types/api/config_create_params.py +227 -0
  55. arbi/types/api/config_create_response.py +17 -0
  56. arbi/types/api/config_delete_response.py +11 -0
  57. arbi/types/api/config_get_versions_response.py +19 -0
  58. arbi/types/api/config_retrieve_response.py +234 -0
  59. arbi/types/api/conversation/__init__.py +8 -0
  60. arbi/types/api/conversation/user_add_params.py +11 -0
  61. arbi/types/api/conversation/user_add_response.py +11 -0
  62. arbi/types/api/conversation/user_remove_params.py +11 -0
  63. arbi/types/api/conversation/user_remove_response.py +11 -0
  64. arbi/types/api/conversation_delete_message_response.py +11 -0
  65. arbi/types/api/conversation_delete_response.py +11 -0
  66. arbi/types/api/conversation_retrieve_message_response.py +105 -0
  67. arbi/types/api/conversation_retrieve_threads_response.py +124 -0
  68. arbi/types/api/conversation_share_response.py +11 -0
  69. arbi/types/api/conversation_update_title_params.py +16 -0
  70. arbi/types/api/conversation_update_title_response.py +13 -0
  71. arbi/types/api/doc_response.py +66 -0
  72. arbi/types/api/document/__init__.py +11 -0
  73. arbi/types/api/document/doc_tag_response.py +40 -0
  74. arbi/types/api/document/doctag_create_params.py +35 -0
  75. arbi/types/api/document/doctag_create_response.py +10 -0
  76. arbi/types/api/document/doctag_delete_params.py +15 -0
  77. arbi/types/api/document/doctag_generate_params.py +22 -0
  78. arbi/types/api/document/doctag_generate_response.py +20 -0
  79. arbi/types/api/document/doctag_update_params.py +35 -0
  80. arbi/types/api/document_date_extractor_llm_config.py +29 -0
  81. arbi/types/api/document_date_extractor_llm_config_param.py +28 -0
  82. arbi/types/api/document_delete_params.py +13 -0
  83. arbi/types/api/document_get_parsed_response.py +26 -0
  84. arbi/types/api/document_retrieve_params.py +16 -0
  85. arbi/types/api/document_retrieve_response.py +10 -0
  86. arbi/types/api/document_update_params.py +42 -0
  87. arbi/types/api/document_update_response.py +10 -0
  88. arbi/types/api/document_upload_from_url_params.py +26 -0
  89. arbi/types/api/document_upload_from_url_response.py +16 -0
  90. arbi/types/api/document_upload_params.py +26 -0
  91. arbi/types/api/document_upload_response.py +16 -0
  92. arbi/types/api/embedder_config.py +30 -0
  93. arbi/types/api/embedder_config_param.py +29 -0
  94. arbi/types/api/health_check_models_response.py +21 -0
  95. arbi/types/api/health_get_models_response.py +19 -0
  96. arbi/types/api/health_retrieve_status_response.py +49 -0
  97. arbi/types/api/model_citation_config.py +20 -0
  98. arbi/types/api/model_citation_config_param.py +20 -0
  99. arbi/types/api/notification_create_params.py +20 -0
  100. arbi/types/api/notification_create_response.py +47 -0
  101. arbi/types/api/notification_delete_params.py +13 -0
  102. arbi/types/api/notification_get_schemas_response.py +197 -0
  103. arbi/types/api/notification_list_response.py +47 -0
  104. arbi/types/api/notification_update_params.py +27 -0
  105. arbi/types/api/notification_update_response.py +47 -0
  106. arbi/types/api/parser_config_param.py +9 -0
  107. arbi/types/api/query_llm_config.py +30 -0
  108. arbi/types/api/query_llm_config_param.py +29 -0
  109. arbi/types/api/reranker_config.py +21 -0
  110. arbi/types/api/reranker_config_param.py +20 -0
  111. arbi/types/api/retriever_config.py +39 -0
  112. arbi/types/api/retriever_config_param.py +38 -0
  113. arbi/types/api/tag_create_params.py +49 -0
  114. arbi/types/api/tag_create_response.py +57 -0
  115. arbi/types/api/tag_delete_response.py +9 -0
  116. arbi/types/api/tag_update_params.py +22 -0
  117. arbi/types/api/tag_update_response.py +57 -0
  118. arbi/types/api/title_llm_config.py +29 -0
  119. arbi/types/api/title_llm_config_param.py +28 -0
  120. arbi/types/api/user/__init__.py +13 -0
  121. arbi/types/api/user/contact_create_params.py +13 -0
  122. arbi/types/api/user/contact_create_response.py +30 -0
  123. arbi/types/api/user/contact_delete_params.py +13 -0
  124. arbi/types/api/user/contact_list_response.py +30 -0
  125. arbi/types/api/user/setting_retrieve_response.py +89 -0
  126. arbi/types/api/user/setting_update_params.py +60 -0
  127. arbi/types/api/user/subscription_create_params.py +13 -0
  128. arbi/types/api/user/subscription_create_response.py +11 -0
  129. arbi/types/api/user/subscription_retrieve_response.py +48 -0
  130. arbi/types/api/user_change_password_params.py +18 -0
  131. arbi/types/api/user_change_password_response.py +11 -0
  132. arbi/types/api/user_check_sso_status_params.py +20 -0
  133. arbi/types/api/user_check_sso_status_response.py +25 -0
  134. arbi/types/api/user_list_products_response.py +37 -0
  135. arbi/types/api/user_list_workspaces_response.py +10 -0
  136. arbi/types/api/user_login_params.py +18 -0
  137. arbi/types/api/user_login_response.py +23 -0
  138. arbi/types/api/user_logout_response.py +9 -0
  139. arbi/types/api/user_register_params.py +22 -0
  140. arbi/types/api/user_response.py +26 -0
  141. arbi/types/api/user_verify_email_params.py +11 -0
  142. arbi/types/api/user_verify_email_response.py +9 -0
  143. arbi/types/api/workspace_copy_params.py +21 -0
  144. arbi/types/api/workspace_copy_response.py +25 -0
  145. arbi/types/api/workspace_create_protected_params.py +16 -0
  146. arbi/types/api/workspace_delete_response.py +9 -0
  147. arbi/types/api/workspace_get_conversations_response.py +30 -0
  148. arbi/types/api/workspace_get_documents_response.py +10 -0
  149. arbi/types/api/workspace_get_stats_response.py +17 -0
  150. arbi/types/api/workspace_get_tags_response.py +60 -0
  151. arbi/types/api/workspace_get_users_response.py +10 -0
  152. arbi/types/api/workspace_remove_user_params.py +11 -0
  153. arbi/types/api/workspace_remove_user_response.py +11 -0
  154. arbi/types/api/workspace_response.py +41 -0
  155. arbi/types/api/workspace_share_params.py +15 -0
  156. arbi/types/api/workspace_share_response.py +13 -0
  157. arbi/types/api/workspace_update_params.py +20 -0
  158. arbi/types/chunk.py +12 -0
  159. arbi/types/chunk_metadata.py +31 -0
  160. arbi/types/chunk_metadata_param.py +32 -0
  161. arbi/types/chunk_param.py +15 -0
  162. arbi-0.18.0.dist-info/METADATA +410 -0
  163. arbi-0.18.0.dist-info/RECORD +165 -0
  164. arbi-0.18.0.dist-info/WHEEL +4 -0
  165. arbi-0.18.0.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,1198 @@
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 Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
10
+ from ..._utils import maybe_transform, strip_not_given, 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_copy_params,
21
+ workspace_share_params,
22
+ workspace_update_params,
23
+ workspace_remove_user_params,
24
+ workspace_create_protected_params,
25
+ )
26
+ from ..._base_client import make_request_options
27
+ from ...types.api.workspace_response import WorkspaceResponse
28
+ from ...types.api.workspace_copy_response import WorkspaceCopyResponse
29
+ from ...types.api.workspace_share_response import WorkspaceShareResponse
30
+ from ...types.api.workspace_delete_response import WorkspaceDeleteResponse
31
+ from ...types.api.workspace_get_tags_response import WorkspaceGetTagsResponse
32
+ from ...types.api.workspace_get_stats_response import WorkspaceGetStatsResponse
33
+ from ...types.api.workspace_get_users_response import WorkspaceGetUsersResponse
34
+ from ...types.api.workspace_remove_user_response import WorkspaceRemoveUserResponse
35
+ from ...types.api.workspace_get_documents_response import WorkspaceGetDocumentsResponse
36
+ from ...types.api.workspace_get_conversations_response import WorkspaceGetConversationsResponse
37
+
38
+ __all__ = ["WorkspaceResource", "AsyncWorkspaceResource"]
39
+
40
+
41
+ class WorkspaceResource(SyncAPIResource):
42
+ @cached_property
43
+ def with_raw_response(self) -> WorkspaceResourceWithRawResponse:
44
+ """
45
+ This property can be used as a prefix for any HTTP method call to return
46
+ the raw response object instead of the parsed content.
47
+
48
+ For more information, see https://www.github.com/arbitrationcity/arbi-python#accessing-raw-response-data-eg-headers
49
+ """
50
+ return WorkspaceResourceWithRawResponse(self)
51
+
52
+ @cached_property
53
+ def with_streaming_response(self) -> WorkspaceResourceWithStreamingResponse:
54
+ """
55
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
56
+
57
+ For more information, see https://www.github.com/arbitrationcity/arbi-python#with_streaming_response
58
+ """
59
+ return WorkspaceResourceWithStreamingResponse(self)
60
+
61
+ def update(
62
+ self,
63
+ workspace_ext_id: str,
64
+ *,
65
+ description: Optional[str] | Omit = omit,
66
+ is_public: Optional[bool] | Omit = omit,
67
+ name: Optional[str] | Omit = omit,
68
+ workspace_key: str | Omit = omit,
69
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
70
+ # The extra values given here take precedence over values defined on the client or passed to this method.
71
+ extra_headers: Headers | None = None,
72
+ extra_query: Query | None = None,
73
+ extra_body: Body | None = None,
74
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
75
+ ) -> WorkspaceResponse:
76
+ """Update workspace metadata such as name, description, or public status.
77
+
78
+ Changes
79
+ are persisted to the database.
80
+
81
+ Only developers can change the is_public field. When making a workspace public,
82
+ the backend uses the Workspace-Key header to get the workspace key.
83
+
84
+ Args:
85
+ extra_headers: Send extra headers
86
+
87
+ extra_query: Add additional query parameters to the request
88
+
89
+ extra_body: Add additional JSON properties to the request
90
+
91
+ timeout: Override the client-level default timeout for this request, in seconds
92
+ """
93
+ if not workspace_ext_id:
94
+ raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
95
+ extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
96
+ return self._patch(
97
+ f"/api/workspace/{workspace_ext_id}",
98
+ body=maybe_transform(
99
+ {
100
+ "description": description,
101
+ "is_public": is_public,
102
+ "name": name,
103
+ },
104
+ workspace_update_params.WorkspaceUpdateParams,
105
+ ),
106
+ options=make_request_options(
107
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
108
+ ),
109
+ cast_to=WorkspaceResponse,
110
+ )
111
+
112
+ def delete(
113
+ self,
114
+ workspace_ext_id: str,
115
+ *,
116
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
117
+ # The extra values given here take precedence over values defined on the client or passed to this method.
118
+ extra_headers: Headers | None = None,
119
+ extra_query: Query | None = None,
120
+ extra_body: Body | None = None,
121
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
122
+ ) -> WorkspaceDeleteResponse:
123
+ """Delete a workspace.
124
+
125
+ Only the creator of the workspace is allowed to delete it.
126
+
127
+ If the workspace
128
+ deletion fails (e.g., due to RLS policy), the operation aborts.
129
+
130
+ Args:
131
+ extra_headers: Send extra headers
132
+
133
+ extra_query: Add additional query parameters to the request
134
+
135
+ extra_body: Add additional JSON properties to the request
136
+
137
+ timeout: Override the client-level default timeout for this request, in seconds
138
+ """
139
+ if not workspace_ext_id:
140
+ raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
141
+ return self._delete(
142
+ f"/api/workspace/{workspace_ext_id}",
143
+ options=make_request_options(
144
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
145
+ ),
146
+ cast_to=WorkspaceDeleteResponse,
147
+ )
148
+
149
+ def copy(
150
+ self,
151
+ workspace_ext_id: str,
152
+ *,
153
+ items: SequenceNotStr[str],
154
+ target_workspace_ext_id: str,
155
+ target_workspace_key: str | Omit = omit,
156
+ workspace_key: str | Omit = omit,
157
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
158
+ # The extra values given here take precedence over values defined on the client or passed to this method.
159
+ extra_headers: Headers | None = None,
160
+ extra_query: Query | None = None,
161
+ extra_body: Body | None = None,
162
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
163
+ ) -> WorkspaceCopyResponse:
164
+ """
165
+ Copy documents from source workspace to target workspace.
166
+
167
+ Requires:
168
+
169
+ - User must have access to source workspace (RLS enforced)
170
+ - Target workspace must exist and user must have access
171
+ - Workspace-Key header with source workspace key (optional for public
172
+ workspaces, required for private)
173
+ - Target-Workspace-Key header with target workspace key (required)
174
+
175
+ Copies:
176
+
177
+ - Document metadata (title, doc_date, shared status, etc.)
178
+ - MinIO encrypted files (downloaded to server memory, re-encrypted, uploaded)
179
+ - Qdrant vectors (with updated doc_ext_id and chunk_ext_id references)
180
+
181
+ Args:
182
+ items: List of document external IDs to copy (e.g., ['doc-a1b2c3d4', 'doc-e5f6g7h8'])
183
+
184
+ extra_headers: Send extra headers
185
+
186
+ extra_query: Add additional query parameters to the request
187
+
188
+ extra_body: Add additional JSON properties to the request
189
+
190
+ timeout: Override the client-level default timeout for this request, in seconds
191
+ """
192
+ if not workspace_ext_id:
193
+ raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
194
+ extra_headers = {
195
+ **strip_not_given(
196
+ {
197
+ "target-workspace-key": target_workspace_key,
198
+ "workspace-key": workspace_key,
199
+ }
200
+ ),
201
+ **(extra_headers or {}),
202
+ }
203
+ return self._post(
204
+ f"/api/workspace/{workspace_ext_id}/copy",
205
+ body=maybe_transform(
206
+ {
207
+ "items": items,
208
+ "target_workspace_ext_id": target_workspace_ext_id,
209
+ },
210
+ workspace_copy_params.WorkspaceCopyParams,
211
+ ),
212
+ options=make_request_options(
213
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
214
+ ),
215
+ cast_to=WorkspaceCopyResponse,
216
+ )
217
+
218
+ def create_protected(
219
+ self,
220
+ *,
221
+ name: str,
222
+ description: Optional[str] | Omit = omit,
223
+ is_public: bool | Omit = omit,
224
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
225
+ # The extra values given here take precedence over values defined on the client or passed to this method.
226
+ extra_headers: Headers | None = None,
227
+ extra_query: Query | None = None,
228
+ extra_body: Body | None = None,
229
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
230
+ ) -> WorkspaceResponse:
231
+ """Create a new workspace with encryption and access controls.
232
+
233
+ Sets up vector
234
+ storage and associates the creator as the initial workspace user.
235
+
236
+ Server generates the workspace symmetric key and wraps it with the user's public
237
+ key. The wrapped key is returned in the response for client-side storage.
238
+
239
+ Public workspaces are visible to all users and grant non-members limited access:
240
+
241
+ - Non-members can view shared documents and tags
242
+ - Non-members can create conversations and send messages
243
+ - Only members can upload documents
244
+ - Only members can see the member list
245
+
246
+ Only users with developer flag can create public workspaces.
247
+
248
+ Args:
249
+ extra_headers: Send extra headers
250
+
251
+ extra_query: Add additional query parameters to the request
252
+
253
+ extra_body: Add additional JSON properties to the request
254
+
255
+ timeout: Override the client-level default timeout for this request, in seconds
256
+ """
257
+ return self._post(
258
+ "/api/workspace/create_protected",
259
+ body=maybe_transform(
260
+ {
261
+ "name": name,
262
+ "description": description,
263
+ "is_public": is_public,
264
+ },
265
+ workspace_create_protected_params.WorkspaceCreateProtectedParams,
266
+ ),
267
+ options=make_request_options(
268
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
269
+ ),
270
+ cast_to=WorkspaceResponse,
271
+ )
272
+
273
+ def get_conversations(
274
+ self,
275
+ workspace_ext_id: str,
276
+ *,
277
+ workspace_key: str | Omit = omit,
278
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
279
+ # The extra values given here take precedence over values defined on the client or passed to this method.
280
+ extra_headers: Headers | None = None,
281
+ extra_query: Query | None = None,
282
+ extra_body: Body | None = None,
283
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
284
+ ) -> WorkspaceGetConversationsResponse:
285
+ """
286
+ Retrieve conversations for a workspace where the current user is:
287
+
288
+ - The creator of the conversation, or
289
+ - Listed in the ConvoUsers table.
290
+
291
+ Return conversation metadata including:
292
+
293
+ - External ID
294
+ - Title
295
+ - Last updated date
296
+ - Number of messages
297
+ - Whether the current user is the creator
298
+
299
+ Args:
300
+ extra_headers: Send extra headers
301
+
302
+ extra_query: Add additional query parameters to the request
303
+
304
+ extra_body: Add additional JSON properties to the request
305
+
306
+ timeout: Override the client-level default timeout for this request, in seconds
307
+ """
308
+ if not workspace_ext_id:
309
+ raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
310
+ extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
311
+ return self._get(
312
+ f"/api/workspace/{workspace_ext_id}/conversations",
313
+ options=make_request_options(
314
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
315
+ ),
316
+ cast_to=WorkspaceGetConversationsResponse,
317
+ )
318
+
319
+ def get_documents(
320
+ self,
321
+ workspace_ext_id: str,
322
+ *,
323
+ workspace_key: str | Omit = omit,
324
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
325
+ # The extra values given here take precedence over values defined on the client or passed to this method.
326
+ extra_headers: Headers | None = None,
327
+ extra_query: Query | None = None,
328
+ extra_body: Body | None = None,
329
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
330
+ ) -> WorkspaceGetDocumentsResponse:
331
+ """Retrieve all documents in a workspace with proper access controls.
332
+
333
+ Decrypts
334
+ document metadata for authorized users.
335
+
336
+ Args:
337
+ extra_headers: Send extra headers
338
+
339
+ extra_query: Add additional query parameters to the request
340
+
341
+ extra_body: Add additional JSON properties to the request
342
+
343
+ timeout: Override the client-level default timeout for this request, in seconds
344
+ """
345
+ if not workspace_ext_id:
346
+ raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
347
+ extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
348
+ return self._get(
349
+ f"/api/workspace/{workspace_ext_id}/documents",
350
+ options=make_request_options(
351
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
352
+ ),
353
+ cast_to=WorkspaceGetDocumentsResponse,
354
+ )
355
+
356
+ def get_stats(
357
+ self,
358
+ workspace_ext_id: str,
359
+ *,
360
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
361
+ # The extra values given here take precedence over values defined on the client or passed to this method.
362
+ extra_headers: Headers | None = None,
363
+ extra_query: Query | None = None,
364
+ extra_body: Body | None = None,
365
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
366
+ ) -> WorkspaceGetStatsResponse:
367
+ """
368
+ Retrieves conversation and document counts with shared/private breakdown for a
369
+ specific workspace.
370
+
371
+ - Conversations are "shared" if they have at least one shared message
372
+ - Documents are "shared" if their shared field is True
373
+
374
+ Args:
375
+ extra_headers: Send extra headers
376
+
377
+ extra_query: Add additional query parameters to the request
378
+
379
+ extra_body: Add additional JSON properties to the request
380
+
381
+ timeout: Override the client-level default timeout for this request, in seconds
382
+ """
383
+ if not workspace_ext_id:
384
+ raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
385
+ return self._get(
386
+ f"/api/workspace/{workspace_ext_id}/stats",
387
+ options=make_request_options(
388
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
389
+ ),
390
+ cast_to=WorkspaceGetStatsResponse,
391
+ )
392
+
393
+ def get_tags(
394
+ self,
395
+ workspace_ext_id: str,
396
+ *,
397
+ workspace_key: str | Omit = omit,
398
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
399
+ # The extra values given here take precedence over values defined on the client or passed to this method.
400
+ extra_headers: Headers | None = None,
401
+ extra_query: Query | None = None,
402
+ extra_body: Body | None = None,
403
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
404
+ ) -> WorkspaceGetTagsResponse:
405
+ """
406
+ Get all tags in a given workspace created by the current user.
407
+
408
+ Args:
409
+ extra_headers: Send extra headers
410
+
411
+ extra_query: Add additional query parameters to the request
412
+
413
+ extra_body: Add additional JSON properties to the request
414
+
415
+ timeout: Override the client-level default timeout for this request, in seconds
416
+ """
417
+ if not workspace_ext_id:
418
+ raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
419
+ extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
420
+ return self._get(
421
+ f"/api/workspace/{workspace_ext_id}/tags",
422
+ options=make_request_options(
423
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
424
+ ),
425
+ cast_to=WorkspaceGetTagsResponse,
426
+ )
427
+
428
+ def get_users(
429
+ self,
430
+ workspace_ext_id: str,
431
+ *,
432
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
433
+ # The extra values given here take precedence over values defined on the client or passed to this method.
434
+ extra_headers: Headers | None = None,
435
+ extra_query: Query | None = None,
436
+ extra_body: Body | None = None,
437
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
438
+ ) -> WorkspaceGetUsersResponse:
439
+ """Retrieve users with access to a specific workspace.
440
+
441
+ RLS handles access control:
442
+ members can view private workspaces, anyone can view public workspaces.
443
+
444
+ Args:
445
+ extra_headers: Send extra headers
446
+
447
+ extra_query: Add additional query parameters to the request
448
+
449
+ extra_body: Add additional JSON properties to the request
450
+
451
+ timeout: Override the client-level default timeout for this request, in seconds
452
+ """
453
+ if not workspace_ext_id:
454
+ raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
455
+ return self._get(
456
+ f"/api/workspace/{workspace_ext_id}/users",
457
+ options=make_request_options(
458
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
459
+ ),
460
+ cast_to=WorkspaceGetUsersResponse,
461
+ )
462
+
463
+ def remove_user(
464
+ self,
465
+ workspace_ext_id: str,
466
+ *,
467
+ user_ext_id: str,
468
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
469
+ # The extra values given here take precedence over values defined on the client or passed to this method.
470
+ extra_headers: Headers | None = None,
471
+ extra_query: Query | None = None,
472
+ extra_body: Body | None = None,
473
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
474
+ ) -> WorkspaceRemoveUserResponse:
475
+ """
476
+ Remove a user from a workspace.
477
+
478
+ RLS ensures the user can only modify workspaces they have access to.
479
+
480
+ Args:
481
+ extra_headers: Send extra headers
482
+
483
+ extra_query: Add additional query parameters to the request
484
+
485
+ extra_body: Add additional JSON properties to the request
486
+
487
+ timeout: Override the client-level default timeout for this request, in seconds
488
+ """
489
+ if not workspace_ext_id:
490
+ raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
491
+ return self._delete(
492
+ f"/api/workspace/{workspace_ext_id}/user",
493
+ body=maybe_transform({"user_ext_id": user_ext_id}, workspace_remove_user_params.WorkspaceRemoveUserParams),
494
+ options=make_request_options(
495
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
496
+ ),
497
+ cast_to=WorkspaceRemoveUserResponse,
498
+ )
499
+
500
+ def share(
501
+ self,
502
+ workspace_ext_id: str,
503
+ *,
504
+ recipient_email: str,
505
+ workspace_key: str | Omit = omit,
506
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
507
+ # The extra values given here take precedence over values defined on the client or passed to this method.
508
+ extra_headers: Headers | None = None,
509
+ extra_query: Query | None = None,
510
+ extra_body: Body | None = None,
511
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
512
+ ) -> WorkspaceShareResponse:
513
+ """
514
+ Share a workspace with another user via their email address.
515
+
516
+ Client provides SealedBox-encrypted workspace key via Workspace-Key header.
517
+ Server decrypts it using session key, then wraps it with recipient's public key.
518
+
519
+ Args:
520
+ extra_headers: Send extra headers
521
+
522
+ extra_query: Add additional query parameters to the request
523
+
524
+ extra_body: Add additional JSON properties to the request
525
+
526
+ timeout: Override the client-level default timeout for this request, in seconds
527
+ """
528
+ if not workspace_ext_id:
529
+ raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
530
+ extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
531
+ return self._post(
532
+ f"/api/workspace/{workspace_ext_id}/share",
533
+ body=maybe_transform({"recipient_email": recipient_email}, workspace_share_params.WorkspaceShareParams),
534
+ options=make_request_options(
535
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
536
+ ),
537
+ cast_to=WorkspaceShareResponse,
538
+ )
539
+
540
+
541
+ class AsyncWorkspaceResource(AsyncAPIResource):
542
+ @cached_property
543
+ def with_raw_response(self) -> AsyncWorkspaceResourceWithRawResponse:
544
+ """
545
+ This property can be used as a prefix for any HTTP method call to return
546
+ the raw response object instead of the parsed content.
547
+
548
+ For more information, see https://www.github.com/arbitrationcity/arbi-python#accessing-raw-response-data-eg-headers
549
+ """
550
+ return AsyncWorkspaceResourceWithRawResponse(self)
551
+
552
+ @cached_property
553
+ def with_streaming_response(self) -> AsyncWorkspaceResourceWithStreamingResponse:
554
+ """
555
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
556
+
557
+ For more information, see https://www.github.com/arbitrationcity/arbi-python#with_streaming_response
558
+ """
559
+ return AsyncWorkspaceResourceWithStreamingResponse(self)
560
+
561
+ async def update(
562
+ self,
563
+ workspace_ext_id: str,
564
+ *,
565
+ description: Optional[str] | Omit = omit,
566
+ is_public: Optional[bool] | Omit = omit,
567
+ name: Optional[str] | Omit = omit,
568
+ workspace_key: str | Omit = omit,
569
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
570
+ # The extra values given here take precedence over values defined on the client or passed to this method.
571
+ extra_headers: Headers | None = None,
572
+ extra_query: Query | None = None,
573
+ extra_body: Body | None = None,
574
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
575
+ ) -> WorkspaceResponse:
576
+ """Update workspace metadata such as name, description, or public status.
577
+
578
+ Changes
579
+ are persisted to the database.
580
+
581
+ Only developers can change the is_public field. When making a workspace public,
582
+ the backend uses the Workspace-Key header to get the workspace key.
583
+
584
+ Args:
585
+ extra_headers: Send extra headers
586
+
587
+ extra_query: Add additional query parameters to the request
588
+
589
+ extra_body: Add additional JSON properties to the request
590
+
591
+ timeout: Override the client-level default timeout for this request, in seconds
592
+ """
593
+ if not workspace_ext_id:
594
+ raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
595
+ extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
596
+ return await self._patch(
597
+ f"/api/workspace/{workspace_ext_id}",
598
+ body=await async_maybe_transform(
599
+ {
600
+ "description": description,
601
+ "is_public": is_public,
602
+ "name": name,
603
+ },
604
+ workspace_update_params.WorkspaceUpdateParams,
605
+ ),
606
+ options=make_request_options(
607
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
608
+ ),
609
+ cast_to=WorkspaceResponse,
610
+ )
611
+
612
+ async def delete(
613
+ self,
614
+ workspace_ext_id: str,
615
+ *,
616
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
617
+ # The extra values given here take precedence over values defined on the client or passed to this method.
618
+ extra_headers: Headers | None = None,
619
+ extra_query: Query | None = None,
620
+ extra_body: Body | None = None,
621
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
622
+ ) -> WorkspaceDeleteResponse:
623
+ """Delete a workspace.
624
+
625
+ Only the creator of the workspace is allowed to delete it.
626
+
627
+ If the workspace
628
+ deletion fails (e.g., due to RLS policy), the operation aborts.
629
+
630
+ Args:
631
+ extra_headers: Send extra headers
632
+
633
+ extra_query: Add additional query parameters to the request
634
+
635
+ extra_body: Add additional JSON properties to the request
636
+
637
+ timeout: Override the client-level default timeout for this request, in seconds
638
+ """
639
+ if not workspace_ext_id:
640
+ raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
641
+ return await self._delete(
642
+ f"/api/workspace/{workspace_ext_id}",
643
+ options=make_request_options(
644
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
645
+ ),
646
+ cast_to=WorkspaceDeleteResponse,
647
+ )
648
+
649
+ async def copy(
650
+ self,
651
+ workspace_ext_id: str,
652
+ *,
653
+ items: SequenceNotStr[str],
654
+ target_workspace_ext_id: str,
655
+ target_workspace_key: str | Omit = omit,
656
+ workspace_key: str | Omit = omit,
657
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
658
+ # The extra values given here take precedence over values defined on the client or passed to this method.
659
+ extra_headers: Headers | None = None,
660
+ extra_query: Query | None = None,
661
+ extra_body: Body | None = None,
662
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
663
+ ) -> WorkspaceCopyResponse:
664
+ """
665
+ Copy documents from source workspace to target workspace.
666
+
667
+ Requires:
668
+
669
+ - User must have access to source workspace (RLS enforced)
670
+ - Target workspace must exist and user must have access
671
+ - Workspace-Key header with source workspace key (optional for public
672
+ workspaces, required for private)
673
+ - Target-Workspace-Key header with target workspace key (required)
674
+
675
+ Copies:
676
+
677
+ - Document metadata (title, doc_date, shared status, etc.)
678
+ - MinIO encrypted files (downloaded to server memory, re-encrypted, uploaded)
679
+ - Qdrant vectors (with updated doc_ext_id and chunk_ext_id references)
680
+
681
+ Args:
682
+ items: List of document external IDs to copy (e.g., ['doc-a1b2c3d4', 'doc-e5f6g7h8'])
683
+
684
+ extra_headers: Send extra headers
685
+
686
+ extra_query: Add additional query parameters to the request
687
+
688
+ extra_body: Add additional JSON properties to the request
689
+
690
+ timeout: Override the client-level default timeout for this request, in seconds
691
+ """
692
+ if not workspace_ext_id:
693
+ raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
694
+ extra_headers = {
695
+ **strip_not_given(
696
+ {
697
+ "target-workspace-key": target_workspace_key,
698
+ "workspace-key": workspace_key,
699
+ }
700
+ ),
701
+ **(extra_headers or {}),
702
+ }
703
+ return await self._post(
704
+ f"/api/workspace/{workspace_ext_id}/copy",
705
+ body=await async_maybe_transform(
706
+ {
707
+ "items": items,
708
+ "target_workspace_ext_id": target_workspace_ext_id,
709
+ },
710
+ workspace_copy_params.WorkspaceCopyParams,
711
+ ),
712
+ options=make_request_options(
713
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
714
+ ),
715
+ cast_to=WorkspaceCopyResponse,
716
+ )
717
+
718
+ async def create_protected(
719
+ self,
720
+ *,
721
+ name: str,
722
+ description: Optional[str] | Omit = omit,
723
+ is_public: bool | Omit = omit,
724
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
725
+ # The extra values given here take precedence over values defined on the client or passed to this method.
726
+ extra_headers: Headers | None = None,
727
+ extra_query: Query | None = None,
728
+ extra_body: Body | None = None,
729
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
730
+ ) -> WorkspaceResponse:
731
+ """Create a new workspace with encryption and access controls.
732
+
733
+ Sets up vector
734
+ storage and associates the creator as the initial workspace user.
735
+
736
+ Server generates the workspace symmetric key and wraps it with the user's public
737
+ key. The wrapped key is returned in the response for client-side storage.
738
+
739
+ Public workspaces are visible to all users and grant non-members limited access:
740
+
741
+ - Non-members can view shared documents and tags
742
+ - Non-members can create conversations and send messages
743
+ - Only members can upload documents
744
+ - Only members can see the member list
745
+
746
+ Only users with developer flag can create public workspaces.
747
+
748
+ Args:
749
+ extra_headers: Send extra headers
750
+
751
+ extra_query: Add additional query parameters to the request
752
+
753
+ extra_body: Add additional JSON properties to the request
754
+
755
+ timeout: Override the client-level default timeout for this request, in seconds
756
+ """
757
+ return await self._post(
758
+ "/api/workspace/create_protected",
759
+ body=await async_maybe_transform(
760
+ {
761
+ "name": name,
762
+ "description": description,
763
+ "is_public": is_public,
764
+ },
765
+ workspace_create_protected_params.WorkspaceCreateProtectedParams,
766
+ ),
767
+ options=make_request_options(
768
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
769
+ ),
770
+ cast_to=WorkspaceResponse,
771
+ )
772
+
773
+ async def get_conversations(
774
+ self,
775
+ workspace_ext_id: str,
776
+ *,
777
+ workspace_key: str | Omit = omit,
778
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
779
+ # The extra values given here take precedence over values defined on the client or passed to this method.
780
+ extra_headers: Headers | None = None,
781
+ extra_query: Query | None = None,
782
+ extra_body: Body | None = None,
783
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
784
+ ) -> WorkspaceGetConversationsResponse:
785
+ """
786
+ Retrieve conversations for a workspace where the current user is:
787
+
788
+ - The creator of the conversation, or
789
+ - Listed in the ConvoUsers table.
790
+
791
+ Return conversation metadata including:
792
+
793
+ - External ID
794
+ - Title
795
+ - Last updated date
796
+ - Number of messages
797
+ - Whether the current user is the creator
798
+
799
+ Args:
800
+ extra_headers: Send extra headers
801
+
802
+ extra_query: Add additional query parameters to the request
803
+
804
+ extra_body: Add additional JSON properties to the request
805
+
806
+ timeout: Override the client-level default timeout for this request, in seconds
807
+ """
808
+ if not workspace_ext_id:
809
+ raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
810
+ extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
811
+ return await self._get(
812
+ f"/api/workspace/{workspace_ext_id}/conversations",
813
+ options=make_request_options(
814
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
815
+ ),
816
+ cast_to=WorkspaceGetConversationsResponse,
817
+ )
818
+
819
+ async def get_documents(
820
+ self,
821
+ workspace_ext_id: str,
822
+ *,
823
+ workspace_key: str | Omit = omit,
824
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
825
+ # The extra values given here take precedence over values defined on the client or passed to this method.
826
+ extra_headers: Headers | None = None,
827
+ extra_query: Query | None = None,
828
+ extra_body: Body | None = None,
829
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
830
+ ) -> WorkspaceGetDocumentsResponse:
831
+ """Retrieve all documents in a workspace with proper access controls.
832
+
833
+ Decrypts
834
+ document metadata for authorized users.
835
+
836
+ Args:
837
+ extra_headers: Send extra headers
838
+
839
+ extra_query: Add additional query parameters to the request
840
+
841
+ extra_body: Add additional JSON properties to the request
842
+
843
+ timeout: Override the client-level default timeout for this request, in seconds
844
+ """
845
+ if not workspace_ext_id:
846
+ raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
847
+ extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
848
+ return await self._get(
849
+ f"/api/workspace/{workspace_ext_id}/documents",
850
+ options=make_request_options(
851
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
852
+ ),
853
+ cast_to=WorkspaceGetDocumentsResponse,
854
+ )
855
+
856
+ async def get_stats(
857
+ self,
858
+ workspace_ext_id: str,
859
+ *,
860
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
861
+ # The extra values given here take precedence over values defined on the client or passed to this method.
862
+ extra_headers: Headers | None = None,
863
+ extra_query: Query | None = None,
864
+ extra_body: Body | None = None,
865
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
866
+ ) -> WorkspaceGetStatsResponse:
867
+ """
868
+ Retrieves conversation and document counts with shared/private breakdown for a
869
+ specific workspace.
870
+
871
+ - Conversations are "shared" if they have at least one shared message
872
+ - Documents are "shared" if their shared field is True
873
+
874
+ Args:
875
+ extra_headers: Send extra headers
876
+
877
+ extra_query: Add additional query parameters to the request
878
+
879
+ extra_body: Add additional JSON properties to the request
880
+
881
+ timeout: Override the client-level default timeout for this request, in seconds
882
+ """
883
+ if not workspace_ext_id:
884
+ raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
885
+ return await self._get(
886
+ f"/api/workspace/{workspace_ext_id}/stats",
887
+ options=make_request_options(
888
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
889
+ ),
890
+ cast_to=WorkspaceGetStatsResponse,
891
+ )
892
+
893
+ async def get_tags(
894
+ self,
895
+ workspace_ext_id: str,
896
+ *,
897
+ workspace_key: str | Omit = omit,
898
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
899
+ # The extra values given here take precedence over values defined on the client or passed to this method.
900
+ extra_headers: Headers | None = None,
901
+ extra_query: Query | None = None,
902
+ extra_body: Body | None = None,
903
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
904
+ ) -> WorkspaceGetTagsResponse:
905
+ """
906
+ Get all tags in a given workspace created by the current user.
907
+
908
+ Args:
909
+ extra_headers: Send extra headers
910
+
911
+ extra_query: Add additional query parameters to the request
912
+
913
+ extra_body: Add additional JSON properties to the request
914
+
915
+ timeout: Override the client-level default timeout for this request, in seconds
916
+ """
917
+ if not workspace_ext_id:
918
+ raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
919
+ extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
920
+ return await self._get(
921
+ f"/api/workspace/{workspace_ext_id}/tags",
922
+ options=make_request_options(
923
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
924
+ ),
925
+ cast_to=WorkspaceGetTagsResponse,
926
+ )
927
+
928
+ async def get_users(
929
+ self,
930
+ workspace_ext_id: str,
931
+ *,
932
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
933
+ # The extra values given here take precedence over values defined on the client or passed to this method.
934
+ extra_headers: Headers | None = None,
935
+ extra_query: Query | None = None,
936
+ extra_body: Body | None = None,
937
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
938
+ ) -> WorkspaceGetUsersResponse:
939
+ """Retrieve users with access to a specific workspace.
940
+
941
+ RLS handles access control:
942
+ members can view private workspaces, anyone can view public workspaces.
943
+
944
+ Args:
945
+ extra_headers: Send extra headers
946
+
947
+ extra_query: Add additional query parameters to the request
948
+
949
+ extra_body: Add additional JSON properties to the request
950
+
951
+ timeout: Override the client-level default timeout for this request, in seconds
952
+ """
953
+ if not workspace_ext_id:
954
+ raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
955
+ return await self._get(
956
+ f"/api/workspace/{workspace_ext_id}/users",
957
+ options=make_request_options(
958
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
959
+ ),
960
+ cast_to=WorkspaceGetUsersResponse,
961
+ )
962
+
963
+ async def remove_user(
964
+ self,
965
+ workspace_ext_id: str,
966
+ *,
967
+ user_ext_id: str,
968
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
969
+ # The extra values given here take precedence over values defined on the client or passed to this method.
970
+ extra_headers: Headers | None = None,
971
+ extra_query: Query | None = None,
972
+ extra_body: Body | None = None,
973
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
974
+ ) -> WorkspaceRemoveUserResponse:
975
+ """
976
+ Remove a user from a workspace.
977
+
978
+ RLS ensures the user can only modify workspaces they have access to.
979
+
980
+ Args:
981
+ extra_headers: Send extra headers
982
+
983
+ extra_query: Add additional query parameters to the request
984
+
985
+ extra_body: Add additional JSON properties to the request
986
+
987
+ timeout: Override the client-level default timeout for this request, in seconds
988
+ """
989
+ if not workspace_ext_id:
990
+ raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
991
+ return await self._delete(
992
+ f"/api/workspace/{workspace_ext_id}/user",
993
+ body=await async_maybe_transform(
994
+ {"user_ext_id": user_ext_id}, workspace_remove_user_params.WorkspaceRemoveUserParams
995
+ ),
996
+ options=make_request_options(
997
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
998
+ ),
999
+ cast_to=WorkspaceRemoveUserResponse,
1000
+ )
1001
+
1002
+ async def share(
1003
+ self,
1004
+ workspace_ext_id: str,
1005
+ *,
1006
+ recipient_email: str,
1007
+ workspace_key: str | Omit = omit,
1008
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1009
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1010
+ extra_headers: Headers | None = None,
1011
+ extra_query: Query | None = None,
1012
+ extra_body: Body | None = None,
1013
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1014
+ ) -> WorkspaceShareResponse:
1015
+ """
1016
+ Share a workspace with another user via their email address.
1017
+
1018
+ Client provides SealedBox-encrypted workspace key via Workspace-Key header.
1019
+ Server decrypts it using session key, then wraps it with recipient's public key.
1020
+
1021
+ Args:
1022
+ extra_headers: Send extra headers
1023
+
1024
+ extra_query: Add additional query parameters to the request
1025
+
1026
+ extra_body: Add additional JSON properties to the request
1027
+
1028
+ timeout: Override the client-level default timeout for this request, in seconds
1029
+ """
1030
+ if not workspace_ext_id:
1031
+ raise ValueError(f"Expected a non-empty value for `workspace_ext_id` but received {workspace_ext_id!r}")
1032
+ extra_headers = {**strip_not_given({"workspace-key": workspace_key}), **(extra_headers or {})}
1033
+ return await self._post(
1034
+ f"/api/workspace/{workspace_ext_id}/share",
1035
+ body=await async_maybe_transform(
1036
+ {"recipient_email": recipient_email}, workspace_share_params.WorkspaceShareParams
1037
+ ),
1038
+ options=make_request_options(
1039
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1040
+ ),
1041
+ cast_to=WorkspaceShareResponse,
1042
+ )
1043
+
1044
+
1045
+ class WorkspaceResourceWithRawResponse:
1046
+ def __init__(self, workspace: WorkspaceResource) -> None:
1047
+ self._workspace = workspace
1048
+
1049
+ self.update = to_raw_response_wrapper(
1050
+ workspace.update,
1051
+ )
1052
+ self.delete = to_raw_response_wrapper(
1053
+ workspace.delete,
1054
+ )
1055
+ self.copy = to_raw_response_wrapper(
1056
+ workspace.copy,
1057
+ )
1058
+ self.create_protected = to_raw_response_wrapper(
1059
+ workspace.create_protected,
1060
+ )
1061
+ self.get_conversations = to_raw_response_wrapper(
1062
+ workspace.get_conversations,
1063
+ )
1064
+ self.get_documents = to_raw_response_wrapper(
1065
+ workspace.get_documents,
1066
+ )
1067
+ self.get_stats = to_raw_response_wrapper(
1068
+ workspace.get_stats,
1069
+ )
1070
+ self.get_tags = to_raw_response_wrapper(
1071
+ workspace.get_tags,
1072
+ )
1073
+ self.get_users = to_raw_response_wrapper(
1074
+ workspace.get_users,
1075
+ )
1076
+ self.remove_user = to_raw_response_wrapper(
1077
+ workspace.remove_user,
1078
+ )
1079
+ self.share = to_raw_response_wrapper(
1080
+ workspace.share,
1081
+ )
1082
+
1083
+
1084
+ class AsyncWorkspaceResourceWithRawResponse:
1085
+ def __init__(self, workspace: AsyncWorkspaceResource) -> None:
1086
+ self._workspace = workspace
1087
+
1088
+ self.update = async_to_raw_response_wrapper(
1089
+ workspace.update,
1090
+ )
1091
+ self.delete = async_to_raw_response_wrapper(
1092
+ workspace.delete,
1093
+ )
1094
+ self.copy = async_to_raw_response_wrapper(
1095
+ workspace.copy,
1096
+ )
1097
+ self.create_protected = async_to_raw_response_wrapper(
1098
+ workspace.create_protected,
1099
+ )
1100
+ self.get_conversations = async_to_raw_response_wrapper(
1101
+ workspace.get_conversations,
1102
+ )
1103
+ self.get_documents = async_to_raw_response_wrapper(
1104
+ workspace.get_documents,
1105
+ )
1106
+ self.get_stats = async_to_raw_response_wrapper(
1107
+ workspace.get_stats,
1108
+ )
1109
+ self.get_tags = async_to_raw_response_wrapper(
1110
+ workspace.get_tags,
1111
+ )
1112
+ self.get_users = async_to_raw_response_wrapper(
1113
+ workspace.get_users,
1114
+ )
1115
+ self.remove_user = async_to_raw_response_wrapper(
1116
+ workspace.remove_user,
1117
+ )
1118
+ self.share = async_to_raw_response_wrapper(
1119
+ workspace.share,
1120
+ )
1121
+
1122
+
1123
+ class WorkspaceResourceWithStreamingResponse:
1124
+ def __init__(self, workspace: WorkspaceResource) -> None:
1125
+ self._workspace = workspace
1126
+
1127
+ self.update = to_streamed_response_wrapper(
1128
+ workspace.update,
1129
+ )
1130
+ self.delete = to_streamed_response_wrapper(
1131
+ workspace.delete,
1132
+ )
1133
+ self.copy = to_streamed_response_wrapper(
1134
+ workspace.copy,
1135
+ )
1136
+ self.create_protected = to_streamed_response_wrapper(
1137
+ workspace.create_protected,
1138
+ )
1139
+ self.get_conversations = to_streamed_response_wrapper(
1140
+ workspace.get_conversations,
1141
+ )
1142
+ self.get_documents = to_streamed_response_wrapper(
1143
+ workspace.get_documents,
1144
+ )
1145
+ self.get_stats = to_streamed_response_wrapper(
1146
+ workspace.get_stats,
1147
+ )
1148
+ self.get_tags = to_streamed_response_wrapper(
1149
+ workspace.get_tags,
1150
+ )
1151
+ self.get_users = to_streamed_response_wrapper(
1152
+ workspace.get_users,
1153
+ )
1154
+ self.remove_user = to_streamed_response_wrapper(
1155
+ workspace.remove_user,
1156
+ )
1157
+ self.share = to_streamed_response_wrapper(
1158
+ workspace.share,
1159
+ )
1160
+
1161
+
1162
+ class AsyncWorkspaceResourceWithStreamingResponse:
1163
+ def __init__(self, workspace: AsyncWorkspaceResource) -> None:
1164
+ self._workspace = workspace
1165
+
1166
+ self.update = async_to_streamed_response_wrapper(
1167
+ workspace.update,
1168
+ )
1169
+ self.delete = async_to_streamed_response_wrapper(
1170
+ workspace.delete,
1171
+ )
1172
+ self.copy = async_to_streamed_response_wrapper(
1173
+ workspace.copy,
1174
+ )
1175
+ self.create_protected = async_to_streamed_response_wrapper(
1176
+ workspace.create_protected,
1177
+ )
1178
+ self.get_conversations = async_to_streamed_response_wrapper(
1179
+ workspace.get_conversations,
1180
+ )
1181
+ self.get_documents = async_to_streamed_response_wrapper(
1182
+ workspace.get_documents,
1183
+ )
1184
+ self.get_stats = async_to_streamed_response_wrapper(
1185
+ workspace.get_stats,
1186
+ )
1187
+ self.get_tags = async_to_streamed_response_wrapper(
1188
+ workspace.get_tags,
1189
+ )
1190
+ self.get_users = async_to_streamed_response_wrapper(
1191
+ workspace.get_users,
1192
+ )
1193
+ self.remove_user = async_to_streamed_response_wrapper(
1194
+ workspace.remove_user,
1195
+ )
1196
+ self.share = async_to_streamed_response_wrapper(
1197
+ workspace.share,
1198
+ )