mindee
Version:
Mindee Client Library for Node.js
45 lines (44 loc) • 1.61 kB
TypeScript
import { ApiResponse } from "./apiResponse";
import { StringDict } from "./stringDict";
import { Inference } from "./inference";
import { Document } from "./document";
/** Wrapper for asynchronous request queues. Holds information regarding a job (queue).
*
* @category API Response
* @category Asynchronous
*/
export declare class Job {
/** Timestamp noting the enqueueing of a document. */
issuedAt: Date;
/** Timestamp noting the availability of a prediction for an enqueued document. */
availableAt?: Date;
/** Information about an error that occurred during the job processing. */
error?: StringDict;
/** ID of the job. */
id: string;
/** Status of the job. */
status?: "waiting" | "processing" | "completed" | "failed";
/** The time taken to process the job, in milliseconds. */
milliSecsTaken?: number;
constructor(jsonResponse: StringDict);
}
export declare function datetimeWithTimezone(date: string): Date;
/** Wrapper for asynchronous jobs and parsing results.
*
* @category API Response
* @category Asynchronous
*/
export declare class AsyncPredictResponse<T extends Inference> extends ApiResponse {
/** Job for a queue. */
job: Job;
/** Prediction for an asynchronous request. Will not be available so long as the job is not
* `completed`.
*/
document?: Document<T>;
/**
*
* @param inferenceClass constructor signature for an inference.
* @param serverResponse raw http response.
*/
constructor(inferenceClass: new (httpResponse: StringDict) => T, serverResponse: StringDict);
}