@@ -26,13 +26,9 @@ const client = new Gitpod({
2626 bearerToken: process .env [' GITPOD_API_KEY' ], // This is the default and can be omitted
2727});
2828
29- async function main () {
30- const response = await client .identity .getAuthenticatedIdentity ();
29+ const response = await client .identity .getAuthenticatedIdentity ();
3130
32- console .log (response .organizationId );
33- }
34-
35- main ();
31+ console .log (response .organizationId );
3632```
3733
3834### Request & Response types
@@ -47,12 +43,8 @@ const client = new Gitpod({
4743 bearerToken: process .env [' GITPOD_API_KEY' ], // This is the default and can be omitted
4844});
4945
50- async function main() {
51- const response: Gitpod .IdentityGetAuthenticatedIdentityResponse =
52- await client .identity .getAuthenticatedIdentity ();
53- }
54-
55- main ();
46+ const response: Gitpod .IdentityGetAuthenticatedIdentityResponse =
47+ await client .identity .getAuthenticatedIdentity ();
5648```
5749
5850Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
@@ -65,19 +57,15 @@ a subclass of `APIError` will be thrown:
6557
6658<!-- prettier-ignore -->
6759``` ts
68- async function main() {
69- const response = await client .identity .getAuthenticatedIdentity ().catch (async (err ) => {
70- if (err instanceof Gitpod .APIError ) {
71- console .log (err .status ); // 400
72- console .log (err .name ); // BadRequestError
73- console .log (err .headers ); // {server: 'nginx', ...}
74- } else {
75- throw err ;
76- }
77- });
78- }
79-
80- main ();
60+ const response = await client .identity .getAuthenticatedIdentity ().catch (async (err ) => {
61+ if (err instanceof Gitpod .APIError ) {
62+ console .log (err .status ); // 400
63+ console .log (err .name ); // BadRequestError
64+ console .log (err .headers ); // {server: 'nginx', ...}
65+ } else {
66+ throw err ;
67+ }
68+ });
8169```
8270
8371Error codes are as follows:
0 commit comments