mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-14 13:22:26 +03:00
Implement filter POSTing and GETting. (#296)
* Implement filter POSTing and GETting. Signed-off-by: Jan Christian Grünhage <jan.christian@gruenhage.xyz> * Add missing '}' typo introduced during merge * Still trying to fix that merge... * Fix linting
This commit is contained in:
parent
e9314e5b30
commit
f6bda82366
5 changed files with 278 additions and 16 deletions
|
@ -189,23 +189,18 @@ func Setup(
|
|||
}),
|
||||
).Methods("GET")
|
||||
|
||||
r0mux.Handle("/user/{userID}/filter",
|
||||
common.MakeExternalAPI("make_filter", func(req *http.Request) util.JSONResponse {
|
||||
// TODO: Persist filter and return filter ID
|
||||
return util.JSONResponse{
|
||||
Code: 200,
|
||||
JSON: struct{}{},
|
||||
}
|
||||
|
||||
r0mux.Handle("/user/{userId}/filter",
|
||||
common.MakeAuthAPI("put_filter", deviceDB, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
|
||||
vars := mux.Vars(req)
|
||||
return writers.PutFilter(req, device, accountDB, vars["userId"])
|
||||
}),
|
||||
).Methods("POST", "OPTIONS")
|
||||
|
||||
r0mux.Handle("/user/{userID}/filter/{filterID}",
|
||||
common.MakeExternalAPI("filter", func(req *http.Request) util.JSONResponse {
|
||||
// TODO: Retrieve filter based on ID
|
||||
return util.JSONResponse{
|
||||
Code: 200,
|
||||
JSON: struct{}{},
|
||||
}
|
||||
r0mux.Handle("/user/{userId}/filter/{filterId}",
|
||||
common.MakeAuthAPI("get_filter", deviceDB, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
|
||||
vars := mux.Vars(req)
|
||||
return readers.GetFilter(req, device, accountDB, vars["userId"], vars["filterId"])
|
||||
}),
|
||||
).Methods("GET")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue