List Costs
Get customer costs
client.V1.Customers.ListCosts(ctx, params) (*CursorPage[CreditTypesmapEndTimestampTimeStartTimestampTimeV1CustomerListCostsResponse], error)
get/v1/customers/{customer_id}/costs
Fetch daily pending costs for the specified customer, broken down by credit type and line items. Note: this is not supported for customers whose plan includes a UNIQUE-type billable metric.
Parameters
paramsCustomerIDfieldEndingBeforefieldStartingOnfieldLimitfieldNextPagefieldV1CustomerListCostsParams
Returns
V1CustomerListCostsResponsestruct
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.Customers.ListCosts(context.TODO(), metronome.V1CustomerListCostsParams{
CustomerID: metronome.F("d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc"),
EndingBefore: metronome.F(time.Now()),
StartingOn: metronome.F(time.Now()),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
200 Example
{
"data": [
{
"credit_types": {
"foo": {
"cost": 0,
"line_item_breakdown": [
{
"cost": 0,
"name": "name",
"group_key": "group_key",
"group_value": "group_value"
}
],
"name": "name"
}
},
"end_timestamp": "2019-12-27T18:11:19.117Z",
"start_timestamp": "2019-12-27T18:11:19.117Z"
}
],
"next_page": "next_page"
}