export type GizmoPrim = {type: 'gizmo'}; export type CustomPrim = {type: 'custom', custom_prim_path: string}; export type SpherePrim = {type: 'sphere', radius?: number | undefined, color?: Array | undefined}; export type TrajectoryMarker = {prim: GizmoPrim | CustomPrim | SpherePrim, poses?: Array> | undefined}; export type CreateApiTrajectoriesNameMarkersArgs = {name: string, body: TrajectoryMarker}; export type CreateApiTrajectoriesNameMarkersOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Create Markers * * POST /trajectories/{name}/markers */ export const createApiTrajectoriesNameMarkers = async (args: CreateApiTrajectoriesNameMarkersArgs, options: CreateApiTrajectoriesNameMarkersOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/trajectories/${encodeURIComponent(String(args.name))}/markers${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };