export type MoveSyntheticsRequestBody = {dst_folder_id: string, synthetic_ids: Array}; export type PatchApiApiV2OrgIdSyntheticsMoveArgs = {org_id: string, folder?: string | undefined, body: MoveSyntheticsRequestBody}; export type PatchApiApiV2OrgIdSyntheticsMoveOptions = {baseUrl: string, Authorization?: string | undefined, fetch?: typeof fetch | undefined}; /** * Move synthetics to a different folder * * PATCH /api/v2/{org_id}/synthetics/move */ export const patchApiApiV2OrgIdSyntheticsMove = async (args: PatchApiApiV2OrgIdSyntheticsMoveArgs, options: PatchApiApiV2OrgIdSyntheticsMoveOptions) => { const {baseUrl, fetch: fetchFn = fetch, Authorization} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.folder != null) query.append("folder", String(args.folder)) if (Authorization !== undefined) headers.set("Authorization", Authorization) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/${encodeURIComponent(String(args.org_id))}/synthetics/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 };