Skip to content
48 changes: 48 additions & 0 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 17 additions & 6 deletions github/repos_pages.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions github/repos_pages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,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()
Expand All @@ -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")}
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)
}
Expand Down