diff --git a/github/billing.go b/github/billing.go index 2ce595d3349..0776358cdb2 100644 --- a/github/billing.go +++ b/github/billing.go @@ -87,7 +87,7 @@ type UsageItem struct { Date *string `json:"date"` Product *string `json:"product"` SKU *string `json:"sku"` - Quantity *int `json:"quantity"` + Quantity *float64 `json:"quantity"` UnitType *string `json:"unitType"` PricePerUnit *float64 `json:"pricePerUnit"` GrossAmount *float64 `json:"grossAmount"` diff --git a/github/billing_test.go b/github/billing_test.go index 3e9c9e7fc42..3c29054840b 100644 --- a/github/billing_test.go +++ b/github/billing_test.go @@ -556,7 +556,7 @@ func TestBillingService_GetUsageReportOrg(t *testing.T) { Date: Ptr("2023-08-01"), Product: Ptr("Actions"), SKU: Ptr("Actions Linux"), - Quantity: Ptr(100), + Quantity: Ptr(100.0), UnitType: Ptr("minutes"), PricePerUnit: Ptr(0.008), GrossAmount: Ptr(0.8), @@ -637,7 +637,7 @@ func TestBillingService_GetUsageReportUser(t *testing.T) { Date: Ptr("2023-08-15"), Product: Ptr("Codespaces"), SKU: Ptr("Codespaces Linux"), - Quantity: Ptr(50), + Quantity: Ptr(50.0), UnitType: Ptr("hours"), PricePerUnit: Ptr(0.18), GrossAmount: Ptr(9.0), diff --git a/github/github-accessors.go b/github/github-accessors.go index 2b832617c85..57e2d07dfc8 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -27630,12 +27630,12 @@ func (u *UsageItem) GetProduct() string { return *u.Product } -// GetQuantity returns the Quantity field if it's non-nil, zero value otherwise. -func (u *UsageItem) GetQuantity() int { - if u == nil || u.Quantity == nil { - return 0 +// GetQuantity returns the Quantity field. +func (u *UsageItem) GetQuantity() *float64 { + if u == nil { + return nil } - return *u.Quantity + return u.Quantity } // GetRepositoryName returns the RepositoryName field if it's non-nil, zero value otherwise. diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index c0b94a55148..1e66350a1d7 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -35523,10 +35523,7 @@ func TestUsageItem_GetProduct(tt *testing.T) { func TestUsageItem_GetQuantity(tt *testing.T) { tt.Parallel() - var zeroValue int - u := &UsageItem{Quantity: &zeroValue} - u.GetQuantity() - u = &UsageItem{} + u := &UsageItem{} u.GetQuantity() u = nil u.GetQuantity()