-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathworkflow-run-steps.ts
More file actions
38 lines (34 loc) · 1.26 KB
/
workflow-run-steps.ts
File metadata and controls
38 lines (34 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { buildPaginationQuery } from '../common/utils/build-pagination-query';
import type { Resend } from '../resend';
import type {
GetWorkflowRunStepOptions,
GetWorkflowRunStepResponse,
GetWorkflowRunStepResponseSuccess,
} from './interfaces/get-workflow-run-step.interface';
import type {
ListWorkflowRunStepsOptions,
ListWorkflowRunStepsResponse,
ListWorkflowRunStepsResponseSuccess,
} from './interfaces/list-workflow-run-steps.interface';
export class WorkflowRunSteps {
constructor(private readonly resend: Resend) {}
async get(
options: GetWorkflowRunStepOptions,
): Promise<GetWorkflowRunStepResponse> {
const data = await this.resend.get<GetWorkflowRunStepResponseSuccess>(
`/automations/${options.workflowId}/runs/${options.runId}/steps/${options.stepId}`,
);
return data;
}
async list(
options: ListWorkflowRunStepsOptions,
): Promise<ListWorkflowRunStepsResponse> {
const queryString = buildPaginationQuery(options);
const url = queryString
? `/automations/${options.workflowId}/runs/${options.runId}/steps?${queryString}`
: `/automations/${options.workflowId}/runs/${options.runId}/steps`;
const data =
await this.resend.get<ListWorkflowRunStepsResponseSuccess>(url);
return data;
}
}