Skip to content

Commit beffc5e

Browse files
feat(api): api update
1 parent 173a337 commit beffc5e

File tree

5 files changed

+23
-44
lines changed

5 files changed

+23
-44
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: 12
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-be07470b9ac183653e025d87493d1fa66e1099c281d78c11b4822c56b81f3ce3.yml
3-
openapi_spec_hash: ab48eeb62ea3b68bec83da9b3e246680
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-c907416d5056243275fc6d1c3842e38096406a4a895f6523c2cbfddfca072ad8.yml
3+
openapi_spec_hash: 0eef2d6ae43857f544ba7bcace19c755
44
config_hash: 8477e3ee6fd596ab6ac911d052e4de79

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ from supermemory.types import (
1414

1515
Methods:
1616

17-
- <code title="patch /v3/memories/{id}">client.memories.<a href="./src/supermemory/resources/memories.py">update</a>(path_id, \*\*<a href="src/supermemory/types/memory_update_params.py">params</a>) -> <a href="./src/supermemory/types/memory_update_response.py">MemoryUpdateResponse</a></code>
17+
- <code title="patch /v3/memories/{id}">client.memories.<a href="./src/supermemory/resources/memories.py">update</a>(id, \*\*<a href="src/supermemory/types/memory_update_params.py">params</a>) -> <a href="./src/supermemory/types/memory_update_response.py">MemoryUpdateResponse</a></code>
1818
- <code title="get /v3/memories">client.memories.<a href="./src/supermemory/resources/memories.py">list</a>(\*\*<a href="src/supermemory/types/memory_list_params.py">params</a>) -> <a href="./src/supermemory/types/memory_list_response.py">MemoryListResponse</a></code>
1919
- <code title="delete /v3/memories/{id}">client.memories.<a href="./src/supermemory/resources/memories.py">delete</a>(id) -> None</code>
2020
- <code title="post /v3/memories">client.memories.<a href="./src/supermemory/resources/memories.py">add</a>(\*\*<a href="src/supermemory/types/memory_add_params.py">params</a>) -> <a href="./src/supermemory/types/memory_add_response.py">MemoryAddResponse</a></code>

src/supermemory/resources/memories.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,8 @@ def with_streaming_response(self) -> MemoriesResourceWithStreamingResponse:
5050

5151
def update(
5252
self,
53-
path_id: str,
53+
id: str,
5454
*,
55-
body_id: str,
5655
content: str,
5756
container_tags: List[str] | NotGiven = NOT_GIVEN,
5857
custom_id: str | NotGiven = NOT_GIVEN,
@@ -68,8 +67,6 @@ def update(
6867
Update a memory with any content type (text, url, file, etc.) and metadata
6968
7069
Args:
71-
body_id: Unique identifier of the memory.
72-
7370
content: The content to extract and process into a memory. This can be a URL to a
7471
website, a PDF, an image, or a video.
7572
@@ -99,13 +96,12 @@ def update(
9996
10097
timeout: Override the client-level default timeout for this request, in seconds
10198
"""
102-
if not path_id:
103-
raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}")
99+
if not id:
100+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
104101
return self._patch(
105-
f"/v3/memories/{path_id}",
102+
f"/v3/memories/{id}",
106103
body=maybe_transform(
107104
{
108-
"body_id": body_id,
109105
"content": content,
110106
"container_tags": container_tags,
111107
"custom_id": custom_id,
@@ -370,9 +366,8 @@ def with_streaming_response(self) -> AsyncMemoriesResourceWithStreamingResponse:
370366

371367
async def update(
372368
self,
373-
path_id: str,
369+
id: str,
374370
*,
375-
body_id: str,
376371
content: str,
377372
container_tags: List[str] | NotGiven = NOT_GIVEN,
378373
custom_id: str | NotGiven = NOT_GIVEN,
@@ -388,8 +383,6 @@ async def update(
388383
Update a memory with any content type (text, url, file, etc.) and metadata
389384
390385
Args:
391-
body_id: Unique identifier of the memory.
392-
393386
content: The content to extract and process into a memory. This can be a URL to a
394387
website, a PDF, an image, or a video.
395388
@@ -419,13 +412,12 @@ async def update(
419412
420413
timeout: Override the client-level default timeout for this request, in seconds
421414
"""
422-
if not path_id:
423-
raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}")
415+
if not id:
416+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
424417
return await self._patch(
425-
f"/v3/memories/{path_id}",
418+
f"/v3/memories/{id}",
426419
body=await async_maybe_transform(
427420
{
428-
"body_id": body_id,
429421
"content": content,
430422
"container_tags": container_tags,
431423
"custom_id": custom_id,

src/supermemory/types/memory_update_params.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111

1212

1313
class MemoryUpdateParams(TypedDict, total=False):
14-
body_id: Required[Annotated[str, PropertyInfo(alias="id")]]
15-
"""Unique identifier of the memory."""
16-
1714
content: Required[str]
1815
"""The content to extract and process into a memory.
1916

tests/api_resources/test_memories.py

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ class TestMemories:
2727
@parametrize
2828
def test_method_update(self, client: Supermemory) -> None:
2929
memory = client.memories.update(
30-
path_id="id",
31-
body_id="acxV5LHMEsG2hMSNb4umbn",
30+
id="id",
3231
content="This is a detailed article about machine learning concepts...",
3332
)
3433
assert_matches_type(MemoryUpdateResponse, memory, path=["response"])
@@ -37,8 +36,7 @@ def test_method_update(self, client: Supermemory) -> None:
3736
@parametrize
3837
def test_method_update_with_all_params(self, client: Supermemory) -> None:
3938
memory = client.memories.update(
40-
path_id="id",
41-
body_id="acxV5LHMEsG2hMSNb4umbn",
39+
id="id",
4240
content="This is a detailed article about machine learning concepts...",
4341
container_tags=["user_123", "project_123"],
4442
custom_id="mem_abc123",
@@ -57,8 +55,7 @@ def test_method_update_with_all_params(self, client: Supermemory) -> None:
5755
@parametrize
5856
def test_raw_response_update(self, client: Supermemory) -> None:
5957
response = client.memories.with_raw_response.update(
60-
path_id="id",
61-
body_id="acxV5LHMEsG2hMSNb4umbn",
58+
id="id",
6259
content="This is a detailed article about machine learning concepts...",
6360
)
6461

@@ -71,8 +68,7 @@ def test_raw_response_update(self, client: Supermemory) -> None:
7168
@parametrize
7269
def test_streaming_response_update(self, client: Supermemory) -> None:
7370
with client.memories.with_streaming_response.update(
74-
path_id="id",
75-
body_id="acxV5LHMEsG2hMSNb4umbn",
71+
id="id",
7672
content="This is a detailed article about machine learning concepts...",
7773
) as response:
7874
assert not response.is_closed
@@ -86,10 +82,9 @@ def test_streaming_response_update(self, client: Supermemory) -> None:
8682
@pytest.mark.skip()
8783
@parametrize
8884
def test_path_params_update(self, client: Supermemory) -> None:
89-
with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_id` but received ''"):
85+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
9086
client.memories.with_raw_response.update(
91-
path_id="",
92-
body_id="acxV5LHMEsG2hMSNb4umbn",
87+
id="",
9388
content="This is a detailed article about machine learning concepts...",
9489
)
9590

@@ -311,8 +306,7 @@ class TestAsyncMemories:
311306
@parametrize
312307
async def test_method_update(self, async_client: AsyncSupermemory) -> None:
313308
memory = await async_client.memories.update(
314-
path_id="id",
315-
body_id="acxV5LHMEsG2hMSNb4umbn",
309+
id="id",
316310
content="This is a detailed article about machine learning concepts...",
317311
)
318312
assert_matches_type(MemoryUpdateResponse, memory, path=["response"])
@@ -321,8 +315,7 @@ async def test_method_update(self, async_client: AsyncSupermemory) -> None:
321315
@parametrize
322316
async def test_method_update_with_all_params(self, async_client: AsyncSupermemory) -> None:
323317
memory = await async_client.memories.update(
324-
path_id="id",
325-
body_id="acxV5LHMEsG2hMSNb4umbn",
318+
id="id",
326319
content="This is a detailed article about machine learning concepts...",
327320
container_tags=["user_123", "project_123"],
328321
custom_id="mem_abc123",
@@ -341,8 +334,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncSupermemor
341334
@parametrize
342335
async def test_raw_response_update(self, async_client: AsyncSupermemory) -> None:
343336
response = await async_client.memories.with_raw_response.update(
344-
path_id="id",
345-
body_id="acxV5LHMEsG2hMSNb4umbn",
337+
id="id",
346338
content="This is a detailed article about machine learning concepts...",
347339
)
348340

@@ -355,8 +347,7 @@ async def test_raw_response_update(self, async_client: AsyncSupermemory) -> None
355347
@parametrize
356348
async def test_streaming_response_update(self, async_client: AsyncSupermemory) -> None:
357349
async with async_client.memories.with_streaming_response.update(
358-
path_id="id",
359-
body_id="acxV5LHMEsG2hMSNb4umbn",
350+
id="id",
360351
content="This is a detailed article about machine learning concepts...",
361352
) as response:
362353
assert not response.is_closed
@@ -370,10 +361,9 @@ async def test_streaming_response_update(self, async_client: AsyncSupermemory) -
370361
@pytest.mark.skip()
371362
@parametrize
372363
async def test_path_params_update(self, async_client: AsyncSupermemory) -> None:
373-
with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_id` but received ''"):
364+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
374365
await async_client.memories.with_raw_response.update(
375-
path_id="",
376-
body_id="acxV5LHMEsG2hMSNb4umbn",
366+
id="",
377367
content="This is a detailed article about machine learning concepts...",
378368
)
379369

0 commit comments

Comments
 (0)