More work on the api. Also auth middleware stuff
More work on the placeholder functions for the Linstrom API Additionally, started work on a slightly more sophisticated authentication control system And ran `go generate` again
This commit is contained in:
parent
b9c95a0297
commit
873f52d64f
14 changed files with 637 additions and 300 deletions
|
@ -12,30 +12,70 @@ func setupLinstromApiRouter() http.Handler {
|
|||
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)
|
||||
router.HandleFunc("GET /notes/{noteId}", linstromGetNote)
|
||||
router.HandleFunc("POST /notes", linstromNewNote)
|
||||
router.HandleFunc("PATCH /notes/{noteId}", linstromUpdateNote)
|
||||
router.HandleFunc("DELETE /notes/{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)
|
||||
router.HandleFunc("GET /notes/{noteId}/reactions", linstromGetReactions)
|
||||
router.HandleFunc("POST /notes/{noteId}/reactions", linstromAddReaction)
|
||||
router.HandleFunc("PATCH /notes/{noteId}/reactions", linstromUpdateReaction)
|
||||
router.HandleFunc("DELETE /notes/{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)
|
||||
router.HandleFunc("GET /notes/{noteId}/boosts", linstromGetBoosts)
|
||||
router.HandleFunc("POST /notes/{noteId}/boosts", linstromAddBoost)
|
||||
router.HandleFunc("DELETE /notes/{noteId}/boosts", linstromRemoveBoost)
|
||||
// Quotes
|
||||
router.HandleFunc("GET /note/{noteId}/quotes", linstromGetQuotes)
|
||||
router.HandleFunc("POST /note/{noteId}/quotes", linstromAddQuote)
|
||||
router.HandleFunc("GET /notes/{noteId}/quotes", linstromGetQuotes)
|
||||
router.HandleFunc("POST /notes/{noteId}/quotes", linstromAddQuote)
|
||||
// Pinning
|
||||
router.HandleFunc("POST /note/{noteId}/pin", linstromPinNote)
|
||||
router.HandleFunc("DELETE /note/{noteId}/pin", linstromUnpinNote)
|
||||
router.HandleFunc("POST /notes/{noteId}/pin", linstromPinNote)
|
||||
router.HandleFunc("DELETE /notes/{noteId}/pin", linstromUnpinNote)
|
||||
// Reports
|
||||
router.HandleFunc("POST /note/{noteId}/report", linstromReportNote)
|
||||
router.HandleFunc("DELETE /note/{noteId}/report", linstromRetractReportNote)
|
||||
router.HandleFunc("POST /notes/{noteId}/report", linstromReportNote)
|
||||
router.HandleFunc("DELETE /notes/{noteId}/report", linstromRetractReportNote)
|
||||
// Admin
|
||||
router.HandleFunc("POST /note/{noteId}/admin/cw", linstromForceCWNote)
|
||||
router.HandleFunc("POST /notes/{noteId}/admin/cw", linstromForceCWNote)
|
||||
|
||||
// Accounts
|
||||
// Creating a new account happens either during fetch of a remote one or during registration with a passkey
|
||||
router.HandleFunc("GET /accounts/{accountId}", linstromGetAccount)
|
||||
router.HandleFunc("PATCH /accounts/{accountId}", linstromUpdateAccount)
|
||||
router.HandleFunc("DELETE /accounts/{accountId}", linstromDeleteAccount)
|
||||
// Follow
|
||||
router.HandleFunc("GET /accounts/{accountId}/follow", linstromIsFollowingAccount)
|
||||
router.HandleFunc("POST /accounts/{accountId}/follow", linstromFollowAccount)
|
||||
router.HandleFunc("DELETE /accounts/{accountId}/follow", linstromUnfollowAccount)
|
||||
// Block
|
||||
router.HandleFunc("GET /accounts/{accountId}/block", linstromIsBlockingAccount)
|
||||
router.HandleFunc("POST /accounts/{accountId}/block", linstromBlockAccount)
|
||||
router.HandleFunc("DELETE /accounts/{accountId}/block", linstromUnblockAccount)
|
||||
// Mute
|
||||
router.HandleFunc("GET /accounts/{accountId}/mute", linstromIsMutedAccount)
|
||||
router.HandleFunc("POST /accounts/{accountId}/mute", linstromMuteAccount)
|
||||
router.HandleFunc("DELETE /accounts/{accountId}/mute", linstromUnmuteAccount)
|
||||
// Report
|
||||
router.HandleFunc("POST /accounts/{accountId}/reports", linstromReportAccount)
|
||||
router.HandleFunc("DELETE /accounts/{accountId}/reports", linstromRetractReportAccount)
|
||||
// Admin
|
||||
router.HandleFunc("POST /accounts/{accountId}/admin/roles", linstromAdminAddRoleAccount)
|
||||
router.HandleFunc(
|
||||
"DELETE /accounts/{accountId}/admin/roles/{roleName}",
|
||||
linstromAdminRemoveRoleAccount,
|
||||
)
|
||||
router.HandleFunc("POST /accounts/{accountId}/admin/warn", linstromAdminWarnAccount)
|
||||
|
||||
// Roles
|
||||
router.HandleFunc("GET /roles/{roleId}", linstromGetRole)
|
||||
router.HandleFunc("POST /roles", linstromCreateRole)
|
||||
router.HandleFunc("PATCH /roles/{roleId}", linstromUpdateRole)
|
||||
router.HandleFunc("DELETE /roles/{roleId}", linstromDeleteRole)
|
||||
|
||||
// Media metadata
|
||||
router.HandleFunc("GET /media/{mediaId}", linstromGetMediaMetadata)
|
||||
router.HandleFunc("POST /media", linstromNewMediaMetadata)
|
||||
router.HandleFunc("PATCH /media/{mediaId}", linstromUpdateMediaMetadata)
|
||||
router.HandleFunc("DELETE /media/{mediaId}", linstromDeleteMediaMetadata)
|
||||
|
||||
// Event streams
|
||||
router.HandleFunc("/streams", linstromEventStream)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue