@inweb/client
Version:
JavaScript REST API client for the Open Cloud Server
154 lines (153 loc) • 5.25 kB
TypeScript
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 owner ID (the user who created the job). Use {@link Client.getUser | Client.getUser()} to obtain
* detailed user 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 one of:
*
* - `geometry` - Convert file geometry data to `VSFX` format.
* - `geometryGltf` - Convert file geometry data to `glTF` format.
* - `properties` - Extract file properties.
* - `validation` - Validate the IFC file.
* - `clash` - Create the clash detection report.
* - `dwg`, `obj`, `gltf`, `glb`, `vsf`, `pdf`, `3dpdf` - Export file to the specified format.
* - Other custom job name.
*
* @readonly
*/
get outputFormat(): string;
/**
* Parameters with which the job 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.
*
* You cannot delete other users' jobs unless you are an administrator.
*
* You can only delete jobs that are in the `waiting` status (jobs that have been created but not yet
* started). Jobs that are currently running (`inprogress`) or have already completed (`done` or
* `failed`) 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 for the job. If the
* job 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>;
}