Skip to content

Commit c0150ac

Browse files
feat(api): api update
1 parent 063cf45 commit c0150ac

File tree

9 files changed

+161
-39
lines changed

9 files changed

+161
-39
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 11
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-7db7d7a82f3e3d16db6481789ab9d65a18481ed036db6fcc1ef993f4a3e0e255.yml
3-
openapi_spec_hash: 3a969e6bf3d693c02ba142fcd8e64dd8
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-17ab2bb871e55eda916736277838e3b8bbd6cec59a3681783bdc454b9c4ab958.yml
3+
openapi_spec_hash: 4df685b7bc763e16de83eb28da61cdf3
44
config_hash: c8c1f2b0d63387d621f0cf066ae3379f

api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ from supermemory.types import (
5959

6060
Methods:
6161

62-
- <code title="post /v3/connections/{provider}">client.connections.<a href="./src/supermemory/resources/connections.py">create</a>(provider) -> <a href="./src/supermemory/types/connection_create_response.py">ConnectionCreateResponse</a></code>
63-
- <code title="get /v3/connections">client.connections.<a href="./src/supermemory/resources/connections.py">list</a>() -> <a href="./src/supermemory/types/connection_list_response.py">ConnectionListResponse</a></code>
62+
- <code title="post /v3/connections/{provider}">client.connections.<a href="./src/supermemory/resources/connections.py">create</a>(provider, \*\*<a href="src/supermemory/types/connection_create_params.py">params</a>) -> <a href="./src/supermemory/types/connection_create_response.py">ConnectionCreateResponse</a></code>
63+
- <code title="get /v3/connections">client.connections.<a href="./src/supermemory/resources/connections.py">list</a>(\*\*<a href="src/supermemory/types/connection_list_params.py">params</a>) -> <a href="./src/supermemory/types/connection_list_response.py">ConnectionListResponse</a></code>
6464
- <code title="get /v3/connections/{connectionId}">client.connections.<a href="./src/supermemory/resources/connections.py">get</a>(connection_id) -> <a href="./src/supermemory/types/connection_get_response.py">ConnectionGetResponse</a></code>

src/supermemory/resources/connections.py

Lines changed: 71 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22

33
from __future__ import annotations
44

5+
from typing import Dict, Union, Optional
56
from typing_extensions import Literal
67

78
import httpx
89

10+
from ..types import connection_list_params, connection_create_params
911
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
12+
from .._utils import maybe_transform, async_maybe_transform
1013
from .._compat import cached_property
1114
from .._resource import SyncAPIResource, AsyncAPIResource
1215
from .._response import (
@@ -47,6 +50,9 @@ def create(
4750
self,
4851
provider: Literal["notion", "google-drive", "onedrive"],
4952
*,
53+
end_user_id: str | NotGiven = NOT_GIVEN,
54+
redirect_url: str | NotGiven = NOT_GIVEN,
55+
metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN,
5056
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5157
# The extra values given here take precedence over values defined on the client or passed to this method.
5258
extra_headers: Headers | None = None,
@@ -70,27 +76,54 @@ def create(
7076
raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}")
7177
return self._post(
7278
f"/v3/connections/{provider}",
79+
body=maybe_transform({"metadata": metadata}, connection_create_params.ConnectionCreateParams),
7380
options=make_request_options(
74-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
81+
extra_headers=extra_headers,
82+
extra_query=extra_query,
83+
extra_body=extra_body,
84+
timeout=timeout,
85+
query=maybe_transform(
86+
{
87+
"end_user_id": end_user_id,
88+
"redirect_url": redirect_url,
89+
},
90+
connection_create_params.ConnectionCreateParams,
91+
),
7592
),
7693
cast_to=ConnectionCreateResponse,
7794
)
7895

7996
def list(
8097
self,
8198
*,
99+
end_user_id: str | NotGiven = NOT_GIVEN,
82100
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
83101
# The extra values given here take precedence over values defined on the client or passed to this method.
84102
extra_headers: Headers | None = None,
85103
extra_query: Query | None = None,
86104
extra_body: Body | None = None,
87105
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
88106
) -> ConnectionListResponse:
89-
"""List all connections"""
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+
"""
90119
return self._get(
91120
"/v3/connections",
92121
options=make_request_options(
93-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
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),
94127
),
95128
cast_to=ConnectionListResponse,
96129
)
@@ -153,6 +186,9 @@ async def create(
153186
self,
154187
provider: Literal["notion", "google-drive", "onedrive"],
155188
*,
189+
end_user_id: str | NotGiven = NOT_GIVEN,
190+
redirect_url: str | NotGiven = NOT_GIVEN,
191+
metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN,
156192
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
157193
# The extra values given here take precedence over values defined on the client or passed to this method.
158194
extra_headers: Headers | None = None,
@@ -176,27 +212,56 @@ async def create(
176212
raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}")
177213
return await self._post(
178214
f"/v3/connections/{provider}",
215+
body=await async_maybe_transform({"metadata": metadata}, connection_create_params.ConnectionCreateParams),
179216
options=make_request_options(
180-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
217+
extra_headers=extra_headers,
218+
extra_query=extra_query,
219+
extra_body=extra_body,
220+
timeout=timeout,
221+
query=await async_maybe_transform(
222+
{
223+
"end_user_id": end_user_id,
224+
"redirect_url": redirect_url,
225+
},
226+
connection_create_params.ConnectionCreateParams,
227+
),
181228
),
182229
cast_to=ConnectionCreateResponse,
183230
)
184231

185232
async def list(
186233
self,
187234
*,
235+
end_user_id: str | NotGiven = NOT_GIVEN,
188236
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
189237
# The extra values given here take precedence over values defined on the client or passed to this method.
190238
extra_headers: Headers | None = None,
191239
extra_query: Query | None = None,
192240
extra_body: Body | None = None,
193241
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
194242
) -> ConnectionListResponse:
195-
"""List all connections"""
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+
"""
196255
return await self._get(
197256
"/v3/connections",
198257
options=make_request_options(
199-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
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+
),
200265
),
201266
cast_to=ConnectionListResponse,
202267
)

src/supermemory/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
from .setting_get_response import SettingGetResponse as SettingGetResponse
1212
from .search_execute_params import SearchExecuteParams as SearchExecuteParams
1313
from .setting_update_params import SettingUpdateParams as SettingUpdateParams
14+
from .connection_list_params import ConnectionListParams as ConnectionListParams
1415
from .memory_delete_response import MemoryDeleteResponse as MemoryDeleteResponse
1516
from .memory_update_response import MemoryUpdateResponse as MemoryUpdateResponse
1617
from .connection_get_response import ConnectionGetResponse as ConnectionGetResponse
1718
from .search_execute_response import SearchExecuteResponse as SearchExecuteResponse
1819
from .setting_update_response import SettingUpdateResponse as SettingUpdateResponse
20+
from .connection_create_params import ConnectionCreateParams as ConnectionCreateParams
1921
from .connection_list_response import ConnectionListResponse as ConnectionListResponse
2022
from .connection_create_response import ConnectionCreateResponse as ConnectionCreateResponse
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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, Union, Optional
6+
from typing_extensions import Annotated, TypedDict
7+
8+
from .._utils import PropertyInfo
9+
10+
__all__ = ["ConnectionCreateParams"]
11+
12+
13+
class ConnectionCreateParams(TypedDict, total=False):
14+
end_user_id: Annotated[str, PropertyInfo(alias="endUserId")]
15+
16+
redirect_url: Annotated[str, PropertyInfo(alias="redirectUrl")]
17+
18+
metadata: Optional[Dict[str, Union[str, float, bool]]]

src/supermemory/types/connection_create_response.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3+
from typing import Optional
4+
35
from pydantic import Field as FieldInfo
46

57
from .._models import BaseModel
@@ -13,3 +15,5 @@ class ConnectionCreateResponse(BaseModel):
1315
auth_link: str = FieldInfo(alias="authLink")
1416

1517
expires_in: str = FieldInfo(alias="expiresIn")
18+
19+
redirects_to: Optional[str] = FieldInfo(alias="redirectsTo", default=None)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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 Annotated, TypedDict
6+
7+
from .._utils import PropertyInfo
8+
9+
__all__ = ["ConnectionListParams"]
10+
11+
12+
class ConnectionListParams(TypedDict, total=False):
13+
end_user_id: Annotated[str, PropertyInfo(alias="endUserId")]

src/supermemory/types/memory_list_response.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
from typing import Dict, List, Union, Optional
4-
from datetime import datetime
5-
from typing_extensions import Literal
64

75
from pydantic import Field as FieldInfo
86

@@ -13,7 +11,6 @@
1311

1412
class Memory(BaseModel):
1513
id: str
16-
"""Unique identifier of the memory."""
1714

1815
content: Optional[str] = None
1916
"""The content to extract and process into a memory.
@@ -27,9 +24,6 @@ class Memory(BaseModel):
2724
We automatically detect the content type from the url's response format.
2825
"""
2926

30-
created_at: datetime = FieldInfo(alias="createdAt")
31-
"""Creation timestamp"""
32-
3327
custom_id: Optional[str] = FieldInfo(alias="customId", default=None)
3428
"""Optional custom ID of the memory.
3529
@@ -49,34 +43,18 @@ class Memory(BaseModel):
4943

5044
source: Optional[str] = None
5145

52-
status: Literal["unknown", "queued", "extracting", "chunking", "embedding", "indexing", "done", "failed"]
53-
"""Status of the memory"""
54-
5546
summary: Optional[str] = None
56-
"""Summary of the memory content"""
5747

5848
title: Optional[str] = None
5949
"""Title of the memory"""
6050

61-
type: Literal["text", "pdf", "tweet", "google_doc", "image", "video", "notion_doc", "webpage"]
62-
"""Type of the memory"""
63-
64-
updated_at: datetime = FieldInfo(alias="updatedAt")
65-
"""Last update timestamp"""
66-
67-
url: Optional[str] = None
68-
"""URL of the memory"""
69-
7051
container_tags: Optional[List[str]] = FieldInfo(alias="containerTags", default=None)
7152
"""Optional tags this memory should be containerized by.
7253
7354
This can be an ID for your user, a project ID, or any other identifier you wish
7455
to use to group memories.
7556
"""
7657

77-
raw: None = None
78-
"""Raw content of the memory"""
79-
8058

8159
class Pagination(BaseModel):
8260
current_page: float = FieldInfo(alias="currentPage")

0 commit comments

Comments
 (0)