UNPKG

@basetime/a2w-api-ts

Version:

Client library that communicates with the addtowallet API.

54 lines (53 loc) 1.74 kB
import { WorkflowJob, WorkflowJobStatus } from '../../types/WorkflowJob'; import { WorkflowMessage } from '../../types/WorkflowMessage'; import Endpoint from '../Endpoint'; /** * Communicate with the `/workflows/jobs*` sub-endpoints (and the workflow-scoped * `/workflows/:workflowId/jobs` listing). * * Accessed via `client.workflows.jobs`. In v1.x these methods lived on * `client.workflows.*` (`getJobs`, `getJob`, `updateJob`, `addJobLog`, `getJobStatus`); * they were moved to a dedicated sub-endpoint in v2 for consistency with the rest of * the SDK. */ export default class WorkflowJobsEndpoint extends Endpoint { /** * Constructor. * * @param parent The parent `WorkflowsEndpoint` whose `req`, `do`, and `qb` are * reused. */ constructor(parent: Endpoint); /** * Returns the jobs for a workflow. * * @param workflowId The ID of the workflow. */ getAll: (workflowId: string) => Promise<WorkflowJob[]>; /** * Returns the details for a job. * * @param jobId The ID of the job. */ getById: (jobId: string) => Promise<WorkflowJob>; /** * Updates a job. * * @param jobId The ID of the job. * @param body The job body. */ update: (jobId: string, body: Partial<WorkflowJob>) => Promise<WorkflowJob>; /** * Logs a message to a workflow job. * * @param jobId The ID of the job. * @param message The message to log. */ addLog: (jobId: string, message: WorkflowMessage) => Promise<WorkflowJob>; /** * Returns the current status of a workflow job. * * @param jobId The ID of the workflow job. */ getStatus: (jobId: string) => Promise<WorkflowJobStatus>; }