1 | |
2 |
|
3 | import * as wmill from "windmill-client" |
4 |
|
5 | |
6 | wmill.OpenAPI.interceptors.response.use(async (response) => { |
7 | if (!response.ok) { |
8 | throw new Error(`${response.status} ${await response.text()}`) |
9 | } |
10 | return response |
11 | }) |
12 |
|
13 | |
14 | * List Completed Jobs |
15 | * List completed jobs, newest first, with optional filters on path, creator, status and start time. |
16 | */ |
17 | export async function main( |
18 | script_path_exact: string | undefined, |
19 | script_path_start: string | undefined, |
20 | schedule_path: string | undefined, |
21 | created_by: string | undefined, |
22 | status: "any" | "success" | "failure" | "canceled" | "skipped" = "any", |
23 | started_after: string | undefined, |
24 | started_before: string | undefined, |
25 | page: number | undefined, |
26 | per_page: number | undefined |
27 | ) { |
28 | return await wmill.JobService.listCompletedJobs({ |
29 | workspace: wmill.getWorkspace(), |
30 | scriptPathExact: script_path_exact || undefined, |
31 | scriptPathStart: script_path_start || undefined, |
32 | schedulePath: schedule_path || undefined, |
33 | createdBy: created_by || undefined, |
34 | status: !status || status === "any" ? undefined : status, |
35 | startedAfter: started_after || undefined, |
36 | startedBefore: started_before || undefined, |
37 | page: page ?? undefined, |
38 | perPage: per_page ?? undefined, |
39 | }) |
40 | } |
41 |
|