Repository: google/go-github (go)

Issue:
Enable Pages Parameter specification
Allow specification of parameters when POST to enable pages API as per: https://developer.github.com/v3/repos/pages/#parameters

Pull request:
Support specification of parameters for enable pages API
Support specification of parameters for enable pages API as per: https://developer.github.com/v3/repos/pages/#parameters

Fixes #1408.

Patch:
diff --git a/README.md b/README.md
index 2d134ce0..326cfe38 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,6 @@
 [![Test Coverage](https://codecov.io/gh/google/go-github/branch/master/graph/badge.svg)](https://codecov.io/gh/google/go-github)
 [![Discuss at go-github@googlegroups.com](https://img.shields.io/badge/discuss-go--github%40googlegroups.com-blue.svg)](https://groups.google.com/group/go-github)
 [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/796/badge)](https://bestpractices.coreinfrastructure.org/projects/796)
-[![TODOs](https://img.shields.io/endpoint?url=https://todos.tickgit.com/badge?repo=github.com/google/go-github)](https://todos.tickgit.com/browse?repo=github.com/google/go-github)
 
 go-github is a Go client library for accessing the [GitHub API v3][].
 
diff --git a/github/github-accessors.go b/github/github-accessors.go
index f300b117..a17114ec 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -1940,6 +1940,14 @@ func (c *Contributor) GetLogin() string {
 	return *c.Login
 }
 
+// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
+func (c *Contributor) GetNodeID() string {
+	if c == nil || c.NodeID == nil {
+		return ""
+	}
+	return *c.NodeID
+}
+
 // GetOrganizationsURL returns the OrganizationsURL field if it's non-nil, zero value otherwise.
 func (c *Contributor) GetOrganizationsURL() string {
 	if c == nil || c.OrganizationsURL == nil {
@@ -8700,6 +8708,14 @@ func (p *PullRequestMergeResult) GetSHA() string {
 	return *p.SHA
 }
 
+// GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise.
+func (p *PullRequestReview) GetAuthorAssociation() string {
+	if p == nil || p.AuthorAssociation == nil {
+		return ""
+	}
+	return *p.AuthorAssociation
+}
+
 // GetBody returns the Body field if it's non-nil, zero value otherwise.
 func (p *PullRequestReview) GetBody() string {
 	if p == nil || p.Body == nil {
diff --git a/github/pulls_reviews.go b/github/pulls_reviews.go
index 88b82982..aee49147 100644
--- a/github/pulls_reviews.go
+++ b/github/pulls_reviews.go
@@ -22,6 +22,9 @@ type PullRequestReview struct {
 	HTMLURL        *string    `json:"html_url,omitempty"`
 	PullRequestURL *string    `json:"pull_request_url,omitempty"`
 	State          *string    `json:"state,omitempty"`
+	// AuthorAssociation is the comment author's relationship to the issue's repository.
+	// Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE".
+	AuthorAssociation *string `json:"author_association,omitempty"`
 }
 
 func (p PullRequestReview) String() string {
diff --git a/github/repos.go b/github/repos.go
index 8f9409e6..133a9ef9 100644
--- a/github/repos.go
+++ b/github/repos.go
@@ -496,6 +496,7 @@ func (s *RepositoriesService) Delete(ctx context.Context, owner, repo string) (*
 type Contributor struct {
 	Login             *string `json:"login,omitempty"`
 	ID                *int64  `json:"id,omitempty"`
+	NodeID            *string `json:"node_id,omitempty"`
 	AvatarURL         *string `json:"avatar_url,omitempty"`
 	GravatarID        *string `json:"gravatar_id,omitempty"`
 	URL               *string `json:"url,omitempty"`
diff --git a/github/repos_pages.go b/github/repos_pages.go
index 7eb32a9d..c0892fdc 100644
--- a/github/repos_pages.go
+++ b/github/repos_pages.go
@@ -43,12 +43,23 @@ type PagesBuild struct {
 	UpdatedAt *Timestamp  `json:"updated_at,omitempty"`
 }
 
+// createPagesRequest is a subset of Pages and is used internally
+// by EnablePages to pass only the known fields for the endpoint.
+type createPagesRequest struct {
+	Source *PagesSource `json:"source,omitempty"`
+}
+
 // EnablePages enables GitHub Pages for the named repo.
 //
 // GitHub API docs: https://developer.github.com/v3/repos/pages/#enable-a-pages-site
-func (s *RepositoriesService) EnablePages(ctx context.Context, owner, repo string) (*Pages, *Response, error) {
+func (s *RepositoriesService) EnablePages(ctx context.Context, owner, repo string, pages *Pages) (*Pages, *Response, error) {
 	u := fmt.Sprintf("repos/%v/%v/pages", owner, repo)
-	req, err := s.client.NewRequest("POST", u, nil)
+
+	pagesReq := &createPagesRequest{
+		Source: pages.Source,
+	}
+
+	req, err := s.client.NewRequest("POST", u, pagesReq)
 	if err != nil {
 		return nil, nil, err
 	}


Test patch:
diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go
index b156cc1d..a8050964 100644
--- a/github/github-stringify_test.go
+++ b/github/github-stringify_test.go
@@ -1012,16 +1012,17 @@ func TestPullRequestComment_String(t *testing.T) {
 
 func TestPullRequestReview_String(t *testing.T) {
 	v := PullRequestReview{
-		ID:             Int64(0),
-		NodeID:         String(""),
-		User:           &User{},
-		Body:           String(""),
-		CommitID:       String(""),
-		HTMLURL:        String(""),
-		PullRequestURL: String(""),
-		State:          String(""),
+		ID:                Int64(0),
+		NodeID:            String(""),
+		User:              &User{},
+		Body:              String(""),
+		CommitID:          String(""),
+		HTMLURL:           String(""),
+		PullRequestURL:    String(""),
+		State:             String(""),
+		AuthorAssociation: String(""),
 	}
-	want := `github.PullRequestReview{ID:0, NodeID:"", User:github.User{}, Body:"", CommitID:"", HTMLURL:"", PullRequestURL:"", State:""}`
+	want := `github.PullRequestReview{ID:0, NodeID:"", User:github.User{}, Body:"", CommitID:"", HTMLURL:"", PullRequestURL:"", State:"", AuthorAssociation:""}`
 	if got := v.String(); got != want {
 		t.Errorf("PullRequestReview.String = %v, want %v", got, want)
 	}
diff --git a/github/repos_pages_test.go b/github/repos_pages_test.go
index ec77f717..8fe38eb3 100644
--- a/github/repos_pages_test.go
+++ b/github/repos_pages_test.go
@@ -7,6 +7,7 @@ package github
 
 import (
 	"context"
+	"encoding/json"
 	"fmt"
 	"net/http"
 	"reflect"
@@ -17,13 +18,29 @@ func TestRepositoriesService_EnablePages(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
+	input := &Pages{
+		Source: &PagesSource{
+			Branch: String("master"),
+			Path:   String("/"),
+		},
+		CNAME: String("www.my-domain.com"), // not passed along.
+	}
+
 	mux.HandleFunc("/repos/o/r/pages", func(w http.ResponseWriter, r *http.Request) {
+		v := new(createPagesRequest)
+		json.NewDecoder(r.Body).Decode(v)
+
 		testMethod(t, r, "POST")
 		testHeader(t, r, "Accept", mediaTypeEnablePagesAPIPreview)
+		want := &createPagesRequest{Source: &PagesSource{Branch: String("master"), Path: String("/")}}
+		if !reflect.DeepEqual(v, want) {
+			t.Errorf("Request body = %+v, want %+v", v, want)
+		}
+
 		fmt.Fprint(w, `{"url":"u","status":"s","cname":"c","custom_404":false,"html_url":"h", "source": {"branch":"master", "path":"/"}}`)
 	})
 
-	page, _, err := client.Repositories.EnablePages(context.Background(), "o", "r")
+	page, _, err := client.Repositories.EnablePages(context.Background(), "o", "r", input)
 	if err != nil {
 		t.Errorf("Repositories.EnablePages returned error: %v", err)
 	}
diff --git a/github/repos_stats_test.go b/github/repos_stats_test.go
index 055504d7..4668cf18 100644
--- a/github/repos_stats_test.go
+++ b/github/repos_stats_test.go
@@ -25,7 +25,8 @@ func TestRepositoriesService_ListContributorsStats(t *testing.T) {
 [
   {
     "author": {
-      "id": 1
+			"id": 1,
+			"node_id": "nodeid-1"
     },
     "total": 135,
     "weeks": [
@@ -49,7 +50,8 @@ func TestRepositoriesService_ListContributorsStats(t *testing.T) {
 	want := []*ContributorStats{
 		{
 			Author: &Contributor{
-				ID: Int64(1),
+				ID:     Int64(1),
+				NodeID: String("nodeid-1"),
 			},
 			Total: Int(135),
 			Weeks: []WeeklyStats{