feat: Add support for enterprise billing cost centers API by gjasny · Pull Request #3803 · google/go-github

@gjasny

@gjasny

@codecov

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.27%. Comparing base (c343d93) to head (bb42507).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3803      +/-   ##
==========================================
+ Coverage   92.23%   92.27%   +0.04%     
==========================================
  Files         191      192       +1     
  Lines       13823    13896      +73     
==========================================
+ Hits        12750    12823      +73     
  Misses        884      884              
  Partials      189      189              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

gmlewis

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, @gjasny - thank you!
Just one minor tweak, please, then we should be ready for a second LGTM+Approval from any other contributor to this repo before merging.

cc: @stevehipwell - @alexandear - @zyfy29

@gjasny

stevehipwell

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

gmlewis

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alexandear

}

// CostCenterListOptions specifies optional parameters to the EnterpriseService.ListCostCenters method.
type CostCenterListOptions struct {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe better:

type CostCenterListOptions struct {
type ListCostCenterOptions struct {

It's for consistency with:

type ListArtifactsOptions struct {

type ListWorkflowRunsOptions struct {

type ListOrgRunnerGroupOptions struct {

type ListWorkflowJobsOptions struct {

type ListCodespacesOptions struct {

// CostCenterListOptions specifies optional parameters to the EnterpriseService.ListCostCenters method.
type CostCenterListOptions struct {
State *string `url:"state,omitempty"`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a comment:

// Set to `active` or `deleted` to only list cost centers in a specific state.

// CostCenterRequest represents a request to create or update a cost center.
type CostCenterRequest struct {
Name *string `json:"name,omitempty"`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This parameter is required whether we create or update cost center:

Name *string `json:"name,omitempty"`
Name string `json:"name"`

@gmlewis

@gjasny

@gjasny gjasny deleted the billing-costcenter branch

November 5, 2025 13:25

@gjasny

Thanks for the fast and thorough review.