structures.go 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package docs
  2. // An EventReference is a reference to a matrix event.
  3. type EventReference struct {
  4. // The event ID of the event.
  5. EventID string
  6. // The sha256 of the redacted event.
  7. EventSHA256 Base64String
  8. }
  9. // A StateKeyTuple is the combination of an event type and an event state key.
  10. // It is often used as a key in maps.
  11. type StateKeyTuple struct {
  12. // The "type" key of a matrix event.
  13. EventType string
  14. // The "state_key" of a matrix event.
  15. // The empty string is a legitimate value for the "state_key" in matrix
  16. // so take care to initialise this field lest you accidentally request a
  17. // "state_key" with the go default of the empty string.
  18. StateKey string
  19. }
  20. // An Event is a matrix event.
  21. // The event should always contain valid JSON.
  22. // If the event content hash is invalid then the event is redacted.
  23. // Redacted events contain only the fields covered by the event signature.
  24. type Event struct {
  25. redacted bool
  26. eventJSON []byte
  27. fields eventFields
  28. }
  29. //Events
  30. // An EventBuilder is used to build a new event.
  31. // These can be exchanged between matrix servers in the federation APIs when
  32. // joining or leaving a room.
  33. type EventBuilder struct {
  34. // The user ID of the user sending the event.
  35. Sender string `json:"sender"`
  36. // The room ID of the room this event is in.
  37. RoomID string `json:"room_id"`
  38. // The type of the event.
  39. Type string `json:"type"`
  40. // The state_key of the event if the event is a state event or nil if the event is not a state event.
  41. StateKey *string `json:"state_key,omitempty"`
  42. // The events that immediately preceded this event in the room history.
  43. PrevEvents []EventReference `json:"prev_events"`
  44. // The events needed to authenticate this event.
  45. AuthEvents []EventReference `json:"auth_events"`
  46. // The event ID of the event being redacted if this event is a "m.room.redaction".
  47. Redacts string `json:"redacts,omitempty"`
  48. // The depth of the event, This should be one greater than the maximum depth of the previous events.
  49. // The create event has a depth of 1.
  50. Depth int64 `json:"depth"`
  51. // The JSON object for "content" key of the event.
  52. Content rawJSON `json:"content"`
  53. // The JSON object for the "unsigned" key
  54. Unsigned rawJSON `json:"unsigned,omitempty"`
  55. }