function replaceFileDump
replaceFileDump(
dumpId: string,
file: File,
comment: string | undefined,
title?: string,
categoryIds?: string[],
isPrivate?: boolean,
slug?: string,
exempt?: boolean
): Promise<Dump>

Replaces a file dump's upload and its comment, for PUT /api/dumps/:dumpId/file. A title, slug, categoryIds or isPrivate left out stays as it is. Visibility is taken here so that a new file and a change of visibility land together. The slug changes as in updateDump, before the file is written. The old file is put back if the database update fails, and clients and followers are told as updateDump tells them.

Parameters

dumpId: string
file: File
comment: string | undefined
optional
title: string
optional
categoryIds: string[]
optional
isPrivate: boolean
optional
slug: string
optional
exempt: boolean = false

Return Type

Promise<Dump>

Throws

APIException

404 when there is no such dump, 400 when it isn't a file dump, the title or comment is too long, the file's type isn't allowed, it exceeds 50 MB, a category doesn't exist or the slug isn't valid, 409 when the slug is taken, 429 when it changed too often lately.

Usage

import { replaceFileDump } from "api/services/dump-service.ts";