diff --git a/github/enterprise_manage_ghes_config.go b/github/enterprise_manage_ghes_config.go index 9770d044af3..819788ebfc6 100644 --- a/github/enterprise_manage_ghes_config.go +++ b/github/enterprise_manage_ghes_config.go @@ -87,7 +87,7 @@ type LicenseStatus struct { ReferenceNumber *string `json:"referenceNumber,omitempty"` Seats *int `json:"seats,omitempty"` SSHAllowed *bool `json:"sshAllowed,omitempty"` - SupportKey *string `json:"supportKey,omitempty"` + SupportKey *bool `json:"supportKey,omitempty"` UnlimitedSeating *bool `json:"unlimitedSeating,omitempty"` } @@ -354,14 +354,14 @@ func (s *EnterpriseService) InitialConfig(ctx context.Context, license, password // GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#get-the-enterprise-license-information // //meta:operation GET /manage/v1/config/license -func (s *EnterpriseService) License(ctx context.Context) ([]*LicenseStatus, *Response, error) { +func (s *EnterpriseService) License(ctx context.Context) (*LicenseStatus, *Response, error) { u := "manage/v1/config/license" req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - var licenseStatus []*LicenseStatus + var licenseStatus *LicenseStatus resp, err := s.client.Do(req, &licenseStatus) if err != nil { return nil, resp, err diff --git a/github/enterprise_manage_ghes_config_test.go b/github/enterprise_manage_ghes_config_test.go index 46fa8e213e4..3c793149585 100644 --- a/github/enterprise_manage_ghes_config_test.go +++ b/github/enterprise_manage_ghes_config_test.go @@ -407,7 +407,7 @@ func TestEnterpriseService_License(t *testing.T) { mux.HandleFunc("/manage/v1/config/license", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - fmt.Fprint(w, `[{ + fmt.Fprint(w, `{ "advancedSecurityEnabled": true, "advancedSecuritySeats": 0, "clusterSupport": false, @@ -424,9 +424,9 @@ func TestEnterpriseService_License(t *testing.T) { "referenceNumber": "32a145", "seats": 0, "sshAllowed": true, - "supportKey": "", + "supportKey": true, "unlimitedSeating": true - }]`) + }`) }) ctx := t.Context() @@ -435,7 +435,7 @@ func TestEnterpriseService_License(t *testing.T) { t.Errorf("Enterprise.License returned error: %v", err) } - want := []*LicenseStatus{{ + want := &LicenseStatus{ AdvancedSecurityEnabled: Ptr(true), AdvancedSecuritySeats: Ptr(0), ClusterSupport: Ptr(false), @@ -452,9 +452,9 @@ func TestEnterpriseService_License(t *testing.T) { ReferenceNumber: Ptr("32a145"), Seats: Ptr(0), SSHAllowed: Ptr(true), - SupportKey: Ptr(""), + SupportKey: Ptr(true), UnlimitedSeating: Ptr(true), - }} + } if diff := cmp.Diff(want, license); diff != "" { t.Errorf("diff mismatch (-want +got):\n%v", diff) } diff --git a/github/github-accessors.go b/github/github-accessors.go index bc3194bc1b6..99f7754c537 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -21039,9 +21039,9 @@ func (l *LicenseStatus) GetSSHAllowed() bool { } // GetSupportKey returns the SupportKey field if it's non-nil, zero value otherwise. -func (l *LicenseStatus) GetSupportKey() string { +func (l *LicenseStatus) GetSupportKey() bool { if l == nil || l.SupportKey == nil { - return "" + return false } return *l.SupportKey } diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index c9ced173fe0..bcfc91818d8 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -26630,7 +26630,7 @@ func TestLicenseStatus_GetSSHAllowed(tt *testing.T) { func TestLicenseStatus_GetSupportKey(tt *testing.T) { tt.Parallel() - var zeroValue string + var zeroValue bool l := &LicenseStatus{SupportKey: &zeroValue} l.GetSupportKey() l = &LicenseStatus{}