Documentation ¶
Overview ¶
Package api provides the types that are used to communicate with the roomserver.
Index ¶
- Constants
- func GetEvent(ctx context.Context, rsAPI QueryEventsAPI, eventID string) *gomatrixserverlib.HeaderedEvent
- func GetStateEvent(ctx context.Context, rsAPI QueryEventsAPI, roomID string, ...) *gomatrixserverlib.HeaderedEvent
- func IsServerBannedFromRoom(ctx context.Context, rsAPI FederationRoomserverAPI, roomID string, ...) bool
- func PopulatePublicRooms(ctx context.Context, roomIDs []string, rsAPI QueryBulkStateContentAPI) ([]gomatrixserverlib.PublicRoom, error)
- func SendEventWithState(ctx context.Context, rsAPI InputRoomEventsAPI, kind Kind, ...) error
- func SendEvents(ctx context.Context, rsAPI InputRoomEventsAPI, kind Kind, ...) error
- func SendInputRoomEvents(ctx context.Context, rsAPI InputRoomEventsAPI, ires []InputRoomEvent, ...) error
- type AliasEvent
- type AppserviceRoomserverAPI
- type ClientRoomserverAPI
- type FederationRoomserverAPI
- type GetAliasesForRoomIDRequest
- type GetAliasesForRoomIDResponse
- type GetRoomIDForAliasRequest
- type GetRoomIDForAliasResponse
- type InputRoomEvent
- type InputRoomEventsAPI
- type InputRoomEventsRequest
- type InputRoomEventsResponse
- type Kind
- type OutputEvent
- type OutputNewInboundPeek
- type OutputNewInviteEvent
- type OutputNewPeek
- type OutputNewRoomEvent
- type OutputOldRoomEvent
- type OutputRedactedEvent
- type OutputRetireInviteEvent
- type OutputRetirePeek
- type OutputRoomEventType
- type OutputType
- type PerformAdminEvacuateRoomRequest
- type PerformAdminEvacuateRoomResponse
- type PerformAdminEvacuateUserRequest
- type PerformAdminEvacuateUserResponse
- type PerformBackfillRequest
- type PerformBackfillResponse
- type PerformError
- type PerformErrorCode
- type PerformForgetRequest
- type PerformForgetResponse
- type PerformInboundPeekRequest
- type PerformInboundPeekResponse
- type PerformInviteRequest
- type PerformInviteResponse
- type PerformJoinRequest
- type PerformJoinResponse
- type PerformLeaveRequest
- type PerformLeaveResponse
- type PerformPeekRequest
- type PerformPeekResponse
- type PerformPublishRequest
- type PerformPublishResponse
- type PerformRoomUpgradeRequest
- type PerformRoomUpgradeResponse
- type PerformUnpeekRequest
- type PerformUnpeekResponse
- type QueryAuthChainRequest
- type QueryAuthChainResponse
- type QueryBulkStateContentAPI
- type QueryBulkStateContentRequest
- type QueryBulkStateContentResponse
- type QueryCurrentStateRequest
- type QueryCurrentStateResponse
- type QueryEventsAPI
- type QueryEventsByIDRequest
- type QueryEventsByIDResponse
- type QueryKnownUsersRequest
- type QueryKnownUsersResponse
- type QueryLatestEventsAndStateAPI
- type QueryLatestEventsAndStateRequest
- type QueryLatestEventsAndStateResponse
- type QueryMembershipForUserRequest
- type QueryMembershipForUserResponse
- type QueryMembershipsForRoomRequest
- type QueryMembershipsForRoomResponse
- type QueryMissingEventsRequest
- type QueryMissingEventsResponse
- type QueryPublishedRoomsRequest
- type QueryPublishedRoomsResponse
- type QueryRestrictedJoinAllowedRequest
- type QueryRestrictedJoinAllowedResponse
- type QueryRoomVersionCapabilitiesRequest
- type QueryRoomVersionCapabilitiesResponse
- type QueryRoomVersionForRoomRequest
- type QueryRoomVersionForRoomResponse
- type QueryRoomsForUserRequest
- type QueryRoomsForUserResponse
- type QueryServerAllowedToSeeEventRequest
- type QueryServerAllowedToSeeEventResponse
- type QueryServerBannedFromRoomRequest
- type QueryServerBannedFromRoomResponse
- type QueryServerJoinedToRoomRequest
- type QueryServerJoinedToRoomResponse
- type QuerySharedUsersRequest
- type QuerySharedUsersResponse
- type QueryStateAfterEventsRequest
- type QueryStateAfterEventsResponse
- type QueryStateAndAuthChainRequest
- type QueryStateAndAuthChainResponse
- type RemoveRoomAliasRequest
- type RemoveRoomAliasResponse
- type RoomserverInternalAPI
- type RoomserverInternalAPITrace
- func (t *RoomserverInternalAPITrace) GetAliasesForRoomID(ctx context.Context, req *GetAliasesForRoomIDRequest, ...) error
- func (t *RoomserverInternalAPITrace) GetRoomIDForAlias(ctx context.Context, req *GetRoomIDForAliasRequest, ...) error
- func (t *RoomserverInternalAPITrace) InputRoomEvents(ctx context.Context, req *InputRoomEventsRequest, res *InputRoomEventsResponse)
- func (t *RoomserverInternalAPITrace) PerformAdminEvacuateRoom(ctx context.Context, req *PerformAdminEvacuateRoomRequest, ...)
- func (t *RoomserverInternalAPITrace) PerformAdminEvacuateUser(ctx context.Context, req *PerformAdminEvacuateUserRequest, ...)
- func (t *RoomserverInternalAPITrace) PerformBackfill(ctx context.Context, req *PerformBackfillRequest, res *PerformBackfillResponse) error
- func (t *RoomserverInternalAPITrace) PerformForget(ctx context.Context, req *PerformForgetRequest, res *PerformForgetResponse) error
- func (t *RoomserverInternalAPITrace) PerformInboundPeek(ctx context.Context, req *PerformInboundPeekRequest, ...) error
- func (t *RoomserverInternalAPITrace) PerformInvite(ctx context.Context, req *PerformInviteRequest, res *PerformInviteResponse) error
- func (t *RoomserverInternalAPITrace) PerformJoin(ctx context.Context, req *PerformJoinRequest, res *PerformJoinResponse)
- func (t *RoomserverInternalAPITrace) PerformLeave(ctx context.Context, req *PerformLeaveRequest, res *PerformLeaveResponse) error
- func (t *RoomserverInternalAPITrace) PerformPeek(ctx context.Context, req *PerformPeekRequest, res *PerformPeekResponse)
- func (t *RoomserverInternalAPITrace) PerformPublish(ctx context.Context, req *PerformPublishRequest, res *PerformPublishResponse)
- func (t *RoomserverInternalAPITrace) PerformRoomUpgrade(ctx context.Context, req *PerformRoomUpgradeRequest, ...)
- func (t *RoomserverInternalAPITrace) PerformUnpeek(ctx context.Context, req *PerformUnpeekRequest, res *PerformUnpeekResponse)
- func (t *RoomserverInternalAPITrace) QueryAuthChain(ctx context.Context, request *QueryAuthChainRequest, ...) error
- func (t *RoomserverInternalAPITrace) QueryBulkStateContent(ctx context.Context, req *QueryBulkStateContentRequest, ...) error
- func (t *RoomserverInternalAPITrace) QueryCurrentState(ctx context.Context, req *QueryCurrentStateRequest, ...) error
- func (t *RoomserverInternalAPITrace) QueryEventsByID(ctx context.Context, req *QueryEventsByIDRequest, res *QueryEventsByIDResponse) error
- func (t *RoomserverInternalAPITrace) QueryKnownUsers(ctx context.Context, req *QueryKnownUsersRequest, res *QueryKnownUsersResponse) error
- func (t *RoomserverInternalAPITrace) QueryLatestEventsAndState(ctx context.Context, req *QueryLatestEventsAndStateRequest, ...) error
- func (t *RoomserverInternalAPITrace) QueryMembershipForUser(ctx context.Context, req *QueryMembershipForUserRequest, ...) error
- func (t *RoomserverInternalAPITrace) QueryMembershipsForRoom(ctx context.Context, req *QueryMembershipsForRoomRequest, ...) error
- func (t *RoomserverInternalAPITrace) QueryMissingEvents(ctx context.Context, req *QueryMissingEventsRequest, ...) error
- func (t *RoomserverInternalAPITrace) QueryPublishedRooms(ctx context.Context, req *QueryPublishedRoomsRequest, ...) error
- func (t *RoomserverInternalAPITrace) QueryRestrictedJoinAllowed(ctx context.Context, request *QueryRestrictedJoinAllowedRequest, ...) error
- func (t *RoomserverInternalAPITrace) QueryRoomVersionCapabilities(ctx context.Context, req *QueryRoomVersionCapabilitiesRequest, ...) error
- func (t *RoomserverInternalAPITrace) QueryRoomVersionForRoom(ctx context.Context, req *QueryRoomVersionForRoomRequest, ...) error
- func (t *RoomserverInternalAPITrace) QueryRoomsForUser(ctx context.Context, req *QueryRoomsForUserRequest, ...) error
- func (t *RoomserverInternalAPITrace) QueryServerAllowedToSeeEvent(ctx context.Context, req *QueryServerAllowedToSeeEventRequest, ...) error
- func (t *RoomserverInternalAPITrace) QueryServerBannedFromRoom(ctx context.Context, req *QueryServerBannedFromRoomRequest, ...) error
- func (t *RoomserverInternalAPITrace) QueryServerJoinedToRoom(ctx context.Context, req *QueryServerJoinedToRoomRequest, ...) error
- func (t *RoomserverInternalAPITrace) QuerySharedUsers(ctx context.Context, req *QuerySharedUsersRequest, ...) error
- func (t *RoomserverInternalAPITrace) QueryStateAfterEvents(ctx context.Context, req *QueryStateAfterEventsRequest, ...) error
- func (t *RoomserverInternalAPITrace) QueryStateAndAuthChain(ctx context.Context, req *QueryStateAndAuthChainRequest, ...) error
- func (t *RoomserverInternalAPITrace) RemoveRoomAlias(ctx context.Context, req *RemoveRoomAliasRequest, res *RemoveRoomAliasResponse) error
- func (t *RoomserverInternalAPITrace) SetAppserviceAPI(asAPI asAPI.AppServiceInternalAPI)
- func (t *RoomserverInternalAPITrace) SetFederationAPI(fsAPI fsAPI.RoomserverFederationAPI, keyRing *gomatrixserverlib.KeyRing)
- func (t *RoomserverInternalAPITrace) SetRoomAlias(ctx context.Context, req *SetRoomAliasRequest, res *SetRoomAliasResponse) error
- func (t *RoomserverInternalAPITrace) SetUserAPI(userAPI userapi.RoomserverUserAPI)
- type SetRoomAliasRequest
- type SetRoomAliasResponse
- type SyncRoomserverAPI
- type TransactionID
- type UserRoomserverAPI
Constants ¶
const DoNotSendToOtherServers = ""
DoNotSendToOtherServers tells us not to send the event to other matrix servers.
Variables ¶
This section is empty.
Functions ¶
func GetEvent ¶
func GetEvent(ctx context.Context, rsAPI QueryEventsAPI, eventID string) *gomatrixserverlib.HeaderedEvent
GetEvent returns the event or nil, even on errors.
func GetStateEvent ¶
func GetStateEvent(ctx context.Context, rsAPI QueryEventsAPI, roomID string, tuple gomatrixserverlib.StateKeyTuple) *gomatrixserverlib.HeaderedEvent
GetStateEvent returns the current state event in the room or nil.
func IsServerBannedFromRoom ¶
func IsServerBannedFromRoom(ctx context.Context, rsAPI FederationRoomserverAPI, roomID string, serverName gomatrixserverlib.ServerName) bool
IsServerBannedFromRoom returns whether the server is banned from a room by server ACLs.
func PopulatePublicRooms ¶
func PopulatePublicRooms(ctx context.Context, roomIDs []string, rsAPI QueryBulkStateContentAPI) ([]gomatrixserverlib.PublicRoom, error)
PopulatePublicRooms extracts PublicRoom information for all the provided room IDs. The IDs are not checked to see if they are visible in the published room directory. due to lots of switches
func SendEventWithState ¶
func SendEventWithState( ctx context.Context, rsAPI InputRoomEventsAPI, kind Kind, state *gomatrixserverlib.RespState, event *gomatrixserverlib.HeaderedEvent, origin gomatrixserverlib.ServerName, haveEventIDs map[string]bool, async bool, ) error
SendEventWithState writes an event with the specified kind to the roomserver with the state at the event as KindOutlier before it. Will not send any event that is marked as `true` in haveEventIDs.
func SendEvents ¶
func SendEvents( ctx context.Context, rsAPI InputRoomEventsAPI, kind Kind, events []*gomatrixserverlib.HeaderedEvent, origin gomatrixserverlib.ServerName, sendAsServer gomatrixserverlib.ServerName, txnID *TransactionID, async bool, ) error
SendEvents to the roomserver The events are written with KindNew.
func SendInputRoomEvents ¶
func SendInputRoomEvents( ctx context.Context, rsAPI InputRoomEventsAPI, ires []InputRoomEvent, async bool, ) error
SendInputRoomEvents to the roomserver.
Types ¶
type AliasEvent ¶
func (AliasEvent) Valid ¶
func (a AliasEvent) Valid() bool
type AppserviceRoomserverAPI ¶
type AppserviceRoomserverAPI interface { // Query a list of events by event ID. QueryEventsByID( ctx context.Context, req *QueryEventsByIDRequest, res *QueryEventsByIDResponse, ) error // Query a list of membership events for a room QueryMembershipsForRoom( ctx context.Context, req *QueryMembershipsForRoomRequest, res *QueryMembershipsForRoomResponse, ) error // Get all known aliases for a room ID GetAliasesForRoomID( ctx context.Context, req *GetAliasesForRoomIDRequest, res *GetAliasesForRoomIDResponse, ) error }
type ClientRoomserverAPI ¶
type ClientRoomserverAPI interface { InputRoomEventsAPI QueryLatestEventsAndStateAPI QueryBulkStateContentAPI QueryEventsAPI QueryMembershipForUser(ctx context.Context, req *QueryMembershipForUserRequest, res *QueryMembershipForUserResponse) error QueryMembershipsForRoom(ctx context.Context, req *QueryMembershipsForRoomRequest, res *QueryMembershipsForRoomResponse) error QueryRoomsForUser(ctx context.Context, req *QueryRoomsForUserRequest, res *QueryRoomsForUserResponse) error QueryStateAfterEvents(ctx context.Context, req *QueryStateAfterEventsRequest, res *QueryStateAfterEventsResponse) error // QueryKnownUsers returns a list of users that we know about from our joined rooms. QueryKnownUsers(ctx context.Context, req *QueryKnownUsersRequest, res *QueryKnownUsersResponse) error QueryRoomVersionForRoom(ctx context.Context, req *QueryRoomVersionForRoomRequest, res *QueryRoomVersionForRoomResponse) error QueryPublishedRooms(ctx context.Context, req *QueryPublishedRoomsRequest, res *QueryPublishedRoomsResponse) error QueryRoomVersionCapabilities(ctx context.Context, req *QueryRoomVersionCapabilitiesRequest, res *QueryRoomVersionCapabilitiesResponse) error GetRoomIDForAlias(ctx context.Context, req *GetRoomIDForAliasRequest, res *GetRoomIDForAliasResponse) error GetAliasesForRoomID(ctx context.Context, req *GetAliasesForRoomIDRequest, res *GetAliasesForRoomIDResponse) error // PerformRoomUpgrade upgrades a room to a newer version PerformRoomUpgrade(ctx context.Context, req *PerformRoomUpgradeRequest, resp *PerformRoomUpgradeResponse) PerformAdminEvacuateRoom(ctx context.Context, req *PerformAdminEvacuateRoomRequest, res *PerformAdminEvacuateRoomResponse) PerformAdminEvacuateUser(ctx context.Context, req *PerformAdminEvacuateUserRequest, res *PerformAdminEvacuateUserResponse) PerformPeek(ctx context.Context, req *PerformPeekRequest, res *PerformPeekResponse) PerformUnpeek(ctx context.Context, req *PerformUnpeekRequest, res *PerformUnpeekResponse) PerformInvite(ctx context.Context, req *PerformInviteRequest, res *PerformInviteResponse) error PerformJoin(ctx context.Context, req *PerformJoinRequest, res *PerformJoinResponse) PerformLeave(ctx context.Context, req *PerformLeaveRequest, res *PerformLeaveResponse) error PerformPublish(ctx context.Context, req *PerformPublishRequest, res *PerformPublishResponse) // PerformForget forgets a rooms history for a specific user PerformForget(ctx context.Context, req *PerformForgetRequest, resp *PerformForgetResponse) error SetRoomAlias(ctx context.Context, req *SetRoomAliasRequest, res *SetRoomAliasResponse) error RemoveRoomAlias(ctx context.Context, req *RemoveRoomAliasRequest, res *RemoveRoomAliasResponse) error }
type FederationRoomserverAPI ¶
type FederationRoomserverAPI interface { InputRoomEventsAPI QueryLatestEventsAndStateAPI QueryBulkStateContentAPI // QueryServerBannedFromRoom returns whether a server is banned from a room by server ACLs. QueryServerBannedFromRoom(ctx context.Context, req *QueryServerBannedFromRoomRequest, res *QueryServerBannedFromRoomResponse) error QueryRoomVersionForRoom(ctx context.Context, req *QueryRoomVersionForRoomRequest, res *QueryRoomVersionForRoomResponse) error GetRoomIDForAlias(ctx context.Context, req *GetRoomIDForAliasRequest, res *GetRoomIDForAliasResponse) error QueryEventsByID(ctx context.Context, req *QueryEventsByIDRequest, res *QueryEventsByIDResponse) error // Query to get state and auth chain for a (potentially hypothetical) event. // Takes lists of PrevEventIDs and AuthEventsIDs and uses them to calculate // the state and auth chain to return. QueryStateAndAuthChain(ctx context.Context, req *QueryStateAndAuthChainRequest, res *QueryStateAndAuthChainResponse) error // Query if we think we're still in a room. QueryServerJoinedToRoom(ctx context.Context, req *QueryServerJoinedToRoomRequest, res *QueryServerJoinedToRoomResponse) error QueryPublishedRooms(ctx context.Context, req *QueryPublishedRoomsRequest, res *QueryPublishedRoomsResponse) error // Query missing events for a room from roomserver QueryMissingEvents(ctx context.Context, req *QueryMissingEventsRequest, res *QueryMissingEventsResponse) error // Query whether a server is allowed to see an event QueryServerAllowedToSeeEvent(ctx context.Context, req *QueryServerAllowedToSeeEventRequest, res *QueryServerAllowedToSeeEventResponse) error QueryRoomsForUser(ctx context.Context, req *QueryRoomsForUserRequest, res *QueryRoomsForUserResponse) error QueryRestrictedJoinAllowed(ctx context.Context, req *QueryRestrictedJoinAllowedRequest, res *QueryRestrictedJoinAllowedResponse) error PerformInboundPeek(ctx context.Context, req *PerformInboundPeekRequest, res *PerformInboundPeekResponse) error PerformInvite(ctx context.Context, req *PerformInviteRequest, res *PerformInviteResponse) error // Query a given amount (or less) of events prior to a given set of events. PerformBackfill(ctx context.Context, req *PerformBackfillRequest, res *PerformBackfillResponse) error }
type GetAliasesForRoomIDRequest ¶
type GetAliasesForRoomIDRequest struct { // The room ID we want to find aliases for RoomID string `json:"room_id"` }
GetAliasesForRoomIDRequest is a request to GetAliasesForRoomID
type GetAliasesForRoomIDResponse ¶
type GetAliasesForRoomIDResponse struct { // The aliases the alias refers to Aliases []string `json:"aliases"` }
GetAliasesForRoomIDResponse is a response to GetAliasesForRoomID
type GetRoomIDForAliasRequest ¶
type GetRoomIDForAliasRequest struct { // Alias we want to lookup Alias string `json:"alias"` // Should we ask appservices for their aliases as a part of // the request? IncludeAppservices bool `json:"include_appservices"` }
GetRoomIDForAliasRequest is a request to GetRoomIDForAlias
type GetRoomIDForAliasResponse ¶
type GetRoomIDForAliasResponse struct { // The room ID the alias refers to RoomID string `json:"room_id"` }
GetRoomIDForAliasResponse is a response to GetRoomIDForAlias
type InputRoomEvent ¶
type InputRoomEvent struct { // Whether this event is new, backfilled or an outlier. // This controls how the event is processed. Kind Kind `json:"kind"` // The event JSON for the event to add. Event *gomatrixserverlib.HeaderedEvent `json:"event"` // Which server told us about this event. Origin gomatrixserverlib.ServerName `json:"origin"` // Whether the state is supplied as a list of event IDs or whether it // should be derived from the state at the previous events. HasState bool `json:"has_state"` // Optional list of state event IDs forming the state before this event. // These state events must have already been persisted. // These are only used if HasState is true. // The list can be empty, for example when storing the first event in a room. StateEventIDs []string `json:"state_event_ids"` // The server name to use to push this event to other servers. // Or empty if this event shouldn't be pushed to other servers. SendAsServer string `json:"send_as_server"` // The transaction ID of the send request if sent by a local user and one // was specified TransactionID *TransactionID `json:"transaction_id"` }
InputRoomEvent is a matrix room event to add to the room server database. TODO: Implement UnmarshalJSON/MarshalJSON in a way that does something sensible with the event JSON.
type InputRoomEventsAPI ¶
type InputRoomEventsAPI interface { InputRoomEvents( ctx context.Context, req *InputRoomEventsRequest, res *InputRoomEventsResponse, ) }
type InputRoomEventsRequest ¶
type InputRoomEventsRequest struct { InputRoomEvents []InputRoomEvent `json:"input_room_events"` Asynchronous bool `json:"async"` }
InputRoomEventsRequest is a request to InputRoomEvents
type InputRoomEventsResponse ¶
type InputRoomEventsResponse struct { ErrMsg string // set if there was any error NotAllowed bool // true if an event in the input was not allowed. }
InputRoomEventsResponse is a response to InputRoomEvents
func (*InputRoomEventsResponse) Err ¶
func (r *InputRoomEventsResponse) Err() error
type Kind ¶
type Kind int
const ( // KindOutlier event fall outside the contiguous event graph. // We do not have the state for these events. // These events are state events used to authenticate other events. // They can become part of the contiguous event graph via backfill. KindOutlier Kind = iota + 1 // KindNew event extend the contiguous graph going forwards. // They usually don't need state, but may include state if the // there was a new event that references an event that we don't // have a copy of. New events will influence the fwd extremities // of the room and output events will be generated as a result. KindNew // KindOld event extend the graph backwards, or fill gaps in // history. They may or may not include state. They will not be // considered for forward extremities, and output events will NOT // be generated for them. KindOld )
type OutputEvent ¶
type OutputEvent struct { // What sort of event this is. Type OutputType `json:"type"` // The content of event with type OutputTypeNewRoomEvent NewRoomEvent *OutputNewRoomEvent `json:"new_room_event,omitempty"` // The content of event with type OutputTypeOldRoomEvent OldRoomEvent *OutputOldRoomEvent `json:"old_room_event,omitempty"` // The content of event with type OutputTypeNewInviteEvent NewInviteEvent *OutputNewInviteEvent `json:"new_invite_event,omitempty"` // The content of event with type OutputTypeRetireInviteEvent RetireInviteEvent *OutputRetireInviteEvent `json:"retire_invite_event,omitempty"` // The content of event with type OutputTypeRedactedEvent RedactedEvent *OutputRedactedEvent `json:"redacted_event,omitempty"` // The content of event with type OutputTypeNewPeek NewPeek *OutputNewPeek `json:"new_peek,omitempty"` // The content of event with type OutputTypeNewInboundPeek NewInboundPeek *OutputNewInboundPeek `json:"new_inbound_peek,omitempty"` // The content of event with type OutputTypeRetirePeek RetirePeek *OutputRetirePeek `json:"retire_peek,omitempty"` }
An OutputEvent is an entry in the roomserver output kafka log. Consumers should check the type field when consuming this event.
type OutputNewInboundPeek ¶
type OutputNewInboundPeek struct { RoomID string PeekID string // the event ID at which the peek begins (so we can avoid // a race between tracking the state returned by /peek and emitting subsequent // peeked events) LatestEventID string ServerName gomatrixserverlib.ServerName // how often we told the peeking server to renew the peek RenewalInterval int64 }
An OutputNewInboundPeek is written whenever a server starts peeking into a room
type OutputNewInviteEvent ¶
type OutputNewInviteEvent struct { // The room version of the invited room. RoomVersion gomatrixserverlib.RoomVersion `json:"room_version"` // The "m.room.member" invite event. Event *gomatrixserverlib.HeaderedEvent `json:"event"` }
An OutputNewInviteEvent is written whenever an invite becomes active. Invite events can be received outside of an existing room so have to be tracked separately from the room events themselves.
type OutputNewPeek ¶
An OutputNewPeek is written whenever a user starts peeking into a room using a given device.
type OutputNewRoomEvent ¶
type OutputNewRoomEvent struct { // The Event. Event *gomatrixserverlib.HeaderedEvent `json:"event"` // Does the event completely rewrite the room state? If so, then AddsStateEventIDs // will contain the entire room state. RewritesState bool `json:"rewrites_state,omitempty"` // The latest events in the room after this event. // This can be used to set the prev events for new events in the room. // This also can be used to get the full current state after this event. LatestEventIDs []string `json:"latest_event_ids"` // The state event IDs that were added to the state of the room by this event. // Together with RemovesStateEventIDs this allows the receiver to keep an up to date // view of the current state of the room. AddsStateEventIDs []string `json:"adds_state_event_ids,omitempty"` // The state event IDs that were removed from the state of the room by this event. RemovesStateEventIDs []string `json:"removes_state_event_ids,omitempty"` // If the LastSentEventID doesn't match what they were expecting it to be // they can use the LatestEventIDs to request the full current state. LastSentEventID string `json:"last_sent_event_id"` // The state is given as a delta against the current state because they are // usually either the same state, or differ by just a couple of events. StateBeforeAddsEventIDs []string `json:"state_before_adds_event_ids,omitempty"` // The state event IDs that are part of the current state, but not part // of the state at the event. StateBeforeRemovesEventIDs []string `json:"state_before_removes_event_ids,omitempty"` // We encode the server name that the event should be sent using here to // future proof the API for virtual hosting. SendAsServer string `json:"send_as_server"` // The transaction ID of the send request if sent by a local user and one // was specified TransactionID *TransactionID `json:"transaction_id,omitempty"` // The history visibility of the event. HistoryVisibility gomatrixserverlib.HistoryVisibility `json:"history_visibility"` }
When we talk about state in a matrix room we are talking about the state after a list of events. The current state is the state after the latest event IDs in the room. The state before an event is the state after its prev_events.
func (*OutputNewRoomEvent) NeededStateEventIDs ¶
func (o *OutputNewRoomEvent) NeededStateEventIDs() ([]*gomatrixserverlib.HeaderedEvent, []string)
type OutputOldRoomEvent ¶
type OutputOldRoomEvent struct { // The Event. Event *gomatrixserverlib.HeaderedEvent `json:"event"` HistoryVisibility gomatrixserverlib.HistoryVisibility `json:"history_visibility"` }
Old events do not update forward extremities or the current room state, therefore they must not be treated as if they do. Downstream components should build their current room state up from OutputNewRoomEvents only.
type OutputRedactedEvent ¶
type OutputRedactedEvent struct { // The event ID that was redacted RedactedEventID string // The value of `unsigned.redacted_because` - the redaction event itself RedactedBecause *gomatrixserverlib.HeaderedEvent }
An OutputRedactedEvent is written whenever a redaction has been /validated/. Downstream components MUST redact the given event ID if they have stored the event JSON. It is guaranteed that this event ID has been seen before.
type OutputRetireInviteEvent ¶
type OutputRetireInviteEvent struct { // The ID of the "m.room.member" invite event. EventID string // The target user ID of the "m.room.member" invite event that was retired. TargetUserID string // Optional event ID of the event that replaced the invite. // This can be empty if the invite was rejected locally and we were unable // to reach the server that originally sent the invite. RetiredByEventID string // The "membership" of the user after retiring the invite. One of "join" // "leave" or "ban". Membership string }
An OutputRetireInviteEvent is written whenever an existing invite is no longer active. An invite stops being active if the user joins the room or if the invite is rejected by the user.
type OutputRetirePeek ¶
An OutputRetirePeek is written whenever a user stops peeking into a room.
type OutputRoomEventType ¶
type OutputRoomEventType int
Type of the OutputNewRoomEvent.
const ( // The event is a timeline event and likely just happened. OutputRoomTimeline OutputRoomEventType = iota // The event is a state event and quite possibly happened in the past. OutputRoomState )
type OutputType ¶
type OutputType string
An OutputType is a type of roomserver output.
const ( // OutputTypeNewRoomEvent indicates that the event is an OutputNewRoomEvent OutputTypeNewRoomEvent OutputType = "new_room_event" // OutputTypeOldRoomEvent indicates that the event is an OutputOldRoomEvent OutputTypeOldRoomEvent OutputType = "old_room_event" // OutputTypeNewInviteEvent indicates that the event is an OutputNewInviteEvent OutputTypeNewInviteEvent OutputType = "new_invite_event" // OutputTypeRetireInviteEvent indicates that the event is an OutputRetireInviteEvent OutputTypeRetireInviteEvent OutputType = "retire_invite_event" // In order to honour redactions correctly, downstream components must ignore m.room.redaction events emitted via OutputTypeNewRoomEvent. // When downstream components receive an OutputTypeRedactedEvent they must: // - Pull out the event to redact from the database. They should have this because the redaction is validated. // - Redact the event and set the corresponding `unsigned` fields to indicate it as redacted. // - Replace the event in the database. OutputTypeRedactedEvent OutputType = "redacted_event" // OutputTypeNewPeek indicates that the kafka event is an OutputNewPeek OutputTypeNewPeek OutputType = "new_peek" // OutputTypeNewInboundPeek indicates that the kafka event is an OutputNewInboundPeek OutputTypeNewInboundPeek OutputType = "new_inbound_peek" // OutputTypeRetirePeek indicates that the kafka event is an OutputRetirePeek OutputTypeRetirePeek OutputType = "retire_peek" )
type PerformAdminEvacuateRoomRequest ¶
type PerformAdminEvacuateRoomRequest struct {
RoomID string `json:"room_id"`
}
type PerformAdminEvacuateRoomResponse ¶
type PerformAdminEvacuateRoomResponse struct { Affected []string `json:"affected"` Error *PerformError }
type PerformAdminEvacuateUserRequest ¶
type PerformAdminEvacuateUserRequest struct {
UserID string `json:"user_id"`
}
type PerformAdminEvacuateUserResponse ¶
type PerformAdminEvacuateUserResponse struct { Affected []string `json:"affected"` Error *PerformError }
type PerformBackfillRequest ¶
type PerformBackfillRequest struct { // The room to backfill RoomID string `json:"room_id"` // A map of backwards extremity event ID to a list of its prev_event IDs. BackwardsExtremities map[string][]string `json:"backwards_extremities"` // The maximum number of events to retrieve. Limit int `json:"limit"` // The server interested in the events. ServerName gomatrixserverlib.ServerName `json:"server_name"` }
PerformBackfillRequest is a request to PerformBackfill.
func (*PerformBackfillRequest) PrevEventIDs ¶
func (r *PerformBackfillRequest) PrevEventIDs() []string
PrevEventIDs returns the prev_event IDs of all backwards extremities, de-duplicated in a lexicographically sorted order.
type PerformBackfillResponse ¶
type PerformBackfillResponse struct { // Missing events, arbritrary order. Events []*gomatrixserverlib.HeaderedEvent `json:"events"` }
PerformBackfillResponse is a response to PerformBackfill.
type PerformError ¶
type PerformError struct { Msg string RemoteCode int // remote HTTP status code, for PerformErrRemote Code PerformErrorCode }
func (*PerformError) Error ¶
func (p *PerformError) Error() string
func (*PerformError) JSONResponse ¶
func (p *PerformError) JSONResponse() util.JSONResponse
JSONResponse maps error codes to suitable HTTP error codes, defaulting to 500.
type PerformErrorCode ¶
type PerformErrorCode int
const ( // PerformErrorNotAllowed means the user is not allowed to invite/join/etc this room (e.g join_rule:invite or banned) PerformErrorNotAllowed PerformErrorCode = 1 // PerformErrorBadRequest means the request was wrong in some way (invalid user ID, wrong server, etc) PerformErrorBadRequest PerformErrorCode = 2 // PerformErrorNoRoom means that the room being joined doesn't exist. PerformErrorNoRoom PerformErrorCode = 3 // PerformErrorNoOperation means that the request resulted in nothing happening e.g invite->invite or leave->leave. PerformErrorNoOperation PerformErrorCode = 4 // PerformErrRemote means that the request failed and the PerformError.Msg is the raw remote JSON error response PerformErrRemote PerformErrorCode = 5 )
type PerformForgetRequest ¶
PerformForgetRequest is a request to PerformForget
type PerformForgetResponse ¶
type PerformForgetResponse struct{}
type PerformInboundPeekRequest ¶
type PerformInboundPeekRequest struct { UserID string `json:"user_id"` RoomID string `json:"room_id"` PeekID string `json:"peek_id"` ServerName gomatrixserverlib.ServerName `json:"server_name"` RenewalInterval int64 `json:"renewal_interval"` }
type PerformInboundPeekResponse ¶
type PerformInboundPeekResponse 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 current state and auth chain events. // The lists will be in an arbitrary order. StateEvents []*gomatrixserverlib.HeaderedEvent `json:"state_events"` AuthChainEvents []*gomatrixserverlib.HeaderedEvent `json:"auth_chain_events"` // The event at which this state was captured LatestEvent *gomatrixserverlib.HeaderedEvent `json:"latest_event"` }
type PerformInviteRequest ¶
type PerformInviteRequest struct { RoomVersion gomatrixserverlib.RoomVersion `json:"room_version"` Event *gomatrixserverlib.HeaderedEvent `json:"event"` InviteRoomState []gomatrixserverlib.InviteV2StrippedState `json:"invite_room_state"` SendAsServer string `json:"send_as_server"` TransactionID *TransactionID `json:"transaction_id"` }
type PerformInviteResponse ¶
type PerformInviteResponse struct {
Error *PerformError
}
type PerformJoinRequest ¶
type PerformJoinRequest struct { RoomIDOrAlias string `json:"room_id_or_alias"` UserID string `json:"user_id"` Content map[string]interface{} `json:"content"` ServerNames []gomatrixserverlib.ServerName `json:"server_names"` }
type PerformJoinResponse ¶
type PerformJoinResponse struct { // The room ID, populated on success. RoomID string `json:"room_id"` JoinedVia gomatrixserverlib.ServerName // If non-nil, the join request failed. Contains more information why it failed. Error *PerformError }
type PerformLeaveRequest ¶
type PerformLeaveResponse ¶
type PerformLeaveResponse struct { Code int `json:"code,omitempty"` Message interface{} `json:"message,omitempty"` }
type PerformPeekRequest ¶
type PerformPeekRequest struct { RoomIDOrAlias string `json:"room_id_or_alias"` UserID string `json:"user_id"` DeviceID string `json:"device_id"` ServerNames []gomatrixserverlib.ServerName `json:"server_names"` }
type PerformPeekResponse ¶
type PerformPeekResponse struct { // The room ID, populated on success. RoomID string `json:"room_id"` // If non-nil, the join request failed. Contains more information why it failed. Error *PerformError }
type PerformPublishRequest ¶
type PerformPublishResponse ¶
type PerformPublishResponse struct { // If non-nil, the publish request failed. Contains more information why it failed. Error *PerformError }
type PerformRoomUpgradeRequest ¶
type PerformRoomUpgradeRequest struct { RoomID string `json:"room_id"` UserID string `json:"user_id"` RoomVersion gomatrixserverlib.RoomVersion `json:"room_version"` }
type PerformRoomUpgradeResponse ¶
type PerformRoomUpgradeResponse struct { NewRoomID string Error *PerformError }
type PerformUnpeekRequest ¶
type PerformUnpeekResponse ¶
type PerformUnpeekResponse struct { // If non-nil, the join request failed. Contains more information why it failed. Error *PerformError }
type QueryAuthChainRequest ¶
type QueryAuthChainRequest struct {
EventIDs []string
}
type QueryAuthChainResponse ¶
type QueryAuthChainResponse struct {
AuthChain []*gomatrixserverlib.HeaderedEvent
}
type QueryBulkStateContentAPI ¶
type QueryBulkStateContentAPI interface {
QueryBulkStateContent(ctx context.Context, req *QueryBulkStateContentRequest, res *QueryBulkStateContentResponse) error
}
QueryBulkStateContent does a bulk query for state event content in the given rooms.
type QueryBulkStateContentRequest ¶
type QueryBulkStateContentRequest struct { // Returns state events in these rooms RoomIDs []string // If true, treats the '*' StateKey as "all state events of this type" rather than a literal value of '*' AllowWildcards bool // The state events to return. Only a small subset of tuples are allowed in this request as only certain events // have their content fields extracted. Specifically, the tuple Type must be one of: // m.room.avatar // m.room.create // m.room.canonical_alias // m.room.guest_access // m.room.history_visibility // m.room.join_rules // m.room.member // m.room.name // m.room.topic // Any other tuple type will result in the query failing. StateTuples []gomatrixserverlib.StateKeyTuple }
type QueryBulkStateContentResponse ¶
type QueryBulkStateContentResponse struct { // map of room ID -> tuple -> content_value Rooms map[string]map[gomatrixserverlib.StateKeyTuple]string }
func (*QueryBulkStateContentResponse) MarshalJSON ¶
func (r *QueryBulkStateContentResponse) MarshalJSON() ([]byte, error)
MarshalJSON stringifies the room ID and StateKeyTuple keys so they can be sent over the wire in HTTP API mode.
func (*QueryBulkStateContentResponse) UnmarshalJSON ¶
func (r *QueryBulkStateContentResponse) UnmarshalJSON(data []byte) error
type QueryCurrentStateRequest ¶
type QueryCurrentStateRequest struct { RoomID string AllowWildcards bool // State key tuples. If a state_key has '*' and AllowWidlcards is true, returns all matching // state events with that event type. StateTuples []gomatrixserverlib.StateKeyTuple }
type QueryCurrentStateResponse ¶
type QueryCurrentStateResponse struct {
StateEvents map[gomatrixserverlib.StateKeyTuple]*gomatrixserverlib.HeaderedEvent
}
func (*QueryCurrentStateResponse) MarshalJSON ¶
func (r *QueryCurrentStateResponse) MarshalJSON() ([]byte, error)
MarshalJSON stringifies the StateKeyTuple keys so they can be sent over the wire in HTTP API mode.
func (*QueryCurrentStateResponse) UnmarshalJSON ¶
func (r *QueryCurrentStateResponse) UnmarshalJSON(data []byte) error
type QueryEventsAPI ¶
type QueryEventsAPI interface { // Query a list of events by event ID. QueryEventsByID( ctx context.Context, req *QueryEventsByIDRequest, res *QueryEventsByIDResponse, ) error // QueryCurrentState retrieves the requested state events. If state events are not found, they will be missing from // the response. QueryCurrentState(ctx context.Context, req *QueryCurrentStateRequest, res *QueryCurrentStateResponse) error }
type QueryEventsByIDRequest ¶
type QueryEventsByIDRequest struct { // The event IDs to look up. EventIDs []string `json:"event_ids"` }
QueryEventsByIDRequest is a request to QueryEventsByID
type QueryEventsByIDResponse ¶
type QueryEventsByIDResponse struct { // A list of events with the requested IDs. // If the roomserver does not have a copy of a requested event // then it will omit that event from the list. // If the roomserver thinks it has a copy of the event, but // fails to read it from the database then it will fail // the entire request. // This list will be in an arbitrary order. Events []*gomatrixserverlib.HeaderedEvent `json:"events"` }
QueryEventsByIDResponse is a response to QueryEventsByID
type QueryKnownUsersRequest ¶
type QueryKnownUsersResponse ¶
type QueryKnownUsersResponse struct {
Users []authtypes.FullyQualifiedProfile `json:"profiles"`
}
type QueryLatestEventsAndStateAPI ¶
type QueryLatestEventsAndStateAPI interface {
QueryLatestEventsAndState(ctx context.Context, req *QueryLatestEventsAndStateRequest, res *QueryLatestEventsAndStateResponse) error
}
Query the latest events and state for a room from the room server.
type QueryLatestEventsAndStateRequest ¶
type QueryLatestEventsAndStateRequest struct { // The room ID to query the latest events for. RoomID string `json:"room_id"` // The state key tuples to fetch from the room current state. // If this list is empty or nil then *ALL* current state events are returned. StateToFetch []gomatrixserverlib.StateKeyTuple `json:"state_to_fetch"` }
QueryLatestEventsAndStateRequest is a request to QueryLatestEventsAndState
type QueryLatestEventsAndStateResponse ¶
type QueryLatestEventsAndStateResponse struct { // Does the room exist? // If the room doesn't exist this will be false and LatestEvents will be empty. RoomExists bool `json:"room_exists"` // The room version of the room. RoomVersion gomatrixserverlib.RoomVersion `json:"room_version"` // The latest events in the room. // These are used to set the prev_events when sending an event. LatestEvents []gomatrixserverlib.EventReference `json:"latest_events"` // The state events requested. // This list will be in an arbitrary order. // These are used to set the auth_events when sending an event. // These are used to check whether the event is allowed. StateEvents []*gomatrixserverlib.HeaderedEvent `json:"state_events"` // The depth of the latest events. // This is one greater than the maximum depth of the latest events. // This is used to set the depth when sending an event. Depth int64 `json:"depth"` }
QueryLatestEventsAndStateResponse is a response to QueryLatestEventsAndState This is used when sending events to set the prev_events, auth_events and depth. It is also used to tell whether the event is allowed by the event auth rules.
type QueryMembershipForUserRequest ¶
type QueryMembershipForUserRequest struct { // ID of the room to fetch membership from RoomID string `json:"room_id"` // ID of the user for whom membership is requested UserID string `json:"user_id"` }
QueryMembershipForUserRequest is a request to QueryMembership
type QueryMembershipForUserResponse ¶
type QueryMembershipForUserResponse struct { // The EventID of the latest "m.room.member" event for the sender, // if HasBeenInRoom is true. EventID string `json:"event_id"` // True if the user has been in room before and has either stayed in it or left it. HasBeenInRoom bool `json:"has_been_in_room"` // True if the user is in room. IsInRoom bool `json:"is_in_room"` // The current membership Membership string `json:"membership"` // True if the user asked to forget this room. IsRoomForgotten bool `json:"is_room_forgotten"` RoomExists bool `json:"room_exists"` }
QueryMembershipForUserResponse is a response to QueryMembership
type QueryMembershipsForRoomRequest ¶
type QueryMembershipsForRoomRequest struct { // If true, only returns the membership events of "join" membership JoinedOnly bool `json:"joined_only"` // If true, only returns the membership events of local users LocalOnly bool `json:"local_only"` // ID of the room to fetch memberships from RoomID string `json:"room_id"` // Optional - ID of the user sending the request, for checking if the // user is allowed to see the memberships. If not specified then all // room memberships will be returned. Sender string `json:"sender"` }
QueryMembershipsForRoomRequest is a request to QueryMembershipsForRoom
type QueryMembershipsForRoomResponse ¶
type QueryMembershipsForRoomResponse struct { // The "m.room.member" events (of "join" membership) in the client format JoinEvents []gomatrixserverlib.ClientEvent `json:"join_events"` // True if the user has been in room before and has either stayed in it or // left it. HasBeenInRoom bool `json:"has_been_in_room"` // True if the user asked to forget this room. IsRoomForgotten bool `json:"is_room_forgotten"` }
QueryMembershipsForRoomResponse is a response to QueryMembershipsForRoom
type QueryMissingEventsRequest ¶
type QueryMissingEventsRequest struct { // Events which are known previous to the gap in the timeline. EarliestEvents []string `json:"earliest_events"` // Latest known events. LatestEvents []string `json:"latest_events"` // Limit the number of events this query returns. Limit int `json:"limit"` // The server interested in the event ServerName gomatrixserverlib.ServerName `json:"server_name"` }
QueryMissingEventsRequest is a request to QueryMissingEvents
type QueryMissingEventsResponse ¶
type QueryMissingEventsResponse struct { // Missing events, arbritrary order. Events []*gomatrixserverlib.HeaderedEvent `json:"events"` }
QueryMissingEventsResponse is a response to QueryMissingEvents
type QueryPublishedRoomsRequest ¶
type QueryPublishedRoomsRequest struct { // Optional. If specified, returns whether this room is published or not. RoomID string }
type QueryPublishedRoomsResponse ¶
type QueryPublishedRoomsResponse struct { // The list of published rooms. RoomIDs []string }
type QueryRestrictedJoinAllowedResponse ¶
type QueryRestrictedJoinAllowedResponse struct { // True if the room membership is restricted by the join rule being set to "restricted" Restricted bool `json:"restricted"` // True if our local server is joined to all of the allowed rooms specified in the "allow" // key of the join rule, false if we are missing from some of them and therefore can't // reliably decide whether or not we can satisfy the join Resident bool `json:"resident"` // True if the restricted join is allowed because we found the membership in one of the // allowed rooms from the join rule, false if not Allowed bool `json:"allowed"` // Contains the user ID of the selected user ID that has power to issue invites, this will // get populated into the "join_authorised_via_users_server" content in the membership AuthorisedVia string `json:"authorised_via,omitempty"` }
type QueryRoomVersionCapabilitiesRequest ¶
type QueryRoomVersionCapabilitiesRequest struct{}
QueryRoomVersionCapabilitiesRequest asks for the default room version
type QueryRoomVersionCapabilitiesResponse ¶
type QueryRoomVersionCapabilitiesResponse struct { DefaultRoomVersion gomatrixserverlib.RoomVersion `json:"default"` AvailableRoomVersions map[gomatrixserverlib.RoomVersion]string `json:"available"` }
QueryRoomVersionCapabilitiesResponse is a response to QueryRoomVersionCapabilitiesRequest
type QueryRoomVersionForRoomRequest ¶
type QueryRoomVersionForRoomRequest struct {
RoomID string `json:"room_id"`
}
QueryRoomVersionForRoomRequest asks for the room version for a given room.
type QueryRoomVersionForRoomResponse ¶
type QueryRoomVersionForRoomResponse struct {
RoomVersion gomatrixserverlib.RoomVersion `json:"room_version"`
}
QueryRoomVersionForRoomResponse is a response to QueryRoomVersionForRoomRequest
type QueryRoomsForUserResponse ¶
type QueryRoomsForUserResponse struct {
RoomIDs []string
}
type QueryServerAllowedToSeeEventRequest ¶
type QueryServerAllowedToSeeEventRequest struct { // The event ID to look up invites in. EventID string `json:"event_id"` // The server interested in the event ServerName gomatrixserverlib.ServerName `json:"server_name"` }
QueryServerAllowedToSeeEventRequest is a request to QueryServerAllowedToSeeEvent
type QueryServerAllowedToSeeEventResponse ¶
type QueryServerAllowedToSeeEventResponse struct { // Wether the server in question is allowed to see the event AllowedToSeeEvent bool `json:"can_see_event"` }
QueryServerAllowedToSeeEventResponse is a response to QueryServerAllowedToSeeEvent
type QueryServerBannedFromRoomRequest ¶
type QueryServerBannedFromRoomRequest struct { ServerName gomatrixserverlib.ServerName `json:"server_name"` RoomID string `json:"room_id"` }
type QueryServerBannedFromRoomResponse ¶
type QueryServerBannedFromRoomResponse struct {
Banned bool `json:"banned"`
}
type QueryServerJoinedToRoomRequest ¶
type QueryServerJoinedToRoomRequest struct { // Server name of the server to find. If not specified, we will // default to checking if the local server is joined. ServerName gomatrixserverlib.ServerName `json:"server_name"` // ID of the room to see if we are still joined to RoomID string `json:"room_id"` }
QueryServerJoinedToRoomRequest is a request to QueryServerJoinedToRoom
type QueryServerJoinedToRoomResponse ¶
type QueryServerJoinedToRoomResponse struct { // True if the room exists on the server RoomExists bool `json:"room_exists"` // True if we still believe that the server is participating in the room IsInRoom bool `json:"is_in_room"` }
QueryMembershipsForRoomResponse is a response to QueryServerJoinedToRoom
type QuerySharedUsersRequest ¶
type QuerySharedUsersRequest struct {}
type QuerySharedUsersResponse ¶
type QuerySharedUsersResponse struct {
}type QueryStateAfterEventsRequest ¶
type QueryStateAfterEventsRequest struct { // The room ID to query the state in. RoomID string `json:"room_id"` // The list of previous events to return the events after. PrevEventIDs []string `json:"prev_event_ids"` // The state key tuples to fetch from the state. If none are specified then // the entire resolved room state will be returned. StateToFetch []gomatrixserverlib.StateKeyTuple `json:"state_to_fetch"` }
QueryStateAfterEventsRequest is a request to QueryStateAfterEvents
type QueryStateAfterEventsResponse ¶
type QueryStateAfterEventsResponse 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"` // Do all the previous events exist on this roomserver? // If some of previous events do not exist this will be false and StateEvents will be empty. PrevEventsExist bool `json:"prev_events_exist"` // The state events requested. // This list will be in an arbitrary order. StateEvents []*gomatrixserverlib.HeaderedEvent `json:"state_events"` }
QueryStateAfterEventsResponse is a response to QueryStateAfterEvents
type QueryStateAndAuthChainRequest ¶
type QueryStateAndAuthChainRequest 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"` // The list of auth events for the event. Used to calculate the auth chain AuthEventIDs []string `json:"auth_event_ids"` // If true, the auth chain events for the auth event IDs given will be fetched only. Prev event IDs are ignored. // If false, state and auth chain events for the prev event IDs and entire current state will be included. // TODO: not a great API shape. It serves 2 main uses: false=>response for send_join, true=>response for /event_auth OnlyFetchAuthChain bool `json:"only_fetch_auth_chain"` // Should state resolution be ran on the result events? // TODO: check call sites and remove if we always want to do state res ResolveState bool `json:"resolve_state"` }
QueryStateAndAuthChainRequest is a request to QueryStateAndAuthChain
type QueryStateAndAuthChainResponse ¶
type QueryStateAndAuthChainResponse 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"` // Do all the previous events exist on this roomserver? // If some of previous events do not exist this will be false and StateEvents will be empty. PrevEventsExist bool `json:"prev_events_exist"` // The state and auth chain events that were requested. // The lists will be in an arbitrary order. StateEvents []*gomatrixserverlib.HeaderedEvent `json:"state_events"` AuthChainEvents []*gomatrixserverlib.HeaderedEvent `json:"auth_chain_events"` // True if the queried event was rejected earlier. IsRejected bool `json:"is_rejected"` }
QueryStateAndAuthChainResponse is a response to QueryStateAndAuthChain
type RemoveRoomAliasRequest ¶
type RemoveRoomAliasRequest struct { // ID of the user removing the alias UserID string `json:"user_id"` // The room alias to remove Alias string `json:"alias"` }
RemoveRoomAliasRequest is a request to RemoveRoomAlias
type RemoveRoomAliasResponse ¶
type RemoveRoomAliasResponse struct { // Did the alias exist before? Found bool `json:"found"` // Did we remove it? Removed bool `json:"removed"` }
RemoveRoomAliasResponse is a response to RemoveRoomAlias
type RoomserverInternalAPI ¶
type RoomserverInternalAPI interface { SyncRoomserverAPI AppserviceRoomserverAPI ClientRoomserverAPI UserRoomserverAPI FederationRoomserverAPI // needed to avoid chicken and egg scenario when setting up the // interdependencies between the roomserver and other input APIs SetFederationAPI(fsAPI fsAPI.RoomserverFederationAPI, keyRing *gomatrixserverlib.KeyRing) SetAppserviceAPI(asAPI asAPI.AppServiceInternalAPI) SetUserAPI(userAPI userapi.RoomserverUserAPI) // QueryAuthChain returns the entire auth chain for the event IDs given. // The response includes the events in the request. // Omits without error for any missing auth events. There will be no duplicates. // Used in MSC2836. QueryAuthChain( ctx context.Context, req *QueryAuthChainRequest, res *QueryAuthChainResponse, ) error }
RoomserverInputAPI is used to write events to the room server.
type RoomserverInternalAPITrace ¶
type RoomserverInternalAPITrace struct {
Impl RoomserverInternalAPI
}
RoomserverInternalAPITrace wraps a RoomserverInternalAPI and logs the complete request/response/error
func (*RoomserverInternalAPITrace) GetAliasesForRoomID ¶
func (t *RoomserverInternalAPITrace) GetAliasesForRoomID( ctx context.Context, req *GetAliasesForRoomIDRequest, res *GetAliasesForRoomIDResponse, ) error
func (*RoomserverInternalAPITrace) GetRoomIDForAlias ¶
func (t *RoomserverInternalAPITrace) GetRoomIDForAlias( ctx context.Context, req *GetRoomIDForAliasRequest, res *GetRoomIDForAliasResponse, ) error
func (*RoomserverInternalAPITrace) InputRoomEvents ¶
func (t *RoomserverInternalAPITrace) InputRoomEvents( ctx context.Context, req *InputRoomEventsRequest, res *InputRoomEventsResponse, )
func (*RoomserverInternalAPITrace) PerformAdminEvacuateRoom ¶
func (t *RoomserverInternalAPITrace) PerformAdminEvacuateRoom( ctx context.Context, req *PerformAdminEvacuateRoomRequest, res *PerformAdminEvacuateRoomResponse, )
func (*RoomserverInternalAPITrace) PerformAdminEvacuateUser ¶
func (t *RoomserverInternalAPITrace) PerformAdminEvacuateUser( ctx context.Context, req *PerformAdminEvacuateUserRequest, res *PerformAdminEvacuateUserResponse, )
func (*RoomserverInternalAPITrace) PerformBackfill ¶
func (t *RoomserverInternalAPITrace) PerformBackfill( ctx context.Context, req *PerformBackfillRequest, res *PerformBackfillResponse, ) error
func (*RoomserverInternalAPITrace) PerformForget ¶
func (t *RoomserverInternalAPITrace) PerformForget( ctx context.Context, req *PerformForgetRequest, res *PerformForgetResponse, ) error
func (*RoomserverInternalAPITrace) PerformInboundPeek ¶
func (t *RoomserverInternalAPITrace) PerformInboundPeek( ctx context.Context, req *PerformInboundPeekRequest, res *PerformInboundPeekResponse, ) error
func (*RoomserverInternalAPITrace) PerformInvite ¶
func (t *RoomserverInternalAPITrace) PerformInvite( ctx context.Context, req *PerformInviteRequest, res *PerformInviteResponse, ) error
func (*RoomserverInternalAPITrace) PerformJoin ¶
func (t *RoomserverInternalAPITrace) PerformJoin( ctx context.Context, req *PerformJoinRequest, res *PerformJoinResponse, )
func (*RoomserverInternalAPITrace) PerformLeave ¶
func (t *RoomserverInternalAPITrace) PerformLeave( ctx context.Context, req *PerformLeaveRequest, res *PerformLeaveResponse, ) error
func (*RoomserverInternalAPITrace) PerformPeek ¶
func (t *RoomserverInternalAPITrace) PerformPeek( ctx context.Context, req *PerformPeekRequest, res *PerformPeekResponse, )
func (*RoomserverInternalAPITrace) PerformPublish ¶
func (t *RoomserverInternalAPITrace) PerformPublish( ctx context.Context, req *PerformPublishRequest, res *PerformPublishResponse, )
func (*RoomserverInternalAPITrace) PerformRoomUpgrade ¶
func (t *RoomserverInternalAPITrace) PerformRoomUpgrade( ctx context.Context, req *PerformRoomUpgradeRequest, res *PerformRoomUpgradeResponse, )
func (*RoomserverInternalAPITrace) PerformUnpeek ¶
func (t *RoomserverInternalAPITrace) PerformUnpeek( ctx context.Context, req *PerformUnpeekRequest, res *PerformUnpeekResponse, )
func (*RoomserverInternalAPITrace) QueryAuthChain ¶
func (t *RoomserverInternalAPITrace) QueryAuthChain( ctx context.Context, request *QueryAuthChainRequest, response *QueryAuthChainResponse, ) error
func (*RoomserverInternalAPITrace) QueryBulkStateContent ¶
func (t *RoomserverInternalAPITrace) QueryBulkStateContent(ctx context.Context, req *QueryBulkStateContentRequest, res *QueryBulkStateContentResponse) error
QueryBulkStateContent does a bulk query for state event content in the given rooms.
func (*RoomserverInternalAPITrace) QueryCurrentState ¶
func (t *RoomserverInternalAPITrace) QueryCurrentState(ctx context.Context, req *QueryCurrentStateRequest, res *QueryCurrentStateResponse) error
func (*RoomserverInternalAPITrace) QueryEventsByID ¶
func (t *RoomserverInternalAPITrace) QueryEventsByID( ctx context.Context, req *QueryEventsByIDRequest, res *QueryEventsByIDResponse, ) error
func (*RoomserverInternalAPITrace) QueryKnownUsers ¶
func (t *RoomserverInternalAPITrace) QueryKnownUsers(ctx context.Context, req *QueryKnownUsersRequest, res *QueryKnownUsersResponse) error
QueryKnownUsers returns a list of users that we know about from our joined rooms.
func (*RoomserverInternalAPITrace) QueryLatestEventsAndState ¶
func (t *RoomserverInternalAPITrace) QueryLatestEventsAndState( ctx context.Context, req *QueryLatestEventsAndStateRequest, res *QueryLatestEventsAndStateResponse, ) error
func (*RoomserverInternalAPITrace) QueryMembershipForUser ¶
func (t *RoomserverInternalAPITrace) QueryMembershipForUser( ctx context.Context, req *QueryMembershipForUserRequest, res *QueryMembershipForUserResponse, ) error
func (*RoomserverInternalAPITrace) QueryMembershipsForRoom ¶
func (t *RoomserverInternalAPITrace) QueryMembershipsForRoom( ctx context.Context, req *QueryMembershipsForRoomRequest, res *QueryMembershipsForRoomResponse, ) error
func (*RoomserverInternalAPITrace) QueryMissingEvents ¶
func (t *RoomserverInternalAPITrace) QueryMissingEvents( ctx context.Context, req *QueryMissingEventsRequest, res *QueryMissingEventsResponse, ) error
func (*RoomserverInternalAPITrace) QueryPublishedRooms ¶
func (t *RoomserverInternalAPITrace) QueryPublishedRooms( ctx context.Context, req *QueryPublishedRoomsRequest, res *QueryPublishedRoomsResponse, ) error
func (*RoomserverInternalAPITrace) QueryRestrictedJoinAllowed ¶
func (t *RoomserverInternalAPITrace) QueryRestrictedJoinAllowed( ctx context.Context, request *QueryRestrictedJoinAllowedRequest, response *QueryRestrictedJoinAllowedResponse, ) error
func (*RoomserverInternalAPITrace) QueryRoomVersionCapabilities ¶
func (t *RoomserverInternalAPITrace) QueryRoomVersionCapabilities( ctx context.Context, req *QueryRoomVersionCapabilitiesRequest, res *QueryRoomVersionCapabilitiesResponse, ) error
func (*RoomserverInternalAPITrace) QueryRoomVersionForRoom ¶
func (t *RoomserverInternalAPITrace) QueryRoomVersionForRoom( ctx context.Context, req *QueryRoomVersionForRoomRequest, res *QueryRoomVersionForRoomResponse, ) error
func (*RoomserverInternalAPITrace) QueryRoomsForUser ¶
func (t *RoomserverInternalAPITrace) QueryRoomsForUser(ctx context.Context, req *QueryRoomsForUserRequest, res *QueryRoomsForUserResponse) error
QueryRoomsForUser retrieves a list of room IDs matching the given query.
func (*RoomserverInternalAPITrace) QueryServerAllowedToSeeEvent ¶
func (t *RoomserverInternalAPITrace) QueryServerAllowedToSeeEvent( ctx context.Context, req *QueryServerAllowedToSeeEventRequest, res *QueryServerAllowedToSeeEventResponse, ) error
func (*RoomserverInternalAPITrace) QueryServerBannedFromRoom ¶
func (t *RoomserverInternalAPITrace) QueryServerBannedFromRoom(ctx context.Context, req *QueryServerBannedFromRoomRequest, res *QueryServerBannedFromRoomResponse) error
QueryServerBannedFromRoom returns whether a server is banned from a room by server ACLs.
func (*RoomserverInternalAPITrace) QueryServerJoinedToRoom ¶
func (t *RoomserverInternalAPITrace) QueryServerJoinedToRoom( ctx context.Context, req *QueryServerJoinedToRoomRequest, res *QueryServerJoinedToRoomResponse, ) error
func (*RoomserverInternalAPITrace) QuerySharedUsers ¶
func (t *RoomserverInternalAPITrace) QuerySharedUsers(ctx context.Context, req *QuerySharedUsersRequest, res *QuerySharedUsersResponse) error
QuerySharedUsers returns a list of users who share at least 1 room in common with the given user.
func (*RoomserverInternalAPITrace) QueryStateAfterEvents ¶
func (t *RoomserverInternalAPITrace) QueryStateAfterEvents( ctx context.Context, req *QueryStateAfterEventsRequest, res *QueryStateAfterEventsResponse, ) error
func (*RoomserverInternalAPITrace) QueryStateAndAuthChain ¶
func (t *RoomserverInternalAPITrace) QueryStateAndAuthChain( ctx context.Context, req *QueryStateAndAuthChainRequest, res *QueryStateAndAuthChainResponse, ) error
func (*RoomserverInternalAPITrace) RemoveRoomAlias ¶
func (t *RoomserverInternalAPITrace) RemoveRoomAlias( ctx context.Context, req *RemoveRoomAliasRequest, res *RemoveRoomAliasResponse, ) error
func (*RoomserverInternalAPITrace) SetAppserviceAPI ¶
func (t *RoomserverInternalAPITrace) SetAppserviceAPI(asAPI asAPI.AppServiceInternalAPI)
func (*RoomserverInternalAPITrace) SetFederationAPI ¶
func (t *RoomserverInternalAPITrace) SetFederationAPI(fsAPI fsAPI.RoomserverFederationAPI, keyRing *gomatrixserverlib.KeyRing)
func (*RoomserverInternalAPITrace) SetRoomAlias ¶
func (t *RoomserverInternalAPITrace) SetRoomAlias( ctx context.Context, req *SetRoomAliasRequest, res *SetRoomAliasResponse, ) error
func (*RoomserverInternalAPITrace) SetUserAPI ¶
func (t *RoomserverInternalAPITrace) SetUserAPI(userAPI userapi.RoomserverUserAPI)
type SetRoomAliasRequest ¶
type SetRoomAliasRequest struct { // ID of the user setting the alias UserID string `json:"user_id"` // New alias for the room Alias string `json:"alias"` // The room ID the alias is referring to RoomID string `json:"room_id"` }
SetRoomAliasRequest is a request to SetRoomAlias
type SetRoomAliasResponse ¶
type SetRoomAliasResponse struct { // Does the alias already refer to a room? AliasExists bool `json:"alias_exists"` }
SetRoomAliasResponse is a response to SetRoomAlias
type SyncRoomserverAPI ¶
type SyncRoomserverAPI interface { QueryLatestEventsAndStateAPI QueryBulkStateContentAPI QuerySharedUsers(ctx context.Context, req *QuerySharedUsersRequest, res *QuerySharedUsersResponse) error // Query a list of events by event ID. QueryEventsByID( ctx context.Context, req *QueryEventsByIDRequest, res *QueryEventsByIDResponse, ) error // Query the membership event for an user for a room. QueryMembershipForUser( ctx context.Context, req *QueryMembershipForUserRequest, res *QueryMembershipForUserResponse, ) error // Query the state after a list of events in a room from the room server. QueryStateAfterEvents( ctx context.Context, req *QueryStateAfterEventsRequest, res *QueryStateAfterEventsResponse, ) error // Query a given amount (or less) of events prior to a given set of events. PerformBackfill( ctx context.Context, req *PerformBackfillRequest, res *PerformBackfillResponse, ) error }
API functions required by the syncapi
type TransactionID ¶
TransactionID contains the transaction ID sent by a client when sending an event, along with the ID of the client session.
type UserRoomserverAPI ¶
type UserRoomserverAPI interface { QueryLatestEventsAndStateAPI QueryCurrentState(ctx context.Context, req *QueryCurrentStateRequest, res *QueryCurrentStateResponse) error QueryMembershipsForRoom(ctx context.Context, req *QueryMembershipsForRoomRequest, res *QueryMembershipsForRoomResponse) error PerformAdminEvacuateUser(ctx context.Context, req *PerformAdminEvacuateUserRequest, res *PerformAdminEvacuateUserResponse) }