Posts, reads, edits and deletes dumps, for the feeds, the dump page, its
edit page and the create form. :dumpId is a dump's id; the dump page reads
a dump by its path, through GET /api/users/:key/dumps/:slug. A private
dump answers 404 to anyone but its poster, moderators included. Its file and
thumbnail are served by routes/files.ts and routes/thumbnails.ts, its
comments by routes/comments.ts.
POST /api/dumps— signed in. Posts a link (JSON body) or a file (multipartfile, withtitle,comment,isPrivateandcategoryIds).GET /api/dumps?page=&limit=— optional sign-in. Answers a page of the dumps the caller may see, newest first.GET /api/dumps?category=&page=&limit=— optional sign-in. The same, in the category with that slug; 404 when there is none.GET /api/dumps?follow=users&category=&page=&limit=— signed in. The index's "follow" tab: a page of the public dumps of the users the caller follows, newest first, optionally in one category.GET /api/dumps?follow=playlists&category=&page=&limit=— signed in. Its/follow/playlistsview: a page of the public dumps in the public playlists the caller follows, most recently added first.GET /api/dumps?url=— optional sign-in. Answers the dumps already pointing at the same thing asurl, for the create form's duplicate hint.GET /api/dumps/:dumpId— optional sign-in. Answers a dump.GET /api/dumps/:dumpId/voters?page=&limit=— optional sign-in. Answers a page of the users who upvoted it.GET /api/dumps/:dumpId/related— optional sign-in. Answers the dumps linked to or from it.GET /api/dumps/:dumpId/playlists— optional sign-in. Answers the playlists it appears in.PUT /api/dumps/:dumpId— signed in, as its poster or withdump:moderate. Updates its title, slug, comment, visibility, categories, and a link's URL. A new slug keeps the old one as an alias, 3 times a day at most but for those withdump:moderate.POST /api/dumps/:dumpId/metadata— signed in, as its poster or withdump:moderate. Fetches a link's preview again.DELETE /api/dumps/:dumpId— signed in, as its poster or withdump:moderate. Deletes it.
v
default: Router
Mounted by api/main.ts behind the error, Open Graph and CORS middleware.
An APIException thrown by a handler becomes the JSON error response there.
Usage
import * as mod from "api/routes/dumps.ts";