From 6eb49d4ba5175412dcbb29b0031ebf02ab85a48d Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Sun, 1 Nov 2015 02:21:32 -0800 Subject: [PATCH] Add support for 'renamed' issue events. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Documented at https://developer.github.com/v3/issues/events/#events-1 and https://developer.github.com/v3/issues/events/#attributes. > Event "renamed": > The issue title was changed. > Attribute "rename": > An object containing rename details including ‘from’ and ‘to’ > attributes. Only provided for ‘renamed’ events. --- github/issues_events.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/github/issues_events.go b/github/issues_events.go index 79eb8d3..b6292d8 100644 --- a/github/issues_events.go +++ b/github/issues_events.go @@ -52,6 +52,9 @@ type IssueEvent struct { // // labeled // A label was added. + // + // renamed + // The issue title was changed. Event *string `json:"event,omitempty"` // The SHA of the commit that referenced this commit, if applicable. @@ -60,8 +63,11 @@ type IssueEvent struct { CreatedAt *time.Time `json:"created_at,omitempty"` Issue *Issue `json:"issue,omitempty"` - // Only present on 'labeled' events + // Only present on 'labeled' events. Label *Label `json:"label,omitempty"` + + // Only present on 'renamed' events. + Rename *Rename `json:"rename,omitempty"` } // ListIssueEvents lists events for the specified issue. @@ -131,3 +137,13 @@ func (s *IssuesService) GetEvent(owner, repo string, id int) (*IssueEvent, *Resp return event, resp, err } + +// Rename contains details for 'renamed' events. +type Rename struct { + From *string `json:"from,omitempty"` + To *string `json:"to,omitempty"` +} + +func (r Rename) String() string { + return Stringify(r) +}