mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 06:12:45 +00:00
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:
parent
d785ad82b9
commit
9834ac97db
29 changed files with 879 additions and 1013 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue