@@ -26,13 +26,9 @@ const client = new Gitpod({
26
26
bearerToken: process .env [' GITPOD_API_KEY' ], // This is the default and can be omitted
27
27
});
28
28
29
- async function main () {
30
- const response = await client .identity .getAuthenticatedIdentity ();
29
+ const response = await client .identity .getAuthenticatedIdentity ();
31
30
32
- console .log (response .organizationId );
33
- }
34
-
35
- main ();
31
+ console .log (response .organizationId );
36
32
```
37
33
38
34
### Request & Response types
@@ -47,12 +43,8 @@ const client = new Gitpod({
47
43
bearerToken: process .env [' GITPOD_API_KEY' ], // This is the default and can be omitted
48
44
});
49
45
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 ();
56
48
```
57
49
58
50
Documentation 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:
65
57
66
58
<!-- prettier-ignore -->
67
59
``` 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
+ });
81
69
```
82
70
83
71
Error codes are as follows:
0 commit comments