Skip to content

Commit d0b2ca6

Browse files
chore: configure new SDK language
1 parent 97725ff commit d0b2ca6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+40
-4113
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: 14
1+
configured_endpoints: 1
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper%2Fbeeper-desktop-api-8c712fe19f280b0b89ecc8a3ce61e9f6b165cee97ce33f66c66a7a5db339c755.yml
33
openapi_spec_hash: 1ea71129cc1a1ccc3dc8a99566082311
4-
config_hash: 64d1986aea34e825a4a842c9da1a0d21
4+
config_hash: def03aa92de3408ec65438763617f5c7

README.md

Lines changed: 13 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,8 @@ 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+
user_info = client.token.info()
37+
print(user_info.sub)
4238
```
4339

4440
While you can provide a `access_token` keyword argument,
@@ -61,12 +57,8 @@ client = AsyncBeeperDesktop(
6157

6258

6359
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)
60+
user_info = await client.token.info()
61+
print(user_info.sub)
7062

7163

7264
asyncio.run(main())
@@ -98,12 +90,8 @@ async def main() -> None:
9890
access_token="My Access Token",
9991
http_client=DefaultAioHttpClient(),
10092
) as client:
101-
page = await client.chats.search(
102-
include_muted=True,
103-
limit=3,
104-
type="single",
105-
)
106-
print(page.items)
93+
user_info = await client.token.info()
94+
print(user_info.sub)
10795

10896

10997
asyncio.run(main())
@@ -118,101 +106,6 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
118106

119107
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`.
120108

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-
200-
## Nested params
201-
202-
Nested parameters are dictionaries, typed using `TypedDict`, for example:
203-
204-
```python
205-
from beeper_desktop_api import BeeperDesktop
206-
207-
client = BeeperDesktop()
208-
209-
base_response = client.chats.reminders.create(
210-
chat_id="!NCdzlIaMjZUmvmvyHU:beeper.com",
211-
reminder={"remind_at_ms": 0},
212-
)
213-
print(base_response.reminder)
214-
```
215-
216109
## Handling errors
217110

218111
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `beeper_desktop_api.APIConnectionError` is raised.
@@ -229,10 +122,7 @@ from beeper_desktop_api import BeeperDesktop
229122
client = BeeperDesktop()
230123

231124
try:
232-
client.messages.send(
233-
chat_id="1229391",
234-
text="Hello! Just checking in on the project status.",
235-
)
125+
client.token.info()
236126
except beeper_desktop_api.APIConnectionError as e:
237127
print("The server could not be reached")
238128
print(e.__cause__) # an underlying Exception, likely raised within httpx.
@@ -275,7 +165,7 @@ client = BeeperDesktop(
275165
)
276166

277167
# Or, configure per-request:
278-
client.with_options(max_retries=5).accounts.list()
168+
client.with_options(max_retries=5).token.info()
279169
```
280170

281171
### Timeouts
@@ -298,7 +188,7 @@ client = BeeperDesktop(
298188
)
299189

300190
# Override per-request:
301-
client.with_options(timeout=5.0).accounts.list()
191+
client.with_options(timeout=5.0).token.info()
302192
```
303193

304194
On timeout, an `APITimeoutError` is thrown.
@@ -339,11 +229,11 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
339229
from beeper_desktop_api import BeeperDesktop
340230

341231
client = BeeperDesktop()
342-
response = client.accounts.with_raw_response.list()
232+
response = client.token.with_raw_response.info()
343233
print(response.headers.get('X-My-Header'))
344234

345-
account = response.parse() # get the object that `accounts.list()` would have returned
346-
print(account)
235+
token = response.parse() # get the object that `token.info()` would have returned
236+
print(token.sub)
347237
```
348238

349239
These methods return an [`APIResponse`](https://github.com/stainless-sdks/beeper-desktop-api-python/tree/main/src/beeper_desktop_api/_response.py) object.
@@ -357,7 +247,7 @@ The above interface eagerly reads the full response body when you make the reque
357247
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
358248

359249
```python
360-
with client.accounts.with_streaming_response.list() as response:
250+
with client.token.with_streaming_response.info() as response:
361251
print(response.headers.get("X-My-Header"))
362252

363253
for line in response.iter_lines():

api.md

Lines changed: 3 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -4,85 +4,28 @@
44
from beeper_desktop_api.types import Attachment, BaseResponse, Error, Message, Reaction, User
55
```
66

7-
# BeeperDesktop
8-
9-
Types:
10-
11-
```python
12-
from beeper_desktop_api.types import DownloadAssetResponse, OpenResponse, SearchResponse
13-
```
14-
15-
Methods:
16-
17-
- <code title="post /v0/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 /v0/open-app">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>
19-
- <code title="get /v0/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>
20-
217
# Accounts
228

239
Types:
2410

2511
```python
26-
from beeper_desktop_api.types import Account, AccountListResponse
12+
from beeper_desktop_api.types import Account
2713
```
2814

29-
Methods:
30-
31-
- <code title="get /v0/get-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>
32-
33-
# Contacts
34-
35-
Types:
36-
37-
```python
38-
from beeper_desktop_api.types import ContactSearchResponse
39-
```
40-
41-
Methods:
42-
43-
- <code title="get /v0/search-users">client.contacts.<a href="./src/beeper_desktop_api/resources/contacts.py">search</a>(\*\*<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>
44-
4515
# Chats
4616

4717
Types:
4818

4919
```python
50-
from beeper_desktop_api.types import Chat, ChatCreateResponse
51-
```
52-
53-
Methods:
54-
55-
- <code title="post /v0/create-chat">client.chats.<a href="./src/beeper_desktop_api/resources/chats/chats.py">create</a>(\*\*<a href="src/beeper_desktop_api/types/chat_create_params.py">params</a>) -> <a href="./src/beeper_desktop_api/types/chat_create_response.py">ChatCreateResponse</a></code>
56-
- <code title="get /v0/get-chat">client.chats.<a href="./src/beeper_desktop_api/resources/chats/chats.py">retrieve</a>(\*\*<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>
57-
- <code title="post /v0/archive-chat">client.chats.<a href="./src/beeper_desktop_api/resources/chats/chats.py">archive</a>(\*\*<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>
58-
- <code title="get /v0/search-chats">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">SyncCursor[Chat]</a></code>
59-
60-
## Reminders
61-
62-
Methods:
63-
64-
- <code title="post /v0/set-chat-reminder">client.chats.reminders.<a href="./src/beeper_desktop_api/resources/chats/reminders.py">create</a>(\*\*<a href="src/beeper_desktop_api/types/chats/reminder_create_params.py">params</a>) -> <a href="./src/beeper_desktop_api/types/shared/base_response.py">BaseResponse</a></code>
65-
- <code title="post /v0/clear-chat-reminder">client.chats.reminders.<a href="./src/beeper_desktop_api/resources/chats/reminders.py">delete</a>(\*\*<a href="src/beeper_desktop_api/types/chats/reminder_delete_params.py">params</a>) -> <a href="./src/beeper_desktop_api/types/shared/base_response.py">BaseResponse</a></code>
66-
67-
# Messages
68-
69-
Types:
70-
71-
```python
72-
from beeper_desktop_api.types import MessageSendResponse
20+
from beeper_desktop_api.types import Chat
7321
```
7422

75-
Methods:
76-
77-
- <code title="get /v0/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">SyncCursor[Message]</a></code>
78-
- <code title="post /v0/send-message">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>
79-
8023
# Token
8124

8225
Types:
8326

8427
```python
85-
from beeper_desktop_api.types import RevokeRequest, UserInfo
28+
from beeper_desktop_api.types import UserInfo
8629
```
8730

8831
Methods:

0 commit comments

Comments
 (0)