supermemory 0.1.0a1__py3-none-any.whl → 3.0.0a1__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/__init__.py +5 -0
- supermemory/_client.py +29 -29
- supermemory/_files.py +1 -1
- supermemory/_utils/_proxy.py +4 -1
- supermemory/_utils/_resources_proxy.py +24 -0
- supermemory/_version.py +1 -1
- supermemory/resources/__init__.py +33 -33
- supermemory/resources/{connection.py → connections.py} +154 -61
- supermemory/resources/{memory.py → memories.py} +264 -88
- supermemory/resources/search.py +92 -50
- supermemory/resources/settings.py +58 -11
- supermemory/types/__init__.py +10 -2
- supermemory/types/connection_create_params.py +5 -2
- supermemory/types/connection_create_response.py +7 -1
- supermemory/types/connection_get_response.py +21 -0
- supermemory/types/connection_list_params.py +13 -0
- supermemory/types/connection_list_response.py +25 -0
- supermemory/types/memory_add_params.py +18 -0
- supermemory/types/{memory_create_response.py → memory_add_response.py} +2 -2
- supermemory/types/memory_get_response.py +3 -19
- supermemory/types/memory_list_response.py +48 -12
- supermemory/types/memory_update_params.py +18 -0
- supermemory/types/memory_update_response.py +11 -0
- supermemory/types/memory_upload_file_params.py +13 -0
- supermemory/types/memory_upload_file_response.py +11 -0
- supermemory/types/search_execute_params.py +36 -6
- supermemory/types/setting_get_response.py +11 -0
- supermemory/types/setting_update_params.py +4 -12
- supermemory/types/setting_update_response.py +3 -11
- {supermemory-0.1.0a1.dist-info → supermemory-3.0.0a1.dist-info}/METADATA +24 -7
- supermemory-3.0.0a1.dist-info/RECORD +56 -0
- supermemory/types/memory_create_params.py +0 -23
- supermemory-0.1.0a1.dist-info/RECORD +0 -47
- {supermemory-0.1.0a1.dist-info → supermemory-3.0.0a1.dist-info}/WHEEL +0 -0
- {supermemory-0.1.0a1.dist-info → supermemory-3.0.0a1.dist-info}/licenses/LICENSE +0 -0
@@ -2,12 +2,13 @@
|
|
2
2
|
|
3
3
|
from __future__ import annotations
|
4
4
|
|
5
|
+
from typing import Dict, Union, Optional
|
5
6
|
from typing_extensions import Literal
|
6
7
|
|
7
8
|
import httpx
|
8
9
|
|
9
|
-
from ..types import connection_create_params
|
10
|
-
from .._types import NOT_GIVEN, Body, Query, Headers,
|
10
|
+
from ..types import connection_list_params, connection_create_params
|
11
|
+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
11
12
|
from .._utils import maybe_transform, async_maybe_transform
|
12
13
|
from .._compat import cached_property
|
13
14
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
@@ -18,37 +19,40 @@ from .._response import (
|
|
18
19
|
async_to_streamed_response_wrapper,
|
19
20
|
)
|
20
21
|
from .._base_client import make_request_options
|
22
|
+
from ..types.connection_get_response import ConnectionGetResponse
|
23
|
+
from ..types.connection_list_response import ConnectionListResponse
|
21
24
|
from ..types.connection_create_response import ConnectionCreateResponse
|
22
25
|
|
23
|
-
__all__ = ["
|
26
|
+
__all__ = ["ConnectionsResource", "AsyncConnectionsResource"]
|
24
27
|
|
25
28
|
|
26
|
-
class
|
29
|
+
class ConnectionsResource(SyncAPIResource):
|
27
30
|
@cached_property
|
28
|
-
def with_raw_response(self) ->
|
31
|
+
def with_raw_response(self) -> ConnectionsResourceWithRawResponse:
|
29
32
|
"""
|
30
33
|
This property can be used as a prefix for any HTTP method call to return
|
31
34
|
the raw response object instead of the parsed content.
|
32
35
|
|
33
36
|
For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers
|
34
37
|
"""
|
35
|
-
return
|
38
|
+
return ConnectionsResourceWithRawResponse(self)
|
36
39
|
|
37
40
|
@cached_property
|
38
|
-
def with_streaming_response(self) ->
|
41
|
+
def with_streaming_response(self) -> ConnectionsResourceWithStreamingResponse:
|
39
42
|
"""
|
40
43
|
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
41
44
|
|
42
45
|
For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response
|
43
46
|
"""
|
44
|
-
return
|
47
|
+
return ConnectionsResourceWithStreamingResponse(self)
|
45
48
|
|
46
49
|
def create(
|
47
50
|
self,
|
48
|
-
|
51
|
+
provider: Literal["notion", "google-drive", "onedrive"],
|
49
52
|
*,
|
50
|
-
|
53
|
+
end_user_id: str | NotGiven = NOT_GIVEN,
|
51
54
|
redirect_url: str | NotGiven = NOT_GIVEN,
|
55
|
+
metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN,
|
52
56
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
53
57
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
54
58
|
extra_headers: Headers | None = None,
|
@@ -68,10 +72,11 @@ class ConnectionResource(SyncAPIResource):
|
|
68
72
|
|
69
73
|
timeout: Override the client-level default timeout for this request, in seconds
|
70
74
|
"""
|
71
|
-
if not
|
72
|
-
raise ValueError(f"Expected a non-empty value for `
|
73
|
-
return self.
|
74
|
-
f"/
|
75
|
+
if not provider:
|
76
|
+
raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}")
|
77
|
+
return self._post(
|
78
|
+
f"/v3/connections/{provider}",
|
79
|
+
body=maybe_transform({"metadata": metadata}, connection_create_params.ConnectionCreateParams),
|
75
80
|
options=make_request_options(
|
76
81
|
extra_headers=extra_headers,
|
77
82
|
extra_query=extra_query,
|
@@ -79,7 +84,7 @@ class ConnectionResource(SyncAPIResource):
|
|
79
84
|
timeout=timeout,
|
80
85
|
query=maybe_transform(
|
81
86
|
{
|
82
|
-
"
|
87
|
+
"end_user_id": end_user_id,
|
83
88
|
"redirect_url": redirect_url,
|
84
89
|
},
|
85
90
|
connection_create_params.ConnectionCreateParams,
|
@@ -88,7 +93,42 @@ class ConnectionResource(SyncAPIResource):
|
|
88
93
|
cast_to=ConnectionCreateResponse,
|
89
94
|
)
|
90
95
|
|
91
|
-
def
|
96
|
+
def list(
|
97
|
+
self,
|
98
|
+
*,
|
99
|
+
end_user_id: str | NotGiven = NOT_GIVEN,
|
100
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
101
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
102
|
+
extra_headers: Headers | None = None,
|
103
|
+
extra_query: Query | None = None,
|
104
|
+
extra_body: Body | None = None,
|
105
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
106
|
+
) -> ConnectionListResponse:
|
107
|
+
"""
|
108
|
+
List all connections
|
109
|
+
|
110
|
+
Args:
|
111
|
+
extra_headers: Send extra headers
|
112
|
+
|
113
|
+
extra_query: Add additional query parameters to the request
|
114
|
+
|
115
|
+
extra_body: Add additional JSON properties to the request
|
116
|
+
|
117
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
118
|
+
"""
|
119
|
+
return self._get(
|
120
|
+
"/v3/connections",
|
121
|
+
options=make_request_options(
|
122
|
+
extra_headers=extra_headers,
|
123
|
+
extra_query=extra_query,
|
124
|
+
extra_body=extra_body,
|
125
|
+
timeout=timeout,
|
126
|
+
query=maybe_transform({"end_user_id": end_user_id}, connection_list_params.ConnectionListParams),
|
127
|
+
),
|
128
|
+
cast_to=ConnectionListResponse,
|
129
|
+
)
|
130
|
+
|
131
|
+
def get(
|
92
132
|
self,
|
93
133
|
connection_id: str,
|
94
134
|
*,
|
@@ -98,8 +138,10 @@ class ConnectionResource(SyncAPIResource):
|
|
98
138
|
extra_query: Query | None = None,
|
99
139
|
extra_body: Body | None = None,
|
100
140
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
101
|
-
) ->
|
141
|
+
) -> ConnectionGetResponse:
|
102
142
|
"""
|
143
|
+
Get connection details
|
144
|
+
|
103
145
|
Args:
|
104
146
|
extra_headers: Send extra headers
|
105
147
|
|
@@ -111,42 +153,42 @@ class ConnectionResource(SyncAPIResource):
|
|
111
153
|
"""
|
112
154
|
if not connection_id:
|
113
155
|
raise ValueError(f"Expected a non-empty value for `connection_id` but received {connection_id!r}")
|
114
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
115
156
|
return self._get(
|
116
|
-
f"/connections/{connection_id}",
|
157
|
+
f"/v3/connections/{connection_id}",
|
117
158
|
options=make_request_options(
|
118
159
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
119
160
|
),
|
120
|
-
cast_to=
|
161
|
+
cast_to=ConnectionGetResponse,
|
121
162
|
)
|
122
163
|
|
123
164
|
|
124
|
-
class
|
165
|
+
class AsyncConnectionsResource(AsyncAPIResource):
|
125
166
|
@cached_property
|
126
|
-
def with_raw_response(self) ->
|
167
|
+
def with_raw_response(self) -> AsyncConnectionsResourceWithRawResponse:
|
127
168
|
"""
|
128
169
|
This property can be used as a prefix for any HTTP method call to return
|
129
170
|
the raw response object instead of the parsed content.
|
130
171
|
|
131
172
|
For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers
|
132
173
|
"""
|
133
|
-
return
|
174
|
+
return AsyncConnectionsResourceWithRawResponse(self)
|
134
175
|
|
135
176
|
@cached_property
|
136
|
-
def with_streaming_response(self) ->
|
177
|
+
def with_streaming_response(self) -> AsyncConnectionsResourceWithStreamingResponse:
|
137
178
|
"""
|
138
179
|
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
139
180
|
|
140
181
|
For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response
|
141
182
|
"""
|
142
|
-
return
|
183
|
+
return AsyncConnectionsResourceWithStreamingResponse(self)
|
143
184
|
|
144
185
|
async def create(
|
145
186
|
self,
|
146
|
-
|
187
|
+
provider: Literal["notion", "google-drive", "onedrive"],
|
147
188
|
*,
|
148
|
-
|
189
|
+
end_user_id: str | NotGiven = NOT_GIVEN,
|
149
190
|
redirect_url: str | NotGiven = NOT_GIVEN,
|
191
|
+
metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN,
|
150
192
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
151
193
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
152
194
|
extra_headers: Headers | None = None,
|
@@ -166,10 +208,11 @@ class AsyncConnectionResource(AsyncAPIResource):
|
|
166
208
|
|
167
209
|
timeout: Override the client-level default timeout for this request, in seconds
|
168
210
|
"""
|
169
|
-
if not
|
170
|
-
raise ValueError(f"Expected a non-empty value for `
|
171
|
-
return await self.
|
172
|
-
f"/
|
211
|
+
if not provider:
|
212
|
+
raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}")
|
213
|
+
return await self._post(
|
214
|
+
f"/v3/connections/{provider}",
|
215
|
+
body=await async_maybe_transform({"metadata": metadata}, connection_create_params.ConnectionCreateParams),
|
173
216
|
options=make_request_options(
|
174
217
|
extra_headers=extra_headers,
|
175
218
|
extra_query=extra_query,
|
@@ -177,7 +220,7 @@ class AsyncConnectionResource(AsyncAPIResource):
|
|
177
220
|
timeout=timeout,
|
178
221
|
query=await async_maybe_transform(
|
179
222
|
{
|
180
|
-
"
|
223
|
+
"end_user_id": end_user_id,
|
181
224
|
"redirect_url": redirect_url,
|
182
225
|
},
|
183
226
|
connection_create_params.ConnectionCreateParams,
|
@@ -186,7 +229,44 @@ class AsyncConnectionResource(AsyncAPIResource):
|
|
186
229
|
cast_to=ConnectionCreateResponse,
|
187
230
|
)
|
188
231
|
|
189
|
-
async def
|
232
|
+
async def list(
|
233
|
+
self,
|
234
|
+
*,
|
235
|
+
end_user_id: str | NotGiven = NOT_GIVEN,
|
236
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
237
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
238
|
+
extra_headers: Headers | None = None,
|
239
|
+
extra_query: Query | None = None,
|
240
|
+
extra_body: Body | None = None,
|
241
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
242
|
+
) -> ConnectionListResponse:
|
243
|
+
"""
|
244
|
+
List all connections
|
245
|
+
|
246
|
+
Args:
|
247
|
+
extra_headers: Send extra headers
|
248
|
+
|
249
|
+
extra_query: Add additional query parameters to the request
|
250
|
+
|
251
|
+
extra_body: Add additional JSON properties to the request
|
252
|
+
|
253
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
254
|
+
"""
|
255
|
+
return await self._get(
|
256
|
+
"/v3/connections",
|
257
|
+
options=make_request_options(
|
258
|
+
extra_headers=extra_headers,
|
259
|
+
extra_query=extra_query,
|
260
|
+
extra_body=extra_body,
|
261
|
+
timeout=timeout,
|
262
|
+
query=await async_maybe_transform(
|
263
|
+
{"end_user_id": end_user_id}, connection_list_params.ConnectionListParams
|
264
|
+
),
|
265
|
+
),
|
266
|
+
cast_to=ConnectionListResponse,
|
267
|
+
)
|
268
|
+
|
269
|
+
async def get(
|
190
270
|
self,
|
191
271
|
connection_id: str,
|
192
272
|
*,
|
@@ -196,8 +276,10 @@ class AsyncConnectionResource(AsyncAPIResource):
|
|
196
276
|
extra_query: Query | None = None,
|
197
277
|
extra_body: Body | None = None,
|
198
278
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
199
|
-
) ->
|
279
|
+
) -> ConnectionGetResponse:
|
200
280
|
"""
|
281
|
+
Get connection details
|
282
|
+
|
201
283
|
Args:
|
202
284
|
extra_headers: Send extra headers
|
203
285
|
|
@@ -209,59 +291,70 @@ class AsyncConnectionResource(AsyncAPIResource):
|
|
209
291
|
"""
|
210
292
|
if not connection_id:
|
211
293
|
raise ValueError(f"Expected a non-empty value for `connection_id` but received {connection_id!r}")
|
212
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
213
294
|
return await self._get(
|
214
|
-
f"/connections/{connection_id}",
|
295
|
+
f"/v3/connections/{connection_id}",
|
215
296
|
options=make_request_options(
|
216
297
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
217
298
|
),
|
218
|
-
cast_to=
|
299
|
+
cast_to=ConnectionGetResponse,
|
219
300
|
)
|
220
301
|
|
221
302
|
|
222
|
-
class
|
223
|
-
def __init__(self,
|
224
|
-
self.
|
303
|
+
class ConnectionsResourceWithRawResponse:
|
304
|
+
def __init__(self, connections: ConnectionsResource) -> None:
|
305
|
+
self._connections = connections
|
225
306
|
|
226
307
|
self.create = to_raw_response_wrapper(
|
227
|
-
|
308
|
+
connections.create,
|
228
309
|
)
|
229
|
-
self.
|
230
|
-
|
310
|
+
self.list = to_raw_response_wrapper(
|
311
|
+
connections.list,
|
312
|
+
)
|
313
|
+
self.get = to_raw_response_wrapper(
|
314
|
+
connections.get,
|
231
315
|
)
|
232
316
|
|
233
317
|
|
234
|
-
class
|
235
|
-
def __init__(self,
|
236
|
-
self.
|
318
|
+
class AsyncConnectionsResourceWithRawResponse:
|
319
|
+
def __init__(self, connections: AsyncConnectionsResource) -> None:
|
320
|
+
self._connections = connections
|
237
321
|
|
238
322
|
self.create = async_to_raw_response_wrapper(
|
239
|
-
|
323
|
+
connections.create,
|
324
|
+
)
|
325
|
+
self.list = async_to_raw_response_wrapper(
|
326
|
+
connections.list,
|
240
327
|
)
|
241
|
-
self.
|
242
|
-
|
328
|
+
self.get = async_to_raw_response_wrapper(
|
329
|
+
connections.get,
|
243
330
|
)
|
244
331
|
|
245
332
|
|
246
|
-
class
|
247
|
-
def __init__(self,
|
248
|
-
self.
|
333
|
+
class ConnectionsResourceWithStreamingResponse:
|
334
|
+
def __init__(self, connections: ConnectionsResource) -> None:
|
335
|
+
self._connections = connections
|
249
336
|
|
250
337
|
self.create = to_streamed_response_wrapper(
|
251
|
-
|
338
|
+
connections.create,
|
252
339
|
)
|
253
|
-
self.
|
254
|
-
|
340
|
+
self.list = to_streamed_response_wrapper(
|
341
|
+
connections.list,
|
342
|
+
)
|
343
|
+
self.get = to_streamed_response_wrapper(
|
344
|
+
connections.get,
|
255
345
|
)
|
256
346
|
|
257
347
|
|
258
|
-
class
|
259
|
-
def __init__(self,
|
260
|
-
self.
|
348
|
+
class AsyncConnectionsResourceWithStreamingResponse:
|
349
|
+
def __init__(self, connections: AsyncConnectionsResource) -> None:
|
350
|
+
self._connections = connections
|
261
351
|
|
262
352
|
self.create = async_to_streamed_response_wrapper(
|
263
|
-
|
353
|
+
connections.create,
|
354
|
+
)
|
355
|
+
self.list = async_to_streamed_response_wrapper(
|
356
|
+
connections.list,
|
264
357
|
)
|
265
|
-
self.
|
266
|
-
|
358
|
+
self.get = async_to_streamed_response_wrapper(
|
359
|
+
connections.get,
|
267
360
|
)
|