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.
Files changed (35) hide show
  1. supermemory/__init__.py +5 -0
  2. supermemory/_client.py +29 -29
  3. supermemory/_files.py +1 -1
  4. supermemory/_utils/_proxy.py +4 -1
  5. supermemory/_utils/_resources_proxy.py +24 -0
  6. supermemory/_version.py +1 -1
  7. supermemory/resources/__init__.py +33 -33
  8. supermemory/resources/{connection.py → connections.py} +154 -61
  9. supermemory/resources/{memory.py → memories.py} +264 -88
  10. supermemory/resources/search.py +92 -50
  11. supermemory/resources/settings.py +58 -11
  12. supermemory/types/__init__.py +10 -2
  13. supermemory/types/connection_create_params.py +5 -2
  14. supermemory/types/connection_create_response.py +7 -1
  15. supermemory/types/connection_get_response.py +21 -0
  16. supermemory/types/connection_list_params.py +13 -0
  17. supermemory/types/connection_list_response.py +25 -0
  18. supermemory/types/memory_add_params.py +18 -0
  19. supermemory/types/{memory_create_response.py → memory_add_response.py} +2 -2
  20. supermemory/types/memory_get_response.py +3 -19
  21. supermemory/types/memory_list_response.py +48 -12
  22. supermemory/types/memory_update_params.py +18 -0
  23. supermemory/types/memory_update_response.py +11 -0
  24. supermemory/types/memory_upload_file_params.py +13 -0
  25. supermemory/types/memory_upload_file_response.py +11 -0
  26. supermemory/types/search_execute_params.py +36 -6
  27. supermemory/types/setting_get_response.py +11 -0
  28. supermemory/types/setting_update_params.py +4 -12
  29. supermemory/types/setting_update_response.py +3 -11
  30. {supermemory-0.1.0a1.dist-info → supermemory-3.0.0a1.dist-info}/METADATA +24 -7
  31. supermemory-3.0.0a1.dist-info/RECORD +56 -0
  32. supermemory/types/memory_create_params.py +0 -23
  33. supermemory-0.1.0a1.dist-info/RECORD +0 -47
  34. {supermemory-0.1.0a1.dist-info → supermemory-3.0.0a1.dist-info}/WHEEL +0 -0
  35. {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, NoneType, NotGiven
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__ = ["ConnectionResource", "AsyncConnectionResource"]
26
+ __all__ = ["ConnectionsResource", "AsyncConnectionsResource"]
24
27
 
25
28
 
26
- class ConnectionResource(SyncAPIResource):
29
+ class ConnectionsResource(SyncAPIResource):
27
30
  @cached_property
28
- def with_raw_response(self) -> ConnectionResourceWithRawResponse:
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 ConnectionResourceWithRawResponse(self)
38
+ return ConnectionsResourceWithRawResponse(self)
36
39
 
37
40
  @cached_property
38
- def with_streaming_response(self) -> ConnectionResourceWithStreamingResponse:
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 ConnectionResourceWithStreamingResponse(self)
47
+ return ConnectionsResourceWithStreamingResponse(self)
45
48
 
46
49
  def create(
47
50
  self,
48
- app: Literal["notion", "google-drive"],
51
+ provider: Literal["notion", "google-drive", "onedrive"],
49
52
  *,
50
- id: str,
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 app:
72
- raise ValueError(f"Expected a non-empty value for `app` but received {app!r}")
73
- return self._get(
74
- f"/connect/{app}",
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
- "id": id,
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 retrieve(
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
- ) -> None:
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=NoneType,
161
+ cast_to=ConnectionGetResponse,
121
162
  )
122
163
 
123
164
 
124
- class AsyncConnectionResource(AsyncAPIResource):
165
+ class AsyncConnectionsResource(AsyncAPIResource):
125
166
  @cached_property
126
- def with_raw_response(self) -> AsyncConnectionResourceWithRawResponse:
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 AsyncConnectionResourceWithRawResponse(self)
174
+ return AsyncConnectionsResourceWithRawResponse(self)
134
175
 
135
176
  @cached_property
136
- def with_streaming_response(self) -> AsyncConnectionResourceWithStreamingResponse:
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 AsyncConnectionResourceWithStreamingResponse(self)
183
+ return AsyncConnectionsResourceWithStreamingResponse(self)
143
184
 
144
185
  async def create(
145
186
  self,
146
- app: Literal["notion", "google-drive"],
187
+ provider: Literal["notion", "google-drive", "onedrive"],
147
188
  *,
148
- id: str,
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 app:
170
- raise ValueError(f"Expected a non-empty value for `app` but received {app!r}")
171
- return await self._get(
172
- f"/connect/{app}",
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
- "id": id,
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 retrieve(
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
- ) -> None:
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=NoneType,
299
+ cast_to=ConnectionGetResponse,
219
300
  )
220
301
 
221
302
 
222
- class ConnectionResourceWithRawResponse:
223
- def __init__(self, connection: ConnectionResource) -> None:
224
- self._connection = connection
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
- connection.create,
308
+ connections.create,
228
309
  )
229
- self.retrieve = to_raw_response_wrapper(
230
- connection.retrieve,
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 AsyncConnectionResourceWithRawResponse:
235
- def __init__(self, connection: AsyncConnectionResource) -> None:
236
- self._connection = connection
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
- connection.create,
323
+ connections.create,
324
+ )
325
+ self.list = async_to_raw_response_wrapper(
326
+ connections.list,
240
327
  )
241
- self.retrieve = async_to_raw_response_wrapper(
242
- connection.retrieve,
328
+ self.get = async_to_raw_response_wrapper(
329
+ connections.get,
243
330
  )
244
331
 
245
332
 
246
- class ConnectionResourceWithStreamingResponse:
247
- def __init__(self, connection: ConnectionResource) -> None:
248
- self._connection = connection
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
- connection.create,
338
+ connections.create,
252
339
  )
253
- self.retrieve = to_streamed_response_wrapper(
254
- connection.retrieve,
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 AsyncConnectionResourceWithStreamingResponse:
259
- def __init__(self, connection: AsyncConnectionResource) -> None:
260
- self._connection = connection
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
- connection.create,
353
+ connections.create,
354
+ )
355
+ self.list = async_to_streamed_response_wrapper(
356
+ connections.list,
264
357
  )
265
- self.retrieve = async_to_streamed_response_wrapper(
266
- connection.retrieve,
358
+ self.get = async_to_streamed_response_wrapper(
359
+ connections.get,
267
360
  )