MCPcopy Create free account
hub / github.com/daodst/chat / GetCapabilities

Function GetCapabilities

clientapi/routing/capabilities.go:28–55  ·  view source on GitHub ↗

GetCapabilities returns information about the server's supported feature set and other relevant capabilities to an authenticated user.

(
	req *http.Request, rsAPI roomserverAPI.ClientRoomserverAPI,
)

Source from the content-addressed store, hash-verified

26// GetCapabilities returns information about the server's supported feature set
27// and other relevant capabilities to an authenticated user.
28func GetCapabilities(
29 req *http.Request, rsAPI roomserverAPI.ClientRoomserverAPI,
30) util.JSONResponse {
31 roomVersionsQueryReq := roomserverAPI.QueryRoomVersionCapabilitiesRequest{}
32 roomVersionsQueryRes := roomserverAPI.QueryRoomVersionCapabilitiesResponse{}
33 if err := rsAPI.QueryRoomVersionCapabilities(
34 req.Context(),
35 &roomVersionsQueryReq,
36 &roomVersionsQueryRes,
37 ); err != nil {
38 util.GetLogger(req.Context()).WithError(err).Error("queryAPI.QueryRoomVersionCapabilities failed")
39 return jsonerror.InternalServerError()
40 }
41
42 response := map[string]interface{}{
43 "capabilities": map[string]interface{}{
44 "m.change_password": map[string]bool{
45 "enabled": true,
46 },
47 "m.room_versions": roomVersionsQueryRes,
48 },
49 }
50
51 return util.JSONResponse{
52 Code: http.StatusOK,
53 JSON: response,
54 }
55}

Callers 1

SetupFunction · 0.85

Calls 3

ContextMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected