mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-25 07:43:10 -06:00
Add/Implement QueryRoomReceipts
This commit is contained in:
parent
5b53b7c80b
commit
615c729775
|
|
@ -196,5 +196,17 @@ type RoomserverInternalAPI interface {
|
||||||
response *RemoveRoomAliasResponse,
|
response *RemoveRoomAliasResponse,
|
||||||
) error
|
) error
|
||||||
|
|
||||||
PerformUserReceiptUpdate(ctx context.Context, req *PerformUserReceiptUpdateRequest, res *PerformUserReceiptUpdateResponse) error
|
// Inserts/updates a user receipt
|
||||||
|
PerformUserReceiptUpdate(
|
||||||
|
ctx context.Context,
|
||||||
|
req *PerformUserReceiptUpdateRequest,
|
||||||
|
res *PerformUserReceiptUpdateResponse,
|
||||||
|
) error
|
||||||
|
|
||||||
|
// Gets user receipts for a room
|
||||||
|
QueryRoomReceipts(
|
||||||
|
ctx context.Context,
|
||||||
|
req *QueryRoomReceiptRequest,
|
||||||
|
res *QueryRoomReceiptResponse,
|
||||||
|
) error
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -322,3 +322,9 @@ func (t *RoomserverInternalAPITrace) PerformUserReceiptUpdate(
|
||||||
util.GetLogger(ctx).WithError(err).Infof("PerformUserReceiptUpdateRequest 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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *RoomserverInternalAPITrace) QueryRoomReceipts(ctx context.Context, req *QueryRoomReceiptRequest, res *QueryRoomReceiptResponse) error {
|
||||||
|
err := t.Impl.QueryRoomReceipts(ctx, req, res)
|
||||||
|
util.GetLogger(ctx).WithError(err).Infof("QueryRoomReceiptRequest req=%+v res=%+v", js(req), js(res))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/clientapi/auth/authtypes"
|
"github.com/matrix-org/dendrite/clientapi/auth/authtypes"
|
||||||
|
"github.com/matrix-org/dendrite/roomserver/types"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -401,3 +402,12 @@ func (r *QueryCurrentStateResponse) UnmarshalJSON(data []byte) error {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type QueryRoomReceiptRequest struct {
|
||||||
|
RoomID string `json:"room_id"`
|
||||||
|
TS int `json:"ts"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type QueryRoomReceiptResponse struct {
|
||||||
|
Receipts []types.Receipt `json:"receipts"`
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,22 @@
|
||||||
package api
|
package api
|
||||||
|
|
||||||
type PerformUserReceiptUpdateRequest struct {
|
type PerformUserReceiptUpdateRequest struct {
|
||||||
RoomID string
|
RoomID string `json:"room_id"`
|
||||||
ReceiptType string
|
ReceiptType string `json:"type"`
|
||||||
EventID string
|
EventID string `json:"event_id"`
|
||||||
UserID string
|
UserID string `json:"user_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PerformUserReceiptUpdateResponse struct{}
|
type PerformUserReceiptUpdateResponse struct{}
|
||||||
|
|
||||||
|
type ReceiptEvent struct {
|
||||||
|
Content map[string]struct {
|
||||||
|
Data map[string]TS `json:"m.read"`
|
||||||
|
} `json:"content"`
|
||||||
|
RoomID string `json:"room_id"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type TS struct {
|
||||||
|
TimeStamp int `json:"ts"`
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue