-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpayload.go
More file actions
63 lines (51 loc) · 1.48 KB
/
payload.go
File metadata and controls
63 lines (51 loc) · 1.48 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package githubservicehook
import (
"encoding/json"
"time"
)
type Payload struct {
Before string `json:"before"`
After string `json:"after"`
Ref string `json:"ref"`
Commits []commit `json:"commits"`
Repository repository `json:"repository"`
HeadCommit commit `json:"head_commit"`
}
type commit struct {
Id string `json:"id"`
Author person `json:"author"`
Committer person `json:"committer"`
Distinct bool `json:"distinct"`
Message string `json:"message"`
Modified []string `json:"modified"`
Removed []string `json:"removed"`
Timestamp time.Time `json:"timestamp"`
Url string `json:"url"`
}
type repository struct {
Name string `json:"name"`
Url string `json:"url"`
Description string `json:"description"`
Homepage string `json:"homepage"`
Private bool `json:"private"`
Owner person `json:"owner"`
Forks int `json:"forks"`
Watchers int `json:"watchers"`
Stars int `json:"stargazers"`
SizeInBytes int `json:"size"`
HasDownloads bool `json:"has_downloads"`
HasIssues bool `json:"has_issues"`
HasWiki bool `json:"has_wiki"`
IsFork bool `json:"fork"`
Language string `json:"language"`
MasterBranch string `json:"master_branch"`
}
type person struct {
Name string `json:"name"`
Email string `json:"email"`
UserName string `json:"username"`
}
func parsePayload(body string) (payload Payload, err error) {
err = json.Unmarshal([]byte(body), &payload)
return
}