export type MoveWorkflowsRequestBody = {dst_folder_id: string, workflow_ids: Array}; export type PatchApiApiV2OrgIdWorkflowsMoveArgs = {org_id: string, body: MoveWorkflowsRequestBody}; export type PatchApiApiV2OrgIdWorkflowsMoveOptions = {baseUrl: string, Authorization?: string | undefined, fetch?: typeof fetch | undefined}; /** * Move workflows to a different folder * * PATCH /api/v2/{org_id}/workflows/move */ export const patchApiApiV2OrgIdWorkflowsMove = async (args: PatchApiApiV2OrgIdWorkflowsMoveArgs, options: PatchApiApiV2OrgIdWorkflowsMoveOptions) => { const {baseUrl, fetch: fetchFn = fetch, Authorization} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Authorization !== undefined) headers.set("Authorization", Authorization) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/${encodeURIComponent(String(args.org_id))}/workflows/move${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };