-
Notifications
You must be signed in to change notification settings - Fork 1
/
events.go
45 lines (41 loc) · 1.01 KB
/
events.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package asana
import (
"encoding/json"
"time"
)
type EventData struct {
Events []Event `json:"events"`
}
type Event struct {
User struct {
ID string `json:"gid"`
ResourceType string `json:"resource_type"`
} `json:"user"`
CreatedAt time.Time `json:"created_at"`
Action string `json:"action"`
Parent struct {
ID string `json:"gid"`
ResourceType string `json:"resource_type"`
ResourceSubtype string `json:"resource_subtype"`
} `json:"parent"`
Change struct {
Field string `json:"field"`
Action string `json:"action"`
NewValue struct {
ID string `json:"gid"`
ResourceType string `json:"resource_type"`
} `json:"new_value"`
} `json:"change"`
Resource struct {
ID string `json:"gid"`
ResourceType string `json:"resource_type"`
ResourceSubtype string `json:"resource_subtype"`
} `json:"resource"`
}
func (e Event) String() string {
data, err := json.MarshalIndent(e, "", " ")
if err != nil {
return ""
}
return string(data)
}