mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-23 14:53:10 -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,
|
||||
"userId": device.UserID,
|
||||
}).Debug("Setting receipt")
|
||||
userReq := &roomserverAPI.PerformUserReceiptUpdate{
|
||||
userReq := &roomserverAPI.PerformUserReceiptUpdateRequest{
|
||||
RoomID: roomId,
|
||||
ReceiptType: receiptType,
|
||||
EventID: eventId,
|
||||
|
|
|
|||
|
|
@ -196,5 +196,5 @@ type RoomserverInternalAPI interface {
|
|||
response *RemoveRoomAliasResponse,
|
||||
) 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(
|
||||
ctx context.Context,
|
||||
req *PerformUserReceiptUpdate,
|
||||
req *PerformUserReceiptUpdateRequest,
|
||||
res *PerformUserReceiptUpdateResponse,
|
||||
) error {
|
||||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package api
|
||||
|
||||
type PerformUserReceiptUpdate struct {
|
||||
type PerformUserReceiptUpdateRequest struct {
|
||||
RoomID string
|
||||
ReceiptType string
|
||||
EventID string
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ func (r *RoomserverInternalAPI) PerformLeave(
|
|||
|
||||
func (r *RoomserverInternalAPI) PerformUserReceiptUpdate(
|
||||
ctx context.Context,
|
||||
req *api.PerformUserReceiptUpdate,
|
||||
req *api.PerformUserReceiptUpdateRequest,
|
||||
res *api.PerformUserReceiptUpdateResponse,
|
||||
) error {
|
||||
return r.Receipter.PerformUserReceiptUpdate(ctx, req, res)
|
||||
|
|
|
|||
|
|
@ -11,6 +11,6 @@ type Receipter struct {
|
|||
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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -496,10 +496,10 @@ func (h *httpRoomserverInternalAPI) QueryServerBannedFromRoom(
|
|||
|
||||
func (h *httpRoomserverInternalAPI) PerformUserReceiptUpdate(
|
||||
ctx context.Context,
|
||||
req *api.PerformUserReceiptUpdate,
|
||||
req *api.PerformUserReceiptUpdateRequest,
|
||||
res *api.PerformUserReceiptUpdateResponse,
|
||||
) error {
|
||||
span, ctx := opentracing.StartSpanFromContext(ctx, "PerformUserReceiptUpdate")
|
||||
span, ctx := opentracing.StartSpanFromContext(ctx, "PerformUserReceiptUpdateRequest")
|
||||
defer span.Finish()
|
||||
|
||||
apiURL := h.roomserverURL + RoomserverPerformReceiptUpdatePath
|
||||
|
|
|
|||
|
|
@ -427,4 +427,17 @@ func AddRoutes(r api.RoomserverInternalAPI, internalAPIMux *mux.Router) {
|
|||
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