From 88adba887c0ddc1302c39a86890bc3097ada751f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=AElehcieR=20treboR?= Date: Tue, 28 Sep 2021 15:31:55 +0000 Subject: [PATCH 1/9] First pass at Pages struct update and test case updates --- github/repos_pages.go | 23 +++++++++++++++++------ github/repos_pages_test.go | 10 +++++++++- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/github/repos_pages.go b/github/repos_pages.go index a954e70584b..87b2974f27f 100644 --- a/github/repos_pages.go +++ b/github/repos_pages.go @@ -12,12 +12,15 @@ import ( // Pages represents a GitHub Pages site configuration. type Pages struct { - URL *string `json:"url,omitempty"` - Status *string `json:"status,omitempty"` - CNAME *string `json:"cname,omitempty"` - Custom404 *bool `json:"custom_404,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - Source *PagesSource `json:"source,omitempty"` + URL *string `json:"url,omitempty"` + Status *string `json:"status,omitempty"` + CNAME *string `json:"cname,omitempty"` + Custom404 *bool `json:"custom_404,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + Source *PagesSource `json:"source,omitempty"` + Public *bool `json:"public,omitempty"` + HttpsCertificate *PagesHttpsCertificate `json:"https_certificate,omitempty"` + HttpsEnforced *bool `json:"https_enforced,omitempty"` } // PagesSource represents a GitHub page's source. @@ -43,6 +46,14 @@ type PagesBuild struct { UpdatedAt *Timestamp `json:"updated_at,omitempty"` } +// PagesBuild represents the HTTPS Certificate information for a GitHub Pages site. +type PagesHttpsCertificate struct { + State *string `json:"state,omitempty"` + Description *string `json:"description,omitempty"` + Domains *[]*string `json:"domains,omitempty"` + ExpiresAt *string `json:"expires_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 { diff --git a/github/repos_pages_test.go b/github/repos_pages_test.go index 85069f946c5..21ece8af39b 100644 --- a/github/repos_pages_test.go +++ b/github/repos_pages_test.go @@ -27,6 +27,14 @@ func TestRepositoriesService_EnablePages(t *testing.T) { Path: String("/"), }, CNAME: String("www.my-domain.com"), // not passed along. + Public: Bool(true), + HttpsCertificate: &PagesHttpsCertificate{ + State: String("approved"), + Description: String("Certificate is approved"), + // Domains: &[]*string{String("developer.github.com")}, + ExpiresAt: String("2021-05-22"), + }, + HttpsEnforced: Bool(true), } mux.HandleFunc("/repos/o/r/pages", func(w http.ResponseWriter, r *http.Request) { @@ -40,7 +48,7 @@ func TestRepositoriesService_EnablePages(t *testing.T) { 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":"/"}}`) + fmt.Fprint(w, `{"url":"u","status":"s","cname":"c","custom_404":false,"html_url":"h", "source": {"branch":"master", "path":"/"}, "public":true, "https_certificate": {"state":"approved","description": "Certificate is approved","domains": ["developer.github.com"],"expires_at": "2021-05-22"},"https_enforced": true}`) }) ctx := context.Background() From 8078f1a92d0a6c225f86e4fe7000c825cf244bfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=AElehcieR=20treboR?= Date: Tue, 28 Sep 2021 19:40:34 +0000 Subject: [PATCH 2/9] Add tests to the correct test case --- github/repos_pages_test.go | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/github/repos_pages_test.go b/github/repos_pages_test.go index 21ece8af39b..3b2ae4fb74d 100644 --- a/github/repos_pages_test.go +++ b/github/repos_pages_test.go @@ -27,14 +27,6 @@ func TestRepositoriesService_EnablePages(t *testing.T) { Path: String("/"), }, CNAME: String("www.my-domain.com"), // not passed along. - Public: Bool(true), - HttpsCertificate: &PagesHttpsCertificate{ - State: String("approved"), - Description: String("Certificate is approved"), - // Domains: &[]*string{String("developer.github.com")}, - ExpiresAt: String("2021-05-22"), - }, - HttpsEnforced: Bool(true), } mux.HandleFunc("/repos/o/r/pages", func(w http.ResponseWriter, r *http.Request) { @@ -48,7 +40,7 @@ func TestRepositoriesService_EnablePages(t *testing.T) { 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":"/"}, "public":true, "https_certificate": {"state":"approved","description": "Certificate is approved","domains": ["developer.github.com"],"expires_at": "2021-05-22"},"https_enforced": true}`) + fmt.Fprint(w, `{"url":"u","status":"s","cname":"c","custom_404":false,"html_url":"h", "source": {"branch":"master", "path":"/"}}`) }) ctx := context.Background() @@ -178,7 +170,7 @@ func TestRepositoriesService_GetPagesInfo(t *testing.T) { mux.HandleFunc("/repos/o/r/pages", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - fmt.Fprint(w, `{"url":"u","status":"s","cname":"c","custom_404":false,"html_url":"h"}`) + fmt.Fprint(w, `{"url":"u","status":"s","cname":"c","custom_404":false,"html_url":"h","public":true, "https_certificate": {"state":"approved","description": "Certificate is approved","domains": ["developer.github.com"],"expires_at": "2021-05-22"},"https_enforced": true}`) }) ctx := context.Background() @@ -187,7 +179,7 @@ func TestRepositoriesService_GetPagesInfo(t *testing.T) { t.Errorf("Repositories.GetPagesInfo returned error: %v", err) } - want := &Pages{URL: String("u"), Status: String("s"), CNAME: String("c"), Custom404: Bool(false), HTMLURL: String("h")} + want := &Pages{URL: String("u"), Status: String("s"), CNAME: String("c"), Custom404: Bool(false), HTMLURL: String("h"), Public: Bool(true), HttpsCertificate: &PagesHttpsCertificate{State: String("approved"), Description: String("Certificate is approved"), Domains: &[]*string{String("developer.github.com")}, ExpiresAt: String("2021-05-22"),}, HttpsEnforced: Bool(true),} if !cmp.Equal(page, want) { t.Errorf("Repositories.GetPagesInfo returned %+v, want %+v", page, want) } From 7b1ec6322528b24809ac91481b9d13d7eed385ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=AElehcieR=20treboR?= Date: Tue, 28 Sep 2021 19:42:55 +0000 Subject: [PATCH 3/9] Run go fmt to make things beautiful --- github/repos_pages.go | 6 +++--- github/repos_pages_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/github/repos_pages.go b/github/repos_pages.go index 87b2974f27f..a11e2474a5f 100644 --- a/github/repos_pages.go +++ b/github/repos_pages.go @@ -48,10 +48,10 @@ type PagesBuild struct { // PagesBuild represents the HTTPS Certificate information for a GitHub Pages site. type PagesHttpsCertificate struct { - State *string `json:"state,omitempty"` - Description *string `json:"description,omitempty"` + State *string `json:"state,omitempty"` + Description *string `json:"description,omitempty"` Domains *[]*string `json:"domains,omitempty"` - ExpiresAt *string `json:"expires_at,omitempty"` + ExpiresAt *string `json:"expires_at,omitempty"` } // createPagesRequest is a subset of Pages and is used internally diff --git a/github/repos_pages_test.go b/github/repos_pages_test.go index 3b2ae4fb74d..c4b276e23eb 100644 --- a/github/repos_pages_test.go +++ b/github/repos_pages_test.go @@ -179,7 +179,7 @@ func TestRepositoriesService_GetPagesInfo(t *testing.T) { t.Errorf("Repositories.GetPagesInfo returned error: %v", err) } - want := &Pages{URL: String("u"), Status: String("s"), CNAME: String("c"), Custom404: Bool(false), HTMLURL: String("h"), Public: Bool(true), HttpsCertificate: &PagesHttpsCertificate{State: String("approved"), Description: String("Certificate is approved"), Domains: &[]*string{String("developer.github.com")}, ExpiresAt: String("2021-05-22"),}, HttpsEnforced: Bool(true),} + want := &Pages{URL: String("u"), Status: String("s"), CNAME: String("c"), Custom404: Bool(false), HTMLURL: String("h"), Public: Bool(true), HttpsCertificate: &PagesHttpsCertificate{State: String("approved"), Description: String("Certificate is approved"), Domains: &[]*string{String("developer.github.com")}, ExpiresAt: String("2021-05-22")}, HttpsEnforced: Bool(true)} if !cmp.Equal(page, want) { t.Errorf("Repositories.GetPagesInfo returned %+v, want %+v", page, want) } From 9d8e6e55e6c25ecc90976d9dcc47b6a5c326617f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=AElehcieR=20treboR?= Date: Tue, 28 Sep 2021 19:46:17 +0000 Subject: [PATCH 4/9] Run through the `Contributing` guidelines --- github/github-accessors.go | 48 +++++++++++++++++++++++++++ github/github-accessors_test.go | 57 +++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) diff --git a/github/github-accessors.go b/github/github-accessors.go index 68de9bb17c0..da9eb9e13cf 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -9844,6 +9844,30 @@ func (p *Pages) GetHTMLURL() string { return *p.HTMLURL } +// GetHttpsCertificate returns the HttpsCertificate field. +func (p *Pages) GetHttpsCertificate() *PagesHttpsCertificate { + if p == nil { + return nil + } + return p.HttpsCertificate +} + +// GetHttpsEnforced returns the HttpsEnforced field if it's non-nil, zero value otherwise. +func (p *Pages) GetHttpsEnforced() bool { + if p == nil || p.HttpsEnforced == nil { + return false + } + return *p.HttpsEnforced +} + +// GetPublic returns the Public field if it's non-nil, zero value otherwise. +func (p *Pages) GetPublic() bool { + if p == nil || p.Public == nil { + return false + } + return *p.Public +} + // GetSource returns the Source field. func (p *Pages) GetSource() *PagesSource { if p == nil { @@ -9940,6 +9964,30 @@ func (p *PagesError) GetMessage() string { return *p.Message } +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (p *PagesHttpsCertificate) GetDescription() string { + if p == nil || p.Description == nil { + return "" + } + return *p.Description +} + +// GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. +func (p *PagesHttpsCertificate) GetExpiresAt() string { + if p == nil || p.ExpiresAt == nil { + return "" + } + return *p.ExpiresAt +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (p *PagesHttpsCertificate) GetState() string { + if p == nil || p.State == nil { + return "" + } + return *p.State +} + // GetBranch returns the Branch field if it's non-nil, zero value otherwise. func (p *PagesSource) GetBranch() string { if p == nil || p.Branch == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index aa9bd566825..c0e39ab854e 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -11550,6 +11550,33 @@ func TestPages_GetHTMLURL(tt *testing.T) { p.GetHTMLURL() } +func TestPages_GetHttpsCertificate(tt *testing.T) { + p := &Pages{} + p.GetHttpsCertificate() + p = nil + p.GetHttpsCertificate() +} + +func TestPages_GetHttpsEnforced(tt *testing.T) { + var zeroValue bool + p := &Pages{HttpsEnforced: &zeroValue} + p.GetHttpsEnforced() + p = &Pages{} + p.GetHttpsEnforced() + p = nil + p.GetHttpsEnforced() +} + +func TestPages_GetPublic(tt *testing.T) { + var zeroValue bool + p := &Pages{Public: &zeroValue} + p.GetPublic() + p = &Pages{} + p.GetPublic() + p = nil + p.GetPublic() +} + func TestPages_GetSource(tt *testing.T) { p := &Pages{} p.GetSource() @@ -11661,6 +11688,36 @@ func TestPagesError_GetMessage(tt *testing.T) { p.GetMessage() } +func TestPagesHttpsCertificate_GetDescription(tt *testing.T) { + var zeroValue string + p := &PagesHttpsCertificate{Description: &zeroValue} + p.GetDescription() + p = &PagesHttpsCertificate{} + p.GetDescription() + p = nil + p.GetDescription() +} + +func TestPagesHttpsCertificate_GetExpiresAt(tt *testing.T) { + var zeroValue string + p := &PagesHttpsCertificate{ExpiresAt: &zeroValue} + p.GetExpiresAt() + p = &PagesHttpsCertificate{} + p.GetExpiresAt() + p = nil + p.GetExpiresAt() +} + +func TestPagesHttpsCertificate_GetState(tt *testing.T) { + var zeroValue string + p := &PagesHttpsCertificate{State: &zeroValue} + p.GetState() + p = &PagesHttpsCertificate{} + p.GetState() + p = nil + p.GetState() +} + func TestPagesSource_GetBranch(tt *testing.T) { var zeroValue string p := &PagesSource{Branch: &zeroValue} From 69924bbb46c6a1ad77e31c769c494f1c6ecbe3fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=AElehcieR=20treboR?= Date: Wed, 29 Sep 2021 15:58:52 +0000 Subject: [PATCH 5/9] Changed type name to HTTPS and updated collateral --- github/github-accessors.go | 12 ++++++------ github/github-accessors_test.go | 24 ++++++++++++------------ github/repos_pages.go | 12 ++++++------ github/repos_pages_test.go | 2 +- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index da9eb9e13cf..d2ee52c9d3e 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -9844,12 +9844,12 @@ func (p *Pages) GetHTMLURL() string { return *p.HTMLURL } -// GetHttpsCertificate returns the HttpsCertificate field. -func (p *Pages) GetHttpsCertificate() *PagesHttpsCertificate { +// GetHTTPSCertificate returns the HTTPSCertificate field. +func (p *Pages) GetHTTPSCertificate() *PagesHTTPSCertificate { if p == nil { return nil } - return p.HttpsCertificate + return p.HTTPSCertificate } // GetHttpsEnforced returns the HttpsEnforced field if it's non-nil, zero value otherwise. @@ -9965,7 +9965,7 @@ func (p *PagesError) GetMessage() string { } // GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (p *PagesHttpsCertificate) GetDescription() string { +func (p *PagesHTTPSCertificate) GetDescription() string { if p == nil || p.Description == nil { return "" } @@ -9973,7 +9973,7 @@ func (p *PagesHttpsCertificate) GetDescription() string { } // GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. -func (p *PagesHttpsCertificate) GetExpiresAt() string { +func (p *PagesHTTPSCertificate) GetExpiresAt() string { if p == nil || p.ExpiresAt == nil { return "" } @@ -9981,7 +9981,7 @@ func (p *PagesHttpsCertificate) GetExpiresAt() string { } // GetState returns the State field if it's non-nil, zero value otherwise. -func (p *PagesHttpsCertificate) GetState() string { +func (p *PagesHTTPSCertificate) GetState() string { if p == nil || p.State == nil { return "" } diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index c0e39ab854e..f6a596ca444 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -11550,11 +11550,11 @@ func TestPages_GetHTMLURL(tt *testing.T) { p.GetHTMLURL() } -func TestPages_GetHttpsCertificate(tt *testing.T) { +func TestPages_GetHTTPSCertificate(tt *testing.T) { p := &Pages{} - p.GetHttpsCertificate() + p.GetHTTPSCertificate() p = nil - p.GetHttpsCertificate() + p.GetHTTPSCertificate() } func TestPages_GetHttpsEnforced(tt *testing.T) { @@ -11688,31 +11688,31 @@ func TestPagesError_GetMessage(tt *testing.T) { p.GetMessage() } -func TestPagesHttpsCertificate_GetDescription(tt *testing.T) { +func TestPagesHTTPSCertificate_GetDescription(tt *testing.T) { var zeroValue string - p := &PagesHttpsCertificate{Description: &zeroValue} + p := &PagesHTTPSCertificate{Description: &zeroValue} p.GetDescription() - p = &PagesHttpsCertificate{} + p = &PagesHTTPSCertificate{} p.GetDescription() p = nil p.GetDescription() } -func TestPagesHttpsCertificate_GetExpiresAt(tt *testing.T) { +func TestPagesHTTPSCertificate_GetExpiresAt(tt *testing.T) { var zeroValue string - p := &PagesHttpsCertificate{ExpiresAt: &zeroValue} + p := &PagesHTTPSCertificate{ExpiresAt: &zeroValue} p.GetExpiresAt() - p = &PagesHttpsCertificate{} + p = &PagesHTTPSCertificate{} p.GetExpiresAt() p = nil p.GetExpiresAt() } -func TestPagesHttpsCertificate_GetState(tt *testing.T) { +func TestPagesHTTPSCertificate_GetState(tt *testing.T) { var zeroValue string - p := &PagesHttpsCertificate{State: &zeroValue} + p := &PagesHTTPSCertificate{State: &zeroValue} p.GetState() - p = &PagesHttpsCertificate{} + p = &PagesHTTPSCertificate{} p.GetState() p = nil p.GetState() diff --git a/github/repos_pages.go b/github/repos_pages.go index a11e2474a5f..fb70e883952 100644 --- a/github/repos_pages.go +++ b/github/repos_pages.go @@ -19,7 +19,7 @@ type Pages struct { HTMLURL *string `json:"html_url,omitempty"` Source *PagesSource `json:"source,omitempty"` Public *bool `json:"public,omitempty"` - HttpsCertificate *PagesHttpsCertificate `json:"https_certificate,omitempty"` + HTTPSCertificate *PagesHTTPSCertificate `json:"https_certificate,omitempty"` HttpsEnforced *bool `json:"https_enforced,omitempty"` } @@ -47,11 +47,11 @@ type PagesBuild struct { } // PagesBuild represents the HTTPS Certificate information for a GitHub Pages site. -type PagesHttpsCertificate struct { - State *string `json:"state,omitempty"` - Description *string `json:"description,omitempty"` - Domains *[]*string `json:"domains,omitempty"` - ExpiresAt *string `json:"expires_at,omitempty"` +type PagesHTTPSCertificate struct { + State *string `json:"state,omitempty"` + Description *string `json:"description,omitempty"` + Domains []string `json:"domains,omitempty"` + ExpiresAt *string `json:"expires_at,omitempty"` } // createPagesRequest is a subset of Pages and is used internally diff --git a/github/repos_pages_test.go b/github/repos_pages_test.go index c4b276e23eb..af9e7342e6a 100644 --- a/github/repos_pages_test.go +++ b/github/repos_pages_test.go @@ -179,7 +179,7 @@ func TestRepositoriesService_GetPagesInfo(t *testing.T) { t.Errorf("Repositories.GetPagesInfo returned error: %v", err) } - want := &Pages{URL: String("u"), Status: String("s"), CNAME: String("c"), Custom404: Bool(false), HTMLURL: String("h"), Public: Bool(true), HttpsCertificate: &PagesHttpsCertificate{State: String("approved"), Description: String("Certificate is approved"), Domains: &[]*string{String("developer.github.com")}, ExpiresAt: String("2021-05-22")}, HttpsEnforced: Bool(true)} + want := &Pages{URL: String("u"), Status: String("s"), CNAME: String("c"), Custom404: Bool(false), HTMLURL: String("h"), Public: Bool(true), HTTPSCertificate: &PagesHTTPSCertificate{State: String("approved"), Description: String("Certificate is approved"), Domains: []string{"developer.github.com"}, ExpiresAt: String("2021-05-22")}, HttpsEnforced: Bool(true)} if !cmp.Equal(page, want) { t.Errorf("Repositories.GetPagesInfo returned %+v, want %+v", page, want) } From aea4a18606bdd61eb75805e1dc5dcc251db27415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=AElehcieR=20treboR?= Date: Wed, 29 Sep 2021 16:01:02 +0000 Subject: [PATCH 6/9] Also update HTTPSEnforced property --- github/github-accessors.go | 8 ++++---- github/github-accessors_test.go | 10 +++++----- github/repos_pages.go | 2 +- github/repos_pages_test.go | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index d2ee52c9d3e..dcb50adc393 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -9852,12 +9852,12 @@ func (p *Pages) GetHTTPSCertificate() *PagesHTTPSCertificate { return p.HTTPSCertificate } -// GetHttpsEnforced returns the HttpsEnforced field if it's non-nil, zero value otherwise. -func (p *Pages) GetHttpsEnforced() bool { - if p == nil || p.HttpsEnforced == nil { +// GetHTTPSEnforced returns the HTTPSEnforced field if it's non-nil, zero value otherwise. +func (p *Pages) GetHTTPSEnforced() bool { + if p == nil || p.HTTPSEnforced == nil { return false } - return *p.HttpsEnforced + return *p.HTTPSEnforced } // GetPublic returns the Public field if it's non-nil, zero value otherwise. diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index f6a596ca444..a216ad85943 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -11557,14 +11557,14 @@ func TestPages_GetHTTPSCertificate(tt *testing.T) { p.GetHTTPSCertificate() } -func TestPages_GetHttpsEnforced(tt *testing.T) { +func TestPages_GetHTTPSEnforced(tt *testing.T) { var zeroValue bool - p := &Pages{HttpsEnforced: &zeroValue} - p.GetHttpsEnforced() + p := &Pages{HTTPSEnforced: &zeroValue} + p.GetHTTPSEnforced() p = &Pages{} - p.GetHttpsEnforced() + p.GetHTTPSEnforced() p = nil - p.GetHttpsEnforced() + p.GetHTTPSEnforced() } func TestPages_GetPublic(tt *testing.T) { diff --git a/github/repos_pages.go b/github/repos_pages.go index fb70e883952..4161fcfe9c9 100644 --- a/github/repos_pages.go +++ b/github/repos_pages.go @@ -20,7 +20,7 @@ type Pages struct { Source *PagesSource `json:"source,omitempty"` Public *bool `json:"public,omitempty"` HTTPSCertificate *PagesHTTPSCertificate `json:"https_certificate,omitempty"` - HttpsEnforced *bool `json:"https_enforced,omitempty"` + HTTPSEnforced *bool `json:"https_enforced,omitempty"` } // PagesSource represents a GitHub page's source. diff --git a/github/repos_pages_test.go b/github/repos_pages_test.go index af9e7342e6a..46bffcff591 100644 --- a/github/repos_pages_test.go +++ b/github/repos_pages_test.go @@ -179,7 +179,7 @@ func TestRepositoriesService_GetPagesInfo(t *testing.T) { t.Errorf("Repositories.GetPagesInfo returned error: %v", err) } - want := &Pages{URL: String("u"), Status: String("s"), CNAME: String("c"), Custom404: Bool(false), HTMLURL: String("h"), Public: Bool(true), HTTPSCertificate: &PagesHTTPSCertificate{State: String("approved"), Description: String("Certificate is approved"), Domains: []string{"developer.github.com"}, ExpiresAt: String("2021-05-22")}, HttpsEnforced: Bool(true)} + want := &Pages{URL: String("u"), Status: String("s"), CNAME: String("c"), Custom404: Bool(false), HTMLURL: String("h"), Public: Bool(true), HTTPSCertificate: &PagesHTTPSCertificate{State: String("approved"), Description: String("Certificate is approved"), Domains: []string{"developer.github.com"}, ExpiresAt: String("2021-05-22")}, HTTPSEnforced: Bool(true)} if !cmp.Equal(page, want) { t.Errorf("Repositories.GetPagesInfo returned %+v, want %+v", page, want) } From 575bb81ad362255e742db4a82b7324f482f47a5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=AElehcieR=20treboR?= Date: Wed, 29 Sep 2021 12:01:53 -0400 Subject: [PATCH 7/9] Apply suggestions from code review Co-authored-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> --- github/repos_pages.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_pages.go b/github/repos_pages.go index 4161fcfe9c9..e64558bbb7d 100644 --- a/github/repos_pages.go +++ b/github/repos_pages.go @@ -46,7 +46,7 @@ type PagesBuild struct { UpdatedAt *Timestamp `json:"updated_at,omitempty"` } -// PagesBuild represents the HTTPS Certificate information for a GitHub Pages site. +// PagesHTTPSCertificate represents the HTTPS Certificate information for a GitHub Pages site. type PagesHTTPSCertificate struct { State *string `json:"state,omitempty"` Description *string `json:"description,omitempty"` From 1506b9815c19cb24474cd043960fed6f25c57f6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=AElehcieR=20treboR?= Date: Wed, 29 Sep 2021 19:38:05 +0000 Subject: [PATCH 8/9] Add comment explaining the use of string in lieu of Timestamp --- github/repos_pages.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/github/repos_pages.go b/github/repos_pages.go index 4161fcfe9c9..c5018b2ec0b 100644 --- a/github/repos_pages.go +++ b/github/repos_pages.go @@ -51,7 +51,8 @@ type PagesHTTPSCertificate struct { State *string `json:"state,omitempty"` Description *string `json:"description,omitempty"` Domains []string `json:"domains,omitempty"` - ExpiresAt *string `json:"expires_at,omitempty"` + // GitHub's API doesn't return a standard Timestamp, rather it returns a YYYY-MM-DD string + ExpiresAt *string `json:"expires_at,omitempty"` } // createPagesRequest is a subset of Pages and is used internally From 62a1c35925f0e11084287c9e3755e10ff9ed911d Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Wed, 29 Sep 2021 20:29:40 +0000 Subject: [PATCH 9/9] Update github/repos_pages.go --- github/repos_pages.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_pages.go b/github/repos_pages.go index b33f81df82b..04825baea1e 100644 --- a/github/repos_pages.go +++ b/github/repos_pages.go @@ -51,7 +51,7 @@ type PagesHTTPSCertificate struct { State *string `json:"state,omitempty"` Description *string `json:"description,omitempty"` Domains []string `json:"domains,omitempty"` - // GitHub's API doesn't return a standard Timestamp, rather it returns a YYYY-MM-DD string + // GitHub's API doesn't return a standard Timestamp, rather it returns a YYYY-MM-DD string. ExpiresAt *string `json:"expires_at,omitempty"` }