mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-23 14:53:10 -06:00
Add/Implement QueryRoomReceipts
This commit is contained in:
parent
5b53b7c80b
commit
615c729775
|
|
@ -196,5 +196,17 @@ type RoomserverInternalAPI interface {
|
|||
response *RemoveRoomAliasResponse,
|
||||
) 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))
|
||||
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"
|
||||
|
||||
"github.com/matrix-org/dendrite/clientapi/auth/authtypes"
|
||||
"github.com/matrix-org/dendrite/roomserver/types"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
)
|
||||
|
||||
|
|
@ -401,3 +402,12 @@ func (r *QueryCurrentStateResponse) UnmarshalJSON(data []byte) error {
|
|||
}
|
||||
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
|
||||
|
||||
type PerformUserReceiptUpdateRequest struct {
|
||||
RoomID string
|
||||
ReceiptType string
|
||||
EventID string
|
||||
UserID string
|
||||
RoomID string `json:"room_id"`
|
||||
ReceiptType string `json:"type"`
|
||||
EventID string `json:"event_id"`
|
||||
UserID string `json:"user_id"`
|
||||
}
|
||||
|
||||
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