export type PositionDto = {previousId: string | null, nextId: string | null}; export type MoveApplicationToStageDto = {stageId: string, statusId?: (string | null) | undefined, position?: PositionDto | undefined}; export type UpdateApiApplicationsIdMoveArgs = {id: string, body: MoveApplicationToStageDto}; export type UpdateApiApplicationsIdMoveOptions = {baseUrl: string, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Move application to stage * * PUT /applications/{id}/move */ export const updateApiApplicationsIdMove = async (args: UpdateApiApplicationsIdMoveArgs, options: UpdateApiApplicationsIdMoveOptions) => { 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/${encodeURIComponent(String(args.id))}/move${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 };