+
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.

24 changes: 18 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,15 @@ type PagesBuild struct {
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
}

// PagesHTTPSCertificate 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"`
// 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
// 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{"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
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载