@wandelbots/nova-js
Version:
Official JS client for the Wandelbots API
62 lines • 3.26 kB
TypeScript
import type { Configuration as BaseConfiguration } from "@wandelbots/nova-api/v2";
import { ApplicationApi, CellApi, ControllerApi, ControllerInputsOutputsApi, CoordinateSystemsApi, JoggingApi, MotionGroupApi, MotionGroupInfoApi, MotionGroupKinematicsApi, ProgramApi, ProgramOperatorApi, StoreCollisionComponentsApi, StoreCollisionScenesApi, StoreObjectApi, SystemApi, TrajectoryExecutionApi, TrajectoryPlanningApi, VirtualRobotApi, VirtualRobotBehaviorApi, VirtualRobotModeApi, VirtualRobotSetupApi } from "@wandelbots/nova-api/v2";
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 motionGroup: WithCellId<MotionGroupApi>;
readonly motionGroupInfos: WithCellId<MotionGroupInfoApi>;
readonly controller: WithCellId<ControllerApi>;
readonly program: WithCellId<ProgramApi>;
readonly programOperator: WithCellId<ProgramOperatorApi>;
readonly controllerIOs: WithCellId<ControllerInputsOutputsApi>;
readonly motionGroupKinematic: WithCellId<MotionGroupKinematicsApi>;
readonly trajectoryPlanning: WithCellId<TrajectoryPlanningApi>;
readonly trajectoryExecution: WithCellId<TrajectoryExecutionApi>;
readonly coordinateSystems: WithCellId<CoordinateSystemsApi>;
readonly application: WithCellId<ApplicationApi>;
readonly applicationGlobal: WithUnwrappedAxiosResponse<ApplicationApi>;
readonly jogging: WithCellId<JoggingApi>;
readonly virtualRobot: WithCellId<VirtualRobotApi>;
readonly virtualRobotSetup: WithCellId<VirtualRobotSetupApi>;
readonly virtualRobotMode: WithCellId<VirtualRobotModeApi>;
readonly virtualRobotBehavior: WithCellId<VirtualRobotBehaviorApi>;
readonly storeObject: WithCellId<StoreObjectApi>;
readonly storeCollisionComponents: WithCellId<StoreCollisionComponentsApi>;
readonly storeCollisionScenes: WithCellId<StoreCollisionScenesApi>;
}
export {};
//# sourceMappingURL=NovaCellAPIClient.d.ts.map