export type BulkUpdateApplicationDto = {id: string, stageId: string, position: number}; export type BulkUpdateApplicationsDto = {items: Array}; export type UpdateApiApplicationsBulkArgs = {body: BulkUpdateApplicationsDto}; export type UpdateApiApplicationsBulkOptions = {baseUrl: string, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Bulk update applications * * PUT /applications/_bulk */ export const updateApiApplicationsBulk = async (args: UpdateApiApplicationsBulkArgs, options: UpdateApiApplicationsBulkOptions) => { const {baseUrl, fetch: fetchFn = fetch, xApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (xApiKey !== undefined) headers.set("x-api-key", xApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/applications/_bulk${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 };