mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
HTTP API endpoints
This commit is contained in:
parent
90dd5e6544
commit
5ef94156f5
3 changed files with 38 additions and 0 deletions
|
@ -208,6 +208,16 @@ func (t *RoomserverInternalAPITrace) QueryStateAndAuthChain(
|
|||
return err
|
||||
}
|
||||
|
||||
func (t *RoomserverInternalAPITrace) QueryStateAndAuthChainIDs(
|
||||
ctx context.Context,
|
||||
req *QueryStateAndAuthChainIDsRequest,
|
||||
res *QueryStateAndAuthChainIDsResponse,
|
||||
) error {
|
||||
err := t.Impl.QueryStateAndAuthChainIDs(ctx, req, res)
|
||||
util.GetLogger(ctx).WithError(err).Infof("QueryStateAndAuthChainIDs req=%+v res=%+v", js(req), js(res))
|
||||
return err
|
||||
}
|
||||
|
||||
func (t *RoomserverInternalAPITrace) PerformBackfill(
|
||||
ctx context.Context,
|
||||
req *PerformBackfillRequest,
|
||||
|
|
|
@ -47,6 +47,7 @@ const (
|
|||
RoomserverQueryServerAllowedToSeeEventPath = "/roomserver/queryServerAllowedToSeeEvent"
|
||||
RoomserverQueryMissingEventsPath = "/roomserver/queryMissingEvents"
|
||||
RoomserverQueryStateAndAuthChainPath = "/roomserver/queryStateAndAuthChain"
|
||||
RoomserverQueryStateAndAuthChainIDsPath = "/roomserver/queryStateAndAuthChainIDs"
|
||||
RoomserverQueryRoomVersionCapabilitiesPath = "/roomserver/queryRoomVersionCapabilities"
|
||||
RoomserverQueryRoomVersionForRoomPath = "/roomserver/queryRoomVersionForRoom"
|
||||
RoomserverQueryPublishedRoomsPath = "/roomserver/queryPublishedRooms"
|
||||
|
@ -417,6 +418,19 @@ func (h *httpRoomserverInternalAPI) QueryStateAndAuthChain(
|
|||
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
|
||||
}
|
||||
|
||||
// QueryStateAndAuthChainIDs implements RoomserverQueryAPI
|
||||
func (h *httpRoomserverInternalAPI) QueryStateAndAuthChainIDs(
|
||||
ctx context.Context,
|
||||
request *api.QueryStateAndAuthChainIDsRequest,
|
||||
response *api.QueryStateAndAuthChainIDsResponse,
|
||||
) error {
|
||||
span, ctx := opentracing.StartSpanFromContext(ctx, "QueryStateAndAuthChainIDs")
|
||||
defer span.Finish()
|
||||
|
||||
apiURL := h.roomserverURL + RoomserverQueryStateAndAuthChainIDsPath
|
||||
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
|
||||
}
|
||||
|
||||
// PerformBackfill implements RoomServerQueryAPI
|
||||
func (h *httpRoomserverInternalAPI) PerformBackfill(
|
||||
ctx context.Context,
|
||||
|
|
|
@ -261,6 +261,20 @@ func AddRoutes(r api.RoomserverInternalAPI, internalAPIMux *mux.Router) {
|
|||
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||
}),
|
||||
)
|
||||
internalAPIMux.Handle(
|
||||
RoomserverQueryStateAndAuthChainIDsPath,
|
||||
httputil.MakeInternalAPI("queryStateAndAuthChainIDs", func(req *http.Request) util.JSONResponse {
|
||||
var request api.QueryStateAndAuthChainIDsRequest
|
||||
var response api.QueryStateAndAuthChainIDsResponse
|
||||
if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
|
||||
return util.ErrorResponse(err)
|
||||
}
|
||||
if err := r.QueryStateAndAuthChainIDs(req.Context(), &request, &response); err != nil {
|
||||
return util.ErrorResponse(err)
|
||||
}
|
||||
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||
}),
|
||||
)
|
||||
internalAPIMux.Handle(
|
||||
RoomserverPerformBackfillPath,
|
||||
httputil.MakeInternalAPI("PerformBackfill", func(req *http.Request) util.JSONResponse {
|
||||
|
|
Loading…
Reference in a new issue