From d722750ab19bf6318a2c8dfad8d4aa034779aa8f Mon Sep 17 00:00:00 2001
From: Piotr Zurek
Date: Mon, 25 Jan 2016 18:05:38 +1300
Subject: [PATCH] new repo struct for push events
fixes: #131,#271
---
github/activity_events.go | 46 ++++++++++++++++++++++++++++++++++-----
1 file changed, 40 insertions(+), 6 deletions(-)
diff --git a/github/activity_events.go b/github/activity_events.go
index 2a40d3e..1e4c4c8 100644
--- a/github/activity_events.go
+++ b/github/activity_events.go
@@ -44,12 +44,12 @@ func (e *Event) Payload() (payload interface{}) {
//
// GitHub API docs: http://developer.github.com/v3/activity/events/types/#pushevent
type PushEvent struct {
- PushID *int `json:"push_id,omitempty"`
- Head *string `json:"head,omitempty"`
- Ref *string `json:"ref,omitempty"`
- Size *int `json:"size,omitempty"`
- Commits []PushEventCommit `json:"commits,omitempty"`
- Repo *Repository `json:"repository,omitempty"`
+ PushID *int `json:"push_id,omitempty"`
+ Head *string `json:"head,omitempty"`
+ Ref *string `json:"ref,omitempty"`
+ Size *int `json:"size,omitempty"`
+ Commits []PushEventCommit `json:"commits,omitempty"`
+ Repo *PushEventRepository `json:"repository,omitempty"`
}
func (p PushEvent) String() string {
@@ -72,6 +72,40 @@ func (p PushEventCommit) String() string {
return Stringify(p)
}
+// PushEventRepository represents the repo object in a PushEvent payload
+type PushEventRepository struct {
+ ID *int `json:"id,omitempty"`
+ Name *string `json:"name,omitempty"`
+ FullName *string `json:"full_name,omitempty"`
+ Owner *PushEventRepoOwner `json:"owner,omitempty"`
+ Private *bool `json:"private,omitempty"`
+ Description *string `json:"description,omitempty"`
+ Fork *bool `json:"fork,omitempty"`
+ CreatedAt *Timestamp `json:"created_at,omitempty"`
+ PushedAt *Timestamp `json:"pushed_at,omitempty"`
+ UpdatedAt *Timestamp `json:"updated_at,omitempty"`
+ Homepage *string `json:"homepage,omitempty"`
+ Size *int `json:"size,omitempty"`
+ StargazersCount *int `json:"stargazers_count,omitempty"`
+ WatchersCount *int `json:"watchers_count,omitempty"`
+ Language *string `json:"language,omitempty"`
+ HasIssues *bool `json:"has_issues,omitempty"`
+ HasDownloads *bool `json:"has_downloads,omitempty"`
+ HasWiki *bool `json:"has_wiki,omitempty"`
+ HasPages *bool `json:"has_pages,omitempty"`
+ ForksCount *int `json:"forks_count,omitempty"`
+ OpenIssuesCount *int `json:"open_issues_count,omitempty"`
+ DefaultBranch *string `json:"default_branch,omitempty"`
+ MasterBranch *string `json:"master_branch,omitempty"`
+ Organization *string `json:"organization,omitempty"`
+}
+
+// PushEventRepoOwner is a basic reporesntation of user/org in a PushEvent payload
+type PushEventRepoOwner struct {
+ Name *string `json:"name,omitempty"`
+ Email *string `json:"email,omitempty"`
+}
+
//PullRequestEvent represents the payload delivered by PullRequestEvent webhook
type PullRequestEvent struct {
Action *string `json:"action,omitempty"`