export type ActionError = {code: string, message: string}; export type UpdateActionRequest = {errors?: Array | undefined, status: string}; export type UpdateApiV1OrdersActionsActionIdArgs = {action_id: string, body: UpdateActionRequest}; export type UpdateApiV1OrdersActionsActionIdOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * updateActionStatus - Update asynchronous action status * * PUT /v1/orders/actions/{action_id} */ export const updateApiV1OrdersActionsActionId = async (args: UpdateApiV1OrdersActionsActionIdArgs, options?: UpdateApiV1OrdersActionsActionIdOptions) => { const {baseUrl = "https://miraklconnect.com/api/channel-platform", 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/orders/actions/${encodeURIComponent(String(args.action_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };