From 1a277b742b44f395057a286adb685f469c9091a6 Mon Sep 17 00:00:00 2001 From: Carlos Panato Date: Fri, 30 Aug 2019 15:32:06 +0200 Subject: [PATCH] add missing fields to PullRequest: locked and rebaseable Signed-off-by: Carlos Panato --- github/github-accessors.go | 16 ++++++++++++++++ github/github-stringify_test.go | 4 +++- github/pulls.go | 2 ++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index 03fd93f927a..02112173d33 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -7644,6 +7644,14 @@ func (p *PullRequest) GetLinks() *PRLinks { return p.Links } +// GetLocked returns the Locked field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetLocked() bool { + if p == nil || p.Locked == nil { + return false + } + return *p.Locked +} + // GetMaintainerCanModify returns the MaintainerCanModify field if it's non-nil, zero value otherwise. func (p *PullRequest) GetMaintainerCanModify() bool { if p == nil || p.MaintainerCanModify == nil { @@ -7732,6 +7740,14 @@ func (p *PullRequest) GetPatchURL() string { return *p.PatchURL } +// GetRebaseable returns the Rebaseable field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetRebaseable() bool { + if p == nil || p.Rebaseable == nil { + return false + } + return *p.Rebaseable +} + // GetReviewComments returns the ReviewComments field if it's non-nil, zero value otherwise. func (p *PullRequest) GetReviewComments() int { if p == nil || p.ReviewComments == nil { diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index 2e7b285ea0e..22e1aafb906 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -899,6 +899,7 @@ func TestPullRequest_String(t *testing.T) { ID: Int64(0), Number: Int(0), State: String(""), + Locked: Bool(false), Title: String(""), Body: String(""), User: &User{}, @@ -908,6 +909,7 @@ func TestPullRequest_String(t *testing.T) { MergeableState: String(""), MergedBy: &User{}, MergeCommitSHA: String(""), + Rebaseable: Bool(false), Comments: Int(0), Commits: Int(0), Additions: Int(0), @@ -934,7 +936,7 @@ func TestPullRequest_String(t *testing.T) { Base: &PullRequestBranch{}, ActiveLockReason: String(""), } - want := `github.PullRequest{ID:0, Number:0, State:"", Title:"", Body:"", User:github.User{}, Draft:false, Merged:false, Mergeable:false, MergeableState:"", MergedBy:github.User{}, MergeCommitSHA:"", Comments:0, Commits:0, Additions:0, Deletions:0, ChangedFiles:0, URL:"", HTMLURL:"", IssueURL:"", StatusesURL:"", DiffURL:"", PatchURL:"", CommitsURL:"", CommentsURL:"", ReviewCommentsURL:"", ReviewCommentURL:"", ReviewComments:0, Assignee:github.User{}, Milestone:github.Milestone{}, MaintainerCanModify:false, AuthorAssociation:"", NodeID:"", Links:github.PRLinks{}, Head:github.PullRequestBranch{}, Base:github.PullRequestBranch{}, ActiveLockReason:""}` + want := `github.PullRequest{ID:0, Number:0, State:"", Locked:false, Title:"", Body:"", User:github.User{}, Draft:false, Merged:false, Mergeable:false, MergeableState:"", MergedBy:github.User{}, MergeCommitSHA:"", Rebaseable:false, Comments:0, Commits:0, Additions:0, Deletions:0, ChangedFiles:0, URL:"", HTMLURL:"", IssueURL:"", StatusesURL:"", DiffURL:"", PatchURL:"", CommitsURL:"", CommentsURL:"", ReviewCommentsURL:"", ReviewCommentURL:"", ReviewComments:0, Assignee:github.User{}, Milestone:github.Milestone{}, MaintainerCanModify:false, AuthorAssociation:"", NodeID:"", Links:github.PRLinks{}, Head:github.PullRequestBranch{}, Base:github.PullRequestBranch{}, ActiveLockReason:""}` if got := v.String(); got != want { t.Errorf("PullRequest.String = %v, want %v", got, want) } diff --git a/github/pulls.go b/github/pulls.go index a06f97bcfd6..e022692d42f 100644 --- a/github/pulls.go +++ b/github/pulls.go @@ -24,6 +24,7 @@ type PullRequest struct { ID *int64 `json:"id,omitempty"` Number *int `json:"number,omitempty"` State *string `json:"state,omitempty"` + Locked *bool `json:"locked,omitempty"` Title *string `json:"title,omitempty"` Body *string `json:"body,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` @@ -38,6 +39,7 @@ type PullRequest struct { MergeableState *string `json:"mergeable_state,omitempty"` MergedBy *User `json:"merged_by,omitempty"` MergeCommitSHA *string `json:"merge_commit_sha,omitempty"` + Rebaseable *bool `json:"rebaseable,omitempty"` Comments *int `json:"comments,omitempty"` Commits *int `json:"commits,omitempty"` Additions *int `json:"additions,omitempty"`