export type FireMultipleActionForm = {comments?: string | undefined, assign?: string | undefined, publishDate?: string | undefined, publishTime?: string | undefined, expireDate?: string | undefined, expireTime?: string | undefined, neverExpire?: string | undefined, whereToSend?: string | undefined, filterKey?: string | undefined, timezoneId?: string | undefined, iwantTo?: string | undefined, contentlet?: Array<{[key: string]: Record}> | undefined}; export type CreateApiApiV1WorkflowActionsDefaultFireSystemActionArgs = {systemAction: 'NEW' | 'EDIT' | 'PUBLISH' | 'UNPUBLISH' | 'ARCHIVE' | 'UNARCHIVE' | 'DELETE' | 'DESTROY' | 'LOCK' | 'UNLOCK', body: FireMultipleActionForm}; export type CreateApiApiV1WorkflowActionsDefaultFireSystemActionOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Fire system action by name over multiple contentlets * * POST /api/v1/workflow/actions/default/fire/{systemAction} */ export const createApiApiV1WorkflowActionsDefaultFireSystemAction = async (args: CreateApiApiV1WorkflowActionsDefaultFireSystemActionArgs, options: CreateApiApiV1WorkflowActionsDefaultFireSystemActionOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/octet-stream") const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/workflow/actions/default/fire/${encodeURIComponent(String(args.systemAction))}${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 res.blob() };