Convert everything but serverkeyapi to inthttp (#1096)

* Convert roomserver to new inthttp format

* Convert eduserver to new inthttp format

* Convert appservice to new inthttp format
This commit is contained in:
Kegsay 2020-06-04 15:43:07 +01:00 committed by GitHub
parent d785ad82b9
commit 9834ac97db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 879 additions and 1013 deletions

View file

@ -1,19 +1,7 @@
package api
import (
"context"
internalHTTP "github.com/matrix-org/dendrite/internal/http"
"github.com/matrix-org/gomatrixserverlib"
"github.com/opentracing/opentracing-go"
)
const (
// RoomserverPerformJoinPath is the HTTP path for the PerformJoin API.
RoomserverPerformJoinPath = "/roomserver/performJoin"
// RoomserverPerformLeavePath is the HTTP path for the PerformLeave API.
RoomserverPerformLeavePath = "/roomserver/performLeave"
)
type PerformJoinRequest struct {
@ -27,18 +15,6 @@ type PerformJoinResponse struct {
RoomID string `json:"room_id"`
}
func (h *httpRoomserverInternalAPI) PerformJoin(
ctx context.Context,
request *PerformJoinRequest,
response *PerformJoinResponse,
) error {
span, ctx := opentracing.StartSpanFromContext(ctx, "PerformJoin")
defer span.Finish()
apiURL := h.roomserverURL + RoomserverPerformJoinPath
return internalHTTP.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
}
type PerformLeaveRequest struct {
RoomID string `json:"room_id"`
UserID string `json:"user_id"`
@ -46,15 +22,3 @@ type PerformLeaveRequest struct {
type PerformLeaveResponse struct {
}
func (h *httpRoomserverInternalAPI) PerformLeave(
ctx context.Context,
request *PerformLeaveRequest,
response *PerformLeaveResponse,
) error {
span, ctx := opentracing.StartSpanFromContext(ctx, "PerformLeave")
defer span.Finish()
apiURL := h.roomserverURL + RoomserverPerformLeavePath
return internalHTTP.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
}