Skip to content
  • Auto
  • Light
  • Dark
Talk to an expert

List

List all billable metrics
client.V1.BillableMetrics.List(ctx, query) (*CursorPage[IDstringNamestringAggregationKeystringAggregationTypeV1BillableMetricListResponseAggregationTypeArchivedAtTimeCustomFieldsmapEventTypeFilterEventTypeFilterGroupKeysarrayPropertyFiltersarraySqlstringV1BillableMetricListResponse], error)
get/v1/billable-metrics

List all billable metrics.

Parameters
queryIncludeArchivedfieldLimitfieldNextPagefieldV1BillableMetricListParams
Hide ParametersShow Parameters
IncludeArchivedfield
optional
param.Field[bool]

If true, the list of returned metrics will include archived metrics

Limitfield
optional
param.Field[int64]

Max number of results that should be returned

minimum1
maximum100
NextPagefield
optional
param.Field[string]

Cursor that indicates where the next page of results should start.

Returns
V1BillableMetricListResponsestruct
Hide ParametersShow Parameters
IDstring

ID of the billable metric

formatuuid
Namestring

The display name of the billable metric.

AggregationKeystring
optional

A key that specifies which property of the event is used to aggregate data. This key must be one of the property filter names and is not applicable when the aggregation type is 'count'.

AggregationTypeV1BillableMetricListResponseAggregationTypeCountV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeLatestV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeMaxV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeSumV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeUniqueV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationType
optional

Specifies the type of aggregation performed on matching events.

Hide ParametersShow Parameters
V1BillableMetricListResponseAggregationTypeCountconst
V1BillableMetricListResponseAggregationTypeCountV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeLatestV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeMaxV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeSumV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeUniqueV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationType
"COUNT"
V1BillableMetricListResponseAggregationTypeLatestconst
V1BillableMetricListResponseAggregationTypeCountV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeLatestV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeMaxV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeSumV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeUniqueV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationType
"LATEST"
V1BillableMetricListResponseAggregationTypeMaxconst
V1BillableMetricListResponseAggregationTypeCountV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeLatestV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeMaxV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeSumV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeUniqueV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationType
"MAX"
V1BillableMetricListResponseAggregationTypeSumconst
V1BillableMetricListResponseAggregationTypeCountV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeLatestV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeMaxV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeSumV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeUniqueV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationType
"SUM"
V1BillableMetricListResponseAggregationTypeUniqueconst
V1BillableMetricListResponseAggregationTypeCountV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeLatestV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeMaxV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeSumV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationTypeUniqueV1BillableMetricListResponseAggregationTypeV1BillableMetricListResponseAggregationType
"UNIQUE"
ArchivedAtTime
optional

RFC 3339 timestamp indicating when the billable metric was archived. If not provided, the billable metric is not archived.

formatdate-time
CustomFieldsmap
optional
map[string, string]
EventTypeFilterInValuesarrayNotInValuesarrayEventTypeFilter
optional

An optional filtering rule to match the 'event_type' property of an event.

GroupKeysarray
optional
[][]string

Property names that are used to group usage costs on an invoice. Each entry represents a set of properties used to slice events into distinct buckets.

PropertyFiltersarray
optional
[]NamestringExistsboolInValuesarrayNotInValuesarrayPropertyFilter

A list of filters to match events to this billable metric. Each filter defines a rule on an event property. All rules must pass for the event to match the billable metric.

Hide ParametersShow Parameters
Namestring

The name of the event property.

Existsbool
optional

Determines whether the property must exist in the event. If true, only events with this property will pass the filter. If false, only events without this property will pass the filter. If null or omitted, the existence of the property is optional.

InValuesarray
optional
[]string

Specifies the allowed values for the property to match an event. An event will pass the filter only if its property value is included in this list. If undefined, all property values will pass the filter. Must be non-empty if present.

NotInValuesarray
optional
[]string

Specifies the values that prevent an event from matching the filter. An event will not pass the filter if its property value is included in this list. If null or empty, all property values will pass the filter. Must be non-empty if present.

Sqlstring
optional

The SQL query associated with the billable metric

package main

import (
  "context"
  "fmt"

  "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.BillableMetrics.List(context.TODO(), metronome.V1BillableMetricListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
200 Example
{
  "data": [
    {
      "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "name": "name",
      "aggregation_key": "aggregation_key",
      "aggregation_type": "COUNT",
      "archived_at": "2019-12-27T18:11:19.117Z",
      "custom_fields": {
        "foo": "string"
      },
      "event_type_filter": {
        "in_values": [
          "string"
        ],
        "not_in_values": [
          "string"
        ]
      },
      "group_keys": [
        [
          "string"
        ]
      ],
      "property_filters": [
        {
          "name": "name",
          "exists": true,
          "in_values": [
            "string"
          ],
          "not_in_values": [
            "string"
          ]
        }
      ],
      "sql": "sql"
    }
  ],
  "next_page": "next_page"
}