mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[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
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user