From f5c004d67d4ed66b6c6df100afec47174aa14ae0 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Thu, 25 May 2023 10:37:38 +0200 Subject: [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 --- internal/api/client/lists/list.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'internal/api/client/lists/list.go') 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) } -- cgit v1.2.3