mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 21:32:46 +00:00
Clean up interface definitions (#2427)
* tidy up interfaces * remove unused GetCreatorIDForAlias * Add RoomserverUserAPI interface * Define more interfaces * Use AppServiceInternalAPI for consistent naming * clean up federationapi constructor a bit * Fix monolith in -http mode
This commit is contained in:
parent
4705f5761e
commit
85704eff20
37 changed files with 236 additions and 429 deletions
|
@ -91,11 +91,11 @@ func (h *httpRoomserverInternalAPI) SetFederationAPI(fsAPI fsInputAPI.Roomserver
|
|||
}
|
||||
|
||||
// SetAppserviceAPI no-ops in HTTP client mode as there is no chicken/egg scenario
|
||||
func (h *httpRoomserverInternalAPI) SetAppserviceAPI(asAPI asAPI.AppServiceQueryAPI) {
|
||||
func (h *httpRoomserverInternalAPI) SetAppserviceAPI(asAPI asAPI.AppServiceInternalAPI) {
|
||||
}
|
||||
|
||||
// SetUserAPI no-ops in HTTP client mode as there is no chicken/egg scenario
|
||||
func (h *httpRoomserverInternalAPI) SetUserAPI(userAPI userapi.UserInternalAPI) {
|
||||
func (h *httpRoomserverInternalAPI) SetUserAPI(userAPI userapi.RoomserverUserAPI) {
|
||||
}
|
||||
|
||||
// SetRoomAlias implements RoomserverAliasAPI
|
||||
|
@ -137,19 +137,6 @@ func (h *httpRoomserverInternalAPI) GetAliasesForRoomID(
|
|||
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
|
||||
}
|
||||
|
||||
// GetCreatorIDForAlias implements RoomserverAliasAPI
|
||||
func (h *httpRoomserverInternalAPI) GetCreatorIDForAlias(
|
||||
ctx context.Context,
|
||||
request *api.GetCreatorIDForAliasRequest,
|
||||
response *api.GetCreatorIDForAliasResponse,
|
||||
) error {
|
||||
span, ctx := opentracing.StartSpanFromContext(ctx, "GetCreatorIDForAlias")
|
||||
defer span.Finish()
|
||||
|
||||
apiURL := h.roomserverURL + RoomserverGetCreatorIDForAliasPath
|
||||
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
|
||||
}
|
||||
|
||||
// RemoveRoomAlias implements RoomserverAliasAPI
|
||||
func (h *httpRoomserverInternalAPI) RemoveRoomAlias(
|
||||
ctx context.Context,
|
||||
|
|
|
@ -353,20 +353,6 @@ func AddRoutes(r api.RoomserverInternalAPI, internalAPIMux *mux.Router) {
|
|||
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||
}),
|
||||
)
|
||||
internalAPIMux.Handle(
|
||||
RoomserverGetCreatorIDForAliasPath,
|
||||
httputil.MakeInternalAPI("GetCreatorIDForAlias", func(req *http.Request) util.JSONResponse {
|
||||
var request api.GetCreatorIDForAliasRequest
|
||||
var response api.GetCreatorIDForAliasResponse
|
||||
if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
|
||||
return util.ErrorResponse(err)
|
||||
}
|
||||
if err := r.GetCreatorIDForAlias(req.Context(), &request, &response); err != nil {
|
||||
return util.ErrorResponse(err)
|
||||
}
|
||||
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||
}),
|
||||
)
|
||||
internalAPIMux.Handle(
|
||||
RoomserverGetAliasesForRoomIDPath,
|
||||
httputil.MakeInternalAPI("getAliasesForRoomID", func(req *http.Request) util.JSONResponse {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue