Skip to content

Commit 3464f92

Browse files
stainless-app[bot]Dhravya
authored andcommitted
feat(api): manual updates
1 parent c2963f4 commit 3464f92

File tree

7 files changed

+305
-3
lines changed

7 files changed

+305
-3
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 18
1+
configured_endpoints: 19
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-new-ebd5e757d0e76cb83013e01a1e0bb3dba62beb83b2a2ffa28d148ea032e96fd0.yml
33
openapi_spec_hash: f930474a6ad230545154244045cc602e
4-
config_hash: 2113359488acead9b94556d37765c57e
4+
config_hash: 23f1770611dec274363355d52f3918cc

api.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# Supermemory
2+
3+
Types:
4+
5+
```python
6+
from supermemory.types import ProfileResponse
7+
```
8+
9+
Methods:
10+
11+
- <code title="post /v4/profile">client.<a href="./src/supermemory/_client.py">profile</a>(\*\*<a href="src/supermemory/types/client_profile_params.py">params</a>) -> <a href="./src/supermemory/types/profile_response.py">ProfileResponse</a></code>
12+
113
# Memories
214

315
Types:

src/supermemory/_client.py

Lines changed: 123 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,43 @@
1010

1111
from . import _exceptions
1212
from ._qs import Querystring
13+
from .types import client_profile_params
1314
from ._types import (
15+
Body,
1416
Omit,
17+
Query,
18+
Headers,
1519
Timeout,
1620
NotGiven,
1721
Transport,
1822
ProxiesTypes,
1923
RequestOptions,
24+
omit,
2025
not_given,
2126
)
22-
from ._utils import is_given, get_async_library
27+
from ._utils import (
28+
is_given,
29+
maybe_transform,
30+
get_async_library,
31+
async_maybe_transform,
32+
)
2333
from ._version import __version__
34+
from ._response import (
35+
to_raw_response_wrapper,
36+
to_streamed_response_wrapper,
37+
async_to_raw_response_wrapper,
38+
async_to_streamed_response_wrapper,
39+
)
2440
from .resources import search, memories, settings, documents, connections
2541
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
2642
from ._exceptions import APIStatusError, SupermemoryError
2743
from ._base_client import (
2844
DEFAULT_MAX_RETRIES,
2945
SyncAPIClient,
3046
AsyncAPIClient,
47+
make_request_options,
3148
)
49+
from .types.profile_response import ProfileResponse
3250

3351
__all__ = [
3452
"Timeout",
@@ -184,6 +202,50 @@ def copy(
184202
# client.with_options(timeout=10).foo.create(...)
185203
with_options = copy
186204

205+
def profile(
206+
self,
207+
*,
208+
container_tag: str,
209+
q: str | Omit = omit,
210+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
211+
# The extra values given here take precedence over values defined on the client or passed to this method.
212+
extra_headers: Headers | None = None,
213+
extra_query: Query | None = None,
214+
extra_body: Body | None = None,
215+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
216+
) -> ProfileResponse:
217+
"""
218+
Get user profile with optional search results
219+
220+
Args:
221+
container_tag: Tag to filter the profile by. This can be an ID for your user, a project ID, or
222+
any other identifier you wish to use to filter memories.
223+
224+
q: Optional search query to include search results in the response
225+
226+
extra_headers: Send extra headers
227+
228+
extra_query: Add additional query parameters to the request
229+
230+
extra_body: Add additional JSON properties to the request
231+
232+
timeout: Override the client-level default timeout for this request, in seconds
233+
"""
234+
return self.post(
235+
"/v4/profile",
236+
body=maybe_transform(
237+
{
238+
"container_tag": container_tag,
239+
"q": q,
240+
},
241+
client_profile_params.ClientProfileParams,
242+
),
243+
options=make_request_options(
244+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
245+
),
246+
cast_to=ProfileResponse,
247+
)
248+
187249
@override
188250
def _make_status_error(
189251
self,
@@ -360,6 +422,50 @@ def copy(
360422
# client.with_options(timeout=10).foo.create(...)
361423
with_options = copy
362424

425+
async def profile(
426+
self,
427+
*,
428+
container_tag: str,
429+
q: str | Omit = omit,
430+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
431+
# The extra values given here take precedence over values defined on the client or passed to this method.
432+
extra_headers: Headers | None = None,
433+
extra_query: Query | None = None,
434+
extra_body: Body | None = None,
435+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
436+
) -> ProfileResponse:
437+
"""
438+
Get user profile with optional search results
439+
440+
Args:
441+
container_tag: Tag to filter the profile by. This can be an ID for your user, a project ID, or
442+
any other identifier you wish to use to filter memories.
443+
444+
q: Optional search query to include search results in the response
445+
446+
extra_headers: Send extra headers
447+
448+
extra_query: Add additional query parameters to the request
449+
450+
extra_body: Add additional JSON properties to the request
451+
452+
timeout: Override the client-level default timeout for this request, in seconds
453+
"""
454+
return await self.post(
455+
"/v4/profile",
456+
body=await async_maybe_transform(
457+
{
458+
"container_tag": container_tag,
459+
"q": q,
460+
},
461+
client_profile_params.ClientProfileParams,
462+
),
463+
options=make_request_options(
464+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
465+
),
466+
cast_to=ProfileResponse,
467+
)
468+
363469
@override
364470
def _make_status_error(
365471
self,
@@ -402,6 +508,10 @@ def __init__(self, client: Supermemory) -> None:
402508
self.settings = settings.SettingsResourceWithRawResponse(client.settings)
403509
self.connections = connections.ConnectionsResourceWithRawResponse(client.connections)
404510

511+
self.profile = to_raw_response_wrapper(
512+
client.profile,
513+
)
514+
405515

406516
class AsyncSupermemoryWithRawResponse:
407517
def __init__(self, client: AsyncSupermemory) -> None:
@@ -411,6 +521,10 @@ def __init__(self, client: AsyncSupermemory) -> None:
411521
self.settings = settings.AsyncSettingsResourceWithRawResponse(client.settings)
412522
self.connections = connections.AsyncConnectionsResourceWithRawResponse(client.connections)
413523

524+
self.profile = async_to_raw_response_wrapper(
525+
client.profile,
526+
)
527+
414528

415529
class SupermemoryWithStreamedResponse:
416530
def __init__(self, client: Supermemory) -> None:
@@ -420,6 +534,10 @@ def __init__(self, client: Supermemory) -> None:
420534
self.settings = settings.SettingsResourceWithStreamingResponse(client.settings)
421535
self.connections = connections.ConnectionsResourceWithStreamingResponse(client.connections)
422536

537+
self.profile = to_streamed_response_wrapper(
538+
client.profile,
539+
)
540+
423541

424542
class AsyncSupermemoryWithStreamedResponse:
425543
def __init__(self, client: AsyncSupermemory) -> None:
@@ -429,6 +547,10 @@ def __init__(self, client: AsyncSupermemory) -> None:
429547
self.settings = settings.AsyncSettingsResourceWithStreamingResponse(client.settings)
430548
self.connections = connections.AsyncConnectionsResourceWithStreamingResponse(client.connections)
431549

550+
self.profile = async_to_streamed_response_wrapper(
551+
client.profile,
552+
)
553+
432554

433555
Client = Supermemory
434556

src/supermemory/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
from .profile_response import ProfileResponse as ProfileResponse
56
from .memory_add_params import MemoryAddParams as MemoryAddParams
67
from .memory_list_params import MemoryListParams as MemoryListParams
78
from .document_add_params import DocumentAddParams as DocumentAddParams
@@ -11,6 +12,7 @@
1112
from .memory_list_response import MemoryListResponse as MemoryListResponse
1213
from .memory_update_params import MemoryUpdateParams as MemoryUpdateParams
1314
from .setting_get_response import SettingGetResponse as SettingGetResponse
15+
from .client_profile_params import ClientProfileParams as ClientProfileParams
1416
from .document_add_response import DocumentAddResponse as DocumentAddResponse
1517
from .document_get_response import DocumentGetResponse as DocumentGetResponse
1618
from .search_execute_params import SearchExecuteParams as SearchExecuteParams
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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 Required, Annotated, TypedDict
6+
7+
from .._utils import PropertyInfo
8+
9+
__all__ = ["ClientProfileParams"]
10+
11+
12+
class ClientProfileParams(TypedDict, total=False):
13+
container_tag: Required[Annotated[str, PropertyInfo(alias="containerTag")]]
14+
"""Tag to filter the profile by.
15+
16+
This can be an ID for your user, a project ID, or any other identifier you wish
17+
to use to filter memories.
18+
"""
19+
20+
q: str
21+
"""Optional search query to include search results in the response"""
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import List, Optional
4+
5+
from pydantic import Field as FieldInfo
6+
7+
from .._models import BaseModel
8+
9+
__all__ = ["ProfileResponse", "Profile", "SearchResults"]
10+
11+
12+
class Profile(BaseModel):
13+
dynamic: List[str]
14+
"""Dynamic profile information (recent memories)"""
15+
16+
static: List[str]
17+
"""Static profile information that remains relevant long-term"""
18+
19+
20+
class SearchResults(BaseModel):
21+
results: List[object]
22+
"""Search results for the provided query"""
23+
24+
timing: float
25+
"""Search timing in milliseconds"""
26+
27+
total: float
28+
"""Total number of search results"""
29+
30+
31+
class ProfileResponse(BaseModel):
32+
profile: Profile
33+
34+
search_results: Optional[SearchResults] = FieldInfo(alias="searchResults", default=None)
35+
"""Search results if a search query was provided"""

tests/api_resources/test_client.py

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
import os
6+
from typing import Any, cast
7+
8+
import pytest
9+
10+
from supermemory import Supermemory, AsyncSupermemory
11+
from tests.utils import assert_matches_type
12+
from supermemory.types import ProfileResponse
13+
14+
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
15+
16+
17+
class TestClient:
18+
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
19+
20+
@pytest.mark.skip(reason="Prism tests are disabled")
21+
@parametrize
22+
def test_method_profile(self, client: Supermemory) -> None:
23+
client_ = client.profile(
24+
container_tag="containerTag",
25+
)
26+
assert_matches_type(ProfileResponse, client_, path=["response"])
27+
28+
@pytest.mark.skip(reason="Prism tests are disabled")
29+
@parametrize
30+
def test_method_profile_with_all_params(self, client: Supermemory) -> None:
31+
client_ = client.profile(
32+
container_tag="containerTag",
33+
q="q",
34+
)
35+
assert_matches_type(ProfileResponse, client_, path=["response"])
36+
37+
@pytest.mark.skip(reason="Prism tests are disabled")
38+
@parametrize
39+
def test_raw_response_profile(self, client: Supermemory) -> None:
40+
response = client.with_raw_response.profile(
41+
container_tag="containerTag",
42+
)
43+
44+
assert response.is_closed is True
45+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
46+
client_ = response.parse()
47+
assert_matches_type(ProfileResponse, client_, path=["response"])
48+
49+
@pytest.mark.skip(reason="Prism tests are disabled")
50+
@parametrize
51+
def test_streaming_response_profile(self, client: Supermemory) -> None:
52+
with client.with_streaming_response.profile(
53+
container_tag="containerTag",
54+
) as response:
55+
assert not response.is_closed
56+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
57+
58+
client_ = response.parse()
59+
assert_matches_type(ProfileResponse, client_, path=["response"])
60+
61+
assert cast(Any, response.is_closed) is True
62+
63+
64+
class TestAsyncClient:
65+
parametrize = pytest.mark.parametrize(
66+
"async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"]
67+
)
68+
69+
@pytest.mark.skip(reason="Prism tests are disabled")
70+
@parametrize
71+
async def test_method_profile(self, async_client: AsyncSupermemory) -> None:
72+
client = await async_client.profile(
73+
container_tag="containerTag",
74+
)
75+
assert_matches_type(ProfileResponse, client, path=["response"])
76+
77+
@pytest.mark.skip(reason="Prism tests are disabled")
78+
@parametrize
79+
async def test_method_profile_with_all_params(self, async_client: AsyncSupermemory) -> None:
80+
client = await async_client.profile(
81+
container_tag="containerTag",
82+
q="q",
83+
)
84+
assert_matches_type(ProfileResponse, client, path=["response"])
85+
86+
@pytest.mark.skip(reason="Prism tests are disabled")
87+
@parametrize
88+
async def test_raw_response_profile(self, async_client: AsyncSupermemory) -> None:
89+
response = await async_client.with_raw_response.profile(
90+
container_tag="containerTag",
91+
)
92+
93+
assert response.is_closed is True
94+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
95+
client = await response.parse()
96+
assert_matches_type(ProfileResponse, client, path=["response"])
97+
98+
@pytest.mark.skip(reason="Prism tests are disabled")
99+
@parametrize
100+
async def test_streaming_response_profile(self, async_client: AsyncSupermemory) -> None:
101+
async with async_client.with_streaming_response.profile(
102+
container_tag="containerTag",
103+
) as response:
104+
assert not response.is_closed
105+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
106+
107+
client = await response.parse()
108+
assert_matches_type(ProfileResponse, client, path=["response"])
109+
110+
assert cast(Any, response.is_closed) is True

0 commit comments

Comments
 (0)