freestyle-sandboxes 0.0.45 → 0.0.47

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/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FreestyleExecuteScriptParamsConfiguration, a as FreestyleExecuteScriptResultSuccess, D as DeploymentSource, b as FreestyleDeployWebConfiguration, B as BuildOptions, c as FreestyleDeployWebSuccessResponseV2, d as FreestyleCloudstateDeployRequest, e as FreestyleCloudstateDeploySuccessResponse, H as HandleBackupCloudstateResponse, f as HandleGetLogsResponse, g as HandleCreateDomainVerificationResponse, h as HandleVerifyDomainResponse, i as HandleVerifyDomainError, j as HandleListDomainsResponse, k as HandleListDomainVerificationRequestsResponse, l as HandleDeleteDomainVerificationResponse, m as HandleListWebDeploysResponse, n as HandleListExecuteRunsResponse, o as HandleGetExecuteRunResponse, p as HandleVerifyWildcardResponse, C as CreateRepositoryResponseSuccess, q as HandleListRepositoriesResponse, r as HandleDeleteRepoResponse, G as GitIdentity, s as HandleDeleteIdentityResponse, A as AccessLevel, t as HandleGrantPermissionResponse, L as ListPermissionResponseSuccess, u as DescribePermissionResponseSuccess, v as CreatedToken, w as ListGitTokensResponseSuccess } from './types.gen-CZUnqmzP.js';
2
- export { y as AccessTokenInfo, x as AccessibleRepository, z as Behavior, E as CreateDomainMappingRequest, I as CreateRecordParams, J as CreateRepositoryRequest, K as DeploymentLogEntry, N as DeploymentState, O as DevServer, P as DnsRecord, Q as DnsRecordData, R as DnsRecordKind, S as DomainVerificationRequest, T as ExecuteLogEntry, U as ExecuteRunInfo, V as ExecuteRunState, W as FreestyleCloudstateDeployConfiguration, X as FreestyleCloudstateDeployErrorResponse, Y as FreestyleDeleteDomainVerificationRequest, Z as FreestyleDeployWebErrorResponse, _ as FreestyleDeployWebPayload, $ as FreestyleDeployWebPayloadV2, a0 as FreestyleDomainVerificationRequest, a1 as FreestyleExecuteScriptParams, a2 as FreestyleFile, a3 as FreestyleGetLogsResponse, a4 as FreestyleJavaScriptLog, a5 as FreestyleLogResponseObject, a6 as FreestyleNetworkPermission, a8 as FreestyleVerifyDomainRequest, a9 as GitRepositoryTrigger, ac as GitTrigger, ad as GitTriggerAction, ae as GrantPermissionRequest, ap as HandleBackupCloudstateData, aq as HandleBackupCloudstateError, aL as HandleCreateDomainVerificationData, aM as HandleCreateDomainVerificationError, bi as HandleCreateGitTokenData, bk as HandleCreateGitTokenError, bj as HandleCreateGitTokenResponse, by as HandleCreateGitTriggerData, bA as HandleCreateGitTriggerError, bz as HandleCreateGitTriggerResponse, a_ as HandleCreateIdentityError, aZ as HandleCreateIdentityResponse, au as HandleCreateRecordData, aw as HandleCreateRecordError, av as HandleCreateRecordResponse, bq as HandleCreateRepoData, bs as HandleCreateRepoError, br as HandleCreateRepoResponse, aG as HandleDeleteDomainMappingData, aI as HandleDeleteDomainMappingError, aH as HandleDeleteDomainMappingResponse, aN as HandleDeleteDomainVerificationData, aO as HandleDeleteDomainVerificationError, bB as HandleDeleteGitTriggerData, bD as HandleDeleteGitTriggerError, bC as HandleDeleteGitTriggerResponse, a$ as HandleDeleteIdentityData, b0 as HandleDeleteIdentityError, ax as HandleDeleteRecordData, az as HandleDeleteRecordError, ay as HandleDeleteRecordResponse, bt as HandleDeleteRepoData, bu as HandleDeleteRepoError, am as HandleDeployCloudstateData, ao as HandleDeployCloudstateError, an as HandleDeployCloudstateResponse, bG as HandleDeployWebData, bI as HandleDeployWebError, bH as HandleDeployWebResponse, bJ as HandleDeployWebV2Data, bL as HandleDeployWebV2Error, bK as HandleDeployWebV2Response, b4 as HandleDescribePermissionData, b6 as HandleDescribePermissionError, b5 as HandleDescribePermissionResponse, aP as HandleEphemeralDevServerData, aR as HandleEphemeralDevServerError, aQ as HandleEphemeralDevServerResponse, aW as HandleExecuteScriptData, aY as HandleExecuteScriptError, aX as HandleExecuteScriptResponse, aU as HandleGetExecuteRunData, aV as HandleGetExecuteRunError, bE as HandleGetLogsData, bF as HandleGetLogsError, bO as HandleGetWebDeployDetailsData, b7 as HandleGrantPermissionData, b8 as HandleGrantPermissionError, aD as HandleInsertDomainMappingData, aF as HandleInsertDomainMappingError, aE as HandleInsertDomainMappingResponse, aJ as HandleListDomainVerificationRequestsError, aC as HandleListDomainsError, aS as HandleListExecuteRunsData, aT as HandleListExecuteRunsError, bf as HandleListGitTokensData, bh as HandleListGitTokensError, bg as HandleListGitTokensResponse, bv as HandleListGitTriggersData, bx as HandleListGitTriggersError, bw as HandleListGitTriggersResponse, b1 as HandleListPermissionsData, b3 as HandleListPermissionsError, b2 as HandleListPermissionsResponse, ar as HandleListRecordsData, at as HandleListRecordsError, as as HandleListRecordsResponse, bo as HandleListRepositoriesData, bp as HandleListRepositoriesError, bM as HandleListWebDeploysData, bN as HandleListWebDeploysError, bl as HandleRevokeGitTokenData, bn as HandleRevokeGitTokenError, bm as HandleRevokeGitTokenResponse, b9 as HandleRevokePermissionData, bb as HandleRevokePermissionError, ba as HandleRevokePermissionResponse, bc as HandleUpdatePermissionData, be as HandleUpdatePermissionError, bd as HandleUpdatePermissionResponse, aK as HandleVerifyDomainData, aA as HandleVerifyWildcardData, aB as HandleVerifyWildcardError, af as InternalServerError, ag as ListRecordsResponse, ah as NetworkPermissionData, ai as RepositoryInfo, aj as RevokeGitTokenRequest, ak as UpdatePermissionRequest, al as Visibility, a7 as action, ab as action2, aa as event, M as kind } from './types.gen-CZUnqmzP.js';
1
+ import { F as FreestyleExecuteScriptParamsConfiguration, a as FreestyleExecuteScriptResultSuccess, D as DeploymentSource, b as FreestyleDeployWebConfiguration, B as BuildOptions, c as FreestyleDeployWebSuccessResponseV2, d as FreestyleCloudstateDeployRequest, e as FreestyleCloudstateDeploySuccessResponse, H as HandleBackupCloudstateResponse, f as HandleGetLogsResponse, g as HandleCreateDomainVerificationResponse, h as HandleVerifyDomainResponse, i as HandleVerifyDomainError, j as HandleListDomainsResponse, k as HandleListDomainVerificationRequestsResponse, l as HandleDeleteDomainVerificationResponse, m as HandleListWebDeploysResponse, n as HandleListExecuteRunsResponse, o as HandleGetExecuteRunResponse, p as HandleVerifyWildcardResponse, C as CreateRepositoryResponseSuccess, q as HandleListRepositoriesResponse, r as HandleDeleteRepoResponse, G as GitIdentity, s as HandleDeleteIdentityResponse, A as AccessLevel, t as HandleGrantPermissionResponse, L as ListPermissionResponseSuccess, u as DescribePermissionResponseSuccess, v as CreatedToken, w as ListGitTokensResponseSuccess, x as HandleListGitTriggersResponse, y as GitTrigger, z as GitTriggerAction, E as HandleCreateGitTriggerResponse, I as HandleEphemeralDevServerResponse } from './types.gen-CIf3ciN7.js';
2
+ export { K as AccessTokenInfo, J as AccessibleRepository, M as Behavior, N as CreateDomainMappingRequest, O as CreateRecordParams, P as CreateRepoRequest, R as CreateRepoSource, Q as CreateRepositoryRequest, T as DeploymentLogEntry, V as DeploymentState, W as DevServer, X as DnsRecord, Y as DnsRecordData, Z as DnsRecordKind, _ as DomainVerificationRequest, $ as ExecuteLogEntry, a0 as ExecuteRunInfo, a1 as ExecuteRunState, a2 as FreestyleCloudstateDeployConfiguration, a3 as FreestyleCloudstateDeployErrorResponse, a4 as FreestyleDeleteDomainVerificationRequest, a5 as FreestyleDeployWebErrorResponse, a6 as FreestyleDeployWebPayload, a7 as FreestyleDeployWebPayloadV2, a8 as FreestyleDomainVerificationRequest, a9 as FreestyleExecuteScriptParams, aa as FreestyleFile, ab as FreestyleGetLogsResponse, ac as FreestyleJavaScriptLog, ad as FreestyleLogResponseObject, ae as FreestyleNetworkPermission, ag as FreestyleVerifyDomainRequest, ah as GitRepositoryTrigger, ak as GrantPermissionRequest, av as HandleBackupCloudstateData, aw as HandleBackupCloudstateError, aR as HandleCreateDomainVerificationData, aS as HandleCreateDomainVerificationError, bn as HandleCreateGitTokenData, bp as HandleCreateGitTokenError, bo as HandleCreateGitTokenResponse, bC as HandleCreateGitTriggerData, bD as HandleCreateGitTriggerError, b3 as HandleCreateIdentityError, b2 as HandleCreateIdentityResponse, aA as HandleCreateRecordData, aC as HandleCreateRecordError, aB as HandleCreateRecordResponse, bv as HandleCreateRepoData, bx as HandleCreateRepoError, bw as HandleCreateRepoResponse, aM as HandleDeleteDomainMappingData, aO as HandleDeleteDomainMappingError, aN as HandleDeleteDomainMappingResponse, aT as HandleDeleteDomainVerificationData, aU as HandleDeleteDomainVerificationError, bE as HandleDeleteGitTriggerData, bG as HandleDeleteGitTriggerError, bF as HandleDeleteGitTriggerResponse, b4 as HandleDeleteIdentityData, b5 as HandleDeleteIdentityError, aD as HandleDeleteRecordData, aF as HandleDeleteRecordError, aE as HandleDeleteRecordResponse, by as HandleDeleteRepoData, bz as HandleDeleteRepoError, as as HandleDeployCloudstateData, au as HandleDeployCloudstateError, at as HandleDeployCloudstateResponse, bJ as HandleDeployWebData, bL as HandleDeployWebError, bK as HandleDeployWebResponse, bM as HandleDeployWebV2Data, bO as HandleDeployWebV2Error, bN as HandleDeployWebV2Response, b9 as HandleDescribePermissionData, bb as HandleDescribePermissionError, ba as HandleDescribePermissionResponse, aV as HandleEphemeralDevServerData, aW as HandleEphemeralDevServerError, a$ as HandleExecuteScriptData, b1 as HandleExecuteScriptError, b0 as HandleExecuteScriptResponse, aZ as HandleGetExecuteRunData, a_ as HandleGetExecuteRunError, bH as HandleGetLogsData, bI as HandleGetLogsError, bR as HandleGetWebDeployDetailsData, bc as HandleGrantPermissionData, bd as HandleGrantPermissionError, aJ as HandleInsertDomainMappingData, aL as HandleInsertDomainMappingError, aK as HandleInsertDomainMappingResponse, aP as HandleListDomainVerificationRequestsError, aI as HandleListDomainsError, aX as HandleListExecuteRunsData, aY as HandleListExecuteRunsError, bk as HandleListGitTokensData, bm as HandleListGitTokensError, bl as HandleListGitTokensResponse, bA as HandleListGitTriggersData, bB as HandleListGitTriggersError, b6 as HandleListPermissionsData, b8 as HandleListPermissionsError, b7 as HandleListPermissionsResponse, ax as HandleListRecordsData, az as HandleListRecordsError, ay as HandleListRecordsResponse, bt as HandleListRepositoriesData, bu as HandleListRepositoriesError, bP as HandleListWebDeploysData, bQ as HandleListWebDeploysError, bq as HandleRevokeGitTokenData, bs as HandleRevokeGitTokenError, br as HandleRevokeGitTokenResponse, be as HandleRevokePermissionData, bg as HandleRevokePermissionError, bf as HandleRevokePermissionResponse, bh as HandleUpdatePermissionData, bj as HandleUpdatePermissionError, bi as HandleUpdatePermissionResponse, aQ as HandleVerifyDomainData, aG as HandleVerifyWildcardData, aH as HandleVerifyWildcardError, al as InternalServerError, am as ListRecordsResponse, an as NetworkPermissionData, ao as RepositoryInfo, ap as RevokeGitTokenRequest, aq as UpdatePermissionRequest, ar as Visibility, af as action, aj as action2, ai as event, U as kind, S as type } from './types.gen-CIf3ciN7.js';
3
3
 
4
4
  declare class FreestyleSandboxes {
5
5
  private client;
@@ -69,88 +69,124 @@ declare class FreestyleSandboxes {
69
69
  provisionWildcard(domain: string): Promise<HandleVerifyWildcardResponse>;
70
70
  /**
71
71
  * Create a new git repository.
72
- *
73
- * @param name The name of the repository.
74
72
  */
75
- createGitRepository(name: string): Promise<CreateRepositoryResponseSuccess>;
73
+ createGitRepository({ name, public: pub, source, }: {
74
+ name: string;
75
+ public?: boolean;
76
+ source?: {
77
+ type: "git";
78
+ url: string;
79
+ branch?: string;
80
+ depth?: number;
81
+ };
82
+ }): Promise<CreateRepositoryResponseSuccess>;
76
83
  /**
77
84
  * List git repositories.
78
- *
79
- * @param limit The maximum number of repositories to return. Defaults to 10.
80
- * @param offset The offset to start at. Defaults to 0.
81
85
  */
82
- listGitRepositories(limit?: number, offset?: number): Promise<HandleListRepositoriesResponse>;
86
+ listGitRepositories({ limit, offset, }?: {
87
+ limit?: number;
88
+ offset?: number;
89
+ }): Promise<HandleListRepositoriesResponse>;
83
90
  /**
84
91
  * Delete a git repository.
85
- *
86
- * @param repositoryId The ID of the repository to delete.
87
92
  */
88
- deleteGitRepository(repositoryId: string): Promise<HandleDeleteRepoResponse>;
93
+ deleteGitRepository({ repoId, }: {
94
+ repoId: string;
95
+ }): Promise<HandleDeleteRepoResponse>;
89
96
  /**
90
97
  * Create a new git identity.
91
98
  */
92
99
  createGitIdentity(): Promise<GitIdentity>;
93
100
  /**
94
101
  * Delete a git identity.
95
- *
96
- * @param identityId The ID of the identity to delete.
97
102
  */
98
- deleteGitIdentity(identityId: string): Promise<HandleDeleteIdentityResponse>;
103
+ deleteGitIdentity({ identityId, }: {
104
+ identityId: string;
105
+ }): Promise<HandleDeleteIdentityResponse>;
99
106
  /**
100
107
  * Grant a git identity access to a repository.
101
- *
102
- * @param repoId The ID of the repository to grant access to.
103
- * @param identityId The ID of the identity grant access to `repoId`.
104
- * @param permission The permission to grant.
105
108
  */
106
- grantGitPermission(repoId: string, identityId: string, permission: AccessLevel): Promise<HandleGrantPermissionResponse>;
109
+ grantGitPermission({ repoId, identityId, permission, }: {
110
+ repoId: string;
111
+ identityId: string;
112
+ permission: AccessLevel;
113
+ }): Promise<HandleGrantPermissionResponse>;
107
114
  /**
108
115
  * Update a git identity's permissions on a repository.
109
- *
110
- * @param repoId The ID of the repository to update permissions for.
111
- * @param identityId The ID of the identity to whose access to update.
112
- * @param permission The permission to grant.
113
116
  */
114
- updateGitPermission(repoId: string, identityId: string, permission: AccessLevel): Promise<void>;
117
+ updateGitPermission({ repoId, identityId, permission, }: {
118
+ repoId: string;
119
+ identityId: string;
120
+ permission: AccessLevel;
121
+ }): Promise<void>;
115
122
  /**
116
123
  * Revoke a git identity's access to a repository.
117
- *
118
- * @param repoId The ID of the repository revoke access to.
119
- * @param identityId The ID of the identity to revoke access from.
120
124
  */
121
- revokeGitPermission(repoId: string, identityId: string): Promise<void>;
125
+ revokeGitPermission({ repoId, identityId, }: {
126
+ repoId: string;
127
+ identityId: string;
128
+ }): Promise<void>;
122
129
  /**
123
130
  * List access permissions for a git identity.
124
- *
125
- * @param identityId The ID of the identity to list permissions for.
126
131
  */
127
- listGitPermissions(identityId: string): Promise<ListPermissionResponseSuccess>;
132
+ listGitPermissions({ identityId, }: {
133
+ identityId: string;
134
+ }): Promise<ListPermissionResponseSuccess>;
128
135
  /**
129
136
  * Get the permission of a git identity on a repository.
130
- *
131
- * @param repoId The ID of the repository to check permissions for.
132
- * @param identityId The ID of the identity to check permissions for.
133
137
  */
134
- getGitPermission(repoId: string, identityId: string): Promise<DescribePermissionResponseSuccess>;
138
+ getGitPermission({ repoId, identityId, }: {
139
+ repoId: string;
140
+ identityId: string;
141
+ }): Promise<DescribePermissionResponseSuccess>;
135
142
  /**
136
143
  * Create a new git access token for an identity.
137
- *
138
- * @param identityId The ID of the identity to create the token for.
139
144
  */
140
- createGitAccessToken(identityId: string): Promise<CreatedToken>;
145
+ createGitAccessToken({ identityId, }: {
146
+ identityId: string;
147
+ }): Promise<CreatedToken>;
141
148
  /**
142
149
  * Revoke a git access token.
143
- *
144
- * @param identityId The ID of the identity the token belongs to.
145
- * @param tokenId The ID of the token to revoke.
146
150
  */
147
- revokeGitAccessToken(identityId: string, tokenId: string): Promise<void>;
151
+ revokeGitAccessToken({ identityId, tokenId, }: {
152
+ identityId: string;
153
+ tokenId: string;
154
+ }): Promise<void>;
148
155
  /**
149
156
  * List git access tokens for an identity.
150
- *
151
- * @param identityId The ID of the identity to list tokens for.
152
157
  */
153
- listGitAccessTokens(identityId: string): Promise<ListGitTokensResponseSuccess>;
158
+ listGitAccessTokens({ identityId, }: {
159
+ identityId: string;
160
+ }): Promise<ListGitTokensResponseSuccess>;
161
+ /**
162
+ * List git triggers for a repository.
163
+ */
164
+ listGitTriggers({ repoId, }: {
165
+ repoId: string;
166
+ }): Promise<HandleListGitTriggersResponse>;
167
+ /**
168
+ * Create a git trigger for a repository.
169
+ */
170
+ createGitTrigger({ repoId, trigger, action, }: {
171
+ repoId: string;
172
+ trigger: GitTrigger;
173
+ action: GitTriggerAction;
174
+ }): Promise<HandleCreateGitTriggerResponse>;
175
+ /**
176
+ * Delete a git trigger.
177
+ */
178
+ deleteGitTrigger({ triggerId }: {
179
+ triggerId: string;
180
+ }): Promise<void>;
181
+ /**
182
+ * Request a dev server for a repository. If a dev server is already running
183
+ * for that repository, it will return a url to that server. Dev servers are
184
+ * ephemeral so you should call this function every time you need a url. Do
185
+ * not store the url in your database!
186
+ */
187
+ requestDevServer({ repoUrl }: {
188
+ repoUrl: string;
189
+ }): Promise<HandleEphemeralDevServerResponse>;
154
190
  }
155
191
 
156
- export { AccessLevel, BuildOptions, CreateRepositoryResponseSuccess, CreatedToken, DeploymentSource, DescribePermissionResponseSuccess, FreestyleCloudstateDeployRequest, FreestyleCloudstateDeploySuccessResponse, FreestyleDeployWebConfiguration, FreestyleDeployWebSuccessResponseV2, FreestyleExecuteScriptParamsConfiguration, FreestyleExecuteScriptResultSuccess, FreestyleSandboxes, GitIdentity, HandleBackupCloudstateResponse, HandleCreateDomainVerificationResponse, HandleDeleteDomainVerificationResponse, HandleDeleteIdentityResponse, HandleDeleteRepoResponse, HandleGetExecuteRunResponse, HandleGetLogsResponse, HandleGrantPermissionResponse, HandleListDomainVerificationRequestsResponse, HandleListDomainsResponse, HandleListExecuteRunsResponse, HandleListRepositoriesResponse, HandleListWebDeploysResponse, HandleVerifyDomainError, HandleVerifyDomainResponse, HandleVerifyWildcardResponse, ListGitTokensResponseSuccess, ListPermissionResponseSuccess };
192
+ export { AccessLevel, BuildOptions, CreateRepositoryResponseSuccess, CreatedToken, DeploymentSource, DescribePermissionResponseSuccess, FreestyleCloudstateDeployRequest, FreestyleCloudstateDeploySuccessResponse, FreestyleDeployWebConfiguration, FreestyleDeployWebSuccessResponseV2, FreestyleExecuteScriptParamsConfiguration, FreestyleExecuteScriptResultSuccess, FreestyleSandboxes, GitIdentity, GitTrigger, GitTriggerAction, HandleBackupCloudstateResponse, HandleCreateDomainVerificationResponse, HandleCreateGitTriggerResponse, HandleDeleteDomainVerificationResponse, HandleDeleteIdentityResponse, HandleDeleteRepoResponse, HandleEphemeralDevServerResponse, HandleGetExecuteRunResponse, HandleGetLogsResponse, HandleGrantPermissionResponse, HandleListDomainVerificationRequestsResponse, HandleListDomainsResponse, HandleListExecuteRunsResponse, HandleListGitTriggersResponse, HandleListRepositoriesResponse, HandleListWebDeploysResponse, HandleVerifyDomainError, HandleVerifyDomainResponse, HandleVerifyWildcardResponse, ListGitTokensResponseSuccess, ListPermissionResponseSuccess };
package/dist/index.mjs CHANGED
@@ -49,6 +49,12 @@ const handleDeleteDomainVerification = (options) => {
49
49
  url: "/domains/v1/verifications"
50
50
  });
51
51
  };
52
+ const handleEphemeralDevServer = (options) => {
53
+ return (options?.client ?? client).post({
54
+ ...options,
55
+ url: "/ephemeral/v1/dev-servers"
56
+ });
57
+ };
52
58
  const handleListExecuteRuns = (options) => {
53
59
  return (options?.client ?? client).get({
54
60
  ...options,
@@ -145,6 +151,24 @@ const handleDeleteRepo = (options) => {
145
151
  url: "/git/v1/repo/{repo}"
146
152
  });
147
153
  };
154
+ const handleListGitTriggers = (options) => {
155
+ return (options?.client ?? client).get({
156
+ ...options,
157
+ url: "/git/v1/repo/{repo}/trigger"
158
+ });
159
+ };
160
+ const handleCreateGitTrigger = (options) => {
161
+ return (options?.client ?? client).post({
162
+ ...options,
163
+ url: "/git/v1/repo/{repo}/trigger"
164
+ });
165
+ };
166
+ const handleDeleteGitTrigger = (options) => {
167
+ return (options?.client ?? client).delete({
168
+ ...options,
169
+ url: "/git/v1/repo/{repo}/trigger/{trigger}"
170
+ });
171
+ };
148
172
  const handleGetLogs = (options) => {
149
173
  return (options?.client ?? client).get({
150
174
  ...options,
@@ -427,14 +451,18 @@ ${response.error.message}`);
427
451
  }
428
452
  /**
429
453
  * Create a new git repository.
430
- *
431
- * @param name The name of the repository.
432
454
  */
433
- async createGitRepository(name) {
455
+ async createGitRepository({
456
+ name,
457
+ public: pub = false,
458
+ source
459
+ }) {
434
460
  const response = await handleCreateRepo({
435
461
  client: this.client,
436
462
  body: {
437
- name
463
+ name,
464
+ public: pub,
465
+ source
438
466
  }
439
467
  });
440
468
  if (response.data) {
@@ -446,16 +474,16 @@ ${response.error.message}`);
446
474
  }
447
475
  /**
448
476
  * List git repositories.
449
- *
450
- * @param limit The maximum number of repositories to return. Defaults to 10.
451
- * @param offset The offset to start at. Defaults to 0.
452
477
  */
453
- async listGitRepositories(limit, offset) {
478
+ async listGitRepositories({
479
+ limit = 10,
480
+ offset = 0
481
+ } = {}) {
454
482
  const response = await handleListRepositories({
455
483
  client: this.client,
456
484
  query: {
457
- limit: limit ?? 10,
458
- offset: offset ?? 0
485
+ limit,
486
+ offset
459
487
  }
460
488
  });
461
489
  if (response.data) {
@@ -465,21 +493,21 @@ ${response.error.message}`);
465
493
  }
466
494
  /**
467
495
  * Delete a git repository.
468
- *
469
- * @param repositoryId The ID of the repository to delete.
470
496
  */
471
- async deleteGitRepository(repositoryId) {
497
+ async deleteGitRepository({
498
+ repoId
499
+ }) {
472
500
  const response = await handleDeleteRepo({
473
501
  client: this.client,
474
502
  path: {
475
- repo: repositoryId
503
+ repo: repoId
476
504
  }
477
505
  });
478
506
  if (response.data) {
479
507
  return response.data;
480
508
  }
481
509
  throw new Error(
482
- `Failed to delete git repository ${repositoryId}: ${response.error}`
510
+ `Failed to delete git repository ${repoId}: ${response.error}`
483
511
  );
484
512
  }
485
513
  /**
@@ -496,10 +524,10 @@ ${response.error.message}`);
496
524
  }
497
525
  /**
498
526
  * Delete a git identity.
499
- *
500
- * @param identityId The ID of the identity to delete.
501
527
  */
502
- async deleteGitIdentity(identityId) {
528
+ async deleteGitIdentity({
529
+ identityId
530
+ }) {
503
531
  const response = await handleDeleteIdentity({
504
532
  client: this.client,
505
533
  path: {
@@ -513,12 +541,12 @@ ${response.error.message}`);
513
541
  }
514
542
  /**
515
543
  * Grant a git identity access to a repository.
516
- *
517
- * @param repoId The ID of the repository to grant access to.
518
- * @param identityId The ID of the identity grant access to `repoId`.
519
- * @param permission The permission to grant.
520
544
  */
521
- async grantGitPermission(repoId, identityId, permission) {
545
+ async grantGitPermission({
546
+ repoId,
547
+ identityId,
548
+ permission
549
+ }) {
522
550
  const response = await handleGrantPermission({
523
551
  client: this.client,
524
552
  path: {
@@ -538,12 +566,12 @@ ${response.error.message}`);
538
566
  }
539
567
  /**
540
568
  * Update a git identity's permissions on a repository.
541
- *
542
- * @param repoId The ID of the repository to update permissions for.
543
- * @param identityId The ID of the identity to whose access to update.
544
- * @param permission The permission to grant.
545
569
  */
546
- async updateGitPermission(repoId, identityId, permission) {
570
+ async updateGitPermission({
571
+ repoId,
572
+ identityId,
573
+ permission
574
+ }) {
547
575
  const response = await handleUpdatePermission({
548
576
  client: this.client,
549
577
  path: {
@@ -563,11 +591,11 @@ ${response.error.message}`);
563
591
  }
564
592
  /**
565
593
  * Revoke a git identity's access to a repository.
566
- *
567
- * @param repoId The ID of the repository revoke access to.
568
- * @param identityId The ID of the identity to revoke access from.
569
594
  */
570
- async revokeGitPermission(repoId, identityId) {
595
+ async revokeGitPermission({
596
+ repoId,
597
+ identityId
598
+ }) {
571
599
  const response = await handleRevokePermission({
572
600
  client: this.client,
573
601
  path: {
@@ -584,10 +612,10 @@ ${response.error.message}`);
584
612
  }
585
613
  /**
586
614
  * List access permissions for a git identity.
587
- *
588
- * @param identityId The ID of the identity to list permissions for.
589
615
  */
590
- async listGitPermissions(identityId) {
616
+ async listGitPermissions({
617
+ identityId
618
+ }) {
591
619
  const response = await handleListPermissions({
592
620
  client: this.client,
593
621
  path: {
@@ -603,11 +631,11 @@ ${response.error.message}`);
603
631
  }
604
632
  /**
605
633
  * Get the permission of a git identity on a repository.
606
- *
607
- * @param repoId The ID of the repository to check permissions for.
608
- * @param identityId The ID of the identity to check permissions for.
609
634
  */
610
- async getGitPermission(repoId, identityId) {
635
+ async getGitPermission({
636
+ repoId,
637
+ identityId
638
+ }) {
611
639
  const response = await handleDescribePermission({
612
640
  client: this.client,
613
641
  path: {
@@ -624,10 +652,10 @@ ${response.error.message}`);
624
652
  }
625
653
  /**
626
654
  * Create a new git access token for an identity.
627
- *
628
- * @param identityId The ID of the identity to create the token for.
629
655
  */
630
- async createGitAccessToken(identityId) {
656
+ async createGitAccessToken({
657
+ identityId
658
+ }) {
631
659
  const response = await handleCreateGitToken({
632
660
  client: this.client,
633
661
  path: {
@@ -643,11 +671,11 @@ ${response.error.message}`);
643
671
  }
644
672
  /**
645
673
  * Revoke a git access token.
646
- *
647
- * @param identityId The ID of the identity the token belongs to.
648
- * @param tokenId The ID of the token to revoke.
649
674
  */
650
- async revokeGitAccessToken(identityId, tokenId) {
675
+ async revokeGitAccessToken({
676
+ identityId,
677
+ tokenId
678
+ }) {
651
679
  const response = await handleRevokeGitToken({
652
680
  client: this.client,
653
681
  body: {
@@ -666,10 +694,10 @@ ${response.error.message}`);
666
694
  }
667
695
  /**
668
696
  * List git access tokens for an identity.
669
- *
670
- * @param identityId The ID of the identity to list tokens for.
671
697
  */
672
- async listGitAccessTokens(identityId) {
698
+ async listGitAccessTokens({
699
+ identityId
700
+ }) {
673
701
  const response = await handleListGitTokens({
674
702
  client: this.client,
675
703
  path: {
@@ -683,6 +711,89 @@ ${response.error.message}`);
683
711
  `Failed to list git access tokens: ${response.error.message}`
684
712
  );
685
713
  }
714
+ /**
715
+ * List git triggers for a repository.
716
+ */
717
+ async listGitTriggers({
718
+ repoId
719
+ }) {
720
+ const response = await handleListGitTriggers({
721
+ client: this.client,
722
+ path: {
723
+ repo: repoId
724
+ }
725
+ });
726
+ if (response.data) {
727
+ return response.data;
728
+ }
729
+ throw new Error(
730
+ `Failed to list git triggers for repository ${repoId}: ${response.error.message}`
731
+ );
732
+ }
733
+ /**
734
+ * Create a git trigger for a repository.
735
+ */
736
+ async createGitTrigger({
737
+ repoId,
738
+ trigger,
739
+ action
740
+ }) {
741
+ const response = await handleCreateGitTrigger({
742
+ client: this.client,
743
+ path: {
744
+ repo: repoId
745
+ },
746
+ body: {
747
+ trigger,
748
+ action
749
+ }
750
+ });
751
+ if (response.data) {
752
+ return response.data;
753
+ }
754
+ throw new Error(
755
+ `Failed to create git trigger for repository ${repoId}: ${response.error.message}`
756
+ );
757
+ }
758
+ /**
759
+ * Delete a git trigger.
760
+ */
761
+ async deleteGitTrigger({ triggerId }) {
762
+ const response = await handleDeleteGitTrigger({
763
+ client: this.client,
764
+ path: {
765
+ trigger: triggerId
766
+ }
767
+ });
768
+ if (response.data) {
769
+ return;
770
+ }
771
+ throw new Error(
772
+ `Failed to delete git trigger ${triggerId}: ${response.error.message}`
773
+ );
774
+ }
775
+ /**
776
+ * Request a dev server for a repository. If a dev server is already running
777
+ * for that repository, it will return a url to that server. Dev servers are
778
+ * ephemeral so you should call this function every time you need a url. Do
779
+ * not store the url in your database!
780
+ */
781
+ async requestDevServer({
782
+ repoUrl
783
+ }) {
784
+ const response = await handleEphemeralDevServer({
785
+ client: this.client,
786
+ body: {
787
+ repo: repoUrl
788
+ }
789
+ });
790
+ if (!response.data) {
791
+ throw new Error(
792
+ `Failed to request dev server: ${response.error}`
793
+ );
794
+ }
795
+ return response.data;
796
+ }
686
797
  }
687
798
 
688
799
  export { FreestyleSandboxes };