Matrix/entities/event/event.go
2020-10-11 23:11:30 +02:00

123 lines
4 KiB
Go

package event
type Event struct {
Id string `json:"event_id,omitempty"`
RoomId string `json:"room_id,omitempty"`
Sender string `json:"sender,omitempty"`
Origin string `json:"origin,omitempty"`
Timestamp int64 `json:"origin_server_ts,omitempty"`
EventType string `json:"type,omitempty"`
StateKey string `json:"state_key,omitempty"`
Content string `json:"content,omitempty"`
PrevEventHashes map[string]EventHash `json:"prev_events,omitempty"`
Depth int `json:"depth,omitempty"`
AuthEventHashes map[string]EventHash `json:"auth_events,omitempty"`
Unsigned UnsignedData `json:"unsigned,omitempty"`
Hashes EventHash `json:"hashes,omitempty"`
Signatures map[string]map[string]string `json:"signatures,omitempty"`
}
type StateEvent struct {
EventType string `json:"type,omitempty"`
StateKey string `json:"state_key,omitempty"`
Content string `json:"content,omitempty"`
}
type UnsignedData struct {
Age int `json:"age,omitempty"`
TransactionId string `json:"transaction_id,omitempty"`
ReplaceState string `json:"replaces_state,omitempty"`
PrevSender string `json:"prev_sender,omitempty"`
PrevContent string `json:"prev_content,omitempty"`
RedactedBecause string `json:"redacted_because,omitempty"`
}
type EventHash struct {
SHA256 string `json:"sha256,omitempty"`
}
type CreateEventContent struct {
Creator string `json:"creator,omitempty"`
Federated bool `json:"m.federate,omitempty"`
RoomVersion string `json:"room_version,omitempty"`
}
type JoinRuleEventContent struct {
JoinRule string `json:"join_rule,omitempty"`
}
type HistoryVisibilityEventContent struct {
HistoryVisibility string `json:"history_visibility,omitempty"`
}
type GuestAccessEventContent struct {
GuestAccess string `json:"guest_access,omitempty"`
}
type NameEventContent struct {
Name string `json:"name,omitempty"`
}
type TopicEventContent struct {
Topic string `json:"topic,omitempty"`
}
type MemberEventContent struct {
AvatarUrl string `json:"avatar_url,omitempty"`
DisplayName string `json:"displayname,omitempty"`
Membership string `json:"membership,omitempty"`
IsDirect bool `json:"is_direct,omitempty"`
}
type PowerLevelsEventContent struct {
Ban int `json:"ban,omitempty"`
Events map[string]int `json:"events,omitempty"`
EventsDefault int `json:"events_default,omitempty"`
Invite int `json:"invite,omitempty"`
Kick int `json:"kick,omitempty"`
Redact int `json:"redact,omitempty"`
StateDefault int `json:"state_default,omitempty"`
Users map[string]int `json:"users,omitempty"`
UsersDefault int `json:"users_default,omitempty"`
Notifications Notifications `json:"notifications,omitempty"`
}
type Notifications struct {
Room int `json:"room,omitempty"`
}
type sendMessageRequest struct {
MessageType string `json:"msgtype,omitempty"`
Body string `json:"body,omitempty"`
}
type createEventResponse struct {
EventId string `json:"event_id,omitempty"`
}
type getEventRequest struct{}
type getEventResponse struct {
Content string `json:"content,omitempty"`
EventType string `json:"type,omitempty"`
}
type syncEventsServerRequest struct {
Origin string `json:"origin,omitempty"`
Timestamp int64 `json:"origin_server_ts,omitempty"`
PDUs []*Event `json:"pdus,omitempty"`
}
type syncEventsServerResponse struct {
PDUs map[string]pduProcessingResult `json:"pdus,omitempty"`
}
type backfillResponse struct {
Origin string `json:"origin,omitempty"`
Timestamp int64 `json:"origin_server_ts,omitempty"`
PDUs []*Event `json:"pdus,omitempty"`
}
type pduProcessingResult struct {
ProcessingError string `json:"error,omitempty"`
}