Calculate the complete /sync response (#69)
This commit is contained in:
parent
203e706b99
commit
53ec4a255b
9 changed files with 387 additions and 65 deletions
|
|
@ -88,16 +88,18 @@ type Event struct {
|
|||
}
|
||||
|
||||
type eventFields struct {
|
||||
RoomID string `json:"room_id"`
|
||||
EventID string `json:"event_id"`
|
||||
Sender string `json:"sender"`
|
||||
Type string `json:"type"`
|
||||
StateKey *string `json:"state_key"`
|
||||
Content rawJSON `json:"content"`
|
||||
PrevEvents []EventReference `json:"prev_events"`
|
||||
AuthEvents []EventReference `json:"auth_events"`
|
||||
Redacts string `json:"redacts"`
|
||||
Depth int64 `json:"depth"`
|
||||
RoomID string `json:"room_id"`
|
||||
EventID string `json:"event_id"`
|
||||
Sender string `json:"sender"`
|
||||
Type string `json:"type"`
|
||||
StateKey *string `json:"state_key"`
|
||||
Content rawJSON `json:"content"`
|
||||
PrevEvents []EventReference `json:"prev_events"`
|
||||
AuthEvents []EventReference `json:"auth_events"`
|
||||
Redacts string `json:"redacts"`
|
||||
Depth int64 `json:"depth"`
|
||||
Unsigned rawJSON `json:"unsigned"`
|
||||
OriginServerTS int64 `json:"origin_server_ts"`
|
||||
}
|
||||
|
||||
var emptyEventReferenceList = []EventReference{}
|
||||
|
|
@ -308,6 +310,16 @@ func (e Event) Type() string {
|
|||
return e.fields.Type
|
||||
}
|
||||
|
||||
// OriginServerTS returns the unix timestamp when this event was created on the origin server, with millisecond resolution.
|
||||
func (e Event) OriginServerTS() int64 {
|
||||
return e.fields.OriginServerTS
|
||||
}
|
||||
|
||||
// Unsigned returns the object under the 'unsigned' key of the event.
|
||||
func (e Event) Unsigned() []byte {
|
||||
return []byte(e.fields.Unsigned)
|
||||
}
|
||||
|
||||
// Content returns the content JSON of the event.
|
||||
func (e Event) Content() []byte {
|
||||
return []byte(e.fields.Content)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue