Started work on linstrom specific endpoints

Router plus a bunch of placeholder handlers
Also a poll on fedi regarding streamed events (one vs many channels)
This commit is contained in:
Melody Becker 2024-10-29 16:09:21 +01:00
parent 1fb924f59c
commit 4f4d05a335
11 changed files with 103 additions and 39 deletions

36
server/apiLinstrom.go Normal file
View file

@ -0,0 +1,36 @@
package server
import "net/http"
func setupLinstromApiRouter() http.Handler {
router := http.NewServeMux()
router.Handle("/v1/", http.StripPrefix("/v1", setupLinstromApiV1Router()))
return router
}
func setupLinstromApiV1Router() http.Handler {
router := http.NewServeMux()
// Notes
router.HandleFunc("GET /note/{noteId}", linstromGetNote)
router.HandleFunc("POST /note", linstromNewNote)
router.HandleFunc("PUT /note/{noteId}", linstromUpdateNote)
router.HandleFunc("DELETE /note/{noteId}", linstromDeleteNote)
// Reactions
router.HandleFunc("GET /note/{noteId}/reactions", linstromGetReactions)
router.HandleFunc("POST /note/{noteId}/reactions", linstromAddReaction)
router.HandleFunc("PUT /note/{noteId}/reactions", linstromUpdateReaction)
router.HandleFunc("DELETE /note/{noteId}/reactions", linstromDeleteReaction)
// Boosts
router.HandleFunc("GET /note/{noteId}/boosts", linstromGetBoosts)
router.HandleFunc("POST /note/{noteId}/boosts", linstromAddBoost)
router.HandleFunc("DELETE /note/{noteId}/boosts", linstromRemoveBoost)
// Quotes
router.HandleFunc("GET /note/{noteId}/quotes", linstromGetQuotes)
router.HandleFunc("POST /note/{noteId}/quotes", linstromAddQuote)
// Pinning
router.HandleFunc("POST /note/{noteId}/pin", linstromPinNote)
router.HandleFunc("DELETE /note/{noteId}/pin", linstromUnpinNote)
return router
}