Repository: google/go-github (go)

Issue:
BUG: Remove Sub Issue uses incorrect endpoint
## SubIssues Bug

Recent addition for managing Sub Issues uses wrong endpoint:

`Failed to remove sub-issue: 404 Not Found, DELETE https://api.github.com/repos/REPO/OWNER/issues/ISSUE_NUMBER/sub_issues: 404 Not Found []`

https://github.com/google/go-github/blob/master/github/sub_issue.go#L51-L53

This endpoint (however inconsistent) must be singular form:

https://docs.github.com/en/rest/issues/sub-issues?apiVersion=2022-11-28#remove-sub-issue



Pull request:
fix: Fix broken URL for `SubIssueService.Remove` endpoint
Fixes #3611

Patch:
diff --git a/github/billing.go b/github/billing.go
index 2ce595d3..0776358c 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/github-accessors.go b/github/github-accessors.go
index 2b832617..57e2d07d 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/sub_issue.go b/github/sub_issue.go
index 8b24adb8..2effcc5a 100644
--- a/github/sub_issue.go
+++ b/github/sub_issue.go
@@ -49,8 +49,8 @@ type SubIssueRequest struct {
 // GitHub API docs: https://docs.github.com/rest/issues/sub-issues#remove-sub-issue
 //
 //meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/sub_issue
-func (s *SubIssueService) Remove(ctx context.Context, owner, repo string, subIssueNumber int64, subIssue SubIssueRequest) (*SubIssue, *Response, error) {
-	u := fmt.Sprintf("repos/%v/%v/issues/%v/sub_issues", owner, repo, subIssueNumber)
+func (s *SubIssueService) Remove(ctx context.Context, owner, repo string, issueNumber int64, subIssue SubIssueRequest) (*SubIssue, *Response, error) {
+	u := fmt.Sprintf("repos/%v/%v/issues/%v/sub_issue", owner, repo, issueNumber)
 
 	req, err := s.client.NewRequest("DELETE", u, subIssue)
 	if err != nil {


Test patch:
diff --git a/github/billing_test.go b/github/billing_test.go
index 3e9c9e7f..3c290548 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_test.go b/github/github-accessors_test.go
index c0b94a55..1e66350a 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()
diff --git a/github/sub_issue_test.go b/github/sub_issue_test.go
index 9a88b244..72e331c3 100644
--- a/github/sub_issue_test.go
+++ b/github/sub_issue_test.go
@@ -97,7 +97,7 @@ func TestSubIssuesService_Remove(t *testing.T) {
 
 	input := &SubIssueRequest{SubIssueID: 42}
 
-	mux.HandleFunc("/repos/o/r/issues/1/sub_issues", func(w http.ResponseWriter, r *http.Request) {
+	mux.HandleFunc("/repos/o/r/issues/1/sub_issue", func(w http.ResponseWriter, r *http.Request) {
 		v := new(SubIssueRequest)
 		assertNilError(t, json.NewDecoder(r.Body).Decode(v))