diff --git a/github/event_types.go b/github/event_types.go index c80a835f6b8..b550361848c 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -106,10 +106,11 @@ type CreateEvent struct { RefType *string `json:"ref_type,omitempty"` MasterBranch *string `json:"master_branch,omitempty"` Description *string `json:"description,omitempty"` + PusherType *string `json:"pusher_type,omitempty"` // The following fields are only populated by Webhook events. - PusherType *string `json:"pusher_type,omitempty"` Repo *Repository `json:"repository,omitempty"` + Org *Organization `json:"organization,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` } @@ -493,13 +494,14 @@ type IssuesEvent struct { type LabelEvent struct { // Action is the action that was performed. Possible values are: // "created", "edited", "deleted" - Action *string `json:"action,omitempty"` - Label *Label `json:"label,omitempty"` + Action *string `json:"action,omitempty"` + Label *Label `json:"label,omitempty"` + Changes *EditChange `json:"changes,omitempty"` // The following fields are only populated by Webhook events. - Changes *EditChange `json:"changes,omitempty"` Repo *Repository `json:"repository,omitempty"` Org *Organization `json:"organization,omitempty"` + Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` } @@ -574,6 +576,9 @@ type MetaEvent struct { Hook *Hook `json:"hook,omitempty"` // The following fields are only populated by Webhook events. + Repo *Repository `json:"repository,omitempty"` + Org *Organization `json:"organization,omitempty"` + Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` } @@ -682,7 +687,12 @@ type PingEvent struct { // The ID of the webhook that triggered the ping. HookID *int64 `json:"hook_id,omitempty"` // The webhook configuration. - Hook *Hook `json:"hook,omitempty"` + Hook *Hook `json:"hook,omitempty"` + + // The following fields are only populated by Webhook events. + Repo *Repository `json:"repository,omitempty"` + Org *Organization `json:"organization,omitempty"` + Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` } diff --git a/github/github-accessors.go b/github/github-accessors.go index c1cb0d1f4df..065f9c6da04 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -3414,6 +3414,14 @@ func (c *CreateCheckSuiteOptions) GetHeadBranch() string { return *c.HeadBranch } +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (c *CreateEvent) GetAction() string { + if c == nil || c.Action == nil { + return "" + } + return *c.Action +} + // GetDescription returns the Description field if it's non-nil, zero value otherwise. func (c *CreateEvent) GetDescription() string { if c == nil || c.Description == nil { @@ -7902,6 +7910,14 @@ func (l *LabelEvent) GetRepo() *Repository { return l.Repo } +// GetSender returns the Sender field. +func (l *LabelEvent) GetSender() *User { + if l == nil { + return nil + } + return l.Sender +} + // GetColor returns the Color field if it's non-nil, zero value otherwise. func (l *LabelResult) GetColor() string { if l == nil || l.Color == nil { @@ -8742,6 +8758,22 @@ func (m *MetaEvent) GetInstallation() *Installation { return m.Installation } +// GetRepo returns the Repo field. +func (m *MetaEvent) GetRepo() *Repository { + if m == nil { + return nil + } + return m.Repo +} + +// GetSender returns the Sender field. +func (m *MetaEvent) GetSender() *User { + if m == nil { + return nil + } + return m.Sender +} + // GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. func (m *Metric) GetHTMLURL() string { if m == nil || m.HTMLURL == nil { @@ -10766,6 +10798,30 @@ func (p *PingEvent) GetInstallation() *Installation { return p.Installation } +// GetOrg returns the Org field. +func (p *PingEvent) GetOrg() *Organization { + if p == nil { + return nil + } + return p.Org +} + +// GetRepo returns the Repo field. +func (p *PingEvent) GetRepo() *Repository { + if p == nil { + return nil + } + return p.Repo +} + +// GetSender returns the Sender field. +func (p *PingEvent) GetSender() *User { + if p == nil { + return nil + } + return p.Sender +} + // GetZen returns the Zen field if it's non-nil, zero value otherwise. func (p *PingEvent) GetZen() string { if p == nil || p.Zen == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 80134620170..5020b708678 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -3995,6 +3995,16 @@ func TestCreateCheckSuiteOptions_GetHeadBranch(tt *testing.T) { c.GetHeadBranch() } +func TestCreateEvent_GetAction(tt *testing.T) { + var zeroValue string + c := &CreateEvent{Action: &zeroValue} + c.GetAction() + c = &CreateEvent{} + c.GetAction() + c = nil + c.GetAction() +} + func TestCreateEvent_GetDescription(tt *testing.T) { var zeroValue string c := &CreateEvent{Description: &zeroValue} @@ -9245,6 +9255,13 @@ func TestLabelEvent_GetRepo(tt *testing.T) { l.GetRepo() } +func TestLabelEvent_GetSender(tt *testing.T) { + l := &LabelEvent{} + l.GetSender() + l = nil + l.GetSender() +} + func TestLabelResult_GetColor(tt *testing.T) { var zeroValue string l := &LabelResult{Color: &zeroValue} @@ -10229,6 +10246,20 @@ func TestMetaEvent_GetInstallation(tt *testing.T) { m.GetInstallation() } +func TestMetaEvent_GetRepo(tt *testing.T) { + m := &MetaEvent{} + m.GetRepo() + m = nil + m.GetRepo() +} + +func TestMetaEvent_GetSender(tt *testing.T) { + m := &MetaEvent{} + m.GetSender() + m = nil + m.GetSender() +} + func TestMetric_GetHTMLURL(tt *testing.T) { var zeroValue string m := &Metric{HTMLURL: &zeroValue} @@ -12621,6 +12652,27 @@ func TestPingEvent_GetInstallation(tt *testing.T) { p.GetInstallation() } +func TestPingEvent_GetOrg(tt *testing.T) { + p := &PingEvent{} + p.GetOrg() + p = nil + p.GetOrg() +} + +func TestPingEvent_GetRepo(tt *testing.T) { + p := &PingEvent{} + p.GetRepo() + p = nil + p.GetRepo() +} + +func TestPingEvent_GetSender(tt *testing.T) { + p := &PingEvent{} + p.GetSender() + p = nil + p.GetSender() +} + func TestPingEvent_GetZen(tt *testing.T) { var zeroValue string p := &PingEvent{Zen: &zeroValue}