@@ -30,9 +30,13 @@ const client = new Stainless({
3030 apiKey: process .env [' STAINLESS_V0_API_KEY' ], // This is the default and can be omitted
3131});
3232
33- const buildObject = await client .builds .create ({ revision: ' string' });
33+ async function main () {
34+ const buildObject = await client .builds .create ({ revision: ' string' });
3435
35- console .log (buildObject .id );
36+ console .log (buildObject .id );
37+ }
38+
39+ main ();
3640```
3741
3842### Request & Response types
@@ -48,8 +52,12 @@ const client = new Stainless({
4852 apiKey: process .env [' STAINLESS_V0_API_KEY' ], // This is the default and can be omitted
4953});
5054
51- const params: Stainless .BuildCreateParams = { revision: ' string' };
52- const buildObject: Stainless .BuildObject = await client .builds .create (params );
55+ async function main() {
56+ const params: Stainless .BuildCreateParams = { revision: ' string' };
57+ const buildObject: Stainless .BuildObject = await client .builds .create (params );
58+ }
59+
60+ main ();
5361```
5462
5563Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
@@ -62,15 +70,19 @@ a subclass of `APIError` will be thrown:
6270
6371<!-- prettier-ignore -->
6472``` ts
65- const buildObject = await client .builds .create ({ revision: ' string' }).catch (async (err ) => {
66- if (err instanceof Stainless .APIError ) {
67- console .log (err .status ); // 400
68- console .log (err .name ); // BadRequestError
69- console .log (err .headers ); // {server: 'nginx', ...}
70- } else {
71- throw err ;
72- }
73- });
73+ async function main() {
74+ const buildObject = await client .builds .create ({ revision: ' string' }).catch (async (err ) => {
75+ if (err instanceof Stainless .APIError ) {
76+ console .log (err .status ); // 400
77+ console .log (err .name ); // BadRequestError
78+ console .log (err .headers ); // {server: 'nginx', ...}
79+ } else {
80+ throw err ;
81+ }
82+ });
83+ }
84+
85+ main ();
7486```
7587
7688Error codes are as follows:
0 commit comments