You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
access_token=os.environ.get("BEEPER_ACCESS_TOKEN"), # This is the default and can be omitted
34
34
)
35
35
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)
42
38
```
43
39
44
40
While you can provide a `access_token` keyword argument,
@@ -61,12 +57,8 @@ client = AsyncBeeperDesktop(
61
57
62
58
63
59
asyncdefmain() -> 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)
70
62
71
63
72
64
asyncio.run(main())
@@ -98,12 +90,8 @@ async def main() -> None:
98
90
access_token="My Access Token",
99
91
http_client=DefaultAioHttpClient(),
100
92
) 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)
107
95
108
96
109
97
asyncio.run(main())
@@ -118,101 +106,6 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
118
106
119
107
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`.
120
108
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:
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
-
216
109
## Handling errors
217
110
218
111
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
229
122
client = BeeperDesktop()
230
123
231
124
try:
232
-
client.messages.send(
233
-
chat_id="1229391",
234
-
text="Hello! Just checking in on the project status.",
235
-
)
125
+
client.token.info()
236
126
except beeper_desktop_api.APIConnectionError as e:
237
127
print("The server could not be reached")
238
128
print(e.__cause__) # an underlying Exception, likely raised within httpx.
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)
347
237
```
348
238
349
239
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
357
247
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.
358
248
359
249
```python
360
-
with client.accounts.with_streaming_response.list() as response:
250
+
with client.token.with_streaming_response.info() as response:
0 commit comments