@hatchet-dev/typescript-sdk 0.8.0-alpha.2 → 0.8.0-alpha.4

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.
@@ -32,7 +32,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
32
32
  return (mod && mod.__esModule) ? mod : { "default": mod };
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.ListenerClient = exports.PollingAsyncListener = exports.RunEventType = void 0;
35
+ exports.ListenerClient = exports.RunEventListener = exports.RunEventType = void 0;
36
36
  // eslint-disable-next-line max-classes-per-file
37
37
  const nice_grpc_1 = require("nice-grpc");
38
38
  const events_1 = require("events");
@@ -94,13 +94,12 @@ const workflowStatusMap = {
94
94
  [data_contracts_1.WorkflowRunStatus.RUNNING]: undefined,
95
95
  [data_contracts_1.WorkflowRunStatus.QUEUED]: undefined,
96
96
  };
97
- class PollingAsyncListener {
97
+ class RunEventListener {
98
98
  constructor(workflowRunid, client) {
99
99
  this.q = [];
100
100
  this.eventEmitter = new events_1.EventEmitter();
101
101
  this.client = client;
102
102
  this.listen(workflowRunid);
103
- this.polling(workflowRunid);
104
103
  }
105
104
  emit(event) {
106
105
  this.q.push(event);
@@ -110,14 +109,9 @@ class PollingAsyncListener {
110
109
  return __awaiter(this, void 0, void 0, function* () {
111
110
  var _a, e_1, _b, _c;
112
111
  var _d;
113
- let listener = this.client.client.subscribeToWorkflowEvents({
112
+ let listener = this.client.subscribeToWorkflowEvents({
114
113
  workflowRunId,
115
114
  });
116
- const res = yield this.getWorkflowRun(workflowRunId);
117
- if (res) {
118
- this.emit(res);
119
- this.close();
120
- }
121
115
  try {
122
116
  try {
123
117
  for (var _e = true, listener_1 = __asyncValues(listener), listener_1_1; listener_1_1 = yield listener_1.next(), _a = listener_1_1.done, !_a; _e = true) {
@@ -126,19 +120,10 @@ class PollingAsyncListener {
126
120
  const workflowEvent = _c;
127
121
  const eventType = (_d = resourceTypeMap[workflowEvent.resourceType]) === null || _d === void 0 ? void 0 : _d[workflowEvent.eventType];
128
122
  if (eventType) {
129
- if (eventType === RunEventType.WORKFLOW_RUN_EVENT_TYPE_COMPLETED) {
130
- // OPTIMZATION - consider including the workflow run data in the event?
131
- const data = yield this.getWorkflowRun(workflowRunId);
132
- if (data) {
133
- this.emit(data);
134
- }
135
- }
136
- else {
137
- this.emit({
138
- type: eventType,
139
- payload: workflowEvent.eventPayload,
140
- });
141
- }
123
+ this.emit({
124
+ type: eventType,
125
+ payload: workflowEvent.eventPayload,
126
+ });
142
127
  }
143
128
  }
144
129
  }
@@ -158,7 +143,6 @@ class PollingAsyncListener {
158
143
  listener = yield this.retrySubscribe(workflowRunId);
159
144
  }
160
145
  }
161
- setTimeout(() => this.close(), DEFAULT_EVENT_LISTENER_POLL_INTERVAL * 5);
162
146
  });
163
147
  }
164
148
  retrySubscribe(workflowRunId) {
@@ -167,7 +151,7 @@ class PollingAsyncListener {
167
151
  while (retries < DEFAULT_EVENT_LISTENER_RETRY_COUNT) {
168
152
  try {
169
153
  yield (0, sleep_1.default)(DEFAULT_EVENT_LISTENER_RETRY_INTERVAL);
170
- const listener = this.client.client.subscribeToWorkflowEvents({
154
+ const listener = this.client.subscribeToWorkflowEvents({
171
155
  workflowRunId,
172
156
  });
173
157
  return listener;
@@ -179,54 +163,6 @@ class PollingAsyncListener {
179
163
  throw new hatchet_error_1.default(`Could not subscribe to the worker after ${DEFAULT_EVENT_LISTENER_RETRY_COUNT} retries`);
180
164
  });
181
165
  }
182
- getWorkflowRun(workflowRunId) {
183
- return __awaiter(this, void 0, void 0, function* () {
184
- var _a, _b, _c;
185
- try {
186
- const res = yield this.client.api.workflowRunGet(this.client.config.tenant_id, workflowRunId);
187
- const stepRuns = (_c = (_b = (_a = res.data.jobRuns) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.stepRuns) !== null && _c !== void 0 ? _c : [];
188
- const stepRunOutput = stepRuns.reduce((acc, stepRun) => {
189
- var _a;
190
- acc[((_a = stepRun.step) === null || _a === void 0 ? void 0 : _a.readableId) || ''] = JSON.parse(stepRun.output || '{}');
191
- return acc;
192
- }, {});
193
- if (Object.keys(workflowStatusMap).includes(res.data.status)) {
194
- const type = workflowStatusMap[res.data.status];
195
- if (!type)
196
- return undefined;
197
- return {
198
- type,
199
- payload: JSON.stringify(stepRunOutput),
200
- };
201
- }
202
- return undefined;
203
- }
204
- catch (e) {
205
- throw new hatchet_error_1.default(e.message);
206
- }
207
- });
208
- }
209
- polling(workflowRunId) {
210
- return __awaiter(this, void 0, void 0, function* () {
211
- this.pollInterval = setInterval(() => __awaiter(this, void 0, void 0, function* () {
212
- try {
213
- const result = yield this.getWorkflowRun(workflowRunId);
214
- if (result) {
215
- this.emit(result);
216
- this.close();
217
- }
218
- }
219
- catch (e) {
220
- // TODO error handling
221
- }
222
- }), DEFAULT_EVENT_LISTENER_POLL_INTERVAL);
223
- });
224
- }
225
- close() {
226
- if (this.pollInterval) {
227
- clearInterval(this.pollInterval);
228
- }
229
- }
230
166
  stream() {
231
167
  return __asyncGenerator(this, arguments, function* stream_1() {
232
168
  var _a, e_2, _b, _c;
@@ -253,33 +189,28 @@ class PollingAsyncListener {
253
189
  });
254
190
  }
255
191
  }
256
- exports.PollingAsyncListener = PollingAsyncListener;
192
+ exports.RunEventListener = RunEventListener;
257
193
  class ListenerClient {
258
194
  constructor(config, channel, factory, api) {
259
- this.childListeners = {};
260
195
  this.config = config;
261
196
  this.client = factory.create(dispatcher_1.DispatcherDefinition, channel);
262
197
  this.logger = new logger_1.Logger(`Listener`, config.log_level);
263
198
  this.api = api;
264
199
  }
265
- getChildListener(workflowRunId, parentWorkflowRunId) {
266
- if (!this.childListeners[parentWorkflowRunId]) {
267
- this.childListeners[parentWorkflowRunId] = new child_listener_client_1.GrpcPooledListener(this, () => {
268
- // cleanup listener when all children are done
269
- delete this.childListeners[parentWorkflowRunId];
200
+ get(workflowRunId) {
201
+ if (!this.pooledListener) {
202
+ this.pooledListener = new child_listener_client_1.GrpcPooledListener(this, () => {
203
+ this.pooledListener = undefined;
270
204
  });
271
205
  }
272
- return this.childListeners[parentWorkflowRunId].subscribe({
206
+ return this.pooledListener.subscribe({
273
207
  workflowRunId,
274
208
  });
275
209
  }
276
- get(workflowRunId) {
277
- const listener = new PollingAsyncListener(workflowRunId, this);
278
- return listener;
279
- }
280
210
  stream(workflowRunId) {
281
211
  return __awaiter(this, void 0, void 0, function* () {
282
- return this.get(workflowRunId).stream();
212
+ const listener = new RunEventListener(workflowRunId, this.client);
213
+ return listener.stream();
283
214
  });
284
215
  }
285
216
  }
@@ -1,4 +1,4 @@
1
- import { APIMeta, AcceptInviteRequest, CreateAPITokenRequest, CreateAPITokenResponse, CreatePullRequestFromStepRun, CreateSNSIntegrationRequest, CreateTenantAlertEmailGroupRequest, CreateTenantInviteRequest, CreateTenantRequest, EventData, EventKey, EventKeyList, EventList, EventOrderByDirection, EventOrderByField, EventSearch, GetStepRunDiffResponse, LinkGithubRepositoryRequest, ListAPIMetaIntegration, ListAPITokensResponse, ListGithubAppInstallationsResponse, ListGithubBranchesResponse, ListGithubReposResponse, ListPullRequestsResponse, ListSNSIntegrations, ListSlackWebhooks, LogLineLevelField, LogLineList, LogLineOrderByDirection, LogLineOrderByField, LogLineSearch, PullRequestState, RejectInviteRequest, ReplayEventRequest, RerunStepRunRequest, SNSIntegration, StepRun, StepRunEventList, Tenant, TenantAlertEmailGroup, TenantAlertEmailGroupList, TenantAlertingSettings, TenantInvite, TenantInviteList, TenantMember, TenantMemberList, TenantResourcePolicy, TriggerWorkflowRunRequest, UpdateTenantAlertEmailGroupRequest, UpdateTenantInviteRequest, UpdateTenantRequest, User, UserChangePasswordRequest, UserLoginRequest, UserRegisterRequest, UserTenantMembershipsList, WebhookWorker, WebhookWorkerCreateRequest, WebhookWorkerListResponse, Worker, WorkerList, Workflow, WorkflowID, WorkflowList, WorkflowMetrics, WorkflowRun, WorkflowRunList, WorkflowRunStatus, WorkflowRunStatusList, WorkflowRunsCancelRequest, WorkflowRunsMetrics, WorkflowVersion, WorkflowVersionDefinition } from './data-contracts';
1
+ import { AcceptInviteRequest, APIMeta, CreateAPITokenRequest, CreateAPITokenResponse, CreateEventRequest, CreateSNSIntegrationRequest, CreateTenantAlertEmailGroupRequest, CreateTenantInviteRequest, CreateTenantRequest, Event, EventData, EventKey, EventKeyList, EventList, EventOrderByDirection, EventOrderByField, EventSearch, ListAPIMetaIntegration, ListAPITokensResponse, ListSlackWebhooks, ListSNSIntegrations, LogLineLevelField, LogLineList, LogLineOrderByDirection, LogLineOrderByField, LogLineSearch, RejectInviteRequest, ReplayEventRequest, RerunStepRunRequest, SNSIntegration, StepRun, StepRunEventList, Tenant, TenantAlertEmailGroup, TenantAlertEmailGroupList, TenantAlertingSettings, TenantInvite, TenantInviteList, TenantMember, TenantMemberList, TenantQueueMetrics, TenantResourcePolicy, TriggerWorkflowRunRequest, UpdateTenantAlertEmailGroupRequest, UpdateTenantInviteRequest, UpdateTenantRequest, User, UserChangePasswordRequest, UserLoginRequest, UserRegisterRequest, UserTenantMembershipsList, WebhookWorkerCreated, WebhookWorkerCreateRequest, WebhookWorkerListResponse, Worker, WorkerList, Workflow, WorkflowID, WorkflowList, WorkflowMetrics, WorkflowRun, WorkflowRunList, WorkflowRunsCancelRequest, WorkflowRunsMetrics, WorkflowRunStatus, WorkflowRunStatusList, WorkflowVersion, WorkflowVersionDefinition } from './data-contracts';
2
2
  import { HttpClient, RequestParams } from './http-client';
3
3
  export declare class Api<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
4
4
  /**
@@ -83,26 +83,6 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
83
83
  * @request GET:/api/v1/users/github/callback
84
84
  */
85
85
  userUpdateGithubOauthCallback: (params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any>>;
86
- /**
87
- * @description Starts the OAuth flow
88
- *
89
- * @tags User
90
- * @name UserUpdateGithubAppOauthStart
91
- * @summary Start OAuth flow
92
- * @request GET:/api/v1/users/github-app/start
93
- * @secure
94
- */
95
- userUpdateGithubAppOauthStart: (params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any>>;
96
- /**
97
- * @description Completes the OAuth flow
98
- *
99
- * @tags User
100
- * @name UserUpdateGithubAppOauthCallback
101
- * @summary Complete OAuth flow
102
- * @request GET:/api/v1/users/github-app/callback
103
- * @secure
104
- */
105
- userUpdateGithubAppOauthCallback: (params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any>>;
106
86
  /**
107
87
  * @description Starts the OAuth flow
108
88
  *
@@ -123,24 +103,6 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
123
103
  * @secure
124
104
  */
125
105
  userUpdateSlackOauthCallback: (params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any>>;
126
- /**
127
- * @description Github App global webhook
128
- *
129
- * @tags Github
130
- * @name GithubUpdateGlobalWebhook
131
- * @summary Github app global webhook
132
- * @request POST:/api/v1/github/webhook
133
- */
134
- githubUpdateGlobalWebhook: (params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any>>;
135
- /**
136
- * @description Github App tenant webhook
137
- *
138
- * @tags Github
139
- * @name GithubUpdateTenantWebhook
140
- * @summary Github app tenant webhook
141
- * @request POST:/api/v1/github/webhook/{webhook}
142
- */
143
- githubUpdateTenantWebhook: (webhook: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any>>;
144
106
  /**
145
107
  * @description SNS event
146
108
  *
@@ -427,6 +389,24 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
427
389
  * @secure
428
390
  */
429
391
  apiTokenUpdateRevoke: (apiToken: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any>>;
392
+ /**
393
+ * @description Get the queue metrics for the tenant
394
+ *
395
+ * @tags Workflow
396
+ * @name TenantGetQueueMetrics
397
+ * @summary Get workflow metrics
398
+ * @request GET:/api/v1/tenants/{tenant}/queue-metrics
399
+ * @secure
400
+ */
401
+ tenantGetQueueMetrics: (tenant: string, query?: {
402
+ /** A list of workflow IDs to filter by */
403
+ workflows?: WorkflowID[];
404
+ /**
405
+ * A list of metadata key value pairs to filter by
406
+ * @example ["key1:value1","key2:value2"]
407
+ */
408
+ additionalMetadata?: string[];
409
+ }, params?: RequestParams) => Promise<import("axios").AxiosResponse<TenantQueueMetrics, any>>;
430
410
  /**
431
411
  * @description Lists all events for a tenant.
432
412
  *
@@ -465,6 +445,16 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
465
445
  */
466
446
  additionalMetadata?: string[];
467
447
  }, params?: RequestParams) => Promise<import("axios").AxiosResponse<EventList, any>>;
448
+ /**
449
+ * @description Creates a new event.
450
+ *
451
+ * @tags Event
452
+ * @name EventCreate
453
+ * @summary Create event
454
+ * @request POST:/api/v1/tenants/{tenant}/events
455
+ * @secure
456
+ */
457
+ eventCreate: (tenant: string, data: CreateEventRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<Event, any>>;
468
458
  /**
469
459
  * @description Replays a list of events.
470
460
  *
@@ -535,7 +525,7 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
535
525
  * @secure
536
526
  */
537
527
  workflowRunCancel: (tenant: string, data: WorkflowRunsCancelRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<{
538
- workflowRunIds?: string[] | undefined;
528
+ workflowRunIds?: string[];
539
529
  }, any>>;
540
530
  /**
541
531
  * @description Get a workflow for a tenant
@@ -611,16 +601,6 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
611
601
  */
612
602
  version?: string;
613
603
  }, params?: RequestParams) => Promise<import("axios").AxiosResponse<WorkflowVersionDefinition, any>>;
614
- /**
615
- * @description Link a github repository to a workflow
616
- *
617
- * @tags Workflow
618
- * @name WorkflowUpdateLinkGithub
619
- * @summary Link github repository
620
- * @request POST:/api/v1/workflows/{workflow}/link-github
621
- * @secure
622
- */
623
- workflowUpdateLinkGithub: (workflow: string, data: LinkGithubRepositoryRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<Workflow, any>>;
624
604
  /**
625
605
  * @description Get the metrics for a workflow version
626
606
  *
@@ -631,21 +611,11 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
631
611
  * @secure
632
612
  */
633
613
  workflowGetMetrics: (workflow: string, query?: {
634
- /** A status of workflow runs to filter by */
614
+ /** A status of workflow run statuses to filter by */
635
615
  status?: WorkflowRunStatus;
636
616
  /** A group key to filter metrics by */
637
617
  groupKey?: string;
638
618
  }, params?: RequestParams) => Promise<import("axios").AxiosResponse<WorkflowMetrics, any>>;
639
- /**
640
- * @description Create a pull request for a workflow
641
- *
642
- * @tags Workflow
643
- * @name StepRunUpdateCreatePr
644
- * @summary Create pull request
645
- * @request POST:/api/v1/step-runs/{step-run}/create-pr
646
- * @secure
647
- */
648
- stepRunUpdateCreatePr: (stepRun: string, data: CreatePullRequestFromStepRun, params?: RequestParams) => Promise<import("axios").AxiosResponse<CreatePullRequestFromStepRun, any>>;
649
619
  /**
650
620
  * @description Lists log lines for a step run.
651
621
  *
@@ -675,16 +645,6 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
675
645
  /** The order direction */
676
646
  orderByDirection?: LogLineOrderByDirection;
677
647
  }, params?: RequestParams) => Promise<import("axios").AxiosResponse<LogLineList, any>>;
678
- /**
679
- * @description Get the diff for a step run between the most recent run and the first run.
680
- *
681
- * @tags Workflow
682
- * @name StepRunGetDiff
683
- * @summary Get diff
684
- * @request GET:/api/v1/step-runs/{step-run}/diff
685
- * @secure
686
- */
687
- stepRunGetDiff: (stepRun: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<GetStepRunDiffResponse, any>>;
688
648
  /**
689
649
  * @description List events for a step run
690
650
  *
@@ -816,19 +776,6 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
816
776
  * @secure
817
777
  */
818
778
  workflowRunGet: (tenant: string, workflowRun: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<WorkflowRun, any>>;
819
- /**
820
- * @description List all pull requests for a workflow run
821
- *
822
- * @tags Workflow
823
- * @name WorkflowRunListPullRequests
824
- * @summary List pull requests
825
- * @request GET:/api/v1/tenants/{tenant}/workflow-runs/{workflow-run}/prs
826
- * @secure
827
- */
828
- workflowRunListPullRequests: (tenant: string, workflowRun: string, query?: {
829
- /** The pull request state */
830
- state?: PullRequestState;
831
- }, params?: RequestParams) => Promise<import("axios").AxiosResponse<ListPullRequestsResponse, any>>;
832
779
  /**
833
780
  * @description Get a step run by id
834
781
  *
@@ -889,42 +836,12 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
889
836
  * @secure
890
837
  */
891
838
  workerGet: (worker: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<Worker, any>>;
892
- /**
893
- * @description List Github App installations
894
- *
895
- * @tags Github
896
- * @name GithubAppListInstallations
897
- * @summary List Github App installations
898
- * @request GET:/api/v1/github-app/installations
899
- * @secure
900
- */
901
- githubAppListInstallations: (params?: RequestParams) => Promise<import("axios").AxiosResponse<ListGithubAppInstallationsResponse, any>>;
902
- /**
903
- * @description List Github App repositories
904
- *
905
- * @tags Github
906
- * @name GithubAppListRepos
907
- * @summary List Github App repositories
908
- * @request GET:/api/v1/github-app/installations/{gh-installation}/repos
909
- * @secure
910
- */
911
- githubAppListRepos: (ghInstallation: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<ListGithubReposResponse, any>>;
912
- /**
913
- * @description List Github App branches
914
- *
915
- * @tags Github
916
- * @name GithubAppListBranches
917
- * @summary List Github App branches
918
- * @request GET:/api/v1/github-app/installations/{gh-installation}/repos/{gh-repo-owner}/{gh-repo-name}/branches
919
- * @secure
920
- */
921
- githubAppListBranches: (ghInstallation: string, ghRepoOwner: string, ghRepoName: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<ListGithubBranchesResponse, any>>;
922
839
  /**
923
840
  * @description Lists all webhooks
924
841
  *
925
842
  * @name WebhookList
926
843
  * @summary List webhooks
927
- * @request GET:/api/v1/webhook-workers/{tenant}
844
+ * @request GET:/api/v1/tenants/{tenant}/webhook-workers
928
845
  * @secure
929
846
  */
930
847
  webhookList: (tenant: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<WebhookWorkerListResponse, any>>;
@@ -933,7 +850,17 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
933
850
  *
934
851
  * @name WebhookCreate
935
852
  * @summary Create a webhook
936
- * @request POST:/api/v1/webhook-workers/{tenant}/create
853
+ * @request POST:/api/v1/tenants/{tenant}/webhook-workers
854
+ * @secure
855
+ */
856
+ webhookCreate: (tenant: string, data: WebhookWorkerCreateRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<WebhookWorkerCreated, any>>;
857
+ /**
858
+ * @description Deletes a webhook
859
+ *
860
+ * @name WebhookDelete
861
+ * @summary Delete a webhook
862
+ * @request DELETE:/api/v1/webhook-workers/{webhook}
863
+ * @secure
937
864
  */
938
- webhookCreate: (tenant: string, data: WebhookWorkerCreateRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<WebhookWorker, any>>;
865
+ webhookDelete: (webhook: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any>>;
939
866
  }
@@ -97,26 +97,6 @@ class Api extends http_client_1.HttpClient {
97
97
  * @request GET:/api/v1/users/github/callback
98
98
  */
99
99
  this.userUpdateGithubOauthCallback = (params = {}) => this.request(Object.assign({ path: `/api/v1/users/github/callback`, method: 'GET' }, params));
100
- /**
101
- * @description Starts the OAuth flow
102
- *
103
- * @tags User
104
- * @name UserUpdateGithubAppOauthStart
105
- * @summary Start OAuth flow
106
- * @request GET:/api/v1/users/github-app/start
107
- * @secure
108
- */
109
- this.userUpdateGithubAppOauthStart = (params = {}) => this.request(Object.assign({ path: `/api/v1/users/github-app/start`, method: 'GET', secure: true }, params));
110
- /**
111
- * @description Completes the OAuth flow
112
- *
113
- * @tags User
114
- * @name UserUpdateGithubAppOauthCallback
115
- * @summary Complete OAuth flow
116
- * @request GET:/api/v1/users/github-app/callback
117
- * @secure
118
- */
119
- this.userUpdateGithubAppOauthCallback = (params = {}) => this.request(Object.assign({ path: `/api/v1/users/github-app/callback`, method: 'GET', secure: true }, params));
120
100
  /**
121
101
  * @description Starts the OAuth flow
122
102
  *
@@ -137,24 +117,6 @@ class Api extends http_client_1.HttpClient {
137
117
  * @secure
138
118
  */
139
119
  this.userUpdateSlackOauthCallback = (params = {}) => this.request(Object.assign({ path: `/api/v1/users/slack/callback`, method: 'GET', secure: true }, params));
140
- /**
141
- * @description Github App global webhook
142
- *
143
- * @tags Github
144
- * @name GithubUpdateGlobalWebhook
145
- * @summary Github app global webhook
146
- * @request POST:/api/v1/github/webhook
147
- */
148
- this.githubUpdateGlobalWebhook = (params = {}) => this.request(Object.assign({ path: `/api/v1/github/webhook`, method: 'POST' }, params));
149
- /**
150
- * @description Github App tenant webhook
151
- *
152
- * @tags Github
153
- * @name GithubUpdateTenantWebhook
154
- * @summary Github app tenant webhook
155
- * @request POST:/api/v1/github/webhook/{webhook}
156
- */
157
- this.githubUpdateTenantWebhook = (webhook, params = {}) => this.request(Object.assign({ path: `/api/v1/github/webhook/${webhook}`, method: 'POST' }, params));
158
120
  /**
159
121
  * @description SNS event
160
122
  *
@@ -441,6 +403,16 @@ class Api extends http_client_1.HttpClient {
441
403
  * @secure
442
404
  */
443
405
  this.apiTokenUpdateRevoke = (apiToken, params = {}) => this.request(Object.assign({ path: `/api/v1/api-tokens/${apiToken}`, method: 'POST', secure: true }, params));
406
+ /**
407
+ * @description Get the queue metrics for the tenant
408
+ *
409
+ * @tags Workflow
410
+ * @name TenantGetQueueMetrics
411
+ * @summary Get workflow metrics
412
+ * @request GET:/api/v1/tenants/{tenant}/queue-metrics
413
+ * @secure
414
+ */
415
+ this.tenantGetQueueMetrics = (tenant, query, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/queue-metrics`, method: 'GET', query: query, secure: true, format: 'json' }, params));
444
416
  /**
445
417
  * @description Lists all events for a tenant.
446
418
  *
@@ -451,6 +423,16 @@ class Api extends http_client_1.HttpClient {
451
423
  * @secure
452
424
  */
453
425
  this.eventList = (tenant, query, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/events`, method: 'GET', query: query, secure: true, format: 'json' }, params));
426
+ /**
427
+ * @description Creates a new event.
428
+ *
429
+ * @tags Event
430
+ * @name EventCreate
431
+ * @summary Create event
432
+ * @request POST:/api/v1/tenants/{tenant}/events
433
+ * @secure
434
+ */
435
+ this.eventCreate = (tenant, data, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/events`, method: 'POST', body: data, secure: true, type: http_client_1.ContentType.Json, format: 'json' }, params));
454
436
  /**
455
437
  * @description Replays a list of events.
456
438
  *
@@ -571,16 +553,6 @@ class Api extends http_client_1.HttpClient {
571
553
  * @secure
572
554
  */
573
555
  this.workflowVersionGetDefinition = (workflow, query, params = {}) => this.request(Object.assign({ path: `/api/v1/workflows/${workflow}/versions/definition`, method: 'GET', query: query, secure: true, format: 'json' }, params));
574
- /**
575
- * @description Link a github repository to a workflow
576
- *
577
- * @tags Workflow
578
- * @name WorkflowUpdateLinkGithub
579
- * @summary Link github repository
580
- * @request POST:/api/v1/workflows/{workflow}/link-github
581
- * @secure
582
- */
583
- this.workflowUpdateLinkGithub = (workflow, data, params = {}) => this.request(Object.assign({ path: `/api/v1/workflows/${workflow}/link-github`, method: 'POST', body: data, secure: true, type: http_client_1.ContentType.Json, format: 'json' }, params));
584
556
  /**
585
557
  * @description Get the metrics for a workflow version
586
558
  *
@@ -591,16 +563,6 @@ class Api extends http_client_1.HttpClient {
591
563
  * @secure
592
564
  */
593
565
  this.workflowGetMetrics = (workflow, query, params = {}) => this.request(Object.assign({ path: `/api/v1/workflows/${workflow}/metrics`, method: 'GET', query: query, secure: true, format: 'json' }, params));
594
- /**
595
- * @description Create a pull request for a workflow
596
- *
597
- * @tags Workflow
598
- * @name StepRunUpdateCreatePr
599
- * @summary Create pull request
600
- * @request POST:/api/v1/step-runs/{step-run}/create-pr
601
- * @secure
602
- */
603
- this.stepRunUpdateCreatePr = (stepRun, data, params = {}) => this.request(Object.assign({ path: `/api/v1/step-runs/${stepRun}/create-pr`, method: 'POST', body: data, secure: true, type: http_client_1.ContentType.Json, format: 'json' }, params));
604
566
  /**
605
567
  * @description Lists log lines for a step run.
606
568
  *
@@ -611,16 +573,6 @@ class Api extends http_client_1.HttpClient {
611
573
  * @secure
612
574
  */
613
575
  this.logLineList = (stepRun, query, params = {}) => this.request(Object.assign({ path: `/api/v1/step-runs/${stepRun}/logs`, method: 'GET', query: query, secure: true, format: 'json' }, params));
614
- /**
615
- * @description Get the diff for a step run between the most recent run and the first run.
616
- *
617
- * @tags Workflow
618
- * @name StepRunGetDiff
619
- * @summary Get diff
620
- * @request GET:/api/v1/step-runs/{step-run}/diff
621
- * @secure
622
- */
623
- this.stepRunGetDiff = (stepRun, params = {}) => this.request(Object.assign({ path: `/api/v1/step-runs/${stepRun}/diff`, method: 'GET', secure: true, format: 'json' }, params));
624
576
  /**
625
577
  * @description List events for a step run
626
578
  *
@@ -661,16 +613,6 @@ class Api extends http_client_1.HttpClient {
661
613
  * @secure
662
614
  */
663
615
  this.workflowRunGet = (tenant, workflowRun, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/workflow-runs/${workflowRun}`, method: 'GET', secure: true, format: 'json' }, params));
664
- /**
665
- * @description List all pull requests for a workflow run
666
- *
667
- * @tags Workflow
668
- * @name WorkflowRunListPullRequests
669
- * @summary List pull requests
670
- * @request GET:/api/v1/tenants/{tenant}/workflow-runs/{workflow-run}/prs
671
- * @secure
672
- */
673
- this.workflowRunListPullRequests = (tenant, workflowRun, query, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/workflow-runs/${workflowRun}/prs`, method: 'GET', query: query, secure: true, format: 'json' }, params));
674
616
  /**
675
617
  * @description Get a step run by id
676
618
  *
@@ -731,53 +673,33 @@ class Api extends http_client_1.HttpClient {
731
673
  * @secure
732
674
  */
733
675
  this.workerGet = (worker, params = {}) => this.request(Object.assign({ path: `/api/v1/workers/${worker}`, method: 'GET', secure: true, format: 'json' }, params));
734
- /**
735
- * @description List Github App installations
736
- *
737
- * @tags Github
738
- * @name GithubAppListInstallations
739
- * @summary List Github App installations
740
- * @request GET:/api/v1/github-app/installations
741
- * @secure
742
- */
743
- this.githubAppListInstallations = (params = {}) => this.request(Object.assign({ path: `/api/v1/github-app/installations`, method: 'GET', secure: true, format: 'json' }, params));
744
- /**
745
- * @description List Github App repositories
746
- *
747
- * @tags Github
748
- * @name GithubAppListRepos
749
- * @summary List Github App repositories
750
- * @request GET:/api/v1/github-app/installations/{gh-installation}/repos
751
- * @secure
752
- */
753
- this.githubAppListRepos = (ghInstallation, params = {}) => this.request(Object.assign({ path: `/api/v1/github-app/installations/${ghInstallation}/repos`, method: 'GET', secure: true, format: 'json' }, params));
754
- /**
755
- * @description List Github App branches
756
- *
757
- * @tags Github
758
- * @name GithubAppListBranches
759
- * @summary List Github App branches
760
- * @request GET:/api/v1/github-app/installations/{gh-installation}/repos/{gh-repo-owner}/{gh-repo-name}/branches
761
- * @secure
762
- */
763
- this.githubAppListBranches = (ghInstallation, ghRepoOwner, ghRepoName, params = {}) => this.request(Object.assign({ path: `/api/v1/github-app/installations/${ghInstallation}/repos/${ghRepoOwner}/${ghRepoName}/branches`, method: 'GET', secure: true, format: 'json' }, params));
764
676
  /**
765
677
  * @description Lists all webhooks
766
678
  *
767
679
  * @name WebhookList
768
680
  * @summary List webhooks
769
- * @request GET:/api/v1/webhook-workers/{tenant}
681
+ * @request GET:/api/v1/tenants/{tenant}/webhook-workers
770
682
  * @secure
771
683
  */
772
- this.webhookList = (tenant, params = {}) => this.request(Object.assign({ path: `/api/v1/webhook-workers/${tenant}`, method: 'GET', secure: true, format: 'json' }, params));
684
+ this.webhookList = (tenant, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/webhook-workers`, method: 'GET', secure: true, format: 'json' }, params));
773
685
  /**
774
686
  * @description Creates a webhook
775
687
  *
776
688
  * @name WebhookCreate
777
689
  * @summary Create a webhook
778
- * @request POST:/api/v1/webhook-workers/{tenant}/create
690
+ * @request POST:/api/v1/tenants/{tenant}/webhook-workers
691
+ * @secure
692
+ */
693
+ this.webhookCreate = (tenant, data, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/webhook-workers`, method: 'POST', body: data, secure: true, type: http_client_1.ContentType.Json, format: 'json' }, params));
694
+ /**
695
+ * @description Deletes a webhook
696
+ *
697
+ * @name WebhookDelete
698
+ * @summary Delete a webhook
699
+ * @request DELETE:/api/v1/webhook-workers/{webhook}
700
+ * @secure
779
701
  */
780
- this.webhookCreate = (tenant, data, params = {}) => this.request(Object.assign({ path: `/api/v1/webhook-workers/${tenant}/create`, method: 'POST', body: data, type: http_client_1.ContentType.Json, format: 'json' }, params));
702
+ this.webhookDelete = (webhook, params = {}) => this.request(Object.assign({ path: `/api/v1/webhook-workers/${webhook}`, method: 'DELETE', secure: true }, params));
781
703
  }
782
704
  }
783
705
  exports.Api = Api;