UNPKG

mindee

Version:

Mindee Client Library for Node.js

25 lines (24 loc) 1.16 kB
import { GeneratedV1Document } from "../../../v1/product/generated/generatedV1Document.js"; import { parseDate } from "../../../parsing/dateParser.js"; /** * Representation of an execution for a workflow. * @category Workflow */ export class Execution { constructor(inferenceClass, jsonResponse) { this.batchName = jsonResponse["batch_name"]; this.createdAt = parseDate(jsonResponse["created_at"]); this.file = jsonResponse["file"]; this.id = jsonResponse["id"]; this.inference = jsonResponse["inference"] ? new inferenceClass(jsonResponse["inference"]) : null; this.priority = jsonResponse["priority"]; this.reviewedAt = parseDate(jsonResponse["reviewed_at"]); this.availableAt = parseDate(jsonResponse["available_at"]); this.reviewedPrediction = jsonResponse["reviewed_prediction"] ? new GeneratedV1Document(jsonResponse["reviewed_prediction"]) : null; this.status = jsonResponse["status"]; this.type = jsonResponse["type"]; this.uploadedAt = parseDate(jsonResponse["uploaded_at"]); this.workflowId = jsonResponse["workflow_id"]; } }