Skip to content

Commit dce7124

Browse files
feat(api): manual updates
1 parent d5cb6c2 commit dce7124

File tree

8 files changed

+59
-55
lines changed

8 files changed

+59
-55
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: 15
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper%2Fbeeper-desktop-api-a3fb0de6dd98f8a51d73e3fdf51de6143f2e8e764048246392624a56b4a3a481.yml
3-
openapi_spec_hash: 50e1001c340cb0bd3436b6329240769b
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper%2Fbeeper-desktop-api-100e7052e74644026f594642a424e04ab306d44e6c73a1f4761cf8a7d7ee0d8f.yml
3+
openapi_spec_hash: 3437145a74c032f2319a235bf40baa88
44
config_hash: 2e31d02f28a11ef29eb747bcf559786a

api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ Methods:
7070
Types:
7171

7272
```python
73-
from beeper_desktop_api.types import MessageSendResponse
73+
from beeper_desktop_api.types import MessageListResponse, MessageSendResponse
7474
```
7575

7676
Methods:
7777

78-
- <code title="get /v1/messages">client.messages.<a href="./src/beeper_desktop_api/resources/messages.py">list</a>(\*\*<a href="src/beeper_desktop_api/types/message_list_params.py">params</a>) -> <a href="./src/beeper_desktop_api/types/shared/message.py">SyncCursorList[Message]</a></code>
78+
- <code title="get /v1/messages">client.messages.<a href="./src/beeper_desktop_api/resources/messages.py">list</a>(\*\*<a href="src/beeper_desktop_api/types/message_list_params.py">params</a>) -> <a href="./src/beeper_desktop_api/types/message_list_response.py">MessageListResponse</a></code>
7979
- <code title="get /v1/messages/search">client.messages.<a href="./src/beeper_desktop_api/resources/messages.py">search</a>(\*\*<a href="src/beeper_desktop_api/types/message_search_params.py">params</a>) -> <a href="./src/beeper_desktop_api/types/shared/message.py">SyncCursorSearch[Message]</a></code>
8080
- <code title="post /v1/messages">client.messages.<a href="./src/beeper_desktop_api/resources/messages.py">send</a>(\*\*<a href="src/beeper_desktop_api/types/message_send_params.py">params</a>) -> <a href="./src/beeper_desktop_api/types/message_send_response.py">MessageSendResponse</a></code>

src/beeper_desktop_api/resources/messages.py

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
async_to_raw_response_wrapper,
2020
async_to_streamed_response_wrapper,
2121
)
22-
from ..pagination import SyncCursorList, AsyncCursorList, SyncCursorSearch, AsyncCursorSearch
22+
from ..pagination import SyncCursorSearch, AsyncCursorSearch
2323
from .._base_client import AsyncPaginator, make_request_options
2424
from ..types.shared.message import Message
25+
from ..types.message_list_response import MessageListResponse
2526
from ..types.message_send_response import MessageSendResponse
2627

2728
__all__ = ["MessagesResource", "AsyncMessagesResource"]
@@ -61,7 +62,7 @@ def list(
6162
extra_query: Query | None = None,
6263
extra_body: Body | None = None,
6364
timeout: float | httpx.Timeout | None | NotGiven = not_given,
64-
) -> SyncCursorList[Message]:
65+
) -> MessageListResponse:
6566
"""List all messages in a chat with cursor-based pagination.
6667
6768
Sorted by timestamp.
@@ -83,9 +84,8 @@ def list(
8384
8485
timeout: Override the client-level default timeout for this request, in seconds
8586
"""
86-
return self._get_api_list(
87+
return self._get(
8788
"/v1/messages",
88-
page=SyncCursorList[Message],
8989
options=make_request_options(
9090
extra_headers=extra_headers,
9191
extra_query=extra_query,
@@ -100,7 +100,7 @@ def list(
100100
message_list_params.MessageListParams,
101101
),
102102
),
103-
model=Message,
103+
cast_to=MessageListResponse,
104104
)
105105

106106
def search(
@@ -153,8 +153,7 @@ def search(
153153
include_muted: Include messages in chats marked as Muted by the user, which are usually less
154154
important. Default: true. Set to false if the user wants a more refined search.
155155
156-
limit: Maximum number of messages to return (1–500). Defaults to 20. The current
157-
implementation caps each page at 20 items even if a higher limit is requested.
156+
limit: Maximum number of messages to return.
158157
159158
media_types: Filter messages by media types. Use ['any'] for any media type, or specify exact
160159
types like ['video', 'image']. Omit for no media filtering.
@@ -208,7 +207,7 @@ def search(
208207
def send(
209208
self,
210209
*,
211-
chat_id: str,
210+
chat_id: str | Omit = omit,
212211
reply_to_message_id: str | Omit = omit,
213212
text: str | Omit = omit,
214213
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -277,7 +276,7 @@ def with_streaming_response(self) -> AsyncMessagesResourceWithStreamingResponse:
277276
"""
278277
return AsyncMessagesResourceWithStreamingResponse(self)
279278

280-
def list(
279+
async def list(
281280
self,
282281
*,
283282
chat_id: str,
@@ -289,7 +288,7 @@ def list(
289288
extra_query: Query | None = None,
290289
extra_body: Body | None = None,
291290
timeout: float | httpx.Timeout | None | NotGiven = not_given,
292-
) -> AsyncPaginator[Message, AsyncCursorList[Message]]:
291+
) -> MessageListResponse:
293292
"""List all messages in a chat with cursor-based pagination.
294293
295294
Sorted by timestamp.
@@ -311,15 +310,14 @@ def list(
311310
312311
timeout: Override the client-level default timeout for this request, in seconds
313312
"""
314-
return self._get_api_list(
313+
return await self._get(
315314
"/v1/messages",
316-
page=AsyncCursorList[Message],
317315
options=make_request_options(
318316
extra_headers=extra_headers,
319317
extra_query=extra_query,
320318
extra_body=extra_body,
321319
timeout=timeout,
322-
query=maybe_transform(
320+
query=await async_maybe_transform(
323321
{
324322
"chat_id": chat_id,
325323
"cursor": cursor,
@@ -328,7 +326,7 @@ def list(
328326
message_list_params.MessageListParams,
329327
),
330328
),
331-
model=Message,
329+
cast_to=MessageListResponse,
332330
)
333331

334332
def search(
@@ -381,8 +379,7 @@ def search(
381379
include_muted: Include messages in chats marked as Muted by the user, which are usually less
382380
important. Default: true. Set to false if the user wants a more refined search.
383381
384-
limit: Maximum number of messages to return (1–500). Defaults to 20. The current
385-
implementation caps each page at 20 items even if a higher limit is requested.
382+
limit: Maximum number of messages to return.
386383
387384
media_types: Filter messages by media types. Use ['any'] for any media type, or specify exact
388385
types like ['video', 'image']. Omit for no media filtering.
@@ -436,7 +433,7 @@ def search(
436433
async def send(
437434
self,
438435
*,
439-
chat_id: str,
436+
chat_id: str | Omit = omit,
440437
reply_to_message_id: str | Omit = omit,
441438
text: str | Omit = omit,
442439
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.

src/beeper_desktop_api/types/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from .client_search_params import ClientSearchParams as ClientSearchParams
2828
from .account_list_response import AccountListResponse as AccountListResponse
2929
from .contact_search_params import ContactSearchParams as ContactSearchParams
30+
from .message_list_response import MessageListResponse as MessageListResponse
3031
from .message_search_params import MessageSearchParams as MessageSearchParams
3132
from .message_send_response import MessageSendResponse as MessageSendResponse
3233
from .contact_search_response import ContactSearchResponse as ContactSearchResponse
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 typing import List
4+
5+
from pydantic import Field as FieldInfo
6+
7+
from .._models import BaseModel
8+
from .shared.message import Message
9+
10+
__all__ = ["MessageListResponse"]
11+
12+
13+
class MessageListResponse(BaseModel):
14+
has_more: bool = FieldInfo(alias="hasMore")
15+
"""True if additional results can be fetched."""
16+
17+
items: List[Message]
18+
"""Messages from the chat, sorted by timestamp.
19+
20+
Use message.sortKey as cursor for pagination.
21+
"""

src/beeper_desktop_api/types/message_search_params.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,7 @@ class MessageSearchParams(TypedDict, total=False):
5656
"""
5757

5858
limit: int
59-
"""Maximum number of messages to return (1–500).
60-
61-
Defaults to 20. The current implementation caps each page at 20 items even if a
62-
higher limit is requested.
63-
"""
59+
"""Maximum number of messages to return."""
6460

6561
media_types: Annotated[List[Literal["any", "video", "image", "link", "file"]], PropertyInfo(alias="mediaTypes")]
6662
"""Filter messages by media types.

src/beeper_desktop_api/types/message_send_params.py

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

33
from __future__ import annotations
44

5-
from typing_extensions import Required, Annotated, TypedDict
5+
from typing_extensions import Annotated, TypedDict
66

77
from .._utils import PropertyInfo
88

99
__all__ = ["MessageSendParams"]
1010

1111

1212
class MessageSendParams(TypedDict, total=False):
13-
chat_id: Required[Annotated[str, PropertyInfo(alias="chatID")]]
13+
chat_id: Annotated[str, PropertyInfo(alias="chatID")]
1414
"""Unique identifier of the chat."""
1515

1616
reply_to_message_id: Annotated[str, PropertyInfo(alias="replyToMessageID")]

tests/api_resources/test_messages.py

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
from tests.utils import assert_matches_type
1111
from beeper_desktop_api import BeeperDesktop, AsyncBeeperDesktop
1212
from beeper_desktop_api.types import (
13+
MessageListResponse,
1314
MessageSendResponse,
1415
)
1516
from beeper_desktop_api._utils import parse_datetime
16-
from beeper_desktop_api.pagination import SyncCursorList, AsyncCursorList, SyncCursorSearch, AsyncCursorSearch
17+
from beeper_desktop_api.pagination import SyncCursorSearch, AsyncCursorSearch
1718
from beeper_desktop_api.types.shared import Message
1819

1920
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -27,7 +28,7 @@ def test_method_list(self, client: BeeperDesktop) -> None:
2728
message = client.messages.list(
2829
chat_id="!NCdzlIaMjZUmvmvyHU:beeper.com",
2930
)
30-
assert_matches_type(SyncCursorList[Message], message, path=["response"])
31+
assert_matches_type(MessageListResponse, message, path=["response"])
3132

3233
@parametrize
3334
def test_method_list_with_all_params(self, client: BeeperDesktop) -> None:
@@ -36,7 +37,7 @@ def test_method_list_with_all_params(self, client: BeeperDesktop) -> None:
3637
cursor="821744079",
3738
direction="before",
3839
)
39-
assert_matches_type(SyncCursorList[Message], message, path=["response"])
40+
assert_matches_type(MessageListResponse, message, path=["response"])
4041

4142
@parametrize
4243
def test_raw_response_list(self, client: BeeperDesktop) -> None:
@@ -47,7 +48,7 @@ def test_raw_response_list(self, client: BeeperDesktop) -> None:
4748
assert response.is_closed is True
4849
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
4950
message = response.parse()
50-
assert_matches_type(SyncCursorList[Message], message, path=["response"])
51+
assert_matches_type(MessageListResponse, message, path=["response"])
5152

5253
@parametrize
5354
def test_streaming_response_list(self, client: BeeperDesktop) -> None:
@@ -58,7 +59,7 @@ def test_streaming_response_list(self, client: BeeperDesktop) -> None:
5859
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
5960

6061
message = response.parse()
61-
assert_matches_type(SyncCursorList[Message], message, path=["response"])
62+
assert_matches_type(MessageListResponse, message, path=["response"])
6263

6364
assert cast(Any, response.is_closed) is True
6465

@@ -112,9 +113,7 @@ def test_streaming_response_search(self, client: BeeperDesktop) -> None:
112113

113114
@parametrize
114115
def test_method_send(self, client: BeeperDesktop) -> None:
115-
message = client.messages.send(
116-
chat_id="!NCdzlIaMjZUmvmvyHU:beeper.com",
117-
)
116+
message = client.messages.send()
118117
assert_matches_type(MessageSendResponse, message, path=["response"])
119118

120119
@parametrize
@@ -128,9 +127,7 @@ def test_method_send_with_all_params(self, client: BeeperDesktop) -> None:
128127

129128
@parametrize
130129
def test_raw_response_send(self, client: BeeperDesktop) -> None:
131-
response = client.messages.with_raw_response.send(
132-
chat_id="!NCdzlIaMjZUmvmvyHU:beeper.com",
133-
)
130+
response = client.messages.with_raw_response.send()
134131

135132
assert response.is_closed is True
136133
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -139,9 +136,7 @@ def test_raw_response_send(self, client: BeeperDesktop) -> None:
139136

140137
@parametrize
141138
def test_streaming_response_send(self, client: BeeperDesktop) -> None:
142-
with client.messages.with_streaming_response.send(
143-
chat_id="!NCdzlIaMjZUmvmvyHU:beeper.com",
144-
) as response:
139+
with client.messages.with_streaming_response.send() as response:
145140
assert not response.is_closed
146141
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
147142

@@ -161,7 +156,7 @@ async def test_method_list(self, async_client: AsyncBeeperDesktop) -> None:
161156
message = await async_client.messages.list(
162157
chat_id="!NCdzlIaMjZUmvmvyHU:beeper.com",
163158
)
164-
assert_matches_type(AsyncCursorList[Message], message, path=["response"])
159+
assert_matches_type(MessageListResponse, message, path=["response"])
165160

166161
@parametrize
167162
async def test_method_list_with_all_params(self, async_client: AsyncBeeperDesktop) -> None:
@@ -170,7 +165,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncBeeperDeskto
170165
cursor="821744079",
171166
direction="before",
172167
)
173-
assert_matches_type(AsyncCursorList[Message], message, path=["response"])
168+
assert_matches_type(MessageListResponse, message, path=["response"])
174169

175170
@parametrize
176171
async def test_raw_response_list(self, async_client: AsyncBeeperDesktop) -> None:
@@ -181,7 +176,7 @@ async def test_raw_response_list(self, async_client: AsyncBeeperDesktop) -> None
181176
assert response.is_closed is True
182177
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
183178
message = await response.parse()
184-
assert_matches_type(AsyncCursorList[Message], message, path=["response"])
179+
assert_matches_type(MessageListResponse, message, path=["response"])
185180

186181
@parametrize
187182
async def test_streaming_response_list(self, async_client: AsyncBeeperDesktop) -> None:
@@ -192,7 +187,7 @@ async def test_streaming_response_list(self, async_client: AsyncBeeperDesktop) -
192187
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
193188

194189
message = await response.parse()
195-
assert_matches_type(AsyncCursorList[Message], message, path=["response"])
190+
assert_matches_type(MessageListResponse, message, path=["response"])
196191

197192
assert cast(Any, response.is_closed) is True
198193

@@ -246,9 +241,7 @@ async def test_streaming_response_search(self, async_client: AsyncBeeperDesktop)
246241

247242
@parametrize
248243
async def test_method_send(self, async_client: AsyncBeeperDesktop) -> None:
249-
message = await async_client.messages.send(
250-
chat_id="!NCdzlIaMjZUmvmvyHU:beeper.com",
251-
)
244+
message = await async_client.messages.send()
252245
assert_matches_type(MessageSendResponse, message, path=["response"])
253246

254247
@parametrize
@@ -262,9 +255,7 @@ async def test_method_send_with_all_params(self, async_client: AsyncBeeperDeskto
262255

263256
@parametrize
264257
async def test_raw_response_send(self, async_client: AsyncBeeperDesktop) -> None:
265-
response = await async_client.messages.with_raw_response.send(
266-
chat_id="!NCdzlIaMjZUmvmvyHU:beeper.com",
267-
)
258+
response = await async_client.messages.with_raw_response.send()
268259

269260
assert response.is_closed is True
270261
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -273,9 +264,7 @@ async def test_raw_response_send(self, async_client: AsyncBeeperDesktop) -> None
273264

274265
@parametrize
275266
async def test_streaming_response_send(self, async_client: AsyncBeeperDesktop) -> None:
276-
async with async_client.messages.with_streaming_response.send(
277-
chat_id="!NCdzlIaMjZUmvmvyHU:beeper.com",
278-
) as response:
267+
async with async_client.messages.with_streaming_response.send() as response:
279268
assert not response.is_closed
280269
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
281270

0 commit comments

Comments
 (0)