mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-15 10:53:09 -06:00
Some progress in building roomtags
This commit is contained in:
parent
7832e77f4f
commit
795bb5b6f8
|
|
@ -14,31 +14,19 @@
|
||||||
|
|
||||||
package routing
|
package routing
|
||||||
|
|
||||||
const pathPrefixR0 = "/_matrix/client/r0"
|
import "net/http"
|
||||||
|
|
||||||
func TagRoom(
|
// GetTag implements GET /_matrix/client/r0/user/{userId}/rooms/{roomId}/tags
|
||||||
req *http.Request
|
func GetTag(req *http.Request, userId string, roomId string) {
|
||||||
) util.JSONResponse {
|
|
||||||
|
|
||||||
r0mux := apiMux.PathPrefix(pathPrefixR0).Subrouter()
|
}
|
||||||
|
|
||||||
|
// PutTag implements GET /_matrix/client/r0/user/{userId}/rooms/{roomId}/tags/{tag}
|
||||||
|
func PutTag(req *http.Request, userId string, roomId string, tag string) {
|
||||||
|
|
||||||
r0mux.Handle("/user/{userId}/rooms/{roomId}/tags",
|
}
|
||||||
common.MakeAuthAPI("account_3pid", authData, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
|
|
||||||
return GetTag()
|
|
||||||
}),
|
|
||||||
).Methods(http.MethodGet, http.MethodOptions)
|
|
||||||
|
|
||||||
r0mux.Handle("/user/{userId}/rooms/{roomId}/tags/{tag}",
|
// DeleteTag implements DELETE /_matrix/client/r0/user/{userId}/rooms/{roomId}/tags/{tag}
|
||||||
common.MakeAuthAPI("account_3pid", authData, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
|
func DeleteTag(req *http.Request, userId string, roomId string, tag string) {
|
||||||
return PutTag()
|
|
||||||
}),
|
|
||||||
).Methods(http.MethodPut, http.MethodOptions)
|
|
||||||
|
|
||||||
r0mux.Handle("/user/{userId}/rooms/{roomId}/tags/{tag}",
|
}
|
||||||
common.MakeAuthAPI("account_3pid", authData, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
|
|
||||||
return DeleteTag()
|
|
||||||
}),
|
|
||||||
).Methods(http.MethodDelete, http.MethodOptions)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -406,4 +406,29 @@ func Setup(
|
||||||
}}
|
}}
|
||||||
}),
|
}),
|
||||||
).Methods(http.MethodGet, http.MethodOptions)
|
).Methods(http.MethodGet, http.MethodOptions)
|
||||||
|
|
||||||
|
r0mux.Handle("/user/{userId}/rooms/{roomId}/tags",
|
||||||
|
common.MakeAuthAPI("account_3pid", authData, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
|
||||||
|
// When a GET tag request is done, obtain all data of user from here and provide a JSON response.
|
||||||
|
// MakeAuthAPI will convert it to a HTTP response and reflect it on the browser.
|
||||||
|
vars := mux.Vars(req)
|
||||||
|
return GetTag(req, vars["userId"], vars["roomId"])
|
||||||
|
}),
|
||||||
|
).Methods(http.MethodGet, http.MethodOptions)
|
||||||
|
|
||||||
|
r0mux.Handle("/user/{userId}/rooms/{roomId}/tags/{tag}",
|
||||||
|
common.MakeAuthAPI("account_3pid", authData, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
|
||||||
|
// When a PUT tag request is done, obtain all data of user from here and provide a JSON response.
|
||||||
|
// MakeAuthAPI will convert it to a HTTP response and reflect it on the browser.
|
||||||
|
return PutTag(req, vars["userId"], vars["roomId"], vars["tag"])
|
||||||
|
}),
|
||||||
|
).Methods(http.MethodPut, http.MethodOptions)
|
||||||
|
|
||||||
|
r0mux.Handle("/user/{userId}/rooms/{roomId}/tags/{tag}",
|
||||||
|
common.MakeAuthAPI("account_3pid", authData, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
|
||||||
|
// When a DELETE tag request is done, obtain all data of user from here and provide a JSON response.
|
||||||
|
// MakeAuthAPI will convert it to a HTTP response and reflect it on the browser.
|
||||||
|
return DeleteTagreq, (vars["userId"], vars["roomId"], vars["tag"])
|
||||||
|
}),
|
||||||
|
).Methods(http.MethodDelete, http.MethodOptions)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue