UNPKG

@inweb/client

Version:

JavaScript REST API client for the Open Cloud Server

141 lines (140 loc) 4.68 kB
import { IHttpClient } from "./IHttpClient"; import { Endpoint } from "./Endpoint"; /** * Provides properties and methods for obtaining information about a job on the Open Cloud Server. */ export declare class Job extends Endpoint { private _data; /** * @param data - Raw job data received from the server. For more information, see * {@link https://cloud.opendesign.com/docs//pages/server/api.html#Jobs | Open Cloud Jobs API}. * @param httpClient - HTTP client instance used to send requests to the REST API server. */ constructor(data: any, httpClient: IHttpClient); /** * The ID of the assembly the job is working on (internal). * * @readonly */ get assemblyId(): string; /** * Job creator ID. Use {@link Client.getUser | Client.getUser()} to obtain detailed creator information. * * @readonly */ get authorId(): string; /** * Job creation time (UTC) in the format specified in * {@link https://www.wikipedia.org/wiki/ISO_8601 | ISO 8601}. * * @readonly */ get createdAt(): string; /** * Raw job data received from the server. For more information, see * {@link https://cloud.opendesign.com/docs//pages/server/api.html#Jobs | Open Cloud Jobs API}. * * @readonly */ get data(): any; private set data(value); /** * `true` if job is `done` or `failed`. See {@link status} for more details. * * @readonly */ get done(): boolean; /** * The ID of the file the job is working on. * * @readonly */ get fileId(): string; /** * Unique job ID. * * @readonly */ get id(): string; /** * Job last update (UTC) time in the format specified in * {@link https://www.wikipedia.org/wiki/ISO_8601 | ISO 8601}. * * @readonly */ get lastUpdate(): string; /** * Job type. Can be `properties`, `geomerty`, `geomertyGltf`, `validation`, `clash`, `dwg`, `obj`, * `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` or custom job name. * * @readonly */ get outputFormat(): string; /** * Parameters with which the job runner was started. For more information, see * {@link https://cloud.opendesign.com/docs//pages/server/api.html#Jobs | Open Cloud Jobs API}. * * @readonly */ get parameters(): any; /** * Job status. Can be `waiting`, `inprogress`, `done` or `failed`. * * @readonly */ get status(): string; /** * Job status description message. * * @readonly */ get statusMessage(): string; /** * Job starting time (UTC) in the format specified in * {@link https://www.wikipedia.org/wiki/ISO_8601 | ISO 8601}. * * @readonly */ get startedAt(): string; /** * Reloads job data from the server. */ checkout(): Promise<this>; /** * Updates job data on the server. * * Only administrators can update job data. If the current logged in user is not an administrator, an * exception will be thrown. * * @param data - Raw job data. For more information, see * {@link https://cloud.opendesign.com/docs//pages/server/api.html#Jobs | Open Cloud Jobs API}. */ update(data: any): Promise<this>; /** * Deletes a job from the server job list. Jobs that are in progress or have already been completed * cannot be deleted. * * @returns Returns the raw data of a deleted job. For more information, see * {@link https://cloud.opendesign.com/docs//pages/server/api.html#Jobs | Open Cloud Jobs API}. */ delete(): Promise<any>; /** * Waits for job to be done. Job is done when it changes to `done` or `failed` status. * * @param params - An object containing waiting parameters. * @param params.timeout - The time, in milliseconds that the function should wait job. If jobs is not * done during this time, the `TimeoutError` exception will be thrown. * @param params.interval - The time, in milliseconds, the function should delay in between checking * job status. * @param params.signal - An * {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController} signal, which * can be used to abort waiting as desired. * @param params.onCheckout - Waiting progress callback. Return `true` to cancel waiting. */ waitForDone(params?: { timeout?: number; interval?: number; signal?: AbortSignal; onCheckout?: (job: Job, ready: boolean) => boolean; }): Promise<this>; }