feat!: Add pagination to Enterprise.ListBudgets and add GetUserStatesForBudget (#4408) - #4501
feat!: Add pagination to Enterprise.ListBudgets and add GetUserStatesForBudget (#4408)#4501devaniketh wants to merge 4 commits into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4501 +/- ##
==========================================
- Coverage 98.53% 98.52% -0.01%
==========================================
Files 195 195
Lines 17763 17798 +35
==========================================
+ Hits 17502 17535 +33
- Misses 261 263 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| // | ||
| //meta:operation GET /enterprises/{enterprise}/settings/billing/budgets | ||
| func (s *EnterpriseService) ListBudgets(ctx context.Context, enterprise string) (*EnterpriseListBudgets, *Response, error) { | ||
| func (s *EnterpriseService) ListBudgets(ctx context.Context, enterprise string, opts *ListOptions) (*EnterpriseListBudgets, *Response, error) { |
| u := fmt.Sprintf("enterprises/%v/settings/billing/budgets/%v/user-states", enterprise, budgetID) | ||
|
|
||
| u, err := addOptions(u, opts) |
There was a problem hiding this comment.
| u := fmt.Sprintf("enterprises/%v/settings/billing/budgets/%v/user-states", enterprise, budgetID) | |
| u, err := addOptions(u, opts) | |
| u := fmt.Sprintf("enterprises/%v/settings/billing/budgets/%v/user-states", enterprise, budgetID) | |
| u, err := addOptions(u, opts) |
| type EnterpriseBudgetUserStates struct { | ||
| UserStates []*EnterpriseBudgetUserState `json:"user_states"` | ||
| HasNextPage *bool `json:"has_next_page,omitempty"` | ||
| TotalCount *int `json:"total_count,omitempty"` | ||
| } |
There was a problem hiding this comment.
has_next_page and total_count are required field and we don't use ,omitempty with them.
"required": [
"user_states",
"has_next_page",
"total_count"
]| type EnterpriseBudgetUserStates struct { | |
| UserStates []*EnterpriseBudgetUserState `json:"user_states"` | |
| HasNextPage *bool `json:"has_next_page,omitempty"` | |
| TotalCount *int `json:"total_count,omitempty"` | |
| } | |
| type EnterpriseBudgetUserStates struct { | |
| UserStates []*EnterpriseBudgetUserState `json:"user_states"` | |
| HasNextPage bool `json:"has_next_page"` | |
| TotalCount int `json:"total_count"` | |
| } |
| type EnterpriseBudgetUserState struct { | ||
| User *string `json:"user,omitempty"` | ||
| ConsumedAmount *float64 `json:"consumed_amount,omitempty"` | ||
| TargetAmount *float64 `json:"target_amount,omitempty"` | ||
| OverrideBudgetID *string `json:"override_budget_id,omitempty"` | ||
| } |
There was a problem hiding this comment.
consumed_amount and target_amount are required.
"required": [
"consumed_amount",
"target_amount"
]| type EnterpriseBudgetUserState struct { | |
| User *string `json:"user,omitempty"` | |
| ConsumedAmount *float64 `json:"consumed_amount,omitempty"` | |
| TargetAmount *float64 `json:"target_amount,omitempty"` | |
| OverrideBudgetID *string `json:"override_budget_id,omitempty"` | |
| } | |
| type EnterpriseBudgetUserState struct { | |
| User *string `json:"user,omitempty"` | |
| ConsumedAmount float64 `json:"consumed_amount"` | |
| TargetAmount float64 `json:"target_amount"` | |
| OverrideBudgetID *string `json:"override_budget_id,omitempty"` | |
| } |

Fixes #4408
Summary
EnterpriseListBudgetsOptionsembeddingListOptionsto enable pagination (page,per_page) inEnterpriseService.ListBudgets.EnterpriseService.GetUserStatesForBudgetalong withEnterpriseBudgetUserState,EnterpriseBudgetUserStates, andEnterpriseGetUserStatesOptionsfor endpointGET /enterprises/{enterprise}/settings/billing/budgets/{budget_id}/user-states.ListBudgetsIter), and stringifier test fixtures viascript/generate.sh.enterprise_budgets_test.go.