Create a meter.
Scopes: meters:write
meters:write
Go
package main import( "context" "os" polargo "github.com/polarsource/polar-go" "github.com/polarsource/polar-go/models/components" "log" ) func main() { ctx := context.Background() s := polargo.New( polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")), ) res, err := s.Meters.Create(ctx, components.MeterCreate{ Name: "<value>", Filter: components.Filter{ Conjunction: components.FilterConjunctionOr, Clauses: []components.Clauses{}, }, Aggregation: components.CreateMeterCreateAggregationCount( components.CountAggregation{}, ), OrganizationID: polargo.Pointer("1dbfc517-0bbf-4301-9ba8-555ca42b9737"), }) if err != nil { log.Fatal(err) } if res.Meter != nil { // handle response } }
{ "metadata": {}, "created_at": "2023-11-07T05:31:56Z", "modified_at": "2023-11-07T05:31:56Z", "id": "<string>", "name": "<string>", "filter": { "conjunction": "and", "clauses": [ { "property": "<string>", "operator": "eq", "value": "<string>" } ] }, "aggregation": { "func": "count" }, "organization_id": "<string>", "archived_at": "2023-11-07T05:31:56Z" }
3
Show child attributes
Was this page helpful?