freestyle-sandboxes 0.0.25 → 0.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/index.ts CHANGED
@@ -1,6 +1,66 @@
1
- import { Client, createClient } from "@hey-api/client-fetch";
1
+ import { type Client, createClient } from "@hey-api/client-fetch";
2
2
  import * as sandbox_openapi from "../openapi/index.ts";
3
3
 
4
+ import type {
5
+ AccessLevel,
6
+ CreatedToken,
7
+ CreateRepositoryResponseSuccess,
8
+ DescribePermissionResponseSuccess,
9
+ FreestyleCloudstateDeployRequest,
10
+ FreestyleCloudstateDeploySuccessResponse,
11
+ FreestyleDeployWebConfiguration,
12
+ FreestyleDeployWebSuccessResponse,
13
+ FreestyleExecuteScriptParamsConfiguration,
14
+ FreestyleExecuteScriptResultSuccess,
15
+ GitIdentity,
16
+ HandleBackupCloudstateResponse,
17
+ HandleCreateDomainVerificationResponse,
18
+ HandleDeleteDomainVerificationResponse,
19
+ HandleDeleteIdentityResponse,
20
+ HandleDeleteRepoResponse,
21
+ HandleGetExecuteRunResponse,
22
+ HandleGetLogsResponse,
23
+ HandleListDomainsResponse,
24
+ HandleListDomainVerificationRequestsResponse,
25
+ HandleListExecuteRunsResponse,
26
+ HandleListRepositoriesResponse,
27
+ HandleListWebDeploysResponse,
28
+ HandleVerifyDomainError,
29
+ HandleVerifyDomainResponse,
30
+ ListGitTokensResponseSuccess,
31
+ ListPermissionResponseSuccess,
32
+ } from "../openapi/index.ts";
33
+
34
+ export type {
35
+ AccessLevel,
36
+ CreatedToken,
37
+ CreateRepositoryResponseSuccess,
38
+ DescribePermissionResponseSuccess,
39
+ FreestyleCloudstateDeployRequest,
40
+ FreestyleCloudstateDeploySuccessResponse,
41
+ FreestyleDeployWebConfiguration,
42
+ FreestyleDeployWebSuccessResponse,
43
+ FreestyleExecuteScriptParamsConfiguration,
44
+ FreestyleExecuteScriptResultSuccess,
45
+ GitIdentity,
46
+ HandleBackupCloudstateResponse,
47
+ HandleCreateDomainVerificationResponse,
48
+ HandleDeleteDomainVerificationResponse,
49
+ HandleDeleteIdentityResponse,
50
+ HandleDeleteRepoResponse,
51
+ HandleGetExecuteRunResponse,
52
+ HandleGetLogsResponse,
53
+ HandleListDomainsResponse,
54
+ HandleListDomainVerificationRequestsResponse,
55
+ HandleListExecuteRunsResponse,
56
+ HandleListRepositoriesResponse,
57
+ HandleListWebDeploysResponse,
58
+ HandleVerifyDomainError,
59
+ HandleVerifyDomainResponse,
60
+ ListGitTokensResponseSuccess,
61
+ ListPermissionResponseSuccess,
62
+ } from "../openapi/index.ts";
63
+
4
64
  export class FreestyleSandboxes {
5
65
  private client: Client;
6
66
  constructor(options: {
@@ -31,8 +91,8 @@ export class FreestyleSandboxes {
31
91
  */
32
92
  async executeScript(
33
93
  script: string,
34
- config?: sandbox_openapi.FreestyleExecuteScriptParamsConfiguration
35
- ): Promise<sandbox_openapi.FreestyleExecuteScriptResultSuccess> {
94
+ config?: FreestyleExecuteScriptParamsConfiguration,
95
+ ): Promise<FreestyleExecuteScriptResultSuccess> {
36
96
  const response = await sandbox_openapi.handleExecuteScript({
37
97
  client: this.client,
38
98
  body: {
@@ -43,13 +103,12 @@ export class FreestyleSandboxes {
43
103
 
44
104
  if (response.data) {
45
105
  return response.data;
46
- } else {
47
- throw new Error(
48
- `Failed to execute script: \n\n${script}\n\nError:\n\n${JSON.stringify(
49
- response
50
- )}`
51
- );
52
106
  }
107
+ throw new Error(
108
+ `Failed to execute script: \n\n${script}\n\nError:\n\n${JSON.stringify(
109
+ response,
110
+ )}`,
111
+ );
53
112
  }
54
113
 
55
114
  /**
@@ -63,8 +122,8 @@ export class FreestyleSandboxes {
63
122
  encoding?: string;
64
123
  }
65
124
  >,
66
- config?: sandbox_openapi.FreestyleDeployWebConfiguration
67
- ): Promise<sandbox_openapi.FreestyleDeployWebSuccessResponse> {
125
+ config?: FreestyleDeployWebConfiguration,
126
+ ): Promise<FreestyleDeployWebSuccessResponse> {
68
127
  const response = await sandbox_openapi.handleDeployWeb({
69
128
  client: this.client,
70
129
  body: {
@@ -74,28 +133,28 @@ export class FreestyleSandboxes {
74
133
  });
75
134
  if (response.data) {
76
135
  return response.data;
77
- } else {
78
- throw new Error(
79
- `Failed to deploy web project\n\nStatus: ${response.response.status}\n\nMessage: ${response.error?.message}`
80
- );
81
136
  }
137
+ throw new Error(
138
+ `Failed to deploy web project\n\nStatus: ${response.response.status}\n\nMessage: ${response.error?.message}`,
139
+ );
82
140
  }
83
141
 
84
142
  /**
85
143
  * Deploy a Cloudstate project to a sandbox.
86
144
  */
87
145
  async deployCloudstate(
88
- body: sandbox_openapi.FreestyleCloudstateDeployRequest
89
- ): Promise<sandbox_openapi.FreestyleCloudstateDeploySuccessResponse> {
146
+ body: FreestyleCloudstateDeployRequest,
147
+ ): Promise<FreestyleCloudstateDeploySuccessResponse> {
90
148
  const response = await sandbox_openapi.handleDeployCloudstate({
91
149
  client: this.client,
92
150
  body: body,
93
151
  });
152
+
94
153
  if (response.data) {
95
154
  return response.data;
96
- } else {
97
- throw new Error("Failed to deploy Cloudstate project");
98
155
  }
156
+
157
+ throw new Error("Failed to deploy Cloudstate project");
99
158
  }
100
159
 
101
160
  /**
@@ -104,20 +163,19 @@ export class FreestyleSandboxes {
104
163
  * @returns The backup of the Cloudstate project.
105
164
  * @throws An error if the backup could not be retrieved.
106
165
  */
107
- async backupCloudstate(
108
- id: string
109
- ): Promise<sandbox_openapi.HandleBackupCloudstateResponse> {
166
+ async backupCloudstate(id: string): Promise<HandleBackupCloudstateResponse> {
110
167
  const response = await sandbox_openapi.handleBackupCloudstate({
111
168
  client: this.client,
112
169
  path: {
113
170
  id: id,
114
171
  },
115
172
  });
173
+
116
174
  if (response.data) {
117
175
  return response.data;
118
- } else {
119
- throw new Error("Failed to get backup of Cloudstate project");
120
176
  }
177
+
178
+ throw new Error("Failed to get backup of Cloudstate project");
121
179
  }
122
180
 
123
181
  /**
@@ -126,7 +184,7 @@ export class FreestyleSandboxes {
126
184
  * @returns The logs for the sandbox.
127
185
  * @throws An error if the logs could not be retrieved.
128
186
  */
129
- async getLogs(id: string): Promise<sandbox_openapi.HandleGetLogsResponse> {
187
+ async getLogs(id: string): Promise<HandleGetLogsResponse> {
130
188
  const response = await sandbox_openapi.handleGetLogs({
131
189
  client: this.client,
132
190
  query: {
@@ -138,9 +196,8 @@ export class FreestyleSandboxes {
138
196
  });
139
197
  if (response.data) {
140
198
  return response.data;
141
- } else {
142
- throw new Error("Failed to get logs for sandbox");
143
199
  }
200
+ throw new Error("Failed to get logs for sandbox");
144
201
  }
145
202
 
146
203
  /**
@@ -149,8 +206,8 @@ export class FreestyleSandboxes {
149
206
  * @returns The domain verification token.
150
207
  */
151
208
  async createDomainVerificationRequest(
152
- domain: string
153
- ): Promise<sandbox_openapi.HandleCreateDomainVerificationResponse> {
209
+ domain: string,
210
+ ): Promise<HandleCreateDomainVerificationResponse> {
154
211
  const response = await sandbox_openapi.handleCreateDomainVerification({
155
212
  client: this.client,
156
213
  body: {
@@ -159,9 +216,9 @@ export class FreestyleSandboxes {
159
216
  });
160
217
  if (response.data) {
161
218
  return response.data;
162
- } else {
163
- throw new Error(response.error.message);
164
219
  }
220
+
221
+ throw new Error(response.error.message);
165
222
  }
166
223
 
167
224
  /**
@@ -170,11 +227,8 @@ export class FreestyleSandboxes {
170
227
  * @returns The domain verification request.
171
228
  */
172
229
  async verifyDomain(
173
- domain: string
174
- ): Promise<
175
- | sandbox_openapi.HandleVerifyDomainResponse
176
- | sandbox_openapi.HandleVerifyDomainError
177
- > {
230
+ domain: string,
231
+ ): Promise<HandleVerifyDomainResponse | HandleVerifyDomainError> {
178
232
  const response = await sandbox_openapi.handleVerifyDomain({
179
233
  client: this.client,
180
234
  body: {
@@ -183,43 +237,42 @@ export class FreestyleSandboxes {
183
237
  });
184
238
  if (response.data) {
185
239
  return response.data;
186
- } else {
187
- throw new Error(
188
- `Failed to verify domain ${domain}: ${response.error.message}`
189
- );
190
240
  }
241
+ throw new Error(
242
+ `Failed to verify domain ${domain}: ${response.error.message}`,
243
+ );
191
244
  }
192
245
 
193
- async listDomains(): Promise<sandbox_openapi.HandleListDomainsResponse> {
246
+ async listDomains(): Promise<HandleListDomainsResponse> {
194
247
  const response = await sandbox_openapi.handleListDomains({
195
248
  client: this.client,
196
249
  });
197
250
  if (response.data) {
198
251
  return response.data;
199
- } else {
200
- throw new Error("Failed to list domains\n" + response.error.message);
201
252
  }
253
+
254
+ throw new Error(`Failed to list domains\n${response.error.message}`);
202
255
  }
203
256
 
204
- async listDomainVerificationRequests(): Promise<sandbox_openapi.HandleListDomainVerificationRequestsResponse> {
257
+ async listDomainVerificationRequests(): Promise<HandleListDomainVerificationRequestsResponse> {
205
258
  const response = await sandbox_openapi.handleListDomainVerificationRequests(
206
259
  {
207
260
  client: this.client,
208
- }
261
+ },
209
262
  );
210
263
  if (response.data) {
211
264
  return response.data;
212
- } else {
213
- throw new Error(
214
- "Failed to list domain verification requests\n" + response.error.message
215
- );
216
265
  }
266
+
267
+ throw new Error(
268
+ `Failed to list domain verification requests\n${response.error.message}`,
269
+ );
217
270
  }
218
271
 
219
272
  async deleteDomainVerificationRequest(
220
273
  domain: string,
221
- verificationCode: string
222
- ): Promise<sandbox_openapi.HandleDeleteDomainVerificationResponse> {
274
+ verificationCode: string,
275
+ ): Promise<HandleDeleteDomainVerificationResponse> {
223
276
  const response = await sandbox_openapi.handleDeleteDomainVerification({
224
277
  client: this.client,
225
278
  body: {
@@ -229,17 +282,17 @@ export class FreestyleSandboxes {
229
282
  });
230
283
  if (response.data) {
231
284
  return response.data;
232
- } else {
233
- throw new Error(
234
- `Failed to delete domain verification request for domain ${domain}: ${response.error.message}`
235
- );
236
285
  }
286
+
287
+ throw new Error(
288
+ `Failed to delete domain verification request for domain ${domain}: ${response.error.message}`,
289
+ );
237
290
  }
238
291
 
239
292
  async listWebDeployments(
240
293
  limit?: number,
241
- offset?: number
242
- ): Promise<sandbox_openapi.HandleListWebDeploysResponse> {
294
+ offset?: number,
295
+ ): Promise<HandleListWebDeploysResponse> {
243
296
  const response = await sandbox_openapi.handleListWebDeploys({
244
297
  client: this.client,
245
298
  query: {
@@ -247,19 +300,20 @@ export class FreestyleSandboxes {
247
300
  offset: offset ?? 0,
248
301
  },
249
302
  });
303
+
250
304
  if (response.data) {
251
305
  return response.data;
252
- } else {
253
- throw new Error(
254
- "Failed to list web deployments\n" + response.error.message
255
- );
256
306
  }
307
+
308
+ throw new Error(
309
+ `Failed to list web deployments\n${response.error.message}`,
310
+ );
257
311
  }
258
312
 
259
313
  async listExecuteRuns(
260
314
  limit?: number,
261
- offset?: number
262
- ): Promise<sandbox_openapi.HandleListExecuteRunsResponse> {
315
+ offset?: number,
316
+ ): Promise<HandleListExecuteRunsResponse> {
263
317
  const response = await sandbox_openapi.handleListExecuteRuns({
264
318
  client: this.client,
265
319
  query: {
@@ -269,14 +323,11 @@ export class FreestyleSandboxes {
269
323
  });
270
324
  if (response.data) {
271
325
  return response.data;
272
- } else {
273
- throw new Error("Failed to list execute runs\n" + response.error.message);
274
326
  }
327
+ throw new Error(`Failed to list execute runs\n${response.error.message}`);
275
328
  }
276
329
 
277
- async getExecuteRun(
278
- id: string
279
- ): Promise<sandbox_openapi.HandleGetExecuteRunResponse> {
330
+ async getExecuteRun(id: string): Promise<HandleGetExecuteRunResponse> {
280
331
  const response = await sandbox_openapi.handleGetExecuteRun({
281
332
  client: this.client,
282
333
  path: {
@@ -289,7 +340,25 @@ export class FreestyleSandboxes {
289
340
  }
290
341
 
291
342
  throw new Error(
292
- `Failed to get execute run with ID ${id}: ${response.error.message}`
343
+ `Failed to get execute run with ID ${id}: ${response.error.message}`,
344
+ );
345
+ }
346
+
347
+ /** Provision a wildcard certificate for domain. */
348
+ async provisionWildcard(domain: string) {
349
+ const response = await sandbox_openapi.handleVerifyWildcard({
350
+ client: this.client,
351
+ path: {
352
+ domain,
353
+ },
354
+ });
355
+
356
+ if (response.data) {
357
+ return response.data;
358
+ }
359
+
360
+ throw new Error(
361
+ `Failed to provision wildcard for domain ${domain}: ${response.error.message}`,
293
362
  );
294
363
  }
295
364
 
@@ -299,19 +368,21 @@ export class FreestyleSandboxes {
299
368
  * @param name The name of the repository.
300
369
  */
301
370
  async createGitRepository(
302
- name: string
303
- ): Promise<sandbox_openapi.CreateRepoHandlerResponse> {
304
- const response = await sandbox_openapi.createRepoHandler({
371
+ name: string,
372
+ ): Promise<CreateRepositoryResponseSuccess> {
373
+ const response = await sandbox_openapi.handleCreateRepo({
305
374
  client: this.client,
306
375
  body: {
307
376
  name,
308
377
  },
309
378
  });
379
+
310
380
  if (response.data) {
311
381
  return response.data;
312
382
  }
383
+
313
384
  throw new Error(
314
- `Failed to create git repository ${name}: ${response.error}`
385
+ `Failed to create git repository ${name}: ${response.error}`,
315
386
  );
316
387
  }
317
388
 
@@ -323,18 +394,20 @@ export class FreestyleSandboxes {
323
394
  */
324
395
  async listGitRepositories(
325
396
  limit?: number,
326
- offset?: number
327
- ): Promise<sandbox_openapi.ListRepositoriesHandlerResponse> {
328
- const response = await sandbox_openapi.listRepositoriesHandler({
397
+ offset?: number,
398
+ ): Promise<HandleListRepositoriesResponse> {
399
+ const response = await sandbox_openapi.handleListRepositories({
329
400
  client: this.client,
330
401
  query: {
331
402
  limit: limit ?? 10,
332
403
  offset: offset ?? 0,
333
404
  },
334
405
  });
406
+
335
407
  if (response.data) {
336
408
  return response.data;
337
409
  }
410
+
338
411
  throw new Error(`Failed to list git repositories: ${response.error}`);
339
412
  }
340
413
 
@@ -344,9 +417,9 @@ export class FreestyleSandboxes {
344
417
  * @param repositoryId The ID of the repository to delete.
345
418
  */
346
419
  async deleteGitRepository(
347
- repositoryId: string
348
- ): Promise<sandbox_openapi.DeleteRepoHandlerResponse> {
349
- const response = await sandbox_openapi.deleteRepoHandler({
420
+ repositoryId: string,
421
+ ): Promise<HandleDeleteRepoResponse> {
422
+ const response = await sandbox_openapi.handleDeleteRepo({
350
423
  client: this.client,
351
424
  path: {
352
425
  repo: repositoryId,
@@ -355,29 +428,262 @@ export class FreestyleSandboxes {
355
428
 
356
429
  if (response.data) {
357
430
  return response.data;
358
- } else {
359
- throw new Error(
360
- `Failed to delete git repository ${repositoryId}: ${response.error}`
361
- );
362
431
  }
432
+
433
+ throw new Error(
434
+ `Failed to delete git repository ${repositoryId}: ${response.error}`,
435
+ );
363
436
  }
364
437
 
365
- /** Provision a wildcard certificate for domain. */
366
- async provisionWildcard(domain: string) {
367
- const response = await sandbox_openapi.handleVerifyWildcard({
438
+ /**
439
+ * Create a new git identity.
440
+ */
441
+ async createGitIdentity(): Promise<GitIdentity> {
442
+ const response = await sandbox_openapi.handleCreateIdentity({
443
+ client: this.client,
444
+ });
445
+
446
+ if (response.data) {
447
+ return response.data;
448
+ }
449
+
450
+ throw new Error(`Failed to create git identity: ${response.error}`);
451
+ }
452
+
453
+ /**
454
+ * Delete a git identity.
455
+ *
456
+ * @param identityId The ID of the identity to delete.
457
+ */
458
+ async deleteGitIdentity(
459
+ identityId: string,
460
+ ): Promise<HandleDeleteIdentityResponse> {
461
+ const response = await sandbox_openapi.handleDeleteIdentity({
368
462
  client: this.client,
369
463
  path: {
370
- domain,
464
+ identity: identityId,
465
+ },
466
+ });
467
+
468
+ if (response.data) {
469
+ return response.data;
470
+ }
471
+
472
+ throw new Error(`Failed to delete git identity: ${response.error}`);
473
+ }
474
+
475
+ /**
476
+ * Grant a git identity access to a repository.
477
+ *
478
+ * @param repoId The ID of the repository to grant access to.
479
+ * @param identityId The ID of the identity grant access to `repoId`.
480
+ * @param permission The permission to grant.
481
+ */
482
+ async grantGitPermission(
483
+ repoId: string,
484
+ identityId: string,
485
+ permission: AccessLevel,
486
+ ) {
487
+ const response = await sandbox_openapi.handleGrantPermission({
488
+ client: this.client,
489
+ path: {
490
+ repo: repoId,
491
+ identity: identityId,
492
+ },
493
+ body: {
494
+ permission,
495
+ },
496
+ });
497
+
498
+ if (response.data) {
499
+ return response.data;
500
+ }
501
+
502
+ throw new Error(
503
+ `Failed to grant access to git identity ${identityId} for repository ${repoId}: ${response.error}`,
504
+ );
505
+ }
506
+
507
+ /**
508
+ * Update a git identity's permissions on a repository.
509
+ *
510
+ * @param repoId The ID of the repository to update permissions for.
511
+ * @param identityId The ID of the identity to whose access to update.
512
+ * @param permission The permission to grant.
513
+ */
514
+ async updateGitPermission(
515
+ repoId: string,
516
+ identityId: string,
517
+ permission: AccessLevel,
518
+ ): Promise<void> {
519
+ const response = await sandbox_openapi.handleUpdatePermission({
520
+ client: this.client,
521
+ path: {
522
+ repo: repoId,
523
+ identity: identityId,
524
+ },
525
+ body: {
526
+ permission,
527
+ },
528
+ });
529
+
530
+ if (response.data) {
531
+ return;
532
+ }
533
+
534
+ throw new Error(
535
+ `Failed to update permission for git identity ${identityId} for repository ${repoId}: ${response.error}`,
536
+ );
537
+ }
538
+
539
+ /**
540
+ * Revoke a git identity's access to a repository.
541
+ *
542
+ * @param repoId The ID of the repository revoke access to.
543
+ * @param identityId The ID of the identity to revoke access from.
544
+ */
545
+ async revokeGitPermission(repoId: string, identityId: string): Promise<void> {
546
+ const response = await sandbox_openapi.handleRevokePermission({
547
+ client: this.client,
548
+ path: {
549
+ repo: repoId,
550
+ identity: identityId,
551
+ },
552
+ });
553
+
554
+ if (response.data) {
555
+ return;
556
+ }
557
+
558
+ throw new Error(
559
+ `Failed to revoke access to git identity ${identityId} for repository ${repoId}: ${response.error}`,
560
+ );
561
+ }
562
+
563
+ /**
564
+ * List access permissions for a git identity.
565
+ *
566
+ * @param identityId The ID of the identity to list permissions for.
567
+ */
568
+ async listGitPermissions(
569
+ identityId: string,
570
+ ): Promise<ListPermissionResponseSuccess> {
571
+ const response = await sandbox_openapi.handleListPermissions({
572
+ client: this.client,
573
+ path: {
574
+ identity: identityId,
371
575
  },
372
576
  });
373
577
 
374
578
  if (response.data) {
375
579
  return response.data;
376
- } else {
377
- throw new Error(
378
- `Failed to provision wildcard for domain ${domain}: ${response.error.message}`
379
- );
380
580
  }
581
+
582
+ throw new Error(
583
+ `Failed to list permissions for git identity ${identityId}: ${response.error}`,
584
+ );
585
+ }
586
+
587
+ /**
588
+ * Get the permission of a git identity on a repository.
589
+ *
590
+ * @param repoId The ID of the repository to check permissions for.
591
+ * @param identityId The ID of the identity to check permissions for.
592
+ */
593
+ async getGitPermission(
594
+ repoId: string,
595
+ identityId: string,
596
+ ): Promise<DescribePermissionResponseSuccess> {
597
+ const response = await sandbox_openapi.handleDescribePermission({
598
+ client: this.client,
599
+ path: {
600
+ repo: repoId,
601
+ identity: identityId,
602
+ },
603
+ });
604
+
605
+ if (response.data) {
606
+ return response.data;
607
+ }
608
+
609
+ throw new Error(
610
+ `Failed to get permission for git identity ${identityId} on repository ${repoId}: ${response.error}`,
611
+ );
612
+ }
613
+
614
+ /**
615
+ * Create a new git access token for an identity.
616
+ *
617
+ * @param identityId The ID of the identity to create the token for.
618
+ */
619
+ async createGitAccessToken(identityId: string): Promise<CreatedToken> {
620
+ const response = await sandbox_openapi.handleCreateGitToken({
621
+ client: this.client,
622
+ path: {
623
+ identity: identityId,
624
+ },
625
+ });
626
+
627
+ if (response.data) {
628
+ return response.data;
629
+ }
630
+
631
+ throw new Error(
632
+ `Failed to create git access token: ${response.error.message}`,
633
+ );
634
+ }
635
+
636
+ /**
637
+ * Revoke a git access token.
638
+ *
639
+ * @param identityId The ID of the identity the token belongs to.
640
+ * @param tokenId The ID of the token to revoke.
641
+ */
642
+ async revokeGitAccessToken(
643
+ identityId: string,
644
+ tokenId: string,
645
+ ): Promise<void> {
646
+ const response = await sandbox_openapi.handleRevokeGitToken({
647
+ client: this.client,
648
+ body: {
649
+ tokenId,
650
+ },
651
+ path: {
652
+ identity: identityId,
653
+ },
654
+ });
655
+
656
+ if (response.data) {
657
+ return;
658
+ }
659
+
660
+ throw new Error(
661
+ `Failed to revoke git access token ${tokenId}: ${response.error.message}`,
662
+ );
663
+ }
664
+
665
+ /**
666
+ * List git access tokens for an identity.
667
+ *
668
+ * @param identityId The ID of the identity to list tokens for.
669
+ */
670
+ async listGitAccessTokens(
671
+ identityId: string,
672
+ ): Promise<ListGitTokensResponseSuccess> {
673
+ const response = await sandbox_openapi.handleListGitTokens({
674
+ client: this.client,
675
+ path: {
676
+ identity: identityId,
677
+ },
678
+ });
679
+
680
+ if (response.data) {
681
+ return response.data;
682
+ }
683
+
684
+ throw new Error(
685
+ `Failed to list git access tokens: ${response.error.message}`,
686
+ );
381
687
  }
382
688
  }
383
689