@wandelbots/nova-js
Version:
Official JS client for the Wandelbots API
66 lines • 3.58 kB
TypeScript
import type { Configuration as BaseConfiguration } from "@wandelbots/nova-api/v1";
import { ApplicationApi, CellApi, ControllerApi, ControllerIOsApi, CoordinateSystemsApi, DeviceConfigurationApi, LibraryProgramApi, LibraryProgramMetadataApi, LibraryRecipeApi, LibraryRecipeMetadataApi, MotionApi, MotionGroupApi, MotionGroupInfosApi, MotionGroupJoggingApi, MotionGroupKinematicApi, ProgramApi, ProgramValuesApi, StoreCollisionComponentsApi, StoreCollisionScenesApi, StoreObjectApi, SystemApi, VirtualRobotApi, VirtualRobotBehaviorApi, VirtualRobotModeApi, VirtualRobotSetupApi } from "@wandelbots/nova-api/v1";
import type { AxiosInstance } from "axios";
type OmitFirstArg<F> = F extends (x: any, ...args: infer P) => infer R ? (...args: P) => R : never;
type UnwrapAxiosResponseReturn<T> = T extends (...a: any) => any ? (...a: Parameters<T>) => Promise<Awaited<ReturnType<T>> extends {
data: infer D;
} ? D : never> : never;
export type WithCellId<T> = {
[P in keyof T]: UnwrapAxiosResponseReturn<OmitFirstArg<T[P]>>;
};
export type WithUnwrappedAxiosResponse<T> = {
[P in keyof T]: UnwrapAxiosResponseReturn<T[P]>;
};
/**
* API client providing type-safe access to all the Nova API REST endpoints
* associated with a specific cell id.
*/
export declare class NovaCellAPIClient {
readonly cellId: string;
readonly opts: BaseConfiguration & {
axiosInstance?: AxiosInstance;
mock?: boolean;
};
constructor(cellId: string, opts: BaseConfiguration & {
axiosInstance?: AxiosInstance;
mock?: boolean;
});
/**
* Some TypeScript sorcery which alters the API class methods so you don't
* have to pass the cell id to every single one, and de-encapsulates the
* response data
*/
private withCellId;
/**
* As withCellId, but only does the response unwrapping
*/
private withUnwrappedResponsesOnly;
readonly system: WithUnwrappedAxiosResponse<SystemApi>;
readonly cell: WithUnwrappedAxiosResponse<CellApi>;
readonly deviceConfig: WithCellId<DeviceConfigurationApi>;
readonly motionGroup: WithCellId<MotionGroupApi>;
readonly motionGroupInfos: WithCellId<MotionGroupInfosApi>;
readonly controller: WithCellId<ControllerApi>;
readonly program: WithCellId<ProgramApi>;
readonly programValues: WithCellId<ProgramValuesApi>;
readonly controllerIOs: WithCellId<ControllerIOsApi>;
readonly motionGroupKinematic: WithCellId<MotionGroupKinematicApi>;
readonly motion: WithCellId<MotionApi>;
readonly coordinateSystems: WithCellId<CoordinateSystemsApi>;
readonly application: WithCellId<ApplicationApi>;
readonly applicationGlobal: WithUnwrappedAxiosResponse<ApplicationApi>;
readonly motionGroupJogging: WithCellId<MotionGroupJoggingApi>;
readonly virtualRobot: WithCellId<VirtualRobotApi>;
readonly virtualRobotSetup: WithCellId<VirtualRobotSetupApi>;
readonly virtualRobotMode: WithCellId<VirtualRobotModeApi>;
readonly virtualRobotBehavior: WithCellId<VirtualRobotBehaviorApi>;
readonly libraryProgramMetadata: WithCellId<LibraryProgramMetadataApi>;
readonly libraryProgram: WithCellId<LibraryProgramApi>;
readonly libraryRecipeMetadata: WithCellId<LibraryRecipeMetadataApi>;
readonly libraryRecipe: WithCellId<LibraryRecipeApi>;
readonly storeObject: WithCellId<StoreObjectApi>;
readonly storeCollisionComponents: WithCellId<StoreCollisionComponentsApi>;
readonly storeCollisionScenes: WithCellId<StoreCollisionScenesApi>;
}
export {};
//# sourceMappingURL=NovaCellAPIClient.d.ts.map