Add QueryStateAndAuthChainIDs

This commit is contained in:
Neil Alexander 2021-07-15 15:02:50 +01:00
parent 1827dd7c09
commit 90dd5e6544
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
8 changed files with 175 additions and 0 deletions

View file

@ -75,6 +75,12 @@ type RoomserverInternalAPI interface {
response *QueryLatestEventsAndStateResponse,
) error
QueryStateAndAuthChainIDs(
ctx context.Context,
request *QueryStateAndAuthChainIDsRequest,
response *QueryStateAndAuthChainIDsResponse,
) error
// Query the state after a list of events in a room from the room server.
QueryStateAfterEvents(
ctx context.Context,

View file

@ -250,6 +250,28 @@ type QueryStateAndAuthChainResponse struct {
AuthChainEvents []*gomatrixserverlib.HeaderedEvent `json:"auth_chain_events"`
}
// QueryStateAndAuthChainIDsRequest is a request to QueryStateAndAuthChainIDs
type QueryStateAndAuthChainIDsRequest struct {
// The room ID to query the state in.
RoomID string `json:"room_id"`
// The list of prev events for the event. Used to calculate the state at
// the event.
PrevEventIDs []string `json:"prev_event_ids"`
}
// QueryStateAndAuthChainIDsResponse is a response to QueryStateAndAuthChainIDs
type QueryStateAndAuthChainIDsResponse struct {
// Does the room exist on this roomserver?
// If the room doesn't exist this will be false and StateEvents will be empty.
RoomExists bool `json:"room_exists"`
// The room version of the room.
RoomVersion gomatrixserverlib.RoomVersion `json:"room_version"`
// The state and auth chain event IDs that were requested.
// The lists will be in an arbitrary order.
StateEvents []string `json:"state_event_ids"`
AuthChainEvents []string `json:"auth_chain_event_ids"`
}
// QueryRoomVersionCapabilitiesRequest asks for the default room version
type QueryRoomVersionCapabilitiesRequest struct{}