export type CreateApiSnapshotsSsIdMincoreArgs = {ssId: string, body: {position?: number | undefined, fromDiff?: string | undefined}}; export type CreateApiSnapshotsSsIdMincoreOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add mincore layer * * POST /snapshots/{ssId}/mincore */ export const createApiSnapshotsSsIdMincore = async (args: CreateApiSnapshotsSsIdMincoreArgs, options?: CreateApiSnapshotsSsIdMincoreOptions) => { const {baseUrl = "http://localhost:8080", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/snapshots/${encodeURIComponent(String(args.ssId))}/mincore${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 undefined };