supermemory 3.0.0a2__py3-none-any.whl → 3.0.0a20__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.
- {supermemory-3.0.0a2.dist-info → supermemory-3.0.0a20.dist-info}/METADATA +32 -32
- supermemory-3.0.0a20.dist-info/RECORD +60 -0
- {supermemory → supermemory_new}/__init__.py +2 -2
- {supermemory → supermemory_new}/_base_client.py +1 -1
- {supermemory → supermemory_new}/_client.py +11 -3
- {supermemory → supermemory_new}/_response.py +4 -4
- {supermemory → supermemory_new}/_types.py +1 -1
- {supermemory → supermemory_new}/_utils/_logs.py +2 -2
- {supermemory → supermemory_new}/_utils/_resources_proxy.py +4 -4
- supermemory_new/_version.py +4 -0
- {supermemory → supermemory_new}/resources/__init__.py +14 -0
- supermemory_new/resources/connections.py +728 -0
- {supermemory → supermemory_new}/resources/memories.py +135 -1
- supermemory_new/resources/search.py +300 -0
- supermemory_new/types/__init__.py +30 -0
- supermemory_new/types/connection_delete_by_provider_params.py +15 -0
- supermemory_new/types/connection_delete_by_provider_response.py +11 -0
- supermemory/types/connection_get_response.py → supermemory_new/types/connection_get_by_id_response.py +2 -2
- supermemory_new/types/connection_get_by_tags_params.py +15 -0
- supermemory_new/types/connection_get_by_tags_response.py +25 -0
- supermemory_new/types/connection_import_params.py +15 -0
- supermemory_new/types/connection_list_documents_params.py +15 -0
- supermemory_new/types/connection_list_documents_response.py +29 -0
- supermemory_new/types/connection_list_params.py +15 -0
- supermemory_new/types/connection_list_response.py +29 -0
- supermemory_new/types/memory_list_params.py +34 -0
- supermemory_new/types/memory_list_response.py +91 -0
- supermemory_new/types/search_execute_params.py +93 -0
- supermemory_new/types/search_execute_response.py +55 -0
- supermemory/_version.py +0 -4
- supermemory/resources/connections.py +0 -273
- supermemory/types/__init__.py +0 -15
- supermemory-3.0.0a2.dist-info/RECORD +0 -46
- {supermemory-3.0.0a2.dist-info → supermemory-3.0.0a20.dist-info}/WHEEL +0 -0
- {supermemory-3.0.0a2.dist-info → supermemory-3.0.0a20.dist-info}/licenses/LICENSE +0 -0
- {supermemory → supermemory_new}/_compat.py +0 -0
- {supermemory → supermemory_new}/_constants.py +0 -0
- {supermemory → supermemory_new}/_exceptions.py +0 -0
- {supermemory → supermemory_new}/_files.py +0 -0
- {supermemory → supermemory_new}/_models.py +0 -0
- {supermemory → supermemory_new}/_qs.py +0 -0
- {supermemory → supermemory_new}/_resource.py +0 -0
- {supermemory → supermemory_new}/_streaming.py +0 -0
- {supermemory → supermemory_new}/_utils/__init__.py +0 -0
- {supermemory → supermemory_new}/_utils/_proxy.py +0 -0
- {supermemory → supermemory_new}/_utils/_reflection.py +0 -0
- {supermemory → supermemory_new}/_utils/_streams.py +0 -0
- {supermemory → supermemory_new}/_utils/_sync.py +0 -0
- {supermemory → supermemory_new}/_utils/_transform.py +0 -0
- {supermemory → supermemory_new}/_utils/_typing.py +0 -0
- {supermemory → supermemory_new}/_utils/_utils.py +0 -0
- {supermemory → supermemory_new}/lib/.keep +0 -0
- {supermemory → supermemory_new}/py.typed +0 -0
- {supermemory → supermemory_new}/resources/settings.py +0 -0
- {supermemory → supermemory_new}/types/connection_create_params.py +0 -0
- {supermemory → supermemory_new}/types/connection_create_response.py +0 -0
- {supermemory → supermemory_new}/types/memory_add_params.py +0 -0
- {supermemory → supermemory_new}/types/memory_add_response.py +0 -0
- {supermemory → supermemory_new}/types/memory_get_response.py +0 -0
- {supermemory → supermemory_new}/types/memory_update_params.py +0 -0
- {supermemory → supermemory_new}/types/memory_update_response.py +0 -0
- {supermemory → supermemory_new}/types/setting_get_response.py +0 -0
- {supermemory → supermemory_new}/types/setting_update_params.py +0 -0
- {supermemory → supermemory_new}/types/setting_update_response.py +0 -0
@@ -0,0 +1,728 @@
|
|
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 Dict, List, Union, Optional
|
6
|
+
from typing_extensions import Literal
|
7
|
+
|
8
|
+
import httpx
|
9
|
+
|
10
|
+
from ..types import (
|
11
|
+
connection_list_params,
|
12
|
+
connection_create_params,
|
13
|
+
connection_import_params,
|
14
|
+
connection_get_by_tags_params,
|
15
|
+
connection_list_documents_params,
|
16
|
+
connection_delete_by_provider_params,
|
17
|
+
)
|
18
|
+
from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
|
19
|
+
from .._utils import maybe_transform, async_maybe_transform
|
20
|
+
from .._compat import cached_property
|
21
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
22
|
+
from .._response import (
|
23
|
+
to_raw_response_wrapper,
|
24
|
+
to_streamed_response_wrapper,
|
25
|
+
async_to_raw_response_wrapper,
|
26
|
+
async_to_streamed_response_wrapper,
|
27
|
+
)
|
28
|
+
from .._base_client import make_request_options
|
29
|
+
from ..types.connection_list_response import ConnectionListResponse
|
30
|
+
from ..types.connection_create_response import ConnectionCreateResponse
|
31
|
+
from ..types.connection_get_by_id_response import ConnectionGetByIDResponse
|
32
|
+
from ..types.connection_get_by_tags_response import ConnectionGetByTagsResponse
|
33
|
+
from ..types.connection_list_documents_response import ConnectionListDocumentsResponse
|
34
|
+
from ..types.connection_delete_by_provider_response import ConnectionDeleteByProviderResponse
|
35
|
+
|
36
|
+
__all__ = ["ConnectionsResource", "AsyncConnectionsResource"]
|
37
|
+
|
38
|
+
|
39
|
+
class ConnectionsResource(SyncAPIResource):
|
40
|
+
@cached_property
|
41
|
+
def with_raw_response(self) -> ConnectionsResourceWithRawResponse:
|
42
|
+
"""
|
43
|
+
This property can be used as a prefix for any HTTP method call to return
|
44
|
+
the raw response object instead of the parsed content.
|
45
|
+
|
46
|
+
For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers
|
47
|
+
"""
|
48
|
+
return ConnectionsResourceWithRawResponse(self)
|
49
|
+
|
50
|
+
@cached_property
|
51
|
+
def with_streaming_response(self) -> ConnectionsResourceWithStreamingResponse:
|
52
|
+
"""
|
53
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
54
|
+
|
55
|
+
For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response
|
56
|
+
"""
|
57
|
+
return ConnectionsResourceWithStreamingResponse(self)
|
58
|
+
|
59
|
+
def create(
|
60
|
+
self,
|
61
|
+
provider: Literal["notion", "google-drive", "onedrive"],
|
62
|
+
*,
|
63
|
+
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
64
|
+
document_limit: int | NotGiven = NOT_GIVEN,
|
65
|
+
metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN,
|
66
|
+
redirect_url: str | NotGiven = NOT_GIVEN,
|
67
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
68
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
69
|
+
extra_headers: Headers | None = None,
|
70
|
+
extra_query: Query | None = None,
|
71
|
+
extra_body: Body | None = None,
|
72
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
73
|
+
) -> ConnectionCreateResponse:
|
74
|
+
"""
|
75
|
+
Initialize connection and get authorization URL
|
76
|
+
|
77
|
+
Args:
|
78
|
+
extra_headers: Send extra headers
|
79
|
+
|
80
|
+
extra_query: Add additional query parameters to the request
|
81
|
+
|
82
|
+
extra_body: Add additional JSON properties to the request
|
83
|
+
|
84
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
85
|
+
"""
|
86
|
+
if not provider:
|
87
|
+
raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}")
|
88
|
+
return self._post(
|
89
|
+
f"/v3/connections/{provider}",
|
90
|
+
body=maybe_transform(
|
91
|
+
{
|
92
|
+
"container_tags": container_tags,
|
93
|
+
"document_limit": document_limit,
|
94
|
+
"metadata": metadata,
|
95
|
+
"redirect_url": redirect_url,
|
96
|
+
},
|
97
|
+
connection_create_params.ConnectionCreateParams,
|
98
|
+
),
|
99
|
+
options=make_request_options(
|
100
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
101
|
+
),
|
102
|
+
cast_to=ConnectionCreateResponse,
|
103
|
+
)
|
104
|
+
|
105
|
+
def list(
|
106
|
+
self,
|
107
|
+
*,
|
108
|
+
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
109
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
110
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
111
|
+
extra_headers: Headers | None = None,
|
112
|
+
extra_query: Query | None = None,
|
113
|
+
extra_body: Body | None = None,
|
114
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
115
|
+
) -> ConnectionListResponse:
|
116
|
+
"""
|
117
|
+
List all connections
|
118
|
+
|
119
|
+
Args:
|
120
|
+
container_tags: Optional comma-separated list of container tags to filter documents by
|
121
|
+
|
122
|
+
extra_headers: Send extra headers
|
123
|
+
|
124
|
+
extra_query: Add additional query parameters to the request
|
125
|
+
|
126
|
+
extra_body: Add additional JSON properties to the request
|
127
|
+
|
128
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
129
|
+
"""
|
130
|
+
return self._post(
|
131
|
+
"/v3/connections/list",
|
132
|
+
body=maybe_transform({"container_tags": container_tags}, connection_list_params.ConnectionListParams),
|
133
|
+
options=make_request_options(
|
134
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
135
|
+
),
|
136
|
+
cast_to=ConnectionListResponse,
|
137
|
+
)
|
138
|
+
|
139
|
+
def delete_by_provider(
|
140
|
+
self,
|
141
|
+
provider: Literal["notion", "google-drive", "onedrive"],
|
142
|
+
*,
|
143
|
+
container_tags: List[str],
|
144
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
145
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
146
|
+
extra_headers: Headers | None = None,
|
147
|
+
extra_query: Query | None = None,
|
148
|
+
extra_body: Body | None = None,
|
149
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
150
|
+
) -> ConnectionDeleteByProviderResponse:
|
151
|
+
"""
|
152
|
+
Delete connection for a specific provider and container tags
|
153
|
+
|
154
|
+
Args:
|
155
|
+
container_tags: Optional comma-separated list of container tags to filter connections by
|
156
|
+
|
157
|
+
extra_headers: Send extra headers
|
158
|
+
|
159
|
+
extra_query: Add additional query parameters to the request
|
160
|
+
|
161
|
+
extra_body: Add additional JSON properties to the request
|
162
|
+
|
163
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
164
|
+
"""
|
165
|
+
if not provider:
|
166
|
+
raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}")
|
167
|
+
return self._delete(
|
168
|
+
f"/v3/connections/{provider}",
|
169
|
+
body=maybe_transform(
|
170
|
+
{"container_tags": container_tags},
|
171
|
+
connection_delete_by_provider_params.ConnectionDeleteByProviderParams,
|
172
|
+
),
|
173
|
+
options=make_request_options(
|
174
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
175
|
+
),
|
176
|
+
cast_to=ConnectionDeleteByProviderResponse,
|
177
|
+
)
|
178
|
+
|
179
|
+
def get_by_id(
|
180
|
+
self,
|
181
|
+
connection_id: str,
|
182
|
+
*,
|
183
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
184
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
185
|
+
extra_headers: Headers | None = None,
|
186
|
+
extra_query: Query | None = None,
|
187
|
+
extra_body: Body | None = None,
|
188
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
189
|
+
) -> ConnectionGetByIDResponse:
|
190
|
+
"""
|
191
|
+
Get connection details with id
|
192
|
+
|
193
|
+
Args:
|
194
|
+
extra_headers: Send extra headers
|
195
|
+
|
196
|
+
extra_query: Add additional query parameters to the request
|
197
|
+
|
198
|
+
extra_body: Add additional JSON properties to the request
|
199
|
+
|
200
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
201
|
+
"""
|
202
|
+
if not connection_id:
|
203
|
+
raise ValueError(f"Expected a non-empty value for `connection_id` but received {connection_id!r}")
|
204
|
+
return self._get(
|
205
|
+
f"/v3/connections/{connection_id}",
|
206
|
+
options=make_request_options(
|
207
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
208
|
+
),
|
209
|
+
cast_to=ConnectionGetByIDResponse,
|
210
|
+
)
|
211
|
+
|
212
|
+
def get_by_tags(
|
213
|
+
self,
|
214
|
+
provider: Literal["notion", "google-drive", "onedrive"],
|
215
|
+
*,
|
216
|
+
container_tags: List[str],
|
217
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
218
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
219
|
+
extra_headers: Headers | None = None,
|
220
|
+
extra_query: Query | None = None,
|
221
|
+
extra_body: Body | None = None,
|
222
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
223
|
+
) -> ConnectionGetByTagsResponse:
|
224
|
+
"""
|
225
|
+
Get connection details with provider and container tags
|
226
|
+
|
227
|
+
Args:
|
228
|
+
container_tags: Comma-separated list of container tags to filter connection by
|
229
|
+
|
230
|
+
extra_headers: Send extra headers
|
231
|
+
|
232
|
+
extra_query: Add additional query parameters to the request
|
233
|
+
|
234
|
+
extra_body: Add additional JSON properties to the request
|
235
|
+
|
236
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
237
|
+
"""
|
238
|
+
if not provider:
|
239
|
+
raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}")
|
240
|
+
return self._post(
|
241
|
+
f"/v3/connections/{provider}/connection",
|
242
|
+
body=maybe_transform(
|
243
|
+
{"container_tags": container_tags}, connection_get_by_tags_params.ConnectionGetByTagsParams
|
244
|
+
),
|
245
|
+
options=make_request_options(
|
246
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
247
|
+
),
|
248
|
+
cast_to=ConnectionGetByTagsResponse,
|
249
|
+
)
|
250
|
+
|
251
|
+
def import_(
|
252
|
+
self,
|
253
|
+
provider: Literal["notion", "google-drive", "onedrive"],
|
254
|
+
*,
|
255
|
+
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
256
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
257
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
258
|
+
extra_headers: Headers | None = None,
|
259
|
+
extra_query: Query | None = None,
|
260
|
+
extra_body: Body | None = None,
|
261
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
262
|
+
) -> None:
|
263
|
+
"""
|
264
|
+
Initiate a manual sync of connections
|
265
|
+
|
266
|
+
Args:
|
267
|
+
container_tags: Optional comma-separated list of container tags to filter connections by
|
268
|
+
|
269
|
+
extra_headers: Send extra headers
|
270
|
+
|
271
|
+
extra_query: Add additional query parameters to the request
|
272
|
+
|
273
|
+
extra_body: Add additional JSON properties to the request
|
274
|
+
|
275
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
276
|
+
"""
|
277
|
+
if not provider:
|
278
|
+
raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}")
|
279
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
280
|
+
return self._post(
|
281
|
+
f"/v3/connections/{provider}/import",
|
282
|
+
body=maybe_transform({"container_tags": container_tags}, connection_import_params.ConnectionImportParams),
|
283
|
+
options=make_request_options(
|
284
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
285
|
+
),
|
286
|
+
cast_to=NoneType,
|
287
|
+
)
|
288
|
+
|
289
|
+
def list_documents(
|
290
|
+
self,
|
291
|
+
provider: Literal["notion", "google-drive", "onedrive"],
|
292
|
+
*,
|
293
|
+
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
294
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
295
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
296
|
+
extra_headers: Headers | None = None,
|
297
|
+
extra_query: Query | None = None,
|
298
|
+
extra_body: Body | None = None,
|
299
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
300
|
+
) -> ConnectionListDocumentsResponse:
|
301
|
+
"""
|
302
|
+
List documents indexed for a provider and container tags
|
303
|
+
|
304
|
+
Args:
|
305
|
+
container_tags: Optional comma-separated list of container tags to filter documents by
|
306
|
+
|
307
|
+
extra_headers: Send extra headers
|
308
|
+
|
309
|
+
extra_query: Add additional query parameters to the request
|
310
|
+
|
311
|
+
extra_body: Add additional JSON properties to the request
|
312
|
+
|
313
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
314
|
+
"""
|
315
|
+
if not provider:
|
316
|
+
raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}")
|
317
|
+
return self._post(
|
318
|
+
f"/v3/connections/{provider}/documents",
|
319
|
+
body=maybe_transform(
|
320
|
+
{"container_tags": container_tags}, connection_list_documents_params.ConnectionListDocumentsParams
|
321
|
+
),
|
322
|
+
options=make_request_options(
|
323
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
324
|
+
),
|
325
|
+
cast_to=ConnectionListDocumentsResponse,
|
326
|
+
)
|
327
|
+
|
328
|
+
|
329
|
+
class AsyncConnectionsResource(AsyncAPIResource):
|
330
|
+
@cached_property
|
331
|
+
def with_raw_response(self) -> AsyncConnectionsResourceWithRawResponse:
|
332
|
+
"""
|
333
|
+
This property can be used as a prefix for any HTTP method call to return
|
334
|
+
the raw response object instead of the parsed content.
|
335
|
+
|
336
|
+
For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers
|
337
|
+
"""
|
338
|
+
return AsyncConnectionsResourceWithRawResponse(self)
|
339
|
+
|
340
|
+
@cached_property
|
341
|
+
def with_streaming_response(self) -> AsyncConnectionsResourceWithStreamingResponse:
|
342
|
+
"""
|
343
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
344
|
+
|
345
|
+
For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response
|
346
|
+
"""
|
347
|
+
return AsyncConnectionsResourceWithStreamingResponse(self)
|
348
|
+
|
349
|
+
async def create(
|
350
|
+
self,
|
351
|
+
provider: Literal["notion", "google-drive", "onedrive"],
|
352
|
+
*,
|
353
|
+
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
354
|
+
document_limit: int | NotGiven = NOT_GIVEN,
|
355
|
+
metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN,
|
356
|
+
redirect_url: str | NotGiven = NOT_GIVEN,
|
357
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
358
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
359
|
+
extra_headers: Headers | None = None,
|
360
|
+
extra_query: Query | None = None,
|
361
|
+
extra_body: Body | None = None,
|
362
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
363
|
+
) -> ConnectionCreateResponse:
|
364
|
+
"""
|
365
|
+
Initialize connection and get authorization URL
|
366
|
+
|
367
|
+
Args:
|
368
|
+
extra_headers: Send extra headers
|
369
|
+
|
370
|
+
extra_query: Add additional query parameters to the request
|
371
|
+
|
372
|
+
extra_body: Add additional JSON properties to the request
|
373
|
+
|
374
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
375
|
+
"""
|
376
|
+
if not provider:
|
377
|
+
raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}")
|
378
|
+
return await self._post(
|
379
|
+
f"/v3/connections/{provider}",
|
380
|
+
body=await async_maybe_transform(
|
381
|
+
{
|
382
|
+
"container_tags": container_tags,
|
383
|
+
"document_limit": document_limit,
|
384
|
+
"metadata": metadata,
|
385
|
+
"redirect_url": redirect_url,
|
386
|
+
},
|
387
|
+
connection_create_params.ConnectionCreateParams,
|
388
|
+
),
|
389
|
+
options=make_request_options(
|
390
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
391
|
+
),
|
392
|
+
cast_to=ConnectionCreateResponse,
|
393
|
+
)
|
394
|
+
|
395
|
+
async def list(
|
396
|
+
self,
|
397
|
+
*,
|
398
|
+
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
399
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
400
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
401
|
+
extra_headers: Headers | None = None,
|
402
|
+
extra_query: Query | None = None,
|
403
|
+
extra_body: Body | None = None,
|
404
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
405
|
+
) -> ConnectionListResponse:
|
406
|
+
"""
|
407
|
+
List all connections
|
408
|
+
|
409
|
+
Args:
|
410
|
+
container_tags: Optional comma-separated list of container tags to filter documents by
|
411
|
+
|
412
|
+
extra_headers: Send extra headers
|
413
|
+
|
414
|
+
extra_query: Add additional query parameters to the request
|
415
|
+
|
416
|
+
extra_body: Add additional JSON properties to the request
|
417
|
+
|
418
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
419
|
+
"""
|
420
|
+
return await self._post(
|
421
|
+
"/v3/connections/list",
|
422
|
+
body=await async_maybe_transform(
|
423
|
+
{"container_tags": container_tags}, connection_list_params.ConnectionListParams
|
424
|
+
),
|
425
|
+
options=make_request_options(
|
426
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
427
|
+
),
|
428
|
+
cast_to=ConnectionListResponse,
|
429
|
+
)
|
430
|
+
|
431
|
+
async def delete_by_provider(
|
432
|
+
self,
|
433
|
+
provider: Literal["notion", "google-drive", "onedrive"],
|
434
|
+
*,
|
435
|
+
container_tags: List[str],
|
436
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
437
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
438
|
+
extra_headers: Headers | None = None,
|
439
|
+
extra_query: Query | None = None,
|
440
|
+
extra_body: Body | None = None,
|
441
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
442
|
+
) -> ConnectionDeleteByProviderResponse:
|
443
|
+
"""
|
444
|
+
Delete connection for a specific provider and container tags
|
445
|
+
|
446
|
+
Args:
|
447
|
+
container_tags: Optional comma-separated list of container tags to filter connections by
|
448
|
+
|
449
|
+
extra_headers: Send extra headers
|
450
|
+
|
451
|
+
extra_query: Add additional query parameters to the request
|
452
|
+
|
453
|
+
extra_body: Add additional JSON properties to the request
|
454
|
+
|
455
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
456
|
+
"""
|
457
|
+
if not provider:
|
458
|
+
raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}")
|
459
|
+
return await self._delete(
|
460
|
+
f"/v3/connections/{provider}",
|
461
|
+
body=await async_maybe_transform(
|
462
|
+
{"container_tags": container_tags},
|
463
|
+
connection_delete_by_provider_params.ConnectionDeleteByProviderParams,
|
464
|
+
),
|
465
|
+
options=make_request_options(
|
466
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
467
|
+
),
|
468
|
+
cast_to=ConnectionDeleteByProviderResponse,
|
469
|
+
)
|
470
|
+
|
471
|
+
async def get_by_id(
|
472
|
+
self,
|
473
|
+
connection_id: str,
|
474
|
+
*,
|
475
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
476
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
477
|
+
extra_headers: Headers | None = None,
|
478
|
+
extra_query: Query | None = None,
|
479
|
+
extra_body: Body | None = None,
|
480
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
481
|
+
) -> ConnectionGetByIDResponse:
|
482
|
+
"""
|
483
|
+
Get connection details with id
|
484
|
+
|
485
|
+
Args:
|
486
|
+
extra_headers: Send extra headers
|
487
|
+
|
488
|
+
extra_query: Add additional query parameters to the request
|
489
|
+
|
490
|
+
extra_body: Add additional JSON properties to the request
|
491
|
+
|
492
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
493
|
+
"""
|
494
|
+
if not connection_id:
|
495
|
+
raise ValueError(f"Expected a non-empty value for `connection_id` but received {connection_id!r}")
|
496
|
+
return await self._get(
|
497
|
+
f"/v3/connections/{connection_id}",
|
498
|
+
options=make_request_options(
|
499
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
500
|
+
),
|
501
|
+
cast_to=ConnectionGetByIDResponse,
|
502
|
+
)
|
503
|
+
|
504
|
+
async def get_by_tags(
|
505
|
+
self,
|
506
|
+
provider: Literal["notion", "google-drive", "onedrive"],
|
507
|
+
*,
|
508
|
+
container_tags: List[str],
|
509
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
510
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
511
|
+
extra_headers: Headers | None = None,
|
512
|
+
extra_query: Query | None = None,
|
513
|
+
extra_body: Body | None = None,
|
514
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
515
|
+
) -> ConnectionGetByTagsResponse:
|
516
|
+
"""
|
517
|
+
Get connection details with provider and container tags
|
518
|
+
|
519
|
+
Args:
|
520
|
+
container_tags: Comma-separated list of container tags to filter connection by
|
521
|
+
|
522
|
+
extra_headers: Send extra headers
|
523
|
+
|
524
|
+
extra_query: Add additional query parameters to the request
|
525
|
+
|
526
|
+
extra_body: Add additional JSON properties to the request
|
527
|
+
|
528
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
529
|
+
"""
|
530
|
+
if not provider:
|
531
|
+
raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}")
|
532
|
+
return await self._post(
|
533
|
+
f"/v3/connections/{provider}/connection",
|
534
|
+
body=await async_maybe_transform(
|
535
|
+
{"container_tags": container_tags}, connection_get_by_tags_params.ConnectionGetByTagsParams
|
536
|
+
),
|
537
|
+
options=make_request_options(
|
538
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
539
|
+
),
|
540
|
+
cast_to=ConnectionGetByTagsResponse,
|
541
|
+
)
|
542
|
+
|
543
|
+
async def import_(
|
544
|
+
self,
|
545
|
+
provider: Literal["notion", "google-drive", "onedrive"],
|
546
|
+
*,
|
547
|
+
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
548
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
549
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
550
|
+
extra_headers: Headers | None = None,
|
551
|
+
extra_query: Query | None = None,
|
552
|
+
extra_body: Body | None = None,
|
553
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
554
|
+
) -> None:
|
555
|
+
"""
|
556
|
+
Initiate a manual sync of connections
|
557
|
+
|
558
|
+
Args:
|
559
|
+
container_tags: Optional comma-separated list of container tags to filter connections by
|
560
|
+
|
561
|
+
extra_headers: Send extra headers
|
562
|
+
|
563
|
+
extra_query: Add additional query parameters to the request
|
564
|
+
|
565
|
+
extra_body: Add additional JSON properties to the request
|
566
|
+
|
567
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
568
|
+
"""
|
569
|
+
if not provider:
|
570
|
+
raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}")
|
571
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
572
|
+
return await self._post(
|
573
|
+
f"/v3/connections/{provider}/import",
|
574
|
+
body=await async_maybe_transform(
|
575
|
+
{"container_tags": container_tags}, connection_import_params.ConnectionImportParams
|
576
|
+
),
|
577
|
+
options=make_request_options(
|
578
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
579
|
+
),
|
580
|
+
cast_to=NoneType,
|
581
|
+
)
|
582
|
+
|
583
|
+
async def list_documents(
|
584
|
+
self,
|
585
|
+
provider: Literal["notion", "google-drive", "onedrive"],
|
586
|
+
*,
|
587
|
+
container_tags: List[str] | NotGiven = NOT_GIVEN,
|
588
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
589
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
590
|
+
extra_headers: Headers | None = None,
|
591
|
+
extra_query: Query | None = None,
|
592
|
+
extra_body: Body | None = None,
|
593
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
594
|
+
) -> ConnectionListDocumentsResponse:
|
595
|
+
"""
|
596
|
+
List documents indexed for a provider and container tags
|
597
|
+
|
598
|
+
Args:
|
599
|
+
container_tags: Optional comma-separated list of container tags to filter documents by
|
600
|
+
|
601
|
+
extra_headers: Send extra headers
|
602
|
+
|
603
|
+
extra_query: Add additional query parameters to the request
|
604
|
+
|
605
|
+
extra_body: Add additional JSON properties to the request
|
606
|
+
|
607
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
608
|
+
"""
|
609
|
+
if not provider:
|
610
|
+
raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}")
|
611
|
+
return await self._post(
|
612
|
+
f"/v3/connections/{provider}/documents",
|
613
|
+
body=await async_maybe_transform(
|
614
|
+
{"container_tags": container_tags}, connection_list_documents_params.ConnectionListDocumentsParams
|
615
|
+
),
|
616
|
+
options=make_request_options(
|
617
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
618
|
+
),
|
619
|
+
cast_to=ConnectionListDocumentsResponse,
|
620
|
+
)
|
621
|
+
|
622
|
+
|
623
|
+
class ConnectionsResourceWithRawResponse:
|
624
|
+
def __init__(self, connections: ConnectionsResource) -> None:
|
625
|
+
self._connections = connections
|
626
|
+
|
627
|
+
self.create = to_raw_response_wrapper(
|
628
|
+
connections.create,
|
629
|
+
)
|
630
|
+
self.list = to_raw_response_wrapper(
|
631
|
+
connections.list,
|
632
|
+
)
|
633
|
+
self.delete_by_provider = to_raw_response_wrapper(
|
634
|
+
connections.delete_by_provider,
|
635
|
+
)
|
636
|
+
self.get_by_id = to_raw_response_wrapper(
|
637
|
+
connections.get_by_id,
|
638
|
+
)
|
639
|
+
self.get_by_tags = to_raw_response_wrapper(
|
640
|
+
connections.get_by_tags,
|
641
|
+
)
|
642
|
+
self.import_ = to_raw_response_wrapper(
|
643
|
+
connections.import_,
|
644
|
+
)
|
645
|
+
self.list_documents = to_raw_response_wrapper(
|
646
|
+
connections.list_documents,
|
647
|
+
)
|
648
|
+
|
649
|
+
|
650
|
+
class AsyncConnectionsResourceWithRawResponse:
|
651
|
+
def __init__(self, connections: AsyncConnectionsResource) -> None:
|
652
|
+
self._connections = connections
|
653
|
+
|
654
|
+
self.create = async_to_raw_response_wrapper(
|
655
|
+
connections.create,
|
656
|
+
)
|
657
|
+
self.list = async_to_raw_response_wrapper(
|
658
|
+
connections.list,
|
659
|
+
)
|
660
|
+
self.delete_by_provider = async_to_raw_response_wrapper(
|
661
|
+
connections.delete_by_provider,
|
662
|
+
)
|
663
|
+
self.get_by_id = async_to_raw_response_wrapper(
|
664
|
+
connections.get_by_id,
|
665
|
+
)
|
666
|
+
self.get_by_tags = async_to_raw_response_wrapper(
|
667
|
+
connections.get_by_tags,
|
668
|
+
)
|
669
|
+
self.import_ = async_to_raw_response_wrapper(
|
670
|
+
connections.import_,
|
671
|
+
)
|
672
|
+
self.list_documents = async_to_raw_response_wrapper(
|
673
|
+
connections.list_documents,
|
674
|
+
)
|
675
|
+
|
676
|
+
|
677
|
+
class ConnectionsResourceWithStreamingResponse:
|
678
|
+
def __init__(self, connections: ConnectionsResource) -> None:
|
679
|
+
self._connections = connections
|
680
|
+
|
681
|
+
self.create = to_streamed_response_wrapper(
|
682
|
+
connections.create,
|
683
|
+
)
|
684
|
+
self.list = to_streamed_response_wrapper(
|
685
|
+
connections.list,
|
686
|
+
)
|
687
|
+
self.delete_by_provider = to_streamed_response_wrapper(
|
688
|
+
connections.delete_by_provider,
|
689
|
+
)
|
690
|
+
self.get_by_id = to_streamed_response_wrapper(
|
691
|
+
connections.get_by_id,
|
692
|
+
)
|
693
|
+
self.get_by_tags = to_streamed_response_wrapper(
|
694
|
+
connections.get_by_tags,
|
695
|
+
)
|
696
|
+
self.import_ = to_streamed_response_wrapper(
|
697
|
+
connections.import_,
|
698
|
+
)
|
699
|
+
self.list_documents = to_streamed_response_wrapper(
|
700
|
+
connections.list_documents,
|
701
|
+
)
|
702
|
+
|
703
|
+
|
704
|
+
class AsyncConnectionsResourceWithStreamingResponse:
|
705
|
+
def __init__(self, connections: AsyncConnectionsResource) -> None:
|
706
|
+
self._connections = connections
|
707
|
+
|
708
|
+
self.create = async_to_streamed_response_wrapper(
|
709
|
+
connections.create,
|
710
|
+
)
|
711
|
+
self.list = async_to_streamed_response_wrapper(
|
712
|
+
connections.list,
|
713
|
+
)
|
714
|
+
self.delete_by_provider = async_to_streamed_response_wrapper(
|
715
|
+
connections.delete_by_provider,
|
716
|
+
)
|
717
|
+
self.get_by_id = async_to_streamed_response_wrapper(
|
718
|
+
connections.get_by_id,
|
719
|
+
)
|
720
|
+
self.get_by_tags = async_to_streamed_response_wrapper(
|
721
|
+
connections.get_by_tags,
|
722
|
+
)
|
723
|
+
self.import_ = async_to_streamed_response_wrapper(
|
724
|
+
connections.import_,
|
725
|
+
)
|
726
|
+
self.list_documents = async_to_streamed_response_wrapper(
|
727
|
+
connections.list_documents,
|
728
|
+
)
|