//native
import * as wmill from "windmill-client"
// windmill-client errors only carry the status text: throw the response body, which says why
wmill.OpenAPI.interceptors.response.use(async (response) => {
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return response
})
/**
* List Completed Jobs
* List completed jobs, newest first, with optional filters on path, creator, status and start time.
*/
export async function main(
script_path_exact: string | undefined,
script_path_start: string | undefined,
schedule_path: string | undefined,
created_by: string | undefined,
status: "any" | "success" | "failure" | "canceled" | "skipped" = "any",
started_after: string | undefined,
started_before: string | undefined,
page: number | undefined,
per_page: number | undefined
) {
return await wmill.JobService.listCompletedJobs({
workspace: wmill.getWorkspace(),
scriptPathExact: script_path_exact || undefined,
scriptPathStart: script_path_start || undefined,
schedulePath: schedule_path || undefined,
createdBy: created_by || undefined,
status: !status || status === "any" ? undefined : status,
startedAfter: started_after || undefined,
startedBefore: started_before || undefined,
page: page ?? undefined,
perPage: per_page ?? undefined,
})
}
Submitted by hugo989 5 hours ago