@@ -74,6 +74,34 @@ type UsageReportOptions struct {
7474 Hour * int `url:"hour,omitempty"`
7575}
7676
77+ // PremiumRequestUsageReportOptions specifies optional parameters
78+ // for the enhanced billing platform premium request usage report.
79+ type PremiumRequestUsageReportOptions struct {
80+ // If specified, only return results for a single year.
81+ // The value of year is an integer with four digits representing a year. For example, 2025.
82+ // Default value is the current year.
83+ Year * int `url:"year,omitempty"`
84+
85+ // If specified, only return results for a single month.
86+ // The value of month is an integer between 1 and 12. Default value is the current month.
87+ // If no year is specified the default year is used.
88+ Month * int `url:"month,omitempty"`
89+
90+ // If specified, only return results for a single day.
91+ // The value of day is an integer between 1 and 31.
92+ // If no year or month is specified, the default year and month are used.
93+ Day * int `url:"day,omitempty"`
94+
95+ // The user name to query usage for. The name is not case sensitive.
96+ User * string `url:"user,omitempty"`
97+
98+ // The model name to query usage for. The name is not case sensitive.
99+ Model * string `url:"model,omitempty"`
100+
101+ // The product name to query usage for. The name is not case sensitive.
102+ Product * string `url:"product,omitempty"`
103+ }
104+
77105// UsageItem represents a single usage item in the enhanced billing platform report.
78106type UsageItem struct {
79107 Date * string `json:"date"`
@@ -95,6 +123,38 @@ type UsageReport struct {
95123 UsageItems []* UsageItem `json:"usageItems,omitempty"`
96124}
97125
126+ // PremiumRequestUsageItem represents a single usage line item in premium request usage reports.
127+ type PremiumRequestUsageItem struct {
128+ Product string `json:"product"`
129+ SKU string `json:"sku"`
130+ Model string `json:"model"`
131+ UnitType string `json:"unitType"`
132+ PricePerUnit float64 `json:"pricePerUnit"`
133+ GrossQuantity int `json:"grossQuantity"`
134+ GrossAmount float64 `json:"grossAmount"`
135+ DiscountQuantity int `json:"discountQuantity"`
136+ DiscountAmount float64 `json:"discountAmount"`
137+ NetQuantity int `json:"netQuantity"`
138+ NetAmount float64 `json:"netAmount"`
139+ }
140+
141+ // PremiumRequestUsageTimePeriod represents a time period for premium request usage reports.
142+ type PremiumRequestUsageTimePeriod struct {
143+ Year int `json:"year"`
144+ Month * int `json:"month,omitempty"`
145+ Day * int `json:"day,omitempty"`
146+ }
147+
148+ // PremiumRequestUsageReport represents the premium request usage report response.
149+ type PremiumRequestUsageReport struct {
150+ TimePeriod PremiumRequestUsageTimePeriod `json:"timePeriod"`
151+ Organization string `json:"organization"`
152+ User * string `json:"user,omitempty"`
153+ Product * string `json:"product,omitempty"`
154+ Model * string `json:"model,omitempty"`
155+ UsageItems []* PremiumRequestUsageItem `json:"usageItems"`
156+ }
157+
98158// GetPackagesBillingOrg returns the free and paid storage used for GitHub Packages in gigabytes for an Org.
99159//
100160// GitHub API docs: https://docs.github.com/rest/billing/billing#get-github-packages-billing-for-an-organization
@@ -262,3 +322,61 @@ func (s *BillingService) GetUsageReportUser(ctx context.Context, user string, op
262322
263323 return usageReport , resp , nil
264324}
325+
326+ // GetOrganizationPremiumRequestUsageReport returns a report of the premium request
327+ // usage for an organization using the enhanced billing platform.
328+ //
329+ // Note: This endpoint is only available to organizations with access to the enhanced billing platform.
330+ //
331+ // GitHub API docs: https://docs.github.com/rest/billing/enhanced-billing#get-billing-premium-request-usage-report-for-an-organization
332+ //
333+ //meta:operation GET /organizations/{org}/settings/billing/premium_request/usage
334+ func (s * BillingService ) GetOrganizationPremiumRequestUsageReport (ctx context.Context , org string , opts * PremiumRequestUsageReportOptions ) (* PremiumRequestUsageReport , * Response , error ) {
335+ u := fmt .Sprintf ("organizations/%v/settings/billing/premium_request/usage" , org )
336+ u , err := addOptions (u , opts )
337+ if err != nil {
338+ return nil , nil , err
339+ }
340+
341+ req , err := s .client .NewRequest ("GET" , u , nil )
342+ if err != nil {
343+ return nil , nil , err
344+ }
345+
346+ premiumRequestUsageReport := new (PremiumRequestUsageReport )
347+ resp , err := s .client .Do (ctx , req , premiumRequestUsageReport )
348+ if err != nil {
349+ return nil , resp , err
350+ }
351+
352+ return premiumRequestUsageReport , resp , nil
353+ }
354+
355+ // GetPremiumRequestUsageReport returns a report of the premium request
356+ // usage for a user using the enhanced billing platform.
357+ //
358+ // Note: This endpoint is only available to users with access to the enhanced billing platform.
359+ //
360+ // GitHub API docs: https://docs.github.com/rest/billing/enhanced-billing#get-billing-premium-request-usage-report-for-a-user
361+ //
362+ //meta:operation GET /users/{username}/settings/billing/premium_request/usage
363+ func (s * BillingService ) GetPremiumRequestUsageReport (ctx context.Context , user string , opts * PremiumRequestUsageReportOptions ) (* PremiumRequestUsageReport , * Response , error ) {
364+ u := fmt .Sprintf ("users/%v/settings/billing/premium_request/usage" , user )
365+ u , err := addOptions (u , opts )
366+ if err != nil {
367+ return nil , nil , err
368+ }
369+
370+ req , err := s .client .NewRequest ("GET" , u , nil )
371+ if err != nil {
372+ return nil , nil , err
373+ }
374+
375+ premiumRequestUsageReport := new (PremiumRequestUsageReport )
376+ resp , err := s .client .Do (ctx , req , premiumRequestUsageReport )
377+ if err != nil {
378+ return nil , resp , err
379+ }
380+
381+ return premiumRequestUsageReport , resp , nil
382+ }
0 commit comments