summaryrefslogtreecommitdiff
path: root/internal/api/client/lists/list.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-05-25 10:37:38 +0200
committerLibravatar GitHub <noreply@github.com>2023-05-25 10:37:38 +0200
commitf5c004d67d4ed66b6c6df100afec47174aa14ae0 (patch)
tree45b72a6e90450d711e10571d844138186fe023c9 /internal/api/client/lists/list.go
parent[docs] local docs hacking howto (#1816) (diff)
downloadgotosocial-f5c004d67d4ed66b6c6df100afec47174aa14ae0.tar.xz
[feature] Add List functionality (#1802)
* start working on lists * further list work * test list db functions nicely * more work on lists * peepoopeepoo * poke * start list timeline func * we're getting there lads * couldn't be me working on stuff... could it? * hook up handlers * fiddling * weeee * woah * screaming, pissing * fix streaming being a whiny baby * lint, small test fix, swagger * tidying up, testing * fucked! by the linter * move timelines to state like a boss * add timeline start to tests using state * invalidate lists
Diffstat (limited to 'internal/api/client/lists/list.go')
-rw-r--r--internal/api/client/lists/list.go19
1 files changed, 18 insertions, 1 deletions
diff --git a/internal/api/client/lists/list.go b/internal/api/client/lists/list.go
index b1c193397..515075271 100644
--- a/internal/api/client/lists/list.go
+++ b/internal/api/client/lists/list.go
@@ -25,8 +25,15 @@ import (
)
const (
+ IDKey = "id"
// BasePath is the base path for serving the lists API, minus the 'api' prefix
- BasePath = "/v1/lists"
+ BasePath = "/v1/lists"
+ BasePathWithID = BasePath + "/:" + IDKey
+ AccountsPath = BasePathWithID + "/accounts"
+ MaxIDKey = "max_id"
+ LimitKey = "limit"
+ SinceIDKey = "since_id"
+ MinIDKey = "min_id"
)
type Module struct {
@@ -40,5 +47,15 @@ func New(processor *processing.Processor) *Module {
}
func (m *Module) Route(attachHandler func(method string, path string, f ...gin.HandlerFunc) gin.IRoutes) {
+ // create / get / update / delete lists
+ attachHandler(http.MethodPost, BasePath, m.ListCreatePOSTHandler)
attachHandler(http.MethodGet, BasePath, m.ListsGETHandler)
+ attachHandler(http.MethodGet, BasePathWithID, m.ListGETHandler)
+ attachHandler(http.MethodPut, BasePathWithID, m.ListUpdatePUTHandler)
+ attachHandler(http.MethodDelete, BasePathWithID, m.ListDELETEHandler)
+
+ // get / add / remove list accounts
+ attachHandler(http.MethodGet, AccountsPath, m.ListAccountsGETHandler)
+ attachHandler(http.MethodPost, AccountsPath, m.ListAccountsPOSTHandler)
+ attachHandler(http.MethodDelete, AccountsPath, m.ListAccountsDELETEHandler)
}