mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-24 07:13:09 -06:00
Rename struct to fit namescheme
This commit is contained in:
parent
afef2a19ae
commit
d8dd4d7bc4
|
|
@ -30,7 +30,7 @@ func SetReceipt(req *http.Request, rsAPI roomserverAPI.RoomserverInternalAPI, de
|
||||||
"eventId": eventId,
|
"eventId": eventId,
|
||||||
"userId": device.UserID,
|
"userId": device.UserID,
|
||||||
}).Debug("Setting receipt")
|
}).Debug("Setting receipt")
|
||||||
userReq := &roomserverAPI.PerformUserReceiptUpdate{
|
userReq := &roomserverAPI.PerformUserReceiptUpdateRequest{
|
||||||
RoomID: roomId,
|
RoomID: roomId,
|
||||||
ReceiptType: receiptType,
|
ReceiptType: receiptType,
|
||||||
EventID: eventId,
|
EventID: eventId,
|
||||||
|
|
|
||||||
|
|
@ -196,5 +196,5 @@ type RoomserverInternalAPI interface {
|
||||||
response *RemoveRoomAliasResponse,
|
response *RemoveRoomAliasResponse,
|
||||||
) error
|
) error
|
||||||
|
|
||||||
PerformUserReceiptUpdate(ctx context.Context, req *PerformUserReceiptUpdate, res *PerformUserReceiptUpdateResponse) error
|
PerformUserReceiptUpdate(ctx context.Context, req *PerformUserReceiptUpdateRequest, res *PerformUserReceiptUpdateResponse) error
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -315,10 +315,10 @@ func js(thing interface{}) string {
|
||||||
|
|
||||||
func (t *RoomserverInternalAPITrace) PerformUserReceiptUpdate(
|
func (t *RoomserverInternalAPITrace) PerformUserReceiptUpdate(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
req *PerformUserReceiptUpdate,
|
req *PerformUserReceiptUpdateRequest,
|
||||||
res *PerformUserReceiptUpdateResponse,
|
res *PerformUserReceiptUpdateResponse,
|
||||||
) error {
|
) error {
|
||||||
err := t.Impl.PerformUserReceiptUpdate(ctx, req, res)
|
err := t.Impl.PerformUserReceiptUpdate(ctx, req, res)
|
||||||
util.GetLogger(ctx).WithError(err).Infof("PerformUserReceiptUpdate req=%+v res=%+v", js(req), js(res))
|
util.GetLogger(ctx).WithError(err).Infof("PerformUserReceiptUpdateRequest req=%+v res=%+v", js(req), js(res))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package api
|
package api
|
||||||
|
|
||||||
type PerformUserReceiptUpdate struct {
|
type PerformUserReceiptUpdateRequest struct {
|
||||||
RoomID string
|
RoomID string
|
||||||
ReceiptType string
|
ReceiptType string
|
||||||
EventID string
|
EventID string
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ func (r *RoomserverInternalAPI) PerformLeave(
|
||||||
|
|
||||||
func (r *RoomserverInternalAPI) PerformUserReceiptUpdate(
|
func (r *RoomserverInternalAPI) PerformUserReceiptUpdate(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
req *api.PerformUserReceiptUpdate,
|
req *api.PerformUserReceiptUpdateRequest,
|
||||||
res *api.PerformUserReceiptUpdateResponse,
|
res *api.PerformUserReceiptUpdateResponse,
|
||||||
) error {
|
) error {
|
||||||
return r.Receipter.PerformUserReceiptUpdate(ctx, req, res)
|
return r.Receipter.PerformUserReceiptUpdate(ctx, req, res)
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,6 @@ type Receipter struct {
|
||||||
DB storage.Database
|
DB storage.Database
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Receipter) PerformUserReceiptUpdate(ctx context.Context, req *api.PerformUserReceiptUpdate, res *api.PerformUserReceiptUpdateResponse) error {
|
func (r *Receipter) PerformUserReceiptUpdate(ctx context.Context, req *api.PerformUserReceiptUpdateRequest, res *api.PerformUserReceiptUpdateResponse) error {
|
||||||
return r.DB.StoreReceipt(ctx, req.RoomID, req.ReceiptType, req.UserID, req.EventID)
|
return r.DB.StoreReceipt(ctx, req.RoomID, req.ReceiptType, req.UserID, req.EventID)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -496,10 +496,10 @@ func (h *httpRoomserverInternalAPI) QueryServerBannedFromRoom(
|
||||||
|
|
||||||
func (h *httpRoomserverInternalAPI) PerformUserReceiptUpdate(
|
func (h *httpRoomserverInternalAPI) PerformUserReceiptUpdate(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
req *api.PerformUserReceiptUpdate,
|
req *api.PerformUserReceiptUpdateRequest,
|
||||||
res *api.PerformUserReceiptUpdateResponse,
|
res *api.PerformUserReceiptUpdateResponse,
|
||||||
) error {
|
) error {
|
||||||
span, ctx := opentracing.StartSpanFromContext(ctx, "PerformUserReceiptUpdate")
|
span, ctx := opentracing.StartSpanFromContext(ctx, "PerformUserReceiptUpdateRequest")
|
||||||
defer span.Finish()
|
defer span.Finish()
|
||||||
|
|
||||||
apiURL := h.roomserverURL + RoomserverPerformReceiptUpdatePath
|
apiURL := h.roomserverURL + RoomserverPerformReceiptUpdatePath
|
||||||
|
|
|
||||||
|
|
@ -427,4 +427,17 @@ func AddRoutes(r api.RoomserverInternalAPI, internalAPIMux *mux.Router) {
|
||||||
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
internalAPIMux.Handle(RoomserverPerformReceiptUpdatePath,
|
||||||
|
httputil.MakeInternalAPI("performReceiptUpdate", func(req *http.Request) util.JSONResponse {
|
||||||
|
request := api.PerformUserReceiptUpdateRequest{}
|
||||||
|
response := api.PerformUserReceiptUpdateResponse{}
|
||||||
|
if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
|
||||||
|
return util.MessageResponse(http.StatusBadRequest, err.Error())
|
||||||
|
}
|
||||||
|
if err := r.PerformUserReceiptUpdate(req.Context(), &request, &response); err != nil {
|
||||||
|
return util.ErrorResponse(err)
|
||||||
|
}
|
||||||
|
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||||
|
}),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue