@@ -27,18 +27,14 @@ const client = new Kernel({
2727 environment: ' development' , // defaults to 'production'
2828});
2929
30- async function main () {
31- const deployment = await client .apps .deployments .create ({
32- entrypoint_rel_path: ' main.ts' ,
33- file: fs .createReadStream (' path/to/file' ),
34- env_vars: { OPENAI_API_KEY : ' x' },
35- version: ' 1.0.0' ,
36- });
37-
38- console .log (deployment .apps );
39- }
30+ const deployment = await client .apps .deployments .create ({
31+ entrypoint_rel_path: ' main.ts' ,
32+ file: fs .createReadStream (' path/to/file' ),
33+ env_vars: { OPENAI_API_KEY : ' x' },
34+ version: ' 1.0.0' ,
35+ });
4036
41- main ( );
37+ console . log ( deployment . apps );
4238```
4339
4440### Request & Response types
@@ -54,15 +50,11 @@ const client = new Kernel({
5450 environment: ' development' , // defaults to 'production'
5551});
5652
57- async function main() {
58- const params: Kernel .BrowserCreateParams = {
59- invocation_id: ' REPLACE_ME' ,
60- persistence: { id: ' browser-for-user-1234' },
61- };
62- const browser: Kernel .BrowserCreateResponse = await client .browsers .create (params );
63- }
64-
65- main ();
53+ const params: Kernel .BrowserCreateParams = {
54+ invocation_id: ' REPLACE_ME' ,
55+ persistence: { id: ' browser-for-user-1234' },
56+ };
57+ const browser: Kernel .BrowserCreateResponse = await client .browsers .create (params );
6658```
6759
6860Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
@@ -119,21 +111,17 @@ a subclass of `APIError` will be thrown:
119111
120112<!-- prettier-ignore -->
121113``` ts
122- async function main() {
123- const browser = await client .browsers
124- .create ({ invocation_id: ' REPLACE_ME' , persistence: { id: ' browser-for-user-1234' } })
125- .catch (async (err ) => {
126- if (err instanceof Kernel .APIError ) {
127- console .log (err .status ); // 400
128- console .log (err .name ); // BadRequestError
129- console .log (err .headers ); // {server: 'nginx', ...}
130- } else {
131- throw err ;
132- }
133- });
134- }
135-
136- main ();
114+ const browser = await client .browsers
115+ .create ({ invocation_id: ' REPLACE_ME' , persistence: { id: ' browser-for-user-1234' } })
116+ .catch (async (err ) => {
117+ if (err instanceof Kernel .APIError ) {
118+ console .log (err .status ); // 400
119+ console .log (err .name ); // BadRequestError
120+ console .log (err .headers ); // {server: 'nginx', ...}
121+ } else {
122+ throw err ;
123+ }
124+ });
137125```
138126
139127Error codes are as follows:
0 commit comments