JobMethods
Methods available on job response objects. These are bound to the job data and delegate to the service.
Methods¶
getAttachments()¶
getAttachments():
Promise<JobAttachmentGetResponse[]>
Gets all attachments linked to this job.
Returns¶
Promise<JobAttachmentGetResponse[]>
Promise resolving to an array of JobAttachmentGetResponse links, empty when the job has none
Example¶
const job = await jobs.getById(<jobKey>, <folderId>);
const attachments = await job.getAttachments();
getOutput()¶
getOutput():
Promise<null|Record<string,unknown>>
Gets the output of this job.
Retrieves the job's output arguments, handling both inline output (stored directly on the job
as a JSON string in outputArguments) and file-based output (stored as a blob attachment for
large outputs). Returns the parsed JSON output or null if the job has no output.
Returns¶
Promise<null | Record<string, unknown>>
Promise resolving to the parsed output as Record<string, unknown>, or null if no output exists
Example¶
const allJobs = await jobs.getAll();
const completedJob = allJobs.items.find(j => j.state === JobState.Successful);
if (completedJob) {
const output = await completedJob.getOutput();
}
linkAttachment()¶
linkAttachment(
attachmentId:string,options?:JobLinkAttachmentOptions):Promise<JobAttachmentGetResponse>
Links an existing attachment to this job.
Parameters¶
| Parameter | Type | Description |
|---|---|---|
attachmentId |
string |
The unique ID (GUID) of the attachment to link |
options? |
JobLinkAttachmentOptions |
Optional settings for the link, such as its category |
Returns¶
Promise<JobAttachmentGetResponse>
Promise resolving to the created JobAttachmentGetResponse link
Example¶
const job = await jobs.getById(<jobKey>, <folderId>);
const link = await job.linkAttachment(<attachmentId>, { category: 'Invoice' });
restart()¶
restart():
Promise<JobGetResponse>
Restarts this job, creating a new execution with a new key.
Returns¶
Promise<JobGetResponse>
Promise resolving to the new JobGetResponse with full job details
resume()¶
resume(
options?:JobResumeOptions):Promise<void>
Resumes this suspended job.
Parameters¶
| Parameter | Type | Description |
|---|---|---|
options? |
JobResumeOptions |
Optional parameters including input arguments |
Returns¶
Promise<void>
Promise that resolves when the job is resumed successfully, or rejects on failure
stop()¶
stop(
options?:JobStopOptions):Promise<void>
Stops this job.
Sends a stop request for this job to the Orchestrator.
Parameters¶
| Parameter | Type | Description |
|---|---|---|
options? |
JobStopOptions |
Optional JobStopOptions including stop strategy (defaults to SoftStop) |
Returns¶
Promise<void>
Promise that resolves when the jobs are stopped successfully, or rejects on failure