event.go 849 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package events
  2. import (
  3. "encoding/json"
  4. )
  5. type EventsResponse struct {
  6. Page int `json:"_page"`
  7. Links struct {
  8. Self struct {
  9. Href string `json:"href"`
  10. } `json:"self"`
  11. Next struct {
  12. Href string `json:"href"`
  13. } `json:"next"`
  14. } `json:"_links"`
  15. Embedded struct{
  16. Events []Event `json:"events"`
  17. } `json:"_embedded"`
  18. }
  19. //type Events []Event
  20. type Event struct {
  21. Id string `json:"id"`
  22. Type string `json:"type"`
  23. EntityId int `json:"entity_id"`
  24. EntityType string `json:"entity_type"`
  25. CreatedBy int64 `json:"created_by"`
  26. CreatedAt int64 `json:"created_at"`
  27. ValueAfter []Value `json:"value_after"`
  28. ValueBefore []Value `json:"value_before,omitempty"`
  29. AccountId int `json:"account_id"`
  30. Embedded struct {
  31. } `json:"_embedded"`
  32. }
  33. func (e Event) String() string {
  34. bts, _ := json.MarshalIndent(e, "", "\t")
  35. return string(bts)
  36. }