supermemory 0.1.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 (47) hide show
  1. supermemory/__init__.py +94 -0
  2. supermemory/_base_client.py +1943 -0
  3. supermemory/_client.py +427 -0
  4. supermemory/_compat.py +219 -0
  5. supermemory/_constants.py +14 -0
  6. supermemory/_exceptions.py +108 -0
  7. supermemory/_files.py +123 -0
  8. supermemory/_models.py +803 -0
  9. supermemory/_qs.py +150 -0
  10. supermemory/_resource.py +43 -0
  11. supermemory/_response.py +832 -0
  12. supermemory/_streaming.py +333 -0
  13. supermemory/_types.py +217 -0
  14. supermemory/_utils/__init__.py +57 -0
  15. supermemory/_utils/_logs.py +25 -0
  16. supermemory/_utils/_proxy.py +62 -0
  17. supermemory/_utils/_reflection.py +42 -0
  18. supermemory/_utils/_streams.py +12 -0
  19. supermemory/_utils/_sync.py +86 -0
  20. supermemory/_utils/_transform.py +447 -0
  21. supermemory/_utils/_typing.py +151 -0
  22. supermemory/_utils/_utils.py +422 -0
  23. supermemory/_version.py +4 -0
  24. supermemory/lib/.keep +4 -0
  25. supermemory/py.typed +0 -0
  26. supermemory/resources/__init__.py +61 -0
  27. supermemory/resources/connection.py +267 -0
  28. supermemory/resources/memory.py +487 -0
  29. supermemory/resources/search.py +254 -0
  30. supermemory/resources/settings.py +195 -0
  31. supermemory/types/__init__.py +16 -0
  32. supermemory/types/connection_create_params.py +15 -0
  33. supermemory/types/connection_create_response.py +13 -0
  34. supermemory/types/memory_create_params.py +23 -0
  35. supermemory/types/memory_create_response.py +11 -0
  36. supermemory/types/memory_delete_response.py +9 -0
  37. supermemory/types/memory_get_response.py +27 -0
  38. supermemory/types/memory_list_params.py +24 -0
  39. supermemory/types/memory_list_response.py +59 -0
  40. supermemory/types/search_execute_params.py +56 -0
  41. supermemory/types/search_execute_response.py +52 -0
  42. supermemory/types/setting_update_params.py +30 -0
  43. supermemory/types/setting_update_response.py +35 -0
  44. supermemory-0.1.0a1.dist-info/METADATA +376 -0
  45. supermemory-0.1.0a1.dist-info/RECORD +47 -0
  46. supermemory-0.1.0a1.dist-info/WHEEL +4 -0
  47. supermemory-0.1.0a1.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,267 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import Literal
6
+
7
+ import httpx
8
+
9
+ from ..types import connection_create_params
10
+ from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
11
+ from .._utils import maybe_transform, async_maybe_transform
12
+ from .._compat import cached_property
13
+ from .._resource import SyncAPIResource, AsyncAPIResource
14
+ from .._response import (
15
+ to_raw_response_wrapper,
16
+ to_streamed_response_wrapper,
17
+ async_to_raw_response_wrapper,
18
+ async_to_streamed_response_wrapper,
19
+ )
20
+ from .._base_client import make_request_options
21
+ from ..types.connection_create_response import ConnectionCreateResponse
22
+
23
+ __all__ = ["ConnectionResource", "AsyncConnectionResource"]
24
+
25
+
26
+ class ConnectionResource(SyncAPIResource):
27
+ @cached_property
28
+ def with_raw_response(self) -> ConnectionResourceWithRawResponse:
29
+ """
30
+ This property can be used as a prefix for any HTTP method call to return
31
+ the raw response object instead of the parsed content.
32
+
33
+ For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers
34
+ """
35
+ return ConnectionResourceWithRawResponse(self)
36
+
37
+ @cached_property
38
+ def with_streaming_response(self) -> ConnectionResourceWithStreamingResponse:
39
+ """
40
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
41
+
42
+ For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response
43
+ """
44
+ return ConnectionResourceWithStreamingResponse(self)
45
+
46
+ def create(
47
+ self,
48
+ app: Literal["notion", "google-drive"],
49
+ *,
50
+ id: str,
51
+ redirect_url: str | NotGiven = NOT_GIVEN,
52
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
53
+ # The extra values given here take precedence over values defined on the client or passed to this method.
54
+ extra_headers: Headers | None = None,
55
+ extra_query: Query | None = None,
56
+ extra_body: Body | None = None,
57
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
58
+ ) -> ConnectionCreateResponse:
59
+ """
60
+ Initialize connection and get authorization URL
61
+
62
+ Args:
63
+ extra_headers: Send extra headers
64
+
65
+ extra_query: Add additional query parameters to the request
66
+
67
+ extra_body: Add additional JSON properties to the request
68
+
69
+ timeout: Override the client-level default timeout for this request, in seconds
70
+ """
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
+ options=make_request_options(
76
+ extra_headers=extra_headers,
77
+ extra_query=extra_query,
78
+ extra_body=extra_body,
79
+ timeout=timeout,
80
+ query=maybe_transform(
81
+ {
82
+ "id": id,
83
+ "redirect_url": redirect_url,
84
+ },
85
+ connection_create_params.ConnectionCreateParams,
86
+ ),
87
+ ),
88
+ cast_to=ConnectionCreateResponse,
89
+ )
90
+
91
+ def retrieve(
92
+ self,
93
+ connection_id: str,
94
+ *,
95
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
96
+ # The extra values given here take precedence over values defined on the client or passed to this method.
97
+ extra_headers: Headers | None = None,
98
+ extra_query: Query | None = None,
99
+ extra_body: Body | None = None,
100
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
101
+ ) -> None:
102
+ """
103
+ Args:
104
+ extra_headers: Send extra headers
105
+
106
+ extra_query: Add additional query parameters to the request
107
+
108
+ extra_body: Add additional JSON properties to the request
109
+
110
+ timeout: Override the client-level default timeout for this request, in seconds
111
+ """
112
+ if not connection_id:
113
+ raise ValueError(f"Expected a non-empty value for `connection_id` but received {connection_id!r}")
114
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
115
+ return self._get(
116
+ f"/connections/{connection_id}",
117
+ options=make_request_options(
118
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
119
+ ),
120
+ cast_to=NoneType,
121
+ )
122
+
123
+
124
+ class AsyncConnectionResource(AsyncAPIResource):
125
+ @cached_property
126
+ def with_raw_response(self) -> AsyncConnectionResourceWithRawResponse:
127
+ """
128
+ This property can be used as a prefix for any HTTP method call to return
129
+ the raw response object instead of the parsed content.
130
+
131
+ For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers
132
+ """
133
+ return AsyncConnectionResourceWithRawResponse(self)
134
+
135
+ @cached_property
136
+ def with_streaming_response(self) -> AsyncConnectionResourceWithStreamingResponse:
137
+ """
138
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
139
+
140
+ For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response
141
+ """
142
+ return AsyncConnectionResourceWithStreamingResponse(self)
143
+
144
+ async def create(
145
+ self,
146
+ app: Literal["notion", "google-drive"],
147
+ *,
148
+ id: str,
149
+ redirect_url: str | NotGiven = NOT_GIVEN,
150
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
151
+ # The extra values given here take precedence over values defined on the client or passed to this method.
152
+ extra_headers: Headers | None = None,
153
+ extra_query: Query | None = None,
154
+ extra_body: Body | None = None,
155
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
156
+ ) -> ConnectionCreateResponse:
157
+ """
158
+ Initialize connection and get authorization URL
159
+
160
+ Args:
161
+ extra_headers: Send extra headers
162
+
163
+ extra_query: Add additional query parameters to the request
164
+
165
+ extra_body: Add additional JSON properties to the request
166
+
167
+ timeout: Override the client-level default timeout for this request, in seconds
168
+ """
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}",
173
+ options=make_request_options(
174
+ extra_headers=extra_headers,
175
+ extra_query=extra_query,
176
+ extra_body=extra_body,
177
+ timeout=timeout,
178
+ query=await async_maybe_transform(
179
+ {
180
+ "id": id,
181
+ "redirect_url": redirect_url,
182
+ },
183
+ connection_create_params.ConnectionCreateParams,
184
+ ),
185
+ ),
186
+ cast_to=ConnectionCreateResponse,
187
+ )
188
+
189
+ async def retrieve(
190
+ self,
191
+ connection_id: str,
192
+ *,
193
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
194
+ # The extra values given here take precedence over values defined on the client or passed to this method.
195
+ extra_headers: Headers | None = None,
196
+ extra_query: Query | None = None,
197
+ extra_body: Body | None = None,
198
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
199
+ ) -> None:
200
+ """
201
+ Args:
202
+ extra_headers: Send extra headers
203
+
204
+ extra_query: Add additional query parameters to the request
205
+
206
+ extra_body: Add additional JSON properties to the request
207
+
208
+ timeout: Override the client-level default timeout for this request, in seconds
209
+ """
210
+ if not connection_id:
211
+ raise ValueError(f"Expected a non-empty value for `connection_id` but received {connection_id!r}")
212
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
213
+ return await self._get(
214
+ f"/connections/{connection_id}",
215
+ options=make_request_options(
216
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
217
+ ),
218
+ cast_to=NoneType,
219
+ )
220
+
221
+
222
+ class ConnectionResourceWithRawResponse:
223
+ def __init__(self, connection: ConnectionResource) -> None:
224
+ self._connection = connection
225
+
226
+ self.create = to_raw_response_wrapper(
227
+ connection.create,
228
+ )
229
+ self.retrieve = to_raw_response_wrapper(
230
+ connection.retrieve,
231
+ )
232
+
233
+
234
+ class AsyncConnectionResourceWithRawResponse:
235
+ def __init__(self, connection: AsyncConnectionResource) -> None:
236
+ self._connection = connection
237
+
238
+ self.create = async_to_raw_response_wrapper(
239
+ connection.create,
240
+ )
241
+ self.retrieve = async_to_raw_response_wrapper(
242
+ connection.retrieve,
243
+ )
244
+
245
+
246
+ class ConnectionResourceWithStreamingResponse:
247
+ def __init__(self, connection: ConnectionResource) -> None:
248
+ self._connection = connection
249
+
250
+ self.create = to_streamed_response_wrapper(
251
+ connection.create,
252
+ )
253
+ self.retrieve = to_streamed_response_wrapper(
254
+ connection.retrieve,
255
+ )
256
+
257
+
258
+ class AsyncConnectionResourceWithStreamingResponse:
259
+ def __init__(self, connection: AsyncConnectionResource) -> None:
260
+ self._connection = connection
261
+
262
+ self.create = async_to_streamed_response_wrapper(
263
+ connection.create,
264
+ )
265
+ self.retrieve = async_to_streamed_response_wrapper(
266
+ connection.retrieve,
267
+ )