UNPKG

@inweb/client

Version:

JavaScript REST API client for the Open Cloud Server

162 lines (161 loc) 5.95 kB
import { IHttpClient } from "./IHttpClient"; import { Endpoint } from "./Endpoint"; import { IClashItem } from "./IAssembly"; import { IShortUserDesc } from "./IUser"; /** * Provides properties and methods for obtaining information about a file/assembly clash detection test. */ export declare class ClashTest extends Endpoint { private _data; /** * @param data - Raw test data received from the server. For more information, see * {@link https://cloud.opendesign.com/docs//pages/server/api.html#Assemblies | Open Cloud Assemblies API}. * @param path - The clash test API path of the file/assembly that owns the test. * @param httpClient - HTTP client instance used to send requests to the REST API server. */ constructor(data: any, path: string, httpClient: IHttpClient); /** * The type of the clashes that the test detects: * * - `true` - Clearance clash. A clash in which the object A may or may not intersect with object B, but * comes within a distance of less than the {@link tolerance}. * - `false` - Hard clash. A clash in which the object A intersects with object B by a distance of more * than the {@link tolerance}. * * @readonly */ get clearance(): boolean; /** * Test creation time (UTC) in the format specified in * {@link https://www.wikipedia.org/wiki/ISO_8601 | ISO 8601}. * * @readonly */ get createdAt(): string; /** * Raw test data received from the server. For more information, see * {@link https://cloud.opendesign.com/docs//pages/server/api.html#Assemblies | Open Cloud Assemblies API}. * * @readonly */ get data(): any; private set data(value); /** * Unique test ID. * * @readonly */ get id(): string; /** * Test last update (UTC) time in the format specified in * {@link https://www.wikipedia.org/wiki/ISO_8601 | ISO 8601}. * * @readonly */ get lastModifiedAt(): string; /** * Test name. */ get name(): string; set name(value: string); /** * Test owner (the user who created the test). * * @readonly */ get owner(): IShortUserDesc; /** * First selection set for clash detection. Objects from `selectionSetA` will be tested against each * others by objects from the `selectionSetB` during the test. * * @readonly */ get selectionSetA(): string[]; /** * The type of first selection set for clash detection. Can be one of: * * - `all` - All file/assembly objects. * - `handle` - Objects with original handles specified in the `selectionSetA`. * - `models` - All objects of the models with original handles specified in the `selectionSetA`. * - `searchquery` - Objects retrieved by the search queries specified in `selectionSetA`. * * @readonly */ get selectionTypeA(): string; /** * Second selection set for clash detection. Objects from `selectionSetB` will be tested against each * others by objects from the `selectionSetA` during the test. * * @readonly */ get selectionSetB(): string[]; /** * The type of second selection set for clash detection. Can be one of: * * - `all` - All file/assembly objects. * - `handle` - Objects with original handles specified in the `selectionSetB`. * - `models` - All objects of the models with original handles specified in the `selectionSetB`. * - `searchquery` - Objects retrieved by the search queries specified in `selectionSetB`. * * @readonly */ get selectionTypeB(): string; /** * Test status. Can be `none`, `waiting`, `inprogress`, `done`, or `failed`. * * @readonly */ get status(): string; /** * The distance of separation between objects at which test begins detecting clashes. * * @readonly */ get tolerance(): number; /** * Reloads test data from the server. */ checkout(): Promise<this>; /** * Updates test data on the server. * * @param data - Raw test data. For more information, see * {@link https://cloud.opendesign.com/docs//pages/server/api.html#Assemblies | Open Cloud Assemblies API}. */ update(data: any): Promise<this>; /** * Deletes a test and its results report from the server. * * @returns Returns the raw data of a deleted test. For more information, see * {@link https://cloud.opendesign.com/docs//pages/server/api.html#Assemblies | Open Cloud Assemblies API}. */ delete(): Promise<any>; /** * Saves test properties changes to the server. Call this method to update test data on the server * after any property changes. */ save(): Promise<this>; /** * Waits for test to complete. Test 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 test. If test is not * complete during this time, the `TimeoutError` exception will be thrown. * @param params.interval - The time, in milliseconds, the function should delay in between checking * test 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?: (test: ClashTest, ready: boolean) => boolean; }): Promise<this>; /** * Returns a list of detected clashes for this test. */ getReport(): Promise<IClashItem[]>; }