Skip to content

Commit 86218ff

Browse files
feat(api): manual updates
1 parent 0fcd71f commit 86218ff

24 files changed

+737
-851
lines changed

.stats.yml

Lines changed: 3 additions & 3 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-f48e33c7d90ed6418a852f8d4d951d07b09f4f3f939feb395dc2aa03f522d81e.yml
3-
openapi_spec_hash: c516120ecf51bb8425b3b9ed76c6423a
4-
config_hash: c5ac9bd5889d27aa168f06d6d0fef0b3
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper%2Fbeeper-desktop-api-f48bb509412536c41fdfa537894cecd4af486099d95fe79369f2ef239fa94a75.yml
3+
openapi_spec_hash: f8b886fdfdc5ee3d51d2cd05daee3bab
4+
config_hash: 6f12c5e4c662e1f315b95a70389b1549

README.md

Lines changed: 3 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,7 @@ client = BeeperDesktop(
3333
access_token=os.environ.get("BEEPER_ACCESS_TOKEN"), # This is the default and can be omitted
3434
)
3535

36-
page = client.chats.search(
37-
include_muted=True,
38-
limit=3,
39-
type="single",
40-
)
41-
print(page.items)
36+
accounts = client.accounts.list()
4237
```
4338

4439
While you can provide a `access_token` keyword argument,
@@ -61,12 +56,7 @@ client = AsyncBeeperDesktop(
6156

6257

6358
async def main() -> None:
64-
page = await client.chats.search(
65-
include_muted=True,
66-
limit=3,
67-
type="single",
68-
)
69-
print(page.items)
59+
accounts = await client.accounts.list()
7060

7161

7262
asyncio.run(main())
@@ -98,12 +88,7 @@ async def main() -> None:
9888
access_token="My Access Token",
9989
http_client=DefaultAioHttpClient(),
10090
) as client:
101-
page = await client.chats.search(
102-
include_muted=True,
103-
limit=3,
104-
type="single",
105-
)
106-
print(page.items)
91+
accounts = await client.accounts.list()
10792

10893

10994
asyncio.run(main())
@@ -118,85 +103,6 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
118103

119104
Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
120105

121-
## Pagination
122-
123-
List methods in the Beeper Desktop API are paginated.
124-
125-
This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:
126-
127-
```python
128-
from beeper_desktop_api import BeeperDesktop
129-
130-
client = BeeperDesktop()
131-
132-
all_messages = []
133-
# Automatically fetches more pages as needed.
134-
for message in client.messages.search(
135-
account_ids=["local-telegram_ba_QFrb5lrLPhO3OT5MFBeTWv0x4BI"],
136-
limit=10,
137-
query="deployment",
138-
):
139-
# Do something with message here
140-
all_messages.append(message)
141-
print(all_messages)
142-
```
143-
144-
Or, asynchronously:
145-
146-
```python
147-
import asyncio
148-
from beeper_desktop_api import AsyncBeeperDesktop
149-
150-
client = AsyncBeeperDesktop()
151-
152-
153-
async def main() -> None:
154-
all_messages = []
155-
# Iterate through items across all pages, issuing requests as needed.
156-
async for message in client.messages.search(
157-
account_ids=["local-telegram_ba_QFrb5lrLPhO3OT5MFBeTWv0x4BI"],
158-
limit=10,
159-
query="deployment",
160-
):
161-
all_messages.append(message)
162-
print(all_messages)
163-
164-
165-
asyncio.run(main())
166-
```
167-
168-
Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:
169-
170-
```python
171-
first_page = await client.messages.search(
172-
account_ids=["local-telegram_ba_QFrb5lrLPhO3OT5MFBeTWv0x4BI"],
173-
limit=10,
174-
query="deployment",
175-
)
176-
if first_page.has_next_page():
177-
print(f"will fetch next page using these details: {first_page.next_page_info()}")
178-
next_page = await first_page.get_next_page()
179-
print(f"number of items we just fetched: {len(next_page.items)}")
180-
181-
# Remove `await` for non-async usage.
182-
```
183-
184-
Or just work directly with the returned data:
185-
186-
```python
187-
first_page = await client.messages.search(
188-
account_ids=["local-telegram_ba_QFrb5lrLPhO3OT5MFBeTWv0x4BI"],
189-
limit=10,
190-
query="deployment",
191-
)
192-
193-
print(f"next page cursor: {first_page.oldest_cursor}") # => "next page cursor: ..."
194-
for message in first_page.items:
195-
print(message.id)
196-
197-
# Remove `await` for non-async usage.
198-
```
199-
200106
## Nested params
201107

202108
Nested parameters are dictionaries, typed using `TypedDict`, for example:

api.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ from beeper_desktop_api.types import Attachment, BaseResponse, Error, Message, R
99
Types:
1010

1111
```python
12-
from beeper_desktop_api.types import DownloadAssetResponse, OpenResponse, SearchResponse
12+
from beeper_desktop_api.types import DownloadAssetResponse, FocusResponse, SearchResponse
1313
```
1414

1515
Methods:
1616

1717
- <code title="post /v1/download-asset">client.<a href="./src/beeper_desktop_api/_client.py">download_asset</a>(\*\*<a href="src/beeper_desktop_api/types/client_download_asset_params.py">params</a>) -> <a href="./src/beeper_desktop_api/types/download_asset_response.py">DownloadAssetResponse</a></code>
18-
- <code title="post /v1/open">client.<a href="./src/beeper_desktop_api/_client.py">open</a>(\*\*<a href="src/beeper_desktop_api/types/client_open_params.py">params</a>) -> <a href="./src/beeper_desktop_api/types/open_response.py">OpenResponse</a></code>
18+
- <code title="post /v1/focus">client.<a href="./src/beeper_desktop_api/_client.py">focus</a>(\*\*<a href="src/beeper_desktop_api/types/client_focus_params.py">params</a>) -> <a href="./src/beeper_desktop_api/types/focus_response.py">FocusResponse</a></code>
1919
- <code title="get /v1/search">client.<a href="./src/beeper_desktop_api/_client.py">search</a>(\*\*<a href="src/beeper_desktop_api/types/client_search_params.py">params</a>) -> <a href="./src/beeper_desktop_api/types/search_response.py">SearchResponse</a></code>
2020

2121
# Accounts
@@ -30,17 +30,18 @@ Methods:
3030

3131
- <code title="get /v1/accounts">client.accounts.<a href="./src/beeper_desktop_api/resources/accounts.py">list</a>() -> <a href="./src/beeper_desktop_api/types/account_list_response.py">AccountListResponse</a></code>
3232

33-
# Contacts
33+
# Search
3434

3535
Types:
3636

3737
```python
38-
from beeper_desktop_api.types import ContactSearchResponse
38+
from beeper_desktop_api.types import SearchContactsResponse
3939
```
4040

4141
Methods:
4242

43-
- <code title="get /v1/accounts/{accountID}/contacts/search">client.contacts.<a href="./src/beeper_desktop_api/resources/contacts.py">search</a>(account_id, \*\*<a href="src/beeper_desktop_api/types/contact_search_params.py">params</a>) -> <a href="./src/beeper_desktop_api/types/contact_search_response.py">ContactSearchResponse</a></code>
43+
- <code title="get /v1/search/chats">client.search.<a href="./src/beeper_desktop_api/resources/search.py">chats</a>(\*\*<a href="src/beeper_desktop_api/types/search_chats_params.py">params</a>) -> <a href="./src/beeper_desktop_api/types/chat.py">SyncCursorSearch[Chat]</a></code>
44+
- <code title="get /v1/search/contacts/{accountID}">client.search.<a href="./src/beeper_desktop_api/resources/search.py">contacts</a>(account_id, \*\*<a href="src/beeper_desktop_api/types/search_contacts_params.py">params</a>) -> <a href="./src/beeper_desktop_api/types/search_contacts_response.py">SearchContactsResponse</a></code>
4445

4546
# Chats
4647

@@ -56,7 +57,6 @@ Methods:
5657
- <code title="get /v1/chats/{chatID}">client.chats.<a href="./src/beeper_desktop_api/resources/chats/chats.py">retrieve</a>(chat_id, \*\*<a href="src/beeper_desktop_api/types/chat_retrieve_params.py">params</a>) -> <a href="./src/beeper_desktop_api/types/chat.py">Chat</a></code>
5758
- <code title="get /v1/chats">client.chats.<a href="./src/beeper_desktop_api/resources/chats/chats.py">list</a>(\*\*<a href="src/beeper_desktop_api/types/chat_list_params.py">params</a>) -> <a href="./src/beeper_desktop_api/types/chat_list_response.py">SyncCursorList[ChatListResponse]</a></code>
5859
- <code title="post /v1/chats/{chatID}/archive">client.chats.<a href="./src/beeper_desktop_api/resources/chats/chats.py">archive</a>(chat_id, \*\*<a href="src/beeper_desktop_api/types/chat_archive_params.py">params</a>) -> <a href="./src/beeper_desktop_api/types/shared/base_response.py">BaseResponse</a></code>
59-
- <code title="get /v1/chats/search">client.chats.<a href="./src/beeper_desktop_api/resources/chats/chats.py">search</a>(\*\*<a href="src/beeper_desktop_api/types/chat_search_params.py">params</a>) -> <a href="./src/beeper_desktop_api/types/chat.py">SyncCursorSearch[Chat]</a></code>
6060

6161
## Reminders
6262

@@ -76,5 +76,5 @@ from beeper_desktop_api.types import MessageSendResponse
7676
Methods:
7777

7878
- <code title="get /v1/chats/{chatID}/messages">client.messages.<a href="./src/beeper_desktop_api/resources/messages.py">list</a>(chat_id, \*\*<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>
79-
- <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>
79+
- <code title="get /v1/search/messages">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/chats/{chatID}/messages">client.messages.<a href="./src/beeper_desktop_api/resources/messages.py">send</a>(chat_id, \*\*<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>

0 commit comments

Comments
 (0)