Skip to content

Commit 223108d

Browse files
feat(api): manual updates
1 parent 207b926 commit 223108d

5 files changed

Lines changed: 88 additions & 59 deletions

File tree

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 23
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper%2Fbeeper-desktop-api-ee25e67fc85ccc86cedb2ca0865385709877582132103e0afa68d7b43551784a.yml
3-
openapi_spec_hash: d41fd99c9a8645a1fd69c519cd25a637
4-
config_hash: 07a9227b2e53d5bf022c964ac30d72fa
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper%2Fbeeper-desktop-api-1b8324f05cd39e88cfc36b9b86a868b6f7e0c9e0827bb30d70a6d875c151ae52.yml
3+
openapi_spec_hash: 41410e315f6a3d0be787ece9e4fcb96a
4+
config_hash: abdcaeff62a619bdf25d727cdeacf3b0

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@ The REST API documentation can be found on [developers.beeper.com](https://devel
2323
## Installation
2424

2525
```sh
26-
# install from PyPI
27-
pip install beeper_desktop_api
26+
# install from the production repo
27+
pip install git+ssh://git@github.com/beeper/desktop-api-python.git
2828
```
2929

30+
> [!NOTE]
31+
> Once this package is [published to PyPI](https://www.stainless.com/docs/guides/publish), this will become: `pip install beeper_desktop_api`
32+
3033
## Usage
3134

3235
The full API of this library can be found in [api.md](api.md).
@@ -87,8 +90,8 @@ By default, the async client uses `httpx` for HTTP requests. However, for improv
8790
You can enable this by installing `aiohttp`:
8891

8992
```sh
90-
# install from PyPI
91-
pip install beeper_desktop_api[aiohttp]
93+
# install from the production repo
94+
pip install 'beeper_desktop_api[aiohttp] @ git+ssh://git@github.com/beeper/desktop-api-python.git'
9295
```
9396

9497
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
@@ -215,10 +218,10 @@ from beeper_desktop_api import BeeperDesktop
215218

216219
client = BeeperDesktop()
217220

218-
client.chats.reminders.create(
219-
chat_id="!NCdzlIaMjZUmvmvyHU:beeper.com",
220-
reminder={"remind_at_ms": 0},
221+
chat = client.chats.create(
222+
chat={"account_id": "accountID"},
221223
)
224+
print(chat.user)
222225
```
223226

224227
## File uploads

src/beeper_desktop_api/resources/chats/chats.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def with_streaming_response(self) -> ChatsResourceWithStreamingResponse:
7979
def create(
8080
self,
8181
*,
82-
chat: chat_create_params.Chat | Omit = omit,
82+
chat: chat_create_params.Chat,
8383
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
8484
# The extra values given here take precedence over values defined on the client or passed to this method.
8585
extra_headers: Headers | None = None,
@@ -383,7 +383,7 @@ def with_streaming_response(self) -> AsyncChatsResourceWithStreamingResponse:
383383
async def create(
384384
self,
385385
*,
386-
chat: chat_create_params.Chat | Omit = omit,
386+
chat: chat_create_params.Chat,
387387
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
388388
# The extra values given here take precedence over values defined on the client or passed to this method.
389389
extra_headers: Headers | None = None,

src/beeper_desktop_api/types/chat_create_params.py

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,23 @@
22

33
from __future__ import annotations
44

5-
from typing import Union
6-
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
5+
from typing_extensions import Literal, Required, Annotated, TypedDict
76

87
from .._types import SequenceNotStr
98
from .._utils import PropertyInfo
109

11-
__all__ = ["ChatCreateParams", "Chat", "ChatUnionMember0", "ChatUnionMember1", "ChatUnionMember1User"]
10+
__all__ = ["ChatCreateParams", "Chat", "ChatUser"]
1211

1312

1413
class ChatCreateParams(TypedDict, total=False):
15-
chat: Chat
14+
chat: Required[Chat]
1615

1716

18-
class ChatUnionMember0(TypedDict, total=False):
19-
account_id: Required[Annotated[str, PropertyInfo(alias="accountID")]]
20-
"""Account to create the chat on."""
21-
22-
participant_ids: Required[Annotated[SequenceNotStr[str], PropertyInfo(alias="participantIDs")]]
23-
"""User IDs to include in the new chat."""
17+
class ChatUser(TypedDict, total=False):
18+
"""Required when mode='start'.
2419
25-
type: Required[Literal["single", "group"]]
20+
Merged user-like contact payload used to resolve the best identifier.
2621
"""
27-
Chat type to create: 'single' requires exactly one participantID; 'group'
28-
supports multiple participants and optional title.
29-
"""
30-
31-
message_text: Annotated[str, PropertyInfo(alias="messageText")]
32-
"""Optional first message content if the platform requires it to create the chat."""
33-
34-
mode: Literal["create"]
35-
"""Create mode. Defaults to 'create' when omitted."""
36-
37-
title: str
38-
"""Optional title for group chats; ignored for single chats on most platforms."""
39-
40-
41-
class ChatUnionMember1User(TypedDict, total=False):
42-
"""Merged user-like contact payload used to resolve the best identifier."""
4322

4423
id: str
4524
"""Known user ID when available."""
@@ -57,21 +36,40 @@ class ChatUnionMember1User(TypedDict, total=False):
5736
"""Username/handle candidate."""
5837

5938

60-
class ChatUnionMember1(TypedDict, total=False):
39+
class Chat(TypedDict, total=False):
6140
account_id: Required[Annotated[str, PropertyInfo(alias="accountID")]]
62-
"""Account to start the chat on."""
63-
64-
mode: Required[Literal["start"]]
65-
"""Start mode for resolving/creating a direct chat from merged contact data."""
66-
67-
user: Required[ChatUnionMember1User]
68-
"""Merged user-like contact payload used to resolve the best identifier."""
41+
"""Account to create or start the chat on."""
6942

7043
allow_invite: Annotated[bool, PropertyInfo(alias="allowInvite")]
71-
"""Whether invite-based DM creation is allowed when required by the platform."""
44+
"""Whether invite-based DM creation is allowed when required by the platform.
45+
46+
Used for mode='start'.
47+
"""
7248

7349
message_text: Annotated[str, PropertyInfo(alias="messageText")]
7450
"""Optional first message content if the platform requires it to create the chat."""
7551

52+
mode: Literal["create", "start"]
53+
"""Operation mode. Defaults to 'create' when omitted."""
54+
55+
participant_ids: Annotated[SequenceNotStr[str], PropertyInfo(alias="participantIDs")]
56+
"""Required when mode='create'. User IDs to include in the new chat."""
57+
58+
title: str
59+
"""
60+
Optional title for group chats when mode='create'; ignored for single chats on
61+
most platforms.
62+
"""
63+
64+
type: Literal["single", "group"]
65+
"""Required when mode='create'.
66+
67+
'single' requires exactly one participantID; 'group' supports multiple
68+
participants and optional title.
69+
"""
70+
71+
user: ChatUser
72+
"""Required when mode='start'.
7673
77-
Chat: TypeAlias = Union[ChatUnionMember0, ChatUnionMember1]
74+
Merged user-like contact payload used to resolve the best identifier.
75+
"""

tests/api_resources/test_chats.py

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,38 @@ class TestChats:
2525

2626
@parametrize
2727
def test_method_create(self, client: BeeperDesktop) -> None:
28-
chat = client.chats.create()
28+
chat = client.chats.create(
29+
chat={"account_id": "accountID"},
30+
)
2931
assert_matches_type(ChatCreateResponse, chat, path=["response"])
3032

3133
@parametrize
3234
def test_method_create_with_all_params(self, client: BeeperDesktop) -> None:
3335
chat = client.chats.create(
3436
chat={
3537
"account_id": "accountID",
36-
"participant_ids": ["string"],
37-
"type": "single",
38+
"allow_invite": True,
3839
"message_text": "messageText",
3940
"mode": "create",
41+
"participant_ids": ["string"],
4042
"title": "title",
43+
"type": "single",
44+
"user": {
45+
"id": "id",
46+
"email": "email",
47+
"full_name": "fullName",
48+
"phone_number": "phoneNumber",
49+
"username": "username",
50+
},
4151
},
4252
)
4353
assert_matches_type(ChatCreateResponse, chat, path=["response"])
4454

4555
@parametrize
4656
def test_raw_response_create(self, client: BeeperDesktop) -> None:
47-
response = client.chats.with_raw_response.create()
57+
response = client.chats.with_raw_response.create(
58+
chat={"account_id": "accountID"},
59+
)
4860

4961
assert response.is_closed is True
5062
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -53,7 +65,9 @@ def test_raw_response_create(self, client: BeeperDesktop) -> None:
5365

5466
@parametrize
5567
def test_streaming_response_create(self, client: BeeperDesktop) -> None:
56-
with client.chats.with_streaming_response.create() as response:
68+
with client.chats.with_streaming_response.create(
69+
chat={"account_id": "accountID"},
70+
) as response:
5771
assert not response.is_closed
5872
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
5973

@@ -245,26 +259,38 @@ class TestAsyncChats:
245259

246260
@parametrize
247261
async def test_method_create(self, async_client: AsyncBeeperDesktop) -> None:
248-
chat = await async_client.chats.create()
262+
chat = await async_client.chats.create(
263+
chat={"account_id": "accountID"},
264+
)
249265
assert_matches_type(ChatCreateResponse, chat, path=["response"])
250266

251267
@parametrize
252268
async def test_method_create_with_all_params(self, async_client: AsyncBeeperDesktop) -> None:
253269
chat = await async_client.chats.create(
254270
chat={
255271
"account_id": "accountID",
256-
"participant_ids": ["string"],
257-
"type": "single",
272+
"allow_invite": True,
258273
"message_text": "messageText",
259274
"mode": "create",
275+
"participant_ids": ["string"],
260276
"title": "title",
277+
"type": "single",
278+
"user": {
279+
"id": "id",
280+
"email": "email",
281+
"full_name": "fullName",
282+
"phone_number": "phoneNumber",
283+
"username": "username",
284+
},
261285
},
262286
)
263287
assert_matches_type(ChatCreateResponse, chat, path=["response"])
264288

265289
@parametrize
266290
async def test_raw_response_create(self, async_client: AsyncBeeperDesktop) -> None:
267-
response = await async_client.chats.with_raw_response.create()
291+
response = await async_client.chats.with_raw_response.create(
292+
chat={"account_id": "accountID"},
293+
)
268294

269295
assert response.is_closed is True
270296
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -273,7 +299,9 @@ async def test_raw_response_create(self, async_client: AsyncBeeperDesktop) -> No
273299

274300
@parametrize
275301
async def test_streaming_response_create(self, async_client: AsyncBeeperDesktop) -> None:
276-
async with async_client.chats.with_streaming_response.create() as response:
302+
async with async_client.chats.with_streaming_response.create(
303+
chat={"account_id": "accountID"},
304+
) as response:
277305
assert not response.is_closed
278306
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
279307

0 commit comments

Comments
 (0)