@@ -26,9 +26,9 @@ const client = new BrowserUse({
2626 apiKey: process .env [' BROWSER_USE_API_KEY' ], // This is the default and can be omitted
2727});
2828
29- const me = await client .users . me . retrieve ( );
29+ const task = await client .tasks . create ({ task : ' x ' } );
3030
31- console .log (me . additionalCreditsBalanceUsd );
31+ console .log (task . id );
3232```
3333
3434### Request & Response types
@@ -43,7 +43,8 @@ const client = new BrowserUse({
4343 apiKey: process .env [' BROWSER_USE_API_KEY' ], // This is the default and can be omitted
4444});
4545
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 );
4748```
4849
4950Documentation 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:
5657
5758<!-- prettier-ignore -->
5859``` ts
59- const me = await client .users . me . retrieve ( ).catch (async (err ) => {
60+ const task = await client .tasks . create ({ task: ' x ' } ).catch (async (err ) => {
6061 if (err instanceof BrowserUse .APIError ) {
6162 console .log (err .status ); // 400
6263 console .log (err .name ); // BadRequestError
@@ -96,7 +97,7 @@ const client = new BrowserUse({
9697});
9798
9899// Or, configure per-request:
99- await client .users . me . retrieve ( {
100+ await client .tasks . create ({ task : ' x ' }, {
100101 maxRetries: 5 ,
101102});
102103```
@@ -113,7 +114,7 @@ const client = new BrowserUse({
113114});
114115
115116// Override per-request:
116- await client .users . me . retrieve ( {
117+ await client .tasks . create ({ task: ' x ' }, {
117118 timeout: 5 * 1000 ,
118119});
119120```
@@ -136,13 +137,13 @@ Unlike `.asResponse()` this method consumes the body, returning once it is parse
136137``` ts
137138const client = new BrowserUse ();
138139
139- const response = await client .users . me . retrieve ( ).asResponse ();
140+ const response = await client .tasks . create ({ task: ' x ' } ).asResponse ();
140141console .log (response .headers .get (' X-My-Header' ));
141142console .log (response .statusText ); // access the underlying Response object
142143
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 ();
144145console .log (raw .headers .get (' X-My-Header' ));
145- console .log (me . additionalCreditsBalanceUsd );
146+ console .log (task . id );
146147```
147148
148149### Logging
@@ -222,7 +223,7 @@ parameter. This library doesn't validate at runtime that the request matches the
222223send will be sent as-is.
223224
224225``` ts
225- client .users . me . retrieve ({
226+ client .tasks . create ({
226227 // ...
227228 // @ts-expect-error baz is not yet public
228229 baz: ' undocumented option' ,
0 commit comments