Skip to main content
Module

x/windmill/windmill-api/services/JobService.ts

Windmill deno client (separated from the main repo because most of the code is auto-generated from the openapi and not worth committing)
Go to Latest
File
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900
/* istanbul ignore file *//* tslint:disable *//* eslint-disable */import type { CompletedJob } from '../models/CompletedJob.ts';import type { FlowPreview } from '../models/FlowPreview.ts';import type { Job } from '../models/Job.ts';import type { Preview } from '../models/Preview.ts';import type { QueuedJob } from '../models/QueuedJob.ts';import type { ScriptArgs } from '../models/ScriptArgs.ts';
import type { CancelablePromise } from '../core/CancelablePromise.ts';import { OpenAPI } from '../core/OpenAPI.ts';import { request as __request } from '../core/request.ts';
export class JobService {
/** * run script by path * @returns string job created * @throws ApiError */ public static runScriptByPath({ workspace, path, requestBody, scheduledFor, scheduledInSecs, parentJob, }: { workspace: string, path: string, /** * script args */ requestBody: ScriptArgs, /** * when to schedule this job (leave empty for immediate run) */ scheduledFor?: string, /** * schedule the script to execute in the number of seconds starting now */ scheduledInSecs?: number, /** * The parent job that is at the origin and responsible for the execution of this script if any */ parentJob?: string, }): CancelablePromise<string> { return __request(OpenAPI, { method: 'POST', url: '/w/{workspace}/jobs/run/p/{path}', path: { 'workspace': workspace, 'path': path, }, query: { 'scheduled_for': scheduledFor, 'scheduled_in_secs': scheduledInSecs, 'parent_job': parentJob, }, body: requestBody, mediaType: 'application/json', }); }
/** * run script by path * @returns any job result * @throws ApiError */ public static runWaitResultScriptByPath({ workspace, path, requestBody, scheduledFor, scheduledInSecs, parentJob, }: { workspace: string, path: string, /** * script args */ requestBody: ScriptArgs, /** * when to schedule this job (leave empty for immediate run) */ scheduledFor?: string, /** * schedule the script to execute in the number of seconds starting now */ scheduledInSecs?: number, /** * The parent job that is at the origin and responsible for the execution of this script if any */ parentJob?: string, }): CancelablePromise<any> { return __request(OpenAPI, { method: 'POST', url: '/w/{workspace}/jobs/run_wait_result/p/{path}', path: { 'workspace': workspace, 'path': path, }, query: { 'scheduled_for': scheduledFor, 'scheduled_in_secs': scheduledInSecs, 'parent_job': parentJob, }, body: requestBody, mediaType: 'application/json', }); }
/** * get job result by id * @returns any job result * @throws ApiError */ public static resultById({ workspace, flowJobId, nodeId, skipDirect, }: { workspace: string, flowJobId: string, nodeId: string, /** * Skip checking that the node is part of the given flow. */ skipDirect?: boolean, }): CancelablePromise<any> { return __request(OpenAPI, { method: 'GET', url: '/w/{workspace}/jobs/result_by_id/{flow_job_id}/{node_id}', path: { 'workspace': workspace, 'flow_job_id': flowJobId, 'node_id': nodeId, }, query: { 'skip_direct': skipDirect, }, }); }
/** * run flow by path * @returns string job created * @throws ApiError */ public static runFlowByPath({ workspace, path, requestBody, scheduledFor, scheduledInSecs, parentJob, }: { workspace: string, path: string, /** * flow args */ requestBody: ScriptArgs, /** * when to schedule this job (leave empty for immediate run) */ scheduledFor?: string, /** * schedule the script to execute in the number of seconds starting now */ scheduledInSecs?: number, /** * The parent job that is at the origin and responsible for the execution of this script if any */ parentJob?: string, }): CancelablePromise<string> { return __request(OpenAPI, { method: 'POST', url: '/w/{workspace}/jobs/run/f/{path}', path: { 'workspace': workspace, 'path': path, }, query: { 'scheduled_for': scheduledFor, 'scheduled_in_secs': scheduledInSecs, 'parent_job': parentJob, }, body: requestBody, mediaType: 'application/json', }); }
/** * run script by hash * @returns string job created * @throws ApiError */ public static runScriptByHash({ workspace, hash, requestBody, scheduledFor, scheduledInSecs, parentJob, }: { workspace: string, hash: string, /** * Partially filled args */ requestBody: any, /** * when to schedule this job (leave empty for immediate run) */ scheduledFor?: string, /** * schedule the script to execute in the number of seconds starting now */ scheduledInSecs?: number, /** * The parent job that is at the origin and responsible for the execution of this script if any */ parentJob?: string, }): CancelablePromise<string> { return __request(OpenAPI, { method: 'POST', url: '/w/{workspace}/jobs/run/h/{hash}', path: { 'workspace': workspace, 'hash': hash, }, query: { 'scheduled_for': scheduledFor, 'scheduled_in_secs': scheduledInSecs, 'parent_job': parentJob, }, body: requestBody, mediaType: 'application/json', }); }
/** * run script preview * @returns string job created * @throws ApiError */ public static runScriptPreview({ workspace, requestBody, }: { workspace: string, /** * preview */ requestBody: Preview, }): CancelablePromise<string> { return __request(OpenAPI, { method: 'POST', url: '/w/{workspace}/jobs/run/preview', path: { 'workspace': workspace, }, body: requestBody, mediaType: 'application/json', }); }
/** * run flow preview * @returns string job created * @throws ApiError */ public static runFlowPreview({ workspace, requestBody, }: { workspace: string, /** * preview */ requestBody: FlowPreview, }): CancelablePromise<string> { return __request(OpenAPI, { method: 'POST', url: '/w/{workspace}/jobs/run/preview_flow', path: { 'workspace': workspace, }, body: requestBody, mediaType: 'application/json', }); }
/** * list all available queued jobs * @returns QueuedJob All available queued jobs * @throws ApiError */ public static listQueue({ workspace, orderDesc, createdBy, parentJob, scriptPathExact, scriptPathStart, scriptHash, createdBefore, createdAfter, success, jobKinds, }: { workspace: string, /** * order by desc order (default true) */ orderDesc?: boolean, /** * mask to filter exact matching user creator */ createdBy?: string, /** * The parent job that is at the origin and responsible for the execution of this script if any */ parentJob?: string, /** * mask to filter exact matching path */ scriptPathExact?: string, /** * mask to filter matching starting path */ scriptPathStart?: string, /** * mask to filter exact matching path */ scriptHash?: string, /** * filter on created before (inclusive) timestamp */ createdBefore?: string, /** * filter on created after (exclusive) timestamp */ createdAfter?: string, /** * filter on successful jobs */ success?: boolean, /** * filter on job kind (values 'preview', 'script', 'dependencies', 'flow') separated by, */ jobKinds?: string, }): CancelablePromise<Array<QueuedJob>> { return __request(OpenAPI, { method: 'GET', url: '/w/{workspace}/jobs/queue/list', path: { 'workspace': workspace, }, query: { 'order_desc': orderDesc, 'created_by': createdBy, 'parent_job': parentJob, 'script_path_exact': scriptPathExact, 'script_path_start': scriptPathStart, 'script_hash': scriptHash, 'created_before': createdBefore, 'created_after': createdAfter, 'success': success, 'job_kinds': jobKinds, }, }); }
/** * list all available completed jobs * @returns CompletedJob All available completed jobs * @throws ApiError */ public static listCompletedJobs({ workspace, orderDesc, createdBy, parentJob, scriptPathExact, scriptPathStart, scriptHash, createdBefore, createdAfter, success, jobKinds, isSkipped, isFlowStep, }: { workspace: string, /** * order by desc order (default true) */ orderDesc?: boolean, /** * mask to filter exact matching user creator */ createdBy?: string, /** * The parent job that is at the origin and responsible for the execution of this script if any */ parentJob?: string, /** * mask to filter exact matching path */ scriptPathExact?: string, /** * mask to filter matching starting path */ scriptPathStart?: string, /** * mask to filter exact matching path */ scriptHash?: string, /** * filter on created before (inclusive) timestamp */ createdBefore?: string, /** * filter on created after (exclusive) timestamp */ createdAfter?: string, /** * filter on successful jobs */ success?: boolean, /** * filter on job kind (values 'preview', 'script', 'dependencies', 'flow') separated by, */ jobKinds?: string, /** * is the job skipped */ isSkipped?: boolean, /** * is the job a flow step */ isFlowStep?: boolean, }): CancelablePromise<Array<CompletedJob>> { return __request(OpenAPI, { method: 'GET', url: '/w/{workspace}/jobs/completed/list', path: { 'workspace': workspace, }, query: { 'order_desc': orderDesc, 'created_by': createdBy, 'parent_job': parentJob, 'script_path_exact': scriptPathExact, 'script_path_start': scriptPathStart, 'script_hash': scriptHash, 'created_before': createdBefore, 'created_after': createdAfter, 'success': success, 'job_kinds': jobKinds, 'is_skipped': isSkipped, 'is_flow_step': isFlowStep, }, }); }
/** * list all available jobs * @returns Job All jobs * @throws ApiError */ public static listJobs({ workspace, createdBy, parentJob, scriptPathExact, scriptPathStart, scriptHash, createdBefore, createdAfter, jobKinds, isSkipped, isFlowStep, success, }: { workspace: string, /** * mask to filter exact matching user creator */ createdBy?: string, /** * The parent job that is at the origin and responsible for the execution of this script if any */ parentJob?: string, /** * mask to filter exact matching path */ scriptPathExact?: string, /** * mask to filter matching starting path */ scriptPathStart?: string, /** * mask to filter exact matching path */ scriptHash?: string, /** * filter on created before (inclusive) timestamp */ createdBefore?: string, /** * filter on created after (exclusive) timestamp */ createdAfter?: string, /** * filter on job kind (values 'preview', 'script', 'dependencies', 'flow') separated by, */ jobKinds?: string, /** * is the job skipped */ isSkipped?: boolean, /** * is the job a flow step */ isFlowStep?: boolean, /** * filter on successful jobs */ success?: boolean, }): CancelablePromise<Array<Job>> { return __request(OpenAPI, { method: 'GET', url: '/w/{workspace}/jobs/list', path: { 'workspace': workspace, }, query: { 'created_by': createdBy, 'parent_job': parentJob, 'script_path_exact': scriptPathExact, 'script_path_start': scriptPathStart, 'script_hash': scriptHash, 'created_before': createdBefore, 'created_after': createdAfter, 'job_kinds': jobKinds, 'is_skipped': isSkipped, 'is_flow_step': isFlowStep, 'success': success, }, }); }
/** * get job * @returns Job job details * @throws ApiError */ public static getJob({ workspace, id, }: { workspace: string, id: string, }): CancelablePromise<Job> { return __request(OpenAPI, { method: 'GET', url: '/w/{workspace}/jobs/get/{id}', path: { 'workspace': workspace, 'id': id, }, }); }
/** * get job updates * @returns any job details * @throws ApiError */ public static getJobUpdates({ workspace, id, running, logOffset, }: { workspace: string, id: string, running?: boolean, logOffset?: number, }): CancelablePromise<{ running?: boolean; completed?: boolean; new_logs?: string; }> { return __request(OpenAPI, { method: 'GET', url: '/w/{workspace}/jobs/getupdate/{id}', path: { 'workspace': workspace, 'id': id, }, query: { 'running': running, 'log_offset': logOffset, }, }); }
/** * get completed job * @returns CompletedJob job details * @throws ApiError */ public static getCompletedJob({ workspace, id, }: { workspace: string, id: string, }): CancelablePromise<CompletedJob> { return __request(OpenAPI, { method: 'GET', url: '/w/{workspace}/jobs/completed/get/{id}', path: { 'workspace': workspace, 'id': id, }, }); }
/** * delete completed job (erase content but keep run id) * @returns CompletedJob job details * @throws ApiError */ public static deleteCompletedJob({ workspace, id, }: { workspace: string, id: string, }): CancelablePromise<CompletedJob> { return __request(OpenAPI, { method: 'POST', url: '/w/{workspace}/jobs/completed/delete/{id}', path: { 'workspace': workspace, 'id': id, }, }); }
/** * cancel queued job * @returns string job canceled * @throws ApiError */ public static cancelQueuedJob({ workspace, id, requestBody, }: { workspace: string, id: string, /** * reason */ requestBody: { reason?: string; }, }): CancelablePromise<string> { return __request(OpenAPI, { method: 'POST', url: '/w/{workspace}/jobs/queue/cancel/{id}', path: { 'workspace': workspace, 'id': id, }, body: requestBody, mediaType: 'application/json', }); }
/** * create an HMac signature given a job id and a resume id * @returns string job signature * @throws ApiError */ public static createJobSignature({ workspace, id, resumeId, approver, }: { workspace: string, id: string, resumeId: number, approver?: string, }): CancelablePromise<string> { return __request(OpenAPI, { method: 'GET', url: '/w/{workspace}/jobs/job_signature/{id}/{resume_id}', path: { 'workspace': workspace, 'id': id, 'resume_id': resumeId, }, query: { 'approver': approver, }, }); }
/** * resume a job for a suspended flow * @returns string job resumed * @throws ApiError */ public static resumeSuspendedJobGet({ workspace, id, resumeId, signature, approver, }: { workspace: string, id: string, resumeId: number, signature: string, approver?: string, }): CancelablePromise<string> { return __request(OpenAPI, { method: 'GET', url: '/w/{workspace}/jobs/resume/{id}/{resume_id}/{signature}', path: { 'workspace': workspace, 'id': id, 'resume_id': resumeId, 'signature': signature, }, query: { 'approver': approver, }, }); }
/** * resume a job for a suspended flow * @returns string job resumed * @throws ApiError */ public static resumeSuspendedJobPost({ workspace, id, resumeId, signature, requestBody, approver, }: { workspace: string, id: string, resumeId: number, signature: string, requestBody: any, approver?: string, }): CancelablePromise<string> { return __request(OpenAPI, { method: 'POST', url: '/w/{workspace}/jobs/resume/{id}/{resume_id}/{signature}', path: { 'workspace': workspace, 'id': id, 'resume_id': resumeId, 'signature': signature, }, query: { 'approver': approver, }, body: requestBody, mediaType: 'application/json', }); }
/** * cancel a job for a suspended flow * @returns string job resumed * @throws ApiError */ public static cancelSuspendedJobGet({ workspace, id, resumeId, signature, approver, }: { workspace: string, id: string, resumeId: number, signature: string, approver?: string, }): CancelablePromise<string> { return __request(OpenAPI, { method: 'GET', url: '/w/{workspace}/jobs/cancel/{id}/{resume_id}/{signature}', path: { 'workspace': workspace, 'id': id, 'resume_id': resumeId, 'signature': signature, }, query: { 'approver': approver, }, }); }
/** * cancel a job for a suspended flow * @returns string job resumed * @throws ApiError */ public static cancelSuspendedJobPost({ workspace, id, resumeId, signature, requestBody, approver, }: { workspace: string, id: string, resumeId: number, signature: string, requestBody: any, approver?: string, }): CancelablePromise<string> { return __request(OpenAPI, { method: 'POST', url: '/w/{workspace}/jobs/cancel/{id}/{resume_id}/{signature}', path: { 'workspace': workspace, 'id': id, 'resume_id': resumeId, 'signature': signature, }, query: { 'approver': approver, }, body: requestBody, mediaType: 'application/json', }); }
/** * get parent flow job of suspended job * @returns any parent flow details * @throws ApiError */ public static getSuspendedJobFlow({ workspace, id, resumeId, signature, approver, }: { workspace: string, id: string, resumeId: number, signature: string, approver?: string, }): CancelablePromise<{ job: Job; approvers: Array<{ resume_id: number; approver: string; }>; }> { return __request(OpenAPI, { method: 'GET', url: '/w/{workspace}/jobs/get_flow/{id}/{resume_id}/{signature}', path: { 'workspace': workspace, 'id': id, 'resume_id': resumeId, 'signature': signature, }, query: { 'approver': approver, }, }); }
}