## List With Groups `client.V1.Usage.ListWithGroups(ctx, params) (*CursorPage[V1UsageListWithGroupsResponse], error)` **post** `/v1/usage/groups` Fetch aggregated usage data for the specified customer, billable-metric, and optional group, broken into intervals of the specified length. ### Parameters - **params:** `V1UsageListWithGroupsParams` - **BillableMetricID:** `param.Field[string]` Body param: - **CustomerID:** `param.Field[string]` Body param: - **WindowSize:** `param.Field[V1UsageListWithGroupsParamsWindowSize]` Body param: A window_size of "day" or "hour" will return the usage for the specified period segmented into daily or hourly aggregates. A window_size of "none" will return a single usage aggregate for the entirety of the specified period. - `V1UsageListWithGroupsParamsWindowSize` - `V1UsageListWithGroupsParamsWindowSize` - `V1UsageListWithGroupsParamsWindowSize` - **Limit:** `param.Field[int64]` Query param: Max number of results that should be returned - **NextPage:** `param.Field[string]` Query param: Cursor that indicates where the next page of results should start. - **CurrentPeriod:** `param.Field[bool]` Body param: If true, will return the usage for the current billing period. Will return an error if the customer is currently uncontracted or starting_on and ending_before are specified when this is true. - **EndingBefore:** `param.Field[Time]` Body param: - **GroupBy:** `param.Field[V1UsageListWithGroupsParamsGroupBy]` Body param: - **Key:** `string` The name of the group_by key to use - **Values:** `[]string` Values of the group_by key to return in the query. Omit this if you'd like all values for the key returned. - **StartingOn:** `param.Field[Time]` Body param: ### Returns - Not supported - **EndingBefore:** `Time` - **GroupKey:** `string` - **GroupValue:** `string` - **StartingOn:** `Time` - **Value:** `float64` ### Example ```go package main import ( "context" "fmt" "time" "github.com/Metronome-Industries/metronome-go" "github.com/Metronome-Industries/metronome-go/option" ) func main() { client := metronome.NewClient( option.WithBearerToken("My Bearer Token"), ) page, err := client.V1.Usage.ListWithGroups(context.TODO(), metronome.V1UsageListWithGroupsParams{ BillableMetricID: metronome.F("222796fd-d29c-429e-89b2-549fabda4ed6"), CustomerID: metronome.F("04ca7e72-4229-4a6e-ab11-9f7376fccbcb"), WindowSize: metronome.F(metronome.V1UsageListWithGroupsParamsWindowSize("day")), EndingBefore: metronome.F(time.Now()), GroupBy: metronome.F(metronome.V1UsageListWithGroupsParamsGroupBy{ Key: metronome.F("region"), Values: metronome.F([]string{"US-East", "US-West", "EU-Central"}), }), StartingOn: metronome.F(time.Now()), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ```