export type ScenarioOrderUpdateItem = {id: string, order: number}; export type UpdateScenariosOrderDto = {updates: Array}; export type CreateApiV1AdminLiveActionsScenariosBulkUpdateOrderArgs = {body: UpdateScenariosOrderDto}; export type CreateApiV1AdminLiveActionsScenariosBulkUpdateOrderOptions = {baseUrl: string, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /v1/admin/live-actions/scenarios/bulk-update-order */ export const createApiV1AdminLiveActionsScenariosBulkUpdateOrder = async (args: CreateApiV1AdminLiveActionsScenariosBulkUpdateOrderArgs, options: CreateApiV1AdminLiveActionsScenariosBulkUpdateOrderOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/admin/live-actions/scenarios/bulk-update-order${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 };