linstrom/server/apiLinstrom.go
mStar 4f4d05a335 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)
2024-10-29 16:09:21 +01:00

36 lines
1.3 KiB
Go

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
}