@@ -26,9 +26,9 @@ const client = new BrowserUse({
26
26
apiKey: process .env [' BROWSER_USE_API_KEY' ], // This is the default and can be omitted
27
27
});
28
28
29
- const me = await client .users . me . retrieve ( );
29
+ const task = await client .tasks . create ({ task : ' x ' } );
30
30
31
- console .log (me . additionalCreditsBalanceUsd );
31
+ console .log (task . id );
32
32
```
33
33
34
34
### Request & Response types
@@ -43,7 +43,8 @@ const client = new BrowserUse({
43
43
apiKey: process .env [' BROWSER_USE_API_KEY' ], // This is the default and can be omitted
44
44
});
45
45
46
- const me: BrowserUse .Users .MeRetrieveResponse = await client .users .me .retrieve ();
46
+ const params: BrowserUse .TaskCreateParams = { task: ' x' };
47
+ const task: BrowserUse .TaskCreateResponse = await client .tasks .create (params );
47
48
```
48
49
49
50
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
@@ -56,7 +57,7 @@ a subclass of `APIError` will be thrown:
56
57
57
58
<!-- prettier-ignore -->
58
59
``` ts
59
- const me = await client .users . me . retrieve ( ).catch (async (err ) => {
60
+ const task = await client .tasks . create ({ task: ' x ' } ).catch (async (err ) => {
60
61
if (err instanceof BrowserUse .APIError ) {
61
62
console .log (err .status ); // 400
62
63
console .log (err .name ); // BadRequestError
@@ -96,7 +97,7 @@ const client = new BrowserUse({
96
97
});
97
98
98
99
// Or, configure per-request:
99
- await client .users . me . retrieve ( {
100
+ await client .tasks . create ({ task : ' x ' }, {
100
101
maxRetries: 5 ,
101
102
});
102
103
```
@@ -113,7 +114,7 @@ const client = new BrowserUse({
113
114
});
114
115
115
116
// Override per-request:
116
- await client .users . me . retrieve ( {
117
+ await client .tasks . create ({ task: ' x ' }, {
117
118
timeout: 5 * 1000 ,
118
119
});
119
120
```
@@ -136,13 +137,13 @@ Unlike `.asResponse()` this method consumes the body, returning once it is parse
136
137
``` ts
137
138
const client = new BrowserUse ();
138
139
139
- const response = await client .users . me . retrieve ( ).asResponse ();
140
+ const response = await client .tasks . create ({ task: ' x ' } ).asResponse ();
140
141
console .log (response .headers .get (' X-My-Header' ));
141
142
console .log (response .statusText ); // access the underlying Response object
142
143
143
- const { data : me , response : raw } = await client .users . me . retrieve ( ).withResponse ();
144
+ const { data : task , response : raw } = await client .tasks . create ({ task: ' x ' } ).withResponse ();
144
145
console .log (raw .headers .get (' X-My-Header' ));
145
- console .log (me . additionalCreditsBalanceUsd );
146
+ console .log (task . id );
146
147
```
147
148
148
149
### Logging
@@ -222,7 +223,7 @@ parameter. This library doesn't validate at runtime that the request matches the
222
223
send will be sent as-is.
223
224
224
225
``` ts
225
- client .users . me . retrieve ({
226
+ client .tasks . create ({
226
227
// ...
227
228
// @ts-expect-error baz is not yet public
228
229
baz: ' undocumented option' ,
0 commit comments