export type MotionStreamConfiguration = {host: string, secure_connection?: boolean | undefined, cell: string, motion_group: string, controller?: string | undefined, response_rate?: number | undefined, use_external_joint_stream?: boolean | undefined}; export type MotionGroupConfiguration = {name: string | null, prim_path: string, enabled?: boolean | undefined, motion_stream_configuration: MotionStreamConfiguration}; export type CreateApiManipulatorsMotionGroupsArgs = {body: MotionGroupConfiguration}; export type CreateApiManipulatorsMotionGroupsOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Create Motion Group * * POST /manipulators/motion-groups */ export const createApiManipulatorsMotionGroups = async (args: CreateApiManipulatorsMotionGroupsArgs, options: CreateApiManipulatorsMotionGroupsOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/manipulators/motion-groups${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 };