metronome

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

README

Metronome Go API Library

Go Reference

The Metronome Go library provides convenient access to the Metronome REST API from applications written in Go.

[!WARNING] The 1.0.0 version of this package introduces a new design with significant breaking changes. Please refer to the migration guide for more information on how to update your code.

Installation

import (
	"github.com/Metronome-Industries/metronome-go" // imported as metronome
)

Or to pin the version:

go get -u 'github.com/Metronome-Industries/metronome-go@v1.0.0'

Requirements

This library requires Go 1.18+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"

	"github.com/Metronome-Industries/metronome-go"
	"github.com/Metronome-Industries/metronome-go/option"
)

func main() {
	client := metronome.NewClient(
		option.WithBearerToken("My Bearer Token"), // defaults to os.LookupEnv("METRONOME_BEARER_TOKEN")
	)
	err := client.V1.Usage.Ingest(context.TODO(), metronome.V1UsageIngestParams{
		Usage: []metronome.V1UsageIngestParamsUsage{{
			TransactionID: "90e9401f-0f8c-4cd3-9a9f-d6beb56d8d72",
			CustomerID:    "team@example.com",
			EventType:     "heartbeat",
			Timestamp:     "2024-01-01T00:00:00Z",
			Properties: map[string]any{
				"cluster_id":  "42",
				"cpu_seconds": 60,
				"region":      "Europe",
			},
		}},
	})
	if err != nil {
		panic(err.Error())
	}
}

Request fields

The metronome library uses the omitzero semantics from the Go 1.24+ encoding/json release for request fields.

Required primitive fields (int64, string, etc.) feature the tag `json:"...,required"`. These fields are always serialized, even their zero values.

Optional primitive types are wrapped in a param.Opt[T]. These fields can be set with the provided constructors, metronome.String(string), metronome.Int(int64), etc.

Any param.Opt[T], map, slice, struct or string enum uses the tag `json:"...,omitzero"`. Its zero value is considered omitted.

The param.IsOmitted(any) function can confirm the presence of any omitzero field.

p := metronome.ExampleParams{
	ID:   "id_xxx",                // required property
	Name: metronome.String("..."), // optional property

	Point: metronome.Point{
		X: 0,                // required field will serialize as 0
		Y: metronome.Int(1), // optional field will serialize as 1
		// ... omitted non-required fields will not be serialized
	},

	Origin: metronome.Origin{}, // the zero value of [Origin] is considered omitted
}

To send null instead of a param.Opt[T], use param.Null[T](). To send null instead of a struct T, use param.NullStruct[T]().

p.Name = param.Null[string]()       // 'null' instead of string
p.Point = param.NullStruct[Point]() // 'null' instead of struct

param.IsNull(p.Name)  // true
param.IsNull(p.Point) // true

Request structs contain a .SetExtraFields(map[string]any) method which can send non-conforming fields in the request body. Extra fields overwrite any struct fields with a matching key. For security reasons, only use SetExtraFields with trusted data.

To send a custom value instead of a struct, use param.Override[T](value).

// In cases where the API specifies a given type,
// but you want to send something else, use [SetExtraFields]:
p.SetExtraFields(map[string]any{
	"x": 0.01, // send "x" as a float instead of int
})

// Send a number instead of an object
custom := param.Override[metronome.FooParams](12)
Request unions

Unions are represented as a struct with fields prefixed by "Of" for each of it's variants, only one field can be non-zero. The non-zero field will be serialized.

Sub-properties of the union can be accessed via methods on the union struct. These methods return a mutable pointer to the underlying data, if present.

// Only one field can be non-zero, use param.IsOmitted() to check if a field is set
type AnimalUnionParam struct {
	OfCat *Cat `json:",omitzero,inline`
	OfDog *Dog `json:",omitzero,inline`
}

animal := AnimalUnionParam{
	OfCat: &Cat{
		Name: "Whiskers",
		Owner: PersonParam{
			Address: AddressParam{Street: "3333 Coyote Hill Rd", Zip: 0},
		},
	},
}

// Mutating a field
if address := animal.GetOwner().GetAddress(); address != nil {
	address.ZipCode = 94304
}
Response objects

All fields in response structs are ordinary value types (not pointers or wrappers). Response structs also include a special JSON field containing metadata about each property.

type Animal struct {
	Name   string `json:"name,nullable"`
	Owners int    `json:"owners"`
	Age    int    `json:"age"`
	JSON   struct {
		Name        respjson.Field
		Owner       respjson.Field
		Age         respjson.Field
		ExtraFields map[string]respjson.Field
	} `json:"-"`
}

To handle optional data, use the .Valid() method on the JSON field. .Valid() returns true if a field is not null, not present, or couldn't be marshaled.

If .Valid() is false, the corresponding field will simply be its zero value.

raw := `{"owners": 1, "name": null}`

var res Animal
json.Unmarshal([]byte(raw), &res)

// Accessing regular fields

res.Owners // 1
res.Name   // ""
res.Age    // 0

// Optional field checks

res.JSON.Owners.Valid() // true
res.JSON.Name.Valid()   // false
res.JSON.Age.Valid()    // false

// Raw JSON values

res.JSON.Owners.Raw()                  // "1"
res.JSON.Name.Raw() == "null"          // true
res.JSON.Name.Raw() == respjson.Null   // true
res.JSON.Age.Raw() == ""               // true
res.JSON.Age.Raw() == respjson.Omitted // true

These .JSON structs also include an ExtraFields map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
Response Unions

In responses, unions are represented by a flattened struct containing all possible fields from each of the object variants. To convert it to a variant use the .AsFooVariant() method or the .AsAny() method if present.

If a response value union contains primitive values, primitive fields will be alongside the properties but prefixed with Of and feature the tag json:"...,inline".

type AnimalUnion struct {
	// From variants [Dog], [Cat]
	Owner Person `json:"owner"`
	// From variant [Dog]
	DogBreed string `json:"dog_breed"`
	// From variant [Cat]
	CatBreed string `json:"cat_breed"`
	// ...

	JSON struct {
		Owner respjson.Field
		// ...
	} `json:"-"`
}

// If animal variant
if animal.Owner.Address.ZipCode == "" {
	panic("missing zip code")
}

// Switch on the variant
switch variant := animal.AsAny().(type) {
case Dog:
case Cat:
default:
	panic("unexpected type")
}
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := metronome.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.V1.Contracts.New(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

The request option option.WithDebugLog(nil) may be helpful while debugging.

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

iter := client.V1.Contracts.Products.ListAutoPaging(context.TODO(), metronome.V1ContractProductListParams{})
// Automatically fetches more pages as needed.
for iter.Next() {
	v1ContractProductListResponse := iter.Current()
	fmt.Printf("%+v\n", v1ContractProductListResponse)
}
if err := iter.Err(); err != nil {
	panic(err.Error())
}

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

page, err := client.V1.Contracts.Products.List(context.TODO(), metronome.V1ContractProductListParams{})
for page != nil {
	for _, product := range page.Data {
		fmt.Printf("%+v\n", product)
	}
	page, err = page.GetNextPage()
}
if err != nil {
	panic(err.Error())
}
Errors

When the API returns a non-success status code, we return an error with type *metronome.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.V1.Contracts.New(context.TODO(), metronome.V1ContractNewParams{
	CustomerID: "13117714-3f05-48e5-a6e9-a66093f13b4d",
	StartingAt: time.Now(),
})
if err != nil {
	var apierr *metronome.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/v1/contracts/create": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.V1.Contracts.New(
	ctx,
	metronome.V1ContractNewParams{
		CustomerID: "13117714-3f05-48e5-a6e9-a66093f13b4d",
		StartingAt: time.Now(),
	},
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as io.Reader. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper metronome.File(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := metronome.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.V1.Contracts.New(
	context.TODO(),
	metronome.V1ContractNewParams{
		CustomerID: "13117714-3f05-48e5-a6e9-a66093f13b4d",
		StartingAt: time.Now(),
	},
	option.WithMaxRetries(5),
)
Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the option.WithResponseInto() request option. This is useful when you need to examine response headers, status codes, or other details.

// Create a variable to store the HTTP response
var response *http.Response
contract, err := client.V1.Contracts.New(
	context.TODO(),
	metronome.V1ContractNewParams{
		CustomerID: "13117714-3f05-48e5-a6e9-a66093f13b4d",
		StartingAt: time.Now(),
	},
	option.WithResponseInto(&response),
)
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", contract)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]any

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   "id_xxxx",
    Data: FooNewParamsData{
        FirstName: metronome.String("John"),
    },
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := metronome.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals.)
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Contributing

See the contributing documentation.

Documentation

Index

Constants

View Source
const CommitRateRateTypeCustom = shared.CommitRateRateTypeCustom

Equals "CUSTOM"

View Source
const CommitRateRateTypeFlat = shared.CommitRateRateTypeFlat

Equals "FLAT"

View Source
const CommitRateRateTypePercentage = shared.CommitRateRateTypePercentage

Equals "PERCENTAGE"

View Source
const CommitRateRateTypeSubscription = shared.CommitRateRateTypeSubscription

Equals "SUBSCRIPTION"

View Source
const CommitRateRateTypeTiered = shared.CommitRateRateTypeTiered

Equals "TIERED"

View Source
const CommitRateTypeCommitRate = shared.CommitRateTypeCommitRate

Equals "COMMIT_RATE"

View Source
const CommitRateTypeListRate = shared.CommitRateTypeListRate

Equals "LIST_RATE"

View Source
const CommitTypePostpaid = shared.CommitTypePostpaid

Equals "POSTPAID"

View Source
const CommitTypePrepaid = shared.CommitTypePrepaid

Equals "PREPAID"

View Source
const ContractScheduledChargesOnUsageInvoicesAll = shared.ContractScheduledChargesOnUsageInvoicesAll

Equals "ALL"

View Source
const ContractV2MultiplierOverridePrioritizationExplicit = shared.ContractV2MultiplierOverridePrioritizationExplicit

Equals "EXPLICIT"

View Source
const ContractV2MultiplierOverridePrioritizationLowestMultiplier = shared.ContractV2MultiplierOverridePrioritizationLowestMultiplier

Equals "LOWEST_MULTIPLIER"

View Source
const ContractV2ScheduledChargesOnUsageInvoicesAll = shared.ContractV2ScheduledChargesOnUsageInvoicesAll

Equals "ALL"

View Source
const ContractWithoutAmendmentsScheduledChargesOnUsageInvoicesAll = shared.ContractWithoutAmendmentsScheduledChargesOnUsageInvoicesAll

Equals "ALL"

View Source
const CreditRateTypeCommitRate = shared.CreditRateTypeCommitRate

Equals "COMMIT_RATE"

View Source
const CreditRateTypeListRate = shared.CreditRateTypeListRate

Equals "LIST_RATE"

View Source
const CreditTypeCredit = shared.CreditTypeCredit

Equals "CREDIT"

View Source
const OverrideRateTypeCustom = shared.OverrideRateTypeCustom

Equals "CUSTOM"

View Source
const OverrideRateTypeFlat = shared.OverrideRateTypeFlat

Equals "FLAT"

View Source
const OverrideRateTypePercentage = shared.OverrideRateTypePercentage

Equals "PERCENTAGE"

View Source
const OverrideRateTypeSubscription = shared.OverrideRateTypeSubscription

Equals "SUBSCRIPTION"

View Source
const OverrideRateTypeTiered = shared.OverrideRateTypeTiered

Equals "TIERED"

View Source
const OverrideTargetCommitRate = shared.OverrideTargetCommitRate

Equals "COMMIT_RATE"

View Source
const OverrideTargetListRate = shared.OverrideTargetListRate

Equals "LIST_RATE"

View Source
const OverrideTypeMultiplier = shared.OverrideTypeMultiplier

Equals "MULTIPLIER"

View Source
const OverrideTypeOverwrite = shared.OverrideTypeOverwrite

Equals "OVERWRITE"

View Source
const OverrideTypeTiered = shared.OverrideTypeTiered

Equals "TIERED"

View Source
const OverwriteRateRateTypeCustom = shared.OverwriteRateRateTypeCustom

Equals "CUSTOM"

View Source
const OverwriteRateRateTypeFlat = shared.OverwriteRateRateTypeFlat

Equals "FLAT"

View Source
const OverwriteRateRateTypePercentage = shared.OverwriteRateRateTypePercentage

Equals "PERCENTAGE"

View Source
const OverwriteRateRateTypeSubscription = shared.OverwriteRateRateTypeSubscription

Equals "SUBSCRIPTION"

View Source
const OverwriteRateRateTypeTiered = shared.OverwriteRateRateTypeTiered

Equals "TIERED"

View Source
const PaymentGateConfigPaymentGateTypeExternal = shared.PaymentGateConfigPaymentGateTypeExternal

Equals "EXTERNAL"

View Source
const PaymentGateConfigPaymentGateTypeNone = shared.PaymentGateConfigPaymentGateTypeNone

Equals "NONE"

View Source
const PaymentGateConfigPaymentGateTypeStripe = shared.PaymentGateConfigPaymentGateTypeStripe

Equals "STRIPE"

View Source
const PaymentGateConfigTaxTypeAnrok = shared.PaymentGateConfigTaxTypeAnrok

Equals "ANROK"

View Source
const PaymentGateConfigTaxTypeNone = shared.PaymentGateConfigTaxTypeNone

Equals "NONE"

View Source
const PaymentGateConfigTaxTypePrecalculated = shared.PaymentGateConfigTaxTypePrecalculated

Equals "PRECALCULATED"

View Source
const PaymentGateConfigTaxTypeStripe = shared.PaymentGateConfigTaxTypeStripe

Equals "STRIPE"

View Source
const PaymentGateConfigV2PaymentGateTypeExternal = shared.PaymentGateConfigV2PaymentGateTypeExternal

Equals "EXTERNAL"

View Source
const PaymentGateConfigV2PaymentGateTypeNone = shared.PaymentGateConfigV2PaymentGateTypeNone

Equals "NONE"

View Source
const PaymentGateConfigV2PaymentGateTypeStripe = shared.PaymentGateConfigV2PaymentGateTypeStripe

Equals "STRIPE"

View Source
const PaymentGateConfigV2TaxTypeAnrok = shared.PaymentGateConfigV2TaxTypeAnrok

Equals "ANROK"

View Source
const PaymentGateConfigV2TaxTypeNone = shared.PaymentGateConfigV2TaxTypeNone

Equals "NONE"

View Source
const PaymentGateConfigV2TaxTypePrecalculated = shared.PaymentGateConfigV2TaxTypePrecalculated

Equals "PRECALCULATED"

View Source
const PaymentGateConfigV2TaxTypeStripe = shared.PaymentGateConfigV2TaxTypeStripe

Equals "STRIPE"

View Source
const RateRateTypeCustom = shared.RateRateTypeCustom

Equals "CUSTOM"

View Source
const RateRateTypeFlat = shared.RateRateTypeFlat

Equals "FLAT"

View Source
const RateRateTypePercentage = shared.RateRateTypePercentage

Equals "PERCENTAGE"

View Source
const RateRateTypeSubscription = shared.RateRateTypeSubscription

Equals "SUBSCRIPTION"

View Source
const RateRateTypeTiered = shared.RateRateTypeTiered

Equals "TIERED"

View Source
const RecurringCommitSubscriptionConfigAllocationIndividual = shared.RecurringCommitSubscriptionConfigAllocationIndividual

Equals "INDIVIDUAL"

View Source
const RecurringCommitSubscriptionConfigAllocationPooled = shared.RecurringCommitSubscriptionConfigAllocationPooled

Equals "POOLED"

View Source
const SubscriptionCollectionScheduleAdvance = shared.SubscriptionCollectionScheduleAdvance

Equals "ADVANCE"

View Source
const SubscriptionCollectionScheduleArrears = shared.SubscriptionCollectionScheduleArrears

Equals "ARREARS"

View Source
const SubscriptionQuantityManagementModeQuantityOnly = shared.SubscriptionQuantityManagementModeQuantityOnly

Equals "QUANTITY_ONLY"

View Source
const SubscriptionQuantityManagementModeSeatBased = shared.SubscriptionQuantityManagementModeSeatBased

Equals "SEAT_BASED"

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) param.Opt[bool]

func BoolPtr added in v1.0.0

func BoolPtr(v bool) *bool

func DefaultClientOptions

func DefaultClientOptions() []option.RequestOption

DefaultClientOptions read from the environment (METRONOME_BEARER_TOKEN, METRONOME_WEBHOOK_SECRET, METRONOME_BASE_URL). This should be used to initialize new clients.

func File added in v1.0.0

func File(rdr io.Reader, filename string, contentType string) file

func Float

func Float(f float64) param.Opt[float64]

func FloatPtr added in v1.0.0

func FloatPtr(v float64) *float64

func Int

func Int(i int64) param.Opt[int64]

func IntPtr added in v1.0.0

func IntPtr(v int64) *int64

func Opt added in v1.0.0

func Opt[T comparable](v T) param.Opt[T]

func Ptr added in v1.0.0

func Ptr[T any](v T) *T

func String

func String(s string) param.Opt[string]

func StringPtr added in v1.0.0

func StringPtr(v string) *string

func Time added in v1.0.0

func Time(t time.Time) param.Opt[time.Time]

func TimePtr added in v1.0.0

func TimePtr(v time.Time) *time.Time

Types

type BaseThresholdCommit added in v1.0.0

type BaseThresholdCommit = shared.BaseThresholdCommit

This is an alias to an internal type.

type BaseThresholdCommitParam added in v1.0.0

type BaseThresholdCommitParam = shared.BaseThresholdCommitParam

This is an alias to an internal type.

type BaseUsageFilter

type BaseUsageFilter = shared.BaseUsageFilter

This is an alias to an internal type.

type BaseUsageFilterParam

type BaseUsageFilterParam = shared.BaseUsageFilterParam

This is an alias to an internal type.

type Client

type Client struct {
	Options []option.RequestOption
	V2      V2Service
	V1      V1Service
}

Client creates a struct with services and top level methods that help with interacting with the metronome API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r Client)

NewClient generates a new client with the default option read from the environment (METRONOME_BEARER_TOKEN, METRONOME_WEBHOOK_SECRET, METRONOME_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

func (*Client) Delete

func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Execute

func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.

If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.

The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.

If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.

Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.

The response body will be deserialized into the res variable, depending on its type:

  • A pointer to a *http.Response is populated by the raw response.
  • A pointer to a byte array will be populated with the contents of the request body.
  • A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
  • A nil value will not read the response body.

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

func (*Client) Get

func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Patch

func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type Commit

type Commit = shared.Commit

This is an alias to an internal type.

type CommitContract

type CommitContract = shared.CommitContract

This is an alias to an internal type.

type CommitHierarchyConfiguration

type CommitHierarchyConfiguration = shared.CommitHierarchyConfiguration

This is an alias to an internal type.

type CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessAll

type CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessAll = shared.CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessAll

This is an alias to an internal type.

type CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessAllParam added in v1.0.0

type CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessAllParam = shared.CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessAllParam

This is an alias to an internal type.

type CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessContractIDs

type CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessContractIDs = shared.CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessContractIDs

This is an alias to an internal type.

type CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessContractIDsParam added in v1.0.0

type CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessContractIDsParam = shared.CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessContractIDsParam

This is an alias to an internal type.

type CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessNone

type CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessNone = shared.CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessNone

This is an alias to an internal type.

type CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessNoneParam added in v1.0.0

type CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessNoneParam = shared.CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessNoneParam

This is an alias to an internal type.

type CommitHierarchyConfigurationChildAccessUnion added in v1.0.0

type CommitHierarchyConfigurationChildAccessUnion = shared.CommitHierarchyConfigurationChildAccessUnion

This is an alias to an internal type.

type CommitHierarchyConfigurationChildAccessUnionParam added in v1.0.0

type CommitHierarchyConfigurationChildAccessUnionParam = shared.CommitHierarchyConfigurationChildAccessUnionParam

This is an alias to an internal type.

type CommitHierarchyConfigurationParam added in v1.0.0

type CommitHierarchyConfigurationParam = shared.CommitHierarchyConfigurationParam

This is an alias to an internal type.

type CommitInvoiceContract

type CommitInvoiceContract = shared.CommitInvoiceContract

The contract that this commit will be billed on.

This is an alias to an internal type.

type CommitLedgerPostpaidCommitAutomatedInvoiceDeductionLedgerEntry

type CommitLedgerPostpaidCommitAutomatedInvoiceDeductionLedgerEntry = shared.CommitLedgerPostpaidCommitAutomatedInvoiceDeductionLedgerEntry

This is an alias to an internal type.

type CommitLedgerPostpaidCommitExpirationLedgerEntry

type CommitLedgerPostpaidCommitExpirationLedgerEntry = shared.CommitLedgerPostpaidCommitExpirationLedgerEntry

This is an alias to an internal type.

type CommitLedgerPostpaidCommitInitialBalanceLedgerEntry

type CommitLedgerPostpaidCommitInitialBalanceLedgerEntry = shared.CommitLedgerPostpaidCommitInitialBalanceLedgerEntry

This is an alias to an internal type.

type CommitLedgerPostpaidCommitManualLedgerEntry

type CommitLedgerPostpaidCommitManualLedgerEntry = shared.CommitLedgerPostpaidCommitManualLedgerEntry

This is an alias to an internal type.

type CommitLedgerPostpaidCommitRolloverLedgerEntry

type CommitLedgerPostpaidCommitRolloverLedgerEntry = shared.CommitLedgerPostpaidCommitRolloverLedgerEntry

This is an alias to an internal type.

type CommitLedgerPostpaidCommitTrueupLedgerEntry

type CommitLedgerPostpaidCommitTrueupLedgerEntry = shared.CommitLedgerPostpaidCommitTrueupLedgerEntry

This is an alias to an internal type.

type CommitLedgerPrepaidCommitAutomatedInvoiceDeductionLedgerEntry

type CommitLedgerPrepaidCommitAutomatedInvoiceDeductionLedgerEntry = shared.CommitLedgerPrepaidCommitAutomatedInvoiceDeductionLedgerEntry

This is an alias to an internal type.

type CommitLedgerPrepaidCommitCanceledLedgerEntry

type CommitLedgerPrepaidCommitCanceledLedgerEntry = shared.CommitLedgerPrepaidCommitCanceledLedgerEntry

This is an alias to an internal type.

type CommitLedgerPrepaidCommitCreditedLedgerEntry

type CommitLedgerPrepaidCommitCreditedLedgerEntry = shared.CommitLedgerPrepaidCommitCreditedLedgerEntry

This is an alias to an internal type.

type CommitLedgerPrepaidCommitExpirationLedgerEntry

type CommitLedgerPrepaidCommitExpirationLedgerEntry = shared.CommitLedgerPrepaidCommitExpirationLedgerEntry

This is an alias to an internal type.

type CommitLedgerPrepaidCommitManualLedgerEntry

type CommitLedgerPrepaidCommitManualLedgerEntry = shared.CommitLedgerPrepaidCommitManualLedgerEntry

This is an alias to an internal type.

type CommitLedgerPrepaidCommitRolloverLedgerEntry

type CommitLedgerPrepaidCommitRolloverLedgerEntry = shared.CommitLedgerPrepaidCommitRolloverLedgerEntry

This is an alias to an internal type.

type CommitLedgerPrepaidCommitSeatBasedAdjustmentLedgerEntry

type CommitLedgerPrepaidCommitSeatBasedAdjustmentLedgerEntry = shared.CommitLedgerPrepaidCommitSeatBasedAdjustmentLedgerEntry

This is an alias to an internal type.

type CommitLedgerPrepaidCommitSegmentStartLedgerEntry

type CommitLedgerPrepaidCommitSegmentStartLedgerEntry = shared.CommitLedgerPrepaidCommitSegmentStartLedgerEntry

This is an alias to an internal type.

type CommitLedgerUnion added in v1.0.0

type CommitLedgerUnion = shared.CommitLedgerUnion

This is an alias to an internal type.

type CommitProduct

type CommitProduct = shared.CommitProduct

This is an alias to an internal type.

type CommitRate added in v1.0.0

type CommitRate = shared.CommitRate

A distinct rate on the rate card. You can choose to use this rate rather than list rate when consuming a credit or commit.

This is an alias to an internal type.

type CommitRateParam added in v1.0.0

type CommitRateParam = shared.CommitRateParam

A distinct rate on the rate card. You can choose to use this rate rather than list rate when consuming a credit or commit.

This is an alias to an internal type.

type CommitRateRateType added in v1.0.0

type CommitRateRateType = shared.CommitRateRateType

This is an alias to an internal type.

type CommitRateType

type CommitRateType = shared.CommitRateType

This is an alias to an internal type.

type CommitRolledOverFrom

type CommitRolledOverFrom = shared.CommitRolledOverFrom

This is an alias to an internal type.

type CommitSpecifier

type CommitSpecifier = shared.CommitSpecifier

This is an alias to an internal type.

type CommitSpecifierInput added in v1.0.0

type CommitSpecifierInput = shared.CommitSpecifierInput

This is an alias to an internal type.

type CommitSpecifierInputParam added in v1.0.0

type CommitSpecifierInputParam = shared.CommitSpecifierInputParam

This is an alias to an internal type.

type CommitType

type CommitType = shared.CommitType

This is an alias to an internal type.

type Contract added in v1.0.0

type Contract = shared.Contract

This is an alias to an internal type.

type ContractAmendment added in v1.0.0

type ContractAmendment = shared.ContractAmendment

This is an alias to an internal type.

type ContractAmendmentResellerRoyalty added in v1.0.0

type ContractAmendmentResellerRoyalty = shared.ContractAmendmentResellerRoyalty

This is an alias to an internal type.

type ContractCustomerBillingProviderConfiguration added in v1.0.0

type ContractCustomerBillingProviderConfiguration = shared.ContractCustomerBillingProviderConfiguration

The billing provider configuration associated with a contract.

This is an alias to an internal type.

type ContractScheduledChargesOnUsageInvoices added in v1.0.0

type ContractScheduledChargesOnUsageInvoices = shared.ContractScheduledChargesOnUsageInvoices

Determines which scheduled and commit charges to consolidate onto the Contract's usage invoice. The charge's `timestamp` must match the usage invoice's `ending_before` date for consolidation to occur. This field cannot be modified after a Contract has been created. If this field is omitted, charges will appear on a separate invoice from usage charges.

This is an alias to an internal type.

type ContractV2 added in v1.0.0

type ContractV2 = shared.ContractV2

This is an alias to an internal type.

type ContractV2Commit added in v1.0.0

type ContractV2Commit = shared.ContractV2Commit

This is an alias to an internal type.

type ContractV2CommitContract added in v1.0.0

type ContractV2CommitContract = shared.ContractV2CommitContract

This is an alias to an internal type.

type ContractV2CommitInvoiceContract added in v1.0.0

type ContractV2CommitInvoiceContract = shared.ContractV2CommitInvoiceContract

The contract that this commit will be billed on.

This is an alias to an internal type.

type ContractV2CommitLedgerPostpaidCommitAutomatedInvoiceDeductionLedgerEntry added in v1.0.0

type ContractV2CommitLedgerPostpaidCommitAutomatedInvoiceDeductionLedgerEntry = shared.ContractV2CommitLedgerPostpaidCommitAutomatedInvoiceDeductionLedgerEntry

This is an alias to an internal type.

type ContractV2CommitLedgerPostpaidCommitExpirationLedgerEntry added in v1.0.0

type ContractV2CommitLedgerPostpaidCommitExpirationLedgerEntry = shared.ContractV2CommitLedgerPostpaidCommitExpirationLedgerEntry

This is an alias to an internal type.

type ContractV2CommitLedgerPostpaidCommitInitialBalanceLedgerEntry added in v1.0.0

type ContractV2CommitLedgerPostpaidCommitInitialBalanceLedgerEntry = shared.ContractV2CommitLedgerPostpaidCommitInitialBalanceLedgerEntry

This is an alias to an internal type.

type ContractV2CommitLedgerPostpaidCommitManualLedgerEntry added in v1.0.0

type ContractV2CommitLedgerPostpaidCommitManualLedgerEntry = shared.ContractV2CommitLedgerPostpaidCommitManualLedgerEntry

This is an alias to an internal type.

type ContractV2CommitLedgerPostpaidCommitRolloverLedgerEntry added in v1.0.0

type ContractV2CommitLedgerPostpaidCommitRolloverLedgerEntry = shared.ContractV2CommitLedgerPostpaidCommitRolloverLedgerEntry

This is an alias to an internal type.

type ContractV2CommitLedgerPostpaidCommitTrueupLedgerEntry added in v1.0.0

type ContractV2CommitLedgerPostpaidCommitTrueupLedgerEntry = shared.ContractV2CommitLedgerPostpaidCommitTrueupLedgerEntry

This is an alias to an internal type.

type ContractV2CommitLedgerPrepaidCommitAutomatedInvoiceDeductionLedgerEntry added in v1.0.0

type ContractV2CommitLedgerPrepaidCommitAutomatedInvoiceDeductionLedgerEntry = shared.ContractV2CommitLedgerPrepaidCommitAutomatedInvoiceDeductionLedgerEntry

This is an alias to an internal type.

type ContractV2CommitLedgerPrepaidCommitCanceledLedgerEntry added in v1.0.0

type ContractV2CommitLedgerPrepaidCommitCanceledLedgerEntry = shared.ContractV2CommitLedgerPrepaidCommitCanceledLedgerEntry

This is an alias to an internal type.

type ContractV2CommitLedgerPrepaidCommitCreditedLedgerEntry added in v1.0.0

type ContractV2CommitLedgerPrepaidCommitCreditedLedgerEntry = shared.ContractV2CommitLedgerPrepaidCommitCreditedLedgerEntry

This is an alias to an internal type.

type ContractV2CommitLedgerPrepaidCommitExpirationLedgerEntry added in v1.0.0

type ContractV2CommitLedgerPrepaidCommitExpirationLedgerEntry = shared.ContractV2CommitLedgerPrepaidCommitExpirationLedgerEntry

This is an alias to an internal type.

type ContractV2CommitLedgerPrepaidCommitManualLedgerEntry added in v1.0.0

type ContractV2CommitLedgerPrepaidCommitManualLedgerEntry = shared.ContractV2CommitLedgerPrepaidCommitManualLedgerEntry

This is an alias to an internal type.

type ContractV2CommitLedgerPrepaidCommitRolloverLedgerEntry added in v1.0.0

type ContractV2CommitLedgerPrepaidCommitRolloverLedgerEntry = shared.ContractV2CommitLedgerPrepaidCommitRolloverLedgerEntry

This is an alias to an internal type.

type ContractV2CommitLedgerPrepaidCommitSeatBasedAdjustmentLedgerEntry added in v1.0.0

type ContractV2CommitLedgerPrepaidCommitSeatBasedAdjustmentLedgerEntry = shared.ContractV2CommitLedgerPrepaidCommitSeatBasedAdjustmentLedgerEntry

This is an alias to an internal type.

type ContractV2CommitLedgerPrepaidCommitSegmentStartLedgerEntry added in v1.0.0

type ContractV2CommitLedgerPrepaidCommitSegmentStartLedgerEntry = shared.ContractV2CommitLedgerPrepaidCommitSegmentStartLedgerEntry

This is an alias to an internal type.

type ContractV2CommitLedgerUnion added in v1.0.0

type ContractV2CommitLedgerUnion = shared.ContractV2CommitLedgerUnion

This is an alias to an internal type.

type ContractV2CommitProduct added in v1.0.0

type ContractV2CommitProduct = shared.ContractV2CommitProduct

This is an alias to an internal type.

type ContractV2CommitRolledOverFrom added in v1.0.0

type ContractV2CommitRolledOverFrom = shared.ContractV2CommitRolledOverFrom

This is an alias to an internal type.

type ContractV2Credit added in v1.0.0

type ContractV2Credit = shared.ContractV2Credit

This is an alias to an internal type.

type ContractV2CreditContract added in v1.0.0

type ContractV2CreditContract = shared.ContractV2CreditContract

This is an alias to an internal type.

type ContractV2CreditLedgerCreditAutomatedInvoiceDeductionLedgerEntry added in v1.0.0

type ContractV2CreditLedgerCreditAutomatedInvoiceDeductionLedgerEntry = shared.ContractV2CreditLedgerCreditAutomatedInvoiceDeductionLedgerEntry

This is an alias to an internal type.

type ContractV2CreditLedgerCreditCanceledLedgerEntry added in v1.0.0

type ContractV2CreditLedgerCreditCanceledLedgerEntry = shared.ContractV2CreditLedgerCreditCanceledLedgerEntry

This is an alias to an internal type.

type ContractV2CreditLedgerCreditCreditedLedgerEntry added in v1.0.0

type ContractV2CreditLedgerCreditCreditedLedgerEntry = shared.ContractV2CreditLedgerCreditCreditedLedgerEntry

This is an alias to an internal type.

type ContractV2CreditLedgerCreditExpirationLedgerEntry added in v1.0.0

type ContractV2CreditLedgerCreditExpirationLedgerEntry = shared.ContractV2CreditLedgerCreditExpirationLedgerEntry

This is an alias to an internal type.

type ContractV2CreditLedgerCreditManualLedgerEntry added in v1.0.0

type ContractV2CreditLedgerCreditManualLedgerEntry = shared.ContractV2CreditLedgerCreditManualLedgerEntry

This is an alias to an internal type.

type ContractV2CreditLedgerCreditSeatBasedAdjustmentLedgerEntry added in v1.0.0

type ContractV2CreditLedgerCreditSeatBasedAdjustmentLedgerEntry = shared.ContractV2CreditLedgerCreditSeatBasedAdjustmentLedgerEntry

This is an alias to an internal type.

type ContractV2CreditLedgerCreditSegmentStartLedgerEntry added in v1.0.0

type ContractV2CreditLedgerCreditSegmentStartLedgerEntry = shared.ContractV2CreditLedgerCreditSegmentStartLedgerEntry

This is an alias to an internal type.

type ContractV2CreditLedgerUnion added in v1.0.0

type ContractV2CreditLedgerUnion = shared.ContractV2CreditLedgerUnion

This is an alias to an internal type.

type ContractV2CreditProduct added in v1.0.0

type ContractV2CreditProduct = shared.ContractV2CreditProduct

This is an alias to an internal type.

type ContractV2CustomerBillingProviderConfiguration added in v1.0.0

type ContractV2CustomerBillingProviderConfiguration = shared.ContractV2CustomerBillingProviderConfiguration

This field's availability is dependent on your client's configuration.

This is an alias to an internal type.

type ContractV2HasMore added in v1.0.0

type ContractV2HasMore = shared.ContractV2HasMore

Indicates whether there are more items than the limit for this endpoint. Use the respective list endpoints to get the full lists.

This is an alias to an internal type.

type ContractV2MultiplierOverridePrioritization added in v1.0.0

type ContractV2MultiplierOverridePrioritization = shared.ContractV2MultiplierOverridePrioritization

Defaults to LOWEST_MULTIPLIER, which applies the greatest discount to list prices automatically. EXPLICIT prioritization requires specifying priorities for each multiplier; the one with the lowest priority value will be prioritized first.

This is an alias to an internal type.

type ContractV2Override added in v1.0.0

type ContractV2Override = shared.ContractV2Override

This is an alias to an internal type.

type ContractV2OverrideOverrideSpecifier added in v1.0.0

type ContractV2OverrideOverrideSpecifier = shared.ContractV2OverrideOverrideSpecifier

This is an alias to an internal type.

type ContractV2OverrideProduct added in v1.0.0

type ContractV2OverrideProduct = shared.ContractV2OverrideProduct

This is an alias to an internal type.

type ContractV2RecurringCommit added in v1.0.0

type ContractV2RecurringCommit = shared.ContractV2RecurringCommit

This is an alias to an internal type.

type ContractV2RecurringCommitAccessAmount added in v1.0.0

type ContractV2RecurringCommitAccessAmount = shared.ContractV2RecurringCommitAccessAmount

The amount of commit to grant.

This is an alias to an internal type.

type ContractV2RecurringCommitCommitDuration added in v1.0.0

type ContractV2RecurringCommitCommitDuration = shared.ContractV2RecurringCommitCommitDuration

The amount of time the created commits will be valid for

This is an alias to an internal type.

type ContractV2RecurringCommitContract added in v1.0.0

type ContractV2RecurringCommitContract = shared.ContractV2RecurringCommitContract

This is an alias to an internal type.

type ContractV2RecurringCommitInvoiceAmount added in v1.0.0

type ContractV2RecurringCommitInvoiceAmount = shared.ContractV2RecurringCommitInvoiceAmount

The amount the customer should be billed for the commit. Not required.

This is an alias to an internal type.

type ContractV2RecurringCommitProduct added in v1.0.0

type ContractV2RecurringCommitProduct = shared.ContractV2RecurringCommitProduct

This is an alias to an internal type.

type ContractV2RecurringCredit added in v1.0.0

type ContractV2RecurringCredit = shared.ContractV2RecurringCredit

This is an alias to an internal type.

type ContractV2RecurringCreditAccessAmount added in v1.0.0

type ContractV2RecurringCreditAccessAmount = shared.ContractV2RecurringCreditAccessAmount

The amount of commit to grant.

This is an alias to an internal type.

type ContractV2RecurringCreditCommitDuration added in v1.0.0

type ContractV2RecurringCreditCommitDuration = shared.ContractV2RecurringCreditCommitDuration

The amount of time the created commits will be valid for

This is an alias to an internal type.

type ContractV2RecurringCreditContract added in v1.0.0

type ContractV2RecurringCreditContract = shared.ContractV2RecurringCreditContract

This is an alias to an internal type.

type ContractV2RecurringCreditProduct added in v1.0.0

type ContractV2RecurringCreditProduct = shared.ContractV2RecurringCreditProduct

This is an alias to an internal type.

type ContractV2ResellerRoyalty added in v1.0.0

type ContractV2ResellerRoyalty = shared.ContractV2ResellerRoyalty

This is an alias to an internal type.

type ContractV2ResellerRoyaltySegment added in v1.0.0

type ContractV2ResellerRoyaltySegment = shared.ContractV2ResellerRoyaltySegment

This is an alias to an internal type.

type ContractV2ScheduledChargesOnUsageInvoices added in v1.0.0

type ContractV2ScheduledChargesOnUsageInvoices = shared.ContractV2ScheduledChargesOnUsageInvoices

Determines which scheduled and commit charges to consolidate onto the Contract's usage invoice. The charge's `timestamp` must match the usage invoice's `ending_before` date for consolidation to occur. This field cannot be modified after a Contract has been created. If this field is omitted, charges will appear on a separate invoice from usage charges.

This is an alias to an internal type.

type ContractV2Transition added in v1.0.0

type ContractV2Transition = shared.ContractV2Transition

This is an alias to an internal type.

type ContractV2UsageFilter added in v1.0.0

type ContractV2UsageFilter = shared.ContractV2UsageFilter

This is an alias to an internal type.

type ContractV2UsageStatementSchedule added in v1.0.0

type ContractV2UsageStatementSchedule = shared.ContractV2UsageStatementSchedule

This is an alias to an internal type.

type ContractWithoutAmendments

type ContractWithoutAmendments = shared.ContractWithoutAmendments

This is an alias to an internal type.

type ContractWithoutAmendmentsRecurringCommit

type ContractWithoutAmendmentsRecurringCommit = shared.ContractWithoutAmendmentsRecurringCommit

This is an alias to an internal type.

type ContractWithoutAmendmentsRecurringCommitAccessAmount added in v1.0.0

type ContractWithoutAmendmentsRecurringCommitAccessAmount = shared.ContractWithoutAmendmentsRecurringCommitAccessAmount

The amount of commit to grant.

This is an alias to an internal type.

type ContractWithoutAmendmentsRecurringCommitCommitDuration added in v1.0.0

type ContractWithoutAmendmentsRecurringCommitCommitDuration = shared.ContractWithoutAmendmentsRecurringCommitCommitDuration

The amount of time the created commits will be valid for

This is an alias to an internal type.

type ContractWithoutAmendmentsRecurringCommitContract added in v1.0.0

type ContractWithoutAmendmentsRecurringCommitContract = shared.ContractWithoutAmendmentsRecurringCommitContract

This is an alias to an internal type.

type ContractWithoutAmendmentsRecurringCommitInvoiceAmount added in v1.0.0

type ContractWithoutAmendmentsRecurringCommitInvoiceAmount = shared.ContractWithoutAmendmentsRecurringCommitInvoiceAmount

The amount the customer should be billed for the commit. Not required.

This is an alias to an internal type.

type ContractWithoutAmendmentsRecurringCommitProduct added in v1.0.0

type ContractWithoutAmendmentsRecurringCommitProduct = shared.ContractWithoutAmendmentsRecurringCommitProduct

This is an alias to an internal type.

type ContractWithoutAmendmentsRecurringCredit

type ContractWithoutAmendmentsRecurringCredit = shared.ContractWithoutAmendmentsRecurringCredit

This is an alias to an internal type.

type ContractWithoutAmendmentsRecurringCreditAccessAmount added in v1.0.0

type ContractWithoutAmendmentsRecurringCreditAccessAmount = shared.ContractWithoutAmendmentsRecurringCreditAccessAmount

The amount of commit to grant.

This is an alias to an internal type.

type ContractWithoutAmendmentsRecurringCreditCommitDuration added in v1.0.0

type ContractWithoutAmendmentsRecurringCreditCommitDuration = shared.ContractWithoutAmendmentsRecurringCreditCommitDuration

The amount of time the created commits will be valid for

This is an alias to an internal type.

type ContractWithoutAmendmentsRecurringCreditContract added in v1.0.0

type ContractWithoutAmendmentsRecurringCreditContract = shared.ContractWithoutAmendmentsRecurringCreditContract

This is an alias to an internal type.

type ContractWithoutAmendmentsRecurringCreditProduct added in v1.0.0

type ContractWithoutAmendmentsRecurringCreditProduct = shared.ContractWithoutAmendmentsRecurringCreditProduct

This is an alias to an internal type.

type ContractWithoutAmendmentsResellerRoyalty

type ContractWithoutAmendmentsResellerRoyalty = shared.ContractWithoutAmendmentsResellerRoyalty

This is an alias to an internal type.

type ContractWithoutAmendmentsScheduledChargesOnUsageInvoices

type ContractWithoutAmendmentsScheduledChargesOnUsageInvoices = shared.ContractWithoutAmendmentsScheduledChargesOnUsageInvoices

Determines which scheduled and commit charges to consolidate onto the Contract's usage invoice. The charge's `timestamp` must match the usage invoice's `ending_before` date for consolidation to occur. This field cannot be modified after a Contract has been created. If this field is omitted, charges will appear on a separate invoice from usage charges.

This is an alias to an internal type.

type ContractWithoutAmendmentsTransition

type ContractWithoutAmendmentsTransition = shared.ContractWithoutAmendmentsTransition

This is an alias to an internal type.

type ContractWithoutAmendmentsUsageFilter

type ContractWithoutAmendmentsUsageFilter = shared.ContractWithoutAmendmentsUsageFilter

This is an alias to an internal type.

type ContractWithoutAmendmentsUsageFilterUpdate

type ContractWithoutAmendmentsUsageFilterUpdate = shared.ContractWithoutAmendmentsUsageFilterUpdate

This is an alias to an internal type.

type ContractWithoutAmendmentsUsageStatementSchedule

type ContractWithoutAmendmentsUsageStatementSchedule = shared.ContractWithoutAmendmentsUsageStatementSchedule

This is an alias to an internal type.

type Credit

type Credit = shared.Credit

This is an alias to an internal type.

type CreditContract

type CreditContract = shared.CreditContract

This is an alias to an internal type.

type CreditLedgerCreditAutomatedInvoiceDeductionLedgerEntry

type CreditLedgerCreditAutomatedInvoiceDeductionLedgerEntry = shared.CreditLedgerCreditAutomatedInvoiceDeductionLedgerEntry

This is an alias to an internal type.

type CreditLedgerCreditCanceledLedgerEntry

type CreditLedgerCreditCanceledLedgerEntry = shared.CreditLedgerCreditCanceledLedgerEntry

This is an alias to an internal type.

type CreditLedgerCreditCreditedLedgerEntry

type CreditLedgerCreditCreditedLedgerEntry = shared.CreditLedgerCreditCreditedLedgerEntry

This is an alias to an internal type.

type CreditLedgerCreditExpirationLedgerEntry

type CreditLedgerCreditExpirationLedgerEntry = shared.CreditLedgerCreditExpirationLedgerEntry

This is an alias to an internal type.

type CreditLedgerCreditManualLedgerEntry

type CreditLedgerCreditManualLedgerEntry = shared.CreditLedgerCreditManualLedgerEntry

This is an alias to an internal type.

type CreditLedgerCreditSeatBasedAdjustmentLedgerEntry

type CreditLedgerCreditSeatBasedAdjustmentLedgerEntry = shared.CreditLedgerCreditSeatBasedAdjustmentLedgerEntry

This is an alias to an internal type.

type CreditLedgerCreditSegmentStartLedgerEntry

type CreditLedgerCreditSegmentStartLedgerEntry = shared.CreditLedgerCreditSegmentStartLedgerEntry

This is an alias to an internal type.

type CreditLedgerEntry

type CreditLedgerEntry struct {
	// an amount representing the change to the customer's credit balance
	Amount    float64 `json:"amount,required"`
	CreatedBy string  `json:"created_by,required"`
	// the credit grant this entry is related to
	CreditGrantID string    `json:"credit_grant_id,required" format:"uuid"`
	EffectiveAt   time.Time `json:"effective_at,required" format:"date-time"`
	Reason        string    `json:"reason,required"`
	// the running balance for this credit type at the time of the ledger entry,
	// including all preceding charges
	RunningBalance float64 `json:"running_balance,required"`
	// if this entry is a deduction, the Metronome ID of the invoice where the credit
	// deduction was consumed; if this entry is a grant, the Metronome ID of the
	// invoice where the grant's paid_amount was charged
	InvoiceID string `json:"invoice_id,nullable" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Amount         respjson.Field
		CreatedBy      respjson.Field
		CreditGrantID  respjson.Field
		EffectiveAt    respjson.Field
		Reason         respjson.Field
		RunningBalance respjson.Field
		InvoiceID      respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CreditLedgerEntry) RawJSON added in v1.0.0

func (r CreditLedgerEntry) RawJSON() string

Returns the unmodified JSON received from the API

func (*CreditLedgerEntry) UnmarshalJSON

func (r *CreditLedgerEntry) UnmarshalJSON(data []byte) error

type CreditLedgerUnion added in v1.0.0

type CreditLedgerUnion = shared.CreditLedgerUnion

This is an alias to an internal type.

type CreditProduct

type CreditProduct = shared.CreditProduct

This is an alias to an internal type.

type CreditRateType

type CreditRateType = shared.CreditRateType

This is an alias to an internal type.

type CreditType

type CreditType = shared.CreditType

This is an alias to an internal type.

type CreditTypeData

type CreditTypeData = shared.CreditTypeData

This is an alias to an internal type.

type Customer

type Customer struct {
	// the Metronome ID of the customer
	ID string `json:"id,required" format:"uuid"`
	// (deprecated, use ingest_aliases instead) the first ID (Metronome or ingest
	// alias) that can be used in usage events
	ExternalID string `json:"external_id,required"`
	// aliases for this customer that can be used instead of the Metronome customer ID
	// in usage events
	IngestAliases []string `json:"ingest_aliases,required"`
	Name          string   `json:"name,required"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID            respjson.Field
		ExternalID    respjson.Field
		IngestAliases respjson.Field
		Name          respjson.Field
		CustomFields  respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Customer) RawJSON added in v1.0.0

func (r Customer) RawJSON() string

Returns the unmodified JSON received from the API

func (*Customer) UnmarshalJSON

func (r *Customer) UnmarshalJSON(data []byte) error

type CustomerAlert

type CustomerAlert struct {
	Alert CustomerAlertAlert `json:"alert,required"`
	// The status of the customer alert. If the alert is archived, null will be
	// returned.
	//
	// Any of "ok", "in_alarm", "evaluating".
	CustomerStatus CustomerAlertCustomerStatus `json:"customer_status,required"`
	// If present, indicates the reason the alert was triggered.
	TriggeredBy string `json:"triggered_by,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Alert          respjson.Field
		CustomerStatus respjson.Field
		TriggeredBy    respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CustomerAlert) RawJSON added in v1.0.0

func (r CustomerAlert) RawJSON() string

Returns the unmodified JSON received from the API

func (*CustomerAlert) UnmarshalJSON

func (r *CustomerAlert) UnmarshalJSON(data []byte) error

type CustomerAlertAlert

type CustomerAlertAlert struct {
	// the Metronome ID of the alert
	ID string `json:"id,required"`
	// Name of the alert
	Name string `json:"name,required"`
	// Status of the alert
	//
	// Any of "enabled", "archived", "disabled".
	Status string `json:"status,required"`
	// Threshold value of the alert policy
	Threshold float64 `json:"threshold,required"`
	// Type of the alert
	//
	// Any of "low_credit_balance_reached", "spend_threshold_reached",
	// "monthly_invoice_total_spend_threshold_reached",
	// "low_remaining_days_in_plan_reached", "low_remaining_credit_percentage_reached",
	// "usage_threshold_reached", "low_remaining_days_for_commit_segment_reached",
	// "low_remaining_commit_balance_reached",
	// "low_remaining_commit_percentage_reached",
	// "low_remaining_days_for_contract_credit_segment_reached",
	// "low_remaining_contract_credit_balance_reached",
	// "low_remaining_contract_credit_percentage_reached",
	// "low_remaining_contract_credit_and_commit_balance_reached",
	// "invoice_total_reached".
	Type string `json:"type,required"`
	// Timestamp for when the alert was last updated
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	// An array of strings, representing a way to filter the credit grant this alert
	// applies to, by looking at the credit_grant_type field on the credit grant. This
	// field is only defined for CreditPercentage and CreditBalance alerts
	CreditGrantTypeFilters []string              `json:"credit_grant_type_filters"`
	CreditType             shared.CreditTypeData `json:"credit_type,nullable"`
	// A list of custom field filters for alert types that support advanced filtering
	CustomFieldFilters []CustomerAlertAlertCustomFieldFilter `json:"custom_field_filters"`
	// Scopes alert evaluation to a specific presentation group key on individual line
	// items. Only present for spend alerts.
	GroupKeyFilter CustomerAlertAlertGroupKeyFilter `json:"group_key_filter"`
	// Only present for `spend_threshold_reached` alerts. Scope alert to a specific
	// group key on individual line items.
	GroupValues []CustomerAlertAlertGroupValue `json:"group_values"`
	// Only supported for invoice_total_reached alerts. A list of invoice types to
	// evaluate.
	InvoiceTypesFilter []string `json:"invoice_types_filter"`
	// Prevents the creation of duplicates. If a request to create a record is made
	// with a previously used uniqueness key, a new record will not be created and the
	// request will fail with a 409 error.
	UniquenessKey string `json:"uniqueness_key"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                     respjson.Field
		Name                   respjson.Field
		Status                 respjson.Field
		Threshold              respjson.Field
		Type                   respjson.Field
		UpdatedAt              respjson.Field
		CreditGrantTypeFilters respjson.Field
		CreditType             respjson.Field
		CustomFieldFilters     respjson.Field
		GroupKeyFilter         respjson.Field
		GroupValues            respjson.Field
		InvoiceTypesFilter     respjson.Field
		UniquenessKey          respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CustomerAlertAlert) RawJSON added in v1.0.0

func (r CustomerAlertAlert) RawJSON() string

Returns the unmodified JSON received from the API

func (*CustomerAlertAlert) UnmarshalJSON

func (r *CustomerAlertAlert) UnmarshalJSON(data []byte) error

type CustomerAlertAlertCustomFieldFilter

type CustomerAlertAlertCustomFieldFilter struct {
	// Any of "Contract", "Commit", "ContractCredit".
	Entity string `json:"entity,required"`
	Key    string `json:"key,required"`
	Value  string `json:"value,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Entity      respjson.Field
		Key         respjson.Field
		Value       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CustomerAlertAlertCustomFieldFilter) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*CustomerAlertAlertCustomFieldFilter) UnmarshalJSON

func (r *CustomerAlertAlertCustomFieldFilter) UnmarshalJSON(data []byte) error

type CustomerAlertAlertGroupKeyFilter

type CustomerAlertAlertGroupKeyFilter struct {
	Key   string `json:"key,required"`
	Value string `json:"value,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Key         respjson.Field
		Value       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Scopes alert evaluation to a specific presentation group key on individual line items. Only present for spend alerts.

func (CustomerAlertAlertGroupKeyFilter) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*CustomerAlertAlertGroupKeyFilter) UnmarshalJSON

func (r *CustomerAlertAlertGroupKeyFilter) UnmarshalJSON(data []byte) error

type CustomerAlertAlertGroupValue added in v0.2.0

type CustomerAlertAlertGroupValue struct {
	Key   string `json:"key,required"`
	Value string `json:"value"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Key         respjson.Field
		Value       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CustomerAlertAlertGroupValue) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*CustomerAlertAlertGroupValue) UnmarshalJSON added in v0.2.0

func (r *CustomerAlertAlertGroupValue) UnmarshalJSON(data []byte) error

type CustomerAlertCustomerStatus

type CustomerAlertCustomerStatus string

The status of the customer alert. If the alert is archived, null will be returned.

const (
	CustomerAlertCustomerStatusOk         CustomerAlertCustomerStatus = "ok"
	CustomerAlertCustomerStatusInAlarm    CustomerAlertCustomerStatus = "in_alarm"
	CustomerAlertCustomerStatusEvaluating CustomerAlertCustomerStatus = "evaluating"
)

type CustomerDetail

type CustomerDetail struct {
	// the Metronome ID of the customer
	ID string `json:"id,required" format:"uuid"`
	// RFC 3339 timestamp indicating when the customer was created.
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields   map[string]string            `json:"custom_fields,required"`
	CustomerConfig CustomerDetailCustomerConfig `json:"customer_config,required"`
	// (deprecated, use ingest_aliases instead) the first ID (Metronome or ingest
	// alias) that can be used in usage events
	ExternalID string `json:"external_id,required"`
	// aliases for this customer that can be used instead of the Metronome customer ID
	// in usage events
	IngestAliases []string `json:"ingest_aliases,required"`
	Name          string   `json:"name,required"`
	// RFC 3339 timestamp indicating when the customer was archived. Null if the
	// customer is active.
	ArchivedAt time.Time `json:"archived_at,nullable" format:"date-time"`
	// This field's availability is dependent on your client's configuration.
	CurrentBillableStatus CustomerDetailCurrentBillableStatus `json:"current_billable_status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                    respjson.Field
		CreatedAt             respjson.Field
		CustomFields          respjson.Field
		CustomerConfig        respjson.Field
		ExternalID            respjson.Field
		IngestAliases         respjson.Field
		Name                  respjson.Field
		ArchivedAt            respjson.Field
		CurrentBillableStatus respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CustomerDetail) RawJSON added in v1.0.0

func (r CustomerDetail) RawJSON() string

Returns the unmodified JSON received from the API

func (*CustomerDetail) UnmarshalJSON

func (r *CustomerDetail) UnmarshalJSON(data []byte) error

type CustomerDetailCurrentBillableStatus

type CustomerDetailCurrentBillableStatus struct {
	// Any of "billable", "unbillable".
	Value       string    `json:"value,required"`
	EffectiveAt time.Time `json:"effective_at,nullable" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Value       respjson.Field
		EffectiveAt respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

This field's availability is dependent on your client's configuration.

func (CustomerDetailCurrentBillableStatus) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*CustomerDetailCurrentBillableStatus) UnmarshalJSON

func (r *CustomerDetailCurrentBillableStatus) UnmarshalJSON(data []byte) error

type CustomerDetailCustomerConfig

type CustomerDetailCustomerConfig struct {
	// The Salesforce account ID for the customer
	SalesforceAccountID string `json:"salesforce_account_id,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		SalesforceAccountID respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CustomerDetailCustomerConfig) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*CustomerDetailCustomerConfig) UnmarshalJSON

func (r *CustomerDetailCustomerConfig) UnmarshalJSON(data []byte) error

type Discount

type Discount = shared.Discount

This is an alias to an internal type.

type DiscountProduct

type DiscountProduct = shared.DiscountProduct

This is an alias to an internal type.

type Error

type Error = apierror.Error

type EventTypeFilter

type EventTypeFilter = shared.EventTypeFilter

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

This is an alias to an internal type.

type EventTypeFilterParam

type EventTypeFilterParam = shared.EventTypeFilterParam

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

This is an alias to an internal type.

type HierarchyConfigurationChildHierarchyConfiguration added in v1.0.0

type HierarchyConfigurationChildHierarchyConfiguration = shared.HierarchyConfigurationChildHierarchyConfiguration

This is an alias to an internal type.

type HierarchyConfigurationChildHierarchyConfigurationParent added in v1.0.0

type HierarchyConfigurationChildHierarchyConfigurationParent = shared.HierarchyConfigurationChildHierarchyConfigurationParent

The single parent contract/customer for this child.

This is an alias to an internal type.

type HierarchyConfigurationParentHierarchyConfiguration added in v1.0.0

type HierarchyConfigurationParentHierarchyConfiguration = shared.HierarchyConfigurationParentHierarchyConfiguration

This is an alias to an internal type.

type HierarchyConfigurationParentHierarchyConfigurationChild added in v1.0.0

type HierarchyConfigurationParentHierarchyConfigurationChild = shared.HierarchyConfigurationParentHierarchyConfigurationChild

This is an alias to an internal type.

type HierarchyConfigurationUnion added in v1.0.0

type HierarchyConfigurationUnion = shared.HierarchyConfigurationUnion

Either a **parent** configuration with a list of children or a **child** configuration with a single parent.

This is an alias to an internal type.

type ID

type ID = shared.ID

This is an alias to an internal type.

type IDParam

type IDParam = shared.IDParam

This is an alias to an internal type.

type Invoice

type Invoice struct {
	ID          string                `json:"id,required" format:"uuid"`
	CreditType  shared.CreditTypeData `json:"credit_type,required"`
	CustomerID  string                `json:"customer_id,required" format:"uuid"`
	LineItems   []InvoiceLineItem     `json:"line_items,required"`
	Status      string                `json:"status,required"`
	Total       float64               `json:"total,required"`
	Type        string                `json:"type,required"`
	AmendmentID string                `json:"amendment_id" format:"uuid"`
	// This field's availability is dependent on your client's configuration.
	//
	// Any of "billable", "unbillable".
	BillableStatus InvoiceBillableStatus `json:"billable_status"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	ContractCustomFields map[string]string       `json:"contract_custom_fields"`
	ContractID           string                  `json:"contract_id" format:"uuid"`
	CorrectionRecord     InvoiceCorrectionRecord `json:"correction_record"`
	// When the invoice was created (UTC). This field is present for correction
	// invoices only.
	CreatedAt    time.Time      `json:"created_at" format:"date-time"`
	CustomFields map[string]any `json:"custom_fields"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomerCustomFields map[string]string `json:"customer_custom_fields"`
	// End of the usage period this invoice covers (UTC)
	EndTimestamp       time.Time                  `json:"end_timestamp" format:"date-time"`
	ExternalInvoice    InvoiceExternalInvoice     `json:"external_invoice,nullable"`
	InvoiceAdjustments []InvoiceInvoiceAdjustment `json:"invoice_adjustments"`
	// When the invoice was issued (UTC)
	IssuedAt            time.Time `json:"issued_at" format:"date-time"`
	NetPaymentTermsDays float64   `json:"net_payment_terms_days"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID string `json:"netsuite_sales_order_id"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	PlanCustomFields map[string]string `json:"plan_custom_fields"`
	PlanID           string            `json:"plan_id" format:"uuid"`
	PlanName         string            `json:"plan_name"`
	// Only present for contract invoices with reseller royalties.
	ResellerRoyalty InvoiceResellerRoyalty `json:"reseller_royalty"`
	// This field's availability is dependent on your client's configuration.
	SalesforceOpportunityID string `json:"salesforce_opportunity_id"`
	// Beginning of the usage period this invoice covers (UTC)
	StartTimestamp time.Time `json:"start_timestamp" format:"date-time"`
	Subtotal       float64   `json:"subtotal"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                      respjson.Field
		CreditType              respjson.Field
		CustomerID              respjson.Field
		LineItems               respjson.Field
		Status                  respjson.Field
		Total                   respjson.Field
		Type                    respjson.Field
		AmendmentID             respjson.Field
		BillableStatus          respjson.Field
		ContractCustomFields    respjson.Field
		ContractID              respjson.Field
		CorrectionRecord        respjson.Field
		CreatedAt               respjson.Field
		CustomFields            respjson.Field
		CustomerCustomFields    respjson.Field
		EndTimestamp            respjson.Field
		ExternalInvoice         respjson.Field
		InvoiceAdjustments      respjson.Field
		IssuedAt                respjson.Field
		NetPaymentTermsDays     respjson.Field
		NetsuiteSalesOrderID    respjson.Field
		PlanCustomFields        respjson.Field
		PlanID                  respjson.Field
		PlanName                respjson.Field
		ResellerRoyalty         respjson.Field
		SalesforceOpportunityID respjson.Field
		StartTimestamp          respjson.Field
		Subtotal                respjson.Field
		ExtraFields             map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Invoice) RawJSON added in v1.0.0

func (r Invoice) RawJSON() string

Returns the unmodified JSON received from the API

func (*Invoice) UnmarshalJSON

func (r *Invoice) UnmarshalJSON(data []byte) error

type InvoiceBillableStatus

type InvoiceBillableStatus string

This field's availability is dependent on your client's configuration.

const (
	InvoiceBillableStatusBillable   InvoiceBillableStatus = "billable"
	InvoiceBillableStatusUnbillable InvoiceBillableStatus = "unbillable"
)

type InvoiceCorrectionRecord

type InvoiceCorrectionRecord struct {
	CorrectedInvoiceID       string                                          `json:"corrected_invoice_id,required" format:"uuid"`
	Memo                     string                                          `json:"memo,required"`
	Reason                   string                                          `json:"reason,required"`
	CorrectedExternalInvoice InvoiceCorrectionRecordCorrectedExternalInvoice `json:"corrected_external_invoice"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CorrectedInvoiceID       respjson.Field
		Memo                     respjson.Field
		Reason                   respjson.Field
		CorrectedExternalInvoice respjson.Field
		ExtraFields              map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InvoiceCorrectionRecord) RawJSON added in v1.0.0

func (r InvoiceCorrectionRecord) RawJSON() string

Returns the unmodified JSON received from the API

func (*InvoiceCorrectionRecord) UnmarshalJSON

func (r *InvoiceCorrectionRecord) UnmarshalJSON(data []byte) error

type InvoiceCorrectionRecordCorrectedExternalInvoice

type InvoiceCorrectionRecordCorrectedExternalInvoice struct {
	// Any of "aws_marketplace", "stripe", "netsuite", "custom", "azure_marketplace",
	// "quickbooks_online", "workday", "gcp_marketplace".
	BillingProviderType string `json:"billing_provider_type,required"`
	// Any of "DRAFT", "FINALIZED", "PAID", "UNCOLLECTIBLE", "VOID", "DELETED",
	// "PAYMENT_FAILED", "INVALID_REQUEST_ERROR", "SKIPPED", "SENT", "QUEUED".
	ExternalStatus    string    `json:"external_status"`
	InvoiceID         string    `json:"invoice_id"`
	IssuedAtTimestamp time.Time `json:"issued_at_timestamp" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BillingProviderType respjson.Field
		ExternalStatus      respjson.Field
		InvoiceID           respjson.Field
		IssuedAtTimestamp   respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InvoiceCorrectionRecordCorrectedExternalInvoice) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*InvoiceCorrectionRecordCorrectedExternalInvoice) UnmarshalJSON

type InvoiceExternalInvoice

type InvoiceExternalInvoice struct {
	// Any of "aws_marketplace", "stripe", "netsuite", "custom", "azure_marketplace",
	// "quickbooks_online", "workday", "gcp_marketplace".
	BillingProviderType string `json:"billing_provider_type,required"`
	// Any of "DRAFT", "FINALIZED", "PAID", "UNCOLLECTIBLE", "VOID", "DELETED",
	// "PAYMENT_FAILED", "INVALID_REQUEST_ERROR", "SKIPPED", "SENT", "QUEUED".
	ExternalStatus    string    `json:"external_status"`
	InvoiceID         string    `json:"invoice_id"`
	IssuedAtTimestamp time.Time `json:"issued_at_timestamp" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BillingProviderType respjson.Field
		ExternalStatus      respjson.Field
		InvoiceID           respjson.Field
		IssuedAtTimestamp   respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InvoiceExternalInvoice) RawJSON added in v1.0.0

func (r InvoiceExternalInvoice) RawJSON() string

Returns the unmodified JSON received from the API

func (*InvoiceExternalInvoice) UnmarshalJSON

func (r *InvoiceExternalInvoice) UnmarshalJSON(data []byte) error

type InvoiceInvoiceAdjustment

type InvoiceInvoiceAdjustment struct {
	CreditType shared.CreditTypeData `json:"credit_type,required"`
	Name       string                `json:"name,required"`
	Total      float64               `json:"total,required"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CreditGrantCustomFields map[string]string `json:"credit_grant_custom_fields"`
	CreditGrantID           string            `json:"credit_grant_id"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreditType              respjson.Field
		Name                    respjson.Field
		Total                   respjson.Field
		CreditGrantCustomFields respjson.Field
		CreditGrantID           respjson.Field
		ExtraFields             map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InvoiceInvoiceAdjustment) RawJSON added in v1.0.0

func (r InvoiceInvoiceAdjustment) RawJSON() string

Returns the unmodified JSON received from the API

func (*InvoiceInvoiceAdjustment) UnmarshalJSON

func (r *InvoiceInvoiceAdjustment) UnmarshalJSON(data []byte) error

type InvoiceLineItem

type InvoiceLineItem struct {
	CreditType shared.CreditTypeData `json:"credit_type,required"`
	Name       string                `json:"name,required"`
	Total      float64               `json:"total,required"`
	// The type of line item.
	//
	//   - `scheduled`: Line item is associated with a scheduled charge. View the
	//     scheduled_charge_id on the line item.
	//   - `commit_purchase`: Line item is associated with a payment for a prepaid
	//     commit. View the commit_id on the line item.
	//   - `usage`: Line item is associated with a usage product or composite product.
	//     View the product_id on the line item to determine which product.
	//   - `subscription`: Line item is associated with a subscription. e.g. monthly
	//     recurring payment for an in-advance subscription.
	//   - `applied_commit_or_credit`: On metronome invoices, applied commits and credits
	//     are associated with their own line items. These line items have negative
	//     totals. Use the applied_commit_or_credit object on the line item to understand
	//     the id of the applied commit or credit, and its type. Note that the
	//     application of a postpaid commit is associated with a line item, but the total
	//     on the line item is not included in the invoice's total as postpaid commits
	//     are paid in-arrears.
	//   - `cpu_conversion`: Line item converting between a custom pricing unit and fiat
	//     currency, using the conversion rate set on the rate card. This line item will
	//     appear when there are products priced in custom pricing units, and there is
	//     insufficient prepaid commit/credit in that custom pricing unit to fully cover
	//     the spend. Then, the outstanding spend in custom pricing units will be
	//     converted to fiat currency using a cpu_conversion line item.
	Type string `json:"type,required"`
	// Details about the credit or commit that was applied to this line item. Only
	// present on line items with product of `USAGE`, `SUBSCRIPTION` or `COMPOSITE`
	// types.
	AppliedCommitOrCredit InvoiceLineItemAppliedCommitOrCredit `json:"applied_commit_or_credit"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CommitCustomFields map[string]string `json:"commit_custom_fields"`
	// For line items with product of `USAGE`, `SUBSCRIPTION`, or `COMPOSITE` types,
	// the ID of the credit or commit that was applied to this line item. For line
	// items with product type of `FIXED`, the ID of the prepaid or postpaid commit
	// that is being paid for.
	CommitID                   string `json:"commit_id" format:"uuid"`
	CommitNetsuiteItemID       string `json:"commit_netsuite_item_id"`
	CommitNetsuiteSalesOrderID string `json:"commit_netsuite_sales_order_id"`
	CommitSegmentID            string `json:"commit_segment_id" format:"uuid"`
	// `PrepaidCommit` (for commit types `PREPAID` and `CREDIT`) or `PostpaidCommit`
	// (for commit type `POSTPAID`).
	CommitType string `json:"commit_type"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	DiscountCustomFields map[string]string `json:"discount_custom_fields"`
	// ID of the discount applied to this line item.
	DiscountID string `json:"discount_id" format:"uuid"`
	// The line item's end date (exclusive).
	EndingBefore time.Time `json:"ending_before" format:"date-time"`
	GroupKey     string    `json:"group_key"`
	GroupValue   string    `json:"group_value,nullable"`
	// Indicates whether the line item is prorated for `SUBSCRIPTION` type product.
	IsProrated bool `json:"is_prorated"`
	// Only present for contract invoices and when the `include_list_prices` query
	// parameter is set to true. This will include the list rate for the charge if
	// applicable. Only present for usage and subscription line items.
	ListPrice shared.Rate `json:"list_price"`
	Metadata  string      `json:"metadata"`
	// The end date for the billing period on the invoice.
	NetsuiteInvoiceBillingEnd time.Time `json:"netsuite_invoice_billing_end" format:"date-time"`
	// The start date for the billing period on the invoice.
	NetsuiteInvoiceBillingStart time.Time `json:"netsuite_invoice_billing_start" format:"date-time"`
	NetsuiteItemID              string    `json:"netsuite_item_id"`
	// Only present for line items paying for a postpaid commit true-up.
	PostpaidCommit InvoiceLineItemPostpaidCommit `json:"postpaid_commit"`
	// Includes the presentation group values associated with this line item if
	// presentation group keys are used.
	PresentationGroupValues map[string]string `json:"presentation_group_values"`
	// Includes the pricing group values associated with this line item if dimensional
	// pricing is used.
	PricingGroupValues map[string]string `json:"pricing_group_values"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	ProductCustomFields map[string]string `json:"product_custom_fields"`
	// ID of the product associated with the line item.
	ProductID string `json:"product_id" format:"uuid"`
	// The current product tags associated with the line item's `product_id`.
	ProductTags []string `json:"product_tags"`
	// The type of the line item's product. Possible values are `FixedProductListItem`
	// (for `FIXED` type products), `UsageProductListItem` (for `USAGE` type products),
	// `SubscriptionProductListItem` (for `SUBSCRIPTION` type products) or
	// `CompositeProductListItem` (for `COMPOSITE` type products). For scheduled
	// charges, commit and credit payments, the value is `FixedProductListItem`.
	ProductType string `json:"product_type"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	ProfessionalServiceCustomFields map[string]string `json:"professional_service_custom_fields"`
	ProfessionalServiceID           string            `json:"professional_service_id" format:"uuid"`
	// The quantity associated with the line item.
	Quantity float64 `json:"quantity"`
	// Any of "AWS", "AWS_PRO_SERVICE", "GCP", "GCP_PRO_SERVICE".
	ResellerType string `json:"reseller_type"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	ScheduledChargeCustomFields map[string]string `json:"scheduled_charge_custom_fields"`
	// ID of scheduled charge.
	ScheduledChargeID string `json:"scheduled_charge_id" format:"uuid"`
	// The line item's start date (inclusive).
	StartingAt   time.Time                    `json:"starting_at" format:"date-time"`
	SubLineItems []InvoiceLineItemSubLineItem `json:"sub_line_items"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	SubscriptionCustomFields map[string]string `json:"subscription_custom_fields"`
	// Populated if the line item has a tiered price.
	Tier InvoiceLineItemTier `json:"tier"`
	// The unit price associated with the line item.
	UnitPrice float64 `json:"unit_price"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreditType                      respjson.Field
		Name                            respjson.Field
		Total                           respjson.Field
		Type                            respjson.Field
		AppliedCommitOrCredit           respjson.Field
		CommitCustomFields              respjson.Field
		CommitID                        respjson.Field
		CommitNetsuiteItemID            respjson.Field
		CommitNetsuiteSalesOrderID      respjson.Field
		CommitSegmentID                 respjson.Field
		CommitType                      respjson.Field
		CustomFields                    respjson.Field
		DiscountCustomFields            respjson.Field
		DiscountID                      respjson.Field
		EndingBefore                    respjson.Field
		GroupKey                        respjson.Field
		GroupValue                      respjson.Field
		IsProrated                      respjson.Field
		ListPrice                       respjson.Field
		Metadata                        respjson.Field
		NetsuiteInvoiceBillingEnd       respjson.Field
		NetsuiteInvoiceBillingStart     respjson.Field
		NetsuiteItemID                  respjson.Field
		PostpaidCommit                  respjson.Field
		PresentationGroupValues         respjson.Field
		PricingGroupValues              respjson.Field
		ProductCustomFields             respjson.Field
		ProductID                       respjson.Field
		ProductTags                     respjson.Field
		ProductType                     respjson.Field
		ProfessionalServiceCustomFields respjson.Field
		ProfessionalServiceID           respjson.Field
		Quantity                        respjson.Field
		ResellerType                    respjson.Field
		ScheduledChargeCustomFields     respjson.Field
		ScheduledChargeID               respjson.Field
		StartingAt                      respjson.Field
		SubLineItems                    respjson.Field
		SubscriptionCustomFields        respjson.Field
		Tier                            respjson.Field
		UnitPrice                       respjson.Field
		ExtraFields                     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InvoiceLineItem) RawJSON added in v1.0.0

func (r InvoiceLineItem) RawJSON() string

Returns the unmodified JSON received from the API

func (*InvoiceLineItem) UnmarshalJSON

func (r *InvoiceLineItem) UnmarshalJSON(data []byte) error

type InvoiceLineItemAppliedCommitOrCredit added in v1.0.0

type InvoiceLineItemAppliedCommitOrCredit struct {
	ID string `json:"id,required" format:"uuid"`
	// Any of "PREPAID", "POSTPAID", "CREDIT".
	Type string `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Details about the credit or commit that was applied to this line item. Only present on line items with product of `USAGE`, `SUBSCRIPTION` or `COMPOSITE` types.

func (InvoiceLineItemAppliedCommitOrCredit) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*InvoiceLineItemAppliedCommitOrCredit) UnmarshalJSON added in v1.0.0

func (r *InvoiceLineItemAppliedCommitOrCredit) UnmarshalJSON(data []byte) error

type InvoiceLineItemPostpaidCommit added in v1.0.0

type InvoiceLineItemPostpaidCommit struct {
	ID string `json:"id,required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Only present for line items paying for a postpaid commit true-up.

func (InvoiceLineItemPostpaidCommit) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*InvoiceLineItemPostpaidCommit) UnmarshalJSON added in v1.0.0

func (r *InvoiceLineItemPostpaidCommit) UnmarshalJSON(data []byte) error

type InvoiceLineItemSubLineItem added in v1.0.0

type InvoiceLineItemSubLineItem struct {
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields  map[string]string `json:"custom_fields,required"`
	Name          string            `json:"name,required"`
	Quantity      float64           `json:"quantity,required"`
	Subtotal      float64           `json:"subtotal,required"`
	ChargeID      string            `json:"charge_id" format:"uuid"`
	CreditGrantID string            `json:"credit_grant_id" format:"uuid"`
	// The end date for the charge (for seats charges only).
	EndDate time.Time `json:"end_date" format:"date-time"`
	// the unit price for this charge, present only if the charge is not tiered and the
	// quantity is nonzero
	Price float64 `json:"price"`
	// The start date for the charge (for seats charges only).
	StartDate time.Time `json:"start_date" format:"date-time"`
	// when the current tier started and ends (for tiered charges only)
	TierPeriod InvoiceLineItemSubLineItemTierPeriod `json:"tier_period"`
	Tiers      []InvoiceLineItemSubLineItemTier     `json:"tiers"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CustomFields  respjson.Field
		Name          respjson.Field
		Quantity      respjson.Field
		Subtotal      respjson.Field
		ChargeID      respjson.Field
		CreditGrantID respjson.Field
		EndDate       respjson.Field
		Price         respjson.Field
		StartDate     respjson.Field
		TierPeriod    respjson.Field
		Tiers         respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InvoiceLineItemSubLineItem) RawJSON added in v1.0.0

func (r InvoiceLineItemSubLineItem) RawJSON() string

Returns the unmodified JSON received from the API

func (*InvoiceLineItemSubLineItem) UnmarshalJSON added in v1.0.0

func (r *InvoiceLineItemSubLineItem) UnmarshalJSON(data []byte) error

type InvoiceLineItemSubLineItemTier added in v1.0.0

type InvoiceLineItemSubLineItemTier struct {
	Price    float64 `json:"price,required"`
	Quantity float64 `json:"quantity,required"`
	// at what metric amount this tier begins
	StartingAt float64 `json:"starting_at,required"`
	Subtotal   float64 `json:"subtotal,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Price       respjson.Field
		Quantity    respjson.Field
		StartingAt  respjson.Field
		Subtotal    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InvoiceLineItemSubLineItemTier) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*InvoiceLineItemSubLineItemTier) UnmarshalJSON added in v1.0.0

func (r *InvoiceLineItemSubLineItemTier) UnmarshalJSON(data []byte) error

type InvoiceLineItemSubLineItemTierPeriod added in v1.0.0

type InvoiceLineItemSubLineItemTierPeriod struct {
	StartingAt   time.Time `json:"starting_at,required" format:"date-time"`
	EndingBefore time.Time `json:"ending_before" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		StartingAt   respjson.Field
		EndingBefore respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

when the current tier started and ends (for tiered charges only)

func (InvoiceLineItemSubLineItemTierPeriod) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*InvoiceLineItemSubLineItemTierPeriod) UnmarshalJSON added in v1.0.0

func (r *InvoiceLineItemSubLineItemTierPeriod) UnmarshalJSON(data []byte) error

type InvoiceLineItemTier added in v1.0.0

type InvoiceLineItemTier struct {
	Level      float64 `json:"level,required"`
	StartingAt string  `json:"starting_at,required"`
	Size       string  `json:"size,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Level       respjson.Field
		StartingAt  respjson.Field
		Size        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Populated if the line item has a tiered price.

func (InvoiceLineItemTier) RawJSON added in v1.0.0

func (r InvoiceLineItemTier) RawJSON() string

Returns the unmodified JSON received from the API

func (*InvoiceLineItemTier) UnmarshalJSON added in v1.0.0

func (r *InvoiceLineItemTier) UnmarshalJSON(data []byte) error

type InvoiceResellerRoyalty

type InvoiceResellerRoyalty struct {
	Fraction           string `json:"fraction,required"`
	NetsuiteResellerID string `json:"netsuite_reseller_id,required"`
	// Any of "AWS", "AWS_PRO_SERVICE", "GCP", "GCP_PRO_SERVICE".
	ResellerType string                           `json:"reseller_type,required"`
	AwsOptions   InvoiceResellerRoyaltyAwsOptions `json:"aws_options"`
	GcpOptions   InvoiceResellerRoyaltyGcpOptions `json:"gcp_options"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Fraction           respjson.Field
		NetsuiteResellerID respjson.Field
		ResellerType       respjson.Field
		AwsOptions         respjson.Field
		GcpOptions         respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Only present for contract invoices with reseller royalties.

func (InvoiceResellerRoyalty) RawJSON added in v1.0.0

func (r InvoiceResellerRoyalty) RawJSON() string

Returns the unmodified JSON received from the API

func (*InvoiceResellerRoyalty) UnmarshalJSON

func (r *InvoiceResellerRoyalty) UnmarshalJSON(data []byte) error

type InvoiceResellerRoyaltyAwsOptions

type InvoiceResellerRoyaltyAwsOptions struct {
	AwsAccountNumber    string `json:"aws_account_number"`
	AwsOfferID          string `json:"aws_offer_id"`
	AwsPayerReferenceID string `json:"aws_payer_reference_id"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AwsAccountNumber    respjson.Field
		AwsOfferID          respjson.Field
		AwsPayerReferenceID respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InvoiceResellerRoyaltyAwsOptions) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*InvoiceResellerRoyaltyAwsOptions) UnmarshalJSON

func (r *InvoiceResellerRoyaltyAwsOptions) UnmarshalJSON(data []byte) error

type InvoiceResellerRoyaltyGcpOptions

type InvoiceResellerRoyaltyGcpOptions struct {
	GcpAccountID string `json:"gcp_account_id"`
	GcpOfferID   string `json:"gcp_offer_id"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		GcpAccountID respjson.Field
		GcpOfferID   respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InvoiceResellerRoyaltyGcpOptions) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*InvoiceResellerRoyaltyGcpOptions) UnmarshalJSON

func (r *InvoiceResellerRoyaltyGcpOptions) UnmarshalJSON(data []byte) error

type Override

type Override = shared.Override

This is an alias to an internal type.

type OverrideOverrideSpecifier

type OverrideOverrideSpecifier = shared.OverrideOverrideSpecifier

This is an alias to an internal type.

type OverrideProduct

type OverrideProduct = shared.OverrideProduct

This is an alias to an internal type.

type OverrideRateType

type OverrideRateType = shared.OverrideRateType

This is an alias to an internal type.

type OverrideTarget

type OverrideTarget = shared.OverrideTarget

This is an alias to an internal type.

type OverrideTier added in v1.0.0

type OverrideTier = shared.OverrideTier

This is an alias to an internal type.

type OverrideType

type OverrideType = shared.OverrideType

This is an alias to an internal type.

type OverwriteRate added in v1.0.0

type OverwriteRate = shared.OverwriteRate

This is an alias to an internal type.

type OverwriteRateRateType added in v1.0.0

type OverwriteRateRateType = shared.OverwriteRateRateType

This is an alias to an internal type.

type PaymentGateConfig added in v1.0.0

type PaymentGateConfig = shared.PaymentGateConfig

This is an alias to an internal type.

type PaymentGateConfigParam added in v1.0.0

type PaymentGateConfigParam = shared.PaymentGateConfigParam

This is an alias to an internal type.

type PaymentGateConfigPaymentGateType added in v1.0.0

type PaymentGateConfigPaymentGateType = shared.PaymentGateConfigPaymentGateType

Gate access to the commit balance based on successful collection of payment. Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to facilitate payment using your own payment integration. Select NONE if you do not wish to payment gate the commit balance.

This is an alias to an internal type.

type PaymentGateConfigPrecalculatedTaxConfig added in v1.0.0

type PaymentGateConfigPrecalculatedTaxConfig = shared.PaymentGateConfigPrecalculatedTaxConfig

Only applicable if using PRECALCULATED as your tax type.

This is an alias to an internal type.

type PaymentGateConfigPrecalculatedTaxConfigParam added in v1.0.0

type PaymentGateConfigPrecalculatedTaxConfigParam = shared.PaymentGateConfigPrecalculatedTaxConfigParam

Only applicable if using PRECALCULATED as your tax type.

This is an alias to an internal type.

type PaymentGateConfigStripeConfig added in v1.0.0

type PaymentGateConfigStripeConfig = shared.PaymentGateConfigStripeConfig

Only applicable if using STRIPE as your payment gate type.

This is an alias to an internal type.

type PaymentGateConfigStripeConfigParam added in v1.0.0

type PaymentGateConfigStripeConfigParam = shared.PaymentGateConfigStripeConfigParam

Only applicable if using STRIPE as your payment gate type.

This is an alias to an internal type.

type PaymentGateConfigTaxType added in v1.0.0

type PaymentGateConfigTaxType = shared.PaymentGateConfigTaxType

Stripe tax is only supported for Stripe payment gateway. Select NONE if you do not wish Metronome to calculate tax on your behalf. Leaving this field blank will default to NONE.

This is an alias to an internal type.

type PaymentGateConfigV2 added in v1.0.0

type PaymentGateConfigV2 = shared.PaymentGateConfigV2

This is an alias to an internal type.

type PaymentGateConfigV2Param added in v1.0.0

type PaymentGateConfigV2Param = shared.PaymentGateConfigV2Param

This is an alias to an internal type.

type PaymentGateConfigV2PaymentGateType added in v1.0.0

type PaymentGateConfigV2PaymentGateType = shared.PaymentGateConfigV2PaymentGateType

Gate access to the commit balance based on successful collection of payment. Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to facilitate payment using your own payment integration. Select NONE if you do not wish to payment gate the commit balance.

This is an alias to an internal type.

type PaymentGateConfigV2PrecalculatedTaxConfig added in v1.0.0

type PaymentGateConfigV2PrecalculatedTaxConfig = shared.PaymentGateConfigV2PrecalculatedTaxConfig

Only applicable if using PRECALCULATED as your tax type.

This is an alias to an internal type.

type PaymentGateConfigV2PrecalculatedTaxConfigParam added in v1.0.0

type PaymentGateConfigV2PrecalculatedTaxConfigParam = shared.PaymentGateConfigV2PrecalculatedTaxConfigParam

Only applicable if using PRECALCULATED as your tax type.

This is an alias to an internal type.

type PaymentGateConfigV2StripeConfig added in v1.0.0

type PaymentGateConfigV2StripeConfig = shared.PaymentGateConfigV2StripeConfig

Only applicable if using STRIPE as your payment gateway type.

This is an alias to an internal type.

type PaymentGateConfigV2StripeConfigParam added in v1.0.0

type PaymentGateConfigV2StripeConfigParam = shared.PaymentGateConfigV2StripeConfigParam

Only applicable if using STRIPE as your payment gateway type.

This is an alias to an internal type.

type PaymentGateConfigV2TaxType added in v1.0.0

type PaymentGateConfigV2TaxType = shared.PaymentGateConfigV2TaxType

Stripe tax is only supported for Stripe payment gateway. Select NONE if you do not wish Metronome to calculate tax on your behalf. Leaving this field blank will default to NONE.

This is an alias to an internal type.

type PlanDetail

type PlanDetail struct {
	ID string `json:"id,required" format:"uuid"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string       `json:"custom_fields,required"`
	Name         string                  `json:"name,required"`
	CreditGrants []PlanDetailCreditGrant `json:"credit_grants"`
	Description  string                  `json:"description"`
	Minimums     []PlanDetailMinimum     `json:"minimums"`
	OverageRates []PlanDetailOverageRate `json:"overage_rates"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID           respjson.Field
		CustomFields respjson.Field
		Name         respjson.Field
		CreditGrants respjson.Field
		Description  respjson.Field
		Minimums     respjson.Field
		OverageRates respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PlanDetail) RawJSON added in v1.0.0

func (r PlanDetail) RawJSON() string

Returns the unmodified JSON received from the API

func (*PlanDetail) UnmarshalJSON

func (r *PlanDetail) UnmarshalJSON(data []byte) error

type PlanDetailCreditGrant

type PlanDetailCreditGrant struct {
	AmountGranted           float64               `json:"amount_granted,required"`
	AmountGrantedCreditType shared.CreditTypeData `json:"amount_granted_credit_type,required"`
	AmountPaid              float64               `json:"amount_paid,required"`
	AmountPaidCreditType    shared.CreditTypeData `json:"amount_paid_credit_type,required"`
	EffectiveDuration       float64               `json:"effective_duration,required"`
	Name                    string                `json:"name,required"`
	Priority                string                `json:"priority,required"`
	SendInvoice             bool                  `json:"send_invoice,required"`
	Reason                  string                `json:"reason"`
	RecurrenceDuration      float64               `json:"recurrence_duration"`
	RecurrenceInterval      float64               `json:"recurrence_interval"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AmountGranted           respjson.Field
		AmountGrantedCreditType respjson.Field
		AmountPaid              respjson.Field
		AmountPaidCreditType    respjson.Field
		EffectiveDuration       respjson.Field
		Name                    respjson.Field
		Priority                respjson.Field
		SendInvoice             respjson.Field
		Reason                  respjson.Field
		RecurrenceDuration      respjson.Field
		RecurrenceInterval      respjson.Field
		ExtraFields             map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PlanDetailCreditGrant) RawJSON added in v1.0.0

func (r PlanDetailCreditGrant) RawJSON() string

Returns the unmodified JSON received from the API

func (*PlanDetailCreditGrant) UnmarshalJSON

func (r *PlanDetailCreditGrant) UnmarshalJSON(data []byte) error

type PlanDetailMinimum

type PlanDetailMinimum struct {
	CreditType shared.CreditTypeData `json:"credit_type,required"`
	Name       string                `json:"name,required"`
	// Used in price ramps. Indicates how many billing periods pass before the charge
	// applies.
	StartPeriod float64 `json:"start_period,required"`
	Value       float64 `json:"value,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreditType  respjson.Field
		Name        respjson.Field
		StartPeriod respjson.Field
		Value       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PlanDetailMinimum) RawJSON added in v1.0.0

func (r PlanDetailMinimum) RawJSON() string

Returns the unmodified JSON received from the API

func (*PlanDetailMinimum) UnmarshalJSON

func (r *PlanDetailMinimum) UnmarshalJSON(data []byte) error

type PlanDetailOverageRate

type PlanDetailOverageRate struct {
	CreditType     shared.CreditTypeData `json:"credit_type,required"`
	FiatCreditType shared.CreditTypeData `json:"fiat_credit_type,required"`
	// Used in price ramps. Indicates how many billing periods pass before the charge
	// applies.
	StartPeriod            float64 `json:"start_period,required"`
	ToFiatConversionFactor float64 `json:"to_fiat_conversion_factor,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreditType             respjson.Field
		FiatCreditType         respjson.Field
		StartPeriod            respjson.Field
		ToFiatConversionFactor respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PlanDetailOverageRate) RawJSON added in v1.0.0

func (r PlanDetailOverageRate) RawJSON() string

Returns the unmodified JSON received from the API

func (*PlanDetailOverageRate) UnmarshalJSON

func (r *PlanDetailOverageRate) UnmarshalJSON(data []byte) error

type PrepaidBalanceThresholdConfiguration added in v1.0.0

type PrepaidBalanceThresholdConfiguration = shared.PrepaidBalanceThresholdConfiguration

This is an alias to an internal type.

type PrepaidBalanceThresholdConfigurationCommit added in v1.0.0

type PrepaidBalanceThresholdConfigurationCommit = shared.PrepaidBalanceThresholdConfigurationCommit

This is an alias to an internal type.

type PrepaidBalanceThresholdConfigurationCommitParam added in v1.0.0

type PrepaidBalanceThresholdConfigurationCommitParam = shared.PrepaidBalanceThresholdConfigurationCommitParam

This is an alias to an internal type.

type PrepaidBalanceThresholdConfigurationParam added in v1.0.0

type PrepaidBalanceThresholdConfigurationParam = shared.PrepaidBalanceThresholdConfigurationParam

This is an alias to an internal type.

type PrepaidBalanceThresholdConfigurationV2 added in v1.0.0

type PrepaidBalanceThresholdConfigurationV2 = shared.PrepaidBalanceThresholdConfigurationV2

This is an alias to an internal type.

type PrepaidBalanceThresholdConfigurationV2Commit added in v1.0.0

type PrepaidBalanceThresholdConfigurationV2Commit = shared.PrepaidBalanceThresholdConfigurationV2Commit

This is an alias to an internal type.

type PrepaidBalanceThresholdConfigurationV2CommitParam added in v1.0.0

type PrepaidBalanceThresholdConfigurationV2CommitParam = shared.PrepaidBalanceThresholdConfigurationV2CommitParam

This is an alias to an internal type.

type PrepaidBalanceThresholdConfigurationV2Param added in v1.0.0

type PrepaidBalanceThresholdConfigurationV2Param = shared.PrepaidBalanceThresholdConfigurationV2Param

This is an alias to an internal type.

type ProService

type ProService = shared.ProService

This is an alias to an internal type.

type ProductListItemState

type ProductListItemState struct {
	CreatedAt           time.Time `json:"created_at,required" format:"date-time"`
	CreatedBy           string    `json:"created_by,required"`
	Name                string    `json:"name,required"`
	BillableMetricID    string    `json:"billable_metric_id"`
	CompositeProductIDs []string  `json:"composite_product_ids" format:"uuid"`
	CompositeTags       []string  `json:"composite_tags"`
	ExcludeFreeUsage    bool      `json:"exclude_free_usage"`
	// This field's availability is dependent on your client's configuration.
	IsRefundable bool `json:"is_refundable"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteInternalItemID string `json:"netsuite_internal_item_id"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteOverageItemID string `json:"netsuite_overage_item_id"`
	// For USAGE products only. Groups usage line items on invoices. The superset of
	// values in the pricing group key and presentation group key must be set as one
	// compound group key on the billable metric.
	PresentationGroupKey []string `json:"presentation_group_key"`
	// For USAGE products only. If set, pricing for this product will be determined for
	// each pricing_group_key value, as opposed to the product as a whole. The superset
	// of values in the pricing group key and presentation group key must be set as one
	// compound group key on the billable metric.
	PricingGroupKey []string `json:"pricing_group_key"`
	// Optional. Only valid for USAGE products. If provided, the quantity will be
	// converted using the provided conversion factor and operation. For example, if
	// the operation is "multiply" and the conversion factor is 100, then the quantity
	// will be multiplied by 100. This can be used in cases where data is sent in one
	// unit and priced in another. For example, data could be sent in MB and priced in
	// GB. In this case, the conversion factor would be 1024 and the operation would be
	// "divide".
	QuantityConversion QuantityConversion `json:"quantity_conversion,nullable"`
	// Optional. Only valid for USAGE products. If provided, the quantity will be
	// rounded using the provided rounding method and decimal places. For example, if
	// the method is "round up" and the decimal places is 0, then the quantity will be
	// rounded up to the nearest integer.
	QuantityRounding QuantityRounding `json:"quantity_rounding,nullable"`
	StartingAt       time.Time        `json:"starting_at" format:"date-time"`
	Tags             []string         `json:"tags"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt              respjson.Field
		CreatedBy              respjson.Field
		Name                   respjson.Field
		BillableMetricID       respjson.Field
		CompositeProductIDs    respjson.Field
		CompositeTags          respjson.Field
		ExcludeFreeUsage       respjson.Field
		IsRefundable           respjson.Field
		NetsuiteInternalItemID respjson.Field
		NetsuiteOverageItemID  respjson.Field
		PresentationGroupKey   respjson.Field
		PricingGroupKey        respjson.Field
		QuantityConversion     respjson.Field
		QuantityRounding       respjson.Field
		StartingAt             respjson.Field
		Tags                   respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ProductListItemState) RawJSON added in v1.0.0

func (r ProductListItemState) RawJSON() string

Returns the unmodified JSON received from the API

func (*ProductListItemState) UnmarshalJSON

func (r *ProductListItemState) UnmarshalJSON(data []byte) error

type PropertyFilter

type PropertyFilter = shared.PropertyFilter

This is an alias to an internal type.

type PropertyFilterParam

type PropertyFilterParam = shared.PropertyFilterParam

This is an alias to an internal type.

type QuantityConversion

type QuantityConversion struct {
	// The factor to multiply or divide the quantity by.
	ConversionFactor float64 `json:"conversion_factor,required"`
	// The operation to perform on the quantity
	//
	// Any of "MULTIPLY", "DIVIDE".
	Operation QuantityConversionOperation `json:"operation,required"`
	// Optional name for this conversion.
	Name string `json:"name"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ConversionFactor respjson.Field
		Operation        respjson.Field
		Name             respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Optional. Only valid for USAGE products. If provided, the quantity will be converted using the provided conversion factor and operation. For example, if the operation is "multiply" and the conversion factor is 100, then the quantity will be multiplied by 100. This can be used in cases where data is sent in one unit and priced in another. For example, data could be sent in MB and priced in GB. In this case, the conversion factor would be 1024 and the operation would be "divide".

func (QuantityConversion) RawJSON added in v1.0.0

func (r QuantityConversion) RawJSON() string

Returns the unmodified JSON received from the API

func (QuantityConversion) ToParam added in v1.0.0

ToParam converts this QuantityConversion to a QuantityConversionParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with QuantityConversionParam.Overrides()

func (*QuantityConversion) UnmarshalJSON

func (r *QuantityConversion) UnmarshalJSON(data []byte) error

type QuantityConversionOperation

type QuantityConversionOperation string

The operation to perform on the quantity

const (
	QuantityConversionOperationMultiply QuantityConversionOperation = "MULTIPLY"
	QuantityConversionOperationDivide   QuantityConversionOperation = "DIVIDE"
)

type QuantityConversionParam

type QuantityConversionParam struct {
	// The factor to multiply or divide the quantity by.
	ConversionFactor float64 `json:"conversion_factor,required"`
	// The operation to perform on the quantity
	//
	// Any of "MULTIPLY", "DIVIDE".
	Operation QuantityConversionOperation `json:"operation,omitzero,required"`
	// Optional name for this conversion.
	Name param.Opt[string] `json:"name,omitzero"`
	// contains filtered or unexported fields
}

Optional. Only valid for USAGE products. If provided, the quantity will be converted using the provided conversion factor and operation. For example, if the operation is "multiply" and the conversion factor is 100, then the quantity will be multiplied by 100. This can be used in cases where data is sent in one unit and priced in another. For example, data could be sent in MB and priced in GB. In this case, the conversion factor would be 1024 and the operation would be "divide".

The properties ConversionFactor, Operation are required.

func (QuantityConversionParam) MarshalJSON

func (r QuantityConversionParam) MarshalJSON() (data []byte, err error)

func (*QuantityConversionParam) UnmarshalJSON added in v1.0.0

func (r *QuantityConversionParam) UnmarshalJSON(data []byte) error

type QuantityRounding

type QuantityRounding struct {
	DecimalPlaces float64 `json:"decimal_places,required"`
	// Any of "ROUND_UP", "ROUND_DOWN", "ROUND_HALF_UP".
	RoundingMethod QuantityRoundingRoundingMethod `json:"rounding_method,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DecimalPlaces  respjson.Field
		RoundingMethod respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Optional. Only valid for USAGE products. If provided, the quantity will be rounded using the provided rounding method and decimal places. For example, if the method is "round up" and the decimal places is 0, then the quantity will be rounded up to the nearest integer.

func (QuantityRounding) RawJSON added in v1.0.0

func (r QuantityRounding) RawJSON() string

Returns the unmodified JSON received from the API

func (QuantityRounding) ToParam added in v1.0.0

ToParam converts this QuantityRounding to a QuantityRoundingParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with QuantityRoundingParam.Overrides()

func (*QuantityRounding) UnmarshalJSON

func (r *QuantityRounding) UnmarshalJSON(data []byte) error

type QuantityRoundingParam

type QuantityRoundingParam struct {
	DecimalPlaces float64 `json:"decimal_places,required"`
	// Any of "ROUND_UP", "ROUND_DOWN", "ROUND_HALF_UP".
	RoundingMethod QuantityRoundingRoundingMethod `json:"rounding_method,omitzero,required"`
	// contains filtered or unexported fields
}

Optional. Only valid for USAGE products. If provided, the quantity will be rounded using the provided rounding method and decimal places. For example, if the method is "round up" and the decimal places is 0, then the quantity will be rounded up to the nearest integer.

The properties DecimalPlaces, RoundingMethod are required.

func (QuantityRoundingParam) MarshalJSON

func (r QuantityRoundingParam) MarshalJSON() (data []byte, err error)

func (*QuantityRoundingParam) UnmarshalJSON added in v1.0.0

func (r *QuantityRoundingParam) UnmarshalJSON(data []byte) error

type QuantityRoundingRoundingMethod

type QuantityRoundingRoundingMethod string
const (
	QuantityRoundingRoundingMethodRoundUp     QuantityRoundingRoundingMethod = "ROUND_UP"
	QuantityRoundingRoundingMethodRoundDown   QuantityRoundingRoundingMethod = "ROUND_DOWN"
	QuantityRoundingRoundingMethodRoundHalfUp QuantityRoundingRoundingMethod = "ROUND_HALF_UP"
)

type Rate

type Rate = shared.Rate

This is an alias to an internal type.

type RateRateType

type RateRateType = shared.RateRateType

This is an alias to an internal type.

type RecurringCommitSubscriptionConfig added in v1.0.0

type RecurringCommitSubscriptionConfig = shared.RecurringCommitSubscriptionConfig

This is an alias to an internal type.

type RecurringCommitSubscriptionConfigAllocation added in v1.0.0

type RecurringCommitSubscriptionConfigAllocation = shared.RecurringCommitSubscriptionConfigAllocation

This is an alias to an internal type.

type RecurringCommitSubscriptionConfigApplySeatIncreaseConfig added in v1.0.0

type RecurringCommitSubscriptionConfigApplySeatIncreaseConfig = shared.RecurringCommitSubscriptionConfigApplySeatIncreaseConfig

This is an alias to an internal type.

type RolloverAmountMaxAmountParam

type RolloverAmountMaxAmountParam struct {
	// Rollover up to a fixed amount of the original credit grant amount.
	//
	// Any of "MAX_AMOUNT".
	Type RolloverAmountMaxAmountType `json:"type,omitzero,required"`
	// The maximum amount to rollover.
	Value float64 `json:"value,required"`
	// contains filtered or unexported fields
}

The properties Type, Value are required.

func (RolloverAmountMaxAmountParam) MarshalJSON

func (r RolloverAmountMaxAmountParam) MarshalJSON() (data []byte, err error)

func (*RolloverAmountMaxAmountParam) UnmarshalJSON added in v1.0.0

func (r *RolloverAmountMaxAmountParam) UnmarshalJSON(data []byte) error

type RolloverAmountMaxAmountType

type RolloverAmountMaxAmountType string

Rollover up to a fixed amount of the original credit grant amount.

const (
	RolloverAmountMaxAmountTypeMaxAmount RolloverAmountMaxAmountType = "MAX_AMOUNT"
)

type RolloverAmountMaxPercentageParam

type RolloverAmountMaxPercentageParam struct {
	// Rollover up to a percentage of the original credit grant amount.
	//
	// Any of "MAX_PERCENTAGE".
	Type RolloverAmountMaxPercentageType `json:"type,omitzero,required"`
	// The maximum percentage (0-1) of the original credit grant to rollover.
	Value float64 `json:"value,required"`
	// contains filtered or unexported fields
}

The properties Type, Value are required.

func (RolloverAmountMaxPercentageParam) MarshalJSON

func (r RolloverAmountMaxPercentageParam) MarshalJSON() (data []byte, err error)

func (*RolloverAmountMaxPercentageParam) UnmarshalJSON added in v1.0.0

func (r *RolloverAmountMaxPercentageParam) UnmarshalJSON(data []byte) error

type RolloverAmountMaxPercentageType

type RolloverAmountMaxPercentageType string

Rollover up to a percentage of the original credit grant amount.

const (
	RolloverAmountMaxPercentageTypeMaxPercentage RolloverAmountMaxPercentageType = "MAX_PERCENTAGE"
)

type ScheduleDuration

type ScheduleDuration = shared.ScheduleDuration

This is an alias to an internal type.

type ScheduleDurationScheduleItem

type ScheduleDurationScheduleItem = shared.ScheduleDurationScheduleItem

This is an alias to an internal type.

type SchedulePointInTime

type SchedulePointInTime = shared.SchedulePointInTime

This is an alias to an internal type.

type SchedulePointInTimeScheduleItem

type SchedulePointInTimeScheduleItem = shared.SchedulePointInTimeScheduleItem

This is an alias to an internal type.

type ScheduledCharge

type ScheduledCharge = shared.ScheduledCharge

This is an alias to an internal type.

type ScheduledChargeProduct

type ScheduledChargeProduct = shared.ScheduledChargeProduct

This is an alias to an internal type.

type SpendThresholdConfiguration added in v1.0.0

type SpendThresholdConfiguration = shared.SpendThresholdConfiguration

This is an alias to an internal type.

type SpendThresholdConfigurationParam added in v1.0.0

type SpendThresholdConfigurationParam = shared.SpendThresholdConfigurationParam

This is an alias to an internal type.

type SpendThresholdConfigurationV2 added in v1.0.0

type SpendThresholdConfigurationV2 = shared.SpendThresholdConfigurationV2

This is an alias to an internal type.

type SpendThresholdConfigurationV2Param added in v1.0.0

type SpendThresholdConfigurationV2Param = shared.SpendThresholdConfigurationV2Param

This is an alias to an internal type.

type Subscription added in v1.0.0

type Subscription = shared.Subscription

This is an alias to an internal type.

type SubscriptionCollectionSchedule added in v1.0.0

type SubscriptionCollectionSchedule = shared.SubscriptionCollectionSchedule

This is an alias to an internal type.

type SubscriptionProration added in v1.0.0

type SubscriptionProration = shared.SubscriptionProration

This is an alias to an internal type.

type SubscriptionQuantityManagementMode added in v1.0.0

type SubscriptionQuantityManagementMode = shared.SubscriptionQuantityManagementMode

Determines how the subscription's quantity is controlled. Defaults to QUANTITY_ONLY. **QUANTITY_ONLY**: The subscription quantity is specified directly on the subscription. `initial_quantity` must be provided with this option. Compatible with recurring commits/credits that use POOLED allocation.

This is an alias to an internal type.

type SubscriptionQuantitySchedule added in v1.0.0

type SubscriptionQuantitySchedule = shared.SubscriptionQuantitySchedule

This is an alias to an internal type.

type SubscriptionSubscriptionRate added in v1.0.0

type SubscriptionSubscriptionRate = shared.SubscriptionSubscriptionRate

This is an alias to an internal type.

type SubscriptionSubscriptionRateProduct added in v1.0.0

type SubscriptionSubscriptionRateProduct = shared.SubscriptionSubscriptionRateProduct

This is an alias to an internal type.

type Tier

type Tier = shared.Tier

This is an alias to an internal type.

type TierParam

type TierParam = shared.TierParam

This is an alias to an internal type.

type UpdateBaseThresholdCommit added in v1.0.0

type UpdateBaseThresholdCommit = shared.UpdateBaseThresholdCommit

This is an alias to an internal type.

type UpdateBaseThresholdCommitParam added in v1.0.0

type UpdateBaseThresholdCommitParam = shared.UpdateBaseThresholdCommitParam

This is an alias to an internal type.

type V1AlertArchiveParams

type V1AlertArchiveParams struct {
	// The Metronome ID of the alert
	ID string `json:"id,required" format:"uuid"`
	// If true, resets the uniqueness key on this alert so it can be re-used
	ReleaseUniquenessKey param.Opt[bool] `json:"release_uniqueness_key,omitzero"`
	// contains filtered or unexported fields
}

func (V1AlertArchiveParams) MarshalJSON

func (r V1AlertArchiveParams) MarshalJSON() (data []byte, err error)

func (*V1AlertArchiveParams) UnmarshalJSON added in v1.0.0

func (r *V1AlertArchiveParams) UnmarshalJSON(data []byte) error

type V1AlertArchiveResponse

type V1AlertArchiveResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1AlertArchiveResponse) RawJSON added in v1.0.0

func (r V1AlertArchiveResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1AlertArchiveResponse) UnmarshalJSON

func (r *V1AlertArchiveResponse) UnmarshalJSON(data []byte) error

type V1AlertNewParams

type V1AlertNewParams struct {
	// Type of the alert
	//
	// Any of "low_credit_balance_reached", "spend_threshold_reached",
	// "monthly_invoice_total_spend_threshold_reached",
	// "low_remaining_days_in_plan_reached", "low_remaining_credit_percentage_reached",
	// "usage_threshold_reached", "low_remaining_days_for_commit_segment_reached",
	// "low_remaining_commit_balance_reached",
	// "low_remaining_commit_percentage_reached",
	// "low_remaining_days_for_contract_credit_segment_reached",
	// "low_remaining_contract_credit_balance_reached",
	// "low_remaining_contract_credit_percentage_reached",
	// "low_remaining_contract_credit_and_commit_balance_reached",
	// "invoice_total_reached".
	AlertType V1AlertNewParamsAlertType `json:"alert_type,omitzero,required"`
	// Name of the alert
	Name string `json:"name,required"`
	// Threshold value of the alert policy. Depending upon the alert type, this number
	// may represent a financial amount, the days remaining, or a percentage reached.
	Threshold float64 `json:"threshold,required"`
	// For alerts of type `usage_threshold_reached`, specifies which billable metric to
	// track the usage for.
	BillableMetricID param.Opt[string] `json:"billable_metric_id,omitzero" format:"uuid"`
	// ID of the credit's currency, defaults to USD. If the specific alert type
	// requires a pricing unit/currency, find the ID in the
	// [Metronome app](https://app.metronome.com/offering/pricing-units).
	CreditTypeID param.Opt[string] `json:"credit_type_id,omitzero" format:"uuid"`
	// If provided, will create this alert for this specific customer. To create an
	// alert for all customers, do not specify a `customer_id`.
	CustomerID param.Opt[string] `json:"customer_id,omitzero" format:"uuid"`
	// If true, the alert will evaluate immediately on customers that already meet the
	// alert threshold. If false, it will only evaluate on future customers that
	// trigger the alert threshold. Defaults to true.
	EvaluateOnCreate param.Opt[bool] `json:"evaluate_on_create,omitzero"`
	// If provided, will create this alert for this specific plan. To create an alert
	// for all customers, do not specify a `plan_id`.
	PlanID param.Opt[string] `json:"plan_id,omitzero" format:"uuid"`
	// Prevents the creation of duplicates. If a request to create a record is made
	// with a previously used uniqueness key, a new record will not be created and the
	// request will fail with a 409 error.
	UniquenessKey param.Opt[string] `json:"uniqueness_key,omitzero"`
	// An array of strings, representing a way to filter the credit grant this alert
	// applies to, by looking at the credit_grant_type field on the credit grant. This
	// field is only defined for CreditPercentage and CreditBalance alerts
	CreditGrantTypeFilters []string `json:"credit_grant_type_filters,omitzero"`
	// A list of custom field filters for alert types that support advanced filtering.
	// Only present for contract invoices.
	CustomFieldFilters []V1AlertNewParamsCustomFieldFilter `json:"custom_field_filters,omitzero"`
	// Only present for `spend_threshold_reached` alerts. Scope alert to a specific
	// group key on individual line items.
	GroupValues []V1AlertNewParamsGroupValue `json:"group_values,omitzero"`
	// Only supported for invoice_total_reached alerts. A list of invoice types to
	// evaluate.
	InvoiceTypesFilter []string `json:"invoice_types_filter,omitzero"`
	// contains filtered or unexported fields
}

func (V1AlertNewParams) MarshalJSON

func (r V1AlertNewParams) MarshalJSON() (data []byte, err error)

func (*V1AlertNewParams) UnmarshalJSON added in v1.0.0

func (r *V1AlertNewParams) UnmarshalJSON(data []byte) error

type V1AlertNewParamsAlertType

type V1AlertNewParamsAlertType string

Type of the alert

const (
	V1AlertNewParamsAlertTypeLowCreditBalanceReached                           V1AlertNewParamsAlertType = "low_credit_balance_reached"
	V1AlertNewParamsAlertTypeSpendThresholdReached                             V1AlertNewParamsAlertType = "spend_threshold_reached"
	V1AlertNewParamsAlertTypeMonthlyInvoiceTotalSpendThresholdReached          V1AlertNewParamsAlertType = "monthly_invoice_total_spend_threshold_reached"
	V1AlertNewParamsAlertTypeLowRemainingDaysInPlanReached                     V1AlertNewParamsAlertType = "low_remaining_days_in_plan_reached"
	V1AlertNewParamsAlertTypeLowRemainingCreditPercentageReached               V1AlertNewParamsAlertType = "low_remaining_credit_percentage_reached"
	V1AlertNewParamsAlertTypeUsageThresholdReached                             V1AlertNewParamsAlertType = "usage_threshold_reached"
	V1AlertNewParamsAlertTypeLowRemainingDaysForCommitSegmentReached           V1AlertNewParamsAlertType = "low_remaining_days_for_commit_segment_reached"
	V1AlertNewParamsAlertTypeLowRemainingCommitBalanceReached                  V1AlertNewParamsAlertType = "low_remaining_commit_balance_reached"
	V1AlertNewParamsAlertTypeLowRemainingCommitPercentageReached               V1AlertNewParamsAlertType = "low_remaining_commit_percentage_reached"
	V1AlertNewParamsAlertTypeLowRemainingDaysForContractCreditSegmentReached   V1AlertNewParamsAlertType = "low_remaining_days_for_contract_credit_segment_reached"
	V1AlertNewParamsAlertTypeLowRemainingContractCreditBalanceReached          V1AlertNewParamsAlertType = "low_remaining_contract_credit_balance_reached"
	V1AlertNewParamsAlertTypeLowRemainingContractCreditPercentageReached       V1AlertNewParamsAlertType = "low_remaining_contract_credit_percentage_reached"
	V1AlertNewParamsAlertTypeLowRemainingContractCreditAndCommitBalanceReached V1AlertNewParamsAlertType = "low_remaining_contract_credit_and_commit_balance_reached"
	V1AlertNewParamsAlertTypeInvoiceTotalReached                               V1AlertNewParamsAlertType = "invoice_total_reached"
)

type V1AlertNewParamsCustomFieldFilter

type V1AlertNewParamsCustomFieldFilter struct {
	// Any of "Contract", "Commit", "ContractCredit".
	Entity string `json:"entity,omitzero,required"`
	Key    string `json:"key,required"`
	Value  string `json:"value,required"`
	// contains filtered or unexported fields
}

The properties Entity, Key, Value are required.

func (V1AlertNewParamsCustomFieldFilter) MarshalJSON

func (r V1AlertNewParamsCustomFieldFilter) MarshalJSON() (data []byte, err error)

func (*V1AlertNewParamsCustomFieldFilter) UnmarshalJSON added in v1.0.0

func (r *V1AlertNewParamsCustomFieldFilter) UnmarshalJSON(data []byte) error

type V1AlertNewParamsGroupValue added in v0.2.0

type V1AlertNewParamsGroupValue struct {
	Key   string            `json:"key,required"`
	Value param.Opt[string] `json:"value,omitzero"`
	// contains filtered or unexported fields
}

The property Key is required.

func (V1AlertNewParamsGroupValue) MarshalJSON added in v0.2.0

func (r V1AlertNewParamsGroupValue) MarshalJSON() (data []byte, err error)

func (*V1AlertNewParamsGroupValue) UnmarshalJSON added in v1.0.0

func (r *V1AlertNewParamsGroupValue) UnmarshalJSON(data []byte) error

type V1AlertNewResponse

type V1AlertNewResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1AlertNewResponse) RawJSON added in v1.0.0

func (r V1AlertNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1AlertNewResponse) UnmarshalJSON

func (r *V1AlertNewResponse) UnmarshalJSON(data []byte) error

type V1AlertService

type V1AlertService struct {
	Options []option.RequestOption
}

V1AlertService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1AlertService method instead.

func NewV1AlertService

func NewV1AlertService(opts ...option.RequestOption) (r V1AlertService)

NewV1AlertService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1AlertService) Archive

Permanently disable an alert and remove it from active monitoring across all customers. Archived alerts stop evaluating immediately and can optionally release their uniqueness key for reuse in future alert configurations.

### Use this endpoint to:

- Decommission alerts that are no longer needed - Clean up test or deprecated alert configurations - Free up uniqueness keys for reuse with new alerts - Stop alert evaluations without losing historical configuration data - Disable outdated monitoring rules during pricing model transitions

### Key response fields:

- data: Object containing the archived alert's ID - Alert evaluation stops immediately for all affected customers - Historical alert data and configurations remain accessible for audit purposes

### Usage guidelines:

  • Irreversible for evaluation: Archived alerts cannot be re-enabled; create a new alert to resume monitoring
  • Uniqueness key handling: Set `release_uniqueness_key` : `true` to reuse the key in future alerts
  • Immediate effect: Alert evaluation stops instantly across all customers
  • Historical preservation: Archive operation maintains alert history and configuration for compliance and auditing

func (*V1AlertService) New

Create a new alert to monitor customer spending, balances, and billing metrics in real-time. Metronome's alert system provides industry-leading speed with immediate evaluation capabilities, enabling you to proactively manage customer accounts and prevent revenue leakage.

This endpoint creates configurable alerts that continuously monitor various billing thresholds including spend limits, credit balances, commitment utilization, and invoice totals. Alerts can be configured globally for all customers or targeted to specific customer accounts. Custom fields can be used on certain alert types to further target alerts to groups of customers.

### Use this endpoint to:

  • Proactively monitor customer spending patterns to prevent unexpected overages or credit exhaustion
  • Automate notifications when customers approach commitment limits or credit thresholds
  • Enable real-time intervention for accounts at risk of churn or payment issues
  • Scale billing operations by automating threshold-based workflows and notifications

### Key response fields:

A successful response returns a CustomerAlert object containing:

- The alert configuration with its unique ID and current status - The customer's evaluation status (ok, in_alarm, or evaluating) - Alert metadata including type, threshold values, and update timestamps

### Usage guidelines:

  • Immediate evaluation: Set `evaluate_on_create` : `true` (default) for instant evaluation against existing customers
  • Uniqueness constraints: Each alert must have a unique `uniqueness_key` within your organization. Use `release_uniqueness_key` : `true` when archiving to reuse keys
  • Alert type requirements: Different alert types require specific fields (e.g., `billable_metric_id` for usage alerts, `credit_type_id` for credit-based alerts)
  • Webhook delivery: Alerts trigger webhook notifications for real-time integration with your systems. Configure webhook endpoints before creating alerts
  • Performance at scale: Metronome's event-driven architecture processes alert evaluations in real-time as usage events stream in, unlike competitors who rely on periodic polling or batch evaluation cycles

type V1AuditLogListParams

type V1AuditLogListParams struct {
	// RFC 3339 timestamp (exclusive). Cannot be used with 'next_page'.
	EndingBefore param.Opt[time.Time] `query:"ending_before,omitzero" format:"date-time" json:"-"`
	// Max number of results that should be returned
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	// Optional parameter that can be used to filter which audit logs are returned. If
	// you specify resource_id, you must also specify resource_type.
	ResourceID param.Opt[string] `query:"resource_id,omitzero" json:"-"`
	// Optional parameter that can be used to filter which audit logs are returned. If
	// you specify resource_type, you must also specify resource_id.
	ResourceType param.Opt[string] `query:"resource_type,omitzero" json:"-"`
	// RFC 3339 timestamp of the earliest audit log to return. Cannot be used with
	// 'next_page'.
	StartingOn param.Opt[time.Time] `query:"starting_on,omitzero" format:"date-time" json:"-"`
	// Sort order by timestamp, e.g. date_asc or date_desc. Defaults to date_asc.
	//
	// Any of "date_asc", "date_desc".
	Sort V1AuditLogListParamsSort `query:"sort,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1AuditLogListParams) URLQuery

func (r V1AuditLogListParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1AuditLogListParams's query parameters as `url.Values`.

type V1AuditLogListParamsSort

type V1AuditLogListParamsSort string

Sort order by timestamp, e.g. date_asc or date_desc. Defaults to date_asc.

const (
	V1AuditLogListParamsSortDateAsc  V1AuditLogListParamsSort = "date_asc"
	V1AuditLogListParamsSortDateDesc V1AuditLogListParamsSort = "date_desc"
)

type V1AuditLogListResponse

type V1AuditLogListResponse struct {
	ID           string                        `json:"id,required"`
	Request      V1AuditLogListResponseRequest `json:"request,required"`
	Timestamp    time.Time                     `json:"timestamp,required" format:"date-time"`
	Action       string                        `json:"action"`
	Actor        V1AuditLogListResponseActor   `json:"actor"`
	Description  string                        `json:"description"`
	ResourceID   string                        `json:"resource_id"`
	ResourceType string                        `json:"resource_type"`
	// Any of "success", "failure", "pending".
	Status V1AuditLogListResponseStatus `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID           respjson.Field
		Request      respjson.Field
		Timestamp    respjson.Field
		Action       respjson.Field
		Actor        respjson.Field
		Description  respjson.Field
		ResourceID   respjson.Field
		ResourceType respjson.Field
		Status       respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1AuditLogListResponse) RawJSON added in v1.0.0

func (r V1AuditLogListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1AuditLogListResponse) UnmarshalJSON

func (r *V1AuditLogListResponse) UnmarshalJSON(data []byte) error

type V1AuditLogListResponseActor

type V1AuditLogListResponseActor struct {
	ID    string `json:"id,required"`
	Name  string `json:"name,required"`
	Email string `json:"email"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		Email       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1AuditLogListResponseActor) RawJSON added in v1.0.0

func (r V1AuditLogListResponseActor) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1AuditLogListResponseActor) UnmarshalJSON

func (r *V1AuditLogListResponseActor) UnmarshalJSON(data []byte) error

type V1AuditLogListResponseRequest

type V1AuditLogListResponseRequest struct {
	ID        string `json:"id,required"`
	IP        string `json:"ip"`
	UserAgent string `json:"user_agent"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		IP          respjson.Field
		UserAgent   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1AuditLogListResponseRequest) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1AuditLogListResponseRequest) UnmarshalJSON

func (r *V1AuditLogListResponseRequest) UnmarshalJSON(data []byte) error

type V1AuditLogListResponseStatus

type V1AuditLogListResponseStatus string
const (
	V1AuditLogListResponseStatusSuccess V1AuditLogListResponseStatus = "success"
	V1AuditLogListResponseStatusFailure V1AuditLogListResponseStatus = "failure"
	V1AuditLogListResponseStatusPending V1AuditLogListResponseStatus = "pending"
)

type V1AuditLogService

type V1AuditLogService struct {
	Options []option.RequestOption
}

V1AuditLogService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1AuditLogService method instead.

func NewV1AuditLogService

func NewV1AuditLogService(opts ...option.RequestOption) (r V1AuditLogService)

NewV1AuditLogService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1AuditLogService) List

Get a comprehensive audit trail of all operations performed in your Metronome account, whether initiated through the API, web interface, or automated processes. This endpoint provides detailed logs of who did what and when, enabling compliance reporting, security monitoring, and operational troubleshooting across all interaction channels.

### Use this endpoint to:

- Monitor all account activity for security and compliance purposes - Track configuration changes regardless of source (API, UI, or system) - Investigate issues by reviewing historical operations

### Key response fields:

An array of AuditLog objects containing:

  • id: Unique identifier for the audit log entry
  • timestamp: When the action occurred (RFC 3339 format)
  • actor: Information about who performed the action
  • request: Details including request ID, IP address, and user agent
  • `resource_type`: The type of resource affected (e.g., customer, contract, invoice)
  • `resource_id`: The specific resource identifier
  • `action`: The operation performed
  • `next_page`: Cursor for continuous log retrieval

### Usage guidelines:

  • Continuous retrieval: The next_page token enables uninterrupted log streaming—save it between requests to ensure no logs are missed
  • Empty responses: An empty data array means no new logs yet; continue polling with the same next_page token
  • Date filtering:
  • `starting_on`: Earliest logs to return (inclusive)
  • `ending_before`: Latest logs to return (exclusive)
  • Cannot be used with `next_page`
  • Resource filtering: Must specify both `resource_type` and `resource_id` together
  • Sort order: Default is `date_asc`; use `date_desc` for newest first

func (*V1AuditLogService) ListAutoPaging

Get a comprehensive audit trail of all operations performed in your Metronome account, whether initiated through the API, web interface, or automated processes. This endpoint provides detailed logs of who did what and when, enabling compliance reporting, security monitoring, and operational troubleshooting across all interaction channels.

### Use this endpoint to:

- Monitor all account activity for security and compliance purposes - Track configuration changes regardless of source (API, UI, or system) - Investigate issues by reviewing historical operations

### Key response fields:

An array of AuditLog objects containing:

  • id: Unique identifier for the audit log entry
  • timestamp: When the action occurred (RFC 3339 format)
  • actor: Information about who performed the action
  • request: Details including request ID, IP address, and user agent
  • `resource_type`: The type of resource affected (e.g., customer, contract, invoice)
  • `resource_id`: The specific resource identifier
  • `action`: The operation performed
  • `next_page`: Cursor for continuous log retrieval

### Usage guidelines:

  • Continuous retrieval: The next_page token enables uninterrupted log streaming—save it between requests to ensure no logs are missed
  • Empty responses: An empty data array means no new logs yet; continue polling with the same next_page token
  • Date filtering:
  • `starting_on`: Earliest logs to return (inclusive)
  • `ending_before`: Latest logs to return (exclusive)
  • Cannot be used with `next_page`
  • Resource filtering: Must specify both `resource_type` and `resource_id` together
  • Sort order: Default is `date_asc`; use `date_desc` for newest first

type V1BillableMetricArchiveParams

type V1BillableMetricArchiveParams struct {
	ID shared.IDParam
	// contains filtered or unexported fields
}

func (V1BillableMetricArchiveParams) MarshalJSON

func (r V1BillableMetricArchiveParams) MarshalJSON() (data []byte, err error)

func (*V1BillableMetricArchiveParams) UnmarshalJSON added in v1.0.0

func (r *V1BillableMetricArchiveParams) UnmarshalJSON(data []byte) error

type V1BillableMetricArchiveResponse

type V1BillableMetricArchiveResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1BillableMetricArchiveResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1BillableMetricArchiveResponse) UnmarshalJSON

func (r *V1BillableMetricArchiveResponse) UnmarshalJSON(data []byte) error

type V1BillableMetricGetParams

type V1BillableMetricGetParams struct {
	BillableMetricID string `path:"billable_metric_id,required" format:"uuid" json:"-"`
	// contains filtered or unexported fields
}

type V1BillableMetricGetResponse

type V1BillableMetricGetResponse struct {
	Data V1BillableMetricGetResponseData `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1BillableMetricGetResponse) RawJSON added in v1.0.0

func (r V1BillableMetricGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1BillableMetricGetResponse) UnmarshalJSON

func (r *V1BillableMetricGetResponse) UnmarshalJSON(data []byte) error

type V1BillableMetricGetResponseData

type V1BillableMetricGetResponseData struct {
	// ID of the billable metric
	ID string `json:"id,required" format:"uuid"`
	// The display name of the billable metric.
	Name string `json:"name,required"`
	// 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'.
	AggregationKey string `json:"aggregation_key"`
	// Specifies the type of aggregation performed on matching events.
	//
	// Any of "COUNT", "LATEST", "MAX", "SUM", "UNIQUE".
	AggregationType string `json:"aggregation_type"`
	// RFC 3339 timestamp indicating when the billable metric was archived. If not
	// provided, the billable metric is not archived.
	ArchivedAt time.Time `json:"archived_at" format:"date-time"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields"`
	// An optional filtering rule to match the 'event_type' property of an event.
	EventTypeFilter shared.EventTypeFilter `json:"event_type_filter"`
	// 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.
	GroupKeys [][]string `json:"group_keys"`
	// 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.
	PropertyFilters []shared.PropertyFilter `json:"property_filters"`
	// The SQL query associated with the billable metric
	Sql string `json:"sql"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID              respjson.Field
		Name            respjson.Field
		AggregationKey  respjson.Field
		AggregationType respjson.Field
		ArchivedAt      respjson.Field
		CustomFields    respjson.Field
		EventTypeFilter respjson.Field
		GroupKeys       respjson.Field
		PropertyFilters respjson.Field
		Sql             respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1BillableMetricGetResponseData) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1BillableMetricGetResponseData) UnmarshalJSON

func (r *V1BillableMetricGetResponseData) UnmarshalJSON(data []byte) error

type V1BillableMetricListParams

type V1BillableMetricListParams struct {
	// If true, the list of returned metrics will include archived metrics
	IncludeArchived param.Opt[bool] `query:"include_archived,omitzero" json:"-"`
	// Max number of results that should be returned
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1BillableMetricListParams) URLQuery

func (r V1BillableMetricListParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1BillableMetricListParams's query parameters as `url.Values`.

type V1BillableMetricListResponse

type V1BillableMetricListResponse struct {
	// ID of the billable metric
	ID string `json:"id,required" format:"uuid"`
	// The display name of the billable metric.
	Name string `json:"name,required"`
	// 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'.
	AggregationKey string `json:"aggregation_key"`
	// Specifies the type of aggregation performed on matching events.
	//
	// Any of "COUNT", "LATEST", "MAX", "SUM", "UNIQUE".
	AggregationType V1BillableMetricListResponseAggregationType `json:"aggregation_type"`
	// RFC 3339 timestamp indicating when the billable metric was archived. If not
	// provided, the billable metric is not archived.
	ArchivedAt time.Time `json:"archived_at" format:"date-time"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields"`
	// An optional filtering rule to match the 'event_type' property of an event.
	EventTypeFilter shared.EventTypeFilter `json:"event_type_filter"`
	// 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.
	GroupKeys [][]string `json:"group_keys"`
	// 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.
	PropertyFilters []shared.PropertyFilter `json:"property_filters"`
	// The SQL query associated with the billable metric
	Sql string `json:"sql"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID              respjson.Field
		Name            respjson.Field
		AggregationKey  respjson.Field
		AggregationType respjson.Field
		ArchivedAt      respjson.Field
		CustomFields    respjson.Field
		EventTypeFilter respjson.Field
		GroupKeys       respjson.Field
		PropertyFilters respjson.Field
		Sql             respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1BillableMetricListResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1BillableMetricListResponse) UnmarshalJSON

func (r *V1BillableMetricListResponse) UnmarshalJSON(data []byte) error

type V1BillableMetricListResponseAggregationType

type V1BillableMetricListResponseAggregationType string

Specifies the type of aggregation performed on matching events.

const (
	V1BillableMetricListResponseAggregationTypeCount  V1BillableMetricListResponseAggregationType = "COUNT"
	V1BillableMetricListResponseAggregationTypeLatest V1BillableMetricListResponseAggregationType = "LATEST"
	V1BillableMetricListResponseAggregationTypeMax    V1BillableMetricListResponseAggregationType = "MAX"
	V1BillableMetricListResponseAggregationTypeSum    V1BillableMetricListResponseAggregationType = "SUM"
	V1BillableMetricListResponseAggregationTypeUnique V1BillableMetricListResponseAggregationType = "UNIQUE"
)

type V1BillableMetricNewParams

type V1BillableMetricNewParams struct {
	// The display name of the billable metric.
	Name string `json:"name,required"`
	// Specifies the type of aggregation performed on matching events. Required if
	// `sql` is not provided.
	AggregationKey param.Opt[string] `json:"aggregation_key,omitzero"`
	// The SQL query associated with the billable metric. This field is mutually
	// exclusive with aggregation_type, event_type_filter, property_filters,
	// aggregation_key, and group_keys. If provided, these other fields must be
	// omitted.
	Sql param.Opt[string] `json:"sql,omitzero"`
	// Specifies the type of aggregation performed on matching events.
	//
	// Any of "COUNT", "LATEST", "MAX", "SUM", "UNIQUE".
	AggregationType V1BillableMetricNewParamsAggregationType `json:"aggregation_type,omitzero"`
	// Custom fields to attach to the billable metric.
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// An optional filtering rule to match the 'event_type' property of an event.
	EventTypeFilter shared.EventTypeFilterParam `json:"event_type_filter,omitzero"`
	// 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.
	GroupKeys [][]string `json:"group_keys,omitzero"`
	// 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.
	PropertyFilters []shared.PropertyFilterParam `json:"property_filters,omitzero"`
	// contains filtered or unexported fields
}

func (V1BillableMetricNewParams) MarshalJSON

func (r V1BillableMetricNewParams) MarshalJSON() (data []byte, err error)

func (*V1BillableMetricNewParams) UnmarshalJSON added in v1.0.0

func (r *V1BillableMetricNewParams) UnmarshalJSON(data []byte) error

type V1BillableMetricNewParamsAggregationType

type V1BillableMetricNewParamsAggregationType string

Specifies the type of aggregation performed on matching events.

const (
	V1BillableMetricNewParamsAggregationTypeCount  V1BillableMetricNewParamsAggregationType = "COUNT"
	V1BillableMetricNewParamsAggregationTypeLatest V1BillableMetricNewParamsAggregationType = "LATEST"
	V1BillableMetricNewParamsAggregationTypeMax    V1BillableMetricNewParamsAggregationType = "MAX"
	V1BillableMetricNewParamsAggregationTypeSum    V1BillableMetricNewParamsAggregationType = "SUM"
	V1BillableMetricNewParamsAggregationTypeUnique V1BillableMetricNewParamsAggregationType = "UNIQUE"
)

type V1BillableMetricNewResponse

type V1BillableMetricNewResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1BillableMetricNewResponse) RawJSON added in v1.0.0

func (r V1BillableMetricNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1BillableMetricNewResponse) UnmarshalJSON

func (r *V1BillableMetricNewResponse) UnmarshalJSON(data []byte) error

type V1BillableMetricService

type V1BillableMetricService struct {
	Options []option.RequestOption
}

V1BillableMetricService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1BillableMetricService method instead.

func NewV1BillableMetricService

func NewV1BillableMetricService(opts ...option.RequestOption) (r V1BillableMetricService)

NewV1BillableMetricService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1BillableMetricService) Archive

Use this endpoint to retire billable metrics that are no longer used. After a billable metric is archived, that billable metric can no longer be used in any new Products to define how that product should be metered. If you archive a billable metric that is already associated with a Product, the Product will continue to function as usual, metering based on the definition of the archived billable metric.

Archived billable metrics will be returned on the `getBillableMetric` and `listBillableMetrics` endpoints with a populated `archived_at` field.

func (*V1BillableMetricService) Get

Retrieves the complete configuration for a specific billable metric by its ID. Use this to review billable metric setup before associating it with products. Returns the metric's `name`, `event_type_filter`, `property_filters`, `aggregation_type`, `aggregation_key`, `group_keys`, `custom fields`, and `SQL query` (if it's a SQL billable metric).

Important:

  • Archived billable metrics will include an `archived_at` timestamp; they no longer process new usage events but remain accessible for historical reference.

func (*V1BillableMetricService) List

Retrieves all billable metrics with their complete configurations. Use this for programmatic discovery and management of billable metrics, such as associating metrics to products and auditing for orphaned or archived metrics. Important: Archived metrics are excluded by default; use `include_archived`=`true` parameter to include them.

func (*V1BillableMetricService) ListAutoPaging

Retrieves all billable metrics with their complete configurations. Use this for programmatic discovery and management of billable metrics, such as associating metrics to products and auditing for orphaned or archived metrics. Important: Archived metrics are excluded by default; use `include_archived`=`true` parameter to include them.

func (*V1BillableMetricService) New

Create billable metrics programmatically with this endpoint—an essential step in configuring your pricing and packaging in Metronome.

A billable metric is a customizable query that filters and aggregates events from your event stream. These metrics are continuously tracked as usage data enters Metronome through the ingestion pipeline. The ingestion process transforms raw usage data into actionable pricing metrics, enabling accurate metering and billing for your products.

### Use this endpoint to:

  • Create individual or multiple billable metrics as part of a setup workflow.
  • Automate the entire pricing configuration process, from metric creation to customer contract setup.
  • Define metrics using either standard filtering/aggregation or a custom SQL query.

### Key response fields:

  • The ID of the billable metric that was created
  • The created billable metric will be available to be used in Products, usage endpoints, and alerts.

### Usage guidelines:

  • Metrics defined using standard filtering and aggregation are Streaming billable metrics, which have been optimized for ultra low latency and high throughput workflows.
  • Use SQL billable metrics if you require more flexible aggregation options.

type V1ContractAddManualBalanceEntryParams

type V1ContractAddManualBalanceEntryParams struct {
	// ID of the balance (commit or credit) to update.
	ID string `json:"id,required" format:"uuid"`
	// Amount to add to the segment. A negative number will draw down from the balance.
	Amount float64 `json:"amount,required"`
	// ID of the customer whose balance is to be updated.
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// Reason for the manual adjustment. This will be displayed in the ledger.
	Reason string `json:"reason,required"`
	// ID of the segment to update.
	SegmentID string `json:"segment_id,required" format:"uuid"`
	// ID of the contract to update. Leave blank to update a customer level balance.
	ContractID param.Opt[string] `json:"contract_id,omitzero" format:"uuid"`
	// RFC 3339 timestamp indicating when the manual adjustment takes place. If not
	// provided, it will default to the start of the segment.
	Timestamp param.Opt[time.Time] `json:"timestamp,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

func (V1ContractAddManualBalanceEntryParams) MarshalJSON

func (r V1ContractAddManualBalanceEntryParams) MarshalJSON() (data []byte, err error)

func (*V1ContractAddManualBalanceEntryParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractAddManualBalanceEntryParams) UnmarshalJSON(data []byte) error

type V1ContractAmendParams

type V1ContractAmendParams struct {
	// ID of the contract to amend
	ContractID string `json:"contract_id,required" format:"uuid"`
	// ID of the customer whose contract is to be amended
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// inclusive start time for the amendment
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Opt[string] `json:"netsuite_sales_order_id,omitzero"`
	// This field's availability is dependent on your client's configuration.
	SalesforceOpportunityID param.Opt[string] `json:"salesforce_opportunity_id,omitzero"`
	// This field's availability is dependent on your client's configuration.
	TotalContractValue param.Opt[float64]            `json:"total_contract_value,omitzero"`
	Commits            []V1ContractAmendParamsCommit `json:"commits,omitzero"`
	Credits            []V1ContractAmendParamsCredit `json:"credits,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// This field's availability is dependent on your client's configuration.
	Discounts         []V1ContractAmendParamsDiscount `json:"discounts,omitzero"`
	ContractOverrides []V1ContractAmendParamsOverride `json:"overrides,omitzero"`
	// This field's availability is dependent on your client's configuration.
	ProfessionalServices []V1ContractAmendParamsProfessionalService `json:"professional_services,omitzero"`
	// This field's availability is dependent on your client's configuration.
	ResellerRoyalties []V1ContractAmendParamsResellerRoyalty `json:"reseller_royalties,omitzero"`
	ScheduledCharges  []V1ContractAmendParamsScheduledCharge `json:"scheduled_charges,omitzero"`
	// contains filtered or unexported fields
}

func (V1ContractAmendParams) MarshalJSON

func (r V1ContractAmendParams) MarshalJSON() (data []byte, err error)

func (*V1ContractAmendParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractAmendParams) UnmarshalJSON(data []byte) error

type V1ContractAmendParamsCommit

type V1ContractAmendParamsCommit struct {
	ProductID string `json:"product_id,required" format:"uuid"`
	// Any of "PREPAID", "POSTPAID".
	Type string `json:"type,omitzero,required"`
	// (DEPRECATED) Use access_schedule and invoice_schedule instead.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// Used only in UI/API. It is not exposed to end customers.
	Description param.Opt[string] `json:"description,omitzero"`
	// displayed on invoices
	Name param.Opt[string] `json:"name,omitzero"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Opt[string] `json:"netsuite_sales_order_id,omitzero"`
	// If multiple commits are applicable, the one with the lower priority will apply
	// first.
	Priority param.Opt[float64] `json:"priority,omitzero"`
	// Fraction of unused segments that will be rolled over. Must be between 0 and 1.
	RolloverFraction param.Opt[float64] `json:"rollover_fraction,omitzero"`
	// A temporary ID for the commit that can be used to reference the commit for
	// commit specific overrides.
	TemporaryID param.Opt[string] `json:"temporary_id,omitzero"`
	// Required: Schedule for distributing the commit to the customer. For "POSTPAID"
	// commits only one schedule item is allowed and amount must match invoice_schedule
	// total.
	AccessSchedule V1ContractAmendParamsCommitAccessSchedule `json:"access_schedule,omitzero"`
	// Which products the commit applies to. If applicable_product_ids,
	// applicable_product_tags or specifiers are not provided, the commit applies to
	// all products.
	ApplicableProductIDs []string `json:"applicable_product_ids,omitzero" format:"uuid"`
	// Which tags the commit applies to. If applicable_product_ids,
	// applicable_product_tags or specifiers are not provided, the commit applies to
	// all products.
	ApplicableProductTags []string `json:"applicable_product_tags,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// Optional configuration for commit hierarchy access control
	HierarchyConfiguration shared.CommitHierarchyConfigurationParam `json:"hierarchy_configuration,omitzero"`
	// Required for "POSTPAID" commits: the true up invoice will be generated at this
	// time and only one schedule item is allowed; the total must match access_schedule
	// amount. Optional for "PREPAID" commits: if not provided, this will be a
	// "complimentary" commit with no invoice.
	InvoiceSchedule V1ContractAmendParamsCommitInvoiceSchedule `json:"invoice_schedule,omitzero"`
	// optionally payment gate this commit
	PaymentGateConfig V1ContractAmendParamsCommitPaymentGateConfig `json:"payment_gate_config,omitzero"`
	// Any of "COMMIT_RATE", "LIST_RATE".
	RateType string `json:"rate_type,omitzero"`
	// List of filters that determine what kind of customer usage draws down a commit
	// or credit. A customer's usage needs to meet the condition of at least one of the
	// specifiers to contribute to a commit's or credit's drawdown. This field cannot
	// be used together with `applicable_product_ids` or `applicable_product_tags`.
	Specifiers []shared.CommitSpecifierInputParam `json:"specifiers,omitzero"`
	// contains filtered or unexported fields
}

The properties ProductID, Type are required.

func (V1ContractAmendParamsCommit) MarshalJSON

func (r V1ContractAmendParamsCommit) MarshalJSON() (data []byte, err error)

func (*V1ContractAmendParamsCommit) UnmarshalJSON added in v1.0.0

func (r *V1ContractAmendParamsCommit) UnmarshalJSON(data []byte) error

type V1ContractAmendParamsCommitAccessSchedule added in v1.0.0

type V1ContractAmendParamsCommitAccessSchedule struct {
	ScheduleItems []V1ContractAmendParamsCommitAccessScheduleScheduleItem `json:"schedule_items,omitzero,required"`
	// Defaults to USD (cents) if not passed
	CreditTypeID param.Opt[string] `json:"credit_type_id,omitzero" format:"uuid"`
	// contains filtered or unexported fields
}

Required: Schedule for distributing the commit to the customer. For "POSTPAID" commits only one schedule item is allowed and amount must match invoice_schedule total.

The property ScheduleItems is required.

func (V1ContractAmendParamsCommitAccessSchedule) MarshalJSON added in v1.0.0

func (r V1ContractAmendParamsCommitAccessSchedule) MarshalJSON() (data []byte, err error)

func (*V1ContractAmendParamsCommitAccessSchedule) UnmarshalJSON added in v1.0.0

func (r *V1ContractAmendParamsCommitAccessSchedule) UnmarshalJSON(data []byte) error

type V1ContractAmendParamsCommitAccessScheduleScheduleItem added in v1.0.0

type V1ContractAmendParamsCommitAccessScheduleScheduleItem struct {
	Amount float64 `json:"amount,required"`
	// RFC 3339 timestamp (exclusive)
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	// RFC 3339 timestamp (inclusive)
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// contains filtered or unexported fields
}

The properties Amount, EndingBefore, StartingAt are required.

func (V1ContractAmendParamsCommitAccessScheduleScheduleItem) MarshalJSON added in v1.0.0

func (*V1ContractAmendParamsCommitAccessScheduleScheduleItem) UnmarshalJSON added in v1.0.0

type V1ContractAmendParamsCommitInvoiceSchedule added in v1.0.0

type V1ContractAmendParamsCommitInvoiceSchedule struct {
	// Defaults to USD (cents) if not passed.
	CreditTypeID param.Opt[string] `json:"credit_type_id,omitzero" format:"uuid"`
	// This field is only applicable to commit invoice schedules. If true, this
	// schedule will not generate an invoice.
	DoNotInvoice param.Opt[bool] `json:"do_not_invoice,omitzero"`
	// Enter the unit price and quantity for the charge or instead only send the
	// amount. If amount is sent, the unit price is assumed to be the amount and
	// quantity is inferred to be 1.
	RecurringSchedule V1ContractAmendParamsCommitInvoiceScheduleRecurringSchedule `json:"recurring_schedule,omitzero"`
	// Either provide amount or provide both unit_price and quantity.
	ScheduleItems []V1ContractAmendParamsCommitInvoiceScheduleScheduleItem `json:"schedule_items,omitzero"`
	// contains filtered or unexported fields
}

Required for "POSTPAID" commits: the true up invoice will be generated at this time and only one schedule item is allowed; the total must match access_schedule amount. Optional for "PREPAID" commits: if not provided, this will be a "complimentary" commit with no invoice.

func (V1ContractAmendParamsCommitInvoiceSchedule) MarshalJSON added in v1.0.0

func (r V1ContractAmendParamsCommitInvoiceSchedule) MarshalJSON() (data []byte, err error)

func (*V1ContractAmendParamsCommitInvoiceSchedule) UnmarshalJSON added in v1.0.0

func (r *V1ContractAmendParamsCommitInvoiceSchedule) UnmarshalJSON(data []byte) error

type V1ContractAmendParamsCommitInvoiceScheduleRecurringSchedule added in v1.0.0

type V1ContractAmendParamsCommitInvoiceScheduleRecurringSchedule struct {
	// Any of "DIVIDED", "DIVIDED_ROUNDED", "EACH".
	AmountDistribution string `json:"amount_distribution,omitzero,required"`
	// RFC 3339 timestamp (exclusive).
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	// Any of "MONTHLY", "QUARTERLY", "SEMI_ANNUAL", "ANNUAL".
	Frequency string `json:"frequency,omitzero,required"`
	// RFC 3339 timestamp (inclusive).
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// Amount for the charge. Can be provided instead of unit_price and quantity. If
	// amount is sent, the unit_price is assumed to be the amount and quantity is
	// inferred to be 1.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount and must be specified with unit_price. If specified amount cannot be
	// provided.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified with quantity. If specified amount cannot be
	// provided.
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

Enter the unit price and quantity for the charge or instead only send the amount. If amount is sent, the unit price is assumed to be the amount and quantity is inferred to be 1.

The properties AmountDistribution, EndingBefore, Frequency, StartingAt are required.

func (V1ContractAmendParamsCommitInvoiceScheduleRecurringSchedule) MarshalJSON added in v1.0.0

func (*V1ContractAmendParamsCommitInvoiceScheduleRecurringSchedule) UnmarshalJSON added in v1.0.0

type V1ContractAmendParamsCommitInvoiceScheduleScheduleItem added in v1.0.0

type V1ContractAmendParamsCommitInvoiceScheduleScheduleItem struct {
	// timestamp of the scheduled event
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// Amount for the charge. Can be provided instead of unit_price and quantity. If
	// amount is sent, the unit_price is assumed to be the amount and quantity is
	// inferred to be 1.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount and must be specified with unit_price. If specified amount cannot be
	// provided.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified with quantity. If specified amount cannot be
	// provided.
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

The property Timestamp is required.

func (V1ContractAmendParamsCommitInvoiceScheduleScheduleItem) MarshalJSON added in v1.0.0

func (*V1ContractAmendParamsCommitInvoiceScheduleScheduleItem) UnmarshalJSON added in v1.0.0

type V1ContractAmendParamsCommitPaymentGateConfig added in v1.0.0

type V1ContractAmendParamsCommitPaymentGateConfig struct {
	// Gate access to the commit balance based on successful collection of payment.
	// Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
	// facilitate payment using your own payment integration. Select NONE if you do not
	// wish to payment gate the commit balance.
	//
	// Any of "NONE", "STRIPE", "EXTERNAL".
	PaymentGateType string `json:"payment_gate_type,omitzero,required"`
	// Only applicable if using PRECALCULATED as your tax type.
	PrecalculatedTaxConfig V1ContractAmendParamsCommitPaymentGateConfigPrecalculatedTaxConfig `json:"precalculated_tax_config,omitzero"`
	// Only applicable if using STRIPE as your payment gate type.
	StripeConfig V1ContractAmendParamsCommitPaymentGateConfigStripeConfig `json:"stripe_config,omitzero"`
	// Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
	// not wish Metronome to calculate tax on your behalf. Leaving this field blank
	// will default to NONE.
	//
	// Any of "NONE", "STRIPE", "ANROK", "PRECALCULATED".
	TaxType string `json:"tax_type,omitzero"`
	// contains filtered or unexported fields
}

optionally payment gate this commit

The property PaymentGateType is required.

func (V1ContractAmendParamsCommitPaymentGateConfig) MarshalJSON added in v1.0.0

func (r V1ContractAmendParamsCommitPaymentGateConfig) MarshalJSON() (data []byte, err error)

func (*V1ContractAmendParamsCommitPaymentGateConfig) UnmarshalJSON added in v1.0.0

func (r *V1ContractAmendParamsCommitPaymentGateConfig) UnmarshalJSON(data []byte) error

type V1ContractAmendParamsCommitPaymentGateConfigPrecalculatedTaxConfig added in v1.0.0

type V1ContractAmendParamsCommitPaymentGateConfigPrecalculatedTaxConfig struct {
	// Amount of tax to be applied. This should be in the same currency and
	// denomination as the commit's invoice schedule
	TaxAmount float64 `json:"tax_amount,required"`
	// Name of the tax to be applied. This may be used in an invoice line item
	// description.
	TaxName param.Opt[string] `json:"tax_name,omitzero"`
	// contains filtered or unexported fields
}

Only applicable if using PRECALCULATED as your tax type.

The property TaxAmount is required.

func (V1ContractAmendParamsCommitPaymentGateConfigPrecalculatedTaxConfig) MarshalJSON added in v1.0.0

func (*V1ContractAmendParamsCommitPaymentGateConfigPrecalculatedTaxConfig) UnmarshalJSON added in v1.0.0

type V1ContractAmendParamsCommitPaymentGateConfigStripeConfig added in v1.0.0

type V1ContractAmendParamsCommitPaymentGateConfigStripeConfig struct {
	// If left blank, will default to INVOICE
	//
	// Any of "INVOICE", "PAYMENT_INTENT".
	PaymentType string `json:"payment_type,omitzero,required"`
	// If true, the payment will be made assuming the customer is present (i.e. on
	// session).
	//
	// If false, the payment will be made assuming the customer is not present (i.e.
	// off session). For cardholders from a country with an e-mandate requirement (e.g.
	// India), the payment may be declined.
	//
	// If left blank, will default to false.
	OnSessionPayment param.Opt[bool] `json:"on_session_payment,omitzero"`
	// Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
	// your payment type.
	InvoiceMetadata map[string]string `json:"invoice_metadata,omitzero"`
	// contains filtered or unexported fields
}

Only applicable if using STRIPE as your payment gate type.

The property PaymentType is required.

func (V1ContractAmendParamsCommitPaymentGateConfigStripeConfig) MarshalJSON added in v1.0.0

func (*V1ContractAmendParamsCommitPaymentGateConfigStripeConfig) UnmarshalJSON added in v1.0.0

type V1ContractAmendParamsCredit

type V1ContractAmendParamsCredit struct {
	// Schedule for distributing the credit to the customer.
	AccessSchedule V1ContractAmendParamsCreditAccessSchedule `json:"access_schedule,omitzero,required"`
	ProductID      string                                    `json:"product_id,required" format:"uuid"`
	// Used only in UI/API. It is not exposed to end customers.
	Description param.Opt[string] `json:"description,omitzero"`
	// displayed on invoices
	Name param.Opt[string] `json:"name,omitzero"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Opt[string] `json:"netsuite_sales_order_id,omitzero"`
	// If multiple credits are applicable, the one with the lower priority will apply
	// first.
	Priority param.Opt[float64] `json:"priority,omitzero"`
	// Which products the credit applies to. If both applicable_product_ids and
	// applicable_product_tags are not provided, the credit applies to all products.
	ApplicableProductIDs []string `json:"applicable_product_ids,omitzero" format:"uuid"`
	// Which tags the credit applies to. If both applicable_product_ids and
	// applicable_product_tags are not provided, the credit applies to all products.
	ApplicableProductTags []string `json:"applicable_product_tags,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// Optional configuration for credit hierarchy access control
	HierarchyConfiguration shared.CommitHierarchyConfigurationParam `json:"hierarchy_configuration,omitzero"`
	// Any of "COMMIT_RATE", "LIST_RATE".
	RateType string `json:"rate_type,omitzero"`
	// List of filters that determine what kind of customer usage draws down a commit
	// or credit. A customer's usage needs to meet the condition of at least one of the
	// specifiers to contribute to a commit's or credit's drawdown. This field cannot
	// be used together with `applicable_product_ids` or `applicable_product_tags`.
	Specifiers []shared.CommitSpecifierInputParam `json:"specifiers,omitzero"`
	// contains filtered or unexported fields
}

The properties AccessSchedule, ProductID are required.

func (V1ContractAmendParamsCredit) MarshalJSON

func (r V1ContractAmendParamsCredit) MarshalJSON() (data []byte, err error)

func (*V1ContractAmendParamsCredit) UnmarshalJSON added in v1.0.0

func (r *V1ContractAmendParamsCredit) UnmarshalJSON(data []byte) error

type V1ContractAmendParamsCreditAccessSchedule added in v1.0.0

type V1ContractAmendParamsCreditAccessSchedule struct {
	ScheduleItems []V1ContractAmendParamsCreditAccessScheduleScheduleItem `json:"schedule_items,omitzero,required"`
	// Defaults to USD (cents) if not passed
	CreditTypeID param.Opt[string] `json:"credit_type_id,omitzero" format:"uuid"`
	// contains filtered or unexported fields
}

Schedule for distributing the credit to the customer.

The property ScheduleItems is required.

func (V1ContractAmendParamsCreditAccessSchedule) MarshalJSON added in v1.0.0

func (r V1ContractAmendParamsCreditAccessSchedule) MarshalJSON() (data []byte, err error)

func (*V1ContractAmendParamsCreditAccessSchedule) UnmarshalJSON added in v1.0.0

func (r *V1ContractAmendParamsCreditAccessSchedule) UnmarshalJSON(data []byte) error

type V1ContractAmendParamsCreditAccessScheduleScheduleItem added in v1.0.0

type V1ContractAmendParamsCreditAccessScheduleScheduleItem struct {
	Amount float64 `json:"amount,required"`
	// RFC 3339 timestamp (exclusive)
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	// RFC 3339 timestamp (inclusive)
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// contains filtered or unexported fields
}

The properties Amount, EndingBefore, StartingAt are required.

func (V1ContractAmendParamsCreditAccessScheduleScheduleItem) MarshalJSON added in v1.0.0

func (*V1ContractAmendParamsCreditAccessScheduleScheduleItem) UnmarshalJSON added in v1.0.0

type V1ContractAmendParamsDiscount

type V1ContractAmendParamsDiscount struct {
	ProductID string `json:"product_id,required" format:"uuid"`
	// Must provide either schedule_items or recurring_schedule.
	Schedule V1ContractAmendParamsDiscountSchedule `json:"schedule,omitzero,required"`
	// displayed on invoices
	Name param.Opt[string] `json:"name,omitzero"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Opt[string] `json:"netsuite_sales_order_id,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// contains filtered or unexported fields
}

The properties ProductID, Schedule are required.

func (V1ContractAmendParamsDiscount) MarshalJSON

func (r V1ContractAmendParamsDiscount) MarshalJSON() (data []byte, err error)

func (*V1ContractAmendParamsDiscount) UnmarshalJSON added in v1.0.0

func (r *V1ContractAmendParamsDiscount) UnmarshalJSON(data []byte) error

type V1ContractAmendParamsDiscountSchedule added in v1.0.0

type V1ContractAmendParamsDiscountSchedule struct {
	// Defaults to USD (cents) if not passed.
	CreditTypeID param.Opt[string] `json:"credit_type_id,omitzero" format:"uuid"`
	// This field is only applicable to commit invoice schedules. If true, this
	// schedule will not generate an invoice.
	DoNotInvoice param.Opt[bool] `json:"do_not_invoice,omitzero"`
	// Enter the unit price and quantity for the charge or instead only send the
	// amount. If amount is sent, the unit price is assumed to be the amount and
	// quantity is inferred to be 1.
	RecurringSchedule V1ContractAmendParamsDiscountScheduleRecurringSchedule `json:"recurring_schedule,omitzero"`
	// Either provide amount or provide both unit_price and quantity.
	ScheduleItems []V1ContractAmendParamsDiscountScheduleScheduleItem `json:"schedule_items,omitzero"`
	// contains filtered or unexported fields
}

Must provide either schedule_items or recurring_schedule.

func (V1ContractAmendParamsDiscountSchedule) MarshalJSON added in v1.0.0

func (r V1ContractAmendParamsDiscountSchedule) MarshalJSON() (data []byte, err error)

func (*V1ContractAmendParamsDiscountSchedule) UnmarshalJSON added in v1.0.0

func (r *V1ContractAmendParamsDiscountSchedule) UnmarshalJSON(data []byte) error

type V1ContractAmendParamsDiscountScheduleRecurringSchedule added in v1.0.0

type V1ContractAmendParamsDiscountScheduleRecurringSchedule struct {
	// Any of "DIVIDED", "DIVIDED_ROUNDED", "EACH".
	AmountDistribution string `json:"amount_distribution,omitzero,required"`
	// RFC 3339 timestamp (exclusive).
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	// Any of "MONTHLY", "QUARTERLY", "SEMI_ANNUAL", "ANNUAL".
	Frequency string `json:"frequency,omitzero,required"`
	// RFC 3339 timestamp (inclusive).
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// Amount for the charge. Can be provided instead of unit_price and quantity. If
	// amount is sent, the unit_price is assumed to be the amount and quantity is
	// inferred to be 1.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount and must be specified with unit_price. If specified amount cannot be
	// provided.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified with quantity. If specified amount cannot be
	// provided.
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

Enter the unit price and quantity for the charge or instead only send the amount. If amount is sent, the unit price is assumed to be the amount and quantity is inferred to be 1.

The properties AmountDistribution, EndingBefore, Frequency, StartingAt are required.

func (V1ContractAmendParamsDiscountScheduleRecurringSchedule) MarshalJSON added in v1.0.0

func (*V1ContractAmendParamsDiscountScheduleRecurringSchedule) UnmarshalJSON added in v1.0.0

type V1ContractAmendParamsDiscountScheduleScheduleItem added in v1.0.0

type V1ContractAmendParamsDiscountScheduleScheduleItem struct {
	// timestamp of the scheduled event
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// Amount for the charge. Can be provided instead of unit_price and quantity. If
	// amount is sent, the unit_price is assumed to be the amount and quantity is
	// inferred to be 1.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount and must be specified with unit_price. If specified amount cannot be
	// provided.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified with quantity. If specified amount cannot be
	// provided.
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

The property Timestamp is required.

func (V1ContractAmendParamsDiscountScheduleScheduleItem) MarshalJSON added in v1.0.0

func (r V1ContractAmendParamsDiscountScheduleScheduleItem) MarshalJSON() (data []byte, err error)

func (*V1ContractAmendParamsDiscountScheduleScheduleItem) UnmarshalJSON added in v1.0.0

type V1ContractAmendParamsOverride

type V1ContractAmendParamsOverride struct {
	// RFC 3339 timestamp indicating when the override will start applying (inclusive)
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// RFC 3339 timestamp indicating when the override will stop applying (exclusive)
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	Entitled     param.Opt[bool]      `json:"entitled,omitzero"`
	// Indicates whether the override should only apply to commits. Defaults to
	// `false`. If `true`, you can specify relevant commits in `override_specifiers` by
	// passing `commit_ids`. if you do not specify `commit_ids`, then the override will
	// apply when consuming any prepaid or postpaid commit.
	IsCommitSpecific param.Opt[bool] `json:"is_commit_specific,omitzero"`
	// Required for MULTIPLIER type. Must be >=0.
	Multiplier param.Opt[float64] `json:"multiplier,omitzero"`
	// Required for EXPLICIT multiplier prioritization scheme and all TIERED overrides.
	// Under EXPLICIT prioritization, overwrites are prioritized first, and then tiered
	// and multiplier overrides are prioritized by their priority value (lowest first).
	// Must be > 0.
	Priority param.Opt[float64] `json:"priority,omitzero"`
	// ID of the product whose rate is being overridden. Cannot be used in conjunction
	// with override_specifiers.
	ProductID param.Opt[string] `json:"product_id,omitzero" format:"uuid"`
	// tags identifying products whose rates are being overridden. Cannot be used in
	// conjunction with override_specifiers.
	ApplicableProductTags []string `json:"applicable_product_tags,omitzero"`
	// Cannot be used in conjunction with product_id or applicable_product_tags. If
	// provided, the override will apply to all products with the specified specifiers.
	OverrideSpecifiers []V1ContractAmendParamsOverrideOverrideSpecifier `json:"override_specifiers,omitzero"`
	// Required for OVERWRITE type.
	OverwriteRate V1ContractAmendParamsOverrideOverwriteRate `json:"overwrite_rate,omitzero"`
	// Indicates whether the override applies to commit rates or list rates. Can only
	// be used for overrides that have `is_commit_specific` set to `true`. Defaults to
	// `"LIST_RATE"`.
	//
	// Any of "COMMIT_RATE", "LIST_RATE".
	Target string `json:"target,omitzero"`
	// Required for TIERED type. Must have at least one tier.
	Tiers []V1ContractAmendParamsOverrideTier `json:"tiers,omitzero"`
	// Overwrites are prioritized over multipliers and tiered overrides.
	//
	// Any of "OVERWRITE", "MULTIPLIER", "TIERED".
	Type string `json:"type,omitzero"`
	// contains filtered or unexported fields
}

The property StartingAt is required.

func (V1ContractAmendParamsOverride) MarshalJSON

func (r V1ContractAmendParamsOverride) MarshalJSON() (data []byte, err error)

func (*V1ContractAmendParamsOverride) UnmarshalJSON added in v1.0.0

func (r *V1ContractAmendParamsOverride) UnmarshalJSON(data []byte) error

type V1ContractAmendParamsOverrideOverrideSpecifier added in v1.0.0

type V1ContractAmendParamsOverrideOverrideSpecifier struct {
	// If provided, the override will only apply to the product with the specified ID.
	ProductID param.Opt[string] `json:"product_id,omitzero" format:"uuid"`
	// Any of "MONTHLY", "QUARTERLY", "ANNUAL", "WEEKLY".
	BillingFrequency string `json:"billing_frequency,omitzero"`
	// Can only be used for commit specific overrides. Must be used in conjunction with
	// one of `product_id`, `product_tags`, `pricing_group_values`, or
	// `presentation_group_values`. If provided, the override will only apply to the
	// specified commits. If not provided, the override will apply to all commits.
	CommitIDs []string `json:"commit_ids,omitzero"`
	// A map of group names to values. The override will only apply to line items with
	// the specified presentation group values.
	PresentationGroupValues map[string]string `json:"presentation_group_values,omitzero"`
	// A map of pricing group names to values. The override will only apply to products
	// with the specified pricing group values.
	PricingGroupValues map[string]string `json:"pricing_group_values,omitzero"`
	// If provided, the override will only apply to products with all the specified
	// tags.
	ProductTags []string `json:"product_tags,omitzero"`
	// Can only be used for commit specific overrides. Must be used in conjunction with
	// one of `product_id`, `product_tags`, `pricing_group_values`, or
	// `presentation_group_values`. If provided, the override will only apply to
	// commits created by the specified recurring commit ids.
	RecurringCommitIDs []string `json:"recurring_commit_ids,omitzero"`
	// Can only be used for commit specific overrides. Must be used in conjunction with
	// one of `product_id`, `product_tags`, `pricing_group_values`, or
	// `presentation_group_values`. If provided, the override will only apply to
	// credits created by the specified recurring credit ids.
	RecurringCreditIDs []string `json:"recurring_credit_ids,omitzero"`
	// contains filtered or unexported fields
}

func (V1ContractAmendParamsOverrideOverrideSpecifier) MarshalJSON added in v1.0.0

func (r V1ContractAmendParamsOverrideOverrideSpecifier) MarshalJSON() (data []byte, err error)

func (*V1ContractAmendParamsOverrideOverrideSpecifier) UnmarshalJSON added in v1.0.0

type V1ContractAmendParamsOverrideOverwriteRate added in v1.0.0

type V1ContractAmendParamsOverrideOverwriteRate struct {
	// Any of "FLAT", "PERCENTAGE", "SUBSCRIPTION", "TIERED", "CUSTOM".
	RateType     string            `json:"rate_type,omitzero,required"`
	CreditTypeID param.Opt[string] `json:"credit_type_id,omitzero" format:"uuid"`
	// Default proration configuration. Only valid for SUBSCRIPTION rate_type. Must be
	// set to true.
	IsProrated param.Opt[bool] `json:"is_prorated,omitzero"`
	// Default price. For FLAT rate_type, this must be >=0. For PERCENTAGE rate_type,
	// this is a decimal fraction, e.g. use 0.1 for 10%; this must be >=0 and <=1.
	Price param.Opt[float64] `json:"price,omitzero"`
	// Default quantity. For SUBSCRIPTION rate_type, this must be >=0.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Only set for CUSTOM rate_type. This field is interpreted by custom rate
	// processors.
	CustomRate map[string]any `json:"custom_rate,omitzero"`
	// Only set for TIERED rate_type.
	Tiers []shared.TierParam `json:"tiers,omitzero"`
	// contains filtered or unexported fields
}

Required for OVERWRITE type.

The property RateType is required.

func (V1ContractAmendParamsOverrideOverwriteRate) MarshalJSON added in v1.0.0

func (r V1ContractAmendParamsOverrideOverwriteRate) MarshalJSON() (data []byte, err error)

func (*V1ContractAmendParamsOverrideOverwriteRate) UnmarshalJSON added in v1.0.0

func (r *V1ContractAmendParamsOverrideOverwriteRate) UnmarshalJSON(data []byte) error

type V1ContractAmendParamsOverrideTier added in v1.0.0

type V1ContractAmendParamsOverrideTier struct {
	Multiplier float64            `json:"multiplier,required"`
	Size       param.Opt[float64] `json:"size,omitzero"`
	// contains filtered or unexported fields
}

The property Multiplier is required.

func (V1ContractAmendParamsOverrideTier) MarshalJSON added in v1.0.0

func (r V1ContractAmendParamsOverrideTier) MarshalJSON() (data []byte, err error)

func (*V1ContractAmendParamsOverrideTier) UnmarshalJSON added in v1.0.0

func (r *V1ContractAmendParamsOverrideTier) UnmarshalJSON(data []byte) error

type V1ContractAmendParamsProfessionalService

type V1ContractAmendParamsProfessionalService struct {
	// Maximum amount for the term.
	MaxAmount float64 `json:"max_amount,required"`
	ProductID string  `json:"product_id,required" format:"uuid"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount.
	Quantity float64 `json:"quantity,required"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified.
	UnitPrice   float64           `json:"unit_price,required"`
	Description param.Opt[string] `json:"description,omitzero"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Opt[string] `json:"netsuite_sales_order_id,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// contains filtered or unexported fields
}

The properties MaxAmount, ProductID, Quantity, UnitPrice are required.

func (V1ContractAmendParamsProfessionalService) MarshalJSON

func (r V1ContractAmendParamsProfessionalService) MarshalJSON() (data []byte, err error)

func (*V1ContractAmendParamsProfessionalService) UnmarshalJSON added in v1.0.0

func (r *V1ContractAmendParamsProfessionalService) UnmarshalJSON(data []byte) error

type V1ContractAmendParamsResellerRoyalty

type V1ContractAmendParamsResellerRoyalty struct {
	// Any of "AWS", "AWS_PRO_SERVICE", "GCP", "GCP_PRO_SERVICE".
	ResellerType string `json:"reseller_type,omitzero,required"`
	// Use null to indicate that the existing end timestamp should be removed.
	EndingBefore          param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	Fraction              param.Opt[float64]   `json:"fraction,omitzero"`
	NetsuiteResellerID    param.Opt[string]    `json:"netsuite_reseller_id,omitzero"`
	ResellerContractValue param.Opt[float64]   `json:"reseller_contract_value,omitzero"`
	StartingAt            param.Opt[time.Time] `json:"starting_at,omitzero" format:"date-time"`
	// Must provide at least one of applicable_product_ids or applicable_product_tags.
	ApplicableProductIDs []string `json:"applicable_product_ids,omitzero" format:"uuid"`
	// Must provide at least one of applicable_product_ids or applicable_product_tags.
	ApplicableProductTags []string                                       `json:"applicable_product_tags,omitzero"`
	AwsOptions            V1ContractAmendParamsResellerRoyaltyAwsOptions `json:"aws_options,omitzero"`
	GcpOptions            V1ContractAmendParamsResellerRoyaltyGcpOptions `json:"gcp_options,omitzero"`
	// contains filtered or unexported fields
}

The property ResellerType is required.

func (V1ContractAmendParamsResellerRoyalty) MarshalJSON

func (r V1ContractAmendParamsResellerRoyalty) MarshalJSON() (data []byte, err error)

func (*V1ContractAmendParamsResellerRoyalty) UnmarshalJSON added in v1.0.0

func (r *V1ContractAmendParamsResellerRoyalty) UnmarshalJSON(data []byte) error

type V1ContractAmendParamsResellerRoyaltyAwsOptions added in v1.0.0

type V1ContractAmendParamsResellerRoyaltyAwsOptions struct {
	AwsAccountNumber    param.Opt[string] `json:"aws_account_number,omitzero"`
	AwsOfferID          param.Opt[string] `json:"aws_offer_id,omitzero"`
	AwsPayerReferenceID param.Opt[string] `json:"aws_payer_reference_id,omitzero"`
	// contains filtered or unexported fields
}

func (V1ContractAmendParamsResellerRoyaltyAwsOptions) MarshalJSON added in v1.0.0

func (r V1ContractAmendParamsResellerRoyaltyAwsOptions) MarshalJSON() (data []byte, err error)

func (*V1ContractAmendParamsResellerRoyaltyAwsOptions) UnmarshalJSON added in v1.0.0

type V1ContractAmendParamsResellerRoyaltyGcpOptions added in v1.0.0

type V1ContractAmendParamsResellerRoyaltyGcpOptions struct {
	GcpAccountID param.Opt[string] `json:"gcp_account_id,omitzero"`
	GcpOfferID   param.Opt[string] `json:"gcp_offer_id,omitzero"`
	// contains filtered or unexported fields
}

func (V1ContractAmendParamsResellerRoyaltyGcpOptions) MarshalJSON added in v1.0.0

func (r V1ContractAmendParamsResellerRoyaltyGcpOptions) MarshalJSON() (data []byte, err error)

func (*V1ContractAmendParamsResellerRoyaltyGcpOptions) UnmarshalJSON added in v1.0.0

type V1ContractAmendParamsScheduledCharge

type V1ContractAmendParamsScheduledCharge struct {
	ProductID string `json:"product_id,required" format:"uuid"`
	// Must provide either schedule_items or recurring_schedule.
	Schedule V1ContractAmendParamsScheduledChargeSchedule `json:"schedule,omitzero,required"`
	// displayed on invoices
	Name param.Opt[string] `json:"name,omitzero"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Opt[string] `json:"netsuite_sales_order_id,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// contains filtered or unexported fields
}

The properties ProductID, Schedule are required.

func (V1ContractAmendParamsScheduledCharge) MarshalJSON

func (r V1ContractAmendParamsScheduledCharge) MarshalJSON() (data []byte, err error)

func (*V1ContractAmendParamsScheduledCharge) UnmarshalJSON added in v1.0.0

func (r *V1ContractAmendParamsScheduledCharge) UnmarshalJSON(data []byte) error

type V1ContractAmendParamsScheduledChargeSchedule added in v1.0.0

type V1ContractAmendParamsScheduledChargeSchedule struct {
	// Defaults to USD (cents) if not passed.
	CreditTypeID param.Opt[string] `json:"credit_type_id,omitzero" format:"uuid"`
	// This field is only applicable to commit invoice schedules. If true, this
	// schedule will not generate an invoice.
	DoNotInvoice param.Opt[bool] `json:"do_not_invoice,omitzero"`
	// Enter the unit price and quantity for the charge or instead only send the
	// amount. If amount is sent, the unit price is assumed to be the amount and
	// quantity is inferred to be 1.
	RecurringSchedule V1ContractAmendParamsScheduledChargeScheduleRecurringSchedule `json:"recurring_schedule,omitzero"`
	// Either provide amount or provide both unit_price and quantity.
	ScheduleItems []V1ContractAmendParamsScheduledChargeScheduleScheduleItem `json:"schedule_items,omitzero"`
	// contains filtered or unexported fields
}

Must provide either schedule_items or recurring_schedule.

func (V1ContractAmendParamsScheduledChargeSchedule) MarshalJSON added in v1.0.0

func (r V1ContractAmendParamsScheduledChargeSchedule) MarshalJSON() (data []byte, err error)

func (*V1ContractAmendParamsScheduledChargeSchedule) UnmarshalJSON added in v1.0.0

func (r *V1ContractAmendParamsScheduledChargeSchedule) UnmarshalJSON(data []byte) error

type V1ContractAmendParamsScheduledChargeScheduleRecurringSchedule added in v1.0.0

type V1ContractAmendParamsScheduledChargeScheduleRecurringSchedule struct {
	// Any of "DIVIDED", "DIVIDED_ROUNDED", "EACH".
	AmountDistribution string `json:"amount_distribution,omitzero,required"`
	// RFC 3339 timestamp (exclusive).
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	// Any of "MONTHLY", "QUARTERLY", "SEMI_ANNUAL", "ANNUAL".
	Frequency string `json:"frequency,omitzero,required"`
	// RFC 3339 timestamp (inclusive).
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// Amount for the charge. Can be provided instead of unit_price and quantity. If
	// amount is sent, the unit_price is assumed to be the amount and quantity is
	// inferred to be 1.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount and must be specified with unit_price. If specified amount cannot be
	// provided.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified with quantity. If specified amount cannot be
	// provided.
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

Enter the unit price and quantity for the charge or instead only send the amount. If amount is sent, the unit price is assumed to be the amount and quantity is inferred to be 1.

The properties AmountDistribution, EndingBefore, Frequency, StartingAt are required.

func (V1ContractAmendParamsScheduledChargeScheduleRecurringSchedule) MarshalJSON added in v1.0.0

func (*V1ContractAmendParamsScheduledChargeScheduleRecurringSchedule) UnmarshalJSON added in v1.0.0

type V1ContractAmendParamsScheduledChargeScheduleScheduleItem added in v1.0.0

type V1ContractAmendParamsScheduledChargeScheduleScheduleItem struct {
	// timestamp of the scheduled event
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// Amount for the charge. Can be provided instead of unit_price and quantity. If
	// amount is sent, the unit_price is assumed to be the amount and quantity is
	// inferred to be 1.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount and must be specified with unit_price. If specified amount cannot be
	// provided.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified with quantity. If specified amount cannot be
	// provided.
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

The property Timestamp is required.

func (V1ContractAmendParamsScheduledChargeScheduleScheduleItem) MarshalJSON added in v1.0.0

func (*V1ContractAmendParamsScheduledChargeScheduleScheduleItem) UnmarshalJSON added in v1.0.0

type V1ContractAmendResponse

type V1ContractAmendResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractAmendResponse) RawJSON added in v1.0.0

func (r V1ContractAmendResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1ContractAmendResponse) UnmarshalJSON

func (r *V1ContractAmendResponse) UnmarshalJSON(data []byte) error

type V1ContractArchiveParams

type V1ContractArchiveParams struct {
	// ID of the contract to archive
	ContractID string `json:"contract_id,required" format:"uuid"`
	// ID of the customer whose contract is to be archived
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// If false, the existing finalized invoices will remain after the contract is
	// archived.
	VoidInvoices bool `json:"void_invoices,required"`
	// contains filtered or unexported fields
}

func (V1ContractArchiveParams) MarshalJSON

func (r V1ContractArchiveParams) MarshalJSON() (data []byte, err error)

func (*V1ContractArchiveParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractArchiveParams) UnmarshalJSON(data []byte) error

type V1ContractArchiveResponse

type V1ContractArchiveResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractArchiveResponse) RawJSON added in v1.0.0

func (r V1ContractArchiveResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1ContractArchiveResponse) UnmarshalJSON

func (r *V1ContractArchiveResponse) UnmarshalJSON(data []byte) error

type V1ContractGetParams

type V1ContractGetParams struct {
	ContractID string `json:"contract_id,required" format:"uuid"`
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// Include the balance of credits and commits in the response. Setting this flag
	// may cause the query to be slower.
	IncludeBalance param.Opt[bool] `json:"include_balance,omitzero"`
	// Include commit ledgers in the response. Setting this flag may cause the query to
	// be slower.
	IncludeLedgers param.Opt[bool] `json:"include_ledgers,omitzero"`
	// contains filtered or unexported fields
}

func (V1ContractGetParams) MarshalJSON

func (r V1ContractGetParams) MarshalJSON() (data []byte, err error)

func (*V1ContractGetParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractGetParams) UnmarshalJSON(data []byte) error

type V1ContractGetRateScheduleParams

type V1ContractGetRateScheduleParams struct {
	// ID of the contract to get the rate schedule for.
	ContractID string `json:"contract_id,required" format:"uuid"`
	// ID of the customer for whose contract to get the rate schedule for.
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// Max number of results that should be returned
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	// optional timestamp which overlaps with the returned rate schedule segments. When
	// not specified, the current timestamp will be used.
	At param.Opt[time.Time] `json:"at,omitzero" format:"date-time"`
	// List of rate selectors, rates matching ANY of the selectors will be included in
	// the response. Passing no selectors will result in all rates being returned.
	Selectors []V1ContractGetRateScheduleParamsSelector `json:"selectors,omitzero"`
	// contains filtered or unexported fields
}

func (V1ContractGetRateScheduleParams) MarshalJSON

func (r V1ContractGetRateScheduleParams) MarshalJSON() (data []byte, err error)

func (V1ContractGetRateScheduleParams) URLQuery

func (r V1ContractGetRateScheduleParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1ContractGetRateScheduleParams's query parameters as `url.Values`.

func (*V1ContractGetRateScheduleParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractGetRateScheduleParams) UnmarshalJSON(data []byte) error

type V1ContractGetRateScheduleParamsSelector

type V1ContractGetRateScheduleParamsSelector struct {
	// Rates matching the product id will be included in the response.
	ProductID param.Opt[string] `json:"product_id,omitzero" format:"uuid"`
	// Subscription rates matching the billing frequency will be included in the
	// response.
	//
	// Any of "MONTHLY", "QUARTERLY", "ANNUAL", "WEEKLY".
	BillingFrequency string `json:"billing_frequency,omitzero"`
	// List of pricing group key value pairs, rates containing the matching key / value
	// pairs will be included in the response.
	PartialPricingGroupValues map[string]string `json:"partial_pricing_group_values,omitzero"`
	// List of pricing group key value pairs, rates matching all of the key / value
	// pairs will be included in the response.
	PricingGroupValues map[string]string `json:"pricing_group_values,omitzero"`
	// List of product tags, rates matching any of the tags will be included in the
	// response.
	ProductTags []string `json:"product_tags,omitzero"`
	// contains filtered or unexported fields
}

func (V1ContractGetRateScheduleParamsSelector) MarshalJSON

func (r V1ContractGetRateScheduleParamsSelector) MarshalJSON() (data []byte, err error)

func (*V1ContractGetRateScheduleParamsSelector) UnmarshalJSON added in v1.0.0

func (r *V1ContractGetRateScheduleParamsSelector) UnmarshalJSON(data []byte) error

type V1ContractGetRateScheduleResponse

type V1ContractGetRateScheduleResponse struct {
	Data     []V1ContractGetRateScheduleResponseData `json:"data,required"`
	NextPage string                                  `json:"next_page,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		NextPage    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractGetRateScheduleResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractGetRateScheduleResponse) UnmarshalJSON

func (r *V1ContractGetRateScheduleResponse) UnmarshalJSON(data []byte) error

type V1ContractGetRateScheduleResponseData

type V1ContractGetRateScheduleResponseData struct {
	Entitled bool        `json:"entitled,required"`
	ListRate shared.Rate `json:"list_rate,required"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	ProductCustomFields map[string]string `json:"product_custom_fields,required"`
	ProductID           string            `json:"product_id,required" format:"uuid"`
	ProductName         string            `json:"product_name,required"`
	ProductTags         []string          `json:"product_tags,required"`
	RateCardID          string            `json:"rate_card_id,required" format:"uuid"`
	StartingAt          time.Time         `json:"starting_at,required" format:"date-time"`
	// Any of "MONTHLY", "QUARTERLY", "ANNUAL", "WEEKLY".
	BillingFrequency string `json:"billing_frequency"`
	// A distinct rate on the rate card. You can choose to use this rate rather than
	// list rate when consuming a credit or commit.
	CommitRate         shared.CommitRate `json:"commit_rate"`
	EndingBefore       time.Time         `json:"ending_before" format:"date-time"`
	OverrideRate       shared.Rate       `json:"override_rate"`
	PricingGroupValues map[string]string `json:"pricing_group_values"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Entitled            respjson.Field
		ListRate            respjson.Field
		ProductCustomFields respjson.Field
		ProductID           respjson.Field
		ProductName         respjson.Field
		ProductTags         respjson.Field
		RateCardID          respjson.Field
		StartingAt          respjson.Field
		BillingFrequency    respjson.Field
		CommitRate          respjson.Field
		EndingBefore        respjson.Field
		OverrideRate        respjson.Field
		PricingGroupValues  respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractGetRateScheduleResponseData) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractGetRateScheduleResponseData) UnmarshalJSON

func (r *V1ContractGetRateScheduleResponseData) UnmarshalJSON(data []byte) error

type V1ContractGetResponse

type V1ContractGetResponse struct {
	Data shared.Contract `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractGetResponse) RawJSON added in v1.0.0

func (r V1ContractGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1ContractGetResponse) UnmarshalJSON

func (r *V1ContractGetResponse) UnmarshalJSON(data []byte) error

type V1ContractGetSubscriptionQuantityHistoryParams

type V1ContractGetSubscriptionQuantityHistoryParams struct {
	ContractID     string `json:"contract_id,required" format:"uuid"`
	CustomerID     string `json:"customer_id,required" format:"uuid"`
	SubscriptionID string `json:"subscription_id,required" format:"uuid"`
	// contains filtered or unexported fields
}

func (V1ContractGetSubscriptionQuantityHistoryParams) MarshalJSON

func (r V1ContractGetSubscriptionQuantityHistoryParams) MarshalJSON() (data []byte, err error)

func (*V1ContractGetSubscriptionQuantityHistoryParams) UnmarshalJSON added in v1.0.0

type V1ContractGetSubscriptionQuantityHistoryResponse

type V1ContractGetSubscriptionQuantityHistoryResponse struct {
	Data V1ContractGetSubscriptionQuantityHistoryResponseData `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractGetSubscriptionQuantityHistoryResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractGetSubscriptionQuantityHistoryResponse) UnmarshalJSON

type V1ContractGetSubscriptionQuantityHistoryResponseData

type V1ContractGetSubscriptionQuantityHistoryResponseData struct {
	FiatCreditTypeID string                                                        `json:"fiat_credit_type_id" format:"uuid"`
	History          []V1ContractGetSubscriptionQuantityHistoryResponseDataHistory `json:"history"`
	SubscriptionID   string                                                        `json:"subscription_id" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FiatCreditTypeID respjson.Field
		History          respjson.Field
		SubscriptionID   respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractGetSubscriptionQuantityHistoryResponseData) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractGetSubscriptionQuantityHistoryResponseData) UnmarshalJSON

type V1ContractGetSubscriptionQuantityHistoryResponseDataHistory

type V1ContractGetSubscriptionQuantityHistoryResponseDataHistory struct {
	Data       []V1ContractGetSubscriptionQuantityHistoryResponseDataHistoryData `json:"data,required"`
	StartingAt time.Time                                                         `json:"starting_at,required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		StartingAt  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractGetSubscriptionQuantityHistoryResponseDataHistory) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractGetSubscriptionQuantityHistoryResponseDataHistory) UnmarshalJSON

type V1ContractGetSubscriptionQuantityHistoryResponseDataHistoryData

type V1ContractGetSubscriptionQuantityHistoryResponseDataHistoryData struct {
	Quantity  float64 `json:"quantity,required"`
	Total     float64 `json:"total,required"`
	UnitPrice float64 `json:"unit_price,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Quantity    respjson.Field
		Total       respjson.Field
		UnitPrice   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractGetSubscriptionQuantityHistoryResponseDataHistoryData) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractGetSubscriptionQuantityHistoryResponseDataHistoryData) UnmarshalJSON

type V1ContractListBalancesParams

type V1ContractListBalancesParams struct {
	CustomerID string            `json:"customer_id,required" format:"uuid"`
	ID         param.Opt[string] `json:"id,omitzero" format:"uuid"`
	// Return only balances that have access schedules that "cover" the provided date
	CoveringDate param.Opt[time.Time] `json:"covering_date,omitzero" format:"date-time"`
	// Include only balances that have any access before the provided date (exclusive)
	EffectiveBefore param.Opt[time.Time] `json:"effective_before,omitzero" format:"date-time"`
	// Include archived credits and credits from archived contracts.
	IncludeArchived param.Opt[bool] `json:"include_archived,omitzero"`
	// Include the balance of credits and commits in the response. Setting this flag
	// may cause the query to be slower.
	IncludeBalance param.Opt[bool] `json:"include_balance,omitzero"`
	// Include balances on the contract level.
	IncludeContractBalances param.Opt[bool] `json:"include_contract_balances,omitzero"`
	// Include ledgers in the response. Setting this flag may cause the query to be
	// slower.
	IncludeLedgers param.Opt[bool] `json:"include_ledgers,omitzero"`
	// The maximum number of commits to return. Defaults to 25.
	Limit param.Opt[int64] `json:"limit,omitzero"`
	// The next page token from a previous response.
	NextPage param.Opt[string] `json:"next_page,omitzero"`
	// Include only balances that have any access on or after the provided date
	StartingAt param.Opt[time.Time] `json:"starting_at,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

func (V1ContractListBalancesParams) MarshalJSON

func (r V1ContractListBalancesParams) MarshalJSON() (data []byte, err error)

func (*V1ContractListBalancesParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractListBalancesParams) UnmarshalJSON(data []byte) error

type V1ContractListBalancesResponseUnion added in v1.0.0

type V1ContractListBalancesResponseUnion struct {
	ID string `json:"id"`
	// This field is from variant [shared.Commit].
	CreatedAt time.Time `json:"created_at"`
	// This field is a union of [shared.CommitProduct], [shared.CreditProduct]
	Product V1ContractListBalancesResponseUnionProduct `json:"product"`
	Type    string                                     `json:"type"`
	// This field is from variant [shared.Commit].
	AccessSchedule shared.ScheduleDuration `json:"access_schedule"`
	// This field is from variant [shared.Commit].
	Amount                float64  `json:"amount"`
	ApplicableContractIDs []string `json:"applicable_contract_ids"`
	ApplicableProductIDs  []string `json:"applicable_product_ids"`
	ApplicableProductTags []string `json:"applicable_product_tags"`
	// This field is from variant [shared.Commit].
	ArchivedAt time.Time `json:"archived_at"`
	Balance    float64   `json:"balance"`
	// This field is a union of [shared.CommitContract], [shared.CreditContract]
	Contract     V1ContractListBalancesResponseUnionContract `json:"contract"`
	CustomFields string                                      `json:"custom_fields"`
	Description  string                                      `json:"description"`
	// This field is from variant [shared.Commit].
	HierarchyConfiguration shared.CommitHierarchyConfiguration `json:"hierarchy_configuration"`
	// This field is from variant [shared.Commit].
	InvoiceContract shared.CommitInvoiceContract `json:"invoice_contract"`
	// This field is from variant [shared.Commit].
	InvoiceSchedule shared.SchedulePointInTime `json:"invoice_schedule"`
	// This field is a union of [[]shared.CommitLedgerUnion],
	// [[]shared.CreditLedgerUnion]
	Ledger               V1ContractListBalancesResponseUnionLedger `json:"ledger"`
	Name                 string                                    `json:"name"`
	NetsuiteSalesOrderID string                                    `json:"netsuite_sales_order_id"`
	Priority             float64                                   `json:"priority"`
	RateType             string                                    `json:"rate_type"`
	// This field is from variant [shared.Commit].
	RolledOverFrom shared.CommitRolledOverFrom `json:"rolled_over_from"`
	// This field is from variant [shared.Commit].
	RolloverFraction        float64                  `json:"rollover_fraction"`
	SalesforceOpportunityID string                   `json:"salesforce_opportunity_id"`
	Specifiers              []shared.CommitSpecifier `json:"specifiers"`
	UniquenessKey           string                   `json:"uniqueness_key"`
	JSON                    struct {
		ID                      respjson.Field
		CreatedAt               respjson.Field
		Product                 respjson.Field
		Type                    respjson.Field
		AccessSchedule          respjson.Field
		Amount                  respjson.Field
		ApplicableContractIDs   respjson.Field
		ApplicableProductIDs    respjson.Field
		ApplicableProductTags   respjson.Field
		ArchivedAt              respjson.Field
		Balance                 respjson.Field
		Contract                respjson.Field
		CustomFields            respjson.Field
		Description             respjson.Field
		HierarchyConfiguration  respjson.Field
		InvoiceContract         respjson.Field
		InvoiceSchedule         respjson.Field
		Ledger                  respjson.Field
		Name                    respjson.Field
		NetsuiteSalesOrderID    respjson.Field
		Priority                respjson.Field
		RateType                respjson.Field
		RolledOverFrom          respjson.Field
		RolloverFraction        respjson.Field
		SalesforceOpportunityID respjson.Field
		Specifiers              respjson.Field
		UniquenessKey           respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

V1ContractListBalancesResponseUnion contains all possible properties and values from shared.Commit, shared.Credit.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (V1ContractListBalancesResponseUnion) AsCommit added in v1.0.0

func (V1ContractListBalancesResponseUnion) AsCredit added in v1.0.0

func (V1ContractListBalancesResponseUnion) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractListBalancesResponseUnion) UnmarshalJSON added in v1.0.0

func (r *V1ContractListBalancesResponseUnion) UnmarshalJSON(data []byte) error

type V1ContractListBalancesResponseUnionContract added in v1.0.0

type V1ContractListBalancesResponseUnionContract struct {
	ID   string `json:"id"`
	JSON struct {
		ID respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

V1ContractListBalancesResponseUnionContract is an implicit subunion of V1ContractListBalancesResponseUnion. V1ContractListBalancesResponseUnionContract provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the V1ContractListBalancesResponseUnion.

func (*V1ContractListBalancesResponseUnionContract) UnmarshalJSON added in v1.0.0

func (r *V1ContractListBalancesResponseUnionContract) UnmarshalJSON(data []byte) error

type V1ContractListBalancesResponseUnionLedger added in v1.0.0

type V1ContractListBalancesResponseUnionLedger struct {
	// This field will be present if the value is a [[]shared.CommitLedgerUnion]
	// instead of an object.
	OfCommitLedgerArray []shared.CommitLedgerUnion `json:",inline"`
	// This field will be present if the value is a [[]shared.CreditLedgerUnion]
	// instead of an object.
	OfCreditLedgerArray []shared.CreditLedgerUnion `json:",inline"`
	JSON                struct {
		OfCommitLedgerArray respjson.Field
		OfCreditLedgerArray respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

V1ContractListBalancesResponseUnionLedger is an implicit subunion of V1ContractListBalancesResponseUnion. V1ContractListBalancesResponseUnionLedger provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the V1ContractListBalancesResponseUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfCommitLedgerArray OfCreditLedgerArray]

func (*V1ContractListBalancesResponseUnionLedger) UnmarshalJSON added in v1.0.0

func (r *V1ContractListBalancesResponseUnionLedger) UnmarshalJSON(data []byte) error

type V1ContractListBalancesResponseUnionProduct added in v1.0.0

type V1ContractListBalancesResponseUnionProduct struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	JSON struct {
		ID   respjson.Field
		Name respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

V1ContractListBalancesResponseUnionProduct is an implicit subunion of V1ContractListBalancesResponseUnion. V1ContractListBalancesResponseUnionProduct provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the V1ContractListBalancesResponseUnion.

func (*V1ContractListBalancesResponseUnionProduct) UnmarshalJSON added in v1.0.0

func (r *V1ContractListBalancesResponseUnionProduct) UnmarshalJSON(data []byte) error

type V1ContractListParams

type V1ContractListParams struct {
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// Optional RFC 3339 timestamp. If provided, the response will include only
	// contracts effective on the provided date. This cannot be provided if the
	// starting_at filter is provided.
	CoveringDate param.Opt[time.Time] `json:"covering_date,omitzero" format:"date-time"`
	// Include archived contracts in the response
	IncludeArchived param.Opt[bool] `json:"include_archived,omitzero"`
	// Include the balance of credits and commits in the response. Setting this flag
	// may cause the query to be slower.
	IncludeBalance param.Opt[bool] `json:"include_balance,omitzero"`
	// Include commit ledgers in the response. Setting this flag may cause the query to
	// be slower.
	IncludeLedgers param.Opt[bool] `json:"include_ledgers,omitzero"`
	// Optional RFC 3339 timestamp. If provided, the response will include only
	// contracts where effective_at is on or after the provided date. This cannot be
	// provided if the covering_date filter is provided.
	StartingAt param.Opt[time.Time] `json:"starting_at,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

func (V1ContractListParams) MarshalJSON

func (r V1ContractListParams) MarshalJSON() (data []byte, err error)

func (*V1ContractListParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractListParams) UnmarshalJSON(data []byte) error

type V1ContractListResponse

type V1ContractListResponse struct {
	Data []shared.Contract `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractListResponse) RawJSON added in v1.0.0

func (r V1ContractListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1ContractListResponse) UnmarshalJSON

func (r *V1ContractListResponse) UnmarshalJSON(data []byte) error

type V1ContractNamedScheduleGetParams

type V1ContractNamedScheduleGetParams struct {
	// ID of the rate card whose named schedule is to be retrieved
	RateCardID string `json:"rate_card_id,required" format:"uuid"`
	// The identifier for the schedule to be retrieved
	ScheduleName string `json:"schedule_name,required"`
	// If provided, at most one schedule segment will be returned (the one that covers
	// this date). If not provided, all segments will be returned.
	CoveringDate param.Opt[time.Time] `json:"covering_date,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

func (V1ContractNamedScheduleGetParams) MarshalJSON

func (r V1ContractNamedScheduleGetParams) MarshalJSON() (data []byte, err error)

func (*V1ContractNamedScheduleGetParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractNamedScheduleGetParams) UnmarshalJSON(data []byte) error

type V1ContractNamedScheduleGetResponse

type V1ContractNamedScheduleGetResponse struct {
	Data []V1ContractNamedScheduleGetResponseData `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractNamedScheduleGetResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractNamedScheduleGetResponse) UnmarshalJSON

func (r *V1ContractNamedScheduleGetResponse) UnmarshalJSON(data []byte) error

type V1ContractNamedScheduleGetResponseData

type V1ContractNamedScheduleGetResponseData struct {
	StartingAt   time.Time `json:"starting_at,required" format:"date-time"`
	Value        any       `json:"value,required"`
	EndingBefore time.Time `json:"ending_before" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		StartingAt   respjson.Field
		Value        respjson.Field
		EndingBefore respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractNamedScheduleGetResponseData) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractNamedScheduleGetResponseData) UnmarshalJSON

func (r *V1ContractNamedScheduleGetResponseData) UnmarshalJSON(data []byte) error

type V1ContractNamedScheduleService

type V1ContractNamedScheduleService struct {
	Options []option.RequestOption
}

V1ContractNamedScheduleService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1ContractNamedScheduleService method instead.

func NewV1ContractNamedScheduleService

func NewV1ContractNamedScheduleService(opts ...option.RequestOption) (r V1ContractNamedScheduleService)

NewV1ContractNamedScheduleService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1ContractNamedScheduleService) Get

Get a named schedule for the given rate card. This endpoint's availability is dependent on your client's configuration.

func (*V1ContractNamedScheduleService) Update

Update a named schedule for the given rate card. This endpoint's availability is dependent on your client's configuration.

type V1ContractNamedScheduleUpdateParams

type V1ContractNamedScheduleUpdateParams struct {
	// ID of the rate card whose named schedule is to be updated
	RateCardID string `json:"rate_card_id,required" format:"uuid"`
	// The identifier for the schedule to be updated
	ScheduleName string    `json:"schedule_name,required"`
	StartingAt   time.Time `json:"starting_at,required" format:"date-time"`
	// The value to set for the named schedule. The structure of this object is
	// specific to the named schedule.
	Value        any                  `json:"value,omitzero,required"`
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

func (V1ContractNamedScheduleUpdateParams) MarshalJSON

func (r V1ContractNamedScheduleUpdateParams) MarshalJSON() (data []byte, err error)

func (*V1ContractNamedScheduleUpdateParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractNamedScheduleUpdateParams) UnmarshalJSON(data []byte) error

type V1ContractNewHistoricalInvoicesParams

type V1ContractNewHistoricalInvoicesParams struct {
	Invoices []V1ContractNewHistoricalInvoicesParamsInvoice `json:"invoices,omitzero,required"`
	Preview  bool                                           `json:"preview,required"`
	// contains filtered or unexported fields
}

func (V1ContractNewHistoricalInvoicesParams) MarshalJSON

func (r V1ContractNewHistoricalInvoicesParams) MarshalJSON() (data []byte, err error)

func (*V1ContractNewHistoricalInvoicesParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewHistoricalInvoicesParams) UnmarshalJSON(data []byte) error

type V1ContractNewHistoricalInvoicesParamsInvoice

type V1ContractNewHistoricalInvoicesParamsInvoice struct {
	ContractID         string                                                      `json:"contract_id,required" format:"uuid"`
	CreditTypeID       string                                                      `json:"credit_type_id,required" format:"uuid"`
	CustomerID         string                                                      `json:"customer_id,required" format:"uuid"`
	ExclusiveEndDate   time.Time                                                   `json:"exclusive_end_date,required" format:"date-time"`
	InclusiveStartDate time.Time                                                   `json:"inclusive_start_date,required" format:"date-time"`
	IssueDate          time.Time                                                   `json:"issue_date,required" format:"date-time"`
	UsageLineItems     []V1ContractNewHistoricalInvoicesParamsInvoiceUsageLineItem `json:"usage_line_items,omitzero,required"`
	// This field's availability is dependent on your client's configuration.
	//
	// Any of "billable", "unbillable".
	BillableStatus string `json:"billable_status,omitzero"`
	// Any of "HOUR", "DAY".
	BreakdownGranularity string `json:"breakdown_granularity,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// contains filtered or unexported fields
}

The properties ContractID, CreditTypeID, CustomerID, ExclusiveEndDate, InclusiveStartDate, IssueDate, UsageLineItems are required.

func (V1ContractNewHistoricalInvoicesParamsInvoice) MarshalJSON

func (r V1ContractNewHistoricalInvoicesParamsInvoice) MarshalJSON() (data []byte, err error)

func (*V1ContractNewHistoricalInvoicesParamsInvoice) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewHistoricalInvoicesParamsInvoice) UnmarshalJSON(data []byte) error

type V1ContractNewHistoricalInvoicesParamsInvoiceUsageLineItem added in v1.0.0

type V1ContractNewHistoricalInvoicesParamsInvoiceUsageLineItem struct {
	ExclusiveEndDate        time.Time                                                                        `json:"exclusive_end_date,required" format:"date-time"`
	InclusiveStartDate      time.Time                                                                        `json:"inclusive_start_date,required" format:"date-time"`
	ProductID               string                                                                           `json:"product_id,required" format:"uuid"`
	Quantity                param.Opt[float64]                                                               `json:"quantity,omitzero"`
	PresentationGroupValues map[string]string                                                                `json:"presentation_group_values,omitzero"`
	PricingGroupValues      map[string]string                                                                `json:"pricing_group_values,omitzero"`
	SubtotalsWithQuantity   []V1ContractNewHistoricalInvoicesParamsInvoiceUsageLineItemSubtotalsWithQuantity `json:"subtotals_with_quantity,omitzero"`
	// contains filtered or unexported fields
}

The properties ExclusiveEndDate, InclusiveStartDate, ProductID are required.

func (V1ContractNewHistoricalInvoicesParamsInvoiceUsageLineItem) MarshalJSON added in v1.0.0

func (*V1ContractNewHistoricalInvoicesParamsInvoiceUsageLineItem) UnmarshalJSON added in v1.0.0

type V1ContractNewHistoricalInvoicesParamsInvoiceUsageLineItemSubtotalsWithQuantity added in v1.0.0

type V1ContractNewHistoricalInvoicesParamsInvoiceUsageLineItemSubtotalsWithQuantity struct {
	ExclusiveEndDate   time.Time `json:"exclusive_end_date,required" format:"date-time"`
	InclusiveStartDate time.Time `json:"inclusive_start_date,required" format:"date-time"`
	Quantity           float64   `json:"quantity,required"`
	// contains filtered or unexported fields
}

The properties ExclusiveEndDate, InclusiveStartDate, Quantity are required.

func (V1ContractNewHistoricalInvoicesParamsInvoiceUsageLineItemSubtotalsWithQuantity) MarshalJSON added in v1.0.0

func (*V1ContractNewHistoricalInvoicesParamsInvoiceUsageLineItemSubtotalsWithQuantity) UnmarshalJSON added in v1.0.0

type V1ContractNewHistoricalInvoicesResponse

type V1ContractNewHistoricalInvoicesResponse struct {
	Data []Invoice `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractNewHistoricalInvoicesResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractNewHistoricalInvoicesResponse) UnmarshalJSON

func (r *V1ContractNewHistoricalInvoicesResponse) UnmarshalJSON(data []byte) error

type V1ContractNewParams

type V1ContractNewParams struct {
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// inclusive contract start time
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// exclusive contract end time
	EndingBefore        param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	Name                param.Opt[string]    `json:"name,omitzero"`
	NetPaymentTermsDays param.Opt[float64]   `json:"net_payment_terms_days,omitzero"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Opt[string] `json:"netsuite_sales_order_id,omitzero"`
	// Priority of the contract.
	Priority param.Opt[float64] `json:"priority,omitzero"`
	// Selects the rate card linked to the specified alias as of the contract's start
	// date.
	RateCardAlias param.Opt[string] `json:"rate_card_alias,omitzero"`
	RateCardID    param.Opt[string] `json:"rate_card_id,omitzero" format:"uuid"`
	// This field's availability is dependent on your client's configuration.
	SalesforceOpportunityID param.Opt[string] `json:"salesforce_opportunity_id,omitzero"`
	// This field's availability is dependent on your client's configuration.
	TotalContractValue param.Opt[float64] `json:"total_contract_value,omitzero"`
	// Prevents the creation of duplicates. If a request to create a record is made
	// with a previously used uniqueness key, a new record will not be created and the
	// request will fail with a 409 error.
	UniquenessKey param.Opt[string] `json:"uniqueness_key,omitzero"`
	// The billing provider configuration associated with a contract. Provide either an
	// ID or the provider and delivery method.
	BillingProviderConfiguration V1ContractNewParamsBillingProviderConfiguration `json:"billing_provider_configuration,omitzero"`
	Commits                      []V1ContractNewParamsCommit                     `json:"commits,omitzero"`
	Credits                      []V1ContractNewParamsCredit                     `json:"credits,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// This field's availability is dependent on your client's configuration.
	Discounts              []V1ContractNewParamsDiscount             `json:"discounts,omitzero"`
	HierarchyConfiguration V1ContractNewParamsHierarchyConfiguration `json:"hierarchy_configuration,omitzero"`
	// Defaults to LOWEST_MULTIPLIER, which applies the greatest discount to list
	// prices automatically. EXPLICIT prioritization requires specifying priorities for
	// each multiplier; the one with the lowest priority value will be prioritized
	// first. If tiered overrides are used, prioritization must be explicit.
	//
	// Any of "LOWEST_MULTIPLIER", "EXPLICIT".
	MultiplierOverridePrioritization     V1ContractNewParamsMultiplierOverridePrioritization `json:"multiplier_override_prioritization,omitzero"`
	ContractOverrides                    []V1ContractNewParamsOverride                       `json:"overrides,omitzero"`
	PrepaidBalanceThresholdConfiguration shared.PrepaidBalanceThresholdConfigurationParam    `json:"prepaid_balance_threshold_configuration,omitzero"`
	// This field's availability is dependent on your client's configuration.
	ProfessionalServices []V1ContractNewParamsProfessionalService `json:"professional_services,omitzero"`
	RecurringCommits     []V1ContractNewParamsRecurringCommit     `json:"recurring_commits,omitzero"`
	RecurringCredits     []V1ContractNewParamsRecurringCredit     `json:"recurring_credits,omitzero"`
	// This field's availability is dependent on your client's configuration.
	ResellerRoyalties []V1ContractNewParamsResellerRoyalty `json:"reseller_royalties,omitzero"`
	ScheduledCharges  []V1ContractNewParamsScheduledCharge `json:"scheduled_charges,omitzero"`
	// Determines which scheduled and commit charges to consolidate onto the Contract's
	// usage invoice. The charge's `timestamp` must match the usage invoice's
	// `ending_before` date for consolidation to occur. This field cannot be modified
	// after a Contract has been created. If this field is omitted, charges will appear
	// on a separate invoice from usage charges.
	//
	// Any of "ALL".
	ScheduledChargesOnUsageInvoices V1ContractNewParamsScheduledChargesOnUsageInvoices `json:"scheduled_charges_on_usage_invoices,omitzero"`
	SpendThresholdConfiguration     shared.SpendThresholdConfigurationParam            `json:"spend_threshold_configuration,omitzero"`
	// Optional list of
	// [subscriptions](https://docs.metronome.com/manage-product-access/create-subscription/)
	// to add to the contract.
	Subscriptions          []V1ContractNewParamsSubscription         `json:"subscriptions,omitzero"`
	Transition             V1ContractNewParamsTransition             `json:"transition,omitzero"`
	UsageFilter            shared.BaseUsageFilterParam               `json:"usage_filter,omitzero"`
	UsageStatementSchedule V1ContractNewParamsUsageStatementSchedule `json:"usage_statement_schedule,omitzero"`
	// contains filtered or unexported fields
}

func (V1ContractNewParams) MarshalJSON

func (r V1ContractNewParams) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParams) UnmarshalJSON(data []byte) error

type V1ContractNewParamsBillingProviderConfiguration

type V1ContractNewParamsBillingProviderConfiguration struct {
	// The Metronome ID of the billing provider configuration. Use when a customer has
	// multiple configurations with the same billing provider and delivery method.
	// Otherwise, specify the billing_provider and delivery_method.
	BillingProviderConfigurationID param.Opt[string] `json:"billing_provider_configuration_id,omitzero" format:"uuid"`
	// Do not specify if using billing_provider_configuration_id.
	//
	// Any of "aws_marketplace", "azure_marketplace", "gcp_marketplace", "stripe",
	// "netsuite".
	BillingProvider string `json:"billing_provider,omitzero"`
	// Do not specify if using billing_provider_configuration_id.
	//
	// Any of "direct_to_billing_provider", "aws_sqs", "tackle", "aws_sns".
	DeliveryMethod string `json:"delivery_method,omitzero"`
	// contains filtered or unexported fields
}

The billing provider configuration associated with a contract. Provide either an ID or the provider and delivery method.

func (V1ContractNewParamsBillingProviderConfiguration) MarshalJSON

func (r V1ContractNewParamsBillingProviderConfiguration) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsBillingProviderConfiguration) UnmarshalJSON added in v1.0.0

type V1ContractNewParamsCommit

type V1ContractNewParamsCommit struct {
	ProductID string `json:"product_id,required" format:"uuid"`
	// Any of "PREPAID", "POSTPAID".
	Type string `json:"type,omitzero,required"`
	// (DEPRECATED) Use access_schedule and invoice_schedule instead.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// Used only in UI/API. It is not exposed to end customers.
	Description param.Opt[string] `json:"description,omitzero"`
	// displayed on invoices
	Name param.Opt[string] `json:"name,omitzero"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Opt[string] `json:"netsuite_sales_order_id,omitzero"`
	// If multiple commits are applicable, the one with the lower priority will apply
	// first.
	Priority param.Opt[float64] `json:"priority,omitzero"`
	// Fraction of unused segments that will be rolled over. Must be between 0 and 1.
	RolloverFraction param.Opt[float64] `json:"rollover_fraction,omitzero"`
	// A temporary ID for the commit that can be used to reference the commit for
	// commit specific overrides.
	TemporaryID param.Opt[string] `json:"temporary_id,omitzero"`
	// Required: Schedule for distributing the commit to the customer. For "POSTPAID"
	// commits only one schedule item is allowed and amount must match invoice_schedule
	// total.
	AccessSchedule V1ContractNewParamsCommitAccessSchedule `json:"access_schedule,omitzero"`
	// Which products the commit applies to. If applicable_product_ids,
	// applicable_product_tags or specifiers are not provided, the commit applies to
	// all products.
	ApplicableProductIDs []string `json:"applicable_product_ids,omitzero" format:"uuid"`
	// Which tags the commit applies to. If applicable_product_ids,
	// applicable_product_tags or specifiers are not provided, the commit applies to
	// all products.
	ApplicableProductTags []string `json:"applicable_product_tags,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// Optional configuration for commit hierarchy access control
	HierarchyConfiguration shared.CommitHierarchyConfigurationParam `json:"hierarchy_configuration,omitzero"`
	// Required for "POSTPAID" commits: the true up invoice will be generated at this
	// time and only one schedule item is allowed; the total must match access_schedule
	// amount. Optional for "PREPAID" commits: if not provided, this will be a
	// "complimentary" commit with no invoice.
	InvoiceSchedule V1ContractNewParamsCommitInvoiceSchedule `json:"invoice_schedule,omitzero"`
	// optionally payment gate this commit
	PaymentGateConfig V1ContractNewParamsCommitPaymentGateConfig `json:"payment_gate_config,omitzero"`
	// Any of "COMMIT_RATE", "LIST_RATE".
	RateType string `json:"rate_type,omitzero"`
	// List of filters that determine what kind of customer usage draws down a commit
	// or credit. A customer's usage needs to meet the condition of at least one of the
	// specifiers to contribute to a commit's or credit's drawdown. This field cannot
	// be used together with `applicable_product_ids` or `applicable_product_tags`.
	Specifiers []shared.CommitSpecifierInputParam `json:"specifiers,omitzero"`
	// contains filtered or unexported fields
}

The properties ProductID, Type are required.

func (V1ContractNewParamsCommit) MarshalJSON

func (r V1ContractNewParamsCommit) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsCommit) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsCommit) UnmarshalJSON(data []byte) error

type V1ContractNewParamsCommitAccessSchedule added in v1.0.0

type V1ContractNewParamsCommitAccessSchedule struct {
	ScheduleItems []V1ContractNewParamsCommitAccessScheduleScheduleItem `json:"schedule_items,omitzero,required"`
	// Defaults to USD (cents) if not passed
	CreditTypeID param.Opt[string] `json:"credit_type_id,omitzero" format:"uuid"`
	// contains filtered or unexported fields
}

Required: Schedule for distributing the commit to the customer. For "POSTPAID" commits only one schedule item is allowed and amount must match invoice_schedule total.

The property ScheduleItems is required.

func (V1ContractNewParamsCommitAccessSchedule) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsCommitAccessSchedule) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsCommitAccessSchedule) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsCommitAccessSchedule) UnmarshalJSON(data []byte) error

type V1ContractNewParamsCommitAccessScheduleScheduleItem added in v1.0.0

type V1ContractNewParamsCommitAccessScheduleScheduleItem struct {
	Amount float64 `json:"amount,required"`
	// RFC 3339 timestamp (exclusive)
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	// RFC 3339 timestamp (inclusive)
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// contains filtered or unexported fields
}

The properties Amount, EndingBefore, StartingAt are required.

func (V1ContractNewParamsCommitAccessScheduleScheduleItem) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsCommitAccessScheduleScheduleItem) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsCommitAccessScheduleScheduleItem) UnmarshalJSON added in v1.0.0

type V1ContractNewParamsCommitInvoiceSchedule added in v1.0.0

type V1ContractNewParamsCommitInvoiceSchedule struct {
	// Defaults to USD (cents) if not passed.
	CreditTypeID param.Opt[string] `json:"credit_type_id,omitzero" format:"uuid"`
	// This field is only applicable to commit invoice schedules. If true, this
	// schedule will not generate an invoice.
	DoNotInvoice param.Opt[bool] `json:"do_not_invoice,omitzero"`
	// Enter the unit price and quantity for the charge or instead only send the
	// amount. If amount is sent, the unit price is assumed to be the amount and
	// quantity is inferred to be 1.
	RecurringSchedule V1ContractNewParamsCommitInvoiceScheduleRecurringSchedule `json:"recurring_schedule,omitzero"`
	// Either provide amount or provide both unit_price and quantity.
	ScheduleItems []V1ContractNewParamsCommitInvoiceScheduleScheduleItem `json:"schedule_items,omitzero"`
	// contains filtered or unexported fields
}

Required for "POSTPAID" commits: the true up invoice will be generated at this time and only one schedule item is allowed; the total must match access_schedule amount. Optional for "PREPAID" commits: if not provided, this will be a "complimentary" commit with no invoice.

func (V1ContractNewParamsCommitInvoiceSchedule) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsCommitInvoiceSchedule) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsCommitInvoiceSchedule) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsCommitInvoiceSchedule) UnmarshalJSON(data []byte) error

type V1ContractNewParamsCommitInvoiceScheduleRecurringSchedule added in v1.0.0

type V1ContractNewParamsCommitInvoiceScheduleRecurringSchedule struct {
	// Any of "DIVIDED", "DIVIDED_ROUNDED", "EACH".
	AmountDistribution string `json:"amount_distribution,omitzero,required"`
	// RFC 3339 timestamp (exclusive).
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	// Any of "MONTHLY", "QUARTERLY", "SEMI_ANNUAL", "ANNUAL".
	Frequency string `json:"frequency,omitzero,required"`
	// RFC 3339 timestamp (inclusive).
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// Amount for the charge. Can be provided instead of unit_price and quantity. If
	// amount is sent, the unit_price is assumed to be the amount and quantity is
	// inferred to be 1.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount and must be specified with unit_price. If specified amount cannot be
	// provided.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified with quantity. If specified amount cannot be
	// provided.
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

Enter the unit price and quantity for the charge or instead only send the amount. If amount is sent, the unit price is assumed to be the amount and quantity is inferred to be 1.

The properties AmountDistribution, EndingBefore, Frequency, StartingAt are required.

func (V1ContractNewParamsCommitInvoiceScheduleRecurringSchedule) MarshalJSON added in v1.0.0

func (*V1ContractNewParamsCommitInvoiceScheduleRecurringSchedule) UnmarshalJSON added in v1.0.0

type V1ContractNewParamsCommitInvoiceScheduleScheduleItem added in v1.0.0

type V1ContractNewParamsCommitInvoiceScheduleScheduleItem struct {
	// timestamp of the scheduled event
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// Amount for the charge. Can be provided instead of unit_price and quantity. If
	// amount is sent, the unit_price is assumed to be the amount and quantity is
	// inferred to be 1.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount and must be specified with unit_price. If specified amount cannot be
	// provided.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified with quantity. If specified amount cannot be
	// provided.
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

The property Timestamp is required.

func (V1ContractNewParamsCommitInvoiceScheduleScheduleItem) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsCommitInvoiceScheduleScheduleItem) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsCommitInvoiceScheduleScheduleItem) UnmarshalJSON added in v1.0.0

type V1ContractNewParamsCommitPaymentGateConfig added in v1.0.0

type V1ContractNewParamsCommitPaymentGateConfig struct {
	// Gate access to the commit balance based on successful collection of payment.
	// Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
	// facilitate payment using your own payment integration. Select NONE if you do not
	// wish to payment gate the commit balance.
	//
	// Any of "NONE", "STRIPE", "EXTERNAL".
	PaymentGateType string `json:"payment_gate_type,omitzero,required"`
	// Only applicable if using PRECALCULATED as your tax type.
	PrecalculatedTaxConfig V1ContractNewParamsCommitPaymentGateConfigPrecalculatedTaxConfig `json:"precalculated_tax_config,omitzero"`
	// Only applicable if using STRIPE as your payment gate type.
	StripeConfig V1ContractNewParamsCommitPaymentGateConfigStripeConfig `json:"stripe_config,omitzero"`
	// Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
	// not wish Metronome to calculate tax on your behalf. Leaving this field blank
	// will default to NONE.
	//
	// Any of "NONE", "STRIPE", "ANROK", "PRECALCULATED".
	TaxType string `json:"tax_type,omitzero"`
	// contains filtered or unexported fields
}

optionally payment gate this commit

The property PaymentGateType is required.

func (V1ContractNewParamsCommitPaymentGateConfig) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsCommitPaymentGateConfig) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsCommitPaymentGateConfig) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsCommitPaymentGateConfig) UnmarshalJSON(data []byte) error

type V1ContractNewParamsCommitPaymentGateConfigPrecalculatedTaxConfig added in v1.0.0

type V1ContractNewParamsCommitPaymentGateConfigPrecalculatedTaxConfig struct {
	// Amount of tax to be applied. This should be in the same currency and
	// denomination as the commit's invoice schedule
	TaxAmount float64 `json:"tax_amount,required"`
	// Name of the tax to be applied. This may be used in an invoice line item
	// description.
	TaxName param.Opt[string] `json:"tax_name,omitzero"`
	// contains filtered or unexported fields
}

Only applicable if using PRECALCULATED as your tax type.

The property TaxAmount is required.

func (V1ContractNewParamsCommitPaymentGateConfigPrecalculatedTaxConfig) MarshalJSON added in v1.0.0

func (*V1ContractNewParamsCommitPaymentGateConfigPrecalculatedTaxConfig) UnmarshalJSON added in v1.0.0

type V1ContractNewParamsCommitPaymentGateConfigStripeConfig added in v1.0.0

type V1ContractNewParamsCommitPaymentGateConfigStripeConfig struct {
	// If left blank, will default to INVOICE
	//
	// Any of "INVOICE", "PAYMENT_INTENT".
	PaymentType string `json:"payment_type,omitzero,required"`
	// If true, the payment will be made assuming the customer is present (i.e. on
	// session).
	//
	// If false, the payment will be made assuming the customer is not present (i.e.
	// off session). For cardholders from a country with an e-mandate requirement (e.g.
	// India), the payment may be declined.
	//
	// If left blank, will default to false.
	OnSessionPayment param.Opt[bool] `json:"on_session_payment,omitzero"`
	// Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
	// your payment type.
	InvoiceMetadata map[string]string `json:"invoice_metadata,omitzero"`
	// contains filtered or unexported fields
}

Only applicable if using STRIPE as your payment gate type.

The property PaymentType is required.

func (V1ContractNewParamsCommitPaymentGateConfigStripeConfig) MarshalJSON added in v1.0.0

func (*V1ContractNewParamsCommitPaymentGateConfigStripeConfig) UnmarshalJSON added in v1.0.0

type V1ContractNewParamsCredit

type V1ContractNewParamsCredit struct {
	// Schedule for distributing the credit to the customer.
	AccessSchedule V1ContractNewParamsCreditAccessSchedule `json:"access_schedule,omitzero,required"`
	ProductID      string                                  `json:"product_id,required" format:"uuid"`
	// Used only in UI/API. It is not exposed to end customers.
	Description param.Opt[string] `json:"description,omitzero"`
	// displayed on invoices
	Name param.Opt[string] `json:"name,omitzero"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Opt[string] `json:"netsuite_sales_order_id,omitzero"`
	// If multiple credits are applicable, the one with the lower priority will apply
	// first.
	Priority param.Opt[float64] `json:"priority,omitzero"`
	// Which products the credit applies to. If both applicable_product_ids and
	// applicable_product_tags are not provided, the credit applies to all products.
	ApplicableProductIDs []string `json:"applicable_product_ids,omitzero" format:"uuid"`
	// Which tags the credit applies to. If both applicable_product_ids and
	// applicable_product_tags are not provided, the credit applies to all products.
	ApplicableProductTags []string `json:"applicable_product_tags,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// Optional configuration for credit hierarchy access control
	HierarchyConfiguration shared.CommitHierarchyConfigurationParam `json:"hierarchy_configuration,omitzero"`
	// Any of "COMMIT_RATE", "LIST_RATE".
	RateType string `json:"rate_type,omitzero"`
	// List of filters that determine what kind of customer usage draws down a commit
	// or credit. A customer's usage needs to meet the condition of at least one of the
	// specifiers to contribute to a commit's or credit's drawdown. This field cannot
	// be used together with `applicable_product_ids` or `applicable_product_tags`.
	Specifiers []shared.CommitSpecifierInputParam `json:"specifiers,omitzero"`
	// contains filtered or unexported fields
}

The properties AccessSchedule, ProductID are required.

func (V1ContractNewParamsCredit) MarshalJSON

func (r V1ContractNewParamsCredit) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsCredit) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsCredit) UnmarshalJSON(data []byte) error

type V1ContractNewParamsCreditAccessSchedule added in v1.0.0

type V1ContractNewParamsCreditAccessSchedule struct {
	ScheduleItems []V1ContractNewParamsCreditAccessScheduleScheduleItem `json:"schedule_items,omitzero,required"`
	// Defaults to USD (cents) if not passed
	CreditTypeID param.Opt[string] `json:"credit_type_id,omitzero" format:"uuid"`
	// contains filtered or unexported fields
}

Schedule for distributing the credit to the customer.

The property ScheduleItems is required.

func (V1ContractNewParamsCreditAccessSchedule) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsCreditAccessSchedule) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsCreditAccessSchedule) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsCreditAccessSchedule) UnmarshalJSON(data []byte) error

type V1ContractNewParamsCreditAccessScheduleScheduleItem added in v1.0.0

type V1ContractNewParamsCreditAccessScheduleScheduleItem struct {
	Amount float64 `json:"amount,required"`
	// RFC 3339 timestamp (exclusive)
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	// RFC 3339 timestamp (inclusive)
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// contains filtered or unexported fields
}

The properties Amount, EndingBefore, StartingAt are required.

func (V1ContractNewParamsCreditAccessScheduleScheduleItem) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsCreditAccessScheduleScheduleItem) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsCreditAccessScheduleScheduleItem) UnmarshalJSON added in v1.0.0

type V1ContractNewParamsDiscount

type V1ContractNewParamsDiscount struct {
	ProductID string `json:"product_id,required" format:"uuid"`
	// Must provide either schedule_items or recurring_schedule.
	Schedule V1ContractNewParamsDiscountSchedule `json:"schedule,omitzero,required"`
	// displayed on invoices
	Name param.Opt[string] `json:"name,omitzero"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Opt[string] `json:"netsuite_sales_order_id,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// contains filtered or unexported fields
}

The properties ProductID, Schedule are required.

func (V1ContractNewParamsDiscount) MarshalJSON

func (r V1ContractNewParamsDiscount) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsDiscount) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsDiscount) UnmarshalJSON(data []byte) error

type V1ContractNewParamsDiscountSchedule added in v1.0.0

type V1ContractNewParamsDiscountSchedule struct {
	// Defaults to USD (cents) if not passed.
	CreditTypeID param.Opt[string] `json:"credit_type_id,omitzero" format:"uuid"`
	// This field is only applicable to commit invoice schedules. If true, this
	// schedule will not generate an invoice.
	DoNotInvoice param.Opt[bool] `json:"do_not_invoice,omitzero"`
	// Enter the unit price and quantity for the charge or instead only send the
	// amount. If amount is sent, the unit price is assumed to be the amount and
	// quantity is inferred to be 1.
	RecurringSchedule V1ContractNewParamsDiscountScheduleRecurringSchedule `json:"recurring_schedule,omitzero"`
	// Either provide amount or provide both unit_price and quantity.
	ScheduleItems []V1ContractNewParamsDiscountScheduleScheduleItem `json:"schedule_items,omitzero"`
	// contains filtered or unexported fields
}

Must provide either schedule_items or recurring_schedule.

func (V1ContractNewParamsDiscountSchedule) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsDiscountSchedule) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsDiscountSchedule) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsDiscountSchedule) UnmarshalJSON(data []byte) error

type V1ContractNewParamsDiscountScheduleRecurringSchedule added in v1.0.0

type V1ContractNewParamsDiscountScheduleRecurringSchedule struct {
	// Any of "DIVIDED", "DIVIDED_ROUNDED", "EACH".
	AmountDistribution string `json:"amount_distribution,omitzero,required"`
	// RFC 3339 timestamp (exclusive).
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	// Any of "MONTHLY", "QUARTERLY", "SEMI_ANNUAL", "ANNUAL".
	Frequency string `json:"frequency,omitzero,required"`
	// RFC 3339 timestamp (inclusive).
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// Amount for the charge. Can be provided instead of unit_price and quantity. If
	// amount is sent, the unit_price is assumed to be the amount and quantity is
	// inferred to be 1.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount and must be specified with unit_price. If specified amount cannot be
	// provided.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified with quantity. If specified amount cannot be
	// provided.
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

Enter the unit price and quantity for the charge or instead only send the amount. If amount is sent, the unit price is assumed to be the amount and quantity is inferred to be 1.

The properties AmountDistribution, EndingBefore, Frequency, StartingAt are required.

func (V1ContractNewParamsDiscountScheduleRecurringSchedule) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsDiscountScheduleRecurringSchedule) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsDiscountScheduleRecurringSchedule) UnmarshalJSON added in v1.0.0

type V1ContractNewParamsDiscountScheduleScheduleItem added in v1.0.0

type V1ContractNewParamsDiscountScheduleScheduleItem struct {
	// timestamp of the scheduled event
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// Amount for the charge. Can be provided instead of unit_price and quantity. If
	// amount is sent, the unit_price is assumed to be the amount and quantity is
	// inferred to be 1.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount and must be specified with unit_price. If specified amount cannot be
	// provided.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified with quantity. If specified amount cannot be
	// provided.
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

The property Timestamp is required.

func (V1ContractNewParamsDiscountScheduleScheduleItem) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsDiscountScheduleScheduleItem) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsDiscountScheduleScheduleItem) UnmarshalJSON added in v1.0.0

type V1ContractNewParamsHierarchyConfiguration

type V1ContractNewParamsHierarchyConfiguration struct {
	Parent V1ContractNewParamsHierarchyConfigurationParent `json:"parent,omitzero,required"`
	// contains filtered or unexported fields
}

The property Parent is required.

func (V1ContractNewParamsHierarchyConfiguration) MarshalJSON

func (r V1ContractNewParamsHierarchyConfiguration) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsHierarchyConfiguration) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsHierarchyConfiguration) UnmarshalJSON(data []byte) error

type V1ContractNewParamsHierarchyConfigurationParent

type V1ContractNewParamsHierarchyConfigurationParent struct {
	ContractID string `json:"contract_id,required" format:"uuid"`
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// contains filtered or unexported fields
}

The properties ContractID, CustomerID are required.

func (V1ContractNewParamsHierarchyConfigurationParent) MarshalJSON

func (r V1ContractNewParamsHierarchyConfigurationParent) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsHierarchyConfigurationParent) UnmarshalJSON added in v1.0.0

type V1ContractNewParamsMultiplierOverridePrioritization

type V1ContractNewParamsMultiplierOverridePrioritization string

Defaults to LOWEST_MULTIPLIER, which applies the greatest discount to list prices automatically. EXPLICIT prioritization requires specifying priorities for each multiplier; the one with the lowest priority value will be prioritized first. If tiered overrides are used, prioritization must be explicit.

const (
	V1ContractNewParamsMultiplierOverridePrioritizationLowestMultiplier V1ContractNewParamsMultiplierOverridePrioritization = "LOWEST_MULTIPLIER"
	V1ContractNewParamsMultiplierOverridePrioritizationExplicit         V1ContractNewParamsMultiplierOverridePrioritization = "EXPLICIT"
)

type V1ContractNewParamsOverride

type V1ContractNewParamsOverride struct {
	// RFC 3339 timestamp indicating when the override will start applying (inclusive)
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// RFC 3339 timestamp indicating when the override will stop applying (exclusive)
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	Entitled     param.Opt[bool]      `json:"entitled,omitzero"`
	// Indicates whether the override should only apply to commits. Defaults to
	// `false`. If `true`, you can specify relevant commits in `override_specifiers` by
	// passing `commit_ids`. if you do not specify `commit_ids`, then the override will
	// apply when consuming any prepaid or postpaid commit.
	IsCommitSpecific param.Opt[bool] `json:"is_commit_specific,omitzero"`
	// Required for MULTIPLIER type. Must be >=0.
	Multiplier param.Opt[float64] `json:"multiplier,omitzero"`
	// Required for EXPLICIT multiplier prioritization scheme and all TIERED overrides.
	// Under EXPLICIT prioritization, overwrites are prioritized first, and then tiered
	// and multiplier overrides are prioritized by their priority value (lowest first).
	// Must be > 0.
	Priority param.Opt[float64] `json:"priority,omitzero"`
	// ID of the product whose rate is being overridden. Cannot be used in conjunction
	// with override_specifiers.
	ProductID param.Opt[string] `json:"product_id,omitzero" format:"uuid"`
	// tags identifying products whose rates are being overridden. Cannot be used in
	// conjunction with override_specifiers.
	ApplicableProductTags []string `json:"applicable_product_tags,omitzero"`
	// Cannot be used in conjunction with product_id or applicable_product_tags. If
	// provided, the override will apply to all products with the specified specifiers.
	OverrideSpecifiers []V1ContractNewParamsOverrideOverrideSpecifier `json:"override_specifiers,omitzero"`
	// Required for OVERWRITE type.
	OverwriteRate V1ContractNewParamsOverrideOverwriteRate `json:"overwrite_rate,omitzero"`
	// Indicates whether the override applies to commit rates or list rates. Can only
	// be used for overrides that have `is_commit_specific` set to `true`. Defaults to
	// `"LIST_RATE"`.
	//
	// Any of "COMMIT_RATE", "LIST_RATE".
	Target string `json:"target,omitzero"`
	// Required for TIERED type. Must have at least one tier.
	Tiers []V1ContractNewParamsOverrideTier `json:"tiers,omitzero"`
	// Overwrites are prioritized over multipliers and tiered overrides.
	//
	// Any of "OVERWRITE", "MULTIPLIER", "TIERED".
	Type string `json:"type,omitzero"`
	// contains filtered or unexported fields
}

The property StartingAt is required.

func (V1ContractNewParamsOverride) MarshalJSON

func (r V1ContractNewParamsOverride) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsOverride) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsOverride) UnmarshalJSON(data []byte) error

type V1ContractNewParamsOverrideOverrideSpecifier added in v1.0.0

type V1ContractNewParamsOverrideOverrideSpecifier struct {
	// If provided, the override will only apply to the product with the specified ID.
	ProductID param.Opt[string] `json:"product_id,omitzero" format:"uuid"`
	// Any of "MONTHLY", "QUARTERLY", "ANNUAL", "WEEKLY".
	BillingFrequency string `json:"billing_frequency,omitzero"`
	// Can only be used for commit specific overrides. Must be used in conjunction with
	// one of `product_id`, `product_tags`, `pricing_group_values`, or
	// `presentation_group_values`. If provided, the override will only apply to the
	// specified commits. If not provided, the override will apply to all commits.
	CommitIDs []string `json:"commit_ids,omitzero"`
	// A map of group names to values. The override will only apply to line items with
	// the specified presentation group values.
	PresentationGroupValues map[string]string `json:"presentation_group_values,omitzero"`
	// A map of pricing group names to values. The override will only apply to products
	// with the specified pricing group values.
	PricingGroupValues map[string]string `json:"pricing_group_values,omitzero"`
	// If provided, the override will only apply to products with all the specified
	// tags.
	ProductTags []string `json:"product_tags,omitzero"`
	// Can only be used for commit specific overrides. Must be used in conjunction with
	// one of `product_id`, `product_tags`, `pricing_group_values`, or
	// `presentation_group_values`. If provided, the override will only apply to
	// commits created by the specified recurring commit ids.
	RecurringCommitIDs []string `json:"recurring_commit_ids,omitzero"`
	// Can only be used for commit specific overrides. Must be used in conjunction with
	// one of `product_id`, `product_tags`, `pricing_group_values`, or
	// `presentation_group_values`. If provided, the override will only apply to
	// credits created by the specified recurring credit ids.
	RecurringCreditIDs []string `json:"recurring_credit_ids,omitzero"`
	// contains filtered or unexported fields
}

func (V1ContractNewParamsOverrideOverrideSpecifier) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsOverrideOverrideSpecifier) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsOverrideOverrideSpecifier) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsOverrideOverrideSpecifier) UnmarshalJSON(data []byte) error

type V1ContractNewParamsOverrideOverwriteRate added in v1.0.0

type V1ContractNewParamsOverrideOverwriteRate struct {
	// Any of "FLAT", "PERCENTAGE", "SUBSCRIPTION", "TIERED", "CUSTOM".
	RateType     string            `json:"rate_type,omitzero,required"`
	CreditTypeID param.Opt[string] `json:"credit_type_id,omitzero" format:"uuid"`
	// Default proration configuration. Only valid for SUBSCRIPTION rate_type. Must be
	// set to true.
	IsProrated param.Opt[bool] `json:"is_prorated,omitzero"`
	// Default price. For FLAT rate_type, this must be >=0. For PERCENTAGE rate_type,
	// this is a decimal fraction, e.g. use 0.1 for 10%; this must be >=0 and <=1.
	Price param.Opt[float64] `json:"price,omitzero"`
	// Default quantity. For SUBSCRIPTION rate_type, this must be >=0.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Only set for CUSTOM rate_type. This field is interpreted by custom rate
	// processors.
	CustomRate map[string]any `json:"custom_rate,omitzero"`
	// Only set for TIERED rate_type.
	Tiers []shared.TierParam `json:"tiers,omitzero"`
	// contains filtered or unexported fields
}

Required for OVERWRITE type.

The property RateType is required.

func (V1ContractNewParamsOverrideOverwriteRate) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsOverrideOverwriteRate) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsOverrideOverwriteRate) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsOverrideOverwriteRate) UnmarshalJSON(data []byte) error

type V1ContractNewParamsOverrideTier added in v1.0.0

type V1ContractNewParamsOverrideTier struct {
	Multiplier float64            `json:"multiplier,required"`
	Size       param.Opt[float64] `json:"size,omitzero"`
	// contains filtered or unexported fields
}

The property Multiplier is required.

func (V1ContractNewParamsOverrideTier) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsOverrideTier) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsOverrideTier) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsOverrideTier) UnmarshalJSON(data []byte) error

type V1ContractNewParamsProfessionalService

type V1ContractNewParamsProfessionalService struct {
	// Maximum amount for the term.
	MaxAmount float64 `json:"max_amount,required"`
	ProductID string  `json:"product_id,required" format:"uuid"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount.
	Quantity float64 `json:"quantity,required"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified.
	UnitPrice   float64           `json:"unit_price,required"`
	Description param.Opt[string] `json:"description,omitzero"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Opt[string] `json:"netsuite_sales_order_id,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// contains filtered or unexported fields
}

The properties MaxAmount, ProductID, Quantity, UnitPrice are required.

func (V1ContractNewParamsProfessionalService) MarshalJSON

func (r V1ContractNewParamsProfessionalService) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsProfessionalService) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsProfessionalService) UnmarshalJSON(data []byte) error

type V1ContractNewParamsRecurringCommit

type V1ContractNewParamsRecurringCommit struct {
	// The amount of commit to grant.
	AccessAmount V1ContractNewParamsRecurringCommitAccessAmount `json:"access_amount,omitzero,required"`
	// Defines the length of the access schedule for each created commit/credit. The
	// value represents the number of units. Unit defaults to "PERIODS", where the
	// length of a period is determined by the recurrence_frequency.
	CommitDuration V1ContractNewParamsRecurringCommitCommitDuration `json:"commit_duration,omitzero,required"`
	// Will be passed down to the individual commits
	Priority  float64 `json:"priority,required"`
	ProductID string  `json:"product_id,required" format:"uuid"`
	// determines the start time for the first commit
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// Will be passed down to the individual commits
	Description param.Opt[string] `json:"description,omitzero"`
	// Determines when the contract will stop creating recurring commits. optional
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	// displayed on invoices. will be passed through to the individual commits
	Name param.Opt[string] `json:"name,omitzero"`
	// Will be passed down to the individual commits
	NetsuiteSalesOrderID param.Opt[string] `json:"netsuite_sales_order_id,omitzero"`
	// Will be passed down to the individual commits. This controls how much of an
	// individual unexpired commit will roll over upon contract transition. Must be
	// between 0 and 1.
	RolloverFraction param.Opt[float64] `json:"rollover_fraction,omitzero"`
	// A temporary ID that can be used to reference the recurring commit for commit
	// specific overrides.
	TemporaryID param.Opt[string] `json:"temporary_id,omitzero"`
	// Will be passed down to the individual commits
	ApplicableProductIDs []string `json:"applicable_product_ids,omitzero" format:"uuid"`
	// Will be passed down to the individual commits
	ApplicableProductTags []string `json:"applicable_product_tags,omitzero"`
	// Optional configuration for recurring commit/credit hierarchy access control
	HierarchyConfiguration shared.CommitHierarchyConfigurationParam `json:"hierarchy_configuration,omitzero"`
	// The amount the customer should be billed for the commit. Not required.
	InvoiceAmount V1ContractNewParamsRecurringCommitInvoiceAmount `json:"invoice_amount,omitzero"`
	// Determines whether the first and last commit will be prorated. If not provided,
	// the default is FIRST_AND_LAST (i.e. prorate both the first and last commits).
	//
	// Any of "NONE", "FIRST", "LAST", "FIRST_AND_LAST".
	Proration string `json:"proration,omitzero"`
	// Whether the created commits will use the commit rate or list rate
	//
	// Any of "COMMIT_RATE", "LIST_RATE".
	RateType string `json:"rate_type,omitzero"`
	// The frequency at which the recurring commits will be created. If not provided: -
	// The commits will be created on the usage invoice frequency. If provided: - The
	// period defined in the duration will correspond to this frequency. - Commits will
	// be created aligned with the recurring commit's starting_at rather than the usage
	// invoice dates.
	//
	// Any of "MONTHLY", "QUARTERLY", "ANNUAL", "WEEKLY".
	RecurrenceFrequency string `json:"recurrence_frequency,omitzero"`
	// List of filters that determine what kind of customer usage draws down a commit
	// or credit. A customer's usage needs to meet the condition of at least one of the
	// specifiers to contribute to a commit's or credit's drawdown. This field cannot
	// be used together with `applicable_product_ids` or `applicable_product_tags`.
	Specifiers []shared.CommitSpecifierInputParam `json:"specifiers,omitzero"`
	// Attach a subscription to the recurring commit/credit.
	SubscriptionConfig V1ContractNewParamsRecurringCommitSubscriptionConfig `json:"subscription_config,omitzero"`
	// contains filtered or unexported fields
}

The properties AccessAmount, CommitDuration, Priority, ProductID, StartingAt are required.

func (V1ContractNewParamsRecurringCommit) MarshalJSON

func (r V1ContractNewParamsRecurringCommit) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsRecurringCommit) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsRecurringCommit) UnmarshalJSON(data []byte) error

type V1ContractNewParamsRecurringCommitAccessAmount added in v1.0.0

type V1ContractNewParamsRecurringCommitAccessAmount struct {
	CreditTypeID string  `json:"credit_type_id,required" format:"uuid"`
	UnitPrice    float64 `json:"unit_price,required"`
	// This field is required unless a subscription is attached via
	// `subscription_config`.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// contains filtered or unexported fields
}

The amount of commit to grant.

The properties CreditTypeID, UnitPrice are required.

func (V1ContractNewParamsRecurringCommitAccessAmount) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsRecurringCommitAccessAmount) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsRecurringCommitAccessAmount) UnmarshalJSON added in v1.0.0

type V1ContractNewParamsRecurringCommitCommitDuration added in v1.0.0

type V1ContractNewParamsRecurringCommitCommitDuration struct {
	Value float64 `json:"value,required"`
	// Any of "PERIODS".
	Unit string `json:"unit,omitzero"`
	// contains filtered or unexported fields
}

Defines the length of the access schedule for each created commit/credit. The value represents the number of units. Unit defaults to "PERIODS", where the length of a period is determined by the recurrence_frequency.

The property Value is required.

func (V1ContractNewParamsRecurringCommitCommitDuration) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsRecurringCommitCommitDuration) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsRecurringCommitCommitDuration) UnmarshalJSON added in v1.0.0

type V1ContractNewParamsRecurringCommitInvoiceAmount added in v1.0.0

type V1ContractNewParamsRecurringCommitInvoiceAmount struct {
	CreditTypeID string  `json:"credit_type_id,required" format:"uuid"`
	Quantity     float64 `json:"quantity,required"`
	UnitPrice    float64 `json:"unit_price,required"`
	// contains filtered or unexported fields
}

The amount the customer should be billed for the commit. Not required.

The properties CreditTypeID, Quantity, UnitPrice are required.

func (V1ContractNewParamsRecurringCommitInvoiceAmount) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsRecurringCommitInvoiceAmount) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsRecurringCommitInvoiceAmount) UnmarshalJSON added in v1.0.0

type V1ContractNewParamsRecurringCommitSubscriptionConfig added in v1.0.0

type V1ContractNewParamsRecurringCommitSubscriptionConfig struct {
	ApplySeatIncreaseConfig V1ContractNewParamsRecurringCommitSubscriptionConfigApplySeatIncreaseConfig `json:"apply_seat_increase_config,omitzero,required"`
	// ID of the subscription to configure on the recurring commit/credit.
	SubscriptionID string `json:"subscription_id,required"`
	// If set to POOLED, allocation added per seat is pooled across the account.
	//
	// Any of "INDIVIDUAL", "POOLED".
	Allocation string `json:"allocation,omitzero"`
	// contains filtered or unexported fields
}

Attach a subscription to the recurring commit/credit.

The properties ApplySeatIncreaseConfig, SubscriptionID are required.

func (V1ContractNewParamsRecurringCommitSubscriptionConfig) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsRecurringCommitSubscriptionConfig) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsRecurringCommitSubscriptionConfig) UnmarshalJSON added in v1.0.0

type V1ContractNewParamsRecurringCommitSubscriptionConfigApplySeatIncreaseConfig added in v1.0.0

type V1ContractNewParamsRecurringCommitSubscriptionConfigApplySeatIncreaseConfig struct {
	// Indicates whether a mid-period seat increase should be prorated.
	IsProrated bool `json:"is_prorated,required"`
	// contains filtered or unexported fields
}

The property IsProrated is required.

func (V1ContractNewParamsRecurringCommitSubscriptionConfigApplySeatIncreaseConfig) MarshalJSON added in v1.0.0

func (*V1ContractNewParamsRecurringCommitSubscriptionConfigApplySeatIncreaseConfig) UnmarshalJSON added in v1.0.0

type V1ContractNewParamsRecurringCredit

type V1ContractNewParamsRecurringCredit struct {
	// The amount of commit to grant.
	AccessAmount V1ContractNewParamsRecurringCreditAccessAmount `json:"access_amount,omitzero,required"`
	// Defines the length of the access schedule for each created commit/credit. The
	// value represents the number of units. Unit defaults to "PERIODS", where the
	// length of a period is determined by the recurrence_frequency.
	CommitDuration V1ContractNewParamsRecurringCreditCommitDuration `json:"commit_duration,omitzero,required"`
	// Will be passed down to the individual commits
	Priority  float64 `json:"priority,required"`
	ProductID string  `json:"product_id,required" format:"uuid"`
	// determines the start time for the first commit
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// Will be passed down to the individual commits
	Description param.Opt[string] `json:"description,omitzero"`
	// Determines when the contract will stop creating recurring commits. optional
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	// displayed on invoices. will be passed through to the individual commits
	Name param.Opt[string] `json:"name,omitzero"`
	// Will be passed down to the individual commits
	NetsuiteSalesOrderID param.Opt[string] `json:"netsuite_sales_order_id,omitzero"`
	// Will be passed down to the individual commits. This controls how much of an
	// individual unexpired commit will roll over upon contract transition. Must be
	// between 0 and 1.
	RolloverFraction param.Opt[float64] `json:"rollover_fraction,omitzero"`
	// A temporary ID that can be used to reference the recurring commit for commit
	// specific overrides.
	TemporaryID param.Opt[string] `json:"temporary_id,omitzero"`
	// Will be passed down to the individual commits
	ApplicableProductIDs []string `json:"applicable_product_ids,omitzero" format:"uuid"`
	// Will be passed down to the individual commits
	ApplicableProductTags []string `json:"applicable_product_tags,omitzero"`
	// Optional configuration for recurring commit/credit hierarchy access control
	HierarchyConfiguration shared.CommitHierarchyConfigurationParam `json:"hierarchy_configuration,omitzero"`
	// Determines whether the first and last commit will be prorated. If not provided,
	// the default is FIRST_AND_LAST (i.e. prorate both the first and last commits).
	//
	// Any of "NONE", "FIRST", "LAST", "FIRST_AND_LAST".
	Proration string `json:"proration,omitzero"`
	// Whether the created commits will use the commit rate or list rate
	//
	// Any of "COMMIT_RATE", "LIST_RATE".
	RateType string `json:"rate_type,omitzero"`
	// The frequency at which the recurring commits will be created. If not provided: -
	// The commits will be created on the usage invoice frequency. If provided: - The
	// period defined in the duration will correspond to this frequency. - Commits will
	// be created aligned with the recurring commit's starting_at rather than the usage
	// invoice dates.
	//
	// Any of "MONTHLY", "QUARTERLY", "ANNUAL", "WEEKLY".
	RecurrenceFrequency string `json:"recurrence_frequency,omitzero"`
	// List of filters that determine what kind of customer usage draws down a commit
	// or credit. A customer's usage needs to meet the condition of at least one of the
	// specifiers to contribute to a commit's or credit's drawdown. This field cannot
	// be used together with `applicable_product_ids` or `applicable_product_tags`.
	Specifiers []shared.CommitSpecifierInputParam `json:"specifiers,omitzero"`
	// Attach a subscription to the recurring commit/credit.
	SubscriptionConfig V1ContractNewParamsRecurringCreditSubscriptionConfig `json:"subscription_config,omitzero"`
	// contains filtered or unexported fields
}

The properties AccessAmount, CommitDuration, Priority, ProductID, StartingAt are required.

func (V1ContractNewParamsRecurringCredit) MarshalJSON

func (r V1ContractNewParamsRecurringCredit) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsRecurringCredit) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsRecurringCredit) UnmarshalJSON(data []byte) error

type V1ContractNewParamsRecurringCreditAccessAmount added in v1.0.0

type V1ContractNewParamsRecurringCreditAccessAmount struct {
	CreditTypeID string  `json:"credit_type_id,required" format:"uuid"`
	UnitPrice    float64 `json:"unit_price,required"`
	// This field is required unless a subscription is attached via
	// `subscription_config`.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// contains filtered or unexported fields
}

The amount of commit to grant.

The properties CreditTypeID, UnitPrice are required.

func (V1ContractNewParamsRecurringCreditAccessAmount) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsRecurringCreditAccessAmount) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsRecurringCreditAccessAmount) UnmarshalJSON added in v1.0.0

type V1ContractNewParamsRecurringCreditCommitDuration added in v1.0.0

type V1ContractNewParamsRecurringCreditCommitDuration struct {
	Value float64 `json:"value,required"`
	// Any of "PERIODS".
	Unit string `json:"unit,omitzero"`
	// contains filtered or unexported fields
}

Defines the length of the access schedule for each created commit/credit. The value represents the number of units. Unit defaults to "PERIODS", where the length of a period is determined by the recurrence_frequency.

The property Value is required.

func (V1ContractNewParamsRecurringCreditCommitDuration) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsRecurringCreditCommitDuration) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsRecurringCreditCommitDuration) UnmarshalJSON added in v1.0.0

type V1ContractNewParamsRecurringCreditSubscriptionConfig added in v1.0.0

type V1ContractNewParamsRecurringCreditSubscriptionConfig struct {
	ApplySeatIncreaseConfig V1ContractNewParamsRecurringCreditSubscriptionConfigApplySeatIncreaseConfig `json:"apply_seat_increase_config,omitzero,required"`
	// ID of the subscription to configure on the recurring commit/credit.
	SubscriptionID string `json:"subscription_id,required"`
	// If set to POOLED, allocation added per seat is pooled across the account.
	//
	// Any of "INDIVIDUAL", "POOLED".
	Allocation string `json:"allocation,omitzero"`
	// contains filtered or unexported fields
}

Attach a subscription to the recurring commit/credit.

The properties ApplySeatIncreaseConfig, SubscriptionID are required.

func (V1ContractNewParamsRecurringCreditSubscriptionConfig) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsRecurringCreditSubscriptionConfig) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsRecurringCreditSubscriptionConfig) UnmarshalJSON added in v1.0.0

type V1ContractNewParamsRecurringCreditSubscriptionConfigApplySeatIncreaseConfig added in v1.0.0

type V1ContractNewParamsRecurringCreditSubscriptionConfigApplySeatIncreaseConfig struct {
	// Indicates whether a mid-period seat increase should be prorated.
	IsProrated bool `json:"is_prorated,required"`
	// contains filtered or unexported fields
}

The property IsProrated is required.

func (V1ContractNewParamsRecurringCreditSubscriptionConfigApplySeatIncreaseConfig) MarshalJSON added in v1.0.0

func (*V1ContractNewParamsRecurringCreditSubscriptionConfigApplySeatIncreaseConfig) UnmarshalJSON added in v1.0.0

type V1ContractNewParamsResellerRoyalty

type V1ContractNewParamsResellerRoyalty struct {
	Fraction           float64 `json:"fraction,required"`
	NetsuiteResellerID string  `json:"netsuite_reseller_id,required"`
	// Any of "AWS", "AWS_PRO_SERVICE", "GCP", "GCP_PRO_SERVICE".
	ResellerType          string               `json:"reseller_type,omitzero,required"`
	StartingAt            time.Time            `json:"starting_at,required" format:"date-time"`
	EndingBefore          param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	ResellerContractValue param.Opt[float64]   `json:"reseller_contract_value,omitzero"`
	// Must provide at least one of applicable_product_ids or applicable_product_tags.
	ApplicableProductIDs []string `json:"applicable_product_ids,omitzero" format:"uuid"`
	// Must provide at least one of applicable_product_ids or applicable_product_tags.
	ApplicableProductTags []string                                     `json:"applicable_product_tags,omitzero"`
	AwsOptions            V1ContractNewParamsResellerRoyaltyAwsOptions `json:"aws_options,omitzero"`
	GcpOptions            V1ContractNewParamsResellerRoyaltyGcpOptions `json:"gcp_options,omitzero"`
	// contains filtered or unexported fields
}

The properties Fraction, NetsuiteResellerID, ResellerType, StartingAt are required.

func (V1ContractNewParamsResellerRoyalty) MarshalJSON

func (r V1ContractNewParamsResellerRoyalty) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsResellerRoyalty) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsResellerRoyalty) UnmarshalJSON(data []byte) error

type V1ContractNewParamsResellerRoyaltyAwsOptions added in v1.0.0

type V1ContractNewParamsResellerRoyaltyAwsOptions struct {
	AwsAccountNumber    param.Opt[string] `json:"aws_account_number,omitzero"`
	AwsOfferID          param.Opt[string] `json:"aws_offer_id,omitzero"`
	AwsPayerReferenceID param.Opt[string] `json:"aws_payer_reference_id,omitzero"`
	// contains filtered or unexported fields
}

func (V1ContractNewParamsResellerRoyaltyAwsOptions) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsResellerRoyaltyAwsOptions) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsResellerRoyaltyAwsOptions) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsResellerRoyaltyAwsOptions) UnmarshalJSON(data []byte) error

type V1ContractNewParamsResellerRoyaltyGcpOptions added in v1.0.0

type V1ContractNewParamsResellerRoyaltyGcpOptions struct {
	GcpAccountID param.Opt[string] `json:"gcp_account_id,omitzero"`
	GcpOfferID   param.Opt[string] `json:"gcp_offer_id,omitzero"`
	// contains filtered or unexported fields
}

func (V1ContractNewParamsResellerRoyaltyGcpOptions) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsResellerRoyaltyGcpOptions) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsResellerRoyaltyGcpOptions) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsResellerRoyaltyGcpOptions) UnmarshalJSON(data []byte) error

type V1ContractNewParamsScheduledCharge

type V1ContractNewParamsScheduledCharge struct {
	ProductID string `json:"product_id,required" format:"uuid"`
	// Must provide either schedule_items or recurring_schedule.
	Schedule V1ContractNewParamsScheduledChargeSchedule `json:"schedule,omitzero,required"`
	// displayed on invoices
	Name param.Opt[string] `json:"name,omitzero"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Opt[string] `json:"netsuite_sales_order_id,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// contains filtered or unexported fields
}

The properties ProductID, Schedule are required.

func (V1ContractNewParamsScheduledCharge) MarshalJSON

func (r V1ContractNewParamsScheduledCharge) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsScheduledCharge) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsScheduledCharge) UnmarshalJSON(data []byte) error

type V1ContractNewParamsScheduledChargeSchedule added in v1.0.0

type V1ContractNewParamsScheduledChargeSchedule struct {
	// Defaults to USD (cents) if not passed.
	CreditTypeID param.Opt[string] `json:"credit_type_id,omitzero" format:"uuid"`
	// This field is only applicable to commit invoice schedules. If true, this
	// schedule will not generate an invoice.
	DoNotInvoice param.Opt[bool] `json:"do_not_invoice,omitzero"`
	// Enter the unit price and quantity for the charge or instead only send the
	// amount. If amount is sent, the unit price is assumed to be the amount and
	// quantity is inferred to be 1.
	RecurringSchedule V1ContractNewParamsScheduledChargeScheduleRecurringSchedule `json:"recurring_schedule,omitzero"`
	// Either provide amount or provide both unit_price and quantity.
	ScheduleItems []V1ContractNewParamsScheduledChargeScheduleScheduleItem `json:"schedule_items,omitzero"`
	// contains filtered or unexported fields
}

Must provide either schedule_items or recurring_schedule.

func (V1ContractNewParamsScheduledChargeSchedule) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsScheduledChargeSchedule) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsScheduledChargeSchedule) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsScheduledChargeSchedule) UnmarshalJSON(data []byte) error

type V1ContractNewParamsScheduledChargeScheduleRecurringSchedule added in v1.0.0

type V1ContractNewParamsScheduledChargeScheduleRecurringSchedule struct {
	// Any of "DIVIDED", "DIVIDED_ROUNDED", "EACH".
	AmountDistribution string `json:"amount_distribution,omitzero,required"`
	// RFC 3339 timestamp (exclusive).
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	// Any of "MONTHLY", "QUARTERLY", "SEMI_ANNUAL", "ANNUAL".
	Frequency string `json:"frequency,omitzero,required"`
	// RFC 3339 timestamp (inclusive).
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// Amount for the charge. Can be provided instead of unit_price and quantity. If
	// amount is sent, the unit_price is assumed to be the amount and quantity is
	// inferred to be 1.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount and must be specified with unit_price. If specified amount cannot be
	// provided.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified with quantity. If specified amount cannot be
	// provided.
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

Enter the unit price and quantity for the charge or instead only send the amount. If amount is sent, the unit price is assumed to be the amount and quantity is inferred to be 1.

The properties AmountDistribution, EndingBefore, Frequency, StartingAt are required.

func (V1ContractNewParamsScheduledChargeScheduleRecurringSchedule) MarshalJSON added in v1.0.0

func (*V1ContractNewParamsScheduledChargeScheduleRecurringSchedule) UnmarshalJSON added in v1.0.0

type V1ContractNewParamsScheduledChargeScheduleScheduleItem added in v1.0.0

type V1ContractNewParamsScheduledChargeScheduleScheduleItem struct {
	// timestamp of the scheduled event
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// Amount for the charge. Can be provided instead of unit_price and quantity. If
	// amount is sent, the unit_price is assumed to be the amount and quantity is
	// inferred to be 1.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount and must be specified with unit_price. If specified amount cannot be
	// provided.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified with quantity. If specified amount cannot be
	// provided.
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

The property Timestamp is required.

func (V1ContractNewParamsScheduledChargeScheduleScheduleItem) MarshalJSON added in v1.0.0

func (*V1ContractNewParamsScheduledChargeScheduleScheduleItem) UnmarshalJSON added in v1.0.0

type V1ContractNewParamsScheduledChargesOnUsageInvoices

type V1ContractNewParamsScheduledChargesOnUsageInvoices string

Determines which scheduled and commit charges to consolidate onto the Contract's usage invoice. The charge's `timestamp` must match the usage invoice's `ending_before` date for consolidation to occur. This field cannot be modified after a Contract has been created. If this field is omitted, charges will appear on a separate invoice from usage charges.

const (
	V1ContractNewParamsScheduledChargesOnUsageInvoicesAll V1ContractNewParamsScheduledChargesOnUsageInvoices = "ALL"
)

type V1ContractNewParamsSubscription

type V1ContractNewParamsSubscription struct {
	// Any of "ADVANCE", "ARREARS".
	CollectionSchedule string                                          `json:"collection_schedule,omitzero,required"`
	Proration          V1ContractNewParamsSubscriptionProration        `json:"proration,omitzero,required"`
	SubscriptionRate   V1ContractNewParamsSubscriptionSubscriptionRate `json:"subscription_rate,omitzero,required"`
	Description        param.Opt[string]                               `json:"description,omitzero"`
	// Exclusive end time for the subscription. If not provided, subscription inherits
	// contract end date.
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	// The initial quantity for the subscription. It must be non-negative value.
	// Required if quantity_management_mode is QUANTITY_ONLY.
	InitialQuantity param.Opt[float64] `json:"initial_quantity,omitzero"`
	Name            param.Opt[string]  `json:"name,omitzero"`
	// Inclusive start time for the subscription. If not provided, defaults to contract
	// start date
	StartingAt param.Opt[time.Time] `json:"starting_at,omitzero" format:"date-time"`
	// A temporary ID used to reference the subscription in recurring commit/credit
	// subscription configs created within the same payload.
	TemporaryID param.Opt[string] `json:"temporary_id,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// Determines how the subscription's quantity is controlled. Defaults to
	// QUANTITY_ONLY. **QUANTITY_ONLY**: The subscription quantity is specified
	// directly on the subscription. `initial_quantity` must be provided with this
	// option. Compatible with recurring commits/credits that use POOLED allocation.
	//
	// Any of "SEAT_BASED", "QUANTITY_ONLY".
	QuantityManagementMode string `json:"quantity_management_mode,omitzero"`
	// contains filtered or unexported fields
}

The properties CollectionSchedule, Proration, SubscriptionRate are required.

func (V1ContractNewParamsSubscription) MarshalJSON

func (r V1ContractNewParamsSubscription) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsSubscription) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsSubscription) UnmarshalJSON(data []byte) error

type V1ContractNewParamsSubscriptionProration added in v1.0.0

type V1ContractNewParamsSubscriptionProration struct {
	// Indicates if the partial period will be prorated or charged a full amount.
	IsProrated param.Opt[bool] `json:"is_prorated,omitzero"`
	// Indicates how mid-period quantity adjustments are invoiced.
	// **BILL_IMMEDIATELY**: Only available when collection schedule is `ADVANCE`. The
	// quantity increase will be billed immediately on the scheduled date.
	// **BILL_ON_NEXT_COLLECTION_DATE**: The quantity increase will be billed for
	// in-arrears at the end of the period.
	//
	// Any of "BILL_IMMEDIATELY", "BILL_ON_NEXT_COLLECTION_DATE".
	InvoiceBehavior string `json:"invoice_behavior,omitzero"`
	// contains filtered or unexported fields
}

func (V1ContractNewParamsSubscriptionProration) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsSubscriptionProration) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsSubscriptionProration) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsSubscriptionProration) UnmarshalJSON(data []byte) error

type V1ContractNewParamsSubscriptionSubscriptionRate added in v1.0.0

type V1ContractNewParamsSubscriptionSubscriptionRate struct {
	// Frequency to bill subscription with. Together with product_id, must match
	// existing rate on the rate card.
	//
	// Any of "MONTHLY", "QUARTERLY", "ANNUAL", "WEEKLY".
	BillingFrequency string `json:"billing_frequency,omitzero,required"`
	// Must be subscription type product
	ProductID string `json:"product_id,required" format:"uuid"`
	// contains filtered or unexported fields
}

The properties BillingFrequency, ProductID are required.

func (V1ContractNewParamsSubscriptionSubscriptionRate) MarshalJSON added in v1.0.0

func (r V1ContractNewParamsSubscriptionSubscriptionRate) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsSubscriptionSubscriptionRate) UnmarshalJSON added in v1.0.0

type V1ContractNewParamsTransition

type V1ContractNewParamsTransition struct {
	FromContractID string `json:"from_contract_id,required" format:"uuid"`
	// This field's available values may vary based on your client's configuration.
	//
	// Any of "SUPERSEDE", "RENEWAL".
	Type                  string                                             `json:"type,omitzero,required"`
	FutureInvoiceBehavior V1ContractNewParamsTransitionFutureInvoiceBehavior `json:"future_invoice_behavior,omitzero"`
	// contains filtered or unexported fields
}

The properties FromContractID, Type are required.

func (V1ContractNewParamsTransition) MarshalJSON

func (r V1ContractNewParamsTransition) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsTransition) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsTransition) UnmarshalJSON(data []byte) error

type V1ContractNewParamsTransitionFutureInvoiceBehavior

type V1ContractNewParamsTransitionFutureInvoiceBehavior struct {
	// Controls whether future trueup invoices are billed or removed. Default behavior
	// is AS_IS if not specified.
	//
	// Any of "REMOVE", "AS_IS".
	Trueup string `json:"trueup,omitzero"`
	// contains filtered or unexported fields
}

func (V1ContractNewParamsTransitionFutureInvoiceBehavior) MarshalJSON

func (r V1ContractNewParamsTransitionFutureInvoiceBehavior) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsTransitionFutureInvoiceBehavior) UnmarshalJSON added in v1.0.0

type V1ContractNewParamsUsageStatementSchedule

type V1ContractNewParamsUsageStatementSchedule struct {
	// Any of "MONTHLY", "QUARTERLY", "ANNUAL", "WEEKLY".
	Frequency string `json:"frequency,omitzero,required"`
	// Required when using CUSTOM_DATE. This option lets you set a historical billing
	// anchor date, aligning future billing cycles with a chosen cadence. For example,
	// if a contract starts on 2024-09-15 and you set the anchor date to 2024-09-10
	// with a MONTHLY frequency, the first usage statement will cover 09-15 to 10-10.
	// Subsequent statements will follow the 10th of each month.
	BillingAnchorDate param.Opt[time.Time] `json:"billing_anchor_date,omitzero" format:"date-time"`
	// The date Metronome should start generating usage invoices. If unspecified,
	// contract start date will be used. This is useful to set if you want to import
	// historical invoices via our 'Create Historical Invoices' API rather than having
	// Metronome automatically generate them.
	InvoiceGenerationStartingAt param.Opt[time.Time] `json:"invoice_generation_starting_at,omitzero" format:"date-time"`
	// If not provided, defaults to the first day of the month.
	//
	// Any of "FIRST_OF_MONTH", "CONTRACT_START", "CUSTOM_DATE".
	Day string `json:"day,omitzero"`
	// contains filtered or unexported fields
}

The property Frequency is required.

func (V1ContractNewParamsUsageStatementSchedule) MarshalJSON

func (r V1ContractNewParamsUsageStatementSchedule) MarshalJSON() (data []byte, err error)

func (*V1ContractNewParamsUsageStatementSchedule) UnmarshalJSON added in v1.0.0

func (r *V1ContractNewParamsUsageStatementSchedule) UnmarshalJSON(data []byte) error

type V1ContractNewResponse

type V1ContractNewResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractNewResponse) RawJSON added in v1.0.0

func (r V1ContractNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1ContractNewResponse) UnmarshalJSON

func (r *V1ContractNewResponse) UnmarshalJSON(data []byte) error

type V1ContractProductArchiveParams

type V1ContractProductArchiveParams struct {
	// ID of the product to be archived
	ProductID string `json:"product_id,required" format:"uuid"`
	// contains filtered or unexported fields
}

func (V1ContractProductArchiveParams) MarshalJSON

func (r V1ContractProductArchiveParams) MarshalJSON() (data []byte, err error)

func (*V1ContractProductArchiveParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractProductArchiveParams) UnmarshalJSON(data []byte) error

type V1ContractProductArchiveResponse

type V1ContractProductArchiveResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractProductArchiveResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractProductArchiveResponse) UnmarshalJSON

func (r *V1ContractProductArchiveResponse) UnmarshalJSON(data []byte) error

type V1ContractProductGetParams

type V1ContractProductGetParams struct {
	ID shared.IDParam
	// contains filtered or unexported fields
}

func (V1ContractProductGetParams) MarshalJSON

func (r V1ContractProductGetParams) MarshalJSON() (data []byte, err error)

func (*V1ContractProductGetParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractProductGetParams) UnmarshalJSON(data []byte) error

type V1ContractProductGetResponse

type V1ContractProductGetResponse struct {
	Data V1ContractProductGetResponseData `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractProductGetResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractProductGetResponse) UnmarshalJSON

func (r *V1ContractProductGetResponse) UnmarshalJSON(data []byte) error

type V1ContractProductGetResponseData

type V1ContractProductGetResponseData struct {
	ID      string               `json:"id,required" format:"uuid"`
	Current ProductListItemState `json:"current,required"`
	Initial ProductListItemState `json:"initial,required"`
	// Any of "USAGE", "SUBSCRIPTION", "COMPOSITE", "FIXED", "PRO_SERVICE".
	Type       string                                   `json:"type,required"`
	Updates    []V1ContractProductGetResponseDataUpdate `json:"updates,required"`
	ArchivedAt time.Time                                `json:"archived_at,nullable" format:"date-time"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID           respjson.Field
		Current      respjson.Field
		Initial      respjson.Field
		Type         respjson.Field
		Updates      respjson.Field
		ArchivedAt   respjson.Field
		CustomFields respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractProductGetResponseData) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractProductGetResponseData) UnmarshalJSON

func (r *V1ContractProductGetResponseData) UnmarshalJSON(data []byte) error

type V1ContractProductGetResponseDataUpdate

type V1ContractProductGetResponseDataUpdate struct {
	CreatedAt           time.Time `json:"created_at,required" format:"date-time"`
	CreatedBy           string    `json:"created_by,required"`
	BillableMetricID    string    `json:"billable_metric_id" format:"uuid"`
	CompositeProductIDs []string  `json:"composite_product_ids" format:"uuid"`
	CompositeTags       []string  `json:"composite_tags"`
	ExcludeFreeUsage    bool      `json:"exclude_free_usage"`
	IsRefundable        bool      `json:"is_refundable"`
	Name                string    `json:"name"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteInternalItemID string `json:"netsuite_internal_item_id"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteOverageItemID string `json:"netsuite_overage_item_id"`
	// For USAGE products only. Groups usage line items on invoices. The superset of
	// values in the pricing group key and presentation group key must be set as one
	// compound group key on the billable metric.
	PresentationGroupKey []string `json:"presentation_group_key"`
	// For USAGE products only. If set, pricing for this product will be determined for
	// each pricing_group_key value, as opposed to the product as a whole. The superset
	// of values in the pricing group key and presentation group key must be set as one
	// compound group key on the billable metric.
	PricingGroupKey []string `json:"pricing_group_key"`
	// Optional. Only valid for USAGE products. If provided, the quantity will be
	// converted using the provided conversion factor and operation. For example, if
	// the operation is "multiply" and the conversion factor is 100, then the quantity
	// will be multiplied by 100. This can be used in cases where data is sent in one
	// unit and priced in another. For example, data could be sent in MB and priced in
	// GB. In this case, the conversion factor would be 1024 and the operation would be
	// "divide".
	QuantityConversion QuantityConversion `json:"quantity_conversion,nullable"`
	// Optional. Only valid for USAGE products. If provided, the quantity will be
	// rounded using the provided rounding method and decimal places. For example, if
	// the method is "round up" and the decimal places is 0, then the quantity will be
	// rounded up to the nearest integer.
	QuantityRounding QuantityRounding `json:"quantity_rounding,nullable"`
	StartingAt       time.Time        `json:"starting_at" format:"date-time"`
	Tags             []string         `json:"tags"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt              respjson.Field
		CreatedBy              respjson.Field
		BillableMetricID       respjson.Field
		CompositeProductIDs    respjson.Field
		CompositeTags          respjson.Field
		ExcludeFreeUsage       respjson.Field
		IsRefundable           respjson.Field
		Name                   respjson.Field
		NetsuiteInternalItemID respjson.Field
		NetsuiteOverageItemID  respjson.Field
		PresentationGroupKey   respjson.Field
		PricingGroupKey        respjson.Field
		QuantityConversion     respjson.Field
		QuantityRounding       respjson.Field
		StartingAt             respjson.Field
		Tags                   respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractProductGetResponseDataUpdate) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractProductGetResponseDataUpdate) UnmarshalJSON

func (r *V1ContractProductGetResponseDataUpdate) UnmarshalJSON(data []byte) error

type V1ContractProductListParams

type V1ContractProductListParams struct {
	// Max number of results that should be returned
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	// Filter options for the product list. If not provided, defaults to not archived.
	//
	// Any of "ARCHIVED", "NOT_ARCHIVED", "ALL".
	ArchiveFilter V1ContractProductListParamsArchiveFilter `json:"archive_filter,omitzero"`
	// contains filtered or unexported fields
}

func (V1ContractProductListParams) MarshalJSON

func (r V1ContractProductListParams) MarshalJSON() (data []byte, err error)

func (V1ContractProductListParams) URLQuery

func (r V1ContractProductListParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1ContractProductListParams's query parameters as `url.Values`.

func (*V1ContractProductListParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractProductListParams) UnmarshalJSON(data []byte) error

type V1ContractProductListParamsArchiveFilter

type V1ContractProductListParamsArchiveFilter string

Filter options for the product list. If not provided, defaults to not archived.

const (
	V1ContractProductListParamsArchiveFilterArchived    V1ContractProductListParamsArchiveFilter = "ARCHIVED"
	V1ContractProductListParamsArchiveFilterNotArchived V1ContractProductListParamsArchiveFilter = "NOT_ARCHIVED"
	V1ContractProductListParamsArchiveFilterAll         V1ContractProductListParamsArchiveFilter = "ALL"
)

type V1ContractProductListResponse

type V1ContractProductListResponse struct {
	ID      string               `json:"id,required" format:"uuid"`
	Current ProductListItemState `json:"current,required"`
	Initial ProductListItemState `json:"initial,required"`
	// Any of "USAGE", "SUBSCRIPTION", "COMPOSITE", "FIXED", "PRO_SERVICE".
	Type       V1ContractProductListResponseType     `json:"type,required"`
	Updates    []V1ContractProductListResponseUpdate `json:"updates,required"`
	ArchivedAt time.Time                             `json:"archived_at,nullable" format:"date-time"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID           respjson.Field
		Current      respjson.Field
		Initial      respjson.Field
		Type         respjson.Field
		Updates      respjson.Field
		ArchivedAt   respjson.Field
		CustomFields respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractProductListResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractProductListResponse) UnmarshalJSON

func (r *V1ContractProductListResponse) UnmarshalJSON(data []byte) error

type V1ContractProductListResponseType

type V1ContractProductListResponseType string
const (
	V1ContractProductListResponseTypeUsage        V1ContractProductListResponseType = "USAGE"
	V1ContractProductListResponseTypeSubscription V1ContractProductListResponseType = "SUBSCRIPTION"
	V1ContractProductListResponseTypeComposite    V1ContractProductListResponseType = "COMPOSITE"
	V1ContractProductListResponseTypeFixed        V1ContractProductListResponseType = "FIXED"
	V1ContractProductListResponseTypeProService   V1ContractProductListResponseType = "PRO_SERVICE"
)

type V1ContractProductListResponseUpdate

type V1ContractProductListResponseUpdate struct {
	CreatedAt           time.Time `json:"created_at,required" format:"date-time"`
	CreatedBy           string    `json:"created_by,required"`
	BillableMetricID    string    `json:"billable_metric_id" format:"uuid"`
	CompositeProductIDs []string  `json:"composite_product_ids" format:"uuid"`
	CompositeTags       []string  `json:"composite_tags"`
	ExcludeFreeUsage    bool      `json:"exclude_free_usage"`
	IsRefundable        bool      `json:"is_refundable"`
	Name                string    `json:"name"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteInternalItemID string `json:"netsuite_internal_item_id"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteOverageItemID string `json:"netsuite_overage_item_id"`
	// For USAGE products only. Groups usage line items on invoices. The superset of
	// values in the pricing group key and presentation group key must be set as one
	// compound group key on the billable metric.
	PresentationGroupKey []string `json:"presentation_group_key"`
	// For USAGE products only. If set, pricing for this product will be determined for
	// each pricing_group_key value, as opposed to the product as a whole. The superset
	// of values in the pricing group key and presentation group key must be set as one
	// compound group key on the billable metric.
	PricingGroupKey []string `json:"pricing_group_key"`
	// Optional. Only valid for USAGE products. If provided, the quantity will be
	// converted using the provided conversion factor and operation. For example, if
	// the operation is "multiply" and the conversion factor is 100, then the quantity
	// will be multiplied by 100. This can be used in cases where data is sent in one
	// unit and priced in another. For example, data could be sent in MB and priced in
	// GB. In this case, the conversion factor would be 1024 and the operation would be
	// "divide".
	QuantityConversion QuantityConversion `json:"quantity_conversion,nullable"`
	// Optional. Only valid for USAGE products. If provided, the quantity will be
	// rounded using the provided rounding method and decimal places. For example, if
	// the method is "round up" and the decimal places is 0, then the quantity will be
	// rounded up to the nearest integer.
	QuantityRounding QuantityRounding `json:"quantity_rounding,nullable"`
	StartingAt       time.Time        `json:"starting_at" format:"date-time"`
	Tags             []string         `json:"tags"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt              respjson.Field
		CreatedBy              respjson.Field
		BillableMetricID       respjson.Field
		CompositeProductIDs    respjson.Field
		CompositeTags          respjson.Field
		ExcludeFreeUsage       respjson.Field
		IsRefundable           respjson.Field
		Name                   respjson.Field
		NetsuiteInternalItemID respjson.Field
		NetsuiteOverageItemID  respjson.Field
		PresentationGroupKey   respjson.Field
		PricingGroupKey        respjson.Field
		QuantityConversion     respjson.Field
		QuantityRounding       respjson.Field
		StartingAt             respjson.Field
		Tags                   respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractProductListResponseUpdate) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractProductListResponseUpdate) UnmarshalJSON

func (r *V1ContractProductListResponseUpdate) UnmarshalJSON(data []byte) error

type V1ContractProductNewParams

type V1ContractProductNewParams struct {
	// displayed on invoices
	Name string `json:"name,required"`
	// Any of "FIXED", "USAGE", "COMPOSITE", "SUBSCRIPTION", "PROFESSIONAL_SERVICE",
	// "PRO_SERVICE".
	Type V1ContractProductNewParamsType `json:"type,omitzero,required"`
	// Required for USAGE products
	BillableMetricID param.Opt[string] `json:"billable_metric_id,omitzero" format:"uuid"`
	// Beta feature only available for composite products. If true, products with $0
	// will not be included when computing composite usage. Defaults to false
	ExcludeFreeUsage param.Opt[bool] `json:"exclude_free_usage,omitzero"`
	// This field's availability is dependent on your client's configuration. Defaults
	// to true.
	IsRefundable param.Opt[bool] `json:"is_refundable,omitzero"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteInternalItemID param.Opt[string] `json:"netsuite_internal_item_id,omitzero"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteOverageItemID param.Opt[string] `json:"netsuite_overage_item_id,omitzero"`
	// Optional. Only valid for USAGE products. If provided, the quantity will be
	// converted using the provided conversion factor and operation. For example, if
	// the operation is "multiply" and the conversion factor is 100, then the quantity
	// will be multiplied by 100. This can be used in cases where data is sent in one
	// unit and priced in another. For example, data could be sent in MB and priced in
	// GB. In this case, the conversion factor would be 1024 and the operation would be
	// "divide".
	QuantityConversion QuantityConversionParam `json:"quantity_conversion,omitzero"`
	// Optional. Only valid for USAGE products. If provided, the quantity will be
	// rounded using the provided rounding method and decimal places. For example, if
	// the method is "round up" and the decimal places is 0, then the quantity will be
	// rounded up to the nearest integer.
	QuantityRounding QuantityRoundingParam `json:"quantity_rounding,omitzero"`
	// Required for COMPOSITE products
	CompositeProductIDs []string `json:"composite_product_ids,omitzero" format:"uuid"`
	// Required for COMPOSITE products
	CompositeTags []string `json:"composite_tags,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// For USAGE products only. Groups usage line items on invoices. The superset of
	// values in the pricing group key and presentation group key must be set as one
	// compound group key on the billable metric.
	PresentationGroupKey []string `json:"presentation_group_key,omitzero"`
	// For USAGE products only. If set, pricing for this product will be determined for
	// each pricing_group_key value, as opposed to the product as a whole. The superset
	// of values in the pricing group key and presentation group key must be set as one
	// compound group key on the billable metric.
	PricingGroupKey []string `json:"pricing_group_key,omitzero"`
	Tags            []string `json:"tags,omitzero"`
	// contains filtered or unexported fields
}

func (V1ContractProductNewParams) MarshalJSON

func (r V1ContractProductNewParams) MarshalJSON() (data []byte, err error)

func (*V1ContractProductNewParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractProductNewParams) UnmarshalJSON(data []byte) error

type V1ContractProductNewParamsType

type V1ContractProductNewParamsType string
const (
	V1ContractProductNewParamsTypeFixed               V1ContractProductNewParamsType = "FIXED"
	V1ContractProductNewParamsTypeUsage               V1ContractProductNewParamsType = "USAGE"
	V1ContractProductNewParamsTypeComposite           V1ContractProductNewParamsType = "COMPOSITE"
	V1ContractProductNewParamsTypeSubscription        V1ContractProductNewParamsType = "SUBSCRIPTION"
	V1ContractProductNewParamsTypeProfessionalService V1ContractProductNewParamsType = "PROFESSIONAL_SERVICE"
	V1ContractProductNewParamsTypeProService          V1ContractProductNewParamsType = "PRO_SERVICE"
)

type V1ContractProductNewResponse

type V1ContractProductNewResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractProductNewResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractProductNewResponse) UnmarshalJSON

func (r *V1ContractProductNewResponse) UnmarshalJSON(data []byte) error

type V1ContractProductService

type V1ContractProductService struct {
	Options []option.RequestOption
}

V1ContractProductService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1ContractProductService method instead.

func NewV1ContractProductService

func NewV1ContractProductService(opts ...option.RequestOption) (r V1ContractProductService)

NewV1ContractProductService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1ContractProductService) Archive

Archive a product. Any current rate cards associated with this product will continue to function as normal. However, it will no longer be available as an option for newly created rates. Once you archive a product, you can still retrieve it in the UI and API, but you cannot unarchive it.

func (*V1ContractProductService) Get

Retrieve a product by its ID, including all metadata and historical changes.

func (*V1ContractProductService) List

Get a paginated list of all products in your organization with their complete configuration, version history, and metadata. By default excludes archived products unless explicitly requested via the `archive_filter` parameter.

func (*V1ContractProductService) ListAutoPaging

Get a paginated list of all products in your organization with their complete configuration, version history, and metadata. By default excludes archived products unless explicitly requested via the `archive_filter` parameter.

func (*V1ContractProductService) New

Create a new product object. Products in Metronome represent your company's individual product or service offerings. A Product can be thought of as the basic unit of a line item on the invoice. This is analogous to SKUs or items in an ERP system. Give the product a meaningful name as they will appear on customer invoices.

func (*V1ContractProductService) Update

Updates a product's configuration while maintaining billing continuity for active customers. Use this endpoint to modify product names, metrics, pricing rules, and composite settings without disrupting ongoing billing cycles. Changes are scheduled using the starting_at timestamp, which must be on an hour boundary—set future dates to schedule updates ahead of time, or past dates for retroactive changes. Returns the updated product ID upon success.

### Usage guidance:

  • Product type cannot be changed after creation. For incorrect product types, create a new product and archive the original instead.

type V1ContractProductUpdateParams

type V1ContractProductUpdateParams struct {
	// ID of the product to update
	ProductID string `json:"product_id,required" format:"uuid"`
	// Timestamp representing when the update should go into effect. It must be on an
	// hour boundary (e.g. 1:00, not 1:30).
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// Available for USAGE products only. If not provided, defaults to product's
	// current billable metric.
	BillableMetricID param.Opt[string] `json:"billable_metric_id,omitzero" format:"uuid"`
	// Beta feature only available for composite products. If true, products with $0
	// will not be included when computing composite usage. Defaults to false
	ExcludeFreeUsage param.Opt[bool] `json:"exclude_free_usage,omitzero"`
	// Defaults to product's current refundability status. This field's availability is
	// dependent on your client's configuration.
	IsRefundable param.Opt[bool] `json:"is_refundable,omitzero"`
	// displayed on invoices. If not provided, defaults to product's current name.
	Name param.Opt[string] `json:"name,omitzero"`
	// If not provided, defaults to product's current netsuite_internal_item_id. This
	// field's availability is dependent on your client's configuration.
	NetsuiteInternalItemID param.Opt[string] `json:"netsuite_internal_item_id,omitzero"`
	// Available for USAGE and COMPOSITE products only. If not provided, defaults to
	// product's current netsuite_overage_item_id. This field's availability is
	// dependent on your client's configuration.
	NetsuiteOverageItemID param.Opt[string] `json:"netsuite_overage_item_id,omitzero"`
	// Optional. Only valid for USAGE products. If provided, the quantity will be
	// converted using the provided conversion factor and operation. For example, if
	// the operation is "multiply" and the conversion factor is 100, then the quantity
	// will be multiplied by 100. This can be used in cases where data is sent in one
	// unit and priced in another. For example, data could be sent in MB and priced in
	// GB. In this case, the conversion factor would be 1024 and the operation would be
	// "divide".
	QuantityConversion QuantityConversionParam `json:"quantity_conversion,omitzero"`
	// Optional. Only valid for USAGE products. If provided, the quantity will be
	// rounded using the provided rounding method and decimal places. For example, if
	// the method is "round up" and the decimal places is 0, then the quantity will be
	// rounded up to the nearest integer.
	QuantityRounding QuantityRoundingParam `json:"quantity_rounding,omitzero"`
	// Available for COMPOSITE products only. If not provided, defaults to product's
	// current composite_product_ids.
	CompositeProductIDs []string `json:"composite_product_ids,omitzero" format:"uuid"`
	// Available for COMPOSITE products only. If not provided, defaults to product's
	// current composite_tags.
	CompositeTags []string `json:"composite_tags,omitzero"`
	// For USAGE products only. Groups usage line items on invoices. The superset of
	// values in the pricing group key and presentation group key must be set as one
	// compound group key on the billable metric.
	PresentationGroupKey []string `json:"presentation_group_key,omitzero"`
	// For USAGE products only. If set, pricing for this product will be determined for
	// each pricing_group_key value, as opposed to the product as a whole. The superset
	// of values in the pricing group key and presentation group key must be set as one
	// compound group key on the billable metric.
	PricingGroupKey []string `json:"pricing_group_key,omitzero"`
	// If not provided, defaults to product's current tags
	Tags []string `json:"tags,omitzero"`
	// contains filtered or unexported fields
}

func (V1ContractProductUpdateParams) MarshalJSON

func (r V1ContractProductUpdateParams) MarshalJSON() (data []byte, err error)

func (*V1ContractProductUpdateParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractProductUpdateParams) UnmarshalJSON(data []byte) error

type V1ContractProductUpdateResponse

type V1ContractProductUpdateResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractProductUpdateResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractProductUpdateResponse) UnmarshalJSON

func (r *V1ContractProductUpdateResponse) UnmarshalJSON(data []byte) error

type V1ContractRateCardArchiveParams

type V1ContractRateCardArchiveParams struct {
	ID shared.IDParam
	// contains filtered or unexported fields
}

func (V1ContractRateCardArchiveParams) MarshalJSON

func (r V1ContractRateCardArchiveParams) MarshalJSON() (data []byte, err error)

func (*V1ContractRateCardArchiveParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractRateCardArchiveParams) UnmarshalJSON(data []byte) error

type V1ContractRateCardArchiveResponse

type V1ContractRateCardArchiveResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractRateCardArchiveResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractRateCardArchiveResponse) UnmarshalJSON

func (r *V1ContractRateCardArchiveResponse) UnmarshalJSON(data []byte) error

type V1ContractRateCardGetParams

type V1ContractRateCardGetParams struct {
	ID shared.IDParam
	// contains filtered or unexported fields
}

func (V1ContractRateCardGetParams) MarshalJSON

func (r V1ContractRateCardGetParams) MarshalJSON() (data []byte, err error)

func (*V1ContractRateCardGetParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractRateCardGetParams) UnmarshalJSON(data []byte) error

type V1ContractRateCardGetRateScheduleParams

type V1ContractRateCardGetRateScheduleParams struct {
	// ID of the rate card to get the schedule for
	RateCardID string `json:"rate_card_id,required" format:"uuid"`
	// inclusive starting point for the rates schedule
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// Max number of results that should be returned
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	// optional exclusive end date for the rates schedule. When not specified rates
	// will show all future schedule segments.
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	// List of rate selectors, rates matching ANY of the selector will be included in
	// the response Passing no selectors will result in all rates being returned.
	Selectors []V1ContractRateCardGetRateScheduleParamsSelector `json:"selectors,omitzero"`
	// contains filtered or unexported fields
}

func (V1ContractRateCardGetRateScheduleParams) MarshalJSON

func (r V1ContractRateCardGetRateScheduleParams) MarshalJSON() (data []byte, err error)

func (V1ContractRateCardGetRateScheduleParams) URLQuery

URLQuery serializes V1ContractRateCardGetRateScheduleParams's query parameters as `url.Values`.

func (*V1ContractRateCardGetRateScheduleParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractRateCardGetRateScheduleParams) UnmarshalJSON(data []byte) error

type V1ContractRateCardGetRateScheduleParamsSelector

type V1ContractRateCardGetRateScheduleParamsSelector struct {
	// Rates matching the product id will be included in the response.
	ProductID param.Opt[string] `json:"product_id,omitzero" format:"uuid"`
	// Subscription rates matching the billing frequency will be included in the
	// response.
	//
	// Any of "MONTHLY", "QUARTERLY", "ANNUAL", "WEEKLY".
	BillingFrequency string `json:"billing_frequency,omitzero"`
	// List of pricing group key value pairs, rates containing the matching key / value
	// pairs will be included in the response.
	PartialPricingGroupValues map[string]string `json:"partial_pricing_group_values,omitzero"`
	// List of pricing group key value pairs, rates matching all of the key / value
	// pairs will be included in the response.
	PricingGroupValues map[string]string `json:"pricing_group_values,omitzero"`
	// contains filtered or unexported fields
}

func (V1ContractRateCardGetRateScheduleParamsSelector) MarshalJSON

func (r V1ContractRateCardGetRateScheduleParamsSelector) MarshalJSON() (data []byte, err error)

func (*V1ContractRateCardGetRateScheduleParamsSelector) UnmarshalJSON added in v1.0.0

type V1ContractRateCardGetRateScheduleResponse

type V1ContractRateCardGetRateScheduleResponse struct {
	Data     []V1ContractRateCardGetRateScheduleResponseData `json:"data,required"`
	NextPage string                                          `json:"next_page,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		NextPage    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractRateCardGetRateScheduleResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractRateCardGetRateScheduleResponse) UnmarshalJSON

func (r *V1ContractRateCardGetRateScheduleResponse) UnmarshalJSON(data []byte) error

type V1ContractRateCardGetRateScheduleResponseData

type V1ContractRateCardGetRateScheduleResponseData struct {
	Entitled bool `json:"entitled,required"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	ProductCustomFields map[string]string `json:"product_custom_fields,required"`
	ProductID           string            `json:"product_id,required" format:"uuid"`
	ProductName         string            `json:"product_name,required"`
	ProductTags         []string          `json:"product_tags,required"`
	Rate                shared.Rate       `json:"rate,required"`
	StartingAt          time.Time         `json:"starting_at,required" format:"date-time"`
	// Any of "MONTHLY", "QUARTERLY", "ANNUAL", "WEEKLY".
	BillingFrequency string `json:"billing_frequency"`
	// A distinct rate on the rate card. You can choose to use this rate rather than
	// list rate when consuming a credit or commit.
	CommitRate         shared.CommitRate `json:"commit_rate"`
	EndingBefore       time.Time         `json:"ending_before" format:"date-time"`
	PricingGroupValues map[string]string `json:"pricing_group_values"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Entitled            respjson.Field
		ProductCustomFields respjson.Field
		ProductID           respjson.Field
		ProductName         respjson.Field
		ProductTags         respjson.Field
		Rate                respjson.Field
		StartingAt          respjson.Field
		BillingFrequency    respjson.Field
		CommitRate          respjson.Field
		EndingBefore        respjson.Field
		PricingGroupValues  respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractRateCardGetRateScheduleResponseData) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractRateCardGetRateScheduleResponseData) UnmarshalJSON

func (r *V1ContractRateCardGetRateScheduleResponseData) UnmarshalJSON(data []byte) error

type V1ContractRateCardGetResponse

type V1ContractRateCardGetResponse struct {
	Data V1ContractRateCardGetResponseData `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractRateCardGetResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractRateCardGetResponse) UnmarshalJSON

func (r *V1ContractRateCardGetResponse) UnmarshalJSON(data []byte) error

type V1ContractRateCardGetResponseData

type V1ContractRateCardGetResponseData struct {
	ID                    string                                                  `json:"id,required" format:"uuid"`
	CreatedAt             time.Time                                               `json:"created_at,required" format:"date-time"`
	CreatedBy             string                                                  `json:"created_by,required"`
	Name                  string                                                  `json:"name,required"`
	Aliases               []V1ContractRateCardGetResponseDataAlias                `json:"aliases"`
	CreditTypeConversions []V1ContractRateCardGetResponseDataCreditTypeConversion `json:"credit_type_conversions"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields   map[string]string     `json:"custom_fields"`
	Description    string                `json:"description"`
	FiatCreditType shared.CreditTypeData `json:"fiat_credit_type"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                    respjson.Field
		CreatedAt             respjson.Field
		CreatedBy             respjson.Field
		Name                  respjson.Field
		Aliases               respjson.Field
		CreditTypeConversions respjson.Field
		CustomFields          respjson.Field
		Description           respjson.Field
		FiatCreditType        respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractRateCardGetResponseData) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractRateCardGetResponseData) UnmarshalJSON

func (r *V1ContractRateCardGetResponseData) UnmarshalJSON(data []byte) error

type V1ContractRateCardGetResponseDataAlias

type V1ContractRateCardGetResponseDataAlias struct {
	Name         string    `json:"name,required"`
	EndingBefore time.Time `json:"ending_before" format:"date-time"`
	StartingAt   time.Time `json:"starting_at" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Name         respjson.Field
		EndingBefore respjson.Field
		StartingAt   respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractRateCardGetResponseDataAlias) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractRateCardGetResponseDataAlias) UnmarshalJSON

func (r *V1ContractRateCardGetResponseDataAlias) UnmarshalJSON(data []byte) error

type V1ContractRateCardGetResponseDataCreditTypeConversion

type V1ContractRateCardGetResponseDataCreditTypeConversion struct {
	CustomCreditType    shared.CreditTypeData `json:"custom_credit_type,required"`
	FiatPerCustomCredit string                `json:"fiat_per_custom_credit,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CustomCreditType    respjson.Field
		FiatPerCustomCredit respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractRateCardGetResponseDataCreditTypeConversion) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractRateCardGetResponseDataCreditTypeConversion) UnmarshalJSON

type V1ContractRateCardListParams

type V1ContractRateCardListParams struct {
	// Max number of results that should be returned
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	Body     any
	// contains filtered or unexported fields
}

func (V1ContractRateCardListParams) MarshalJSON

func (r V1ContractRateCardListParams) MarshalJSON() (data []byte, err error)

func (V1ContractRateCardListParams) URLQuery

func (r V1ContractRateCardListParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1ContractRateCardListParams's query parameters as `url.Values`.

func (*V1ContractRateCardListParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractRateCardListParams) UnmarshalJSON(data []byte) error

type V1ContractRateCardListResponse

type V1ContractRateCardListResponse struct {
	ID                    string                                               `json:"id,required" format:"uuid"`
	CreatedAt             time.Time                                            `json:"created_at,required" format:"date-time"`
	CreatedBy             string                                               `json:"created_by,required"`
	Name                  string                                               `json:"name,required"`
	Aliases               []V1ContractRateCardListResponseAlias                `json:"aliases"`
	CreditTypeConversions []V1ContractRateCardListResponseCreditTypeConversion `json:"credit_type_conversions"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields   map[string]string     `json:"custom_fields"`
	Description    string                `json:"description"`
	FiatCreditType shared.CreditTypeData `json:"fiat_credit_type"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                    respjson.Field
		CreatedAt             respjson.Field
		CreatedBy             respjson.Field
		Name                  respjson.Field
		Aliases               respjson.Field
		CreditTypeConversions respjson.Field
		CustomFields          respjson.Field
		Description           respjson.Field
		FiatCreditType        respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractRateCardListResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractRateCardListResponse) UnmarshalJSON

func (r *V1ContractRateCardListResponse) UnmarshalJSON(data []byte) error

type V1ContractRateCardListResponseAlias

type V1ContractRateCardListResponseAlias struct {
	Name         string    `json:"name,required"`
	EndingBefore time.Time `json:"ending_before" format:"date-time"`
	StartingAt   time.Time `json:"starting_at" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Name         respjson.Field
		EndingBefore respjson.Field
		StartingAt   respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractRateCardListResponseAlias) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractRateCardListResponseAlias) UnmarshalJSON

func (r *V1ContractRateCardListResponseAlias) UnmarshalJSON(data []byte) error

type V1ContractRateCardListResponseCreditTypeConversion

type V1ContractRateCardListResponseCreditTypeConversion struct {
	CustomCreditType    shared.CreditTypeData `json:"custom_credit_type,required"`
	FiatPerCustomCredit string                `json:"fiat_per_custom_credit,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CustomCreditType    respjson.Field
		FiatPerCustomCredit respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractRateCardListResponseCreditTypeConversion) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractRateCardListResponseCreditTypeConversion) UnmarshalJSON

type V1ContractRateCardNamedScheduleGetParams

type V1ContractRateCardNamedScheduleGetParams struct {
	// ID of the contract whose named schedule is to be retrieved
	ContractID string `json:"contract_id,required" format:"uuid"`
	// ID of the customer whose named schedule is to be retrieved
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// The identifier for the schedule to be retrieved
	ScheduleName string `json:"schedule_name,required"`
	// If provided, at most one schedule segment will be returned (the one that covers
	// this date). If not provided, all segments will be returned.
	CoveringDate param.Opt[time.Time] `json:"covering_date,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

func (V1ContractRateCardNamedScheduleGetParams) MarshalJSON

func (r V1ContractRateCardNamedScheduleGetParams) MarshalJSON() (data []byte, err error)

func (*V1ContractRateCardNamedScheduleGetParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractRateCardNamedScheduleGetParams) UnmarshalJSON(data []byte) error

type V1ContractRateCardNamedScheduleGetResponse

type V1ContractRateCardNamedScheduleGetResponse struct {
	Data []V1ContractRateCardNamedScheduleGetResponseData `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractRateCardNamedScheduleGetResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractRateCardNamedScheduleGetResponse) UnmarshalJSON

func (r *V1ContractRateCardNamedScheduleGetResponse) UnmarshalJSON(data []byte) error

type V1ContractRateCardNamedScheduleGetResponseData

type V1ContractRateCardNamedScheduleGetResponseData struct {
	StartingAt   time.Time `json:"starting_at,required" format:"date-time"`
	Value        any       `json:"value,required"`
	EndingBefore time.Time `json:"ending_before" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		StartingAt   respjson.Field
		Value        respjson.Field
		EndingBefore respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractRateCardNamedScheduleGetResponseData) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractRateCardNamedScheduleGetResponseData) UnmarshalJSON

type V1ContractRateCardNamedScheduleService

type V1ContractRateCardNamedScheduleService struct {
	Options []option.RequestOption
}

V1ContractRateCardNamedScheduleService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1ContractRateCardNamedScheduleService method instead.

func NewV1ContractRateCardNamedScheduleService

func NewV1ContractRateCardNamedScheduleService(opts ...option.RequestOption) (r V1ContractRateCardNamedScheduleService)

NewV1ContractRateCardNamedScheduleService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1ContractRateCardNamedScheduleService) Get

Get a named schedule for the given contract. This endpoint's availability is dependent on your client's configuration.

func (*V1ContractRateCardNamedScheduleService) Update

Update a named schedule for the given contract. This endpoint's availability is dependent on your client's configuration.

type V1ContractRateCardNamedScheduleUpdateParams

type V1ContractRateCardNamedScheduleUpdateParams struct {
	// ID of the contract whose named schedule is to be updated
	ContractID string `json:"contract_id,required" format:"uuid"`
	// ID of the customer whose named schedule is to be updated
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// The identifier for the schedule to be updated
	ScheduleName string    `json:"schedule_name,required"`
	StartingAt   time.Time `json:"starting_at,required" format:"date-time"`
	// The value to set for the named schedule. The structure of this object is
	// specific to the named schedule.
	Value        any                  `json:"value,omitzero,required"`
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

func (V1ContractRateCardNamedScheduleUpdateParams) MarshalJSON

func (r V1ContractRateCardNamedScheduleUpdateParams) MarshalJSON() (data []byte, err error)

func (*V1ContractRateCardNamedScheduleUpdateParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractRateCardNamedScheduleUpdateParams) UnmarshalJSON(data []byte) error

type V1ContractRateCardNewParams

type V1ContractRateCardNewParams struct {
	// Used only in UI/API. It is not exposed to end customers.
	Name        string            `json:"name,required"`
	Description param.Opt[string] `json:"description,omitzero"`
	// The Metronome ID of the credit type to associate with the rate card, defaults to
	// USD (cents) if not passed.
	FiatCreditTypeID param.Opt[string] `json:"fiat_credit_type_id,omitzero" format:"uuid"`
	// Reference this alias when creating a contract. If the same alias is assigned to
	// multiple rate cards, it will reference the rate card to which it was most
	// recently assigned. It is not exposed to end customers.
	Aliases []V1ContractRateCardNewParamsAlias `json:"aliases,omitzero"`
	// Required when using custom pricing units in rates.
	CreditTypeConversions []V1ContractRateCardNewParamsCreditTypeConversion `json:"credit_type_conversions,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// contains filtered or unexported fields
}

func (V1ContractRateCardNewParams) MarshalJSON

func (r V1ContractRateCardNewParams) MarshalJSON() (data []byte, err error)

func (*V1ContractRateCardNewParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractRateCardNewParams) UnmarshalJSON(data []byte) error

type V1ContractRateCardNewParamsAlias

type V1ContractRateCardNewParamsAlias struct {
	Name         string               `json:"name,required"`
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	StartingAt   param.Opt[time.Time] `json:"starting_at,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

The property Name is required.

func (V1ContractRateCardNewParamsAlias) MarshalJSON

func (r V1ContractRateCardNewParamsAlias) MarshalJSON() (data []byte, err error)

func (*V1ContractRateCardNewParamsAlias) UnmarshalJSON added in v1.0.0

func (r *V1ContractRateCardNewParamsAlias) UnmarshalJSON(data []byte) error

type V1ContractRateCardNewParamsCreditTypeConversion

type V1ContractRateCardNewParamsCreditTypeConversion struct {
	CustomCreditTypeID  string  `json:"custom_credit_type_id,required" format:"uuid"`
	FiatPerCustomCredit float64 `json:"fiat_per_custom_credit,required"`
	// contains filtered or unexported fields
}

The properties CustomCreditTypeID, FiatPerCustomCredit are required.

func (V1ContractRateCardNewParamsCreditTypeConversion) MarshalJSON

func (r V1ContractRateCardNewParamsCreditTypeConversion) MarshalJSON() (data []byte, err error)

func (*V1ContractRateCardNewParamsCreditTypeConversion) UnmarshalJSON added in v1.0.0

type V1ContractRateCardNewResponse

type V1ContractRateCardNewResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractRateCardNewResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractRateCardNewResponse) UnmarshalJSON

func (r *V1ContractRateCardNewResponse) UnmarshalJSON(data []byte) error

type V1ContractRateCardProductOrderService

type V1ContractRateCardProductOrderService struct {
	Options []option.RequestOption
}

V1ContractRateCardProductOrderService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1ContractRateCardProductOrderService method instead.

func NewV1ContractRateCardProductOrderService

func NewV1ContractRateCardProductOrderService(opts ...option.RequestOption) (r V1ContractRateCardProductOrderService)

NewV1ContractRateCardProductOrderService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1ContractRateCardProductOrderService) Set

The ordering of products on a rate card determines the order in which the products will appear on customers' invoices. Use this endpoint to set the order of products on the rate card.

func (*V1ContractRateCardProductOrderService) Update

The ordering of products on a rate card determines the order in which the products will appear on customers' invoices. Use this endpoint to set the order of specific products on the rate card by moving them relative to their current location.

type V1ContractRateCardProductOrderSetParams

type V1ContractRateCardProductOrderSetParams struct {
	ProductOrder []string `json:"product_order,omitzero,required" format:"uuid"`
	// ID of the rate card to update
	RateCardID string `json:"rate_card_id,required" format:"uuid"`
	// contains filtered or unexported fields
}

func (V1ContractRateCardProductOrderSetParams) MarshalJSON

func (r V1ContractRateCardProductOrderSetParams) MarshalJSON() (data []byte, err error)

func (*V1ContractRateCardProductOrderSetParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractRateCardProductOrderSetParams) UnmarshalJSON(data []byte) error

type V1ContractRateCardProductOrderSetResponse

type V1ContractRateCardProductOrderSetResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractRateCardProductOrderSetResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractRateCardProductOrderSetResponse) UnmarshalJSON

func (r *V1ContractRateCardProductOrderSetResponse) UnmarshalJSON(data []byte) error

type V1ContractRateCardProductOrderUpdateParams

type V1ContractRateCardProductOrderUpdateParams struct {
	ProductMoves []V1ContractRateCardProductOrderUpdateParamsProductMove `json:"product_moves,omitzero,required"`
	// ID of the rate card to update
	RateCardID string `json:"rate_card_id,required" format:"uuid"`
	// contains filtered or unexported fields
}

func (V1ContractRateCardProductOrderUpdateParams) MarshalJSON

func (r V1ContractRateCardProductOrderUpdateParams) MarshalJSON() (data []byte, err error)

func (*V1ContractRateCardProductOrderUpdateParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractRateCardProductOrderUpdateParams) UnmarshalJSON(data []byte) error

type V1ContractRateCardProductOrderUpdateParamsProductMove

type V1ContractRateCardProductOrderUpdateParamsProductMove struct {
	// 0-based index of the new position of the product
	Position float64 `json:"position,required"`
	// ID of the product to move
	ProductID string `json:"product_id,required" format:"uuid"`
	// contains filtered or unexported fields
}

The properties Position, ProductID are required.

func (V1ContractRateCardProductOrderUpdateParamsProductMove) MarshalJSON

func (*V1ContractRateCardProductOrderUpdateParamsProductMove) UnmarshalJSON added in v1.0.0

type V1ContractRateCardProductOrderUpdateResponse

type V1ContractRateCardProductOrderUpdateResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractRateCardProductOrderUpdateResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractRateCardProductOrderUpdateResponse) UnmarshalJSON

func (r *V1ContractRateCardProductOrderUpdateResponse) UnmarshalJSON(data []byte) error

type V1ContractRateCardRateAddManyParams

type V1ContractRateCardRateAddManyParams struct {
	RateCardID string                                    `json:"rate_card_id,required" format:"uuid"`
	Rates      []V1ContractRateCardRateAddManyParamsRate `json:"rates,omitzero,required"`
	// contains filtered or unexported fields
}

func (V1ContractRateCardRateAddManyParams) MarshalJSON

func (r V1ContractRateCardRateAddManyParams) MarshalJSON() (data []byte, err error)

func (*V1ContractRateCardRateAddManyParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractRateCardRateAddManyParams) UnmarshalJSON(data []byte) error

type V1ContractRateCardRateAddManyParamsRate

type V1ContractRateCardRateAddManyParamsRate struct {
	Entitled bool `json:"entitled,required"`
	// ID of the product to add a rate for
	ProductID string `json:"product_id,required" format:"uuid"`
	// Any of "FLAT", "PERCENTAGE", "SUBSCRIPTION", "TIERED", "CUSTOM".
	RateType string `json:"rate_type,omitzero,required"`
	// inclusive effective date
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// "The Metronome ID of the credit type to associate with price, defaults to USD
	// (cents) if not passed. Used by all rate_types except type PERCENTAGE. PERCENTAGE
	// rates use the credit type of associated rates."
	CreditTypeID param.Opt[string] `json:"credit_type_id,omitzero" format:"uuid"`
	// exclusive end date
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	// Default proration configuration. Only valid for SUBSCRIPTION rate_type. Must be
	// set to true.
	IsProrated param.Opt[bool] `json:"is_prorated,omitzero"`
	// Default price. For FLAT and SUBSCRIPTION rate_type, this must be >=0. For
	// PERCENTAGE rate_type, this is a decimal fraction, e.g. use 0.1 for 10%; this
	// must be >=0 and <=1.
	Price param.Opt[float64] `json:"price,omitzero"`
	// Default quantity. For SUBSCRIPTION rate_type, this must be >=0.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Only set for PERCENTAGE rate_type. Defaults to false. If true, rate is computed
	// using list prices rather than the standard rates for this product on the
	// contract.
	UseListPrices param.Opt[bool] `json:"use_list_prices,omitzero"`
	// Optional. Frequency to bill subscriptions with. Required for subscription type
	// products with Flat rate.
	//
	// Any of "MONTHLY", "QUARTERLY", "ANNUAL", "WEEKLY".
	BillingFrequency string `json:"billing_frequency,omitzero"`
	// A distinct rate on the rate card. You can choose to use this rate rather than
	// list rate when consuming a credit or commit.
	CommitRate shared.CommitRateParam `json:"commit_rate,omitzero"`
	// Only set for CUSTOM rate_type. This field is interpreted by custom rate
	// processors.
	CustomRate map[string]any `json:"custom_rate,omitzero"`
	// Optional. List of pricing group key value pairs which will be used to calculate
	// the price.
	PricingGroupValues map[string]string `json:"pricing_group_values,omitzero"`
	// Only set for TIERED rate_type.
	Tiers []shared.TierParam `json:"tiers,omitzero"`
	// contains filtered or unexported fields
}

The properties Entitled, ProductID, RateType, StartingAt are required.

func (V1ContractRateCardRateAddManyParamsRate) MarshalJSON

func (r V1ContractRateCardRateAddManyParamsRate) MarshalJSON() (data []byte, err error)

func (*V1ContractRateCardRateAddManyParamsRate) UnmarshalJSON added in v1.0.0

func (r *V1ContractRateCardRateAddManyParamsRate) UnmarshalJSON(data []byte) error

type V1ContractRateCardRateAddManyResponse

type V1ContractRateCardRateAddManyResponse struct {
	// The ID of the rate card to which the rates were added.
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractRateCardRateAddManyResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractRateCardRateAddManyResponse) UnmarshalJSON

func (r *V1ContractRateCardRateAddManyResponse) UnmarshalJSON(data []byte) error

type V1ContractRateCardRateAddParams

type V1ContractRateCardRateAddParams struct {
	Entitled bool `json:"entitled,required"`
	// ID of the product to add a rate for
	ProductID string `json:"product_id,required" format:"uuid"`
	// ID of the rate card to update
	RateCardID string `json:"rate_card_id,required" format:"uuid"`
	// Any of "FLAT", "PERCENTAGE", "SUBSCRIPTION", "TIERED", "CUSTOM".
	RateType V1ContractRateCardRateAddParamsRateType `json:"rate_type,omitzero,required"`
	// inclusive effective date
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// The Metronome ID of the credit type to associate with price, defaults to USD
	// (cents) if not passed. Used by all rate_types except type PERCENTAGE. PERCENTAGE
	// rates use the credit type of associated rates.
	CreditTypeID param.Opt[string] `json:"credit_type_id,omitzero" format:"uuid"`
	// exclusive end date
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	// Default proration configuration. Only valid for SUBSCRIPTION rate_type. Must be
	// set to true.
	IsProrated param.Opt[bool] `json:"is_prorated,omitzero"`
	// Default price. For FLAT and SUBSCRIPTION rate_type, this must be >=0. For
	// PERCENTAGE rate_type, this is a decimal fraction, e.g. use 0.1 for 10%; this
	// must be >=0 and <=1.
	Price param.Opt[float64] `json:"price,omitzero"`
	// Default quantity. For SUBSCRIPTION rate_type, this must be >=0.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Only set for PERCENTAGE rate_type. Defaults to false. If true, rate is computed
	// using list prices rather than the standard rates for this product on the
	// contract.
	UseListPrices param.Opt[bool] `json:"use_list_prices,omitzero"`
	// Optional. Frequency to bill subscriptions with. Required for subscription type
	// products with Flat rate.
	//
	// Any of "MONTHLY", "QUARTERLY", "ANNUAL", "WEEKLY".
	BillingFrequency V1ContractRateCardRateAddParamsBillingFrequency `json:"billing_frequency,omitzero"`
	// A distinct rate on the rate card. You can choose to use this rate rather than
	// list rate when consuming a credit or commit.
	CommitRate shared.CommitRateParam `json:"commit_rate,omitzero"`
	// Only set for CUSTOM rate_type. This field is interpreted by custom rate
	// processors.
	CustomRate map[string]any `json:"custom_rate,omitzero"`
	// Optional. List of pricing group key value pairs which will be used to calculate
	// the price.
	PricingGroupValues map[string]string `json:"pricing_group_values,omitzero"`
	// Only set for TIERED rate_type.
	Tiers []shared.TierParam `json:"tiers,omitzero"`
	// contains filtered or unexported fields
}

func (V1ContractRateCardRateAddParams) MarshalJSON

func (r V1ContractRateCardRateAddParams) MarshalJSON() (data []byte, err error)

func (*V1ContractRateCardRateAddParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractRateCardRateAddParams) UnmarshalJSON(data []byte) error

type V1ContractRateCardRateAddParamsBillingFrequency

type V1ContractRateCardRateAddParamsBillingFrequency string

Optional. Frequency to bill subscriptions with. Required for subscription type products with Flat rate.

const (
	V1ContractRateCardRateAddParamsBillingFrequencyMonthly   V1ContractRateCardRateAddParamsBillingFrequency = "MONTHLY"
	V1ContractRateCardRateAddParamsBillingFrequencyQuarterly V1ContractRateCardRateAddParamsBillingFrequency = "QUARTERLY"
	V1ContractRateCardRateAddParamsBillingFrequencyAnnual    V1ContractRateCardRateAddParamsBillingFrequency = "ANNUAL"
	V1ContractRateCardRateAddParamsBillingFrequencyWeekly    V1ContractRateCardRateAddParamsBillingFrequency = "WEEKLY"
)

type V1ContractRateCardRateAddParamsRateType

type V1ContractRateCardRateAddParamsRateType string
const (
	V1ContractRateCardRateAddParamsRateTypeFlat         V1ContractRateCardRateAddParamsRateType = "FLAT"
	V1ContractRateCardRateAddParamsRateTypePercentage   V1ContractRateCardRateAddParamsRateType = "PERCENTAGE"
	V1ContractRateCardRateAddParamsRateTypeSubscription V1ContractRateCardRateAddParamsRateType = "SUBSCRIPTION"
	V1ContractRateCardRateAddParamsRateTypeTiered       V1ContractRateCardRateAddParamsRateType = "TIERED"
	V1ContractRateCardRateAddParamsRateTypeCustom       V1ContractRateCardRateAddParamsRateType = "CUSTOM"
)

type V1ContractRateCardRateAddResponse

type V1ContractRateCardRateAddResponse struct {
	Data V1ContractRateCardRateAddResponseData `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractRateCardRateAddResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractRateCardRateAddResponse) UnmarshalJSON

func (r *V1ContractRateCardRateAddResponse) UnmarshalJSON(data []byte) error

type V1ContractRateCardRateAddResponseData

type V1ContractRateCardRateAddResponseData struct {
	// Any of "FLAT", "PERCENTAGE", "SUBSCRIPTION", "CUSTOM", "TIERED".
	RateType string `json:"rate_type,required"`
	// A distinct rate on the rate card. You can choose to use this rate rather than
	// list rate when consuming a credit or commit.
	CommitRate shared.CommitRate     `json:"commit_rate"`
	CreditType shared.CreditTypeData `json:"credit_type"`
	// Only set for CUSTOM rate_type. This field is interpreted by custom rate
	// processors.
	CustomRate map[string]any `json:"custom_rate"`
	// Default proration configuration. Only valid for SUBSCRIPTION rate_type. Must be
	// set to true.
	IsProrated bool `json:"is_prorated"`
	// Default price. For FLAT rate_type, this must be >=0. For PERCENTAGE rate_type,
	// this is a decimal fraction, e.g. use 0.1 for 10%; this must be >=0 and <=1.
	Price float64 `json:"price"`
	// if pricing groups are used, this will contain the values used to calculate the
	// price
	PricingGroupValues map[string]string `json:"pricing_group_values"`
	// Default quantity. For SUBSCRIPTION rate_type, this must be >=0.
	Quantity float64 `json:"quantity"`
	// Only set for TIERED rate_type.
	Tiers []shared.Tier `json:"tiers"`
	// Only set for PERCENTAGE rate_type. Defaults to false. If true, rate is computed
	// using list prices rather than the standard rates for this product on the
	// contract.
	UseListPrices bool `json:"use_list_prices"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		RateType           respjson.Field
		CommitRate         respjson.Field
		CreditType         respjson.Field
		CustomRate         respjson.Field
		IsProrated         respjson.Field
		Price              respjson.Field
		PricingGroupValues respjson.Field
		Quantity           respjson.Field
		Tiers              respjson.Field
		UseListPrices      respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractRateCardRateAddResponseData) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractRateCardRateAddResponseData) UnmarshalJSON

func (r *V1ContractRateCardRateAddResponseData) UnmarshalJSON(data []byte) error

type V1ContractRateCardRateListParams

type V1ContractRateCardRateListParams struct {
	// inclusive starting point for the rates schedule
	At time.Time `json:"at,required" format:"date-time"`
	// ID of the rate card to get the schedule for
	RateCardID string `json:"rate_card_id,required" format:"uuid"`
	// Max number of results that should be returned
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	// List of rate selectors, rates matching ANY of the selector will be included in
	// the response Passing no selectors will result in all rates being returned.
	Selectors []V1ContractRateCardRateListParamsSelector `json:"selectors,omitzero"`
	// contains filtered or unexported fields
}

func (V1ContractRateCardRateListParams) MarshalJSON

func (r V1ContractRateCardRateListParams) MarshalJSON() (data []byte, err error)

func (V1ContractRateCardRateListParams) URLQuery

func (r V1ContractRateCardRateListParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1ContractRateCardRateListParams's query parameters as `url.Values`.

func (*V1ContractRateCardRateListParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractRateCardRateListParams) UnmarshalJSON(data []byte) error

type V1ContractRateCardRateListParamsSelector

type V1ContractRateCardRateListParamsSelector struct {
	// Rates matching the product id will be included in the response.
	ProductID param.Opt[string] `json:"product_id,omitzero" format:"uuid"`
	// Subscription rates matching the billing frequency will be included in the
	// response.
	//
	// Any of "MONTHLY", "QUARTERLY", "ANNUAL", "WEEKLY".
	BillingFrequency string `json:"billing_frequency,omitzero"`
	// List of pricing group key value pairs, rates containing the matching key / value
	// pairs will be included in the response.
	PartialPricingGroupValues map[string]string `json:"partial_pricing_group_values,omitzero"`
	// List of pricing group key value pairs, rates matching all of the key / value
	// pairs will be included in the response.
	PricingGroupValues map[string]string `json:"pricing_group_values,omitzero"`
	// List of product tags, rates matching any of the tags will be included in the
	// response.
	ProductTags []string `json:"product_tags,omitzero"`
	// contains filtered or unexported fields
}

func (V1ContractRateCardRateListParamsSelector) MarshalJSON

func (r V1ContractRateCardRateListParamsSelector) MarshalJSON() (data []byte, err error)

func (*V1ContractRateCardRateListParamsSelector) UnmarshalJSON added in v1.0.0

func (r *V1ContractRateCardRateListParamsSelector) UnmarshalJSON(data []byte) error

type V1ContractRateCardRateListResponse

type V1ContractRateCardRateListResponse struct {
	Entitled bool `json:"entitled,required"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	ProductCustomFields map[string]string `json:"product_custom_fields,required"`
	ProductID           string            `json:"product_id,required" format:"uuid"`
	ProductName         string            `json:"product_name,required"`
	ProductTags         []string          `json:"product_tags,required"`
	Rate                shared.Rate       `json:"rate,required"`
	StartingAt          time.Time         `json:"starting_at,required" format:"date-time"`
	// Any of "MONTHLY", "QUARTERLY", "ANNUAL", "WEEKLY".
	BillingFrequency V1ContractRateCardRateListResponseBillingFrequency `json:"billing_frequency"`
	// A distinct rate on the rate card. You can choose to use this rate rather than
	// list rate when consuming a credit or commit.
	CommitRate         shared.CommitRate `json:"commit_rate"`
	EndingBefore       time.Time         `json:"ending_before" format:"date-time"`
	PricingGroupValues map[string]string `json:"pricing_group_values"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Entitled            respjson.Field
		ProductCustomFields respjson.Field
		ProductID           respjson.Field
		ProductName         respjson.Field
		ProductTags         respjson.Field
		Rate                respjson.Field
		StartingAt          respjson.Field
		BillingFrequency    respjson.Field
		CommitRate          respjson.Field
		EndingBefore        respjson.Field
		PricingGroupValues  respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractRateCardRateListResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractRateCardRateListResponse) UnmarshalJSON

func (r *V1ContractRateCardRateListResponse) UnmarshalJSON(data []byte) error

type V1ContractRateCardRateListResponseBillingFrequency

type V1ContractRateCardRateListResponseBillingFrequency string
const (
	V1ContractRateCardRateListResponseBillingFrequencyMonthly   V1ContractRateCardRateListResponseBillingFrequency = "MONTHLY"
	V1ContractRateCardRateListResponseBillingFrequencyQuarterly V1ContractRateCardRateListResponseBillingFrequency = "QUARTERLY"
	V1ContractRateCardRateListResponseBillingFrequencyAnnual    V1ContractRateCardRateListResponseBillingFrequency = "ANNUAL"
	V1ContractRateCardRateListResponseBillingFrequencyWeekly    V1ContractRateCardRateListResponseBillingFrequency = "WEEKLY"
)

type V1ContractRateCardRateService

type V1ContractRateCardRateService struct {
	Options []option.RequestOption
}

V1ContractRateCardRateService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1ContractRateCardRateService method instead.

func NewV1ContractRateCardRateService

func NewV1ContractRateCardRateService(opts ...option.RequestOption) (r V1ContractRateCardRateService)

NewV1ContractRateCardRateService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1ContractRateCardRateService) Add

Add a new rate

func (*V1ContractRateCardRateService) AddMany

Add new rates

func (*V1ContractRateCardRateService) List

Understand the rate schedule at a given timestamp, optionally filtering the list of rates returned based on properties such as `product_id` and `pricing_group_values`. For example, you may want to display the current price for a given product in your product experience - use this endpoint to fetch that information from its source of truth in Metronome.

If you want to understand the rates for a specific customer's contract, inclusive of contract-level overrides, use the `getContractRateSchedule` endpoint.

func (*V1ContractRateCardRateService) ListAutoPaging

Understand the rate schedule at a given timestamp, optionally filtering the list of rates returned based on properties such as `product_id` and `pricing_group_values`. For example, you may want to display the current price for a given product in your product experience - use this endpoint to fetch that information from its source of truth in Metronome.

If you want to understand the rates for a specific customer's contract, inclusive of contract-level overrides, use the `getContractRateSchedule` endpoint.

type V1ContractRateCardService

type V1ContractRateCardService struct {
	Options        []option.RequestOption
	ProductOrders  V1ContractRateCardProductOrderService
	Rates          V1ContractRateCardRateService
	NamedSchedules V1ContractRateCardNamedScheduleService
}

V1ContractRateCardService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1ContractRateCardService method instead.

func NewV1ContractRateCardService

func NewV1ContractRateCardService(opts ...option.RequestOption) (r V1ContractRateCardService)

NewV1ContractRateCardService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1ContractRateCardService) Archive

Permanently disable a rate card by archiving it, preventing use in new contracts while preserving existing contract pricing. Use this when retiring old pricing models, consolidating rate cards, or removing outdated pricing structures. Returns the archived rate card ID and stops the rate card from appearing in contract creation workflows.

func (*V1ContractRateCardService) Get

Return details for a specific rate card including name, description, and aliases. This endpoint does not return rates - use the dedicated getRates or getRateSchedule endpoints to understand the rates on a rate card.

func (*V1ContractRateCardService) GetRateSchedule

A rate card defines the prices that you charge for your products. Rate cards support scheduled changes over time, to allow you to easily roll out pricing changes and new product launches across your customer base. Use this endpoint to understand the rate schedule `starting_at` a given date, optionally filtering the list of rates returned based on product id or pricing group values. For example, you may want to display a schedule of upcoming price changes for a given product in your product experience - use this endpoint to fetch that information from its source of truth in Metronome.

If you want to understand the rates for a specific customer's contract, inclusive of contract-level overrides, use the `getContractRateSchedule` endpoint.

func (*V1ContractRateCardService) List

List all rate cards. Returns rate card IDs, names, descriptions, aliases, and other details. To view the rates associated with a given rate card, use the getRates or getRateSchedule endpoints.

func (*V1ContractRateCardService) ListAutoPaging

List all rate cards. Returns rate card IDs, names, descriptions, aliases, and other details. To view the rates associated with a given rate card, use the getRates or getRateSchedule endpoints.

func (*V1ContractRateCardService) New

In Metronome, the rate card is the central location for your pricing. Rate cards were built with new product launches and pricing changes in mind - you can update your products and pricing in one place, and that change will be automatically propagated across your customer cohorts. Most clients need only maintain one or a few rate cards within Metronome.

### Use this endpoint to:

  • Create a rate card with a name and description
  • Define the rate card's single underlying fiat currency, and any number of conversion rates between that fiat currency and custom pricing units. You can then add products and associated rates in the fiat currency or custom pricing unit for which you have defined a conversion rate.
  • Set aliases for the rate card. Aliases are human-readable names that you can use in the place of the id of the rate card when provisioning a customer's contract. By using an alias, you can easily create a contract and provision a customer by choosing the paygo rate card, without storing the rate card id in your internal systems. This is helpful when launching a new rate card for paygo customers, you can update the alias for paygo to be scheduled to be assigned to the new rate card without updating your code.

### Key response fields:

- The ID of the rate card you just created

### Usage guidelines:

  • After creating a rate card, you can now use the addRate or addRates endpoints to add products and their prices to it
  • A rate card alias can only be used by one rate card at a time. If you create a contract with a rate card alias that is already in use by another rate card, the original rate card's alias schedule will be updated. The alias will reference the rate card to which it was most recently assigned.

func (*V1ContractRateCardService) Update

Update the metadata properties of an existing rate card, including its name, description, and aliases. This endpoint is designed for managing rate card identity and reference aliases rather than modifying pricing rates.

Modifies the descriptive properties and alias configuration of a rate card without affecting the underlying pricing rates or schedules. This allows you to update how a rate card is identified and referenced throughout your system.

### Use this endpoint to:

  • Rate card renaming: Update display names or descriptions for organizational clarity
  • Alias management: Add, modify, or schedule alias transitions for seamless rate card migrations
  • Documentation updates: Keep rate card descriptions current with business context
  • Self-serve provisioning setup: Configure aliases to enable code-free rate card transitions

#### Active contract impact:

  • Alias changes: Already-created contracts continue using their originally assigned rate cards.
  • Other changes made using this endpoint will only impact the Metronome UI.

#### Grandfathering existing PLG customer pricing:

  • Rate card aliases support scheduled transitions, enabling seamless rate card migrations for new customers, allowing existing customers to be grandfathered into their existing prices without code. Note that there are multiple mechanisms to support grandfathering in Metronome.

#### How scheduled aliases work for PLG grandfathering:

Initial setup:

  • Add alias to current rate card: Assign a stable alias (e.g., "standard-pricing") to your active rate card
  • Reference alias during contract creation: Configure your self-serve workflow to create contracts using `rate_card_alias` instead of direct `rate_card_id`
  • Automatic resolution: New contracts referencing the alias automatically resolve to the rate card associated with the alias at the point in time of provisioning

#### Grandfathering process:

  • Create new rate card: Build your new rate card with updated pricing structure
  • Schedule alias transition: Add the same alias to the new rate card with a `starting_at` timestamp
  • Automatic cutover: Starting at the scheduled time, new contracts created in your PLG workflow using that alias will automatically reference the new rate card

type V1ContractRateCardUpdateParams

type V1ContractRateCardUpdateParams struct {
	// ID of the rate card to update
	RateCardID  string            `json:"rate_card_id,required" format:"uuid"`
	Description param.Opt[string] `json:"description,omitzero"`
	// Used only in UI/API. It is not exposed to end customers.
	Name param.Opt[string] `json:"name,omitzero"`
	// Reference this alias when creating a contract. If the same alias is assigned to
	// multiple rate cards, it will reference the rate card to which it was most
	// recently assigned. It is not exposed to end customers.
	Aliases []V1ContractRateCardUpdateParamsAlias `json:"aliases,omitzero"`
	// contains filtered or unexported fields
}

func (V1ContractRateCardUpdateParams) MarshalJSON

func (r V1ContractRateCardUpdateParams) MarshalJSON() (data []byte, err error)

func (*V1ContractRateCardUpdateParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractRateCardUpdateParams) UnmarshalJSON(data []byte) error

type V1ContractRateCardUpdateParamsAlias

type V1ContractRateCardUpdateParamsAlias struct {
	Name         string               `json:"name,required"`
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	StartingAt   param.Opt[time.Time] `json:"starting_at,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

The property Name is required.

func (V1ContractRateCardUpdateParamsAlias) MarshalJSON

func (r V1ContractRateCardUpdateParamsAlias) MarshalJSON() (data []byte, err error)

func (*V1ContractRateCardUpdateParamsAlias) UnmarshalJSON added in v1.0.0

func (r *V1ContractRateCardUpdateParamsAlias) UnmarshalJSON(data []byte) error

type V1ContractRateCardUpdateResponse

type V1ContractRateCardUpdateResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractRateCardUpdateResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractRateCardUpdateResponse) UnmarshalJSON

func (r *V1ContractRateCardUpdateResponse) UnmarshalJSON(data []byte) error

type V1ContractScheduleProServicesInvoiceParams

type V1ContractScheduleProServicesInvoiceParams struct {
	ContractID string `json:"contract_id,required" format:"uuid"`
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// The date the invoice is issued
	IssuedAt time.Time `json:"issued_at,required" format:"date-time"`
	// Each line requires an amount or both unit_price and quantity.
	LineItems []V1ContractScheduleProServicesInvoiceParamsLineItem `json:"line_items,omitzero,required"`
	// The end date of the invoice header in Netsuite
	NetsuiteInvoiceHeaderEnd param.Opt[time.Time] `json:"netsuite_invoice_header_end,omitzero" format:"date-time"`
	// The start date of the invoice header in Netsuite
	NetsuiteInvoiceHeaderStart param.Opt[time.Time] `json:"netsuite_invoice_header_start,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

func (V1ContractScheduleProServicesInvoiceParams) MarshalJSON

func (r V1ContractScheduleProServicesInvoiceParams) MarshalJSON() (data []byte, err error)

func (*V1ContractScheduleProServicesInvoiceParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractScheduleProServicesInvoiceParams) UnmarshalJSON(data []byte) error

type V1ContractScheduleProServicesInvoiceParamsLineItem

type V1ContractScheduleProServicesInvoiceParamsLineItem struct {
	ProfessionalServiceID string `json:"professional_service_id,required" format:"uuid"`
	// If the professional_service_id was added on an amendment, this is required.
	AmendmentID param.Opt[string] `json:"amendment_id,omitzero" format:"uuid"`
	// Amount for the term on the new invoice.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// For client use.
	Metadata param.Opt[string] `json:"metadata,omitzero"`
	// The end date for the billing period on the invoice.
	NetsuiteInvoiceBillingEnd param.Opt[time.Time] `json:"netsuite_invoice_billing_end,omitzero" format:"date-time"`
	// The start date for the billing period on the invoice.
	NetsuiteInvoiceBillingStart param.Opt[time.Time] `json:"netsuite_invoice_billing_start,omitzero" format:"date-time"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// If specified, this overrides the unit price on the pro service term. Must also
	// provide quantity (but not amount) if providing unit_price.
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

Describes the line item for a professional service charge on an invoice.

The property ProfessionalServiceID is required.

func (V1ContractScheduleProServicesInvoiceParamsLineItem) MarshalJSON

func (r V1ContractScheduleProServicesInvoiceParamsLineItem) MarshalJSON() (data []byte, err error)

func (*V1ContractScheduleProServicesInvoiceParamsLineItem) UnmarshalJSON added in v1.0.0

type V1ContractScheduleProServicesInvoiceResponse

type V1ContractScheduleProServicesInvoiceResponse struct {
	Data []Invoice `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractScheduleProServicesInvoiceResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractScheduleProServicesInvoiceResponse) UnmarshalJSON

func (r *V1ContractScheduleProServicesInvoiceResponse) UnmarshalJSON(data []byte) error

type V1ContractService

type V1ContractService struct {
	Options        []option.RequestOption
	Products       V1ContractProductService
	RateCards      V1ContractRateCardService
	NamedSchedules V1ContractNamedScheduleService
}

V1ContractService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1ContractService method instead.

func NewV1ContractService

func NewV1ContractService(opts ...option.RequestOption) (r V1ContractService)

NewV1ContractService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1ContractService) AddManualBalanceEntry

func (r *V1ContractService) AddManualBalanceEntry(ctx context.Context, body V1ContractAddManualBalanceEntryParams, opts ...option.RequestOption) (err error)

Manually adjust the available balance on a commit or credit. This entry is appended to the commit ledger as a new event. Optionally include a description that provides the reasoning for the entry.

### Use this endpoint to:

  • Address incorrect usage burn-down caused by malformed usage or invalid config
  • Decrease available balance to account for outages where usage may have not been tracked or sent to Metronome
  • Issue credits to customers in the form of increased balance on existing commit or credit

### Usage guidelines:

Manual ledger entries can be extremely useful for resolving discrepancies in Metronome. However, most corrections to inaccurate billings can be modified upstream of the commit, whether that is via contract editing, rate editing, or other actions that cause an invoice to be recalculated.

func (*V1ContractService) Amend

Amendments will be replaced by Contract editing. New clients should implement using the `editContract` endpoint. Read more about the migration to contract editing [here](https://docs.metronome.com/migrate-amendments-to-edits/) and reach out to your Metronome representative for more details. Once contract editing is enabled, access to this endpoint will be removed.

func (*V1ContractService) Archive

Permanently end and archive a contract along with all its terms. Any draft invoices will be canceled, and all upcoming scheduled invoices will be voided–also all finalized invoices can optionally be voided. Use this in the event a contract was incorrectly created and needed to be removed from a customer.

#### Impact on commits and credits:

When archiving a contract, all associated commits and credits are also archived. For prepaid commits with active segments, Metronome automatically generates expiration ledger entries to close out any remaining balances, ensuring accurate accounting of unused prepaid amounts. These ledger entries will appear in the commit's transaction history with type `PREPAID_COMMIT_EXPIRATION`.

#### Archived contract visibility:

Archived contracts remain accessible for historical reporting and audit purposes. They can be retrieved using the `ListContracts` endpoint by setting the `include_archived` parameter to `true` or in the Metronome UI when the "Show archived" option is enabled.

func (*V1ContractService) Get

This is the v1 endpoint to get a contract. New clients should implement using the v2 endpoint.

func (*V1ContractService) GetRateSchedule

For a specific customer and contract, get the rates at a specific point in time. This endpoint takes the contract's rate card into consideration, including scheduled changes. It also takes into account overrides on the contract.

For example, if you want to show your customer a summary of the prices they are paying, inclusive of any negotiated discounts or promotions, use this endpoint. This endpoint only returns rates that are entitled.

func (*V1ContractService) GetSubscriptionQuantityHistory

Get the history of subscription quantities and prices over time for a given `subscription_id`. This endpoint can be used to power an in-product experience where you show a customer their historical changes to seat count. Future changes are not included in this endpoint - use the `getContract` endpoint to view the future scheduled changes to a subscription's quantity.

Subscriptions are used to model fixed recurring fees as well as seat-based recurring fees. To model changes to the number of seats in Metronome, you can increment or decrement the quantity on a subscription at any point in the past or future.

func (*V1ContractService) List

Retrieves all contracts for a specific customer, including pricing, terms, credits, and commitments. Use this to view a customer's contract history and current agreements for billing management. Returns contract details with optional ledgers and balance information.

⚠️ Note: This is the legacy v1 endpoint - new integrations should use the v2 endpoint for enhanced features.

func (*V1ContractService) ListBalances

Retrieve a comprehensive view of all available balances (commits and credits) for a customer. This endpoint provides real-time visibility into prepaid funds, postpaid commitments, promotional credits, and other balance types that can offset usage charges, helping you build transparent billing experiences.

### Use this endpoint to:

- Display current available balances in customer dashboards - Verify available funds before approving high-usage operations - Generate balance reports for finance teams - Filter balances by contract or date ranges

### Key response fields:

An array of balance objects (all credits and commits) containing:

  • Balance details: Current available amount for each commit or credit
  • Metadata: Product associations, priorities, applicable date ranges
  • Optional ledger entries: Detailed transaction history (if `include_ledgers=true`)
  • Balance calculations: Including pending transactions and future-dated entries
  • Custom fields: Any additional metadata attached to balances

### Usage guidelines:

  • Date filtering: Use `effective_before` to include only balances with access before a specific date (exclusive)
  • Set `include_balance=true` for calculated balance amounts on each commit or credit
  • Set `include_ledgers=true` for full transaction history
  • Set `include_contract_balances = true` to see contract level balances
  • Balance logic: Reflects currently accessible amounts, excluding expired/future segments
  • Manual adjustments: Includes all manual ledger entries, even future-dated ones

func (*V1ContractService) ListBalancesAutoPaging added in v1.0.0

Retrieve a comprehensive view of all available balances (commits and credits) for a customer. This endpoint provides real-time visibility into prepaid funds, postpaid commitments, promotional credits, and other balance types that can offset usage charges, helping you build transparent billing experiences.

### Use this endpoint to:

- Display current available balances in customer dashboards - Verify available funds before approving high-usage operations - Generate balance reports for finance teams - Filter balances by contract or date ranges

### Key response fields:

An array of balance objects (all credits and commits) containing:

  • Balance details: Current available amount for each commit or credit
  • Metadata: Product associations, priorities, applicable date ranges
  • Optional ledger entries: Detailed transaction history (if `include_ledgers=true`)
  • Balance calculations: Including pending transactions and future-dated entries
  • Custom fields: Any additional metadata attached to balances

### Usage guidelines:

  • Date filtering: Use `effective_before` to include only balances with access before a specific date (exclusive)
  • Set `include_balance=true` for calculated balance amounts on each commit or credit
  • Set `include_ledgers=true` for full transaction history
  • Set `include_contract_balances = true` to see contract level balances
  • Balance logic: Reflects currently accessible amounts, excluding expired/future segments
  • Manual adjustments: Includes all manual ledger entries, even future-dated ones

func (*V1ContractService) New

Contracts define a customer's products, pricing, discounts, access duration, and billing configuration. Contracts serve as the central billing agreement for both PLG and Enterprise customers, you can automatically customers access to your products and services directly from your product or CRM.

### Use this endpoint to:

  • PLG onboarding: Automatically provision new self-serve customers with contracts when they sign up.
  • Enterprise sales: Push negotiated contracts from Salesforce with custom pricing and commitments
  • Promotional pricing: Implement time-limited discounts and free trials through overrides

### Key components:

#### Contract Term and Billing Schedule

  • Set contract duration using `starting_at` and `ending_before` fields. PLG contracts typically use perpetual agreements (no end date), while Enterprise contracts have fixed end dates which can be edited over time in the case of co-term upsells.

#### Rate Card

If you are offering usage based pricing, you can set a rate card for the contract to reference through `rate_card_id` or `rate_card_alias`. The rate card is a store of all of your usage based products and their centralized pricing. Any new products or price changes on the rate card can be set to automatically propagate to all associated contracts - this ensures consistent pricing and product launches flow to contracts without manual updates and migrations. The `usage_statement_schedule` determines the cadence on which Metronome will finalize a usage invoice for the customer. This defaults to monthly on the 1st, with options for custom dates, quarterly, or annual cadences. Note: Most usage based billing companies align usage statements to be evaluated aligned to the first of the month. Read more about [Rate Cards](https://docs.metronome.com/pricing-packaging/create-manage-rate-cards/).

#### Overrides and discounts

Customize pricing on the contract through time-bounded overrides that can target specific products, product families, or complex usage scenarios. Overrides enable two key capabilities:

  • Discounts: Apply percentage discounts, fixed rate reductions, or quantity-based pricing tiers
  • Entitlements: Provide special pricing or access to specific products for negotiated deals

Read more about [Contract Overrides](https://docs.metronome.com/manage-product-access/add-contract-override/).

#### Commits and Credits

Using commits, configure prepaid or postpaid spending commitments where customers promise to spend a certain amount over the contract period paid in advance or in arrears. Use credits to provide free spending allowances. Under the hood these are the same mechanisms, however, credits are typically offered for free (SLA or promotional) or as a part of an allotment associated with a Subscription.

In Metronome, you can set commits and credits to only be applicable for a subset of usage. Use `applicable_product_ids` or `applicable_product_tags` to create product or product-family specific commits or credits, or you can build complex boolean logic specifiers to target usage based on pricing and presentation group values using `override_specifiers`.

These objects can also also be configured to have a recurrence schedule to easily model customer packaging which includes recurring monthly or quarterly allotments.

Commits support rollover settings (`rollover_fraction`) to transfer unused balances between contract periods, either entirely or as a percentage.

Read more about [Credits and Commits](https://docs.metronome.com/pricing-packaging/apply-credits-commits/).

#### Subscriptions

You can add a fixed recurring charge to a contract, like monthly licenses or seat-based fees, using the subscription charge. Subscription charges are defined on your rate card and you can select which subscription is applicable to add to each contract. When you add a subscription to a contract you need to:

  • Define whether the subscription is paid for in-advance or in-arrears (`collection_schedule`)
  • Define the proration behavior (`proration`)
  • Specify an initial quantity (`initial_quantity`)
  • Define which subscription rate on the rate card should be used (`subscription_rate`)

Read more about [Subscriptions](https://docs.metronome.com/manage-product-access/create-subscription/).

#### Scheduled Charges

Set up one-time, recurring, or entirely custom charges that occur on specific dates, separate from usage-based billing or commitments. These can be used to model non-recurring platform charges or professional services.

#### Threshold Billing

Metronome allows you to configure automatic billing triggers when customers reach spending thresholds to prevent fraud and manage risk. You can use `spend_threshold_configuration` to trigger an invoice to cover current charges whenever the threshold is reached or you can ensure the customer maintains a minimum prepaid balance using the `prepaid_balance_configuration`.

Read more about [Spend Threshold](https://docs.metronome.com/manage-product-access/spend-thresholds/) and [Prepaid Balance Thresholds](https://docs.metronome.com/manage-product-access/prepaid-balance-thresholds/).

### Usage guidelines:

func (*V1ContractService) NewHistoricalInvoices

Create historical usage invoices for past billing periods on specific contracts. Use this endpoint to generate retroactive invoices with custom usage line items, quantities, and date ranges. Supports preview mode to validate invoice data before creation. Ideal for billing migrations or correcting past billing periods.

func (*V1ContractService) ScheduleProServicesInvoice

Create a new scheduled invoice for Professional Services terms on a contract. This endpoint's availability is dependent on your client's configuration.

func (*V1ContractService) SetUsageFilter

func (r *V1ContractService) SetUsageFilter(ctx context.Context, body V1ContractSetUsageFilterParams, opts ...option.RequestOption) (err error)

If a customer has multiple contracts with overlapping rates, the usage filter routes usage to the appropriate contract based on a predefined group key.

As an example, imagine you have a customer associated with two projects. Each project is associated with its own contract. You can create a usage filter with group key `project_id` on each contract, and route usage for `project_1` to the first contract and `project_2` to the second contract.

### Use this endpoint to:

  • Support enterprise contracting scenarios where multiple contracts are associated to the same customer with the same rates.
  • Update the usage filter associated with the contract over time.

### Usage guidelines:

To use usage filters, the `group_key` must be defined on the billable metrics underlying the rate card on the contracts.

func (*V1ContractService) UpdateEndDate

Update or and an end date to a contract. Ending a contract early will impact draft usage statements, truncate any terms, and remove upcoming scheduled invoices. Moving the date into the future will only extend the contract length. Terms and scheduled invoices are not extended. Use this if a contract's end date has changed or if a perpetual contract ends.

type V1ContractSetUsageFilterParams

type V1ContractSetUsageFilterParams struct {
	ContractID  string    `json:"contract_id,required" format:"uuid"`
	CustomerID  string    `json:"customer_id,required" format:"uuid"`
	GroupKey    string    `json:"group_key,required"`
	GroupValues []string  `json:"group_values,omitzero,required"`
	StartingAt  time.Time `json:"starting_at,required" format:"date-time"`
	// contains filtered or unexported fields
}

func (V1ContractSetUsageFilterParams) MarshalJSON

func (r V1ContractSetUsageFilterParams) MarshalJSON() (data []byte, err error)

func (*V1ContractSetUsageFilterParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractSetUsageFilterParams) UnmarshalJSON(data []byte) error

type V1ContractUpdateEndDateParams

type V1ContractUpdateEndDateParams struct {
	// ID of the contract to update
	ContractID string `json:"contract_id,required" format:"uuid"`
	// ID of the customer whose contract is to be updated
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// If true, allows setting the contract end date earlier than the end_timestamp of
	// existing finalized invoices. Finalized invoices will be unchanged; if you want
	// to incorporate the new end date, you can void and regenerate finalized usage
	// invoices. Defaults to true.
	AllowEndingBeforeFinalizedInvoice param.Opt[bool] `json:"allow_ending_before_finalized_invoice,omitzero"`
	// RFC 3339 timestamp indicating when the contract will end (exclusive). If not
	// provided, the contract will be updated to be open-ended.
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

func (V1ContractUpdateEndDateParams) MarshalJSON

func (r V1ContractUpdateEndDateParams) MarshalJSON() (data []byte, err error)

func (*V1ContractUpdateEndDateParams) UnmarshalJSON added in v1.0.0

func (r *V1ContractUpdateEndDateParams) UnmarshalJSON(data []byte) error

type V1ContractUpdateEndDateResponse

type V1ContractUpdateEndDateResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ContractUpdateEndDateResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ContractUpdateEndDateResponse) UnmarshalJSON

func (r *V1ContractUpdateEndDateResponse) UnmarshalJSON(data []byte) error

type V1CreditGrantEditParams

type V1CreditGrantEditParams struct {
	// the ID of the credit grant
	ID string `json:"id,required" format:"uuid"`
	// the updated credit grant type
	CreditGrantType param.Opt[string] `json:"credit_grant_type,omitzero"`
	// the updated expiration date for the credit grant
	ExpiresAt param.Opt[time.Time] `json:"expires_at,omitzero" format:"date-time"`
	// the updated name for the credit grant
	Name param.Opt[string] `json:"name,omitzero"`
	// contains filtered or unexported fields
}

func (V1CreditGrantEditParams) MarshalJSON

func (r V1CreditGrantEditParams) MarshalJSON() (data []byte, err error)

func (*V1CreditGrantEditParams) UnmarshalJSON added in v1.0.0

func (r *V1CreditGrantEditParams) UnmarshalJSON(data []byte) error

type V1CreditGrantEditResponse

type V1CreditGrantEditResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CreditGrantEditResponse) RawJSON added in v1.0.0

func (r V1CreditGrantEditResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1CreditGrantEditResponse) UnmarshalJSON

func (r *V1CreditGrantEditResponse) UnmarshalJSON(data []byte) error

type V1CreditGrantListEntriesParams

type V1CreditGrantListEntriesParams struct {
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	// If supplied, ledger entries will only be returned with an effective_at before
	// this time. This timestamp must not be in the future. If no timestamp is
	// supplied, all entries up to the start of the customer's next billing period will
	// be returned.
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	// If supplied, only ledger entries effective at or after this time will be
	// returned.
	StartingOn param.Opt[time.Time] `json:"starting_on,omitzero" format:"date-time"`
	// Ledgers sort order by date, asc or desc. Defaults to asc.
	//
	// Any of "asc", "desc".
	Sort V1CreditGrantListEntriesParamsSort `query:"sort,omitzero" json:"-"`
	// A list of Metronome credit type IDs to fetch ledger entries for. If absent,
	// ledger entries for all credit types will be returned.
	CreditTypeIDs []string `json:"credit_type_ids,omitzero" format:"uuid"`
	// A list of Metronome customer IDs to fetch ledger entries for. If absent, ledger
	// entries for all customers will be returned.
	CustomerIDs []string `json:"customer_ids,omitzero" format:"uuid"`
	// contains filtered or unexported fields
}

func (V1CreditGrantListEntriesParams) MarshalJSON

func (r V1CreditGrantListEntriesParams) MarshalJSON() (data []byte, err error)

func (V1CreditGrantListEntriesParams) URLQuery

func (r V1CreditGrantListEntriesParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1CreditGrantListEntriesParams's query parameters as `url.Values`.

func (*V1CreditGrantListEntriesParams) UnmarshalJSON added in v1.0.0

func (r *V1CreditGrantListEntriesParams) UnmarshalJSON(data []byte) error

type V1CreditGrantListEntriesParamsSort

type V1CreditGrantListEntriesParamsSort string

Ledgers sort order by date, asc or desc. Defaults to asc.

const (
	V1CreditGrantListEntriesParamsSortAsc  V1CreditGrantListEntriesParamsSort = "asc"
	V1CreditGrantListEntriesParamsSortDesc V1CreditGrantListEntriesParamsSort = "desc"
)

type V1CreditGrantListEntriesResponse

type V1CreditGrantListEntriesResponse struct {
	CustomerID string                                   `json:"customer_id,required" format:"uuid"`
	Ledgers    []V1CreditGrantListEntriesResponseLedger `json:"ledgers,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CustomerID  respjson.Field
		Ledgers     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CreditGrantListEntriesResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CreditGrantListEntriesResponse) UnmarshalJSON

func (r *V1CreditGrantListEntriesResponse) UnmarshalJSON(data []byte) error

type V1CreditGrantListEntriesResponseLedger added in v1.0.0

type V1CreditGrantListEntriesResponseLedger struct {
	CreditType shared.CreditTypeData `json:"credit_type,required"`
	// the effective balances at the end of the specified time window
	EndingBalance   V1CreditGrantListEntriesResponseLedgerEndingBalance   `json:"ending_balance,required"`
	Entries         []CreditLedgerEntry                                   `json:"entries,required"`
	PendingEntries  []CreditLedgerEntry                                   `json:"pending_entries,required"`
	StartingBalance V1CreditGrantListEntriesResponseLedgerStartingBalance `json:"starting_balance,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreditType      respjson.Field
		EndingBalance   respjson.Field
		Entries         respjson.Field
		PendingEntries  respjson.Field
		StartingBalance respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CreditGrantListEntriesResponseLedger) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CreditGrantListEntriesResponseLedger) UnmarshalJSON added in v1.0.0

func (r *V1CreditGrantListEntriesResponseLedger) UnmarshalJSON(data []byte) error

type V1CreditGrantListEntriesResponseLedgerEndingBalance added in v1.0.0

type V1CreditGrantListEntriesResponseLedgerEndingBalance struct {
	// the ending_before request parameter (if supplied) or the current billing
	// period's end date
	EffectiveAt time.Time `json:"effective_at,required" format:"date-time"`
	// the ending balance, including the balance of all grants that have not expired
	// before the effective_at date and deductions that happened before the
	// effective_at date
	ExcludingPending float64 `json:"excluding_pending,required"`
	// the excluding_pending balance plus any pending invoice deductions and
	// expirations that will happen by the effective_at date
	IncludingPending float64 `json:"including_pending,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EffectiveAt      respjson.Field
		ExcludingPending respjson.Field
		IncludingPending respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

the effective balances at the end of the specified time window

func (V1CreditGrantListEntriesResponseLedgerEndingBalance) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CreditGrantListEntriesResponseLedgerEndingBalance) UnmarshalJSON added in v1.0.0

type V1CreditGrantListEntriesResponseLedgerStartingBalance added in v1.0.0

type V1CreditGrantListEntriesResponseLedgerStartingBalance struct {
	// the starting_on request parameter (if supplied) or the first credit grant's
	// effective_at date
	EffectiveAt time.Time `json:"effective_at,required" format:"date-time"`
	// the starting balance, including all posted grants, deductions, and expirations
	// that happened at or before the effective_at timestamp
	ExcludingPending float64 `json:"excluding_pending,required"`
	// the excluding_pending balance plus any pending activity that has not been posted
	// at the time of the query
	IncludingPending float64 `json:"including_pending,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EffectiveAt      respjson.Field
		ExcludingPending respjson.Field
		IncludingPending respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CreditGrantListEntriesResponseLedgerStartingBalance) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CreditGrantListEntriesResponseLedgerStartingBalance) UnmarshalJSON added in v1.0.0

type V1CreditGrantListParams

type V1CreditGrantListParams struct {
	// Max number of results that should be returned
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	// Only return credit grants that are effective before this timestamp (exclusive).
	EffectiveBefore param.Opt[time.Time] `json:"effective_before,omitzero" format:"date-time"`
	// Only return credit grants that expire at or after this timestamp.
	NotExpiringBefore param.Opt[time.Time] `json:"not_expiring_before,omitzero" format:"date-time"`
	// An array of credit grant IDs. If this is specified, neither credit_type_ids nor
	// customer_ids may be specified.
	CreditGrantIDs []string `json:"credit_grant_ids,omitzero" format:"uuid"`
	// An array of credit type IDs. This must not be specified if credit_grant_ids is
	// specified.
	CreditTypeIDs []string `json:"credit_type_ids,omitzero" format:"uuid"`
	// An array of Metronome customer IDs. This must not be specified if
	// credit_grant_ids is specified.
	CustomerIDs []string `json:"customer_ids,omitzero" format:"uuid"`
	// contains filtered or unexported fields
}

func (V1CreditGrantListParams) MarshalJSON

func (r V1CreditGrantListParams) MarshalJSON() (data []byte, err error)

func (V1CreditGrantListParams) URLQuery

func (r V1CreditGrantListParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1CreditGrantListParams's query parameters as `url.Values`.

func (*V1CreditGrantListParams) UnmarshalJSON added in v1.0.0

func (r *V1CreditGrantListParams) UnmarshalJSON(data []byte) error

type V1CreditGrantListResponse

type V1CreditGrantListResponse struct {
	// the Metronome ID of the credit grant
	ID string `json:"id,required" format:"uuid"`
	// The effective balance of the grant as of the end of the customer's current
	// billing period. Expiration deductions will be included only if the grant expires
	// before the end of the current billing period.
	Balance V1CreditGrantListResponseBalance `json:"balance,required"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,required"`
	// the Metronome ID of the customer
	CustomerID  string              `json:"customer_id,required" format:"uuid"`
	Deductions  []CreditLedgerEntry `json:"deductions,required"`
	EffectiveAt time.Time           `json:"effective_at,required" format:"date-time"`
	ExpiresAt   time.Time           `json:"expires_at,required" format:"date-time"`
	// the amount of credits initially granted
	GrantAmount V1CreditGrantListResponseGrantAmount `json:"grant_amount,required"`
	Name        string                               `json:"name,required"`
	// the amount paid for this credit grant
	PaidAmount        V1CreditGrantListResponsePaidAmount `json:"paid_amount,required"`
	PendingDeductions []CreditLedgerEntry                 `json:"pending_deductions,required"`
	Priority          float64                             `json:"priority,required"`
	CreditGrantType   string                              `json:"credit_grant_type,nullable"`
	// the Metronome ID of the invoice with the purchase charge for this credit grant,
	// if applicable
	InvoiceID string `json:"invoice_id,nullable" format:"uuid"`
	// The products which these credits will be applied to. (If unspecified, the
	// credits will be applied to charges for all products.)
	Products []V1CreditGrantListResponseProduct `json:"products"`
	Reason   string                             `json:"reason,nullable"`
	// Prevents the creation of duplicates. If a request to create a record is made
	// with a previously used uniqueness key, a new record will not be created and the
	// request will fail with a 409 error.
	UniquenessKey string `json:"uniqueness_key,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                respjson.Field
		Balance           respjson.Field
		CustomFields      respjson.Field
		CustomerID        respjson.Field
		Deductions        respjson.Field
		EffectiveAt       respjson.Field
		ExpiresAt         respjson.Field
		GrantAmount       respjson.Field
		Name              respjson.Field
		PaidAmount        respjson.Field
		PendingDeductions respjson.Field
		Priority          respjson.Field
		CreditGrantType   respjson.Field
		InvoiceID         respjson.Field
		Products          respjson.Field
		Reason            respjson.Field
		UniquenessKey     respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CreditGrantListResponse) RawJSON added in v1.0.0

func (r V1CreditGrantListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1CreditGrantListResponse) UnmarshalJSON

func (r *V1CreditGrantListResponse) UnmarshalJSON(data []byte) error

type V1CreditGrantListResponseBalance

type V1CreditGrantListResponseBalance struct {
	// The end_date of the customer's current billing period.
	EffectiveAt time.Time `json:"effective_at,required" format:"date-time"`
	// The grant's current balance including all posted deductions. If the grant has
	// expired, this amount will be 0.
	ExcludingPending float64 `json:"excluding_pending,required"`
	// The grant's current balance including all posted and pending deductions. If the
	// grant expires before the end of the customer's current billing period, this
	// amount will be 0.
	IncludingPending float64 `json:"including_pending,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EffectiveAt      respjson.Field
		ExcludingPending respjson.Field
		IncludingPending respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The effective balance of the grant as of the end of the customer's current billing period. Expiration deductions will be included only if the grant expires before the end of the current billing period.

func (V1CreditGrantListResponseBalance) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CreditGrantListResponseBalance) UnmarshalJSON

func (r *V1CreditGrantListResponseBalance) UnmarshalJSON(data []byte) error

type V1CreditGrantListResponseGrantAmount

type V1CreditGrantListResponseGrantAmount struct {
	Amount float64 `json:"amount,required"`
	// the credit type for the amount granted
	CreditType shared.CreditTypeData `json:"credit_type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Amount      respjson.Field
		CreditType  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

the amount of credits initially granted

func (V1CreditGrantListResponseGrantAmount) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CreditGrantListResponseGrantAmount) UnmarshalJSON

func (r *V1CreditGrantListResponseGrantAmount) UnmarshalJSON(data []byte) error

type V1CreditGrantListResponsePaidAmount

type V1CreditGrantListResponsePaidAmount struct {
	Amount float64 `json:"amount,required"`
	// the credit type for the amount paid
	CreditType shared.CreditTypeData `json:"credit_type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Amount      respjson.Field
		CreditType  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

the amount paid for this credit grant

func (V1CreditGrantListResponsePaidAmount) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CreditGrantListResponsePaidAmount) UnmarshalJSON

func (r *V1CreditGrantListResponsePaidAmount) UnmarshalJSON(data []byte) error

type V1CreditGrantListResponseProduct

type V1CreditGrantListResponseProduct struct {
	ID   string `json:"id,required"`
	Name string `json:"name,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CreditGrantListResponseProduct) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CreditGrantListResponseProduct) UnmarshalJSON

func (r *V1CreditGrantListResponseProduct) UnmarshalJSON(data []byte) error

type V1CreditGrantNewParams

type V1CreditGrantNewParams struct {
	// the Metronome ID of the customer
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// The credit grant will only apply to usage or charges dated before this timestamp
	ExpiresAt time.Time `json:"expires_at,required" format:"date-time"`
	// the amount of credits granted
	GrantAmount V1CreditGrantNewParamsGrantAmount `json:"grant_amount,omitzero,required"`
	// the name of the credit grant as it will appear on invoices
	Name string `json:"name,required"`
	// the amount paid for this credit grant
	PaidAmount      V1CreditGrantNewParamsPaidAmount `json:"paid_amount,omitzero,required"`
	Priority        float64                          `json:"priority,required"`
	CreditGrantType param.Opt[string]                `json:"credit_grant_type,omitzero"`
	// The credit grant will only apply to usage or charges dated on or after this
	// timestamp
	EffectiveAt param.Opt[time.Time] `json:"effective_at,omitzero" format:"date-time"`
	// The date to issue an invoice for the paid_amount.
	InvoiceDate param.Opt[time.Time] `json:"invoice_date,omitzero" format:"date-time"`
	Reason      param.Opt[string]    `json:"reason,omitzero"`
	// Prevents the creation of duplicates. If a request to create a record is made
	// with a previously used uniqueness key, a new record will not be created and the
	// request will fail with a 409 error.
	UniquenessKey param.Opt[string] `json:"uniqueness_key,omitzero"`
	// Custom fields to attach to the credit grant.
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// The product(s) which these credits will be applied to. (If unspecified, the
	// credits will be applied to charges for all products.). The array ordering
	// specified here will be used to determine the order in which credits will be
	// applied to invoice line items
	ProductIDs []string `json:"product_ids,omitzero" format:"uuid"`
	// Configure a rollover for this credit grant so if it expires it rolls over a
	// configured amount to a new credit grant. This feature is currently opt-in only.
	// Contact Metronome to be added to the beta.
	RolloverSettings V1CreditGrantNewParamsRolloverSettings `json:"rollover_settings,omitzero"`
	// contains filtered or unexported fields
}

func (V1CreditGrantNewParams) MarshalJSON

func (r V1CreditGrantNewParams) MarshalJSON() (data []byte, err error)

func (*V1CreditGrantNewParams) UnmarshalJSON added in v1.0.0

func (r *V1CreditGrantNewParams) UnmarshalJSON(data []byte) error

type V1CreditGrantNewParamsGrantAmount

type V1CreditGrantNewParamsGrantAmount struct {
	Amount float64 `json:"amount,required"`
	// the ID of the pricing unit to be used. Defaults to USD (cents) if not passed.
	CreditTypeID string `json:"credit_type_id,required" format:"uuid"`
	// contains filtered or unexported fields
}

the amount of credits granted

The properties Amount, CreditTypeID are required.

func (V1CreditGrantNewParamsGrantAmount) MarshalJSON

func (r V1CreditGrantNewParamsGrantAmount) MarshalJSON() (data []byte, err error)

func (*V1CreditGrantNewParamsGrantAmount) UnmarshalJSON added in v1.0.0

func (r *V1CreditGrantNewParamsGrantAmount) UnmarshalJSON(data []byte) error

type V1CreditGrantNewParamsPaidAmount

type V1CreditGrantNewParamsPaidAmount struct {
	Amount float64 `json:"amount,required"`
	// the ID of the pricing unit to be used. Defaults to USD (cents) if not passed.
	CreditTypeID string `json:"credit_type_id,required" format:"uuid"`
	// contains filtered or unexported fields
}

the amount paid for this credit grant

The properties Amount, CreditTypeID are required.

func (V1CreditGrantNewParamsPaidAmount) MarshalJSON

func (r V1CreditGrantNewParamsPaidAmount) MarshalJSON() (data []byte, err error)

func (*V1CreditGrantNewParamsPaidAmount) UnmarshalJSON added in v1.0.0

func (r *V1CreditGrantNewParamsPaidAmount) UnmarshalJSON(data []byte) error

type V1CreditGrantNewParamsRolloverSettings

type V1CreditGrantNewParamsRolloverSettings struct {
	// The date to expire the rollover credits.
	ExpiresAt time.Time `json:"expires_at,required" format:"date-time"`
	// The priority to give the rollover credit grant that gets created when a rollover
	// happens.
	Priority float64 `json:"priority,required"`
	// Specify how much to rollover to the rollover credit grant
	RolloverAmount V1CreditGrantNewParamsRolloverSettingsRolloverAmountUnion `json:"rollover_amount,omitzero,required"`
	// contains filtered or unexported fields
}

Configure a rollover for this credit grant so if it expires it rolls over a configured amount to a new credit grant. This feature is currently opt-in only. Contact Metronome to be added to the beta.

The properties ExpiresAt, Priority, RolloverAmount are required.

func (V1CreditGrantNewParamsRolloverSettings) MarshalJSON

func (r V1CreditGrantNewParamsRolloverSettings) MarshalJSON() (data []byte, err error)

func (*V1CreditGrantNewParamsRolloverSettings) UnmarshalJSON added in v1.0.0

func (r *V1CreditGrantNewParamsRolloverSettings) UnmarshalJSON(data []byte) error

type V1CreditGrantNewParamsRolloverSettingsRolloverAmountUnion

type V1CreditGrantNewParamsRolloverSettingsRolloverAmountUnion struct {
	OfRolloverAmountMaxPercentage *RolloverAmountMaxPercentageParam `json:",omitzero,inline"`
	OfRolloverAmountMaxAmount     *RolloverAmountMaxAmountParam     `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (V1CreditGrantNewParamsRolloverSettingsRolloverAmountUnion) GetType added in v1.0.0

Returns a pointer to the underlying variant's property, if present.

func (V1CreditGrantNewParamsRolloverSettingsRolloverAmountUnion) GetValue added in v1.0.0

Returns a pointer to the underlying variant's property, if present.

func (V1CreditGrantNewParamsRolloverSettingsRolloverAmountUnion) MarshalJSON added in v1.0.0

func (*V1CreditGrantNewParamsRolloverSettingsRolloverAmountUnion) UnmarshalJSON added in v1.0.0

type V1CreditGrantNewResponse

type V1CreditGrantNewResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CreditGrantNewResponse) RawJSON added in v1.0.0

func (r V1CreditGrantNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1CreditGrantNewResponse) UnmarshalJSON

func (r *V1CreditGrantNewResponse) UnmarshalJSON(data []byte) error

type V1CreditGrantService

type V1CreditGrantService struct {
	Options []option.RequestOption
}

V1CreditGrantService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1CreditGrantService method instead.

func NewV1CreditGrantService

func NewV1CreditGrantService(opts ...option.RequestOption) (r V1CreditGrantService)

NewV1CreditGrantService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1CreditGrantService) Edit

Edit an existing credit grant

func (*V1CreditGrantService) List

List credit grants. This list does not included voided grants.

func (*V1CreditGrantService) ListAutoPaging

List credit grants. This list does not included voided grants.

func (*V1CreditGrantService) ListEntries

Fetches a list of credit ledger entries. Returns lists of ledgers per customer. Ledger entries are returned in chronological order. Ledger entries associated with voided credit grants are not included.

func (*V1CreditGrantService) ListEntriesAutoPaging added in v1.0.0

Fetches a list of credit ledger entries. Returns lists of ledgers per customer. Ledger entries are returned in chronological order. Ledger entries associated with voided credit grants are not included.

func (*V1CreditGrantService) New

Create a new credit grant

func (*V1CreditGrantService) Void

Void a credit grant

type V1CreditGrantVoidParams

type V1CreditGrantVoidParams struct {
	ID string `json:"id,required" format:"uuid"`
	// If true, resets the uniqueness key on this grant so it can be re-used
	ReleaseUniquenessKey param.Opt[bool] `json:"release_uniqueness_key,omitzero"`
	// If true, void the purchase invoice associated with the grant
	VoidCreditPurchaseInvoice param.Opt[bool] `json:"void_credit_purchase_invoice,omitzero"`
	// contains filtered or unexported fields
}

func (V1CreditGrantVoidParams) MarshalJSON

func (r V1CreditGrantVoidParams) MarshalJSON() (data []byte, err error)

func (*V1CreditGrantVoidParams) UnmarshalJSON added in v1.0.0

func (r *V1CreditGrantVoidParams) UnmarshalJSON(data []byte) error

type V1CreditGrantVoidResponse

type V1CreditGrantVoidResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CreditGrantVoidResponse) RawJSON added in v1.0.0

func (r V1CreditGrantVoidResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1CreditGrantVoidResponse) UnmarshalJSON

func (r *V1CreditGrantVoidResponse) UnmarshalJSON(data []byte) error

type V1CustomFieldAddKeyParams

type V1CustomFieldAddKeyParams struct {
	EnforceUniqueness bool `json:"enforce_uniqueness,required"`
	// Any of "alert", "billable_metric", "charge", "commit", "contract_credit",
	// "contract_product", "contract", "credit_grant", "customer_plan", "customer",
	// "discount", "invoice", "plan", "professional_service", "product", "rate_card",
	// "scheduled_charge", "subscription".
	Entity V1CustomFieldAddKeyParamsEntity `json:"entity,omitzero,required"`
	Key    string                          `json:"key,required"`
	// contains filtered or unexported fields
}

func (V1CustomFieldAddKeyParams) MarshalJSON

func (r V1CustomFieldAddKeyParams) MarshalJSON() (data []byte, err error)

func (*V1CustomFieldAddKeyParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomFieldAddKeyParams) UnmarshalJSON(data []byte) error

type V1CustomFieldAddKeyParamsEntity

type V1CustomFieldAddKeyParamsEntity string
const (
	V1CustomFieldAddKeyParamsEntityAlert               V1CustomFieldAddKeyParamsEntity = "alert"
	V1CustomFieldAddKeyParamsEntityBillableMetric      V1CustomFieldAddKeyParamsEntity = "billable_metric"
	V1CustomFieldAddKeyParamsEntityCharge              V1CustomFieldAddKeyParamsEntity = "charge"
	V1CustomFieldAddKeyParamsEntityCommit              V1CustomFieldAddKeyParamsEntity = "commit"
	V1CustomFieldAddKeyParamsEntityContractCredit      V1CustomFieldAddKeyParamsEntity = "contract_credit"
	V1CustomFieldAddKeyParamsEntityContractProduct     V1CustomFieldAddKeyParamsEntity = "contract_product"
	V1CustomFieldAddKeyParamsEntityContract            V1CustomFieldAddKeyParamsEntity = "contract"
	V1CustomFieldAddKeyParamsEntityCreditGrant         V1CustomFieldAddKeyParamsEntity = "credit_grant"
	V1CustomFieldAddKeyParamsEntityCustomerPlan        V1CustomFieldAddKeyParamsEntity = "customer_plan"
	V1CustomFieldAddKeyParamsEntityCustomer            V1CustomFieldAddKeyParamsEntity = "customer"
	V1CustomFieldAddKeyParamsEntityDiscount            V1CustomFieldAddKeyParamsEntity = "discount"
	V1CustomFieldAddKeyParamsEntityInvoice             V1CustomFieldAddKeyParamsEntity = "invoice"
	V1CustomFieldAddKeyParamsEntityPlan                V1CustomFieldAddKeyParamsEntity = "plan"
	V1CustomFieldAddKeyParamsEntityProfessionalService V1CustomFieldAddKeyParamsEntity = "professional_service"
	V1CustomFieldAddKeyParamsEntityProduct             V1CustomFieldAddKeyParamsEntity = "product"
	V1CustomFieldAddKeyParamsEntityRateCard            V1CustomFieldAddKeyParamsEntity = "rate_card"
	V1CustomFieldAddKeyParamsEntityScheduledCharge     V1CustomFieldAddKeyParamsEntity = "scheduled_charge"
	V1CustomFieldAddKeyParamsEntitySubscription        V1CustomFieldAddKeyParamsEntity = "subscription"
)

type V1CustomFieldDeleteValuesParams

type V1CustomFieldDeleteValuesParams struct {
	// Any of "alert", "billable_metric", "charge", "commit", "contract_credit",
	// "contract_product", "contract", "credit_grant", "customer_plan", "customer",
	// "discount", "invoice", "plan", "professional_service", "product", "rate_card",
	// "scheduled_charge", "subscription".
	Entity   V1CustomFieldDeleteValuesParamsEntity `json:"entity,omitzero,required"`
	EntityID string                                `json:"entity_id,required" format:"uuid"`
	Keys     []string                              `json:"keys,omitzero,required"`
	// contains filtered or unexported fields
}

func (V1CustomFieldDeleteValuesParams) MarshalJSON

func (r V1CustomFieldDeleteValuesParams) MarshalJSON() (data []byte, err error)

func (*V1CustomFieldDeleteValuesParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomFieldDeleteValuesParams) UnmarshalJSON(data []byte) error

type V1CustomFieldDeleteValuesParamsEntity

type V1CustomFieldDeleteValuesParamsEntity string
const (
	V1CustomFieldDeleteValuesParamsEntityAlert               V1CustomFieldDeleteValuesParamsEntity = "alert"
	V1CustomFieldDeleteValuesParamsEntityBillableMetric      V1CustomFieldDeleteValuesParamsEntity = "billable_metric"
	V1CustomFieldDeleteValuesParamsEntityCharge              V1CustomFieldDeleteValuesParamsEntity = "charge"
	V1CustomFieldDeleteValuesParamsEntityCommit              V1CustomFieldDeleteValuesParamsEntity = "commit"
	V1CustomFieldDeleteValuesParamsEntityContractCredit      V1CustomFieldDeleteValuesParamsEntity = "contract_credit"
	V1CustomFieldDeleteValuesParamsEntityContractProduct     V1CustomFieldDeleteValuesParamsEntity = "contract_product"
	V1CustomFieldDeleteValuesParamsEntityContract            V1CustomFieldDeleteValuesParamsEntity = "contract"
	V1CustomFieldDeleteValuesParamsEntityCreditGrant         V1CustomFieldDeleteValuesParamsEntity = "credit_grant"
	V1CustomFieldDeleteValuesParamsEntityCustomerPlan        V1CustomFieldDeleteValuesParamsEntity = "customer_plan"
	V1CustomFieldDeleteValuesParamsEntityCustomer            V1CustomFieldDeleteValuesParamsEntity = "customer"
	V1CustomFieldDeleteValuesParamsEntityDiscount            V1CustomFieldDeleteValuesParamsEntity = "discount"
	V1CustomFieldDeleteValuesParamsEntityInvoice             V1CustomFieldDeleteValuesParamsEntity = "invoice"
	V1CustomFieldDeleteValuesParamsEntityPlan                V1CustomFieldDeleteValuesParamsEntity = "plan"
	V1CustomFieldDeleteValuesParamsEntityProfessionalService V1CustomFieldDeleteValuesParamsEntity = "professional_service"
	V1CustomFieldDeleteValuesParamsEntityProduct             V1CustomFieldDeleteValuesParamsEntity = "product"
	V1CustomFieldDeleteValuesParamsEntityRateCard            V1CustomFieldDeleteValuesParamsEntity = "rate_card"
	V1CustomFieldDeleteValuesParamsEntityScheduledCharge     V1CustomFieldDeleteValuesParamsEntity = "scheduled_charge"
	V1CustomFieldDeleteValuesParamsEntitySubscription        V1CustomFieldDeleteValuesParamsEntity = "subscription"
)

type V1CustomFieldListKeysParams

type V1CustomFieldListKeysParams struct {
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	// Optional list of entity types to return keys for
	//
	// Any of "alert", "billable_metric", "charge", "commit", "contract_credit",
	// "contract_product", "contract", "credit_grant", "customer_plan", "customer",
	// "discount", "invoice", "plan", "professional_service", "product", "rate_card",
	// "scheduled_charge", "subscription".
	Entities []string `json:"entities,omitzero"`
	// contains filtered or unexported fields
}

func (V1CustomFieldListKeysParams) MarshalJSON

func (r V1CustomFieldListKeysParams) MarshalJSON() (data []byte, err error)

func (V1CustomFieldListKeysParams) URLQuery

func (r V1CustomFieldListKeysParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1CustomFieldListKeysParams's query parameters as `url.Values`.

func (*V1CustomFieldListKeysParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomFieldListKeysParams) UnmarshalJSON(data []byte) error

type V1CustomFieldListKeysResponse

type V1CustomFieldListKeysResponse struct {
	EnforceUniqueness bool `json:"enforce_uniqueness,required"`
	// Any of "alert", "billable_metric", "charge", "commit", "contract_credit",
	// "contract_product", "contract", "credit_grant", "customer_plan", "customer",
	// "discount", "invoice", "plan", "professional_service", "product", "rate_card",
	// "scheduled_charge", "subscription".
	Entity V1CustomFieldListKeysResponseEntity `json:"entity,required"`
	Key    string                              `json:"key,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EnforceUniqueness respjson.Field
		Entity            respjson.Field
		Key               respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomFieldListKeysResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CustomFieldListKeysResponse) UnmarshalJSON

func (r *V1CustomFieldListKeysResponse) UnmarshalJSON(data []byte) error

type V1CustomFieldListKeysResponseEntity added in v1.0.0

type V1CustomFieldListKeysResponseEntity string
const (
	V1CustomFieldListKeysResponseEntityAlert               V1CustomFieldListKeysResponseEntity = "alert"
	V1CustomFieldListKeysResponseEntityBillableMetric      V1CustomFieldListKeysResponseEntity = "billable_metric"
	V1CustomFieldListKeysResponseEntityCharge              V1CustomFieldListKeysResponseEntity = "charge"
	V1CustomFieldListKeysResponseEntityCommit              V1CustomFieldListKeysResponseEntity = "commit"
	V1CustomFieldListKeysResponseEntityContractCredit      V1CustomFieldListKeysResponseEntity = "contract_credit"
	V1CustomFieldListKeysResponseEntityContractProduct     V1CustomFieldListKeysResponseEntity = "contract_product"
	V1CustomFieldListKeysResponseEntityContract            V1CustomFieldListKeysResponseEntity = "contract"
	V1CustomFieldListKeysResponseEntityCreditGrant         V1CustomFieldListKeysResponseEntity = "credit_grant"
	V1CustomFieldListKeysResponseEntityCustomerPlan        V1CustomFieldListKeysResponseEntity = "customer_plan"
	V1CustomFieldListKeysResponseEntityCustomer            V1CustomFieldListKeysResponseEntity = "customer"
	V1CustomFieldListKeysResponseEntityDiscount            V1CustomFieldListKeysResponseEntity = "discount"
	V1CustomFieldListKeysResponseEntityInvoice             V1CustomFieldListKeysResponseEntity = "invoice"
	V1CustomFieldListKeysResponseEntityPlan                V1CustomFieldListKeysResponseEntity = "plan"
	V1CustomFieldListKeysResponseEntityProfessionalService V1CustomFieldListKeysResponseEntity = "professional_service"
	V1CustomFieldListKeysResponseEntityProduct             V1CustomFieldListKeysResponseEntity = "product"
	V1CustomFieldListKeysResponseEntityRateCard            V1CustomFieldListKeysResponseEntity = "rate_card"
	V1CustomFieldListKeysResponseEntityScheduledCharge     V1CustomFieldListKeysResponseEntity = "scheduled_charge"
	V1CustomFieldListKeysResponseEntitySubscription        V1CustomFieldListKeysResponseEntity = "subscription"
)

type V1CustomFieldRemoveKeyParams

type V1CustomFieldRemoveKeyParams struct {
	// Any of "alert", "billable_metric", "charge", "commit", "contract_credit",
	// "contract_product", "contract", "credit_grant", "customer_plan", "customer",
	// "discount", "invoice", "plan", "professional_service", "product", "rate_card",
	// "scheduled_charge", "subscription".
	Entity V1CustomFieldRemoveKeyParamsEntity `json:"entity,omitzero,required"`
	Key    string                             `json:"key,required"`
	// contains filtered or unexported fields
}

func (V1CustomFieldRemoveKeyParams) MarshalJSON

func (r V1CustomFieldRemoveKeyParams) MarshalJSON() (data []byte, err error)

func (*V1CustomFieldRemoveKeyParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomFieldRemoveKeyParams) UnmarshalJSON(data []byte) error

type V1CustomFieldRemoveKeyParamsEntity

type V1CustomFieldRemoveKeyParamsEntity string
const (
	V1CustomFieldRemoveKeyParamsEntityAlert               V1CustomFieldRemoveKeyParamsEntity = "alert"
	V1CustomFieldRemoveKeyParamsEntityBillableMetric      V1CustomFieldRemoveKeyParamsEntity = "billable_metric"
	V1CustomFieldRemoveKeyParamsEntityCharge              V1CustomFieldRemoveKeyParamsEntity = "charge"
	V1CustomFieldRemoveKeyParamsEntityCommit              V1CustomFieldRemoveKeyParamsEntity = "commit"
	V1CustomFieldRemoveKeyParamsEntityContractCredit      V1CustomFieldRemoveKeyParamsEntity = "contract_credit"
	V1CustomFieldRemoveKeyParamsEntityContractProduct     V1CustomFieldRemoveKeyParamsEntity = "contract_product"
	V1CustomFieldRemoveKeyParamsEntityContract            V1CustomFieldRemoveKeyParamsEntity = "contract"
	V1CustomFieldRemoveKeyParamsEntityCreditGrant         V1CustomFieldRemoveKeyParamsEntity = "credit_grant"
	V1CustomFieldRemoveKeyParamsEntityCustomerPlan        V1CustomFieldRemoveKeyParamsEntity = "customer_plan"
	V1CustomFieldRemoveKeyParamsEntityCustomer            V1CustomFieldRemoveKeyParamsEntity = "customer"
	V1CustomFieldRemoveKeyParamsEntityDiscount            V1CustomFieldRemoveKeyParamsEntity = "discount"
	V1CustomFieldRemoveKeyParamsEntityInvoice             V1CustomFieldRemoveKeyParamsEntity = "invoice"
	V1CustomFieldRemoveKeyParamsEntityPlan                V1CustomFieldRemoveKeyParamsEntity = "plan"
	V1CustomFieldRemoveKeyParamsEntityProfessionalService V1CustomFieldRemoveKeyParamsEntity = "professional_service"
	V1CustomFieldRemoveKeyParamsEntityProduct             V1CustomFieldRemoveKeyParamsEntity = "product"
	V1CustomFieldRemoveKeyParamsEntityRateCard            V1CustomFieldRemoveKeyParamsEntity = "rate_card"
	V1CustomFieldRemoveKeyParamsEntityScheduledCharge     V1CustomFieldRemoveKeyParamsEntity = "scheduled_charge"
	V1CustomFieldRemoveKeyParamsEntitySubscription        V1CustomFieldRemoveKeyParamsEntity = "subscription"
)

type V1CustomFieldService

type V1CustomFieldService struct {
	Options []option.RequestOption
}

V1CustomFieldService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1CustomFieldService method instead.

func NewV1CustomFieldService

func NewV1CustomFieldService(opts ...option.RequestOption) (r V1CustomFieldService)

NewV1CustomFieldService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1CustomFieldService) AddKey

Creates a new custom field key for a given entity (e.g. billable metric, contract, alert).

Custom fields are properties that you can add to Metronome objects to store metadata like foreign keys or other descriptors. This metadata can get transferred to or accessed by other systems to contextualize Metronome data and power business processes. For example, to service workflows like revenue recognition, reconciliation, and invoicing, custom fields help Metronome know the relationship between entities in the platform and third-party systems.

### Use this endpoint to:

  • Create a new custom field key for Customer objects in Metronome. You can then use the Set Custom Field Values endpoint to set the value of this key for a specific customer.
  • Specify whether the key should enforce uniqueness. If the key is set to enforce uniqueness and you attempt to set a custom field value for the key that already exists, it will fail.

### Usage guidelines:

  • Custom fields set on commits, credits, and contracts can be used to scope alert evaluation. For example, you can create a spend threshold alert that only considers spend associated with contracts with custom field key `contract_type` and value `paygo`
  • Custom fields set on products can be used in the Stripe integration to set metadata on invoices.
  • Custom fields for customers, contracts, invoices, products, commits, scheduled charges, and subscriptions are passed down to the invoice.

func (*V1CustomFieldService) DeleteValues

Remove specific custom field values from a Metronome entity instance by specifying the field keys to delete. Use this endpoint to clean up unwanted custom field data while preserving other fields on the same entity. Requires the entity type, entity ID, and array of keys to remove.

func (*V1CustomFieldService) ListKeys

Retrieve all your active custom field keys, with optional filtering by entity type (customer, contract, product, etc.). Use this endpoint to discover what custom field keys are available before setting values on entities or to audit your custom field configuration across different entity types.

func (*V1CustomFieldService) ListKeysAutoPaging added in v1.0.0

Retrieve all your active custom field keys, with optional filtering by entity type (customer, contract, product, etc.). Use this endpoint to discover what custom field keys are available before setting values on entities or to audit your custom field configuration across different entity types.

func (*V1CustomFieldService) RemoveKey

Removes a custom field key from the allowlist for a specific entity type, preventing future use of that key across all instances of the entity. Existing values for this key on entity instances will no longer be accessible once the key is removed.

func (*V1CustomFieldService) SetValues

Sets custom field values on a specific Metronome entity instance. Overwrites existing values for matching keys while preserving other fields. All updates are transactional—either all values are set or none are. Custom field values are limited to 200 characters each.

type V1CustomFieldSetValuesParams

type V1CustomFieldSetValuesParams struct {
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero,required"`
	// Any of "alert", "billable_metric", "charge", "commit", "contract_credit",
	// "contract_product", "contract", "credit_grant", "customer_plan", "customer",
	// "discount", "invoice", "plan", "professional_service", "product", "rate_card",
	// "scheduled_charge", "subscription".
	Entity   V1CustomFieldSetValuesParamsEntity `json:"entity,omitzero,required"`
	EntityID string                             `json:"entity_id,required" format:"uuid"`
	// contains filtered or unexported fields
}

func (V1CustomFieldSetValuesParams) MarshalJSON

func (r V1CustomFieldSetValuesParams) MarshalJSON() (data []byte, err error)

func (*V1CustomFieldSetValuesParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomFieldSetValuesParams) UnmarshalJSON(data []byte) error

type V1CustomFieldSetValuesParamsEntity

type V1CustomFieldSetValuesParamsEntity string
const (
	V1CustomFieldSetValuesParamsEntityAlert               V1CustomFieldSetValuesParamsEntity = "alert"
	V1CustomFieldSetValuesParamsEntityBillableMetric      V1CustomFieldSetValuesParamsEntity = "billable_metric"
	V1CustomFieldSetValuesParamsEntityCharge              V1CustomFieldSetValuesParamsEntity = "charge"
	V1CustomFieldSetValuesParamsEntityCommit              V1CustomFieldSetValuesParamsEntity = "commit"
	V1CustomFieldSetValuesParamsEntityContractCredit      V1CustomFieldSetValuesParamsEntity = "contract_credit"
	V1CustomFieldSetValuesParamsEntityContractProduct     V1CustomFieldSetValuesParamsEntity = "contract_product"
	V1CustomFieldSetValuesParamsEntityContract            V1CustomFieldSetValuesParamsEntity = "contract"
	V1CustomFieldSetValuesParamsEntityCreditGrant         V1CustomFieldSetValuesParamsEntity = "credit_grant"
	V1CustomFieldSetValuesParamsEntityCustomerPlan        V1CustomFieldSetValuesParamsEntity = "customer_plan"
	V1CustomFieldSetValuesParamsEntityCustomer            V1CustomFieldSetValuesParamsEntity = "customer"
	V1CustomFieldSetValuesParamsEntityDiscount            V1CustomFieldSetValuesParamsEntity = "discount"
	V1CustomFieldSetValuesParamsEntityInvoice             V1CustomFieldSetValuesParamsEntity = "invoice"
	V1CustomFieldSetValuesParamsEntityPlan                V1CustomFieldSetValuesParamsEntity = "plan"
	V1CustomFieldSetValuesParamsEntityProfessionalService V1CustomFieldSetValuesParamsEntity = "professional_service"
	V1CustomFieldSetValuesParamsEntityProduct             V1CustomFieldSetValuesParamsEntity = "product"
	V1CustomFieldSetValuesParamsEntityRateCard            V1CustomFieldSetValuesParamsEntity = "rate_card"
	V1CustomFieldSetValuesParamsEntityScheduledCharge     V1CustomFieldSetValuesParamsEntity = "scheduled_charge"
	V1CustomFieldSetValuesParamsEntitySubscription        V1CustomFieldSetValuesParamsEntity = "subscription"
)

type V1CustomerAlertGetParams

type V1CustomerAlertGetParams struct {
	// The Metronome ID of the alert
	AlertID string `json:"alert_id,required" format:"uuid"`
	// The Metronome ID of the customer
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// Only present for `spend_threshold_reached` alerts. Retrieve the alert for a
	// specific group key-value pair.
	GroupValues []V1CustomerAlertGetParamsGroupValue `json:"group_values,omitzero"`
	// When parallel alerts are enabled during migration, this flag denotes whether to
	// fetch alerts for plans or contracts.
	//
	// Any of "PLANS", "CONTRACTS".
	PlansOrContracts V1CustomerAlertGetParamsPlansOrContracts `json:"plans_or_contracts,omitzero"`
	// contains filtered or unexported fields
}

func (V1CustomerAlertGetParams) MarshalJSON

func (r V1CustomerAlertGetParams) MarshalJSON() (data []byte, err error)

func (*V1CustomerAlertGetParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomerAlertGetParams) UnmarshalJSON(data []byte) error

type V1CustomerAlertGetParamsGroupValue added in v1.0.0

type V1CustomerAlertGetParamsGroupValue struct {
	Key   string `json:"key,required"`
	Value string `json:"value,required"`
	// contains filtered or unexported fields
}

Scopes alert evaluation to a specific presentation group key on individual line items. Only present for spend alerts.

The properties Key, Value are required.

func (V1CustomerAlertGetParamsGroupValue) MarshalJSON added in v1.0.0

func (r V1CustomerAlertGetParamsGroupValue) MarshalJSON() (data []byte, err error)

func (*V1CustomerAlertGetParamsGroupValue) UnmarshalJSON added in v1.0.0

func (r *V1CustomerAlertGetParamsGroupValue) UnmarshalJSON(data []byte) error

type V1CustomerAlertGetParamsPlansOrContracts

type V1CustomerAlertGetParamsPlansOrContracts string

When parallel alerts are enabled during migration, this flag denotes whether to fetch alerts for plans or contracts.

const (
	V1CustomerAlertGetParamsPlansOrContractsPlans     V1CustomerAlertGetParamsPlansOrContracts = "PLANS"
	V1CustomerAlertGetParamsPlansOrContractsContracts V1CustomerAlertGetParamsPlansOrContracts = "CONTRACTS"
)

type V1CustomerAlertGetResponse

type V1CustomerAlertGetResponse struct {
	Data CustomerAlert `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerAlertGetResponse) RawJSON added in v1.0.0

func (r V1CustomerAlertGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1CustomerAlertGetResponse) UnmarshalJSON

func (r *V1CustomerAlertGetResponse) UnmarshalJSON(data []byte) error

type V1CustomerAlertListParams

type V1CustomerAlertListParams struct {
	// The Metronome ID of the customer
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	// Optionally filter by alert status. If absent, only enabled alerts will be
	// returned.
	//
	// Any of "ENABLED", "DISABLED", "ARCHIVED".
	AlertStatuses []string `json:"alert_statuses,omitzero"`
	// contains filtered or unexported fields
}

func (V1CustomerAlertListParams) MarshalJSON

func (r V1CustomerAlertListParams) MarshalJSON() (data []byte, err error)

func (V1CustomerAlertListParams) URLQuery

func (r V1CustomerAlertListParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1CustomerAlertListParams's query parameters as `url.Values`.

func (*V1CustomerAlertListParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomerAlertListParams) UnmarshalJSON(data []byte) error

type V1CustomerAlertResetParams

type V1CustomerAlertResetParams struct {
	// The Metronome ID of the alert
	AlertID string `json:"alert_id,required" format:"uuid"`
	// The Metronome ID of the customer
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// contains filtered or unexported fields
}

func (V1CustomerAlertResetParams) MarshalJSON

func (r V1CustomerAlertResetParams) MarshalJSON() (data []byte, err error)

func (*V1CustomerAlertResetParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomerAlertResetParams) UnmarshalJSON(data []byte) error

type V1CustomerAlertService

type V1CustomerAlertService struct {
	Options []option.RequestOption
}

V1CustomerAlertService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1CustomerAlertService method instead.

func NewV1CustomerAlertService

func NewV1CustomerAlertService(opts ...option.RequestOption) (r V1CustomerAlertService)

NewV1CustomerAlertService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1CustomerAlertService) Get

Retrieve the real-time evaluation status for a specific alert-customer pair. This endpoint provides instant visibility into whether a customer has triggered an alert condition, enabling you to monitor account health and take proactive action based on current alert states.

### Use this endpoint to:

  • Check if a specific customer is currently violating an alert threshold (`in_alarm` status)
  • Verify alert configuration details and threshold values for a customer
  • Integrate alert status checks into customer support tools or admin interfaces

### Key response fields:

A CustomerAlert object containing:

- `customer_status`: The current evaluation state

  • `ok` - Customer is within acceptable thresholds
  • `in_alarm`- Customer has breached the alert threshold
  • `evaluating` - Alert has yet to be evaluated (typically due to a customer or alert having just been created)
  • `null` - Alert has been archived
  • `triggered_by`: Additional context about what caused the alert to trigger (when applicable)
  • alert: Complete alert configuration including:
  • Alert ID, name, and type
  • Current threshold values and credit type information
  • Alert status (enabled, disabled, or archived)
  • Last update timestamp
  • Any applied filters (credit grant types, custom fields, group values)

### Usage guidelines:

  • Customer status: Returns the current evaluation state, not historical data. For alert history, use webhook notifications or event logs
  • Archived alerts: Returns null for customer_status if the alert has been archived, but still includes the alert configuration details
  • Integration patterns: This endpoint can be used to check a customer's alert status, but shouldn't be scraped. You should instead rely on the webhook notification to understand when customers are moved to IN_ALARM.
  • Error handling: Returns 404 if either the customer or alert ID doesn't exist or isn't accessible to your organization

func (*V1CustomerAlertService) List

Retrieve all alert configurations and their current statuses for a specific customer in a single API call. This endpoint provides a comprehensive view of all alerts monitoring a customer account.

### Use this endpoint to:

- Display all active alerts for a customer in dashboards or admin panels - Quickly identify which alerts a customer is currently triggering - Audit alert coverage for specific accounts - Filter alerts by status (enabled, disabled, or archived)

### Key response fields:

- data: Array of CustomerAlert objects, each containing:

  • Current evaluation status (`ok`, `in_alarm`, `evaluating`, or `null`)
  • Complete alert configuration and threshold details
  • Alert metadata including type, name, and last update time

- `next_page`: Pagination cursor for retrieving additional results

### Usage guidelines:

  • Default behavior: Returns only enabled alerts unless alert_statuses filter is specified
  • Pagination: Use the `next_page` cursor to retrieve all results for customers with many alerts

func (*V1CustomerAlertService) ListAutoPaging added in v1.0.0

Retrieve all alert configurations and their current statuses for a specific customer in a single API call. This endpoint provides a comprehensive view of all alerts monitoring a customer account.

### Use this endpoint to:

- Display all active alerts for a customer in dashboards or admin panels - Quickly identify which alerts a customer is currently triggering - Audit alert coverage for specific accounts - Filter alerts by status (enabled, disabled, or archived)

### Key response fields:

- data: Array of CustomerAlert objects, each containing:

  • Current evaluation status (`ok`, `in_alarm`, `evaluating`, or `null`)
  • Complete alert configuration and threshold details
  • Alert metadata including type, name, and last update time

- `next_page`: Pagination cursor for retrieving additional results

### Usage guidelines:

  • Default behavior: Returns only enabled alerts unless alert_statuses filter is specified
  • Pagination: Use the `next_page` cursor to retrieve all results for customers with many alerts

func (*V1CustomerAlertService) Reset

Force an immediate re-evaluation of a specific alert for a customer, clearing any previous state and triggering a fresh assessment against current thresholds. This endpoint ensures alert accuracy after configuration changes or data corrections.

### Use this endpoint to:

- Clear false positive alerts after fixing data issues - Re-evaluate alerts after adjusting customer balances or credits - Test alert behavior during development and debugging - Resolve stuck alerts that may be in an incorrect state - Trigger immediate evaluation after threshold modifications

### Key response fields:

  • 200 Success: Confirmation that the alert has been reset and re-evaluation initiated
  • No response body is returned - the operation completes asynchronously

### Usage guidelines:

  • Immediate effect: Triggers re-evaluation instantly, which may result in new webhook notifications if thresholds are breached
  • State clearing: Removes any cached evaluation state, ensuring a fresh assessment
  • Use sparingly: Intended for exceptional cases, not routine operations
  • Asynchronous processing: The reset completes immediately, but re-evaluation happens in the background

type V1CustomerArchiveParams

type V1CustomerArchiveParams struct {
	ID shared.IDParam
	// contains filtered or unexported fields
}

func (V1CustomerArchiveParams) MarshalJSON

func (r V1CustomerArchiveParams) MarshalJSON() (data []byte, err error)

func (*V1CustomerArchiveParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomerArchiveParams) UnmarshalJSON(data []byte) error

type V1CustomerArchiveResponse

type V1CustomerArchiveResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerArchiveResponse) RawJSON added in v1.0.0

func (r V1CustomerArchiveResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1CustomerArchiveResponse) UnmarshalJSON

func (r *V1CustomerArchiveResponse) UnmarshalJSON(data []byte) error

type V1CustomerBillingConfigDeleteParams

type V1CustomerBillingConfigDeleteParams struct {
	CustomerID string `path:"customer_id,required" format:"uuid" json:"-"`
	// Any of "aws_marketplace", "stripe", "netsuite", "custom", "azure_marketplace",
	// "quickbooks_online", "workday", "gcp_marketplace".
	BillingProviderType V1CustomerBillingConfigDeleteParamsBillingProviderType `path:"billing_provider_type,omitzero,required" json:"-"`
	// contains filtered or unexported fields
}

type V1CustomerBillingConfigDeleteParamsBillingProviderType

type V1CustomerBillingConfigDeleteParamsBillingProviderType string
const (
	V1CustomerBillingConfigDeleteParamsBillingProviderTypeAwsMarketplace   V1CustomerBillingConfigDeleteParamsBillingProviderType = "aws_marketplace"
	V1CustomerBillingConfigDeleteParamsBillingProviderTypeStripe           V1CustomerBillingConfigDeleteParamsBillingProviderType = "stripe"
	V1CustomerBillingConfigDeleteParamsBillingProviderTypeNetsuite         V1CustomerBillingConfigDeleteParamsBillingProviderType = "netsuite"
	V1CustomerBillingConfigDeleteParamsBillingProviderTypeCustom           V1CustomerBillingConfigDeleteParamsBillingProviderType = "custom"
	V1CustomerBillingConfigDeleteParamsBillingProviderTypeAzureMarketplace V1CustomerBillingConfigDeleteParamsBillingProviderType = "azure_marketplace"
	V1CustomerBillingConfigDeleteParamsBillingProviderTypeQuickbooksOnline V1CustomerBillingConfigDeleteParamsBillingProviderType = "quickbooks_online"
	V1CustomerBillingConfigDeleteParamsBillingProviderTypeWorkday          V1CustomerBillingConfigDeleteParamsBillingProviderType = "workday"
	V1CustomerBillingConfigDeleteParamsBillingProviderTypeGcpMarketplace   V1CustomerBillingConfigDeleteParamsBillingProviderType = "gcp_marketplace"
)

type V1CustomerBillingConfigGetParams

type V1CustomerBillingConfigGetParams struct {
	CustomerID string `path:"customer_id,required" format:"uuid" json:"-"`
	// Any of "aws_marketplace", "stripe", "netsuite", "custom", "azure_marketplace",
	// "quickbooks_online", "workday", "gcp_marketplace".
	BillingProviderType V1CustomerBillingConfigGetParamsBillingProviderType `path:"billing_provider_type,omitzero,required" json:"-"`
	// contains filtered or unexported fields
}

type V1CustomerBillingConfigGetParamsBillingProviderType

type V1CustomerBillingConfigGetParamsBillingProviderType string
const (
	V1CustomerBillingConfigGetParamsBillingProviderTypeAwsMarketplace   V1CustomerBillingConfigGetParamsBillingProviderType = "aws_marketplace"
	V1CustomerBillingConfigGetParamsBillingProviderTypeStripe           V1CustomerBillingConfigGetParamsBillingProviderType = "stripe"
	V1CustomerBillingConfigGetParamsBillingProviderTypeNetsuite         V1CustomerBillingConfigGetParamsBillingProviderType = "netsuite"
	V1CustomerBillingConfigGetParamsBillingProviderTypeCustom           V1CustomerBillingConfigGetParamsBillingProviderType = "custom"
	V1CustomerBillingConfigGetParamsBillingProviderTypeAzureMarketplace V1CustomerBillingConfigGetParamsBillingProviderType = "azure_marketplace"
	V1CustomerBillingConfigGetParamsBillingProviderTypeQuickbooksOnline V1CustomerBillingConfigGetParamsBillingProviderType = "quickbooks_online"
	V1CustomerBillingConfigGetParamsBillingProviderTypeWorkday          V1CustomerBillingConfigGetParamsBillingProviderType = "workday"
	V1CustomerBillingConfigGetParamsBillingProviderTypeGcpMarketplace   V1CustomerBillingConfigGetParamsBillingProviderType = "gcp_marketplace"
)

type V1CustomerBillingConfigGetResponse

type V1CustomerBillingConfigGetResponse struct {
	Data V1CustomerBillingConfigGetResponseData `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerBillingConfigGetResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CustomerBillingConfigGetResponse) UnmarshalJSON

func (r *V1CustomerBillingConfigGetResponse) UnmarshalJSON(data []byte) error

type V1CustomerBillingConfigGetResponseData

type V1CustomerBillingConfigGetResponseData struct {
	// Contract expiration date for the customer. The expected format is RFC 3339 and
	// can be retrieved from
	// [AWS's GetEntitlements API](https://docs.aws.amazon.com/marketplaceentitlement/latest/APIReference/API_GetEntitlements.html).
	AwsExpirationDate time.Time `json:"aws_expiration_date" format:"date-time"`
	// True if the aws_product_code is a SAAS subscription product, false otherwise.
	AwsIsSubscriptionProduct bool   `json:"aws_is_subscription_product"`
	AwsProductCode           string `json:"aws_product_code"`
	// Any of "af-south-1", "ap-east-1", "ap-northeast-1", "ap-northeast-2",
	// "ap-northeast-3", "ap-south-1", "ap-southeast-1", "ap-southeast-2",
	// "ca-central-1", "cn-north-1", "cn-northwest-1", "eu-central-1", "eu-north-1",
	// "eu-south-1", "eu-west-1", "eu-west-2", "eu-west-3", "me-south-1", "sa-east-1",
	// "us-east-1", "us-east-2", "us-gov-east-1", "us-gov-west-1", "us-west-1",
	// "us-west-2".
	AwsRegion string `json:"aws_region"`
	// Subscription term start/end date for the customer. The expected format is RFC
	// 3339 and can be retrieved from
	// [Azure's Get Subscription API](https://learn.microsoft.com/en-us/partner-center/marketplace/partner-center-portal/pc-saas-fulfillment-subscription-api#get-subscription).
	AzureExpirationDate time.Time `json:"azure_expiration_date" format:"date-time"`
	AzurePlanID         string    `json:"azure_plan_id" format:"uuid"`
	// Subscription term start/end date for the customer. The expected format is RFC
	// 3339 and can be retrieved from
	// [Azure's Get Subscription API](https://learn.microsoft.com/en-us/partner-center/marketplace/partner-center-portal/pc-saas-fulfillment-subscription-api#get-subscription).
	AzureStartDate time.Time `json:"azure_start_date" format:"date-time"`
	// Any of "Subscribed", "Unsubscribed", "Suspended", "PendingFulfillmentStart".
	AzureSubscriptionStatus   string `json:"azure_subscription_status"`
	BillingProviderCustomerID string `json:"billing_provider_customer_id"`
	// Any of "charge_automatically", "send_invoice", "auto_charge_payment_intent",
	// "manually_charge_payment_intent".
	StripeCollectionMethod string `json:"stripe_collection_method"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AwsExpirationDate         respjson.Field
		AwsIsSubscriptionProduct  respjson.Field
		AwsProductCode            respjson.Field
		AwsRegion                 respjson.Field
		AzureExpirationDate       respjson.Field
		AzurePlanID               respjson.Field
		AzureStartDate            respjson.Field
		AzureSubscriptionStatus   respjson.Field
		BillingProviderCustomerID respjson.Field
		StripeCollectionMethod    respjson.Field
		ExtraFields               map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerBillingConfigGetResponseData) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CustomerBillingConfigGetResponseData) UnmarshalJSON

func (r *V1CustomerBillingConfigGetResponseData) UnmarshalJSON(data []byte) error

type V1CustomerBillingConfigNewParams

type V1CustomerBillingConfigNewParams struct {
	CustomerID string `path:"customer_id,required" format:"uuid" json:"-"`
	// Any of "aws_marketplace", "stripe", "netsuite", "custom", "azure_marketplace",
	// "quickbooks_online", "workday", "gcp_marketplace".
	BillingProviderType V1CustomerBillingConfigNewParamsBillingProviderType `path:"billing_provider_type,omitzero,required" json:"-"`
	// The customer ID in the billing provider's system. For Azure, this is the
	// subscription ID.
	BillingProviderCustomerID string            `json:"billing_provider_customer_id,required"`
	AwsProductCode            param.Opt[string] `json:"aws_product_code,omitzero"`
	// Any of "af-south-1", "ap-east-1", "ap-northeast-1", "ap-northeast-2",
	// "ap-northeast-3", "ap-south-1", "ap-southeast-1", "ap-southeast-2",
	// "ca-central-1", "cn-north-1", "cn-northwest-1", "eu-central-1", "eu-north-1",
	// "eu-south-1", "eu-west-1", "eu-west-2", "eu-west-3", "me-south-1", "sa-east-1",
	// "us-east-1", "us-east-2", "us-gov-east-1", "us-gov-west-1", "us-west-1",
	// "us-west-2".
	AwsRegion V1CustomerBillingConfigNewParamsAwsRegion `json:"aws_region,omitzero"`
	// Any of "charge_automatically", "send_invoice", "auto_charge_payment_intent",
	// "manually_charge_payment_intent".
	StripeCollectionMethod V1CustomerBillingConfigNewParamsStripeCollectionMethod `json:"stripe_collection_method,omitzero"`
	// contains filtered or unexported fields
}

func (V1CustomerBillingConfigNewParams) MarshalJSON

func (r V1CustomerBillingConfigNewParams) MarshalJSON() (data []byte, err error)

func (*V1CustomerBillingConfigNewParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomerBillingConfigNewParams) UnmarshalJSON(data []byte) error

type V1CustomerBillingConfigNewParamsAwsRegion

type V1CustomerBillingConfigNewParamsAwsRegion string
const (
	V1CustomerBillingConfigNewParamsAwsRegionAfSouth1     V1CustomerBillingConfigNewParamsAwsRegion = "af-south-1"
	V1CustomerBillingConfigNewParamsAwsRegionApEast1      V1CustomerBillingConfigNewParamsAwsRegion = "ap-east-1"
	V1CustomerBillingConfigNewParamsAwsRegionApNortheast1 V1CustomerBillingConfigNewParamsAwsRegion = "ap-northeast-1"
	V1CustomerBillingConfigNewParamsAwsRegionApNortheast2 V1CustomerBillingConfigNewParamsAwsRegion = "ap-northeast-2"
	V1CustomerBillingConfigNewParamsAwsRegionApNortheast3 V1CustomerBillingConfigNewParamsAwsRegion = "ap-northeast-3"
	V1CustomerBillingConfigNewParamsAwsRegionApSouth1     V1CustomerBillingConfigNewParamsAwsRegion = "ap-south-1"
	V1CustomerBillingConfigNewParamsAwsRegionApSoutheast1 V1CustomerBillingConfigNewParamsAwsRegion = "ap-southeast-1"
	V1CustomerBillingConfigNewParamsAwsRegionApSoutheast2 V1CustomerBillingConfigNewParamsAwsRegion = "ap-southeast-2"
	V1CustomerBillingConfigNewParamsAwsRegionCaCentral1   V1CustomerBillingConfigNewParamsAwsRegion = "ca-central-1"
	V1CustomerBillingConfigNewParamsAwsRegionCnNorth1     V1CustomerBillingConfigNewParamsAwsRegion = "cn-north-1"
	V1CustomerBillingConfigNewParamsAwsRegionCnNorthwest1 V1CustomerBillingConfigNewParamsAwsRegion = "cn-northwest-1"
	V1CustomerBillingConfigNewParamsAwsRegionEuCentral1   V1CustomerBillingConfigNewParamsAwsRegion = "eu-central-1"
	V1CustomerBillingConfigNewParamsAwsRegionEuNorth1     V1CustomerBillingConfigNewParamsAwsRegion = "eu-north-1"
	V1CustomerBillingConfigNewParamsAwsRegionEuSouth1     V1CustomerBillingConfigNewParamsAwsRegion = "eu-south-1"
	V1CustomerBillingConfigNewParamsAwsRegionEuWest1      V1CustomerBillingConfigNewParamsAwsRegion = "eu-west-1"
	V1CustomerBillingConfigNewParamsAwsRegionEuWest2      V1CustomerBillingConfigNewParamsAwsRegion = "eu-west-2"
	V1CustomerBillingConfigNewParamsAwsRegionEuWest3      V1CustomerBillingConfigNewParamsAwsRegion = "eu-west-3"
	V1CustomerBillingConfigNewParamsAwsRegionMeSouth1     V1CustomerBillingConfigNewParamsAwsRegion = "me-south-1"
	V1CustomerBillingConfigNewParamsAwsRegionSaEast1      V1CustomerBillingConfigNewParamsAwsRegion = "sa-east-1"
	V1CustomerBillingConfigNewParamsAwsRegionUsEast1      V1CustomerBillingConfigNewParamsAwsRegion = "us-east-1"
	V1CustomerBillingConfigNewParamsAwsRegionUsEast2      V1CustomerBillingConfigNewParamsAwsRegion = "us-east-2"
	V1CustomerBillingConfigNewParamsAwsRegionUsGovEast1   V1CustomerBillingConfigNewParamsAwsRegion = "us-gov-east-1"
	V1CustomerBillingConfigNewParamsAwsRegionUsGovWest1   V1CustomerBillingConfigNewParamsAwsRegion = "us-gov-west-1"
	V1CustomerBillingConfigNewParamsAwsRegionUsWest1      V1CustomerBillingConfigNewParamsAwsRegion = "us-west-1"
	V1CustomerBillingConfigNewParamsAwsRegionUsWest2      V1CustomerBillingConfigNewParamsAwsRegion = "us-west-2"
)

type V1CustomerBillingConfigNewParamsBillingProviderType

type V1CustomerBillingConfigNewParamsBillingProviderType string
const (
	V1CustomerBillingConfigNewParamsBillingProviderTypeAwsMarketplace   V1CustomerBillingConfigNewParamsBillingProviderType = "aws_marketplace"
	V1CustomerBillingConfigNewParamsBillingProviderTypeStripe           V1CustomerBillingConfigNewParamsBillingProviderType = "stripe"
	V1CustomerBillingConfigNewParamsBillingProviderTypeNetsuite         V1CustomerBillingConfigNewParamsBillingProviderType = "netsuite"
	V1CustomerBillingConfigNewParamsBillingProviderTypeCustom           V1CustomerBillingConfigNewParamsBillingProviderType = "custom"
	V1CustomerBillingConfigNewParamsBillingProviderTypeAzureMarketplace V1CustomerBillingConfigNewParamsBillingProviderType = "azure_marketplace"
	V1CustomerBillingConfigNewParamsBillingProviderTypeQuickbooksOnline V1CustomerBillingConfigNewParamsBillingProviderType = "quickbooks_online"
	V1CustomerBillingConfigNewParamsBillingProviderTypeWorkday          V1CustomerBillingConfigNewParamsBillingProviderType = "workday"
	V1CustomerBillingConfigNewParamsBillingProviderTypeGcpMarketplace   V1CustomerBillingConfigNewParamsBillingProviderType = "gcp_marketplace"
)

type V1CustomerBillingConfigNewParamsStripeCollectionMethod

type V1CustomerBillingConfigNewParamsStripeCollectionMethod string
const (
	V1CustomerBillingConfigNewParamsStripeCollectionMethodChargeAutomatically         V1CustomerBillingConfigNewParamsStripeCollectionMethod = "charge_automatically"
	V1CustomerBillingConfigNewParamsStripeCollectionMethodSendInvoice                 V1CustomerBillingConfigNewParamsStripeCollectionMethod = "send_invoice"
	V1CustomerBillingConfigNewParamsStripeCollectionMethodAutoChargePaymentIntent     V1CustomerBillingConfigNewParamsStripeCollectionMethod = "auto_charge_payment_intent"
	V1CustomerBillingConfigNewParamsStripeCollectionMethodManuallyChargePaymentIntent V1CustomerBillingConfigNewParamsStripeCollectionMethod = "manually_charge_payment_intent"
)

type V1CustomerBillingConfigService

type V1CustomerBillingConfigService struct {
	Options []option.RequestOption
}

V1CustomerBillingConfigService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1CustomerBillingConfigService method instead.

func NewV1CustomerBillingConfigService

func NewV1CustomerBillingConfigService(opts ...option.RequestOption) (r V1CustomerBillingConfigService)

NewV1CustomerBillingConfigService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1CustomerBillingConfigService) Delete

Delete the billing configuration for a given customer. Note: this is unsupported for Azure and AWS Marketplace customers.

func (*V1CustomerBillingConfigService) Get

Fetch the billing configuration for the given customer.

func (*V1CustomerBillingConfigService) New

Set the billing configuration for a given customer.

type V1CustomerCommitListParams

type V1CustomerCommitListParams struct {
	CustomerID string            `json:"customer_id,required" format:"uuid"`
	CommitID   param.Opt[string] `json:"commit_id,omitzero" format:"uuid"`
	// Include only commits that have access schedules that "cover" the provided date
	CoveringDate param.Opt[time.Time] `json:"covering_date,omitzero" format:"date-time"`
	// Include only commits that have any access before the provided date (exclusive)
	EffectiveBefore param.Opt[time.Time] `json:"effective_before,omitzero" format:"date-time"`
	// Include archived commits and commits from archived contracts.
	IncludeArchived param.Opt[bool] `json:"include_archived,omitzero"`
	// Include the balance in the response. Setting this flag may cause the query to be
	// slower.
	IncludeBalance param.Opt[bool] `json:"include_balance,omitzero"`
	// Include commits on the contract level.
	IncludeContractCommits param.Opt[bool] `json:"include_contract_commits,omitzero"`
	// Include commit ledgers in the response. Setting this flag may cause the query to
	// be slower.
	IncludeLedgers param.Opt[bool] `json:"include_ledgers,omitzero"`
	// The maximum number of commits to return. Defaults to 25.
	Limit param.Opt[int64] `json:"limit,omitzero"`
	// The next page token from a previous response.
	NextPage param.Opt[string] `json:"next_page,omitzero"`
	// Include only commits that have any access on or after the provided date
	StartingAt param.Opt[time.Time] `json:"starting_at,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

func (V1CustomerCommitListParams) MarshalJSON

func (r V1CustomerCommitListParams) MarshalJSON() (data []byte, err error)

func (*V1CustomerCommitListParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomerCommitListParams) UnmarshalJSON(data []byte) error

type V1CustomerCommitNewParams

type V1CustomerCommitNewParams struct {
	// Schedule for distributing the commit to the customer. For "POSTPAID" commits
	// only one schedule item is allowed and amount must match invoice_schedule total.
	AccessSchedule V1CustomerCommitNewParamsAccessSchedule `json:"access_schedule,omitzero,required"`
	CustomerID     string                                  `json:"customer_id,required" format:"uuid"`
	// If multiple credits or commits are applicable, the one with the lower priority
	// will apply first.
	Priority float64 `json:"priority,required"`
	// ID of the fixed product associated with the commit. This is required because
	// products are used to invoice the commit amount.
	ProductID string `json:"product_id,required" format:"uuid"`
	// Any of "PREPAID", "POSTPAID".
	Type V1CustomerCommitNewParamsType `json:"type,omitzero,required"`
	// Used only in UI/API. It is not exposed to end customers.
	Description param.Opt[string] `json:"description,omitzero"`
	// The contract that this commit will be billed on. This is required for "POSTPAID"
	// commits and for "PREPAID" commits unless there is no invoice schedule above
	// (i.e., the commit is 'free').
	InvoiceContractID param.Opt[string] `json:"invoice_contract_id,omitzero" format:"uuid"`
	// displayed on invoices
	Name param.Opt[string] `json:"name,omitzero"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Opt[string] `json:"netsuite_sales_order_id,omitzero"`
	// This field's availability is dependent on your client's configuration.
	SalesforceOpportunityID param.Opt[string] `json:"salesforce_opportunity_id,omitzero"`
	// Prevents the creation of duplicates. If a request to create a commit or credit
	// is made with a uniqueness key that was previously used to create a commit or
	// credit, a new record will not be created and the request will fail with a 409
	// error.
	UniquenessKey param.Opt[string] `json:"uniqueness_key,omitzero"`
	// Which contract the commit applies to. If not provided, the commit applies to all
	// contracts.
	ApplicableContractIDs []string `json:"applicable_contract_ids,omitzero"`
	// Which products the commit applies to. If applicable_product_ids,
	// applicable_product_tags or specifiers are not provided, the commit applies to
	// all products.
	ApplicableProductIDs []string `json:"applicable_product_ids,omitzero" format:"uuid"`
	// Which tags the commit applies to. If applicable_product_ids,
	// applicable_product_tags or specifiers are not provided, the commit applies to
	// all products.
	ApplicableProductTags []string `json:"applicable_product_tags,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// Required for "POSTPAID" commits: the true up invoice will be generated at this
	// time and only one schedule item is allowed; the total must match
	// accesss_schedule amount. Optional for "PREPAID" commits: if not provided, this
	// will be a "complimentary" commit with no invoice.
	InvoiceSchedule V1CustomerCommitNewParamsInvoiceSchedule `json:"invoice_schedule,omitzero"`
	// Any of "COMMIT_RATE", "LIST_RATE".
	RateType V1CustomerCommitNewParamsRateType `json:"rate_type,omitzero"`
	// List of filters that determine what kind of customer usage draws down a commit
	// or credit. A customer's usage needs to meet the condition of at least one of the
	// specifiers to contribute to a commit's or credit's drawdown. This field cannot
	// be used together with `applicable_product_ids` or `applicable_product_tags`.
	Specifiers []shared.CommitSpecifierInputParam `json:"specifiers,omitzero"`
	// contains filtered or unexported fields
}

func (V1CustomerCommitNewParams) MarshalJSON

func (r V1CustomerCommitNewParams) MarshalJSON() (data []byte, err error)

func (*V1CustomerCommitNewParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomerCommitNewParams) UnmarshalJSON(data []byte) error

type V1CustomerCommitNewParamsAccessSchedule

type V1CustomerCommitNewParamsAccessSchedule struct {
	ScheduleItems []V1CustomerCommitNewParamsAccessScheduleScheduleItem `json:"schedule_items,omitzero,required"`
	// Defaults to USD (cents) if not passed
	CreditTypeID param.Opt[string] `json:"credit_type_id,omitzero" format:"uuid"`
	// contains filtered or unexported fields
}

Schedule for distributing the commit to the customer. For "POSTPAID" commits only one schedule item is allowed and amount must match invoice_schedule total.

The property ScheduleItems is required.

func (V1CustomerCommitNewParamsAccessSchedule) MarshalJSON

func (r V1CustomerCommitNewParamsAccessSchedule) MarshalJSON() (data []byte, err error)

func (*V1CustomerCommitNewParamsAccessSchedule) UnmarshalJSON added in v1.0.0

func (r *V1CustomerCommitNewParamsAccessSchedule) UnmarshalJSON(data []byte) error

type V1CustomerCommitNewParamsAccessScheduleScheduleItem

type V1CustomerCommitNewParamsAccessScheduleScheduleItem struct {
	Amount float64 `json:"amount,required"`
	// RFC 3339 timestamp (exclusive)
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	// RFC 3339 timestamp (inclusive)
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// contains filtered or unexported fields
}

The properties Amount, EndingBefore, StartingAt are required.

func (V1CustomerCommitNewParamsAccessScheduleScheduleItem) MarshalJSON

func (r V1CustomerCommitNewParamsAccessScheduleScheduleItem) MarshalJSON() (data []byte, err error)

func (*V1CustomerCommitNewParamsAccessScheduleScheduleItem) UnmarshalJSON added in v1.0.0

type V1CustomerCommitNewParamsInvoiceSchedule

type V1CustomerCommitNewParamsInvoiceSchedule struct {
	// Defaults to USD (cents) if not passed.
	CreditTypeID param.Opt[string] `json:"credit_type_id,omitzero" format:"uuid"`
	// This field is only applicable to commit invoice schedules. If true, this
	// schedule will not generate an invoice.
	DoNotInvoice param.Opt[bool] `json:"do_not_invoice,omitzero"`
	// Enter the unit price and quantity for the charge or instead only send the
	// amount. If amount is sent, the unit price is assumed to be the amount and
	// quantity is inferred to be 1.
	RecurringSchedule V1CustomerCommitNewParamsInvoiceScheduleRecurringSchedule `json:"recurring_schedule,omitzero"`
	// Either provide amount or provide both unit_price and quantity.
	ScheduleItems []V1CustomerCommitNewParamsInvoiceScheduleScheduleItem `json:"schedule_items,omitzero"`
	// contains filtered or unexported fields
}

Required for "POSTPAID" commits: the true up invoice will be generated at this time and only one schedule item is allowed; the total must match accesss_schedule amount. Optional for "PREPAID" commits: if not provided, this will be a "complimentary" commit with no invoice.

func (V1CustomerCommitNewParamsInvoiceSchedule) MarshalJSON

func (r V1CustomerCommitNewParamsInvoiceSchedule) MarshalJSON() (data []byte, err error)

func (*V1CustomerCommitNewParamsInvoiceSchedule) UnmarshalJSON added in v1.0.0

func (r *V1CustomerCommitNewParamsInvoiceSchedule) UnmarshalJSON(data []byte) error

type V1CustomerCommitNewParamsInvoiceScheduleRecurringSchedule

type V1CustomerCommitNewParamsInvoiceScheduleRecurringSchedule struct {
	// Any of "DIVIDED", "DIVIDED_ROUNDED", "EACH".
	AmountDistribution string `json:"amount_distribution,omitzero,required"`
	// RFC 3339 timestamp (exclusive).
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	// Any of "MONTHLY", "QUARTERLY", "SEMI_ANNUAL", "ANNUAL".
	Frequency string `json:"frequency,omitzero,required"`
	// RFC 3339 timestamp (inclusive).
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// Amount for the charge. Can be provided instead of unit_price and quantity. If
	// amount is sent, the unit_price is assumed to be the amount and quantity is
	// inferred to be 1.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount and must be specified with unit_price. If specified amount cannot be
	// provided.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified with quantity. If specified amount cannot be
	// provided.
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

Enter the unit price and quantity for the charge or instead only send the amount. If amount is sent, the unit price is assumed to be the amount and quantity is inferred to be 1.

The properties AmountDistribution, EndingBefore, Frequency, StartingAt are required.

func (V1CustomerCommitNewParamsInvoiceScheduleRecurringSchedule) MarshalJSON

func (*V1CustomerCommitNewParamsInvoiceScheduleRecurringSchedule) UnmarshalJSON added in v1.0.0

type V1CustomerCommitNewParamsInvoiceScheduleScheduleItem

type V1CustomerCommitNewParamsInvoiceScheduleScheduleItem struct {
	// timestamp of the scheduled event
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// Amount for the charge. Can be provided instead of unit_price and quantity. If
	// amount is sent, the unit_price is assumed to be the amount and quantity is
	// inferred to be 1.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount and must be specified with unit_price. If specified amount cannot be
	// provided.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified with quantity. If specified amount cannot be
	// provided.
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

The property Timestamp is required.

func (V1CustomerCommitNewParamsInvoiceScheduleScheduleItem) MarshalJSON

func (r V1CustomerCommitNewParamsInvoiceScheduleScheduleItem) MarshalJSON() (data []byte, err error)

func (*V1CustomerCommitNewParamsInvoiceScheduleScheduleItem) UnmarshalJSON added in v1.0.0

type V1CustomerCommitNewParamsRateType

type V1CustomerCommitNewParamsRateType string
const (
	V1CustomerCommitNewParamsRateTypeCommitRate V1CustomerCommitNewParamsRateType = "COMMIT_RATE"
	V1CustomerCommitNewParamsRateTypeListRate   V1CustomerCommitNewParamsRateType = "LIST_RATE"
)

type V1CustomerCommitNewParamsType

type V1CustomerCommitNewParamsType string
const (
	V1CustomerCommitNewParamsTypePrepaid  V1CustomerCommitNewParamsType = "PREPAID"
	V1CustomerCommitNewParamsTypePostpaid V1CustomerCommitNewParamsType = "POSTPAID"
)

type V1CustomerCommitNewResponse

type V1CustomerCommitNewResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerCommitNewResponse) RawJSON added in v1.0.0

func (r V1CustomerCommitNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1CustomerCommitNewResponse) UnmarshalJSON

func (r *V1CustomerCommitNewResponse) UnmarshalJSON(data []byte) error

type V1CustomerCommitService

type V1CustomerCommitService struct {
	Options []option.RequestOption
}

V1CustomerCommitService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1CustomerCommitService method instead.

func NewV1CustomerCommitService

func NewV1CustomerCommitService(opts ...option.RequestOption) (r V1CustomerCommitService)

NewV1CustomerCommitService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1CustomerCommitService) List

Retrieve all commit agreements for a customer, including both prepaid and postpaid commitments. This endpoint provides comprehensive visibility into contractual spending obligations, enabling you to track commitment utilization and manage customer contracts effectively.

### Use this endpoint to:

- Display commitment balances and utilization in customer dashboards - Track prepaid commitment drawdown and remaining balances - Monitor postpaid commitment progress toward minimum thresholds - Build commitment tracking and forecasting tools - Show commitment history with optional ledger details - Manage rollover balances between contract periods

### Key response fields:

An array of Commit objects containing:

- Commit type: PREPAID (pay upfront) or POSTPAID (pay at true-up) - Rate type: COMMIT_RATE (discounted) or LIST_RATE (standard pricing) - Access schedule: When commitment funds become available - Invoice schedule: When the customer is billed - Product targeting: Which product(s) usage is eligible to draw from this commit - Optional ledger entries: Transaction history (if `include_ledgers=true`) - Balance information: Current available amount (if `include_balance=true`) - Rollover settings: Fraction of unused amount that carries forward

### Usage guidelines:

- Pagination: Results limited to 25 commits per page; use 'next_page' for more - Date filtering options:

  • `covering_date`: Commits active on a specific date
  • `starting_at`: Commits with access on/after a date
  • `effective_before`: Commits with access before a date (exclusive)

- Scope options:

  • `include_contract_commits`: Include contract-level commits (not just customer-level)
  • `include_archived`: Include archived commits and commits from archived contracts

- Performance considerations:

  • include_ledgers: Adds detailed transaction history (slower)
  • include_balance: Adds current balance calculation (slower)

- Optional filtering: Use commit_id to retrieve a specific commit

func (*V1CustomerCommitService) ListAutoPaging added in v1.0.0

Retrieve all commit agreements for a customer, including both prepaid and postpaid commitments. This endpoint provides comprehensive visibility into contractual spending obligations, enabling you to track commitment utilization and manage customer contracts effectively.

### Use this endpoint to:

- Display commitment balances and utilization in customer dashboards - Track prepaid commitment drawdown and remaining balances - Monitor postpaid commitment progress toward minimum thresholds - Build commitment tracking and forecasting tools - Show commitment history with optional ledger details - Manage rollover balances between contract periods

### Key response fields:

An array of Commit objects containing:

- Commit type: PREPAID (pay upfront) or POSTPAID (pay at true-up) - Rate type: COMMIT_RATE (discounted) or LIST_RATE (standard pricing) - Access schedule: When commitment funds become available - Invoice schedule: When the customer is billed - Product targeting: Which product(s) usage is eligible to draw from this commit - Optional ledger entries: Transaction history (if `include_ledgers=true`) - Balance information: Current available amount (if `include_balance=true`) - Rollover settings: Fraction of unused amount that carries forward

### Usage guidelines:

- Pagination: Results limited to 25 commits per page; use 'next_page' for more - Date filtering options:

  • `covering_date`: Commits active on a specific date
  • `starting_at`: Commits with access on/after a date
  • `effective_before`: Commits with access before a date (exclusive)

- Scope options:

  • `include_contract_commits`: Include contract-level commits (not just customer-level)
  • `include_archived`: Include archived commits and commits from archived contracts

- Performance considerations:

  • include_ledgers: Adds detailed transaction history (slower)
  • include_balance: Adds current balance calculation (slower)

- Optional filtering: Use commit_id to retrieve a specific commit

func (*V1CustomerCommitService) New

Creates customer-level commits that establish spending commitments for customers across their Metronome usage. Commits represent contracted spending obligations that can be either prepaid (paid upfront) or postpaid (billed later).

Note: In most cases, you should add commitments directly to customer contracts using the contract/create or contract/edit APIs.

### Use this endpoint to:

Use this endpoint when you need to establish customer-level spending commitments that can be applied across multiple contracts or scoped to specific contracts. Customer-level commits are ideal for:

- Enterprise-wide minimum spending agreements that span multiple contracts - Multi-contract volume commitments with shared spending pools - Cross-contract discount tiers based on aggregate usage

#### Commit type Requirements:

  • You must specify either "prepaid" or "postpaid" as the commit type:
  • Prepaid commits: Customer pays upfront; invoice_schedule is optional (if omitted, creates a commit without an invoice)
  • Postpaid commits: Customer pays when the commitment expires (the end of the access_schedule); invoice_schedule is required and must match access_schedule totals.

#### Billing configuration:

  • invoice_contract_id is required for postpaid commits and for prepaid commits with billing (only optional for free prepaid commits)
  • For postpaid commits: access_schedule and invoice_schedule must have matching amounts
  • For postpaid commits: only one schedule item is allowed in both schedules.

#### Scoping flexibility:

Customer-level commits can be configured in a few ways:

  • Contract-specific: Use the `applicable_contract_ids` field to limit the commit to specific contracts
  • Cross-contract: Leave `applicable_contract_ids` empty to allow the commit to be used across all of the customer's contracts

#### Product targeting:

Commits can be scoped to specific products using applicable_product_ids, applicable_product_tags, or specifiers, or left unrestricted to apply to all products.

#### Priority considerations:

When multiple commits are applicable, the one with the lower priority value will be consumed first. If there is a tie, contract level commits and credits will be applied before customer level commits and credits. Plan your priority scheme carefully to ensure commits are applied in the desired order.

### Usage guidelines:

⚠️ Preferred Alternative: In most cases, you should add commits directly to contracts using the create contract or edit contract APIs instead of creating customer-level commits. Contract-level commits provide better organization and are the recommended approach for standard use cases.

func (*V1CustomerCommitService) UpdateEndDate

Shortens the end date of a prepaid commit to terminate it earlier than originally scheduled. Use this endpoint when you need to cancel or reduce the duration of an existing prepaid commit. Only works with prepaid commit types and can only move the end date forward (earlier), not extend it.

### Usage guidelines:

To extend commit end dates or make other comprehensive edits, use the 'edit commit' endpoint instead.

type V1CustomerCommitUpdateEndDateParams

type V1CustomerCommitUpdateEndDateParams struct {
	// ID of the commit to update. Only supports "PREPAID" commits.
	CommitID string `json:"commit_id,required" format:"uuid"`
	// ID of the customer whose commit is to be updated
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// RFC 3339 timestamp indicating when access to the commit will end and it will no
	// longer be possible to draw it down (exclusive). If not provided, the access will
	// not be updated.
	AccessEndingBefore param.Opt[time.Time] `json:"access_ending_before,omitzero" format:"date-time"`
	// RFC 3339 timestamp indicating when the commit will stop being invoiced
	// (exclusive). If not provided, the invoice schedule will not be updated.
	InvoicesEndingBefore param.Opt[time.Time] `json:"invoices_ending_before,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

func (V1CustomerCommitUpdateEndDateParams) MarshalJSON

func (r V1CustomerCommitUpdateEndDateParams) MarshalJSON() (data []byte, err error)

func (*V1CustomerCommitUpdateEndDateParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomerCommitUpdateEndDateParams) UnmarshalJSON(data []byte) error

type V1CustomerCommitUpdateEndDateResponse

type V1CustomerCommitUpdateEndDateResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerCommitUpdateEndDateResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CustomerCommitUpdateEndDateResponse) UnmarshalJSON

func (r *V1CustomerCommitUpdateEndDateResponse) UnmarshalJSON(data []byte) error

type V1CustomerCreditListParams

type V1CustomerCreditListParams struct {
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// Return only credits that have access schedules that "cover" the provided date
	CoveringDate param.Opt[time.Time] `json:"covering_date,omitzero" format:"date-time"`
	CreditID     param.Opt[string]    `json:"credit_id,omitzero" format:"uuid"`
	// Include only credits that have any access before the provided date (exclusive)
	EffectiveBefore param.Opt[time.Time] `json:"effective_before,omitzero" format:"date-time"`
	// Include archived credits and credits from archived contracts.
	IncludeArchived param.Opt[bool] `json:"include_archived,omitzero"`
	// Include the balance in the response. Setting this flag may cause the query to be
	// slower.
	IncludeBalance param.Opt[bool] `json:"include_balance,omitzero"`
	// Include credits on the contract level.
	IncludeContractCredits param.Opt[bool] `json:"include_contract_credits,omitzero"`
	// Include credit ledgers in the response. Setting this flag may cause the query to
	// be slower.
	IncludeLedgers param.Opt[bool] `json:"include_ledgers,omitzero"`
	// The maximum number of commits to return. Defaults to 25.
	Limit param.Opt[int64] `json:"limit,omitzero"`
	// The next page token from a previous response.
	NextPage param.Opt[string] `json:"next_page,omitzero"`
	// Include only credits that have any access on or after the provided date
	StartingAt param.Opt[time.Time] `json:"starting_at,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

func (V1CustomerCreditListParams) MarshalJSON

func (r V1CustomerCreditListParams) MarshalJSON() (data []byte, err error)

func (*V1CustomerCreditListParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomerCreditListParams) UnmarshalJSON(data []byte) error

type V1CustomerCreditNewParams

type V1CustomerCreditNewParams struct {
	// Schedule for distributing the credit to the customer.
	AccessSchedule V1CustomerCreditNewParamsAccessSchedule `json:"access_schedule,omitzero,required"`
	CustomerID     string                                  `json:"customer_id,required" format:"uuid"`
	// If multiple credits or commits are applicable, the one with the lower priority
	// will apply first.
	Priority  float64 `json:"priority,required"`
	ProductID string  `json:"product_id,required" format:"uuid"`
	// Used only in UI/API. It is not exposed to end customers.
	Description param.Opt[string] `json:"description,omitzero"`
	// displayed on invoices
	Name param.Opt[string] `json:"name,omitzero"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Opt[string] `json:"netsuite_sales_order_id,omitzero"`
	// This field's availability is dependent on your client's configuration.
	SalesforceOpportunityID param.Opt[string] `json:"salesforce_opportunity_id,omitzero"`
	// Prevents the creation of duplicates. If a request to create a commit or credit
	// is made with a uniqueness key that was previously used to create a commit or
	// credit, a new record will not be created and the request will fail with a 409
	// error.
	UniquenessKey param.Opt[string] `json:"uniqueness_key,omitzero"`
	// Which contract the credit applies to. If not provided, the credit applies to all
	// contracts.
	ApplicableContractIDs []string `json:"applicable_contract_ids,omitzero"`
	// Which products the credit applies to. If both applicable_product_ids and
	// applicable_product_tags are not provided, the credit applies to all products.
	ApplicableProductIDs []string `json:"applicable_product_ids,omitzero" format:"uuid"`
	// Which tags the credit applies to. If both applicable_product_ids and
	// applicable_product_tags are not provided, the credit applies to all products.
	ApplicableProductTags []string `json:"applicable_product_tags,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// Any of "COMMIT_RATE", "LIST_RATE".
	RateType V1CustomerCreditNewParamsRateType `json:"rate_type,omitzero"`
	// List of filters that determine what kind of customer usage draws down a commit
	// or credit. A customer's usage needs to meet the condition of at least one of the
	// specifiers to contribute to a commit's or credit's drawdown. This field cannot
	// be used together with `applicable_product_ids` or `applicable_product_tags`.
	Specifiers []shared.CommitSpecifierInputParam `json:"specifiers,omitzero"`
	// contains filtered or unexported fields
}

func (V1CustomerCreditNewParams) MarshalJSON

func (r V1CustomerCreditNewParams) MarshalJSON() (data []byte, err error)

func (*V1CustomerCreditNewParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomerCreditNewParams) UnmarshalJSON(data []byte) error

type V1CustomerCreditNewParamsAccessSchedule

type V1CustomerCreditNewParamsAccessSchedule struct {
	ScheduleItems []V1CustomerCreditNewParamsAccessScheduleScheduleItem `json:"schedule_items,omitzero,required"`
	// Defaults to USD (cents) if not passed
	CreditTypeID param.Opt[string] `json:"credit_type_id,omitzero" format:"uuid"`
	// contains filtered or unexported fields
}

Schedule for distributing the credit to the customer.

The property ScheduleItems is required.

func (V1CustomerCreditNewParamsAccessSchedule) MarshalJSON

func (r V1CustomerCreditNewParamsAccessSchedule) MarshalJSON() (data []byte, err error)

func (*V1CustomerCreditNewParamsAccessSchedule) UnmarshalJSON added in v1.0.0

func (r *V1CustomerCreditNewParamsAccessSchedule) UnmarshalJSON(data []byte) error

type V1CustomerCreditNewParamsAccessScheduleScheduleItem

type V1CustomerCreditNewParamsAccessScheduleScheduleItem struct {
	Amount float64 `json:"amount,required"`
	// RFC 3339 timestamp (exclusive)
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	// RFC 3339 timestamp (inclusive)
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// contains filtered or unexported fields
}

The properties Amount, EndingBefore, StartingAt are required.

func (V1CustomerCreditNewParamsAccessScheduleScheduleItem) MarshalJSON

func (r V1CustomerCreditNewParamsAccessScheduleScheduleItem) MarshalJSON() (data []byte, err error)

func (*V1CustomerCreditNewParamsAccessScheduleScheduleItem) UnmarshalJSON added in v1.0.0

type V1CustomerCreditNewParamsRateType

type V1CustomerCreditNewParamsRateType string
const (
	V1CustomerCreditNewParamsRateTypeCommitRate V1CustomerCreditNewParamsRateType = "COMMIT_RATE"
	V1CustomerCreditNewParamsRateTypeListRate   V1CustomerCreditNewParamsRateType = "LIST_RATE"
)

type V1CustomerCreditNewResponse

type V1CustomerCreditNewResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerCreditNewResponse) RawJSON added in v1.0.0

func (r V1CustomerCreditNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1CustomerCreditNewResponse) UnmarshalJSON

func (r *V1CustomerCreditNewResponse) UnmarshalJSON(data []byte) error

type V1CustomerCreditService

type V1CustomerCreditService struct {
	Options []option.RequestOption
}

V1CustomerCreditService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1CustomerCreditService method instead.

func NewV1CustomerCreditService

func NewV1CustomerCreditService(opts ...option.RequestOption) (r V1CustomerCreditService)

NewV1CustomerCreditService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1CustomerCreditService) List

Retrieve a detailed list of all credits available to a customer, including promotional credits and contract-specific credits. This endpoint provides comprehensive visibility into credit balances, access schedules, and usage rules, enabling you to build credit management interfaces and track available funding.

### Use this endpoint to:

  • Display all available credits in customer billing dashboards
  • Show credit balances and expiration dates
  • Track credit usage history with optional ledger details
  • Build credit management and reporting tools
  • Monitor promotional credit utilization • Support customer inquiries about available credits

### Key response fields:

An array of Credit objects containing:

  • Credit details: Name, priority, and which applicable products/tags it applies to
  • Product ID: The `product_id` of the credit. This is for external mapping into your quote-to-cash stack, not the product it applies to.
  • Access schedule: When credits become available and expire
  • Optional ledger entries: Transaction history (if `include_ledgers=true`)
  • Balance information: Current available amount (if `include_balance=true`)
  • Metadata: Custom fields and usage specifiers

### Usage guidelines:

- Pagination: Results limited to 25 commits per page; use next_page for more - Date filtering options:

  • `covering_date`: Credits active on a specific date
  • `starting_at`: Credits with access on/after a date
  • `effective_before`: Credits with access before a date (exclusive)

- Scope options:

  • `include_contract_credits`: Include contract-level credits (not just customer-level)
  • `include_archived`: Include archived credits and credits from archived contracts

- Performance considerations:

  • `include_ledgers`: Adds detailed transaction history (slower)
  • `include_balance`: Adds current balance calculation (slower)

- Optional filtering: Use credit_id to retrieve a specific commit

func (*V1CustomerCreditService) ListAutoPaging added in v1.0.0

Retrieve a detailed list of all credits available to a customer, including promotional credits and contract-specific credits. This endpoint provides comprehensive visibility into credit balances, access schedules, and usage rules, enabling you to build credit management interfaces and track available funding.

### Use this endpoint to:

  • Display all available credits in customer billing dashboards
  • Show credit balances and expiration dates
  • Track credit usage history with optional ledger details
  • Build credit management and reporting tools
  • Monitor promotional credit utilization • Support customer inquiries about available credits

### Key response fields:

An array of Credit objects containing:

  • Credit details: Name, priority, and which applicable products/tags it applies to
  • Product ID: The `product_id` of the credit. This is for external mapping into your quote-to-cash stack, not the product it applies to.
  • Access schedule: When credits become available and expire
  • Optional ledger entries: Transaction history (if `include_ledgers=true`)
  • Balance information: Current available amount (if `include_balance=true`)
  • Metadata: Custom fields and usage specifiers

### Usage guidelines:

- Pagination: Results limited to 25 commits per page; use next_page for more - Date filtering options:

  • `covering_date`: Credits active on a specific date
  • `starting_at`: Credits with access on/after a date
  • `effective_before`: Credits with access before a date (exclusive)

- Scope options:

  • `include_contract_credits`: Include contract-level credits (not just customer-level)
  • `include_archived`: Include archived credits and credits from archived contracts

- Performance considerations:

  • `include_ledgers`: Adds detailed transaction history (slower)
  • `include_balance`: Adds current balance calculation (slower)

- Optional filtering: Use credit_id to retrieve a specific commit

func (*V1CustomerCreditService) New

Creates customer-level credits that provide spending allowances or free credit balances for customers across their Metronome usage. Note: In most cases, you should add credits directly to customer contracts using the contract/create or contract/edit APIs.

### Use this endpoint to:

Use this endpoint when you need to provision credits directly at the customer level that can be applied across multiple contracts or scoped to specific contracts. Customer-level credits are ideal for:

- Customer onboarding incentives that apply globally - Flexible spending allowances that aren't tied to a single contract - Migration scenarios where you need to preserve existing customer balances

#### Scoping flexibility:

Customer-level credits can be configured in two ways:

  • Contract-specific: Use the applicable_contract_ids field to limit the credit to specific contracts
  • Cross-contract: Leave applicable_contract_ids empty to allow the credit to be used across all of the customer's contracts

#### Product Targeting:

Credits can be scoped to specific products using `applicable_product_ids` or `applicable_product_tags`, or left unrestricted to apply to all products.

#### Priority considerations:

When multiple credits are applicable, the one with the lower priority value will be consumed first. If there is a tie, contract level commits and credits will be applied before customer level commits and credits. Plan your priority scheme carefully to ensure credits are applied in the desired order.

#### Access Schedule Required:

You must provide an `access_schedule` that defines when and how much credit becomes available to the customer over time. This usually is aligned to the contract schedule or starts immediately and is set to expire in the future.

### Usage Guidelines:

⚠️ Preferred Alternative: In most cases, you should add credits directly to contracts using the contract/create or contract/edit APIs instead of creating customer-level credits. Contract-level credits provide better organization, and are easier for finance teams to recognize revenue, and are the recommended approach for most use cases.

func (*V1CustomerCreditService) UpdateEndDate

Shortens the end date of an existing customer credit to terminate it earlier than originally scheduled. Only allows moving end dates forward (earlier), not extending them.

Note: To extend credit end dates or make comprehensive edits, use the 'edit credit' endpoint instead.

type V1CustomerCreditUpdateEndDateParams

type V1CustomerCreditUpdateEndDateParams struct {
	// RFC 3339 timestamp indicating when access to the credit will end and it will no
	// longer be possible to draw it down (exclusive).
	AccessEndingBefore time.Time `json:"access_ending_before,required" format:"date-time"`
	// ID of the commit to update
	CreditID string `json:"credit_id,required" format:"uuid"`
	// ID of the customer whose credit is to be updated
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// contains filtered or unexported fields
}

func (V1CustomerCreditUpdateEndDateParams) MarshalJSON

func (r V1CustomerCreditUpdateEndDateParams) MarshalJSON() (data []byte, err error)

func (*V1CustomerCreditUpdateEndDateParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomerCreditUpdateEndDateParams) UnmarshalJSON(data []byte) error

type V1CustomerCreditUpdateEndDateResponse

type V1CustomerCreditUpdateEndDateResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerCreditUpdateEndDateResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CustomerCreditUpdateEndDateResponse) UnmarshalJSON

func (r *V1CustomerCreditUpdateEndDateResponse) UnmarshalJSON(data []byte) error

type V1CustomerGetBillingConfigurationsParams added in v1.0.0

type V1CustomerGetBillingConfigurationsParams struct {
	CustomerID      string          `json:"customer_id,required" format:"uuid"`
	IncludeArchived param.Opt[bool] `json:"include_archived,omitzero"`
	// contains filtered or unexported fields
}

func (V1CustomerGetBillingConfigurationsParams) MarshalJSON added in v1.0.0

func (r V1CustomerGetBillingConfigurationsParams) MarshalJSON() (data []byte, err error)

func (*V1CustomerGetBillingConfigurationsParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomerGetBillingConfigurationsParams) UnmarshalJSON(data []byte) error

type V1CustomerGetBillingConfigurationsResponse added in v1.0.0

type V1CustomerGetBillingConfigurationsResponse struct {
	Data []V1CustomerGetBillingConfigurationsResponseData `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerGetBillingConfigurationsResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CustomerGetBillingConfigurationsResponse) UnmarshalJSON added in v1.0.0

func (r *V1CustomerGetBillingConfigurationsResponse) UnmarshalJSON(data []byte) error

type V1CustomerGetBillingConfigurationsResponseData added in v1.0.0

type V1CustomerGetBillingConfigurationsResponseData struct {
	// ID of this configuration; can be provided as the
	// billing_provider_configuration_id when creating a contract.
	ID         string    `json:"id,required" format:"uuid"`
	ArchivedAt time.Time `json:"archived_at,required" format:"date-time"`
	// The billing provider set for this configuration.
	//
	// Any of "aws_marketplace", "stripe", "netsuite", "custom", "azure_marketplace",
	// "quickbooks_online", "workday", "gcp_marketplace".
	BillingProvider string `json:"billing_provider,required"`
	// Configuration for the billing provider. The structure of this object is specific
	// to the billing provider.
	Configuration map[string]any `json:"configuration,required"`
	CustomerID    string         `json:"customer_id,required" format:"uuid"`
	// The method to use for delivering invoices to this customer.
	//
	// Any of "direct_to_billing_provider", "aws_sqs", "tackle", "aws_sns".
	DeliveryMethod string `json:"delivery_method,required"`
	// Configuration for the delivery method. The structure of this object is specific
	// to the delivery method.
	DeliveryMethodConfiguration map[string]any `json:"delivery_method_configuration,required"`
	// ID of the delivery method to use for this customer.
	DeliveryMethodID string `json:"delivery_method_id,required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                          respjson.Field
		ArchivedAt                  respjson.Field
		BillingProvider             respjson.Field
		Configuration               respjson.Field
		CustomerID                  respjson.Field
		DeliveryMethod              respjson.Field
		DeliveryMethodConfiguration respjson.Field
		DeliveryMethodID            respjson.Field
		ExtraFields                 map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerGetBillingConfigurationsResponseData) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CustomerGetBillingConfigurationsResponseData) UnmarshalJSON added in v1.0.0

type V1CustomerGetParams

type V1CustomerGetParams struct {
	CustomerID string `path:"customer_id,required" format:"uuid" json:"-"`
	// contains filtered or unexported fields
}

type V1CustomerGetResponse

type V1CustomerGetResponse struct {
	Data CustomerDetail `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerGetResponse) RawJSON added in v1.0.0

func (r V1CustomerGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1CustomerGetResponse) UnmarshalJSON

func (r *V1CustomerGetResponse) UnmarshalJSON(data []byte) error

type V1CustomerInvoiceAddChargeParams

type V1CustomerInvoiceAddChargeParams struct {
	CustomerID string `path:"customer_id,required" format:"uuid" json:"-"`
	// The Metronome ID of the charge to add to the invoice. Note that the charge must
	// be on a product that is not on the current plan, and the product must have only
	// fixed charges.
	ChargeID string `json:"charge_id,required" format:"uuid"`
	// The Metronome ID of the customer plan to add the charge to.
	CustomerPlanID string `json:"customer_plan_id,required" format:"uuid"`
	Description    string `json:"description,required"`
	// The start_timestamp of the invoice to add the charge to.
	InvoiceStartTimestamp time.Time `json:"invoice_start_timestamp,required" format:"date-time"`
	// The price of the charge. This price will match the currency on the invoice, e.g.
	// USD cents.
	Price    float64 `json:"price,required"`
	Quantity float64 `json:"quantity,required"`
	// contains filtered or unexported fields
}

func (V1CustomerInvoiceAddChargeParams) MarshalJSON

func (r V1CustomerInvoiceAddChargeParams) MarshalJSON() (data []byte, err error)

func (*V1CustomerInvoiceAddChargeParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomerInvoiceAddChargeParams) UnmarshalJSON(data []byte) error

type V1CustomerInvoiceAddChargeResponse

type V1CustomerInvoiceAddChargeResponse struct {
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerInvoiceAddChargeResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CustomerInvoiceAddChargeResponse) UnmarshalJSON

func (r *V1CustomerInvoiceAddChargeResponse) UnmarshalJSON(data []byte) error

type V1CustomerInvoiceGetParams

type V1CustomerInvoiceGetParams struct {
	CustomerID string `path:"customer_id,required" format:"uuid" json:"-"`
	InvoiceID  string `path:"invoice_id,required" format:"uuid" json:"-"`
	// If set, all zero quantity line items will be filtered out of the response
	SkipZeroQtyLineItems param.Opt[bool] `query:"skip_zero_qty_line_items,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1CustomerInvoiceGetParams) URLQuery

func (r V1CustomerInvoiceGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1CustomerInvoiceGetParams's query parameters as `url.Values`.

type V1CustomerInvoiceGetResponse

type V1CustomerInvoiceGetResponse struct {
	Data Invoice `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerInvoiceGetResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CustomerInvoiceGetResponse) UnmarshalJSON

func (r *V1CustomerInvoiceGetResponse) UnmarshalJSON(data []byte) error

type V1CustomerInvoiceListBreakdownsParams

type V1CustomerInvoiceListBreakdownsParams struct {
	CustomerID string `path:"customer_id,required" format:"uuid" json:"-"`
	// RFC 3339 timestamp. Breakdowns will only be returned for time windows that end
	// on or before this time.
	EndingBefore time.Time `query:"ending_before,required" format:"date-time" json:"-"`
	// RFC 3339 timestamp. Breakdowns will only be returned for time windows that start
	// on or after this time.
	StartingOn time.Time `query:"starting_on,required" format:"date-time" json:"-"`
	// Only return invoices for the specified credit type
	CreditTypeID param.Opt[string] `query:"credit_type_id,omitzero" json:"-"`
	// Max number of results that should be returned. For daily breakdowns, the
	// response can return up to 35 days worth of breakdowns. For hourly breakdowns,
	// the response can return up to 24 hours. If there are more results, a cursor to
	// the next page is returned.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	// If set, all zero quantity line items will be filtered out of the response
	SkipZeroQtyLineItems param.Opt[bool] `query:"skip_zero_qty_line_items,omitzero" json:"-"`
	// Invoice status, e.g. DRAFT or FINALIZED
	Status param.Opt[string] `query:"status,omitzero" json:"-"`
	// Invoice sort order by issued_at, e.g. date_asc or date_desc. Defaults to
	// date_asc.
	//
	// Any of "date_asc", "date_desc".
	Sort V1CustomerInvoiceListBreakdownsParamsSort `query:"sort,omitzero" json:"-"`
	// The granularity of the breakdowns to return. Defaults to day.
	//
	// Any of "HOUR", "DAY".
	WindowSize V1CustomerInvoiceListBreakdownsParamsWindowSize `query:"window_size,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1CustomerInvoiceListBreakdownsParams) URLQuery

func (r V1CustomerInvoiceListBreakdownsParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1CustomerInvoiceListBreakdownsParams's query parameters as `url.Values`.

type V1CustomerInvoiceListBreakdownsParamsSort

type V1CustomerInvoiceListBreakdownsParamsSort string

Invoice sort order by issued_at, e.g. date_asc or date_desc. Defaults to date_asc.

const (
	V1CustomerInvoiceListBreakdownsParamsSortDateAsc  V1CustomerInvoiceListBreakdownsParamsSort = "date_asc"
	V1CustomerInvoiceListBreakdownsParamsSortDateDesc V1CustomerInvoiceListBreakdownsParamsSort = "date_desc"
)

type V1CustomerInvoiceListBreakdownsParamsWindowSize

type V1CustomerInvoiceListBreakdownsParamsWindowSize string

The granularity of the breakdowns to return. Defaults to day.

const (
	V1CustomerInvoiceListBreakdownsParamsWindowSizeHour V1CustomerInvoiceListBreakdownsParamsWindowSize = "HOUR"
	V1CustomerInvoiceListBreakdownsParamsWindowSizeDay  V1CustomerInvoiceListBreakdownsParamsWindowSize = "DAY"
)

type V1CustomerInvoiceListBreakdownsResponse

type V1CustomerInvoiceListBreakdownsResponse struct {
	BreakdownEndTimestamp   time.Time `json:"breakdown_end_timestamp,required" format:"date-time"`
	BreakdownStartTimestamp time.Time `json:"breakdown_start_timestamp,required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BreakdownEndTimestamp   respjson.Field
		BreakdownStartTimestamp respjson.Field
		ExtraFields             map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	Invoice
}

func (V1CustomerInvoiceListBreakdownsResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CustomerInvoiceListBreakdownsResponse) UnmarshalJSON

func (r *V1CustomerInvoiceListBreakdownsResponse) UnmarshalJSON(data []byte) error

type V1CustomerInvoiceListParams

type V1CustomerInvoiceListParams struct {
	CustomerID string `path:"customer_id,required" format:"uuid" json:"-"`
	// Only return invoices for the specified credit type
	CreditTypeID param.Opt[string] `query:"credit_type_id,omitzero" json:"-"`
	// RFC 3339 timestamp (exclusive). Invoices will only be returned for billing
	// periods that end before this time.
	EndingBefore param.Opt[time.Time] `query:"ending_before,omitzero" format:"date-time" json:"-"`
	// Max number of results that should be returned
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	// If set, all zero quantity line items will be filtered out of the response
	SkipZeroQtyLineItems param.Opt[bool] `query:"skip_zero_qty_line_items,omitzero" json:"-"`
	// RFC 3339 timestamp (inclusive). Invoices will only be returned for billing
	// periods that start at or after this time.
	StartingOn param.Opt[time.Time] `query:"starting_on,omitzero" format:"date-time" json:"-"`
	// Invoice status, e.g. DRAFT, FINALIZED, or VOID
	Status param.Opt[string] `query:"status,omitzero" json:"-"`
	// Invoice sort order by issued_at, e.g. date_asc or date_desc. Defaults to
	// date_asc.
	//
	// Any of "date_asc", "date_desc".
	Sort V1CustomerInvoiceListParamsSort `query:"sort,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1CustomerInvoiceListParams) URLQuery

func (r V1CustomerInvoiceListParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1CustomerInvoiceListParams's query parameters as `url.Values`.

type V1CustomerInvoiceListParamsSort

type V1CustomerInvoiceListParamsSort string

Invoice sort order by issued_at, e.g. date_asc or date_desc. Defaults to date_asc.

const (
	V1CustomerInvoiceListParamsSortDateAsc  V1CustomerInvoiceListParamsSort = "date_asc"
	V1CustomerInvoiceListParamsSortDateDesc V1CustomerInvoiceListParamsSort = "date_desc"
)

type V1CustomerInvoiceService

type V1CustomerInvoiceService struct {
	Options []option.RequestOption
}

V1CustomerInvoiceService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1CustomerInvoiceService method instead.

func NewV1CustomerInvoiceService

func NewV1CustomerInvoiceService(opts ...option.RequestOption) (r V1CustomerInvoiceService)

NewV1CustomerInvoiceService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1CustomerInvoiceService) AddCharge

Add a one time charge to the specified invoice

func (*V1CustomerInvoiceService) Get

Retrieve detailed information for a specific invoice by its unique identifier. This endpoint returns comprehensive invoice data including line items, applied credits, totals, and billing period details for both finalized and draft invoices.

### Use this endpoint to:

  • Display historical invoice details in customer-facing dashboards or billing portals.
  • Retrieve current month draft invoices to show customers their month-to-date spend.
  • Access finalized invoices for historical billing records and payment reconciliation.
  • Validate customer pricing and credit applications for customer support queries.

### Key response fields:

Invoice status (DRAFT, FINALIZED, VOID) Billing period start and end dates Total amount and amount due after credits Detailed line items broken down by:

- Customer and contract information - Invoice line item type - Product/service name and ID - Quantity consumed - Unit and total price - Time period for usage-based charges - Applied credits or prepaid commitments

### Usage guidelines:

  • Draft invoices update in real-time as usage is reported and may change before finalization
  • The response includes both usage-based line items (e.g., API calls, data processed) and scheduled charges (e.g., monthly subscriptions, commitment fees)
  • Credit and commitment applications are shown as separate line items with negative amounts
  • For voided invoices, the response will indicate VOID status but retain all original line item details

func (*V1CustomerInvoiceService) List

Retrieves a paginated list of invoices for a specific customer, with flexible filtering options to narrow results by status, date range, credit type, and more. This endpoint provides a comprehensive view of a customer's billing history and current charges, supporting both real-time billing dashboards and historical reporting needs.

### Use this endpoint to:

  • Display historical invoice details in customer-facing dashboards or billing portals.
  • Retrieve current month draft invoices to show customers their month-to-date spend.
  • Access finalized invoices for historical billing records and payment reconciliation.
  • Validate customer pricing and credit applications for customer support queries.
  • Generate financial reports by filtering invoices within specific date ranges

### Key response fields:

Array of invoice objects containing:

- Invoice ID and status (DRAFT, FINALIZED, VOID) - Invoice type (USAGE, SCHEDULED) - Billing period start and end dates - Issue date and due date - Total amount, subtotal, and amount due - Applied credits summary - Contract ID reference - External billing provider status (if integrated with Stripe, etc.) - Pagination metadata `next_page` cursor

### Usage guidelines:

  • The endpoint returns invoice summaries; use the Get Invoice endpoint for detailed line items
  • Draft invoices are continuously updated as new usage is reported and will show real-time spend
  • Results are ordered by creation date descending by default (newest first)
  • When filtering by date range, the filter applies to the billing period, not the issue date
  • For customers with many invoices, implement pagination to ensure all results are retrieved External billing provider statuses (like Stripe payment status) are included when applicable
  • Voided invoices are included in results by default unless filtered out by status

func (*V1CustomerInvoiceService) ListAutoPaging

Retrieves a paginated list of invoices for a specific customer, with flexible filtering options to narrow results by status, date range, credit type, and more. This endpoint provides a comprehensive view of a customer's billing history and current charges, supporting both real-time billing dashboards and historical reporting needs.

### Use this endpoint to:

  • Display historical invoice details in customer-facing dashboards or billing portals.
  • Retrieve current month draft invoices to show customers their month-to-date spend.
  • Access finalized invoices for historical billing records and payment reconciliation.
  • Validate customer pricing and credit applications for customer support queries.
  • Generate financial reports by filtering invoices within specific date ranges

### Key response fields:

Array of invoice objects containing:

- Invoice ID and status (DRAFT, FINALIZED, VOID) - Invoice type (USAGE, SCHEDULED) - Billing period start and end dates - Issue date and due date - Total amount, subtotal, and amount due - Applied credits summary - Contract ID reference - External billing provider status (if integrated with Stripe, etc.) - Pagination metadata `next_page` cursor

### Usage guidelines:

  • The endpoint returns invoice summaries; use the Get Invoice endpoint for detailed line items
  • Draft invoices are continuously updated as new usage is reported and will show real-time spend
  • Results are ordered by creation date descending by default (newest first)
  • When filtering by date range, the filter applies to the billing period, not the issue date
  • For customers with many invoices, implement pagination to ensure all results are retrieved External billing provider statuses (like Stripe payment status) are included when applicable
  • Voided invoices are included in results by default unless filtered out by status

func (*V1CustomerInvoiceService) ListBreakdowns

Retrieve granular time-series breakdowns of invoice data at hourly or daily intervals. This endpoint transforms standard invoices into detailed timelines, enabling you to track usage patterns, identify consumption spikes, and provide customers with transparency into their billing details throughout the billing period.

### Use this endpoint to:

- Build usage analytics dashboards showing daily or hourly consumption trends - Identify peak usage periods for capacity planning and cost optimization - Generate detailed billing reports for finance teams and customer success - Troubleshoot billing disputes by examining usage patterns at specific times - Power real-time cost monitoring and alerting systems

### Key response fields:

An array of BreakdownInvoice objects, each containing:

- All standard invoice fields (ID, customer, commit, line items, totals, status) - Line items with quantities and costs for that specific period - `breakdown_start_timestamp`: Start of the specific time window - `breakdown_end_timestamp`: End of the specific time window - `next_page`: Pagination cursor for large result sets

### Usage guidelines:

  • Time granularity: Set `window_size` to hour or day based on your analysis needs
  • Response limits: Daily breakdowns return up to 35 days; hourly breakdowns return up to 24 hours per request
  • Date filtering: Use `starting_on` and `ending_before` to focus on specific periods
  • Performance: For large date ranges, use pagination to retrieve all data efficiently
  • Backdated usage: If usage events arrive after invoice finalization, breakdowns will reflect the updated usage
  • Zero quantity filtering: Use `skip_zero_qty_line_items=true` to exclude periods with no usage

func (*V1CustomerInvoiceService) ListBreakdownsAutoPaging

Retrieve granular time-series breakdowns of invoice data at hourly or daily intervals. This endpoint transforms standard invoices into detailed timelines, enabling you to track usage patterns, identify consumption spikes, and provide customers with transparency into their billing details throughout the billing period.

### Use this endpoint to:

- Build usage analytics dashboards showing daily or hourly consumption trends - Identify peak usage periods for capacity planning and cost optimization - Generate detailed billing reports for finance teams and customer success - Troubleshoot billing disputes by examining usage patterns at specific times - Power real-time cost monitoring and alerting systems

### Key response fields:

An array of BreakdownInvoice objects, each containing:

- All standard invoice fields (ID, customer, commit, line items, totals, status) - Line items with quantities and costs for that specific period - `breakdown_start_timestamp`: Start of the specific time window - `breakdown_end_timestamp`: End of the specific time window - `next_page`: Pagination cursor for large result sets

### Usage guidelines:

  • Time granularity: Set `window_size` to hour or day based on your analysis needs
  • Response limits: Daily breakdowns return up to 35 days; hourly breakdowns return up to 24 hours per request
  • Date filtering: Use `starting_on` and `ending_before` to focus on specific periods
  • Performance: For large date ranges, use pagination to retrieve all data efficiently
  • Backdated usage: If usage events arrive after invoice finalization, breakdowns will reflect the updated usage
  • Zero quantity filtering: Use `skip_zero_qty_line_items=true` to exclude periods with no usage

type V1CustomerListBillableMetricsParams

type V1CustomerListBillableMetricsParams struct {
	CustomerID string `path:"customer_id,required" format:"uuid" json:"-"`
	// If true, the list of returned metrics will include archived metrics
	IncludeArchived param.Opt[bool] `query:"include_archived,omitzero" json:"-"`
	// Max number of results that should be returned
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	// If true, the list of metrics will be filtered to just ones that are on the
	// customer's current plan
	OnCurrentPlan param.Opt[bool] `query:"on_current_plan,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1CustomerListBillableMetricsParams) URLQuery

func (r V1CustomerListBillableMetricsParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1CustomerListBillableMetricsParams's query parameters as `url.Values`.

type V1CustomerListBillableMetricsResponse

type V1CustomerListBillableMetricsResponse struct {
	ID   string `json:"id,required" format:"uuid"`
	Name string `json:"name,required"`
	// (DEPRECATED) use aggregation_type instead
	Aggregate string `json:"aggregate"`
	// (DEPRECATED) use aggregation_key instead
	AggregateKeys []string `json:"aggregate_keys"`
	// 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'.
	AggregationKey string `json:"aggregation_key"`
	// Specifies the type of aggregation performed on matching events.
	//
	// Any of "COUNT", "LATEST", "MAX", "SUM", "UNIQUE".
	AggregationType V1CustomerListBillableMetricsResponseAggregationType `json:"aggregation_type"`
	// RFC 3339 timestamp indicating when the billable metric was archived. If not
	// provided, the billable metric is not archived.
	ArchivedAt time.Time `json:"archived_at" format:"date-time"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields"`
	// An optional filtering rule to match the 'event_type' property of an event.
	EventTypeFilter shared.EventTypeFilter `json:"event_type_filter"`
	// (DEPRECATED) use property_filters & event_type_filter instead
	Filter map[string]any `json:"filter"`
	// (DEPRECATED) use group_keys instead
	GroupBy []string `json:"group_by"`
	// 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.
	GroupKeys [][]string `json:"group_keys"`
	// 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.
	PropertyFilters []shared.PropertyFilter `json:"property_filters"`
	// The SQL query associated with the billable metric
	Sql string `json:"sql"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID              respjson.Field
		Name            respjson.Field
		Aggregate       respjson.Field
		AggregateKeys   respjson.Field
		AggregationKey  respjson.Field
		AggregationType respjson.Field
		ArchivedAt      respjson.Field
		CustomFields    respjson.Field
		EventTypeFilter respjson.Field
		Filter          respjson.Field
		GroupBy         respjson.Field
		GroupKeys       respjson.Field
		PropertyFilters respjson.Field
		Sql             respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerListBillableMetricsResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CustomerListBillableMetricsResponse) UnmarshalJSON

func (r *V1CustomerListBillableMetricsResponse) UnmarshalJSON(data []byte) error

type V1CustomerListBillableMetricsResponseAggregationType

type V1CustomerListBillableMetricsResponseAggregationType string

Specifies the type of aggregation performed on matching events.

const (
	V1CustomerListBillableMetricsResponseAggregationTypeCount  V1CustomerListBillableMetricsResponseAggregationType = "COUNT"
	V1CustomerListBillableMetricsResponseAggregationTypeLatest V1CustomerListBillableMetricsResponseAggregationType = "LATEST"
	V1CustomerListBillableMetricsResponseAggregationTypeMax    V1CustomerListBillableMetricsResponseAggregationType = "MAX"
	V1CustomerListBillableMetricsResponseAggregationTypeSum    V1CustomerListBillableMetricsResponseAggregationType = "SUM"
	V1CustomerListBillableMetricsResponseAggregationTypeUnique V1CustomerListBillableMetricsResponseAggregationType = "UNIQUE"
)

type V1CustomerListCostsParams

type V1CustomerListCostsParams struct {
	CustomerID string `path:"customer_id,required" format:"uuid" json:"-"`
	// RFC 3339 timestamp (exclusive)
	EndingBefore time.Time `query:"ending_before,required" format:"date-time" json:"-"`
	// RFC 3339 timestamp (inclusive)
	StartingOn time.Time `query:"starting_on,required" format:"date-time" json:"-"`
	// Max number of results that should be returned
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1CustomerListCostsParams) URLQuery

func (r V1CustomerListCostsParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1CustomerListCostsParams's query parameters as `url.Values`.

type V1CustomerListCostsResponse

type V1CustomerListCostsResponse struct {
	CreditTypes    map[string]V1CustomerListCostsResponseCreditType `json:"credit_types,required"`
	EndTimestamp   time.Time                                        `json:"end_timestamp,required" format:"date-time"`
	StartTimestamp time.Time                                        `json:"start_timestamp,required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreditTypes    respjson.Field
		EndTimestamp   respjson.Field
		StartTimestamp respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerListCostsResponse) RawJSON added in v1.0.0

func (r V1CustomerListCostsResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1CustomerListCostsResponse) UnmarshalJSON

func (r *V1CustomerListCostsResponse) UnmarshalJSON(data []byte) error

type V1CustomerListCostsResponseCreditType

type V1CustomerListCostsResponseCreditType struct {
	Cost              float64                                                  `json:"cost"`
	LineItemBreakdown []V1CustomerListCostsResponseCreditTypeLineItemBreakdown `json:"line_item_breakdown"`
	Name              string                                                   `json:"name"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Cost              respjson.Field
		LineItemBreakdown respjson.Field
		Name              respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerListCostsResponseCreditType) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CustomerListCostsResponseCreditType) UnmarshalJSON

func (r *V1CustomerListCostsResponseCreditType) UnmarshalJSON(data []byte) error

type V1CustomerListCostsResponseCreditTypeLineItemBreakdown added in v1.0.0

type V1CustomerListCostsResponseCreditTypeLineItemBreakdown struct {
	Cost       float64 `json:"cost,required"`
	Name       string  `json:"name,required"`
	GroupKey   string  `json:"group_key"`
	GroupValue string  `json:"group_value,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Cost        respjson.Field
		Name        respjson.Field
		GroupKey    respjson.Field
		GroupValue  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerListCostsResponseCreditTypeLineItemBreakdown) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CustomerListCostsResponseCreditTypeLineItemBreakdown) UnmarshalJSON added in v1.0.0

type V1CustomerListParams

type V1CustomerListParams struct {
	// Filter the customer list by ingest_alias
	IngestAlias param.Opt[string] `query:"ingest_alias,omitzero" json:"-"`
	// Max number of results that should be returned
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	// Filter the customer list to only return archived customers. By default, only
	// active customers are returned.
	OnlyArchived param.Opt[bool] `query:"only_archived,omitzero" json:"-"`
	// Filter the customer list by customer_id. Up to 100 ids can be provided.
	CustomerIDs []string `query:"customer_ids,omitzero" json:"-"`
	// Filter the customer list by salesforce_account_id. Up to 100 ids can be
	// provided.
	SalesforceAccountIDs []string `query:"salesforce_account_ids,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1CustomerListParams) URLQuery

func (r V1CustomerListParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1CustomerListParams's query parameters as `url.Values`.

type V1CustomerNamedScheduleGetParams

type V1CustomerNamedScheduleGetParams struct {
	// ID of the customer whose named schedule is to be retrieved
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// The identifier for the schedule to be retrieved
	ScheduleName string `json:"schedule_name,required"`
	// If provided, at most one schedule segment will be returned (the one that covers
	// this date). If not provided, all segments will be returned.
	CoveringDate param.Opt[time.Time] `json:"covering_date,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

func (V1CustomerNamedScheduleGetParams) MarshalJSON

func (r V1CustomerNamedScheduleGetParams) MarshalJSON() (data []byte, err error)

func (*V1CustomerNamedScheduleGetParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomerNamedScheduleGetParams) UnmarshalJSON(data []byte) error

type V1CustomerNamedScheduleGetResponse

type V1CustomerNamedScheduleGetResponse struct {
	Data []V1CustomerNamedScheduleGetResponseData `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerNamedScheduleGetResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CustomerNamedScheduleGetResponse) UnmarshalJSON

func (r *V1CustomerNamedScheduleGetResponse) UnmarshalJSON(data []byte) error

type V1CustomerNamedScheduleGetResponseData

type V1CustomerNamedScheduleGetResponseData struct {
	StartingAt   time.Time `json:"starting_at,required" format:"date-time"`
	Value        any       `json:"value,required"`
	EndingBefore time.Time `json:"ending_before" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		StartingAt   respjson.Field
		Value        respjson.Field
		EndingBefore respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerNamedScheduleGetResponseData) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CustomerNamedScheduleGetResponseData) UnmarshalJSON

func (r *V1CustomerNamedScheduleGetResponseData) UnmarshalJSON(data []byte) error

type V1CustomerNamedScheduleService

type V1CustomerNamedScheduleService struct {
	Options []option.RequestOption
}

V1CustomerNamedScheduleService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1CustomerNamedScheduleService method instead.

func NewV1CustomerNamedScheduleService

func NewV1CustomerNamedScheduleService(opts ...option.RequestOption) (r V1CustomerNamedScheduleService)

NewV1CustomerNamedScheduleService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1CustomerNamedScheduleService) Get

Get a named schedule for the given customer. This endpoint's availability is dependent on your client's configuration.

func (*V1CustomerNamedScheduleService) Update

Update a named schedule for the given customer. This endpoint's availability is dependent on your client's configuration.

type V1CustomerNamedScheduleUpdateParams

type V1CustomerNamedScheduleUpdateParams struct {
	// ID of the customer whose named schedule is to be updated
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// The identifier for the schedule to be updated
	ScheduleName string    `json:"schedule_name,required"`
	StartingAt   time.Time `json:"starting_at,required" format:"date-time"`
	// The value to set for the named schedule. The structure of this object is
	// specific to the named schedule.
	Value        any                  `json:"value,omitzero,required"`
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

func (V1CustomerNamedScheduleUpdateParams) MarshalJSON

func (r V1CustomerNamedScheduleUpdateParams) MarshalJSON() (data []byte, err error)

func (*V1CustomerNamedScheduleUpdateParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomerNamedScheduleUpdateParams) UnmarshalJSON(data []byte) error

type V1CustomerNewParams

type V1CustomerNewParams struct {
	// This will be truncated to 160 characters if the provided name is longer.
	Name string `json:"name,required"`
	// (deprecated, use ingest_aliases instead) an alias that can be used to refer to
	// this customer in usage events
	ExternalID    param.Opt[string]                `json:"external_id,omitzero"`
	BillingConfig V1CustomerNewParamsBillingConfig `json:"billing_config,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields                          map[string]string                                         `json:"custom_fields,omitzero"`
	CustomerBillingProviderConfigurations []V1CustomerNewParamsCustomerBillingProviderConfiguration `json:"customer_billing_provider_configurations,omitzero"`
	// Aliases that can be used to refer to this customer in usage events
	IngestAliases []string `json:"ingest_aliases,omitzero"`
	// contains filtered or unexported fields
}

func (V1CustomerNewParams) MarshalJSON

func (r V1CustomerNewParams) MarshalJSON() (data []byte, err error)

func (*V1CustomerNewParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomerNewParams) UnmarshalJSON(data []byte) error

type V1CustomerNewParamsBillingConfig

type V1CustomerNewParamsBillingConfig struct {
	BillingProviderCustomerID string `json:"billing_provider_customer_id,required"`
	// Any of "aws_marketplace", "stripe", "netsuite", "custom", "azure_marketplace",
	// "quickbooks_online", "workday", "gcp_marketplace".
	BillingProviderType string `json:"billing_provider_type,omitzero,required"`
	// True if the aws_product_code is a SAAS subscription product, false otherwise.
	AwsIsSubscriptionProduct param.Opt[bool]   `json:"aws_is_subscription_product,omitzero"`
	AwsProductCode           param.Opt[string] `json:"aws_product_code,omitzero"`
	// Any of "af-south-1", "ap-east-1", "ap-northeast-1", "ap-northeast-2",
	// "ap-northeast-3", "ap-south-1", "ap-southeast-1", "ap-southeast-2",
	// "ca-central-1", "cn-north-1", "cn-northwest-1", "eu-central-1", "eu-north-1",
	// "eu-south-1", "eu-west-1", "eu-west-2", "eu-west-3", "me-south-1", "sa-east-1",
	// "us-east-1", "us-east-2", "us-gov-east-1", "us-gov-west-1", "us-west-1",
	// "us-west-2".
	AwsRegion string `json:"aws_region,omitzero"`
	// Any of "charge_automatically", "send_invoice", "auto_charge_payment_intent",
	// "manually_charge_payment_intent".
	StripeCollectionMethod string `json:"stripe_collection_method,omitzero"`
	// contains filtered or unexported fields
}

The properties BillingProviderCustomerID, BillingProviderType are required.

func (V1CustomerNewParamsBillingConfig) MarshalJSON

func (r V1CustomerNewParamsBillingConfig) MarshalJSON() (data []byte, err error)

func (*V1CustomerNewParamsBillingConfig) UnmarshalJSON added in v1.0.0

func (r *V1CustomerNewParamsBillingConfig) UnmarshalJSON(data []byte) error

type V1CustomerNewParamsCustomerBillingProviderConfiguration

type V1CustomerNewParamsCustomerBillingProviderConfiguration struct {
	// The billing provider set for this configuration.
	//
	// Any of "aws_marketplace", "azure_marketplace", "gcp_marketplace", "stripe",
	// "netsuite".
	BillingProvider string `json:"billing_provider,omitzero,required"`
	// ID of the delivery method to use for this customer. If not provided, the
	// `delivery_method` must be provided.
	DeliveryMethodID param.Opt[string] `json:"delivery_method_id,omitzero" format:"uuid"`
	// Configuration for the billing provider. The structure of this object is specific
	// to the billing provider and delivery provider combination. Defaults to an empty
	// object, however, for most billing provider + delivery method combinations, it
	// will not be a valid configuration.
	Configuration map[string]any `json:"configuration,omitzero"`
	// The method to use for delivering invoices to this customer. If not provided, the
	// `delivery_method_id` must be provided.
	//
	// Any of "direct_to_billing_provider", "aws_sqs", "tackle", "aws_sns".
	DeliveryMethod string `json:"delivery_method,omitzero"`
	// Specifies which tax provider Metronome should use for tax calculation when
	// billing through Stripe. This is only supported for Stripe billing provider
	// configurations with auto_charge_payment_intent or manual_charge_payment_intent
	// collection methods.
	//
	// Any of "anrok", "avalara", "stripe".
	TaxProvider string `json:"tax_provider,omitzero"`
	// contains filtered or unexported fields
}

The property BillingProvider is required.

func (V1CustomerNewParamsCustomerBillingProviderConfiguration) MarshalJSON

func (*V1CustomerNewParamsCustomerBillingProviderConfiguration) UnmarshalJSON added in v1.0.0

type V1CustomerNewResponse

type V1CustomerNewResponse struct {
	Data Customer `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerNewResponse) RawJSON added in v1.0.0

func (r V1CustomerNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1CustomerNewResponse) UnmarshalJSON

func (r *V1CustomerNewResponse) UnmarshalJSON(data []byte) error

type V1CustomerPlanAddParams

type V1CustomerPlanAddParams struct {
	CustomerID string `path:"customer_id,required" format:"uuid" json:"-"`
	PlanID     string `json:"plan_id,required" format:"uuid"`
	// RFC 3339 timestamp for when the plan becomes active for this customer. Must be
	// at 0:00 UTC (midnight).
	StartingOn time.Time `json:"starting_on,required" format:"date-time"`
	// RFC 3339 timestamp for when the plan ends (exclusive) for this customer. Must be
	// at 0:00 UTC (midnight).
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	// Number of days after issuance of invoice after which the invoice is due (e.g.
	// Net 30).
	NetPaymentTermsDays param.Opt[float64] `json:"net_payment_terms_days,omitzero"`
	// An optional list of overage rates that override the rates of the original plan
	// configuration. These new rates will apply to all pricing ramps.
	OverageRateAdjustments []V1CustomerPlanAddParamsOverageRateAdjustment `json:"overage_rate_adjustments,omitzero"`
	// A list of price adjustments can be applied on top of the pricing in the plans.
	// See the
	// [price adjustments documentation](https://plans-docs.metronome.com/pricing/managing-plans/#price-adjustments)
	// for details.
	PriceAdjustments []V1CustomerPlanAddParamsPriceAdjustment `json:"price_adjustments,omitzero"`
	// A custom trial can be set for the customer's plan. See the
	// [trial configuration documentation](https://docs.metronome.com/provisioning/configure-trials/)
	// for details.
	TrialSpec V1CustomerPlanAddParamsTrialSpec `json:"trial_spec,omitzero"`
	// contains filtered or unexported fields
}

func (V1CustomerPlanAddParams) MarshalJSON

func (r V1CustomerPlanAddParams) MarshalJSON() (data []byte, err error)

func (*V1CustomerPlanAddParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomerPlanAddParams) UnmarshalJSON(data []byte) error

type V1CustomerPlanAddParamsOverageRateAdjustment

type V1CustomerPlanAddParamsOverageRateAdjustment struct {
	CustomCreditTypeID       string `json:"custom_credit_type_id,required" format:"uuid"`
	FiatCurrencyCreditTypeID string `json:"fiat_currency_credit_type_id,required" format:"uuid"`
	// The overage cost in fiat currency for each credit of the custom credit type.
	ToFiatConversionFactor float64 `json:"to_fiat_conversion_factor,required"`
	// contains filtered or unexported fields
}

The properties CustomCreditTypeID, FiatCurrencyCreditTypeID, ToFiatConversionFactor are required.

func (V1CustomerPlanAddParamsOverageRateAdjustment) MarshalJSON

func (r V1CustomerPlanAddParamsOverageRateAdjustment) MarshalJSON() (data []byte, err error)

func (*V1CustomerPlanAddParamsOverageRateAdjustment) UnmarshalJSON added in v1.0.0

func (r *V1CustomerPlanAddParamsOverageRateAdjustment) UnmarshalJSON(data []byte) error

type V1CustomerPlanAddParamsPriceAdjustment

type V1CustomerPlanAddParamsPriceAdjustment struct {
	// Any of "percentage", "fixed", "override", "quantity".
	AdjustmentType string `json:"adjustment_type,omitzero,required"`
	ChargeID       string `json:"charge_id,required" format:"uuid"`
	// Used in price ramps. Indicates how many billing periods pass before the charge
	// applies.
	StartPeriod float64 `json:"start_period,required"`
	// the overridden quantity for a fixed charge
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Used in pricing tiers. Indicates at what metric value the price applies.
	Tier param.Opt[float64] `json:"tier,omitzero"`
	// The amount of change to a price. Percentage and fixed adjustments can be
	// positive or negative. Percentage-based adjustments should be decimals, e.g.
	// -0.05 for a 5% discount.
	Value param.Opt[float64] `json:"value,omitzero"`
	// contains filtered or unexported fields
}

The properties AdjustmentType, ChargeID, StartPeriod are required.

func (V1CustomerPlanAddParamsPriceAdjustment) MarshalJSON

func (r V1CustomerPlanAddParamsPriceAdjustment) MarshalJSON() (data []byte, err error)

func (*V1CustomerPlanAddParamsPriceAdjustment) UnmarshalJSON added in v1.0.0

func (r *V1CustomerPlanAddParamsPriceAdjustment) UnmarshalJSON(data []byte) error

type V1CustomerPlanAddParamsTrialSpec

type V1CustomerPlanAddParamsTrialSpec struct {
	// Length of the trial period in days.
	LengthInDays float64                                     `json:"length_in_days,required"`
	SpendingCap  V1CustomerPlanAddParamsTrialSpecSpendingCap `json:"spending_cap,omitzero"`
	// contains filtered or unexported fields
}

A custom trial can be set for the customer's plan. See the [trial configuration documentation](https://docs.metronome.com/provisioning/configure-trials/) for details.

The property LengthInDays is required.

func (V1CustomerPlanAddParamsTrialSpec) MarshalJSON

func (r V1CustomerPlanAddParamsTrialSpec) MarshalJSON() (data []byte, err error)

func (*V1CustomerPlanAddParamsTrialSpec) UnmarshalJSON added in v1.0.0

func (r *V1CustomerPlanAddParamsTrialSpec) UnmarshalJSON(data []byte) error

type V1CustomerPlanAddParamsTrialSpecSpendingCap

type V1CustomerPlanAddParamsTrialSpecSpendingCap struct {
	// The credit amount in the given denomination based on the credit type, e.g. US
	// cents.
	Amount float64 `json:"amount,required"`
	// The credit type ID for the spending cap.
	CreditTypeID string `json:"credit_type_id,required"`
	// contains filtered or unexported fields
}

The properties Amount, CreditTypeID are required.

func (V1CustomerPlanAddParamsTrialSpecSpendingCap) MarshalJSON

func (r V1CustomerPlanAddParamsTrialSpecSpendingCap) MarshalJSON() (data []byte, err error)

func (*V1CustomerPlanAddParamsTrialSpecSpendingCap) UnmarshalJSON added in v1.0.0

func (r *V1CustomerPlanAddParamsTrialSpecSpendingCap) UnmarshalJSON(data []byte) error

type V1CustomerPlanAddResponse

type V1CustomerPlanAddResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerPlanAddResponse) RawJSON added in v1.0.0

func (r V1CustomerPlanAddResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1CustomerPlanAddResponse) UnmarshalJSON

func (r *V1CustomerPlanAddResponse) UnmarshalJSON(data []byte) error

type V1CustomerPlanEndParams

type V1CustomerPlanEndParams struct {
	CustomerID     string `path:"customer_id,required" format:"uuid" json:"-"`
	CustomerPlanID string `path:"customer_plan_id,required" format:"uuid" json:"-"`
	// RFC 3339 timestamp for when the plan ends (exclusive) for this customer. Must be
	// at 0:00 UTC (midnight). If not provided, the plan end date will be cleared.
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	// If true, plan end date can be before the last finalized invoice date. Any
	// invoices generated after the plan end date will be voided.
	VoidInvoices param.Opt[bool] `json:"void_invoices,omitzero"`
	// Only applicable when void_invoices is set to true. If true, for every invoice
	// that is voided we will also attempt to void/delete the stripe invoice (if any).
	// Stripe invoices will be voided if finalized or deleted if still in draft state.
	VoidStripeInvoices param.Opt[bool] `json:"void_stripe_invoices,omitzero"`
	// contains filtered or unexported fields
}

func (V1CustomerPlanEndParams) MarshalJSON

func (r V1CustomerPlanEndParams) MarshalJSON() (data []byte, err error)

func (*V1CustomerPlanEndParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomerPlanEndParams) UnmarshalJSON(data []byte) error

type V1CustomerPlanEndResponse

type V1CustomerPlanEndResponse struct {
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerPlanEndResponse) RawJSON added in v1.0.0

func (r V1CustomerPlanEndResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1CustomerPlanEndResponse) UnmarshalJSON

func (r *V1CustomerPlanEndResponse) UnmarshalJSON(data []byte) error

type V1CustomerPlanListParams

type V1CustomerPlanListParams struct {
	CustomerID string `path:"customer_id,required" format:"uuid" json:"-"`
	// Max number of results that should be returned
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1CustomerPlanListParams) URLQuery

func (r V1CustomerPlanListParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1CustomerPlanListParams's query parameters as `url.Values`.

type V1CustomerPlanListPriceAdjustmentsParams

type V1CustomerPlanListPriceAdjustmentsParams struct {
	CustomerID     string `path:"customer_id,required" format:"uuid" json:"-"`
	CustomerPlanID string `path:"customer_plan_id,required" format:"uuid" json:"-"`
	// Max number of results that should be returned
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1CustomerPlanListPriceAdjustmentsParams) URLQuery

URLQuery serializes V1CustomerPlanListPriceAdjustmentsParams's query parameters as `url.Values`.

type V1CustomerPlanListPriceAdjustmentsResponse

type V1CustomerPlanListPriceAdjustmentsResponse struct {
	ChargeID string `json:"charge_id,required" format:"uuid"`
	// Any of "usage", "fixed", "composite", "minimum", "seat".
	ChargeType  V1CustomerPlanListPriceAdjustmentsResponseChargeType `json:"charge_type,required"`
	Prices      []V1CustomerPlanListPriceAdjustmentsResponsePrice    `json:"prices,required"`
	StartPeriod float64                                              `json:"start_period,required"`
	Quantity    float64                                              `json:"quantity"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ChargeID    respjson.Field
		ChargeType  respjson.Field
		Prices      respjson.Field
		StartPeriod respjson.Field
		Quantity    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerPlanListPriceAdjustmentsResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CustomerPlanListPriceAdjustmentsResponse) UnmarshalJSON

func (r *V1CustomerPlanListPriceAdjustmentsResponse) UnmarshalJSON(data []byte) error

type V1CustomerPlanListPriceAdjustmentsResponseChargeType

type V1CustomerPlanListPriceAdjustmentsResponseChargeType string
const (
	V1CustomerPlanListPriceAdjustmentsResponseChargeTypeUsage     V1CustomerPlanListPriceAdjustmentsResponseChargeType = "usage"
	V1CustomerPlanListPriceAdjustmentsResponseChargeTypeFixed     V1CustomerPlanListPriceAdjustmentsResponseChargeType = "fixed"
	V1CustomerPlanListPriceAdjustmentsResponseChargeTypeComposite V1CustomerPlanListPriceAdjustmentsResponseChargeType = "composite"
	V1CustomerPlanListPriceAdjustmentsResponseChargeTypeMinimum   V1CustomerPlanListPriceAdjustmentsResponseChargeType = "minimum"
	V1CustomerPlanListPriceAdjustmentsResponseChargeTypeSeat      V1CustomerPlanListPriceAdjustmentsResponseChargeType = "seat"
)

type V1CustomerPlanListPriceAdjustmentsResponsePrice

type V1CustomerPlanListPriceAdjustmentsResponsePrice struct {
	// Determines how the value will be applied.
	//
	// Any of "fixed", "quantity", "percentage", "override".
	AdjustmentType string `json:"adjustment_type,required"`
	// Used in pricing tiers. Indicates at what metric value the price applies.
	Tier  float64 `json:"tier"`
	Value float64 `json:"value"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AdjustmentType respjson.Field
		Tier           respjson.Field
		Value          respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerPlanListPriceAdjustmentsResponsePrice) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CustomerPlanListPriceAdjustmentsResponsePrice) UnmarshalJSON

type V1CustomerPlanListResponse

type V1CustomerPlanListResponse struct {
	// the ID of the customer plan
	ID string `json:"id,required" format:"uuid"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields    map[string]string `json:"custom_fields,required"`
	PlanDescription string            `json:"plan_description,required"`
	// the ID of the plan
	PlanID              string                              `json:"plan_id,required" format:"uuid"`
	PlanName            string                              `json:"plan_name,required"`
	StartingOn          time.Time                           `json:"starting_on,required" format:"date-time"`
	EndingBefore        time.Time                           `json:"ending_before" format:"date-time"`
	NetPaymentTermsDays float64                             `json:"net_payment_terms_days"`
	TrialInfo           V1CustomerPlanListResponseTrialInfo `json:"trial_info"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                  respjson.Field
		CustomFields        respjson.Field
		PlanDescription     respjson.Field
		PlanID              respjson.Field
		PlanName            respjson.Field
		StartingOn          respjson.Field
		EndingBefore        respjson.Field
		NetPaymentTermsDays respjson.Field
		TrialInfo           respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerPlanListResponse) RawJSON added in v1.0.0

func (r V1CustomerPlanListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1CustomerPlanListResponse) UnmarshalJSON

func (r *V1CustomerPlanListResponse) UnmarshalJSON(data []byte) error

type V1CustomerPlanListResponseTrialInfo

type V1CustomerPlanListResponseTrialInfo struct {
	EndingBefore time.Time                                        `json:"ending_before,required" format:"date-time"`
	SpendingCaps []V1CustomerPlanListResponseTrialInfoSpendingCap `json:"spending_caps,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EndingBefore respjson.Field
		SpendingCaps respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerPlanListResponseTrialInfo) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CustomerPlanListResponseTrialInfo) UnmarshalJSON

func (r *V1CustomerPlanListResponseTrialInfo) UnmarshalJSON(data []byte) error

type V1CustomerPlanListResponseTrialInfoSpendingCap

type V1CustomerPlanListResponseTrialInfoSpendingCap struct {
	Amount          float64               `json:"amount,required"`
	AmountRemaining float64               `json:"amount_remaining,required"`
	CreditType      shared.CreditTypeData `json:"credit_type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Amount          respjson.Field
		AmountRemaining respjson.Field
		CreditType      respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerPlanListResponseTrialInfoSpendingCap) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CustomerPlanListResponseTrialInfoSpendingCap) UnmarshalJSON

type V1CustomerPlanService

type V1CustomerPlanService struct {
	Options []option.RequestOption
}

V1CustomerPlanService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1CustomerPlanService method instead.

func NewV1CustomerPlanService

func NewV1CustomerPlanService(opts ...option.RequestOption) (r V1CustomerPlanService)

NewV1CustomerPlanService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1CustomerPlanService) Add

Associate an existing customer with a plan for a specified date range. See the [price adjustments documentation](https://plans-docs.metronome.com/pricing/managing-plans/#price-adjustments) for details on the price adjustments.

func (*V1CustomerPlanService) End

Change the end date of a customer's plan.

func (*V1CustomerPlanService) List

List the given customer's plans in reverse-chronological order.

func (*V1CustomerPlanService) ListAutoPaging

List the given customer's plans in reverse-chronological order.

func (*V1CustomerPlanService) ListPriceAdjustments

Lists a customer plans adjustments. See the [price adjustments documentation](https://plans-docs.metronome.com/pricing/managing-plans/#price-adjustments) for details.

func (*V1CustomerPlanService) ListPriceAdjustmentsAutoPaging

Lists a customer plans adjustments. See the [price adjustments documentation](https://plans-docs.metronome.com/pricing/managing-plans/#price-adjustments) for details.

type V1CustomerPreviewEventsParams

type V1CustomerPreviewEventsParams struct {
	CustomerID string                               `path:"customer_id,required" format:"uuid" json:"-"`
	Events     []V1CustomerPreviewEventsParamsEvent `json:"events,omitzero,required"`
	// If set, all zero quantity line items will be filtered out of the response.
	SkipZeroQtyLineItems param.Opt[bool] `json:"skip_zero_qty_line_items,omitzero"`
	// If set to "replace", the preview will be generated as if those were the only
	// events for the specified customer. If set to "merge", the events will be merged
	// with any existing events for the specified customer. Defaults to "replace".
	//
	// Any of "replace", "merge".
	Mode V1CustomerPreviewEventsParamsMode `json:"mode,omitzero"`
	// contains filtered or unexported fields
}

func (V1CustomerPreviewEventsParams) MarshalJSON

func (r V1CustomerPreviewEventsParams) MarshalJSON() (data []byte, err error)

func (*V1CustomerPreviewEventsParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomerPreviewEventsParams) UnmarshalJSON(data []byte) error

type V1CustomerPreviewEventsParamsEvent

type V1CustomerPreviewEventsParamsEvent struct {
	EventType string `json:"event_type,required"`
	// This has no effect for preview events, but may be set for consistency with Event
	// objects. They will be processed even if they do not match the customer's ID or
	// ingest aliases.
	CustomerID param.Opt[string] `json:"customer_id,omitzero"`
	// RFC 3339 formatted. If not provided, the current time will be used.
	Timestamp param.Opt[string] `json:"timestamp,omitzero"`
	// This has no effect for preview events, but may be set for consistency with Event
	// objects. Duplicate transaction_ids are NOT filtered out, even within the same
	// request.
	TransactionID param.Opt[string] `json:"transaction_id,omitzero"`
	Properties    map[string]any    `json:"properties,omitzero"`
	// contains filtered or unexported fields
}

The property EventType is required.

func (V1CustomerPreviewEventsParamsEvent) MarshalJSON

func (r V1CustomerPreviewEventsParamsEvent) MarshalJSON() (data []byte, err error)

func (*V1CustomerPreviewEventsParamsEvent) UnmarshalJSON added in v1.0.0

func (r *V1CustomerPreviewEventsParamsEvent) UnmarshalJSON(data []byte) error

type V1CustomerPreviewEventsParamsMode

type V1CustomerPreviewEventsParamsMode string

If set to "replace", the preview will be generated as if those were the only events for the specified customer. If set to "merge", the events will be merged with any existing events for the specified customer. Defaults to "replace".

const (
	V1CustomerPreviewEventsParamsModeReplace V1CustomerPreviewEventsParamsMode = "replace"
	V1CustomerPreviewEventsParamsModeMerge   V1CustomerPreviewEventsParamsMode = "merge"
)

type V1CustomerPreviewEventsResponse

type V1CustomerPreviewEventsResponse struct {
	Data Invoice `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerPreviewEventsResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1CustomerPreviewEventsResponse) UnmarshalJSON

func (r *V1CustomerPreviewEventsResponse) UnmarshalJSON(data []byte) error

type V1CustomerService

V1CustomerService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1CustomerService method instead.

func NewV1CustomerService

func NewV1CustomerService(opts ...option.RequestOption) (r V1CustomerService)

NewV1CustomerService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1CustomerService) Archive

Use this endpoint to archive a customer while preserving auditability. Archiving a customer will automatically archive all contracts as of the current date and void all corresponding invoices. Use this endpoint if a customer is onboarded by mistake.

### Usage guidelines:

  • Once a customer is archived, it cannot be unarchived.
  • Archived customers can still be viewed through the API or the UI for audit purposes.
  • Ingest aliases remain idempotent for archived customers. In order to reuse an ingest alias, first remove the ingest alias from the customer prior to archiving.
  • Any alerts associated with the customer will no longer be triggered.

func (*V1CustomerService) Get

Get detailed information for a specific customer by their Metronome ID. Returns customer profile data including name, creation date, ingest aliases, configuration settings, and custom fields. Use this endpoint to fetch complete customer details for billing operations or account management.

Note: If searching for a customer billing configuration, use the `/getCustomerBillingConfigurations` endpoint.

func (*V1CustomerService) GetBillingConfigurations added in v1.0.0

Returns all billing configurations previously set for the customer. Use during the contract provisioning process to fetch the `billing_provider_configuration_id` needed to set the contract billing configuration.

func (*V1CustomerService) List

Gets a paginated list of all customers in your Metronome account. Use this endpoint to browse your customer base, implement customer search functionality, or sync customer data with external systems. Returns customer details including IDs, names, and configuration settings. Supports filtering and pagination parameters for efficient data retrieval.

func (*V1CustomerService) ListAutoPaging

Gets a paginated list of all customers in your Metronome account. Use this endpoint to browse your customer base, implement customer search functionality, or sync customer data with external systems. Returns customer details including IDs, names, and configuration settings. Supports filtering and pagination parameters for efficient data retrieval.

func (*V1CustomerService) ListBillableMetrics

Get all billable metrics available for a specific customer. Supports pagination and filtering by current plan status or archived metrics. Use this endpoint to see which metrics are being tracked for billing calculations for a given customer.

func (*V1CustomerService) ListBillableMetricsAutoPaging

Get all billable metrics available for a specific customer. Supports pagination and filtering by current plan status or archived metrics. Use this endpoint to see which metrics are being tracked for billing calculations for a given customer.

func (*V1CustomerService) ListCosts

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.

func (*V1CustomerService) ListCostsAutoPaging

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.

func (*V1CustomerService) New

Create a new customer in Metronome and optionally the billing configuration (recommended) which dictates where invoices for the customer will be sent or where payment will be collected.

### Use this endpoint to:

Execute your customer provisioning workflows for either PLG motions, where customers originate in your platform, or SLG motions, where customers originate in your sales system.

### Key response fields:

This end-point returns the `customer_id` created by the request. This id can be used to fetch relevant billing configurations and create contracts.

### Example workflow:

  • Generally, Metronome recommends first creating the customer in the downstream payment / ERP system when payment method is collected and then creating the customer in Metronome using the response (i.e. `customer_id`) from the downstream system. If you do not create a billing configuration on customer creation, you can add it later.
  • Once a customer is created, you can then create a contract for the customer. In the contract creation process, you will need to add the customer billing configuration to the contract to ensure Metronome invoices the customer correctly. This is because a customer can have multiple configurations.
  • As part of the customer creation process, set the ingest alias for the customer which will ensure usage is accurately mapped to the customer. Ingest aliases can be added or changed after the creation process as well.

### Usage guidelines:

For details on different billing configurations for different systems, review the `/setCustomerBillingConfiguration` end-point.

func (*V1CustomerService) PreviewEvents

Preview how a set of events will affect a customer's invoice. Generates a draft invoice for a customer using their current contract configuration and the provided events. This is useful for testing how new events will affect the customer's invoice before they are actually processed.

func (*V1CustomerService) SetBillingConfigurations added in v1.0.0

func (r *V1CustomerService) SetBillingConfigurations(ctx context.Context, body V1CustomerSetBillingConfigurationsParams, opts ...option.RequestOption) (err error)

Create a billing configuration for a customer. Once created, these configurations are available to associate to a contract and dictates which downstream system to collect payment in or send the invoice to. You can create multiple configurations per customer. The configuration formats are distinct for each downstream provider.

### Use this endpoint to:

  • Add the initial configuration to an existing customer. Once created, the billing configuration can then be associated to the customer's contract.
  • Add a new configuration to an existing customer. This might be used as part of an upgrade or downgrade workflow where the customer was previously billed through system A (e.g. Stripe) but will now be billed through system B (e.g. AWS). Once created, the new configuration can then be associated to the customer's contract.

### Delivery method options:

  • `direct_to_billing_provider`: Use when Metronome should send invoices directly to the billing provider's API (e.g., Stripe, NetSuite). This is the most common method for automated billing workflows.
  • `tackle`: Use specifically for AWS Marketplace transactions that require Tackle's co-selling platform for partner attribution and commission tracking.
  • `aws_sqs`: Use when you want invoice data delivered to an AWS SQS queue for custom processing before sending to your billing system.
  • `aws_sns`: Use when you want invoice notifications published to an AWS SNS topic for event-driven billing workflows.

### Key response fields:

The id for the customer billing configuration. This id can be used to associate the billing configuration to a contract.

### Usage guidelines:

Must use the `delivery_method_id` if you have multiple Stripe accounts connected to Metronome.

func (*V1CustomerService) SetIngestAliases

func (r *V1CustomerService) SetIngestAliases(ctx context.Context, params V1CustomerSetIngestAliasesParams, opts ...option.RequestOption) (err error)

Sets the ingest aliases for a customer. Use this endpoint to associate a Metronome customer with an internal ID for easier tracking between systems. Ingest aliases can be used in the `customer_id` field when sending usage events to Metronome.

### Usage guidelines:

  • This call is idempotent and fully replaces the set of ingest aliases for the given customer.
  • Switching an ingest alias from one customer to another will associate all corresponding usage to the new customer.
  • Use multiple ingest aliases to model child organizations within a single Metronome customer.

func (*V1CustomerService) SetName

Updates the display name for a customer record. Use this to correct customer names, update business names after rebranding, or maintain accurate customer information for invoicing and reporting. Returns the updated customer object with the new name applied immediately across all billing documents and interfaces.

func (*V1CustomerService) UpdateConfig

func (r *V1CustomerService) UpdateConfig(ctx context.Context, params V1CustomerUpdateConfigParams, opts ...option.RequestOption) (err error)

Update configuration settings for a specific customer, such as external system integrations (e.g., Salesforce account ID) and other customer-specific billing parameters. Use this endpoint to modify customer configurations without affecting core customer data like name or ingest aliases.

type V1CustomerSetBillingConfigurationsParams added in v1.0.0

type V1CustomerSetBillingConfigurationsParams struct {
	Data []V1CustomerSetBillingConfigurationsParamsData `json:"data,omitzero,required"`
	// contains filtered or unexported fields
}

func (V1CustomerSetBillingConfigurationsParams) MarshalJSON added in v1.0.0

func (r V1CustomerSetBillingConfigurationsParams) MarshalJSON() (data []byte, err error)

func (*V1CustomerSetBillingConfigurationsParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomerSetBillingConfigurationsParams) UnmarshalJSON(data []byte) error

type V1CustomerSetBillingConfigurationsParamsData added in v1.0.0

type V1CustomerSetBillingConfigurationsParamsData struct {
	// The billing provider set for this configuration.
	//
	// Any of "aws_marketplace", "stripe", "netsuite", "custom", "azure_marketplace",
	// "quickbooks_online", "workday", "gcp_marketplace".
	BillingProvider string `json:"billing_provider,omitzero,required"`
	CustomerID      string `json:"customer_id,required" format:"uuid"`
	// ID of the delivery method to use for this customer. If not provided, the
	// `delivery_method` must be provided.
	DeliveryMethodID param.Opt[string] `json:"delivery_method_id,omitzero" format:"uuid"`
	// Configuration for the billing provider. The structure of this object is specific
	// to the billing provider and delivery method combination. Defaults to an empty
	// object, however, for most billing provider + delivery method combinations, it
	// will not be a valid configuration. For AWS marketplace configurations, the
	// aws_is_subscription_product flag can be used to indicate a product with
	// usage-based pricing. More information can be found
	// [here](https://docs.metronome.com/invoice-customers/solutions/marketplaces/invoice-aws/#provision-aws-marketplace-customers-in-metronome).
	Configuration map[string]any `json:"configuration,omitzero"`
	// The method to use for delivering invoices to this customer. If not provided, the
	// `delivery_method_id` must be provided.
	//
	// Any of "direct_to_billing_provider", "aws_sqs", "tackle", "aws_sns".
	DeliveryMethod string `json:"delivery_method,omitzero"`
	// Specifies which tax provider Metronome should use for tax calculation when
	// billing through Stripe. This is only supported for Stripe billing provider
	// configurations with auto_charge_payment_intent or manual_charge_payment_intent
	// collection methods.
	//
	// Any of "anrok", "avalara", "stripe".
	TaxProvider string `json:"tax_provider,omitzero"`
	// contains filtered or unexported fields
}

The properties BillingProvider, CustomerID are required.

func (V1CustomerSetBillingConfigurationsParamsData) MarshalJSON added in v1.0.0

func (r V1CustomerSetBillingConfigurationsParamsData) MarshalJSON() (data []byte, err error)

func (*V1CustomerSetBillingConfigurationsParamsData) UnmarshalJSON added in v1.0.0

func (r *V1CustomerSetBillingConfigurationsParamsData) UnmarshalJSON(data []byte) error

type V1CustomerSetIngestAliasesParams

type V1CustomerSetIngestAliasesParams struct {
	CustomerID    string   `path:"customer_id,required" format:"uuid" json:"-"`
	IngestAliases []string `json:"ingest_aliases,omitzero,required"`
	// contains filtered or unexported fields
}

func (V1CustomerSetIngestAliasesParams) MarshalJSON

func (r V1CustomerSetIngestAliasesParams) MarshalJSON() (data []byte, err error)

func (*V1CustomerSetIngestAliasesParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomerSetIngestAliasesParams) UnmarshalJSON(data []byte) error

type V1CustomerSetNameParams

type V1CustomerSetNameParams struct {
	CustomerID string `path:"customer_id,required" format:"uuid" json:"-"`
	// The new name for the customer. This will be truncated to 160 characters if the
	// provided name is longer.
	Name string `json:"name,required"`
	// contains filtered or unexported fields
}

func (V1CustomerSetNameParams) MarshalJSON

func (r V1CustomerSetNameParams) MarshalJSON() (data []byte, err error)

func (*V1CustomerSetNameParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomerSetNameParams) UnmarshalJSON(data []byte) error

type V1CustomerSetNameResponse

type V1CustomerSetNameResponse struct {
	Data Customer `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1CustomerSetNameResponse) RawJSON added in v1.0.0

func (r V1CustomerSetNameResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1CustomerSetNameResponse) UnmarshalJSON

func (r *V1CustomerSetNameResponse) UnmarshalJSON(data []byte) error

type V1CustomerUpdateConfigParams

type V1CustomerUpdateConfigParams struct {
	CustomerID string `path:"customer_id,required" format:"uuid" json:"-"`
	// Leave in draft or set to auto-advance on invoices sent to Stripe. Falls back to
	// the client-level config if unset, which defaults to true if unset.
	LeaveStripeInvoicesInDraft param.Opt[bool] `json:"leave_stripe_invoices_in_draft,omitzero"`
	// The Salesforce account ID for the customer
	SalesforceAccountID param.Opt[string] `json:"salesforce_account_id,omitzero"`
	// contains filtered or unexported fields
}

func (V1CustomerUpdateConfigParams) MarshalJSON

func (r V1CustomerUpdateConfigParams) MarshalJSON() (data []byte, err error)

func (*V1CustomerUpdateConfigParams) UnmarshalJSON added in v1.0.0

func (r *V1CustomerUpdateConfigParams) UnmarshalJSON(data []byte) error

type V1DashboardGetEmbeddableURLParams

type V1DashboardGetEmbeddableURLParams struct {
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// The type of dashboard to retrieve.
	//
	// Any of "invoices", "usage", "credits", "commits_and_credits".
	Dashboard V1DashboardGetEmbeddableURLParamsDashboard `json:"dashboard,omitzero,required"`
	// Optional list of billable metric group key overrides
	BmGroupKeyOverrides []V1DashboardGetEmbeddableURLParamsBmGroupKeyOverride `json:"bm_group_key_overrides,omitzero"`
	// Optional list of colors to override
	ColorOverrides []V1DashboardGetEmbeddableURLParamsColorOverride `json:"color_overrides,omitzero"`
	// Optional dashboard specific options
	DashboardOptions []V1DashboardGetEmbeddableURLParamsDashboardOption `json:"dashboard_options,omitzero"`
	// contains filtered or unexported fields
}

func (V1DashboardGetEmbeddableURLParams) MarshalJSON

func (r V1DashboardGetEmbeddableURLParams) MarshalJSON() (data []byte, err error)

func (*V1DashboardGetEmbeddableURLParams) UnmarshalJSON added in v1.0.0

func (r *V1DashboardGetEmbeddableURLParams) UnmarshalJSON(data []byte) error

type V1DashboardGetEmbeddableURLParamsBmGroupKeyOverride

type V1DashboardGetEmbeddableURLParamsBmGroupKeyOverride struct {
	// The name of the billable metric group key.
	GroupKeyName string `json:"group_key_name,required"`
	// The display name for the billable metric group key
	DisplayName param.Opt[string] `json:"display_name,omitzero"`
	// <key, value> pairs of the billable metric group key values and their display
	// names. e.g. {"a": "Asia", "b": "Euro"}
	ValueDisplayNames map[string]any `json:"value_display_names,omitzero"`
	// contains filtered or unexported fields
}

The property GroupKeyName is required.

func (V1DashboardGetEmbeddableURLParamsBmGroupKeyOverride) MarshalJSON

func (r V1DashboardGetEmbeddableURLParamsBmGroupKeyOverride) MarshalJSON() (data []byte, err error)

func (*V1DashboardGetEmbeddableURLParamsBmGroupKeyOverride) UnmarshalJSON added in v1.0.0

type V1DashboardGetEmbeddableURLParamsColorOverride

type V1DashboardGetEmbeddableURLParamsColorOverride struct {
	// Hex value representation of the color
	Value param.Opt[string] `json:"value,omitzero"`
	// The color to override
	//
	// Any of "Gray_dark", "Gray_medium", "Gray_light", "Gray_extralight", "White",
	// "Primary_medium", "Primary_light", "UsageLine_0", "UsageLine_1", "UsageLine_2",
	// "UsageLine_3", "UsageLine_4", "UsageLine_5", "UsageLine_6", "UsageLine_7",
	// "UsageLine_8", "UsageLine_9", "Primary_green", "Primary_red", "Progress_bar",
	// "Progress_bar_background".
	Name string `json:"name,omitzero"`
	// contains filtered or unexported fields
}

func (V1DashboardGetEmbeddableURLParamsColorOverride) MarshalJSON

func (r V1DashboardGetEmbeddableURLParamsColorOverride) MarshalJSON() (data []byte, err error)

func (*V1DashboardGetEmbeddableURLParamsColorOverride) UnmarshalJSON added in v1.0.0

type V1DashboardGetEmbeddableURLParamsDashboard

type V1DashboardGetEmbeddableURLParamsDashboard string

The type of dashboard to retrieve.

const (
	V1DashboardGetEmbeddableURLParamsDashboardInvoices          V1DashboardGetEmbeddableURLParamsDashboard = "invoices"
	V1DashboardGetEmbeddableURLParamsDashboardUsage             V1DashboardGetEmbeddableURLParamsDashboard = "usage"
	V1DashboardGetEmbeddableURLParamsDashboardCredits           V1DashboardGetEmbeddableURLParamsDashboard = "credits"
	V1DashboardGetEmbeddableURLParamsDashboardCommitsAndCredits V1DashboardGetEmbeddableURLParamsDashboard = "commits_and_credits"
)

type V1DashboardGetEmbeddableURLParamsDashboardOption

type V1DashboardGetEmbeddableURLParamsDashboardOption struct {
	// The option key name
	Key string `json:"key,required"`
	// The option value
	Value string `json:"value,required"`
	// contains filtered or unexported fields
}

The properties Key, Value are required.

func (V1DashboardGetEmbeddableURLParamsDashboardOption) MarshalJSON

func (r V1DashboardGetEmbeddableURLParamsDashboardOption) MarshalJSON() (data []byte, err error)

func (*V1DashboardGetEmbeddableURLParamsDashboardOption) UnmarshalJSON added in v1.0.0

type V1DashboardGetEmbeddableURLResponse

type V1DashboardGetEmbeddableURLResponse struct {
	Data V1DashboardGetEmbeddableURLResponseData `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1DashboardGetEmbeddableURLResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1DashboardGetEmbeddableURLResponse) UnmarshalJSON

func (r *V1DashboardGetEmbeddableURLResponse) UnmarshalJSON(data []byte) error

type V1DashboardGetEmbeddableURLResponseData

type V1DashboardGetEmbeddableURLResponseData struct {
	URL string `json:"url"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		URL         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1DashboardGetEmbeddableURLResponseData) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1DashboardGetEmbeddableURLResponseData) UnmarshalJSON

func (r *V1DashboardGetEmbeddableURLResponseData) UnmarshalJSON(data []byte) error

type V1DashboardService

type V1DashboardService struct {
	Options []option.RequestOption
}

V1DashboardService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1DashboardService method instead.

func NewV1DashboardService

func NewV1DashboardService(opts ...option.RequestOption) (r V1DashboardService)

NewV1DashboardService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1DashboardService) GetEmbeddableURL

Generate secure, embeddable dashboard URLs that allow you to seamlessly integrate Metronome's billing visualizations directly into your application. This endpoint creates authenticated iframe-ready URLs for customer-specific dashboards, providing a white-labeled billing experience without building custom UI.

### Use this endpoint to:

- Embed billing dashboards directly in your customer portal or admin interface - Provide self-service access to invoices, usage data, and credit balances - Build white-labeled billing experiences with minimal development effort

### Key response fields:

- A secure, time-limited URL that can be embedded in an iframe - The URL includes authentication tokens and configuration parameters - URLs are customer-specific and respect your security settings

### Usage guidelines:

- Dashboard types: Choose from `invoices`, `usage`, or `commits_and_credits` - Customization options:

  • `dashboard_options`: Configure whether you want invoices to show zero usage line items
  • `color_overrides`: Match your brand's color palette
  • `bm_group_key_overrides`: Customize how dimensions are displayed (for the usage embeddable dashboard)

- Iframe implementation: Embed the returned URL directly in an iframe element - Responsive design: Dashboards automatically adapt to container dimensions

type V1InvoiceRegenerateParams

type V1InvoiceRegenerateParams struct {
	// The invoice id to regenerate
	ID string `json:"id,required" format:"uuid"`
	// contains filtered or unexported fields
}

func (V1InvoiceRegenerateParams) MarshalJSON

func (r V1InvoiceRegenerateParams) MarshalJSON() (data []byte, err error)

func (*V1InvoiceRegenerateParams) UnmarshalJSON added in v1.0.0

func (r *V1InvoiceRegenerateParams) UnmarshalJSON(data []byte) error

type V1InvoiceRegenerateResponse

type V1InvoiceRegenerateResponse struct {
	Data V1InvoiceRegenerateResponseData `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1InvoiceRegenerateResponse) RawJSON added in v1.0.0

func (r V1InvoiceRegenerateResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1InvoiceRegenerateResponse) UnmarshalJSON

func (r *V1InvoiceRegenerateResponse) UnmarshalJSON(data []byte) error

type V1InvoiceRegenerateResponseData

type V1InvoiceRegenerateResponseData struct {
	// The new invoice id
	ID string `json:"id,required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1InvoiceRegenerateResponseData) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1InvoiceRegenerateResponseData) UnmarshalJSON

func (r *V1InvoiceRegenerateResponseData) UnmarshalJSON(data []byte) error

type V1InvoiceService

type V1InvoiceService struct {
	Options []option.RequestOption
}

V1InvoiceService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1InvoiceService method instead.

func NewV1InvoiceService

func NewV1InvoiceService(opts ...option.RequestOption) (r V1InvoiceService)

NewV1InvoiceService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1InvoiceService) Regenerate

This endpoint regenerates a voided invoice and recalculates the invoice based on up-to-date rates, available balances, and other fees regardless of the billing period.

### Use this endpoint to:

Recalculate an invoice with updated rate terms, available balance, and fees to correct billing disputes or discrepancies

### Key response fields:

The regenerated invoice id, which is distinct from the previously voided invoice.

### Usage guidelines:

If an invoice is attached to a contract with a billing provider on it, the regenerated invoice will be distributed based on the configuration.

func (*V1InvoiceService) Void

Permanently cancels an invoice by setting its status to voided, preventing collection and removing it from customer billing. Use this to correct billing errors, cancel incorrect charges, or handle disputed invoices that should not be collected. Returns the voided invoice ID with the status change applied immediately to stop any payment processing.

type V1InvoiceVoidParams

type V1InvoiceVoidParams struct {
	// The invoice id to void
	ID string `json:"id,required" format:"uuid"`
	// contains filtered or unexported fields
}

func (V1InvoiceVoidParams) MarshalJSON

func (r V1InvoiceVoidParams) MarshalJSON() (data []byte, err error)

func (*V1InvoiceVoidParams) UnmarshalJSON added in v1.0.0

func (r *V1InvoiceVoidParams) UnmarshalJSON(data []byte) error

type V1InvoiceVoidResponse

type V1InvoiceVoidResponse struct {
	Data V1InvoiceVoidResponseData `json:"data"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1InvoiceVoidResponse) RawJSON added in v1.0.0

func (r V1InvoiceVoidResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1InvoiceVoidResponse) UnmarshalJSON

func (r *V1InvoiceVoidResponse) UnmarshalJSON(data []byte) error

type V1InvoiceVoidResponseData

type V1InvoiceVoidResponseData struct {
	ID string `json:"id,required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1InvoiceVoidResponseData) RawJSON added in v1.0.0

func (r V1InvoiceVoidResponseData) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1InvoiceVoidResponseData) UnmarshalJSON

func (r *V1InvoiceVoidResponseData) UnmarshalJSON(data []byte) error

type V1PlanGetDetailsParams

type V1PlanGetDetailsParams struct {
	PlanID string `path:"plan_id,required" format:"uuid" json:"-"`
	// contains filtered or unexported fields
}

type V1PlanGetDetailsResponse

type V1PlanGetDetailsResponse struct {
	Data PlanDetail `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1PlanGetDetailsResponse) RawJSON added in v1.0.0

func (r V1PlanGetDetailsResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1PlanGetDetailsResponse) UnmarshalJSON

func (r *V1PlanGetDetailsResponse) UnmarshalJSON(data []byte) error

type V1PlanListChargesParams

type V1PlanListChargesParams struct {
	PlanID string `path:"plan_id,required" format:"uuid" json:"-"`
	// Max number of results that should be returned
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1PlanListChargesParams) URLQuery

func (r V1PlanListChargesParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1PlanListChargesParams's query parameters as `url.Values`.

type V1PlanListChargesResponse

type V1PlanListChargesResponse struct {
	ID string `json:"id,required" format:"uuid"`
	// Any of "usage", "fixed", "composite", "minimum", "seat".
	ChargeType V1PlanListChargesResponseChargeType `json:"charge_type,required"`
	CreditType shared.CreditTypeData               `json:"credit_type,required"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string                `json:"custom_fields,required"`
	Name         string                           `json:"name,required"`
	Prices       []V1PlanListChargesResponsePrice `json:"prices,required"`
	ProductID    string                           `json:"product_id,required"`
	ProductName  string                           `json:"product_name,required"`
	Quantity     float64                          `json:"quantity"`
	// Used in price ramps. Indicates how many billing periods pass before the charge
	// applies.
	StartPeriod float64 `json:"start_period"`
	// Used in pricing tiers. Indicates how often the tier resets. Default is 1 - the
	// tier count resets every billing period.
	TierResetFrequency float64 `json:"tier_reset_frequency"`
	// Specifies how quantities for usage based charges will be converted.
	UnitConversion V1PlanListChargesResponseUnitConversion `json:"unit_conversion"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                 respjson.Field
		ChargeType         respjson.Field
		CreditType         respjson.Field
		CustomFields       respjson.Field
		Name               respjson.Field
		Prices             respjson.Field
		ProductID          respjson.Field
		ProductName        respjson.Field
		Quantity           respjson.Field
		StartPeriod        respjson.Field
		TierResetFrequency respjson.Field
		UnitConversion     respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1PlanListChargesResponse) RawJSON added in v1.0.0

func (r V1PlanListChargesResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1PlanListChargesResponse) UnmarshalJSON

func (r *V1PlanListChargesResponse) UnmarshalJSON(data []byte) error

type V1PlanListChargesResponseChargeType

type V1PlanListChargesResponseChargeType string
const (
	V1PlanListChargesResponseChargeTypeUsage     V1PlanListChargesResponseChargeType = "usage"
	V1PlanListChargesResponseChargeTypeFixed     V1PlanListChargesResponseChargeType = "fixed"
	V1PlanListChargesResponseChargeTypeComposite V1PlanListChargesResponseChargeType = "composite"
	V1PlanListChargesResponseChargeTypeMinimum   V1PlanListChargesResponseChargeType = "minimum"
	V1PlanListChargesResponseChargeTypeSeat      V1PlanListChargesResponseChargeType = "seat"
)

type V1PlanListChargesResponsePrice

type V1PlanListChargesResponsePrice struct {
	// Used in pricing tiers. Indicates at what metric value the price applies.
	Tier               float64 `json:"tier,required"`
	Value              float64 `json:"value,required"`
	CollectionInterval float64 `json:"collection_interval"`
	CollectionSchedule string  `json:"collection_schedule"`
	Quantity           float64 `json:"quantity"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Tier               respjson.Field
		Value              respjson.Field
		CollectionInterval respjson.Field
		CollectionSchedule respjson.Field
		Quantity           respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1PlanListChargesResponsePrice) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1PlanListChargesResponsePrice) UnmarshalJSON

func (r *V1PlanListChargesResponsePrice) UnmarshalJSON(data []byte) error

type V1PlanListChargesResponseUnitConversion

type V1PlanListChargesResponseUnitConversion struct {
	// The conversion factor
	DivisionFactor float64 `json:"division_factor,required"`
	// Whether usage should be rounded down or up to the nearest whole number. If null,
	// quantity will be rounded to 20 decimal places.
	//
	// Any of "floor", "ceiling".
	RoundingBehavior string `json:"rounding_behavior"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DivisionFactor   respjson.Field
		RoundingBehavior respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Specifies how quantities for usage based charges will be converted.

func (V1PlanListChargesResponseUnitConversion) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1PlanListChargesResponseUnitConversion) UnmarshalJSON

func (r *V1PlanListChargesResponseUnitConversion) UnmarshalJSON(data []byte) error

type V1PlanListCustomersParams

type V1PlanListCustomersParams struct {
	PlanID string `path:"plan_id,required" format:"uuid" json:"-"`
	// Max number of results that should be returned
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	// Status of customers on a given plan. Defaults to `active`.
	//
	// - `all` - Return current, past, and upcoming customers of the plan.
	// - `active` - Return current customers of the plan.
	// - `ended` - Return past customers of the plan.
	// - `upcoming` - Return upcoming customers of the plan.
	//
	// Multiple statuses can be OR'd together using commas, e.g. `active,ended`.
	// **Note:** `ended,upcoming` combination is not yet supported.
	//
	// Any of "all", "active", "ended", "upcoming".
	Status V1PlanListCustomersParamsStatus `query:"status,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1PlanListCustomersParams) URLQuery

func (r V1PlanListCustomersParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1PlanListCustomersParams's query parameters as `url.Values`.

type V1PlanListCustomersParamsStatus

type V1PlanListCustomersParamsStatus string

Status of customers on a given plan. Defaults to `active`.

- `all` - Return current, past, and upcoming customers of the plan. - `active` - Return current customers of the plan. - `ended` - Return past customers of the plan. - `upcoming` - Return upcoming customers of the plan.

Multiple statuses can be OR'd together using commas, e.g. `active,ended`. **Note:** `ended,upcoming` combination is not yet supported.

const (
	V1PlanListCustomersParamsStatusAll      V1PlanListCustomersParamsStatus = "all"
	V1PlanListCustomersParamsStatusActive   V1PlanListCustomersParamsStatus = "active"
	V1PlanListCustomersParamsStatusEnded    V1PlanListCustomersParamsStatus = "ended"
	V1PlanListCustomersParamsStatusUpcoming V1PlanListCustomersParamsStatus = "upcoming"
)

type V1PlanListCustomersResponse

type V1PlanListCustomersResponse struct {
	CustomerDetails CustomerDetail                         `json:"customer_details,required"`
	PlanDetails     V1PlanListCustomersResponsePlanDetails `json:"plan_details,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CustomerDetails respjson.Field
		PlanDetails     respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1PlanListCustomersResponse) RawJSON added in v1.0.0

func (r V1PlanListCustomersResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1PlanListCustomersResponse) UnmarshalJSON

func (r *V1PlanListCustomersResponse) UnmarshalJSON(data []byte) error

type V1PlanListCustomersResponsePlanDetails

type V1PlanListCustomersResponsePlanDetails struct {
	ID string `json:"id,required" format:"uuid"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields   map[string]string `json:"custom_fields,required"`
	CustomerPlanID string            `json:"customer_plan_id,required" format:"uuid"`
	Name           string            `json:"name,required"`
	// The start date of the plan
	StartingOn time.Time `json:"starting_on,required" format:"date-time"`
	// The end date of the plan
	EndingBefore time.Time `json:"ending_before,nullable" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID             respjson.Field
		CustomFields   respjson.Field
		CustomerPlanID respjson.Field
		Name           respjson.Field
		StartingOn     respjson.Field
		EndingBefore   respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1PlanListCustomersResponsePlanDetails) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1PlanListCustomersResponsePlanDetails) UnmarshalJSON

func (r *V1PlanListCustomersResponsePlanDetails) UnmarshalJSON(data []byte) error

type V1PlanListParams

type V1PlanListParams struct {
	// Max number of results that should be returned
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1PlanListParams) URLQuery

func (r V1PlanListParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1PlanListParams's query parameters as `url.Values`.

type V1PlanListResponse

type V1PlanListResponse struct {
	ID          string `json:"id,required" format:"uuid"`
	Description string `json:"description,required"`
	Name        string `json:"name,required"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID           respjson.Field
		Description  respjson.Field
		Name         respjson.Field
		CustomFields respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1PlanListResponse) RawJSON added in v1.0.0

func (r V1PlanListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1PlanListResponse) UnmarshalJSON

func (r *V1PlanListResponse) UnmarshalJSON(data []byte) error

type V1PlanService

type V1PlanService struct {
	Options []option.RequestOption
}

V1PlanService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1PlanService method instead.

func NewV1PlanService

func NewV1PlanService(opts ...option.RequestOption) (r V1PlanService)

NewV1PlanService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1PlanService) GetDetails

Fetch high level details of a specific plan.

func (*V1PlanService) List

List all available plans.

func (*V1PlanService) ListAutoPaging

List all available plans.

func (*V1PlanService) ListCharges

Fetches a list of charges of a specific plan.

func (*V1PlanService) ListChargesAutoPaging

Fetches a list of charges of a specific plan.

func (*V1PlanService) ListCustomers

Fetches a list of customers on a specific plan (by default, only currently active plans are included)

func (*V1PlanService) ListCustomersAutoPaging

Fetches a list of customers on a specific plan (by default, only currently active plans are included)

type V1PricingUnitListParams

type V1PricingUnitListParams struct {
	// Max number of results that should be returned
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1PricingUnitListParams) URLQuery

func (r V1PricingUnitListParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1PricingUnitListParams's query parameters as `url.Values`.

type V1PricingUnitListResponse

type V1PricingUnitListResponse struct {
	ID         string `json:"id" format:"uuid"`
	IsCurrency bool   `json:"is_currency"`
	Name       string `json:"name"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		IsCurrency  respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1PricingUnitListResponse) RawJSON added in v1.0.0

func (r V1PricingUnitListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1PricingUnitListResponse) UnmarshalJSON

func (r *V1PricingUnitListResponse) UnmarshalJSON(data []byte) error

type V1PricingUnitService

type V1PricingUnitService struct {
	Options []option.RequestOption
}

V1PricingUnitService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1PricingUnitService method instead.

func NewV1PricingUnitService

func NewV1PricingUnitService(opts ...option.RequestOption) (r V1PricingUnitService)

NewV1PricingUnitService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1PricingUnitService) List

List all pricing units. All fiat currency types (for example, USD or GBP) will be included, as well as any custom pricing units that were configured. Custom pricing units can be used to charge for usage in a non-fiat pricing unit, for example AI credits.

Note: The USD (cents) pricing unit is 2714e483-4ff1-48e4-9e25-ac732e8f24f2.

func (*V1PricingUnitService) ListAutoPaging

List all pricing units. All fiat currency types (for example, USD or GBP) will be included, as well as any custom pricing units that were configured. Custom pricing units can be used to charge for usage in a non-fiat pricing unit, for example AI credits.

Note: The USD (cents) pricing unit is 2714e483-4ff1-48e4-9e25-ac732e8f24f2.

type V1Service

type V1Service struct {
	Options         []option.RequestOption
	Alerts          V1AlertService
	Plans           V1PlanService
	CreditGrants    V1CreditGrantService
	PricingUnits    V1PricingUnitService
	Customers       V1CustomerService
	Dashboards      V1DashboardService
	Usage           V1UsageService
	AuditLogs       V1AuditLogService
	CustomFields    V1CustomFieldService
	BillableMetrics V1BillableMetricService
	Services        V1ServiceService
	Invoices        V1InvoiceService
	Contracts       V1ContractService
}

V1Service contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1Service method instead.

func NewV1Service

func NewV1Service(opts ...option.RequestOption) (r V1Service)

NewV1Service generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type V1ServiceListResponse

type V1ServiceListResponse struct {
	Services []V1ServiceListResponseService `json:"services,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Services    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ServiceListResponse) RawJSON added in v1.0.0

func (r V1ServiceListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1ServiceListResponse) UnmarshalJSON

func (r *V1ServiceListResponse) UnmarshalJSON(data []byte) error

type V1ServiceListResponseService

type V1ServiceListResponseService struct {
	IPs  []string `json:"ips,required"`
	Name string   `json:"name,required"`
	// Any of "makes_connections_from", "accepts_connections_at".
	Usage string `json:"usage,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		IPs         respjson.Field
		Name        respjson.Field
		Usage       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1ServiceListResponseService) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1ServiceListResponseService) UnmarshalJSON

func (r *V1ServiceListResponseService) UnmarshalJSON(data []byte) error

type V1ServiceService

type V1ServiceService struct {
	Options []option.RequestOption
}

V1ServiceService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1ServiceService method instead.

func NewV1ServiceService

func NewV1ServiceService(opts ...option.RequestOption) (r V1ServiceService)

NewV1ServiceService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1ServiceService) List

Gets Metronome's service registry with associated IP addresses for security allowlisting and firewall configuration. Use this endpoint to maintain an up-to-date list of IPs that your systems should trust for Metronome communications. Returns service names and their current IP ranges, with new IPs typically appearing 30+ days before first use to ensure smooth allowlist updates.

type V1UsageIngestParams

type V1UsageIngestParams struct {
	Usage []V1UsageIngestParamsUsage
	// contains filtered or unexported fields
}

func (V1UsageIngestParams) MarshalJSON

func (r V1UsageIngestParams) MarshalJSON() (data []byte, err error)

func (*V1UsageIngestParams) UnmarshalJSON added in v1.0.0

func (r *V1UsageIngestParams) UnmarshalJSON(data []byte) error

type V1UsageIngestParamsUsage

type V1UsageIngestParamsUsage struct {
	CustomerID string `json:"customer_id,required"`
	EventType  string `json:"event_type,required"`
	// RFC 3339 formatted
	Timestamp     string         `json:"timestamp,required"`
	TransactionID string         `json:"transaction_id,required"`
	Properties    map[string]any `json:"properties,omitzero"`
	// contains filtered or unexported fields
}

The properties CustomerID, EventType, Timestamp, TransactionID are required.

func (V1UsageIngestParamsUsage) MarshalJSON

func (r V1UsageIngestParamsUsage) MarshalJSON() (data []byte, err error)

func (*V1UsageIngestParamsUsage) UnmarshalJSON added in v1.0.0

func (r *V1UsageIngestParamsUsage) UnmarshalJSON(data []byte) error

type V1UsageListParams

type V1UsageListParams struct {
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	StartingOn   time.Time `json:"starting_on,required" format:"date-time"`
	// 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.
	//
	// Any of "HOUR", "DAY", "NONE".
	WindowSize V1UsageListParamsWindowSize `json:"window_size,omitzero,required"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	// A list of billable metrics to fetch usage for. If absent, all billable metrics
	// will be returned.
	BillableMetrics []V1UsageListParamsBillableMetric `json:"billable_metrics,omitzero"`
	// A list of Metronome customer IDs to fetch usage for. If absent, usage for all
	// customers will be returned.
	CustomerIDs []string `json:"customer_ids,omitzero" format:"uuid"`
	// contains filtered or unexported fields
}

func (V1UsageListParams) MarshalJSON

func (r V1UsageListParams) MarshalJSON() (data []byte, err error)

func (V1UsageListParams) URLQuery

func (r V1UsageListParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1UsageListParams's query parameters as `url.Values`.

func (*V1UsageListParams) UnmarshalJSON added in v1.0.0

func (r *V1UsageListParams) UnmarshalJSON(data []byte) error

type V1UsageListParamsBillableMetric

type V1UsageListParamsBillableMetric struct {
	ID      string                                 `json:"id,required" format:"uuid"`
	GroupBy V1UsageListParamsBillableMetricGroupBy `json:"group_by,omitzero"`
	// contains filtered or unexported fields
}

The property ID is required.

func (V1UsageListParamsBillableMetric) MarshalJSON

func (r V1UsageListParamsBillableMetric) MarshalJSON() (data []byte, err error)

func (*V1UsageListParamsBillableMetric) UnmarshalJSON added in v1.0.0

func (r *V1UsageListParamsBillableMetric) UnmarshalJSON(data []byte) error

type V1UsageListParamsBillableMetricGroupBy added in v1.0.0

type V1UsageListParamsBillableMetricGroupBy struct {
	// The name of the group_by key to use
	Key string `json:"key,required"`
	// Values of the group_by key to return in the query. If this field is omitted, all
	// available values will be returned, up to a maximum of 200.
	Values []string `json:"values,omitzero"`
	// contains filtered or unexported fields
}

The property Key is required.

func (V1UsageListParamsBillableMetricGroupBy) MarshalJSON added in v1.0.0

func (r V1UsageListParamsBillableMetricGroupBy) MarshalJSON() (data []byte, err error)

func (*V1UsageListParamsBillableMetricGroupBy) UnmarshalJSON added in v1.0.0

func (r *V1UsageListParamsBillableMetricGroupBy) UnmarshalJSON(data []byte) error

type V1UsageListParamsWindowSize

type V1UsageListParamsWindowSize string

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.

const (
	V1UsageListParamsWindowSizeHour V1UsageListParamsWindowSize = "HOUR"
	V1UsageListParamsWindowSizeDay  V1UsageListParamsWindowSize = "DAY"
	V1UsageListParamsWindowSizeNone V1UsageListParamsWindowSize = "NONE"
)

type V1UsageListResponse

type V1UsageListResponse struct {
	BillableMetricID   string    `json:"billable_metric_id,required" format:"uuid"`
	BillableMetricName string    `json:"billable_metric_name,required"`
	CustomerID         string    `json:"customer_id,required" format:"uuid"`
	EndTimestamp       time.Time `json:"end_timestamp,required" format:"date-time"`
	StartTimestamp     time.Time `json:"start_timestamp,required" format:"date-time"`
	Value              float64   `json:"value,required"`
	// Values will be either a number or null. Null indicates that there were no
	// matches for the group_by value.
	Groups map[string]float64 `json:"groups"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BillableMetricID   respjson.Field
		BillableMetricName respjson.Field
		CustomerID         respjson.Field
		EndTimestamp       respjson.Field
		StartTimestamp     respjson.Field
		Value              respjson.Field
		Groups             respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1UsageListResponse) RawJSON added in v1.0.0

func (r V1UsageListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1UsageListResponse) UnmarshalJSON

func (r *V1UsageListResponse) UnmarshalJSON(data []byte) error

type V1UsageListWithGroupsParams

type V1UsageListWithGroupsParams struct {
	BillableMetricID string `json:"billable_metric_id,required" format:"uuid"`
	CustomerID       string `json:"customer_id,required" format:"uuid"`
	// 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.
	//
	// Any of "HOUR", "DAY", "NONE".
	WindowSize V1UsageListWithGroupsParamsWindowSize `json:"window_size,omitzero,required"`
	// Max number of results that should be returned
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Opt[string] `query:"next_page,omitzero" json:"-"`
	// 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.
	CurrentPeriod param.Opt[bool]                    `json:"current_period,omitzero"`
	EndingBefore  param.Opt[time.Time]               `json:"ending_before,omitzero" format:"date-time"`
	StartingOn    param.Opt[time.Time]               `json:"starting_on,omitzero" format:"date-time"`
	GroupBy       V1UsageListWithGroupsParamsGroupBy `json:"group_by,omitzero"`
	// contains filtered or unexported fields
}

func (V1UsageListWithGroupsParams) MarshalJSON

func (r V1UsageListWithGroupsParams) MarshalJSON() (data []byte, err error)

func (V1UsageListWithGroupsParams) URLQuery

func (r V1UsageListWithGroupsParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1UsageListWithGroupsParams's query parameters as `url.Values`.

func (*V1UsageListWithGroupsParams) UnmarshalJSON added in v1.0.0

func (r *V1UsageListWithGroupsParams) UnmarshalJSON(data []byte) error

type V1UsageListWithGroupsParamsGroupBy

type V1UsageListWithGroupsParamsGroupBy struct {
	// The name of the group_by key to use
	Key string `json:"key,required"`
	// Values of the group_by key to return in the query. Omit this if you'd like all
	// values for the key returned.
	Values []string `json:"values,omitzero"`
	// contains filtered or unexported fields
}

The property Key is required.

func (V1UsageListWithGroupsParamsGroupBy) MarshalJSON

func (r V1UsageListWithGroupsParamsGroupBy) MarshalJSON() (data []byte, err error)

func (*V1UsageListWithGroupsParamsGroupBy) UnmarshalJSON added in v1.0.0

func (r *V1UsageListWithGroupsParamsGroupBy) UnmarshalJSON(data []byte) error

type V1UsageListWithGroupsParamsWindowSize

type V1UsageListWithGroupsParamsWindowSize string

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.

const (
	V1UsageListWithGroupsParamsWindowSizeHour V1UsageListWithGroupsParamsWindowSize = "HOUR"
	V1UsageListWithGroupsParamsWindowSizeDay  V1UsageListWithGroupsParamsWindowSize = "DAY"
	V1UsageListWithGroupsParamsWindowSizeNone V1UsageListWithGroupsParamsWindowSize = "NONE"
)

type V1UsageListWithGroupsResponse

type V1UsageListWithGroupsResponse struct {
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	GroupKey     string    `json:"group_key,required"`
	GroupValue   string    `json:"group_value,required"`
	StartingOn   time.Time `json:"starting_on,required" format:"date-time"`
	Value        float64   `json:"value,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EndingBefore respjson.Field
		GroupKey     respjson.Field
		GroupValue   respjson.Field
		StartingOn   respjson.Field
		Value        respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1UsageListWithGroupsResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1UsageListWithGroupsResponse) UnmarshalJSON

func (r *V1UsageListWithGroupsResponse) UnmarshalJSON(data []byte) error

type V1UsageSearchParams

type V1UsageSearchParams struct {
	// The transaction IDs of the events to retrieve
	TransactionIDs []string `json:"transactionIds,omitzero,required"`
	// contains filtered or unexported fields
}

func (V1UsageSearchParams) MarshalJSON

func (r V1UsageSearchParams) MarshalJSON() (data []byte, err error)

func (*V1UsageSearchParams) UnmarshalJSON added in v1.0.0

func (r *V1UsageSearchParams) UnmarshalJSON(data []byte) error

type V1UsageSearchResponse

type V1UsageSearchResponse struct {
	ID string `json:"id,required"`
	// The ID of the customer in the ingest event body
	CustomerID             string                                       `json:"customer_id,required"`
	EventType              string                                       `json:"event_type,required"`
	Timestamp              time.Time                                    `json:"timestamp,required" format:"date-time"`
	TransactionID          string                                       `json:"transaction_id,required"`
	IsDuplicate            bool                                         `json:"is_duplicate"`
	MatchedBillableMetrics []V1UsageSearchResponseMatchedBillableMetric `json:"matched_billable_metrics"`
	// The customer the event was matched to if a match was found
	MatchedCustomer V1UsageSearchResponseMatchedCustomer `json:"matched_customer"`
	ProcessedAt     time.Time                            `json:"processed_at" format:"date-time"`
	Properties      map[string]any                       `json:"properties"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                     respjson.Field
		CustomerID             respjson.Field
		EventType              respjson.Field
		Timestamp              respjson.Field
		TransactionID          respjson.Field
		IsDuplicate            respjson.Field
		MatchedBillableMetrics respjson.Field
		MatchedCustomer        respjson.Field
		ProcessedAt            respjson.Field
		Properties             respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1UsageSearchResponse) RawJSON added in v1.0.0

func (r V1UsageSearchResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1UsageSearchResponse) UnmarshalJSON

func (r *V1UsageSearchResponse) UnmarshalJSON(data []byte) error

type V1UsageSearchResponseMatchedBillableMetric

type V1UsageSearchResponseMatchedBillableMetric struct {
	ID   string `json:"id,required" format:"uuid"`
	Name string `json:"name,required"`
	// (DEPRECATED) use aggregation_type instead
	Aggregate string `json:"aggregate"`
	// (DEPRECATED) use aggregation_key instead
	AggregateKeys []string `json:"aggregate_keys"`
	// 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'.
	AggregationKey string `json:"aggregation_key"`
	// Specifies the type of aggregation performed on matching events.
	//
	// Any of "COUNT", "LATEST", "MAX", "SUM", "UNIQUE".
	AggregationType string `json:"aggregation_type"`
	// RFC 3339 timestamp indicating when the billable metric was archived. If not
	// provided, the billable metric is not archived.
	ArchivedAt time.Time `json:"archived_at" format:"date-time"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields"`
	// An optional filtering rule to match the 'event_type' property of an event.
	EventTypeFilter shared.EventTypeFilter `json:"event_type_filter"`
	// (DEPRECATED) use property_filters & event_type_filter instead
	Filter map[string]any `json:"filter"`
	// (DEPRECATED) use group_keys instead
	GroupBy []string `json:"group_by"`
	// 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.
	GroupKeys [][]string `json:"group_keys"`
	// 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.
	PropertyFilters []shared.PropertyFilter `json:"property_filters"`
	// The SQL query associated with the billable metric
	Sql string `json:"sql"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID              respjson.Field
		Name            respjson.Field
		Aggregate       respjson.Field
		AggregateKeys   respjson.Field
		AggregationKey  respjson.Field
		AggregationType respjson.Field
		ArchivedAt      respjson.Field
		CustomFields    respjson.Field
		EventTypeFilter respjson.Field
		Filter          respjson.Field
		GroupBy         respjson.Field
		GroupKeys       respjson.Field
		PropertyFilters respjson.Field
		Sql             respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V1UsageSearchResponseMatchedBillableMetric) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1UsageSearchResponseMatchedBillableMetric) UnmarshalJSON

func (r *V1UsageSearchResponseMatchedBillableMetric) UnmarshalJSON(data []byte) error

type V1UsageSearchResponseMatchedCustomer

type V1UsageSearchResponseMatchedCustomer struct {
	ID   string `json:"id" format:"uuid"`
	Name string `json:"name"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The customer the event was matched to if a match was found

func (V1UsageSearchResponseMatchedCustomer) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V1UsageSearchResponseMatchedCustomer) UnmarshalJSON

func (r *V1UsageSearchResponseMatchedCustomer) UnmarshalJSON(data []byte) error

type V1UsageService

type V1UsageService struct {
	Options []option.RequestOption
}

V1UsageService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1UsageService method instead.

func NewV1UsageService

func NewV1UsageService(opts ...option.RequestOption) (r V1UsageService)

NewV1UsageService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1UsageService) Ingest

func (r *V1UsageService) Ingest(ctx context.Context, body V1UsageIngestParams, opts ...option.RequestOption) (err error)

The ingest endpoint is the primary method for sending usage events to Metronome, serving as the foundation for all billing calculations in your usage-based pricing model. This high-throughput endpoint is designed for real-time streaming ingestion, supports backdating 34 days, and is built to handle mission-critical usage data with enterprise-grade reliability. Metronome supports 100,000 events per second without requiring pre-aggregation or rollups and can scale up from there. See [Getting usage into Metronome](https://docs.metronome.com/connect-metronome/) to learn more about usage events.

### Use this endpoint to:

Create a customer usage pipeline into Metronome that drives billable metrics, credit drawdown, and invoicing. Track customer behavior, resource consumption, and feature usage

### What happens when you send events:

  • Events are validated and processed in real-time
  • Events are matched to customers using customer IDs or customer ingest aliases
  • Events are matched to billable metrics and are immediately available for usage and spend calculations

### Usage guidelines:

  • Historical events can be backdated up to 34 days and will immediately impact live customer spend
  • Duplicate events are automatically detected and ignored (34-day deduplication window)

#### Event structure:

Usage events are simple JSON objects designed for flexibility and ease of integration:

```json

{
  "transaction_id": "2021-01-01T00:00:00Z_cluster42",
  "customer_id": "team@example.com",
  "event_type": "api_request",
  "timestamp": "2021-01-01T00:00:00Z",
  "properties": {
    "endpoint": "/v1/users",
    "method": "POST",
    "response_time_ms": 45,
    "region": "us-west-2"
  }
}

```

#### Transaction ID

The transaction_id serves as your idempotency key, ensuring events are processed exactly once. Metronome maintains a 34-day deduplication window - significantly longer than typical 12-hour windows - enabling robust backfill scenarios without duplicate billing.

- Best Practices:

  • Use UUIDs for one-time events: uuid4()
  • For heartbeat events, use deterministic IDs
  • Include enough context to avoid collisions across different event sources

#### Customer ID

Identifies which customer should be billed for this usage. Supports two identification methods:

- Metronome Customer ID: The UUID returned when creating a customer - Ingest Alias: Your system's identifier (email, account number, etc.)

Ingest aliases enable seamless integration without requiring ID mapping, and customers can have multiple aliases for flexibility.

#### Event Type:

Categorizes the event type for billable metric matching. Choose descriptive names that aligns with the product surface area.

#### Properties:

Flexible metadata also used to match billable metrics or to be used to serve as group keys to create multiple pricing dimensions or breakdown costs by novel properties for end customers or internal finance teams measuring underlying COGs.

func (*V1UsageService) List

Retrieve aggregated usage data across multiple customers and billable metrics in a single query. This batch endpoint enables you to fetch usage patterns at scale, broken down by time windows, making it ideal for building analytics dashboards, generating reports, and monitoring platform-wide usage trends.

### Use this endpoint to:

- Generate platform-wide usage reports for internal teams - Monitor aggregate usage trends across your entire customer base - Create comparative usage analyses between customers or time periods - Support capacity planning with historical usage patterns

### Key response fields:

An array of `UsageBatchAggregate` objects containing:

- `customer_id`: The customer this usage belongs to - `billable_metric_id` and `billable_metric_name`: What was measured - `start_timestamp` and `end_timestamp`: Time window for this data point - `value`: Aggregated usage amount for the period - `groups` (optional): Usage broken down by group keys with values - `next_page`: Pagination cursor for large result sets

### Usage guidelines:

  • Time windows: Set `window_size` to `hour`, `day`, or `none` (entire period)
  • Required parameters: Must specify `starting_on`, `ending_before`, and `window_size`
  • Filtering options:
  • `customer_ids`: Limit to specific customers (omit for all customers)
  • `billable_metrics`: Limit to specific metrics (omit for all metrics)
  • Pagination: Use `next_page` cursor to retrieve large datasets
  • Null values: Group values may be null when no usage matches that group

func (*V1UsageService) ListAutoPaging added in v1.0.0

Retrieve aggregated usage data across multiple customers and billable metrics in a single query. This batch endpoint enables you to fetch usage patterns at scale, broken down by time windows, making it ideal for building analytics dashboards, generating reports, and monitoring platform-wide usage trends.

### Use this endpoint to:

- Generate platform-wide usage reports for internal teams - Monitor aggregate usage trends across your entire customer base - Create comparative usage analyses between customers or time periods - Support capacity planning with historical usage patterns

### Key response fields:

An array of `UsageBatchAggregate` objects containing:

- `customer_id`: The customer this usage belongs to - `billable_metric_id` and `billable_metric_name`: What was measured - `start_timestamp` and `end_timestamp`: Time window for this data point - `value`: Aggregated usage amount for the period - `groups` (optional): Usage broken down by group keys with values - `next_page`: Pagination cursor for large result sets

### Usage guidelines:

  • Time windows: Set `window_size` to `hour`, `day`, or `none` (entire period)
  • Required parameters: Must specify `starting_on`, `ending_before`, and `window_size`
  • Filtering options:
  • `customer_ids`: Limit to specific customers (omit for all customers)
  • `billable_metrics`: Limit to specific metrics (omit for all metrics)
  • Pagination: Use `next_page` cursor to retrieve large datasets
  • Null values: Group values may be null when no usage matches that group

func (*V1UsageService) ListWithGroups

Retrieve granular usage data for a specific customer and billable metric, with the ability to break down usage by custom grouping dimensions. This endpoint enables deep usage analytics by segmenting data across attributes like region, user, model type, or any custom dimension defined in your billable metrics.

### Use this endpoint to:

  • Analyze usage patterns broken down by specific attributes (region, user, department, etc.)
  • Build detailed usage dashboards with dimensional filtering
  • Identify high-usage segments for optimization opportunities

### Key response fields:

An array of `PagedUsageAggregate` objects containing:

- `starting_on` and `ending_before`: Time window boundaries - `group_key`: The dimension being grouped by (e.g., "region") - `group_value`: The specific value for this group (e.g., "US-East") - `value`: Aggregated usage for this group and time window - `next_page`: Pagination cursor for large datasets

### Usage guidelines:

  • Required parameters: Must specify `customer_id`, `billable_metric_id`, and `window_size`
  • Time windows: Set `window_size` to hour, day, or none for different granularities
  • Group filtering: Use `group_by` to specify:
  • key: The dimension to group by (must be set on the billable metric as a group key)
  • values: Optional array to filter to specific values only
  • Pagination: Use limit and `next_page` for large result sets
  • Null handling: `group_value` may be null for unmatched data

func (*V1UsageService) ListWithGroupsAutoPaging

Retrieve granular usage data for a specific customer and billable metric, with the ability to break down usage by custom grouping dimensions. This endpoint enables deep usage analytics by segmenting data across attributes like region, user, model type, or any custom dimension defined in your billable metrics.

### Use this endpoint to:

  • Analyze usage patterns broken down by specific attributes (region, user, department, etc.)
  • Build detailed usage dashboards with dimensional filtering
  • Identify high-usage segments for optimization opportunities

### Key response fields:

An array of `PagedUsageAggregate` objects containing:

- `starting_on` and `ending_before`: Time window boundaries - `group_key`: The dimension being grouped by (e.g., "region") - `group_value`: The specific value for this group (e.g., "US-East") - `value`: Aggregated usage for this group and time window - `next_page`: Pagination cursor for large datasets

### Usage guidelines:

  • Required parameters: Must specify `customer_id`, `billable_metric_id`, and `window_size`
  • Time windows: Set `window_size` to hour, day, or none for different granularities
  • Group filtering: Use `group_by` to specify:
  • key: The dimension to group by (must be set on the billable metric as a group key)
  • values: Optional array to filter to specific values only
  • Pagination: Use limit and `next_page` for large result sets
  • Null handling: `group_value` may be null for unmatched data

func (*V1UsageService) Search

This endpoint retrieves events by transaction ID for events that occurred within the last 34 days. It is specifically designed for sampling-based testing workflows to detect revenue leakage. The Event Search API provides a critical observability tool that validates the integrity of your usage pipeline by allowing you to sample raw events and verify their matching against active billable metrics.

Why event observability matters for revenue leakage: Silent revenue loss occurs when events are dropped, delayed, or fail to match billable metrics due to:

- Upstream system failures - Event format changes - Misconfigured billable metrics

### Use this endpoint to:

- Sample raw events and validate they match the expected billable metrics - Build custom leakage detection alerts to prevent silent revenue loss - Verify event processing accuracy during system changes or metric updates - Debug event matching issues in real-time

### Key response fields:

- Complete event details including transaction ID, customer ID, and properties - Matched Metronome customer (if any) - Matched billable metric information (if any) - Processing status and duplicate detection flags

### Usage guidelines:

⚠️ Important: This endpoint is heavily rate limited and designed for sampling workflows only. Do not use this endpoint to check every event in your system. Instead, implement a sampling strategy to randomly validate a subset of events for observability purposes.

type V2ContractEditCommitParams

type V2ContractEditCommitParams struct {
	// ID of the commit to edit
	CommitID string `json:"commit_id,required" format:"uuid"`
	// ID of the customer whose commit is being edited
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// If multiple commits are applicable, the one with the lower priority will apply
	// first.
	Priority param.Opt[float64] `json:"priority,omitzero"`
	// ID of contract to use for invoicing
	InvoiceContractID param.Opt[string] `json:"invoice_contract_id,omitzero" format:"uuid"`
	ProductID         param.Opt[string] `json:"product_id,omitzero" format:"uuid"`
	// Which products the commit applies to. If applicable_product_ids,
	// applicable_product_tags or specifiers are not provided, the commit applies to
	// all products.
	ApplicableProductIDs []string `json:"applicable_product_ids,omitzero" format:"uuid"`
	// Which tags the commit applies to. If applicable_product_ids,
	// applicable_product_tags or specifiers are not provided, the commit applies to
	// all products.
	ApplicableProductTags []string `json:"applicable_product_tags,omitzero"`
	// List of filters that determine what kind of customer usage draws down a commit
	// or credit. A customer's usage needs to meet the condition of at least one of the
	// specifiers to contribute to a commit's or credit's drawdown. This field cannot
	// be used together with `applicable_product_ids` or `applicable_product_tags`.
	// Instead, to target usage by product or product tag, pass those values in the
	// body of `specifiers`.
	Specifiers      []shared.CommitSpecifierInputParam        `json:"specifiers,omitzero"`
	AccessSchedule  V2ContractEditCommitParamsAccessSchedule  `json:"access_schedule,omitzero"`
	InvoiceSchedule V2ContractEditCommitParamsInvoiceSchedule `json:"invoice_schedule,omitzero"`
	// If provided, updates the commit to use the specified rate type for current and
	// future invoices. Previously finalized invoices will need to be voided and
	// regenerated to reflect the rate type change.
	//
	// Any of "LIST_RATE", "COMMIT_RATE".
	RateType V2ContractEditCommitParamsRateType `json:"rate_type,omitzero"`
	// contains filtered or unexported fields
}

func (V2ContractEditCommitParams) MarshalJSON

func (r V2ContractEditCommitParams) MarshalJSON() (data []byte, err error)

func (*V2ContractEditCommitParams) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditCommitParams) UnmarshalJSON(data []byte) error

type V2ContractEditCommitParamsAccessSchedule

type V2ContractEditCommitParamsAccessSchedule struct {
	AddScheduleItems    []V2ContractEditCommitParamsAccessScheduleAddScheduleItem    `json:"add_schedule_items,omitzero"`
	RemoveScheduleItems []V2ContractEditCommitParamsAccessScheduleRemoveScheduleItem `json:"remove_schedule_items,omitzero"`
	UpdateScheduleItems []V2ContractEditCommitParamsAccessScheduleUpdateScheduleItem `json:"update_schedule_items,omitzero"`
	// contains filtered or unexported fields
}

func (V2ContractEditCommitParamsAccessSchedule) MarshalJSON

func (r V2ContractEditCommitParamsAccessSchedule) MarshalJSON() (data []byte, err error)

func (*V2ContractEditCommitParamsAccessSchedule) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditCommitParamsAccessSchedule) UnmarshalJSON(data []byte) error

type V2ContractEditCommitParamsAccessScheduleAddScheduleItem

type V2ContractEditCommitParamsAccessScheduleAddScheduleItem struct {
	Amount       float64   `json:"amount,required"`
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	StartingAt   time.Time `json:"starting_at,required" format:"date-time"`
	// contains filtered or unexported fields
}

The properties Amount, EndingBefore, StartingAt are required.

func (V2ContractEditCommitParamsAccessScheduleAddScheduleItem) MarshalJSON

func (*V2ContractEditCommitParamsAccessScheduleAddScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditCommitParamsAccessScheduleRemoveScheduleItem

type V2ContractEditCommitParamsAccessScheduleRemoveScheduleItem struct {
	ID string `json:"id,required" format:"uuid"`
	// contains filtered or unexported fields
}

The property ID is required.

func (V2ContractEditCommitParamsAccessScheduleRemoveScheduleItem) MarshalJSON

func (*V2ContractEditCommitParamsAccessScheduleRemoveScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditCommitParamsAccessScheduleUpdateScheduleItem

type V2ContractEditCommitParamsAccessScheduleUpdateScheduleItem struct {
	ID           string               `json:"id,required" format:"uuid"`
	Amount       param.Opt[float64]   `json:"amount,omitzero"`
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	StartingAt   param.Opt[time.Time] `json:"starting_at,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

The property ID is required.

func (V2ContractEditCommitParamsAccessScheduleUpdateScheduleItem) MarshalJSON

func (*V2ContractEditCommitParamsAccessScheduleUpdateScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditCommitParamsInvoiceSchedule

type V2ContractEditCommitParamsInvoiceSchedule struct {
	AddScheduleItems    []V2ContractEditCommitParamsInvoiceScheduleAddScheduleItem    `json:"add_schedule_items,omitzero"`
	RemoveScheduleItems []V2ContractEditCommitParamsInvoiceScheduleRemoveScheduleItem `json:"remove_schedule_items,omitzero"`
	UpdateScheduleItems []V2ContractEditCommitParamsInvoiceScheduleUpdateScheduleItem `json:"update_schedule_items,omitzero"`
	// contains filtered or unexported fields
}

func (V2ContractEditCommitParamsInvoiceSchedule) MarshalJSON

func (r V2ContractEditCommitParamsInvoiceSchedule) MarshalJSON() (data []byte, err error)

func (*V2ContractEditCommitParamsInvoiceSchedule) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditCommitParamsInvoiceSchedule) UnmarshalJSON(data []byte) error

type V2ContractEditCommitParamsInvoiceScheduleAddScheduleItem

type V2ContractEditCommitParamsInvoiceScheduleAddScheduleItem struct {
	Timestamp time.Time          `json:"timestamp,required" format:"date-time"`
	Amount    param.Opt[float64] `json:"amount,omitzero"`
	Quantity  param.Opt[float64] `json:"quantity,omitzero"`
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

The property Timestamp is required.

func (V2ContractEditCommitParamsInvoiceScheduleAddScheduleItem) MarshalJSON

func (*V2ContractEditCommitParamsInvoiceScheduleAddScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditCommitParamsInvoiceScheduleRemoveScheduleItem

type V2ContractEditCommitParamsInvoiceScheduleRemoveScheduleItem struct {
	ID string `json:"id,required" format:"uuid"`
	// contains filtered or unexported fields
}

The property ID is required.

func (V2ContractEditCommitParamsInvoiceScheduleRemoveScheduleItem) MarshalJSON

func (*V2ContractEditCommitParamsInvoiceScheduleRemoveScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditCommitParamsInvoiceScheduleUpdateScheduleItem

type V2ContractEditCommitParamsInvoiceScheduleUpdateScheduleItem struct {
	ID        string               `json:"id,required" format:"uuid"`
	Amount    param.Opt[float64]   `json:"amount,omitzero"`
	Quantity  param.Opt[float64]   `json:"quantity,omitzero"`
	Timestamp param.Opt[time.Time] `json:"timestamp,omitzero" format:"date-time"`
	UnitPrice param.Opt[float64]   `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

The property ID is required.

func (V2ContractEditCommitParamsInvoiceScheduleUpdateScheduleItem) MarshalJSON

func (*V2ContractEditCommitParamsInvoiceScheduleUpdateScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditCommitParamsRateType added in v1.0.0

type V2ContractEditCommitParamsRateType string

If provided, updates the commit to use the specified rate type for current and future invoices. Previously finalized invoices will need to be voided and regenerated to reflect the rate type change.

const (
	V2ContractEditCommitParamsRateTypeListRate   V2ContractEditCommitParamsRateType = "LIST_RATE"
	V2ContractEditCommitParamsRateTypeCommitRate V2ContractEditCommitParamsRateType = "COMMIT_RATE"
)

type V2ContractEditCommitResponse

type V2ContractEditCommitResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractEditCommitResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractEditCommitResponse) UnmarshalJSON

func (r *V2ContractEditCommitResponse) UnmarshalJSON(data []byte) error

type V2ContractEditCreditParams

type V2ContractEditCreditParams struct {
	// ID of the credit to edit
	CreditID string `json:"credit_id,required" format:"uuid"`
	// ID of the customer whose credit is being edited
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// If multiple commits are applicable, the one with the lower priority will apply
	// first.
	Priority  param.Opt[float64] `json:"priority,omitzero"`
	ProductID param.Opt[string]  `json:"product_id,omitzero" format:"uuid"`
	// Which products the credit applies to. If both applicable_product_ids and
	// applicable_product_tags are not provided, the credit applies to all products.
	ApplicableProductIDs []string `json:"applicable_product_ids,omitzero" format:"uuid"`
	// Which tags the credit applies to. If both applicable_product_ids and
	// applicable_product_tags are not provided, the credit applies to all products.
	ApplicableProductTags []string `json:"applicable_product_tags,omitzero"`
	// List of filters that determine what kind of customer usage draws down a commit
	// or credit. A customer's usage needs to meet the condition of at least one of the
	// specifiers to contribute to a commit's or credit's drawdown. This field cannot
	// be used together with `applicable_product_ids` or `applicable_product_tags`.
	// Instead, to target usage by product or product tag, pass those values in the
	// body of `specifiers`.
	Specifiers     []shared.CommitSpecifierInputParam       `json:"specifiers,omitzero"`
	AccessSchedule V2ContractEditCreditParamsAccessSchedule `json:"access_schedule,omitzero"`
	// If provided, updates the credit to use the specified rate type for current and
	// future invoices. Previously finalized invoices will need to be voided and
	// regenerated to reflect the rate type change.
	//
	// Any of "LIST_RATE", "COMMIT_RATE".
	RateType V2ContractEditCreditParamsRateType `json:"rate_type,omitzero"`
	// contains filtered or unexported fields
}

func (V2ContractEditCreditParams) MarshalJSON

func (r V2ContractEditCreditParams) MarshalJSON() (data []byte, err error)

func (*V2ContractEditCreditParams) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditCreditParams) UnmarshalJSON(data []byte) error

type V2ContractEditCreditParamsAccessSchedule

type V2ContractEditCreditParamsAccessSchedule struct {
	AddScheduleItems    []V2ContractEditCreditParamsAccessScheduleAddScheduleItem    `json:"add_schedule_items,omitzero"`
	RemoveScheduleItems []V2ContractEditCreditParamsAccessScheduleRemoveScheduleItem `json:"remove_schedule_items,omitzero"`
	UpdateScheduleItems []V2ContractEditCreditParamsAccessScheduleUpdateScheduleItem `json:"update_schedule_items,omitzero"`
	// contains filtered or unexported fields
}

func (V2ContractEditCreditParamsAccessSchedule) MarshalJSON

func (r V2ContractEditCreditParamsAccessSchedule) MarshalJSON() (data []byte, err error)

func (*V2ContractEditCreditParamsAccessSchedule) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditCreditParamsAccessSchedule) UnmarshalJSON(data []byte) error

type V2ContractEditCreditParamsAccessScheduleAddScheduleItem

type V2ContractEditCreditParamsAccessScheduleAddScheduleItem struct {
	Amount       float64   `json:"amount,required"`
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	StartingAt   time.Time `json:"starting_at,required" format:"date-time"`
	// contains filtered or unexported fields
}

The properties Amount, EndingBefore, StartingAt are required.

func (V2ContractEditCreditParamsAccessScheduleAddScheduleItem) MarshalJSON

func (*V2ContractEditCreditParamsAccessScheduleAddScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditCreditParamsAccessScheduleRemoveScheduleItem

type V2ContractEditCreditParamsAccessScheduleRemoveScheduleItem struct {
	ID string `json:"id,required" format:"uuid"`
	// contains filtered or unexported fields
}

The property ID is required.

func (V2ContractEditCreditParamsAccessScheduleRemoveScheduleItem) MarshalJSON

func (*V2ContractEditCreditParamsAccessScheduleRemoveScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditCreditParamsAccessScheduleUpdateScheduleItem

type V2ContractEditCreditParamsAccessScheduleUpdateScheduleItem struct {
	ID           string               `json:"id,required" format:"uuid"`
	Amount       param.Opt[float64]   `json:"amount,omitzero"`
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	StartingAt   param.Opt[time.Time] `json:"starting_at,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

The property ID is required.

func (V2ContractEditCreditParamsAccessScheduleUpdateScheduleItem) MarshalJSON

func (*V2ContractEditCreditParamsAccessScheduleUpdateScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditCreditParamsRateType added in v1.0.0

type V2ContractEditCreditParamsRateType string

If provided, updates the credit to use the specified rate type for current and future invoices. Previously finalized invoices will need to be voided and regenerated to reflect the rate type change.

const (
	V2ContractEditCreditParamsRateTypeListRate   V2ContractEditCreditParamsRateType = "LIST_RATE"
	V2ContractEditCreditParamsRateTypeCommitRate V2ContractEditCreditParamsRateType = "COMMIT_RATE"
)

type V2ContractEditCreditResponse

type V2ContractEditCreditResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractEditCreditResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractEditCreditResponse) UnmarshalJSON

func (r *V2ContractEditCreditResponse) UnmarshalJSON(data []byte) error

type V2ContractEditParams

type V2ContractEditParams struct {
	// ID of the contract being edited
	ContractID string `json:"contract_id,required" format:"uuid"`
	// ID of the customer whose contract is being edited
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// RFC 3339 timestamp indicating when the contract will end (exclusive).
	UpdateContractEndDate param.Opt[time.Time] `json:"update_contract_end_date,omitzero" format:"date-time"`
	// Value to update the contract name to. If not provided, the contract name will
	// remain unchanged.
	UpdateContractName param.Opt[string] `json:"update_contract_name,omitzero"`
	// If true, allows setting the contract end date earlier than the end_timestamp of
	// existing finalized invoices. Finalized invoices will be unchanged; if you want
	// to incorporate the new end date, you can void and regenerate finalized usage
	// invoices. Defaults to true.
	AllowContractEndingBeforeFinalizedInvoice param.Opt[bool] `json:"allow_contract_ending_before_finalized_invoice,omitzero"`
	// Optional uniqueness key to prevent duplicate contract edits.
	UniquenessKey                           param.Opt[string]                                  `json:"uniqueness_key,omitzero"`
	AddCommits                              []V2ContractEditParamsAddCommit                    `json:"add_commits,omitzero"`
	AddCredits                              []V2ContractEditParamsAddCredit                    `json:"add_credits,omitzero"`
	AddDiscounts                            []V2ContractEditParamsAddDiscount                  `json:"add_discounts,omitzero"`
	AddOverrides                            []V2ContractEditParamsAddOverride                  `json:"add_overrides,omitzero"`
	AddPrepaidBalanceThresholdConfiguration shared.PrepaidBalanceThresholdConfigurationV2Param `json:"add_prepaid_balance_threshold_configuration,omitzero"`
	// This field's availability is dependent on your client's configuration.
	AddProfessionalServices        []V2ContractEditParamsAddProfessionalService `json:"add_professional_services,omitzero"`
	AddRecurringCommits            []V2ContractEditParamsAddRecurringCommit     `json:"add_recurring_commits,omitzero"`
	AddRecurringCredits            []V2ContractEditParamsAddRecurringCredit     `json:"add_recurring_credits,omitzero"`
	AddResellerRoyalties           []V2ContractEditParamsAddResellerRoyalty     `json:"add_reseller_royalties,omitzero"`
	AddScheduledCharges            []V2ContractEditParamsAddScheduledCharge     `json:"add_scheduled_charges,omitzero"`
	AddSpendThresholdConfiguration shared.SpendThresholdConfigurationV2Param    `json:"add_spend_threshold_configuration,omitzero"`
	// Optional list of
	// [subscriptions](https://docs.metronome.com/manage-product-access/create-subscription/)
	// to add to the contract.
	AddSubscriptions []V2ContractEditParamsAddSubscription `json:"add_subscriptions,omitzero"`
	// IDs of commits to archive
	ArchiveCommits []V2ContractEditParamsArchiveCommit `json:"archive_commits,omitzero"`
	// IDs of credits to archive
	ArchiveCredits []V2ContractEditParamsArchiveCredit `json:"archive_credits,omitzero"`
	// IDs of scheduled charges to archive
	ArchiveScheduledCharges []V2ContractEditParamsArchiveScheduledCharge `json:"archive_scheduled_charges,omitzero"`
	// IDs of overrides to remove
	RemoveOverrides                            []V2ContractEditParamsRemoveOverride                           `json:"remove_overrides,omitzero"`
	UpdateCommits                              []V2ContractEditParamsUpdateCommit                             `json:"update_commits,omitzero"`
	UpdateCredits                              []V2ContractEditParamsUpdateCredit                             `json:"update_credits,omitzero"`
	UpdatePrepaidBalanceThresholdConfiguration V2ContractEditParamsUpdatePrepaidBalanceThresholdConfiguration `json:"update_prepaid_balance_threshold_configuration,omitzero"`
	// Edits to these recurring commits will only affect commits whose access schedules
	// has not started. Expired commits, and commits with an active access schedule
	// will remain unchanged.
	UpdateRecurringCommits []V2ContractEditParamsUpdateRecurringCommit `json:"update_recurring_commits,omitzero"`
	// Edits to these recurring credits will only affect credits whose access schedules
	// has not started. Expired credits, and credits with an active access schedule
	// will remain unchanged.
	UpdateRecurringCredits            []V2ContractEditParamsUpdateRecurringCredit           `json:"update_recurring_credits,omitzero"`
	UpdateScheduledCharges            []V2ContractEditParamsUpdateScheduledCharge           `json:"update_scheduled_charges,omitzero"`
	UpdateSpendThresholdConfiguration V2ContractEditParamsUpdateSpendThresholdConfiguration `json:"update_spend_threshold_configuration,omitzero"`
	// Optional list of subscriptions to update.
	UpdateSubscriptions []V2ContractEditParamsUpdateSubscription `json:"update_subscriptions,omitzero"`
	// contains filtered or unexported fields
}

func (V2ContractEditParams) MarshalJSON

func (r V2ContractEditParams) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParams) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParams) UnmarshalJSON(data []byte) error

type V2ContractEditParamsAddCommit

type V2ContractEditParamsAddCommit struct {
	ProductID string `json:"product_id,required" format:"uuid"`
	// Any of "PREPAID", "POSTPAID".
	Type string `json:"type,omitzero,required"`
	// (DEPRECATED) Use access_schedule and invoice_schedule instead.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// Used only in UI/API. It is not exposed to end customers.
	Description param.Opt[string] `json:"description,omitzero"`
	// displayed on invoices
	Name param.Opt[string] `json:"name,omitzero"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Opt[string] `json:"netsuite_sales_order_id,omitzero"`
	// If multiple commits are applicable, the one with the lower priority will apply
	// first.
	Priority param.Opt[float64] `json:"priority,omitzero"`
	// Fraction of unused segments that will be rolled over. Must be between 0 and 1.
	RolloverFraction param.Opt[float64] `json:"rollover_fraction,omitzero"`
	// A temporary ID for the commit that can be used to reference the commit for
	// commit specific overrides.
	TemporaryID param.Opt[string] `json:"temporary_id,omitzero"`
	// Required: Schedule for distributing the commit to the customer. For "POSTPAID"
	// commits only one schedule item is allowed and amount must match invoice_schedule
	// total.
	AccessSchedule V2ContractEditParamsAddCommitAccessSchedule `json:"access_schedule,omitzero"`
	// Which products the commit applies to. If applicable_product_ids,
	// applicable_product_tags or specifiers are not provided, the commit applies to
	// all products.
	ApplicableProductIDs []string `json:"applicable_product_ids,omitzero" format:"uuid"`
	// Which tags the commit applies to. If applicable_product_ids,
	// applicable_product_tags or specifiers are not provided, the commit applies to
	// all products.
	ApplicableProductTags []string `json:"applicable_product_tags,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// Optional configuration for commit hierarchy access control
	HierarchyConfiguration shared.CommitHierarchyConfigurationParam `json:"hierarchy_configuration,omitzero"`
	// Required for "POSTPAID" commits: the true up invoice will be generated at this
	// time and only one schedule item is allowed; the total must match access_schedule
	// amount. Optional for "PREPAID" commits: if not provided, this will be a
	// "complimentary" commit with no invoice.
	InvoiceSchedule V2ContractEditParamsAddCommitInvoiceSchedule `json:"invoice_schedule,omitzero"`
	// optionally payment gate this commit
	PaymentGateConfig V2ContractEditParamsAddCommitPaymentGateConfig `json:"payment_gate_config,omitzero"`
	// Any of "COMMIT_RATE", "LIST_RATE".
	RateType string `json:"rate_type,omitzero"`
	// List of filters that determine what kind of customer usage draws down a commit
	// or credit. A customer's usage needs to meet the condition of at least one of the
	// specifiers to contribute to a commit's or credit's drawdown. This field cannot
	// be used together with `applicable_product_ids` or `applicable_product_tags`.
	// Instead, to target usage by product or product tag, pass those values in the
	// body of `specifiers`.
	Specifiers []shared.CommitSpecifierInputParam `json:"specifiers,omitzero"`
	// contains filtered or unexported fields
}

The properties ProductID, Type are required.

func (V2ContractEditParamsAddCommit) MarshalJSON

func (r V2ContractEditParamsAddCommit) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddCommit) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsAddCommit) UnmarshalJSON(data []byte) error

type V2ContractEditParamsAddCommitAccessSchedule added in v1.0.0

type V2ContractEditParamsAddCommitAccessSchedule struct {
	ScheduleItems []V2ContractEditParamsAddCommitAccessScheduleScheduleItem `json:"schedule_items,omitzero,required"`
	CreditTypeID  param.Opt[string]                                         `json:"credit_type_id,omitzero" format:"uuid"`
	// contains filtered or unexported fields
}

Required: Schedule for distributing the commit to the customer. For "POSTPAID" commits only one schedule item is allowed and amount must match invoice_schedule total.

The property ScheduleItems is required.

func (V2ContractEditParamsAddCommitAccessSchedule) MarshalJSON added in v1.0.0

func (r V2ContractEditParamsAddCommitAccessSchedule) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddCommitAccessSchedule) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsAddCommitAccessSchedule) UnmarshalJSON(data []byte) error

type V2ContractEditParamsAddCommitAccessScheduleScheduleItem added in v1.0.0

type V2ContractEditParamsAddCommitAccessScheduleScheduleItem struct {
	Amount float64 `json:"amount,required"`
	// RFC 3339 timestamp (exclusive)
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	// RFC 3339 timestamp (inclusive)
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// contains filtered or unexported fields
}

The properties Amount, EndingBefore, StartingAt are required.

func (V2ContractEditParamsAddCommitAccessScheduleScheduleItem) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsAddCommitAccessScheduleScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddCommitInvoiceSchedule added in v1.0.0

type V2ContractEditParamsAddCommitInvoiceSchedule struct {
	// Defaults to USD (cents) if not passed.
	CreditTypeID param.Opt[string] `json:"credit_type_id,omitzero" format:"uuid"`
	// This field is only applicable to commit invoice schedules. If true, this
	// schedule will not generate an invoice.
	DoNotInvoice param.Opt[bool] `json:"do_not_invoice,omitzero"`
	// Enter the unit price and quantity for the charge or instead only send the
	// amount. If amount is sent, the unit price is assumed to be the amount and
	// quantity is inferred to be 1.
	RecurringSchedule V2ContractEditParamsAddCommitInvoiceScheduleRecurringSchedule `json:"recurring_schedule,omitzero"`
	// Either provide amount or provide both unit_price and quantity.
	ScheduleItems []V2ContractEditParamsAddCommitInvoiceScheduleScheduleItem `json:"schedule_items,omitzero"`
	// contains filtered or unexported fields
}

Required for "POSTPAID" commits: the true up invoice will be generated at this time and only one schedule item is allowed; the total must match access_schedule amount. Optional for "PREPAID" commits: if not provided, this will be a "complimentary" commit with no invoice.

func (V2ContractEditParamsAddCommitInvoiceSchedule) MarshalJSON added in v1.0.0

func (r V2ContractEditParamsAddCommitInvoiceSchedule) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddCommitInvoiceSchedule) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsAddCommitInvoiceSchedule) UnmarshalJSON(data []byte) error

type V2ContractEditParamsAddCommitInvoiceScheduleRecurringSchedule added in v1.0.0

type V2ContractEditParamsAddCommitInvoiceScheduleRecurringSchedule struct {
	// Any of "DIVIDED", "DIVIDED_ROUNDED", "EACH".
	AmountDistribution string `json:"amount_distribution,omitzero,required"`
	// RFC 3339 timestamp (exclusive).
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	// Any of "MONTHLY", "QUARTERLY", "SEMI_ANNUAL", "ANNUAL", "WEEKLY".
	Frequency string `json:"frequency,omitzero,required"`
	// RFC 3339 timestamp (inclusive).
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// Amount for the charge. Can be provided instead of unit_price and quantity. If
	// amount is sent, the unit_price is assumed to be the amount and quantity is
	// inferred to be 1.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount and must be specified with unit_price. If specified amount cannot be
	// provided.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified with quantity. If specified amount cannot be
	// provided.
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

Enter the unit price and quantity for the charge or instead only send the amount. If amount is sent, the unit price is assumed to be the amount and quantity is inferred to be 1.

The properties AmountDistribution, EndingBefore, Frequency, StartingAt are required.

func (V2ContractEditParamsAddCommitInvoiceScheduleRecurringSchedule) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsAddCommitInvoiceScheduleRecurringSchedule) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddCommitInvoiceScheduleScheduleItem added in v1.0.0

type V2ContractEditParamsAddCommitInvoiceScheduleScheduleItem struct {
	// timestamp of the scheduled event
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// Amount for the charge. Can be provided instead of unit_price and quantity. If
	// amount is sent, the unit_price is assumed to be the amount and quantity is
	// inferred to be 1.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount and must be specified with unit_price. If specified amount cannot be
	// provided.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified with quantity. If specified amount cannot be
	// provided.
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

The property Timestamp is required.

func (V2ContractEditParamsAddCommitInvoiceScheduleScheduleItem) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsAddCommitInvoiceScheduleScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddCommitPaymentGateConfig added in v1.0.0

type V2ContractEditParamsAddCommitPaymentGateConfig struct {
	// Gate access to the commit balance based on successful collection of payment.
	// Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
	// facilitate payment using your own payment integration. Select NONE if you do not
	// wish to payment gate the commit balance.
	//
	// Any of "NONE", "STRIPE", "EXTERNAL".
	PaymentGateType string `json:"payment_gate_type,omitzero,required"`
	// Only applicable if using PRECALCULATED as your tax type.
	PrecalculatedTaxConfig V2ContractEditParamsAddCommitPaymentGateConfigPrecalculatedTaxConfig `json:"precalculated_tax_config,omitzero"`
	// Only applicable if using STRIPE as your payment gateway type.
	StripeConfig V2ContractEditParamsAddCommitPaymentGateConfigStripeConfig `json:"stripe_config,omitzero"`
	// Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
	// not wish Metronome to calculate tax on your behalf. Leaving this field blank
	// will default to NONE.
	//
	// Any of "NONE", "STRIPE", "ANROK", "PRECALCULATED".
	TaxType string `json:"tax_type,omitzero"`
	// contains filtered or unexported fields
}

optionally payment gate this commit

The property PaymentGateType is required.

func (V2ContractEditParamsAddCommitPaymentGateConfig) MarshalJSON added in v1.0.0

func (r V2ContractEditParamsAddCommitPaymentGateConfig) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddCommitPaymentGateConfig) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddCommitPaymentGateConfigPrecalculatedTaxConfig added in v1.0.0

type V2ContractEditParamsAddCommitPaymentGateConfigPrecalculatedTaxConfig struct {
	// Amount of tax to be applied. This should be in the same currency and
	// denomination as the commit's invoice schedule
	TaxAmount float64 `json:"tax_amount,required"`
	// Name of the tax to be applied. This may be used in an invoice line item
	// description.
	TaxName param.Opt[string] `json:"tax_name,omitzero"`
	// contains filtered or unexported fields
}

Only applicable if using PRECALCULATED as your tax type.

The property TaxAmount is required.

func (V2ContractEditParamsAddCommitPaymentGateConfigPrecalculatedTaxConfig) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsAddCommitPaymentGateConfigPrecalculatedTaxConfig) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddCommitPaymentGateConfigStripeConfig added in v1.0.0

type V2ContractEditParamsAddCommitPaymentGateConfigStripeConfig struct {
	// If left blank, will default to INVOICE
	//
	// Any of "INVOICE", "PAYMENT_INTENT".
	PaymentType string `json:"payment_type,omitzero,required"`
	// If true, the payment will be made assuming the customer is present (i.e. on
	// session).
	//
	// If false, the payment will be made assuming the customer is not present (i.e.
	// off session). For cardholders from a country with an e-mandate requirement (e.g.
	// India), the payment may be declined.
	//
	// If left blank, will default to false.
	OnSessionPayment param.Opt[bool] `json:"on_session_payment,omitzero"`
	// Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
	// your payment type.
	InvoiceMetadata map[string]string `json:"invoice_metadata,omitzero"`
	// contains filtered or unexported fields
}

Only applicable if using STRIPE as your payment gateway type.

The property PaymentType is required.

func (V2ContractEditParamsAddCommitPaymentGateConfigStripeConfig) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsAddCommitPaymentGateConfigStripeConfig) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddCredit

type V2ContractEditParamsAddCredit struct {
	// Schedule for distributing the credit to the customer.
	AccessSchedule V2ContractEditParamsAddCreditAccessSchedule `json:"access_schedule,omitzero,required"`
	ProductID      string                                      `json:"product_id,required" format:"uuid"`
	// Used only in UI/API. It is not exposed to end customers.
	Description param.Opt[string] `json:"description,omitzero"`
	// displayed on invoices
	Name param.Opt[string] `json:"name,omitzero"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Opt[string] `json:"netsuite_sales_order_id,omitzero"`
	// If multiple credits are applicable, the one with the lower priority will apply
	// first.
	Priority param.Opt[float64] `json:"priority,omitzero"`
	// Which products the credit applies to. If both applicable_product_ids and
	// applicable_product_tags are not provided, the credit applies to all products.
	ApplicableProductIDs []string `json:"applicable_product_ids,omitzero" format:"uuid"`
	// Which tags the credit applies to. If both applicable_product_ids and
	// applicable_product_tags are not provided, the credit applies to all products.
	ApplicableProductTags []string `json:"applicable_product_tags,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// Optional configuration for credit hierarchy access control
	HierarchyConfiguration shared.CommitHierarchyConfigurationParam `json:"hierarchy_configuration,omitzero"`
	// Any of "COMMIT_RATE", "LIST_RATE".
	RateType string `json:"rate_type,omitzero"`
	// List of filters that determine what kind of customer usage draws down a commit
	// or credit. A customer's usage needs to meet the condition of at least one of the
	// specifiers to contribute to a commit's or credit's drawdown. This field cannot
	// be used together with `applicable_product_ids` or `applicable_product_tags`.
	// Instead, to target usage by product or product tag, pass those values in the
	// body of `specifiers`.
	Specifiers []shared.CommitSpecifierInputParam `json:"specifiers,omitzero"`
	// contains filtered or unexported fields
}

The properties AccessSchedule, ProductID are required.

func (V2ContractEditParamsAddCredit) MarshalJSON

func (r V2ContractEditParamsAddCredit) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddCredit) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsAddCredit) UnmarshalJSON(data []byte) error

type V2ContractEditParamsAddCreditAccessSchedule added in v1.0.0

type V2ContractEditParamsAddCreditAccessSchedule struct {
	ScheduleItems []V2ContractEditParamsAddCreditAccessScheduleScheduleItem `json:"schedule_items,omitzero,required"`
	CreditTypeID  param.Opt[string]                                         `json:"credit_type_id,omitzero" format:"uuid"`
	// contains filtered or unexported fields
}

Schedule for distributing the credit to the customer.

The property ScheduleItems is required.

func (V2ContractEditParamsAddCreditAccessSchedule) MarshalJSON added in v1.0.0

func (r V2ContractEditParamsAddCreditAccessSchedule) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddCreditAccessSchedule) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsAddCreditAccessSchedule) UnmarshalJSON(data []byte) error

type V2ContractEditParamsAddCreditAccessScheduleScheduleItem added in v1.0.0

type V2ContractEditParamsAddCreditAccessScheduleScheduleItem struct {
	Amount float64 `json:"amount,required"`
	// RFC 3339 timestamp (exclusive)
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	// RFC 3339 timestamp (inclusive)
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// contains filtered or unexported fields
}

The properties Amount, EndingBefore, StartingAt are required.

func (V2ContractEditParamsAddCreditAccessScheduleScheduleItem) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsAddCreditAccessScheduleScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddDiscount

type V2ContractEditParamsAddDiscount struct {
	ProductID string `json:"product_id,required" format:"uuid"`
	// Must provide either schedule_items or recurring_schedule.
	Schedule V2ContractEditParamsAddDiscountSchedule `json:"schedule,omitzero,required"`
	// displayed on invoices
	Name param.Opt[string] `json:"name,omitzero"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Opt[string] `json:"netsuite_sales_order_id,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// contains filtered or unexported fields
}

The properties ProductID, Schedule are required.

func (V2ContractEditParamsAddDiscount) MarshalJSON

func (r V2ContractEditParamsAddDiscount) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddDiscount) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsAddDiscount) UnmarshalJSON(data []byte) error

type V2ContractEditParamsAddDiscountSchedule added in v1.0.0

type V2ContractEditParamsAddDiscountSchedule struct {
	// Defaults to USD (cents) if not passed.
	CreditTypeID param.Opt[string] `json:"credit_type_id,omitzero" format:"uuid"`
	// This field is only applicable to commit invoice schedules. If true, this
	// schedule will not generate an invoice.
	DoNotInvoice param.Opt[bool] `json:"do_not_invoice,omitzero"`
	// Enter the unit price and quantity for the charge or instead only send the
	// amount. If amount is sent, the unit price is assumed to be the amount and
	// quantity is inferred to be 1.
	RecurringSchedule V2ContractEditParamsAddDiscountScheduleRecurringSchedule `json:"recurring_schedule,omitzero"`
	// Either provide amount or provide both unit_price and quantity.
	ScheduleItems []V2ContractEditParamsAddDiscountScheduleScheduleItem `json:"schedule_items,omitzero"`
	// contains filtered or unexported fields
}

Must provide either schedule_items or recurring_schedule.

func (V2ContractEditParamsAddDiscountSchedule) MarshalJSON added in v1.0.0

func (r V2ContractEditParamsAddDiscountSchedule) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddDiscountSchedule) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsAddDiscountSchedule) UnmarshalJSON(data []byte) error

type V2ContractEditParamsAddDiscountScheduleRecurringSchedule added in v1.0.0

type V2ContractEditParamsAddDiscountScheduleRecurringSchedule struct {
	// Any of "DIVIDED", "DIVIDED_ROUNDED", "EACH".
	AmountDistribution string `json:"amount_distribution,omitzero,required"`
	// RFC 3339 timestamp (exclusive).
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	// Any of "MONTHLY", "QUARTERLY", "SEMI_ANNUAL", "ANNUAL", "WEEKLY".
	Frequency string `json:"frequency,omitzero,required"`
	// RFC 3339 timestamp (inclusive).
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// Amount for the charge. Can be provided instead of unit_price and quantity. If
	// amount is sent, the unit_price is assumed to be the amount and quantity is
	// inferred to be 1.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount and must be specified with unit_price. If specified amount cannot be
	// provided.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified with quantity. If specified amount cannot be
	// provided.
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

Enter the unit price and quantity for the charge or instead only send the amount. If amount is sent, the unit price is assumed to be the amount and quantity is inferred to be 1.

The properties AmountDistribution, EndingBefore, Frequency, StartingAt are required.

func (V2ContractEditParamsAddDiscountScheduleRecurringSchedule) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsAddDiscountScheduleRecurringSchedule) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddDiscountScheduleScheduleItem added in v1.0.0

type V2ContractEditParamsAddDiscountScheduleScheduleItem struct {
	// timestamp of the scheduled event
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// Amount for the charge. Can be provided instead of unit_price and quantity. If
	// amount is sent, the unit_price is assumed to be the amount and quantity is
	// inferred to be 1.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount and must be specified with unit_price. If specified amount cannot be
	// provided.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified with quantity. If specified amount cannot be
	// provided.
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

The property Timestamp is required.

func (V2ContractEditParamsAddDiscountScheduleScheduleItem) MarshalJSON added in v1.0.0

func (r V2ContractEditParamsAddDiscountScheduleScheduleItem) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddDiscountScheduleScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddOverride

type V2ContractEditParamsAddOverride struct {
	// RFC 3339 timestamp indicating when the override will start applying (inclusive)
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// RFC 3339 timestamp indicating when the override will stop applying (exclusive)
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	Entitled     param.Opt[bool]      `json:"entitled,omitzero"`
	// Indicates whether the override should only apply to commits. Defaults to
	// `false`. If `true`, you can specify relevant commits in `override_specifiers` by
	// passing `commit_ids`.
	IsCommitSpecific param.Opt[bool] `json:"is_commit_specific,omitzero"`
	// Required for MULTIPLIER type. Must be >=0.
	Multiplier param.Opt[float64] `json:"multiplier,omitzero"`
	// Required for EXPLICIT multiplier prioritization scheme and all TIERED overrides.
	// Under EXPLICIT prioritization, overwrites are prioritized first, and then tiered
	// and multiplier overrides are prioritized by their priority value (lowest first).
	// Must be > 0.
	Priority param.Opt[float64] `json:"priority,omitzero"`
	// ID of the product whose rate is being overridden
	ProductID param.Opt[string] `json:"product_id,omitzero" format:"uuid"`
	// tags identifying products whose rates are being overridden
	ApplicableProductTags []string `json:"applicable_product_tags,omitzero"`
	// Cannot be used in conjunction with product_id or applicable_product_tags. If
	// provided, the override will apply to all products with the specified specifiers.
	OverrideSpecifiers []V2ContractEditParamsAddOverrideOverrideSpecifier `json:"override_specifiers,omitzero"`
	// Required for OVERWRITE type.
	OverwriteRate V2ContractEditParamsAddOverrideOverwriteRate `json:"overwrite_rate,omitzero"`
	// Indicates whether the override applies to commit rates or list rates. Can only
	// be used for overrides that have `is_commit_specific` set to `true`. Defaults to
	// `"LIST_RATE"`.
	//
	// Any of "COMMIT_RATE", "LIST_RATE".
	Target string `json:"target,omitzero"`
	// Required for TIERED type. Must have at least one tier.
	Tiers []V2ContractEditParamsAddOverrideTier `json:"tiers,omitzero"`
	// Overwrites are prioritized over multipliers and tiered overrides.
	//
	// Any of "OVERWRITE", "MULTIPLIER", "TIERED".
	Type string `json:"type,omitzero"`
	// contains filtered or unexported fields
}

The property StartingAt is required.

func (V2ContractEditParamsAddOverride) MarshalJSON

func (r V2ContractEditParamsAddOverride) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddOverride) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsAddOverride) UnmarshalJSON(data []byte) error

type V2ContractEditParamsAddOverrideOverrideSpecifier added in v1.0.0

type V2ContractEditParamsAddOverrideOverrideSpecifier struct {
	// If provided, the override will only apply to the product with the specified ID.
	ProductID param.Opt[string] `json:"product_id,omitzero" format:"uuid"`
	// Any of "MONTHLY", "QUARTERLY", "ANNUAL", "WEEKLY".
	BillingFrequency string `json:"billing_frequency,omitzero"`
	// If provided, the override will only apply to the specified commits. Can only be
	// used for commit specific overrides. If not provided, the override will apply to
	// all commits.
	CommitIDs []string `json:"commit_ids,omitzero"`
	// A map of group names to values. The override will only apply to line items with
	// the specified presentation group values. Can only be used for multiplier
	// overrides.
	PresentationGroupValues map[string]string `json:"presentation_group_values,omitzero"`
	// A map of pricing group names to values. The override will only apply to products
	// with the specified pricing group values.
	PricingGroupValues map[string]string `json:"pricing_group_values,omitzero"`
	// If provided, the override will only apply to products with all the specified
	// tags.
	ProductTags []string `json:"product_tags,omitzero"`
	// Can only be used for commit specific overrides. Must be used in conjunction with
	// one of product_id, product_tags, pricing_group_values, or
	// presentation_group_values. If provided, the override will only apply to commits
	// created by the specified recurring commit ids.
	RecurringCommitIDs []string `json:"recurring_commit_ids,omitzero"`
	// Can only be used for commit specific overrides. Must be used in conjunction with
	// one of product_id, product_tags, pricing_group_values, or
	// presentation_group_values. If provided, the override will only apply to commits
	// created by the specified recurring credit ids.
	RecurringCreditIDs []string `json:"recurring_credit_ids,omitzero"`
	// contains filtered or unexported fields
}

func (V2ContractEditParamsAddOverrideOverrideSpecifier) MarshalJSON added in v1.0.0

func (r V2ContractEditParamsAddOverrideOverrideSpecifier) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddOverrideOverrideSpecifier) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddOverrideOverwriteRate added in v1.0.0

type V2ContractEditParamsAddOverrideOverwriteRate struct {
	// Any of "FLAT", "PERCENTAGE", "SUBSCRIPTION", "TIERED", "CUSTOM".
	RateType     string            `json:"rate_type,omitzero,required"`
	CreditTypeID param.Opt[string] `json:"credit_type_id,omitzero" format:"uuid"`
	// Default proration configuration. Only valid for SUBSCRIPTION rate_type. Must be
	// set to true.
	IsProrated param.Opt[bool] `json:"is_prorated,omitzero"`
	// Default price. For FLAT rate_type, this must be >=0. For PERCENTAGE rate_type,
	// this is a decimal fraction, e.g. use 0.1 for 10%; this must be >=0 and <=1.
	Price param.Opt[float64] `json:"price,omitzero"`
	// Default quantity. For SUBSCRIPTION rate_type, this must be >=0.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Only set for CUSTOM rate_type. This field is interpreted by custom rate
	// processors.
	CustomRate map[string]any `json:"custom_rate,omitzero"`
	// Only set for TIERED rate_type.
	Tiers []shared.TierParam `json:"tiers,omitzero"`
	// contains filtered or unexported fields
}

Required for OVERWRITE type.

The property RateType is required.

func (V2ContractEditParamsAddOverrideOverwriteRate) MarshalJSON added in v1.0.0

func (r V2ContractEditParamsAddOverrideOverwriteRate) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddOverrideOverwriteRate) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsAddOverrideOverwriteRate) UnmarshalJSON(data []byte) error

type V2ContractEditParamsAddOverrideTier added in v1.0.0

type V2ContractEditParamsAddOverrideTier struct {
	Multiplier float64            `json:"multiplier,required"`
	Size       param.Opt[float64] `json:"size,omitzero"`
	// contains filtered or unexported fields
}

The property Multiplier is required.

func (V2ContractEditParamsAddOverrideTier) MarshalJSON added in v1.0.0

func (r V2ContractEditParamsAddOverrideTier) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddOverrideTier) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsAddOverrideTier) UnmarshalJSON(data []byte) error

type V2ContractEditParamsAddProfessionalService

type V2ContractEditParamsAddProfessionalService struct {
	// Maximum amount for the term.
	MaxAmount float64 `json:"max_amount,required"`
	ProductID string  `json:"product_id,required" format:"uuid"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount.
	Quantity float64 `json:"quantity,required"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified.
	UnitPrice   float64           `json:"unit_price,required"`
	Description param.Opt[string] `json:"description,omitzero"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Opt[string] `json:"netsuite_sales_order_id,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// contains filtered or unexported fields
}

The properties MaxAmount, ProductID, Quantity, UnitPrice are required.

func (V2ContractEditParamsAddProfessionalService) MarshalJSON

func (r V2ContractEditParamsAddProfessionalService) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddProfessionalService) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsAddProfessionalService) UnmarshalJSON(data []byte) error

type V2ContractEditParamsAddRecurringCommit

type V2ContractEditParamsAddRecurringCommit struct {
	// The amount of commit to grant.
	AccessAmount V2ContractEditParamsAddRecurringCommitAccessAmount `json:"access_amount,omitzero,required"`
	// Defines the length of the access schedule for each created commit/credit. The
	// value represents the number of units. Unit defaults to "PERIODS", where the
	// length of a period is determined by the recurrence_frequency.
	CommitDuration V2ContractEditParamsAddRecurringCommitCommitDuration `json:"commit_duration,omitzero,required"`
	// Will be passed down to the individual commits
	Priority  float64 `json:"priority,required"`
	ProductID string  `json:"product_id,required" format:"uuid"`
	// determines the start time for the first commit
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// Will be passed down to the individual commits
	Description param.Opt[string] `json:"description,omitzero"`
	// Determines when the contract will stop creating recurring commits. optional
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	// displayed on invoices. will be passed through to the individual commits
	Name param.Opt[string] `json:"name,omitzero"`
	// Will be passed down to the individual commits
	NetsuiteSalesOrderID param.Opt[string] `json:"netsuite_sales_order_id,omitzero"`
	// Will be passed down to the individual commits. This controls how much of an
	// individual unexpired commit will roll over upon contract transition. Must be
	// between 0 and 1.
	RolloverFraction param.Opt[float64] `json:"rollover_fraction,omitzero"`
	// A temporary ID that can be used to reference the recurring commit for commit
	// specific overrides.
	TemporaryID param.Opt[string] `json:"temporary_id,omitzero"`
	// Will be passed down to the individual commits
	ApplicableProductIDs []string `json:"applicable_product_ids,omitzero" format:"uuid"`
	// Will be passed down to the individual commits
	ApplicableProductTags []string `json:"applicable_product_tags,omitzero"`
	// Optional configuration for recurring credit hierarchy access control
	HierarchyConfiguration shared.CommitHierarchyConfigurationParam `json:"hierarchy_configuration,omitzero"`
	// The amount the customer should be billed for the commit. Not required.
	InvoiceAmount V2ContractEditParamsAddRecurringCommitInvoiceAmount `json:"invoice_amount,omitzero"`
	// Determines whether the first and last commit will be prorated. If not provided,
	// the default is FIRST_AND_LAST (i.e. prorate both the first and last commits).
	//
	// Any of "NONE", "FIRST", "LAST", "FIRST_AND_LAST".
	Proration string `json:"proration,omitzero"`
	// Whether the created commits will use the commit rate or list rate
	//
	// Any of "COMMIT_RATE", "LIST_RATE".
	RateType string `json:"rate_type,omitzero"`
	// The frequency at which the recurring commits will be created. If not provided: -
	// The commits will be created on the usage invoice frequency. If provided: - The
	// period defined in the duration will correspond to this frequency. - Commits will
	// be created aligned with the recurring commit's starting_at rather than the usage
	// invoice dates.
	//
	// Any of "MONTHLY", "QUARTERLY", "ANNUAL", "WEEKLY".
	RecurrenceFrequency string `json:"recurrence_frequency,omitzero"`
	// List of filters that determine what kind of customer usage draws down a commit
	// or credit. A customer's usage needs to meet the condition of at least one of the
	// specifiers to contribute to a commit's or credit's drawdown. This field cannot
	// be used together with `applicable_product_ids` or `applicable_product_tags`.
	// Instead, to target usage by product or product tag, pass those values in the
	// body of `specifiers`.
	Specifiers []shared.CommitSpecifierInputParam `json:"specifiers,omitzero"`
	// Attach a subscription to the recurring commit/credit.
	SubscriptionConfig V2ContractEditParamsAddRecurringCommitSubscriptionConfig `json:"subscription_config,omitzero"`
	// contains filtered or unexported fields
}

The properties AccessAmount, CommitDuration, Priority, ProductID, StartingAt are required.

func (V2ContractEditParamsAddRecurringCommit) MarshalJSON

func (r V2ContractEditParamsAddRecurringCommit) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddRecurringCommit) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsAddRecurringCommit) UnmarshalJSON(data []byte) error

type V2ContractEditParamsAddRecurringCommitAccessAmount added in v1.0.0

type V2ContractEditParamsAddRecurringCommitAccessAmount struct {
	CreditTypeID string  `json:"credit_type_id,required" format:"uuid"`
	UnitPrice    float64 `json:"unit_price,required"`
	// This field is required unless a subscription is attached via
	// `subscription_config`.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// contains filtered or unexported fields
}

The amount of commit to grant.

The properties CreditTypeID, UnitPrice are required.

func (V2ContractEditParamsAddRecurringCommitAccessAmount) MarshalJSON added in v1.0.0

func (r V2ContractEditParamsAddRecurringCommitAccessAmount) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddRecurringCommitAccessAmount) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddRecurringCommitCommitDuration added in v1.0.0

type V2ContractEditParamsAddRecurringCommitCommitDuration struct {
	Value float64 `json:"value,required"`
	// Any of "PERIODS".
	Unit string `json:"unit,omitzero"`
	// contains filtered or unexported fields
}

Defines the length of the access schedule for each created commit/credit. The value represents the number of units. Unit defaults to "PERIODS", where the length of a period is determined by the recurrence_frequency.

The property Value is required.

func (V2ContractEditParamsAddRecurringCommitCommitDuration) MarshalJSON added in v1.0.0

func (r V2ContractEditParamsAddRecurringCommitCommitDuration) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddRecurringCommitCommitDuration) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddRecurringCommitInvoiceAmount added in v1.0.0

type V2ContractEditParamsAddRecurringCommitInvoiceAmount struct {
	CreditTypeID string  `json:"credit_type_id,required" format:"uuid"`
	Quantity     float64 `json:"quantity,required"`
	UnitPrice    float64 `json:"unit_price,required"`
	// contains filtered or unexported fields
}

The amount the customer should be billed for the commit. Not required.

The properties CreditTypeID, Quantity, UnitPrice are required.

func (V2ContractEditParamsAddRecurringCommitInvoiceAmount) MarshalJSON added in v1.0.0

func (r V2ContractEditParamsAddRecurringCommitInvoiceAmount) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddRecurringCommitInvoiceAmount) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddRecurringCommitSubscriptionConfig added in v1.0.0

type V2ContractEditParamsAddRecurringCommitSubscriptionConfig struct {
	ApplySeatIncreaseConfig V2ContractEditParamsAddRecurringCommitSubscriptionConfigApplySeatIncreaseConfig `json:"apply_seat_increase_config,omitzero,required"`
	// ID of the subscription to configure on the recurring commit/credit.
	SubscriptionID string `json:"subscription_id,required"`
	// If set to POOLED, allocation added per seat is pooled across the account.
	//
	// Any of "POOLED", "INDIVIDUAL".
	Allocation string `json:"allocation,omitzero"`
	// contains filtered or unexported fields
}

Attach a subscription to the recurring commit/credit.

The properties ApplySeatIncreaseConfig, SubscriptionID are required.

func (V2ContractEditParamsAddRecurringCommitSubscriptionConfig) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsAddRecurringCommitSubscriptionConfig) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddRecurringCommitSubscriptionConfigApplySeatIncreaseConfig added in v1.0.0

type V2ContractEditParamsAddRecurringCommitSubscriptionConfigApplySeatIncreaseConfig struct {
	// Indicates whether a mid-period seat increase should be prorated.
	IsProrated bool `json:"is_prorated,required"`
	// contains filtered or unexported fields
}

The property IsProrated is required.

func (V2ContractEditParamsAddRecurringCommitSubscriptionConfigApplySeatIncreaseConfig) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsAddRecurringCommitSubscriptionConfigApplySeatIncreaseConfig) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddRecurringCredit

type V2ContractEditParamsAddRecurringCredit struct {
	// The amount of commit to grant.
	AccessAmount V2ContractEditParamsAddRecurringCreditAccessAmount `json:"access_amount,omitzero,required"`
	// Defines the length of the access schedule for each created commit/credit. The
	// value represents the number of units. Unit defaults to "PERIODS", where the
	// length of a period is determined by the recurrence_frequency.
	CommitDuration V2ContractEditParamsAddRecurringCreditCommitDuration `json:"commit_duration,omitzero,required"`
	// Will be passed down to the individual commits
	Priority  float64 `json:"priority,required"`
	ProductID string  `json:"product_id,required" format:"uuid"`
	// determines the start time for the first commit
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// Will be passed down to the individual commits
	Description param.Opt[string] `json:"description,omitzero"`
	// Determines when the contract will stop creating recurring commits. optional
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	// displayed on invoices. will be passed through to the individual commits
	Name param.Opt[string] `json:"name,omitzero"`
	// Will be passed down to the individual commits
	NetsuiteSalesOrderID param.Opt[string] `json:"netsuite_sales_order_id,omitzero"`
	// Will be passed down to the individual commits. This controls how much of an
	// individual unexpired commit will roll over upon contract transition. Must be
	// between 0 and 1.
	RolloverFraction param.Opt[float64] `json:"rollover_fraction,omitzero"`
	// A temporary ID that can be used to reference the recurring commit for commit
	// specific overrides.
	TemporaryID param.Opt[string] `json:"temporary_id,omitzero"`
	// Will be passed down to the individual commits
	ApplicableProductIDs []string `json:"applicable_product_ids,omitzero" format:"uuid"`
	// Will be passed down to the individual commits
	ApplicableProductTags []string `json:"applicable_product_tags,omitzero"`
	// Optional configuration for recurring credit hierarchy access control
	HierarchyConfiguration shared.CommitHierarchyConfigurationParam `json:"hierarchy_configuration,omitzero"`
	// Determines whether the first and last commit will be prorated. If not provided,
	// the default is FIRST_AND_LAST (i.e. prorate both the first and last commits).
	//
	// Any of "NONE", "FIRST", "LAST", "FIRST_AND_LAST".
	Proration string `json:"proration,omitzero"`
	// Whether the created commits will use the commit rate or list rate
	//
	// Any of "COMMIT_RATE", "LIST_RATE".
	RateType string `json:"rate_type,omitzero"`
	// The frequency at which the recurring commits will be created. If not provided: -
	// The commits will be created on the usage invoice frequency. If provided: - The
	// period defined in the duration will correspond to this frequency. - Commits will
	// be created aligned with the recurring commit's starting_at rather than the usage
	// invoice dates.
	//
	// Any of "MONTHLY", "QUARTERLY", "ANNUAL", "WEEKLY".
	RecurrenceFrequency string `json:"recurrence_frequency,omitzero"`
	// List of filters that determine what kind of customer usage draws down a commit
	// or credit. A customer's usage needs to meet the condition of at least one of the
	// specifiers to contribute to a commit's or credit's drawdown. This field cannot
	// be used together with `applicable_product_ids` or `applicable_product_tags`.
	// Instead, to target usage by product or product tag, pass those values in the
	// body of `specifiers`.
	Specifiers []shared.CommitSpecifierInputParam `json:"specifiers,omitzero"`
	// Attach a subscription to the recurring commit/credit.
	SubscriptionConfig V2ContractEditParamsAddRecurringCreditSubscriptionConfig `json:"subscription_config,omitzero"`
	// contains filtered or unexported fields
}

The properties AccessAmount, CommitDuration, Priority, ProductID, StartingAt are required.

func (V2ContractEditParamsAddRecurringCredit) MarshalJSON

func (r V2ContractEditParamsAddRecurringCredit) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddRecurringCredit) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsAddRecurringCredit) UnmarshalJSON(data []byte) error

type V2ContractEditParamsAddRecurringCreditAccessAmount added in v1.0.0

type V2ContractEditParamsAddRecurringCreditAccessAmount struct {
	CreditTypeID string  `json:"credit_type_id,required" format:"uuid"`
	UnitPrice    float64 `json:"unit_price,required"`
	// This field is required unless a subscription is attached via
	// `subscription_config`.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// contains filtered or unexported fields
}

The amount of commit to grant.

The properties CreditTypeID, UnitPrice are required.

func (V2ContractEditParamsAddRecurringCreditAccessAmount) MarshalJSON added in v1.0.0

func (r V2ContractEditParamsAddRecurringCreditAccessAmount) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddRecurringCreditAccessAmount) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddRecurringCreditCommitDuration added in v1.0.0

type V2ContractEditParamsAddRecurringCreditCommitDuration struct {
	Value float64 `json:"value,required"`
	// Any of "PERIODS".
	Unit string `json:"unit,omitzero"`
	// contains filtered or unexported fields
}

Defines the length of the access schedule for each created commit/credit. The value represents the number of units. Unit defaults to "PERIODS", where the length of a period is determined by the recurrence_frequency.

The property Value is required.

func (V2ContractEditParamsAddRecurringCreditCommitDuration) MarshalJSON added in v1.0.0

func (r V2ContractEditParamsAddRecurringCreditCommitDuration) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddRecurringCreditCommitDuration) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddRecurringCreditSubscriptionConfig added in v1.0.0

type V2ContractEditParamsAddRecurringCreditSubscriptionConfig struct {
	ApplySeatIncreaseConfig V2ContractEditParamsAddRecurringCreditSubscriptionConfigApplySeatIncreaseConfig `json:"apply_seat_increase_config,omitzero,required"`
	// ID of the subscription to configure on the recurring commit/credit.
	SubscriptionID string `json:"subscription_id,required"`
	// If set to POOLED, allocation added per seat is pooled across the account.
	//
	// Any of "POOLED", "INDIVIDUAL".
	Allocation string `json:"allocation,omitzero"`
	// contains filtered or unexported fields
}

Attach a subscription to the recurring commit/credit.

The properties ApplySeatIncreaseConfig, SubscriptionID are required.

func (V2ContractEditParamsAddRecurringCreditSubscriptionConfig) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsAddRecurringCreditSubscriptionConfig) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddRecurringCreditSubscriptionConfigApplySeatIncreaseConfig added in v1.0.0

type V2ContractEditParamsAddRecurringCreditSubscriptionConfigApplySeatIncreaseConfig struct {
	// Indicates whether a mid-period seat increase should be prorated.
	IsProrated bool `json:"is_prorated,required"`
	// contains filtered or unexported fields
}

The property IsProrated is required.

func (V2ContractEditParamsAddRecurringCreditSubscriptionConfigApplySeatIncreaseConfig) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsAddRecurringCreditSubscriptionConfigApplySeatIncreaseConfig) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddResellerRoyalty

type V2ContractEditParamsAddResellerRoyalty struct {
	// Any of "AWS", "AWS_PRO_SERVICE", "GCP", "GCP_PRO_SERVICE".
	ResellerType string `json:"reseller_type,omitzero,required"`
	// Use null to indicate that the existing end timestamp should be removed.
	EndingBefore          param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	Fraction              param.Opt[float64]   `json:"fraction,omitzero"`
	NetsuiteResellerID    param.Opt[string]    `json:"netsuite_reseller_id,omitzero"`
	ResellerContractValue param.Opt[float64]   `json:"reseller_contract_value,omitzero"`
	StartingAt            param.Opt[time.Time] `json:"starting_at,omitzero" format:"date-time"`
	// Must provide at least one of applicable_product_ids or applicable_product_tags.
	ApplicableProductIDs []string `json:"applicable_product_ids,omitzero" format:"uuid"`
	// Must provide at least one of applicable_product_ids or applicable_product_tags.
	ApplicableProductTags []string                                         `json:"applicable_product_tags,omitzero"`
	AwsOptions            V2ContractEditParamsAddResellerRoyaltyAwsOptions `json:"aws_options,omitzero"`
	GcpOptions            V2ContractEditParamsAddResellerRoyaltyGcpOptions `json:"gcp_options,omitzero"`
	// contains filtered or unexported fields
}

The property ResellerType is required.

func (V2ContractEditParamsAddResellerRoyalty) MarshalJSON

func (r V2ContractEditParamsAddResellerRoyalty) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddResellerRoyalty) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsAddResellerRoyalty) UnmarshalJSON(data []byte) error

type V2ContractEditParamsAddResellerRoyaltyAwsOptions added in v1.0.0

type V2ContractEditParamsAddResellerRoyaltyAwsOptions struct {
	AwsAccountNumber    param.Opt[string] `json:"aws_account_number,omitzero"`
	AwsOfferID          param.Opt[string] `json:"aws_offer_id,omitzero"`
	AwsPayerReferenceID param.Opt[string] `json:"aws_payer_reference_id,omitzero"`
	// contains filtered or unexported fields
}

func (V2ContractEditParamsAddResellerRoyaltyAwsOptions) MarshalJSON added in v1.0.0

func (r V2ContractEditParamsAddResellerRoyaltyAwsOptions) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddResellerRoyaltyAwsOptions) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddResellerRoyaltyGcpOptions added in v1.0.0

type V2ContractEditParamsAddResellerRoyaltyGcpOptions struct {
	GcpAccountID param.Opt[string] `json:"gcp_account_id,omitzero"`
	GcpOfferID   param.Opt[string] `json:"gcp_offer_id,omitzero"`
	// contains filtered or unexported fields
}

func (V2ContractEditParamsAddResellerRoyaltyGcpOptions) MarshalJSON added in v1.0.0

func (r V2ContractEditParamsAddResellerRoyaltyGcpOptions) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddResellerRoyaltyGcpOptions) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddScheduledCharge

type V2ContractEditParamsAddScheduledCharge struct {
	ProductID string `json:"product_id,required" format:"uuid"`
	// Must provide either schedule_items or recurring_schedule.
	Schedule V2ContractEditParamsAddScheduledChargeSchedule `json:"schedule,omitzero,required"`
	// displayed on invoices
	Name param.Opt[string] `json:"name,omitzero"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Opt[string] `json:"netsuite_sales_order_id,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// contains filtered or unexported fields
}

The properties ProductID, Schedule are required.

func (V2ContractEditParamsAddScheduledCharge) MarshalJSON

func (r V2ContractEditParamsAddScheduledCharge) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddScheduledCharge) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsAddScheduledCharge) UnmarshalJSON(data []byte) error

type V2ContractEditParamsAddScheduledChargeSchedule added in v1.0.0

type V2ContractEditParamsAddScheduledChargeSchedule struct {
	// Defaults to USD (cents) if not passed.
	CreditTypeID param.Opt[string] `json:"credit_type_id,omitzero" format:"uuid"`
	// This field is only applicable to commit invoice schedules. If true, this
	// schedule will not generate an invoice.
	DoNotInvoice param.Opt[bool] `json:"do_not_invoice,omitzero"`
	// Enter the unit price and quantity for the charge or instead only send the
	// amount. If amount is sent, the unit price is assumed to be the amount and
	// quantity is inferred to be 1.
	RecurringSchedule V2ContractEditParamsAddScheduledChargeScheduleRecurringSchedule `json:"recurring_schedule,omitzero"`
	// Either provide amount or provide both unit_price and quantity.
	ScheduleItems []V2ContractEditParamsAddScheduledChargeScheduleScheduleItem `json:"schedule_items,omitzero"`
	// contains filtered or unexported fields
}

Must provide either schedule_items or recurring_schedule.

func (V2ContractEditParamsAddScheduledChargeSchedule) MarshalJSON added in v1.0.0

func (r V2ContractEditParamsAddScheduledChargeSchedule) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddScheduledChargeSchedule) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddScheduledChargeScheduleRecurringSchedule added in v1.0.0

type V2ContractEditParamsAddScheduledChargeScheduleRecurringSchedule struct {
	// Any of "DIVIDED", "DIVIDED_ROUNDED", "EACH".
	AmountDistribution string `json:"amount_distribution,omitzero,required"`
	// RFC 3339 timestamp (exclusive).
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	// Any of "MONTHLY", "QUARTERLY", "SEMI_ANNUAL", "ANNUAL", "WEEKLY".
	Frequency string `json:"frequency,omitzero,required"`
	// RFC 3339 timestamp (inclusive).
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// Amount for the charge. Can be provided instead of unit_price and quantity. If
	// amount is sent, the unit_price is assumed to be the amount and quantity is
	// inferred to be 1.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount and must be specified with unit_price. If specified amount cannot be
	// provided.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified with quantity. If specified amount cannot be
	// provided.
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

Enter the unit price and quantity for the charge or instead only send the amount. If amount is sent, the unit price is assumed to be the amount and quantity is inferred to be 1.

The properties AmountDistribution, EndingBefore, Frequency, StartingAt are required.

func (V2ContractEditParamsAddScheduledChargeScheduleRecurringSchedule) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsAddScheduledChargeScheduleRecurringSchedule) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddScheduledChargeScheduleScheduleItem added in v1.0.0

type V2ContractEditParamsAddScheduledChargeScheduleScheduleItem struct {
	// timestamp of the scheduled event
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// Amount for the charge. Can be provided instead of unit_price and quantity. If
	// amount is sent, the unit_price is assumed to be the amount and quantity is
	// inferred to be 1.
	Amount param.Opt[float64] `json:"amount,omitzero"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount and must be specified with unit_price. If specified amount cannot be
	// provided.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified with quantity. If specified amount cannot be
	// provided.
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

The property Timestamp is required.

func (V2ContractEditParamsAddScheduledChargeScheduleScheduleItem) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsAddScheduledChargeScheduleScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsAddSubscription

type V2ContractEditParamsAddSubscription struct {
	// Any of "ADVANCE", "ARREARS".
	CollectionSchedule string                                              `json:"collection_schedule,omitzero,required"`
	Proration          V2ContractEditParamsAddSubscriptionProration        `json:"proration,omitzero,required"`
	SubscriptionRate   V2ContractEditParamsAddSubscriptionSubscriptionRate `json:"subscription_rate,omitzero,required"`
	Description        param.Opt[string]                                   `json:"description,omitzero"`
	// Exclusive end time for the subscription. If not provided, subscription inherits
	// contract end date.
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	// The initial quantity for the subscription. It must be non-negative value.
	// Required if quantity_management_mode is QUANTITY_ONLY.
	InitialQuantity param.Opt[float64] `json:"initial_quantity,omitzero"`
	Name            param.Opt[string]  `json:"name,omitzero"`
	// Inclusive start time for the subscription. If not provided, defaults to contract
	// start date
	StartingAt param.Opt[time.Time] `json:"starting_at,omitzero" format:"date-time"`
	// A temporary ID used to reference the subscription in recurring commit/credit
	// subscription configs created within the same payload.
	TemporaryID param.Opt[string] `json:"temporary_id,omitzero"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields map[string]string `json:"custom_fields,omitzero"`
	// Determines how the subscription's quantity is controlled. Defaults to
	// QUANTITY_ONLY. **QUANTITY_ONLY**: The subscription quantity is specified
	// directly on the subscription. `initial_quantity` must be provided with this
	// option. Compatible with recurring commits/credits that use POOLED allocation.
	//
	// Any of "SEAT_BASED", "QUANTITY_ONLY".
	QuantityManagementMode string `json:"quantity_management_mode,omitzero"`
	// contains filtered or unexported fields
}

The properties CollectionSchedule, Proration, SubscriptionRate are required.

func (V2ContractEditParamsAddSubscription) MarshalJSON

func (r V2ContractEditParamsAddSubscription) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddSubscription) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsAddSubscription) UnmarshalJSON(data []byte) error

type V2ContractEditParamsAddSubscriptionProration added in v1.0.0

type V2ContractEditParamsAddSubscriptionProration struct {
	// Indicates if the partial period will be prorated or charged a full amount.
	IsProrated param.Opt[bool] `json:"is_prorated,omitzero"`
	// Indicates how mid-period quantity adjustments are invoiced.
	// **BILL_IMMEDIATELY**: Only available when collection schedule is `ADVANCE`. The
	// quantity increase will be billed immediately on the scheduled date.
	// **BILL_ON_NEXT_COLLECTION_DATE**: The quantity increase will be billed for
	// in-arrears at the end of the period.
	//
	// Any of "BILL_IMMEDIATELY", "BILL_ON_NEXT_COLLECTION_DATE".
	InvoiceBehavior string `json:"invoice_behavior,omitzero"`
	// contains filtered or unexported fields
}

func (V2ContractEditParamsAddSubscriptionProration) MarshalJSON added in v1.0.0

func (r V2ContractEditParamsAddSubscriptionProration) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddSubscriptionProration) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsAddSubscriptionProration) UnmarshalJSON(data []byte) error

type V2ContractEditParamsAddSubscriptionSubscriptionRate added in v1.0.0

type V2ContractEditParamsAddSubscriptionSubscriptionRate struct {
	// Frequency to bill subscription with. Together with product_id, must match
	// existing rate on the rate card.
	//
	// Any of "MONTHLY", "QUARTERLY", "ANNUAL", "WEEKLY".
	BillingFrequency string `json:"billing_frequency,omitzero,required"`
	// Must be subscription type product
	ProductID string `json:"product_id,required" format:"uuid"`
	// contains filtered or unexported fields
}

The properties BillingFrequency, ProductID are required.

func (V2ContractEditParamsAddSubscriptionSubscriptionRate) MarshalJSON added in v1.0.0

func (r V2ContractEditParamsAddSubscriptionSubscriptionRate) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsAddSubscriptionSubscriptionRate) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsArchiveCommit

type V2ContractEditParamsArchiveCommit struct {
	ID string `json:"id,required" format:"uuid"`
	// contains filtered or unexported fields
}

The property ID is required.

func (V2ContractEditParamsArchiveCommit) MarshalJSON

func (r V2ContractEditParamsArchiveCommit) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsArchiveCommit) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsArchiveCommit) UnmarshalJSON(data []byte) error

type V2ContractEditParamsArchiveCredit

type V2ContractEditParamsArchiveCredit struct {
	ID string `json:"id,required" format:"uuid"`
	// contains filtered or unexported fields
}

The property ID is required.

func (V2ContractEditParamsArchiveCredit) MarshalJSON

func (r V2ContractEditParamsArchiveCredit) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsArchiveCredit) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsArchiveCredit) UnmarshalJSON(data []byte) error

type V2ContractEditParamsArchiveScheduledCharge

type V2ContractEditParamsArchiveScheduledCharge struct {
	ID string `json:"id,required" format:"uuid"`
	// contains filtered or unexported fields
}

The property ID is required.

func (V2ContractEditParamsArchiveScheduledCharge) MarshalJSON

func (r V2ContractEditParamsArchiveScheduledCharge) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsArchiveScheduledCharge) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsArchiveScheduledCharge) UnmarshalJSON(data []byte) error

type V2ContractEditParamsRemoveOverride

type V2ContractEditParamsRemoveOverride struct {
	ID string `json:"id,required" format:"uuid"`
	// contains filtered or unexported fields
}

The property ID is required.

func (V2ContractEditParamsRemoveOverride) MarshalJSON

func (r V2ContractEditParamsRemoveOverride) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsRemoveOverride) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsRemoveOverride) UnmarshalJSON(data []byte) error

type V2ContractEditParamsUpdateCommit

type V2ContractEditParamsUpdateCommit struct {
	CommitID             string             `json:"commit_id,required" format:"uuid"`
	NetsuiteSalesOrderID param.Opt[string]  `json:"netsuite_sales_order_id,omitzero"`
	Priority             param.Opt[float64] `json:"priority,omitzero"`
	RolloverFraction     param.Opt[float64] `json:"rollover_fraction,omitzero"`
	ProductID            param.Opt[string]  `json:"product_id,omitzero" format:"uuid"`
	// Which products the commit applies to. If applicable_product_ids,
	// applicable_product_tags or specifiers are not provided, the commit applies to
	// all products.
	ApplicableProductIDs []string `json:"applicable_product_ids,omitzero" format:"uuid"`
	// Which tags the commit applies to. If applicable_product_ids,
	// applicable_product_tags or specifiers are not provided, the commit applies to
	// all products.
	ApplicableProductTags []string                                       `json:"applicable_product_tags,omitzero"`
	AccessSchedule        V2ContractEditParamsUpdateCommitAccessSchedule `json:"access_schedule,omitzero"`
	// Optional configuration for commit hierarchy access control
	HierarchyConfiguration shared.CommitHierarchyConfigurationParam        `json:"hierarchy_configuration,omitzero"`
	InvoiceSchedule        V2ContractEditParamsUpdateCommitInvoiceSchedule `json:"invoice_schedule,omitzero"`
	// If provided, updates the commit to use the specified rate type for current and
	// future invoices. Previously finalized invoices will need to be voided and
	// regenerated to reflect the rate type change.
	//
	// Any of "LIST_RATE", "COMMIT_RATE".
	RateType string `json:"rate_type,omitzero"`
	// contains filtered or unexported fields
}

The property CommitID is required.

func (V2ContractEditParamsUpdateCommit) MarshalJSON

func (r V2ContractEditParamsUpdateCommit) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsUpdateCommit) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsUpdateCommit) UnmarshalJSON(data []byte) error

type V2ContractEditParamsUpdateCommitAccessSchedule added in v1.0.0

type V2ContractEditParamsUpdateCommitAccessSchedule struct {
	AddScheduleItems    []V2ContractEditParamsUpdateCommitAccessScheduleAddScheduleItem    `json:"add_schedule_items,omitzero"`
	RemoveScheduleItems []V2ContractEditParamsUpdateCommitAccessScheduleRemoveScheduleItem `json:"remove_schedule_items,omitzero"`
	UpdateScheduleItems []V2ContractEditParamsUpdateCommitAccessScheduleUpdateScheduleItem `json:"update_schedule_items,omitzero"`
	// contains filtered or unexported fields
}

func (V2ContractEditParamsUpdateCommitAccessSchedule) MarshalJSON added in v1.0.0

func (r V2ContractEditParamsUpdateCommitAccessSchedule) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsUpdateCommitAccessSchedule) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsUpdateCommitAccessScheduleAddScheduleItem added in v1.0.0

type V2ContractEditParamsUpdateCommitAccessScheduleAddScheduleItem struct {
	Amount       float64   `json:"amount,required"`
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	StartingAt   time.Time `json:"starting_at,required" format:"date-time"`
	// contains filtered or unexported fields
}

The properties Amount, EndingBefore, StartingAt are required.

func (V2ContractEditParamsUpdateCommitAccessScheduleAddScheduleItem) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsUpdateCommitAccessScheduleAddScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsUpdateCommitAccessScheduleRemoveScheduleItem added in v1.0.0

type V2ContractEditParamsUpdateCommitAccessScheduleRemoveScheduleItem struct {
	ID string `json:"id,required" format:"uuid"`
	// contains filtered or unexported fields
}

The property ID is required.

func (V2ContractEditParamsUpdateCommitAccessScheduleRemoveScheduleItem) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsUpdateCommitAccessScheduleRemoveScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsUpdateCommitAccessScheduleUpdateScheduleItem added in v1.0.0

type V2ContractEditParamsUpdateCommitAccessScheduleUpdateScheduleItem struct {
	ID           string               `json:"id,required" format:"uuid"`
	Amount       param.Opt[float64]   `json:"amount,omitzero"`
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	StartingAt   param.Opt[time.Time] `json:"starting_at,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

The property ID is required.

func (V2ContractEditParamsUpdateCommitAccessScheduleUpdateScheduleItem) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsUpdateCommitAccessScheduleUpdateScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsUpdateCommitInvoiceSchedule added in v1.0.0

type V2ContractEditParamsUpdateCommitInvoiceSchedule struct {
	AddScheduleItems    []V2ContractEditParamsUpdateCommitInvoiceScheduleAddScheduleItem    `json:"add_schedule_items,omitzero"`
	RemoveScheduleItems []V2ContractEditParamsUpdateCommitInvoiceScheduleRemoveScheduleItem `json:"remove_schedule_items,omitzero"`
	UpdateScheduleItems []V2ContractEditParamsUpdateCommitInvoiceScheduleUpdateScheduleItem `json:"update_schedule_items,omitzero"`
	// contains filtered or unexported fields
}

func (V2ContractEditParamsUpdateCommitInvoiceSchedule) MarshalJSON added in v1.0.0

func (r V2ContractEditParamsUpdateCommitInvoiceSchedule) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsUpdateCommitInvoiceSchedule) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsUpdateCommitInvoiceScheduleAddScheduleItem added in v1.0.0

type V2ContractEditParamsUpdateCommitInvoiceScheduleAddScheduleItem struct {
	Timestamp time.Time          `json:"timestamp,required" format:"date-time"`
	Amount    param.Opt[float64] `json:"amount,omitzero"`
	Quantity  param.Opt[float64] `json:"quantity,omitzero"`
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

The property Timestamp is required.

func (V2ContractEditParamsUpdateCommitInvoiceScheduleAddScheduleItem) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsUpdateCommitInvoiceScheduleAddScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsUpdateCommitInvoiceScheduleRemoveScheduleItem added in v1.0.0

type V2ContractEditParamsUpdateCommitInvoiceScheduleRemoveScheduleItem struct {
	ID string `json:"id,required" format:"uuid"`
	// contains filtered or unexported fields
}

The property ID is required.

func (V2ContractEditParamsUpdateCommitInvoiceScheduleRemoveScheduleItem) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsUpdateCommitInvoiceScheduleRemoveScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsUpdateCommitInvoiceScheduleUpdateScheduleItem added in v1.0.0

type V2ContractEditParamsUpdateCommitInvoiceScheduleUpdateScheduleItem struct {
	ID        string               `json:"id,required" format:"uuid"`
	Amount    param.Opt[float64]   `json:"amount,omitzero"`
	Quantity  param.Opt[float64]   `json:"quantity,omitzero"`
	Timestamp param.Opt[time.Time] `json:"timestamp,omitzero" format:"date-time"`
	UnitPrice param.Opt[float64]   `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

The property ID is required.

func (V2ContractEditParamsUpdateCommitInvoiceScheduleUpdateScheduleItem) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsUpdateCommitInvoiceScheduleUpdateScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsUpdateCredit

type V2ContractEditParamsUpdateCredit struct {
	CreditID             string             `json:"credit_id,required" format:"uuid"`
	NetsuiteSalesOrderID param.Opt[string]  `json:"netsuite_sales_order_id,omitzero"`
	Priority             param.Opt[float64] `json:"priority,omitzero"`
	ProductID            param.Opt[string]  `json:"product_id,omitzero" format:"uuid"`
	// Which products the commit applies to. If applicable_product_ids,
	// applicable_product_tags or specifiers are not provided, the commit applies to
	// all products.
	ApplicableProductIDs []string `json:"applicable_product_ids,omitzero" format:"uuid"`
	// Which tags the commit applies to. If applicable_product_ids,
	// applicable_product_tags or specifiers are not provided, the commit applies to
	// all products.
	ApplicableProductTags []string                                       `json:"applicable_product_tags,omitzero"`
	AccessSchedule        V2ContractEditParamsUpdateCreditAccessSchedule `json:"access_schedule,omitzero"`
	// Optional configuration for commit hierarchy access control
	HierarchyConfiguration shared.CommitHierarchyConfigurationParam `json:"hierarchy_configuration,omitzero"`
	// If provided, updates the credit to use the specified rate type for current and
	// future invoices. Previously finalized invoices will need to be voided and
	// regenerated to reflect the rate type change.
	//
	// Any of "LIST_RATE", "COMMIT_RATE".
	RateType string `json:"rate_type,omitzero"`
	// contains filtered or unexported fields
}

The property CreditID is required.

func (V2ContractEditParamsUpdateCredit) MarshalJSON

func (r V2ContractEditParamsUpdateCredit) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsUpdateCredit) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsUpdateCredit) UnmarshalJSON(data []byte) error

type V2ContractEditParamsUpdateCreditAccessSchedule added in v1.0.0

type V2ContractEditParamsUpdateCreditAccessSchedule struct {
	AddScheduleItems    []V2ContractEditParamsUpdateCreditAccessScheduleAddScheduleItem    `json:"add_schedule_items,omitzero"`
	RemoveScheduleItems []V2ContractEditParamsUpdateCreditAccessScheduleRemoveScheduleItem `json:"remove_schedule_items,omitzero"`
	UpdateScheduleItems []V2ContractEditParamsUpdateCreditAccessScheduleUpdateScheduleItem `json:"update_schedule_items,omitzero"`
	// contains filtered or unexported fields
}

func (V2ContractEditParamsUpdateCreditAccessSchedule) MarshalJSON added in v1.0.0

func (r V2ContractEditParamsUpdateCreditAccessSchedule) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsUpdateCreditAccessSchedule) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsUpdateCreditAccessScheduleAddScheduleItem added in v1.0.0

type V2ContractEditParamsUpdateCreditAccessScheduleAddScheduleItem struct {
	Amount       float64   `json:"amount,required"`
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	StartingAt   time.Time `json:"starting_at,required" format:"date-time"`
	// contains filtered or unexported fields
}

The properties Amount, EndingBefore, StartingAt are required.

func (V2ContractEditParamsUpdateCreditAccessScheduleAddScheduleItem) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsUpdateCreditAccessScheduleAddScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsUpdateCreditAccessScheduleRemoveScheduleItem added in v1.0.0

type V2ContractEditParamsUpdateCreditAccessScheduleRemoveScheduleItem struct {
	ID string `json:"id,required" format:"uuid"`
	// contains filtered or unexported fields
}

The property ID is required.

func (V2ContractEditParamsUpdateCreditAccessScheduleRemoveScheduleItem) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsUpdateCreditAccessScheduleRemoveScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsUpdateCreditAccessScheduleUpdateScheduleItem added in v1.0.0

type V2ContractEditParamsUpdateCreditAccessScheduleUpdateScheduleItem struct {
	ID           string               `json:"id,required" format:"uuid"`
	Amount       param.Opt[float64]   `json:"amount,omitzero"`
	EndingBefore param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	StartingAt   param.Opt[time.Time] `json:"starting_at,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

The property ID is required.

func (V2ContractEditParamsUpdateCreditAccessScheduleUpdateScheduleItem) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsUpdateCreditAccessScheduleUpdateScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsUpdatePrepaidBalanceThresholdConfiguration

type V2ContractEditParamsUpdatePrepaidBalanceThresholdConfiguration struct {
	// If provided, the threshold, recharge-to amount, and the resulting threshold
	// commit amount will be in terms of this credit type instead of the fiat currency.
	CustomCreditTypeID param.Opt[string] `json:"custom_credit_type_id,omitzero" format:"uuid"`
	// When set to false, the contract will not be evaluated against the
	// threshold_amount. Toggling to true will result an immediate evaluation,
	// regardless of prior state.
	IsEnabled param.Opt[bool] `json:"is_enabled,omitzero"`
	// Specify the amount the balance should be recharged to.
	RechargeToAmount param.Opt[float64] `json:"recharge_to_amount,omitzero"`
	// Specify the threshold amount for the contract. Each time the contract's balance
	// lowers to this amount, a threshold charge will be initiated.
	ThresholdAmount   param.Opt[float64]                                                   `json:"threshold_amount,omitzero"`
	Commit            V2ContractEditParamsUpdatePrepaidBalanceThresholdConfigurationCommit `json:"commit,omitzero"`
	PaymentGateConfig shared.PaymentGateConfigV2Param                                      `json:"payment_gate_config,omitzero"`
	// contains filtered or unexported fields
}

func (V2ContractEditParamsUpdatePrepaidBalanceThresholdConfiguration) MarshalJSON

func (*V2ContractEditParamsUpdatePrepaidBalanceThresholdConfiguration) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsUpdatePrepaidBalanceThresholdConfigurationCommit

type V2ContractEditParamsUpdatePrepaidBalanceThresholdConfigurationCommit struct {
	// Which products the threshold commit applies to. If both applicable_product_ids
	// and applicable_product_tags are not provided, the commit applies to all
	// products.
	ApplicableProductIDs []string `json:"applicable_product_ids,omitzero" format:"uuid"`
	// Which tags the threshold commit applies to. If both applicable_product_ids and
	// applicable_product_tags are not provided, the commit applies to all products.
	ApplicableProductTags []string `json:"applicable_product_tags,omitzero"`
	// List of filters that determine what kind of customer usage draws down a commit
	// or credit. A customer's usage needs to meet the condition of at least one of the
	// specifiers to contribute to a commit's or credit's drawdown. This field cannot
	// be used together with `applicable_product_ids` or `applicable_product_tags`.
	// Instead, to target usage by product or product tag, pass those values in the
	// body of `specifiers`.
	Specifiers []shared.CommitSpecifierInputParam `json:"specifiers,omitzero"`
	shared.UpdateBaseThresholdCommitParam
}

func (V2ContractEditParamsUpdatePrepaidBalanceThresholdConfigurationCommit) MarshalJSON

type V2ContractEditParamsUpdateRecurringCommit

type V2ContractEditParamsUpdateRecurringCommit struct {
	RecurringCommitID string                                                 `json:"recurring_commit_id,required" format:"uuid"`
	EndingBefore      param.Opt[time.Time]                                   `json:"ending_before,omitzero" format:"date-time"`
	AccessAmount      V2ContractEditParamsUpdateRecurringCommitAccessAmount  `json:"access_amount,omitzero"`
	InvoiceAmount     V2ContractEditParamsUpdateRecurringCommitInvoiceAmount `json:"invoice_amount,omitzero"`
	// contains filtered or unexported fields
}

The property RecurringCommitID is required.

func (V2ContractEditParamsUpdateRecurringCommit) MarshalJSON

func (r V2ContractEditParamsUpdateRecurringCommit) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsUpdateRecurringCommit) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsUpdateRecurringCommit) UnmarshalJSON(data []byte) error

type V2ContractEditParamsUpdateRecurringCommitAccessAmount added in v1.0.0

type V2ContractEditParamsUpdateRecurringCommitAccessAmount struct {
	Quantity  param.Opt[float64] `json:"quantity,omitzero"`
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

func (V2ContractEditParamsUpdateRecurringCommitAccessAmount) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsUpdateRecurringCommitAccessAmount) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsUpdateRecurringCommitInvoiceAmount added in v1.0.0

type V2ContractEditParamsUpdateRecurringCommitInvoiceAmount struct {
	Quantity  param.Opt[float64] `json:"quantity,omitzero"`
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

func (V2ContractEditParamsUpdateRecurringCommitInvoiceAmount) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsUpdateRecurringCommitInvoiceAmount) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsUpdateRecurringCredit

type V2ContractEditParamsUpdateRecurringCredit struct {
	RecurringCreditID string                                                `json:"recurring_credit_id,required" format:"uuid"`
	EndingBefore      param.Opt[time.Time]                                  `json:"ending_before,omitzero" format:"date-time"`
	AccessAmount      V2ContractEditParamsUpdateRecurringCreditAccessAmount `json:"access_amount,omitzero"`
	// contains filtered or unexported fields
}

The property RecurringCreditID is required.

func (V2ContractEditParamsUpdateRecurringCredit) MarshalJSON

func (r V2ContractEditParamsUpdateRecurringCredit) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsUpdateRecurringCredit) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsUpdateRecurringCredit) UnmarshalJSON(data []byte) error

type V2ContractEditParamsUpdateRecurringCreditAccessAmount added in v1.0.0

type V2ContractEditParamsUpdateRecurringCreditAccessAmount struct {
	Quantity  param.Opt[float64] `json:"quantity,omitzero"`
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

func (V2ContractEditParamsUpdateRecurringCreditAccessAmount) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsUpdateRecurringCreditAccessAmount) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsUpdateScheduledCharge

type V2ContractEditParamsUpdateScheduledCharge struct {
	ScheduledChargeID    string                                                   `json:"scheduled_charge_id,required" format:"uuid"`
	NetsuiteSalesOrderID param.Opt[string]                                        `json:"netsuite_sales_order_id,omitzero"`
	InvoiceSchedule      V2ContractEditParamsUpdateScheduledChargeInvoiceSchedule `json:"invoice_schedule,omitzero"`
	// contains filtered or unexported fields
}

The property ScheduledChargeID is required.

func (V2ContractEditParamsUpdateScheduledCharge) MarshalJSON

func (r V2ContractEditParamsUpdateScheduledCharge) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsUpdateScheduledCharge) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsUpdateScheduledCharge) UnmarshalJSON(data []byte) error

type V2ContractEditParamsUpdateScheduledChargeInvoiceSchedule added in v1.0.0

type V2ContractEditParamsUpdateScheduledChargeInvoiceSchedule struct {
	AddScheduleItems    []V2ContractEditParamsUpdateScheduledChargeInvoiceScheduleAddScheduleItem    `json:"add_schedule_items,omitzero"`
	RemoveScheduleItems []V2ContractEditParamsUpdateScheduledChargeInvoiceScheduleRemoveScheduleItem `json:"remove_schedule_items,omitzero"`
	UpdateScheduleItems []V2ContractEditParamsUpdateScheduledChargeInvoiceScheduleUpdateScheduleItem `json:"update_schedule_items,omitzero"`
	// contains filtered or unexported fields
}

func (V2ContractEditParamsUpdateScheduledChargeInvoiceSchedule) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsUpdateScheduledChargeInvoiceSchedule) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsUpdateScheduledChargeInvoiceScheduleAddScheduleItem added in v1.0.0

type V2ContractEditParamsUpdateScheduledChargeInvoiceScheduleAddScheduleItem struct {
	Timestamp time.Time          `json:"timestamp,required" format:"date-time"`
	Amount    param.Opt[float64] `json:"amount,omitzero"`
	Quantity  param.Opt[float64] `json:"quantity,omitzero"`
	UnitPrice param.Opt[float64] `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

The property Timestamp is required.

func (V2ContractEditParamsUpdateScheduledChargeInvoiceScheduleAddScheduleItem) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsUpdateScheduledChargeInvoiceScheduleAddScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsUpdateScheduledChargeInvoiceScheduleRemoveScheduleItem added in v1.0.0

type V2ContractEditParamsUpdateScheduledChargeInvoiceScheduleRemoveScheduleItem struct {
	ID string `json:"id,required" format:"uuid"`
	// contains filtered or unexported fields
}

The property ID is required.

func (V2ContractEditParamsUpdateScheduledChargeInvoiceScheduleRemoveScheduleItem) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsUpdateScheduledChargeInvoiceScheduleRemoveScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsUpdateScheduledChargeInvoiceScheduleUpdateScheduleItem added in v1.0.0

type V2ContractEditParamsUpdateScheduledChargeInvoiceScheduleUpdateScheduleItem struct {
	ID        string               `json:"id,required" format:"uuid"`
	Amount    param.Opt[float64]   `json:"amount,omitzero"`
	Quantity  param.Opt[float64]   `json:"quantity,omitzero"`
	Timestamp param.Opt[time.Time] `json:"timestamp,omitzero" format:"date-time"`
	UnitPrice param.Opt[float64]   `json:"unit_price,omitzero"`
	// contains filtered or unexported fields
}

The property ID is required.

func (V2ContractEditParamsUpdateScheduledChargeInvoiceScheduleUpdateScheduleItem) MarshalJSON added in v1.0.0

func (*V2ContractEditParamsUpdateScheduledChargeInvoiceScheduleUpdateScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsUpdateSpendThresholdConfiguration

type V2ContractEditParamsUpdateSpendThresholdConfiguration struct {
	// When set to false, the contract will not be evaluated against the
	// threshold_amount. Toggling to true will result an immediate evaluation,
	// regardless of prior state.
	IsEnabled param.Opt[bool] `json:"is_enabled,omitzero"`
	// Specify the threshold amount for the contract. Each time the contract's usage
	// hits this amount, a threshold charge will be initiated.
	ThresholdAmount   param.Opt[float64]                    `json:"threshold_amount,omitzero"`
	Commit            shared.UpdateBaseThresholdCommitParam `json:"commit,omitzero"`
	PaymentGateConfig shared.PaymentGateConfigV2Param       `json:"payment_gate_config,omitzero"`
	// contains filtered or unexported fields
}

func (V2ContractEditParamsUpdateSpendThresholdConfiguration) MarshalJSON

func (*V2ContractEditParamsUpdateSpendThresholdConfiguration) UnmarshalJSON added in v1.0.0

type V2ContractEditParamsUpdateSubscription

type V2ContractEditParamsUpdateSubscription struct {
	SubscriptionID string               `json:"subscription_id,required" format:"uuid"`
	EndingBefore   param.Opt[time.Time] `json:"ending_before,omitzero" format:"date-time"`
	// Quantity changes are applied on the effective date based on the order which they
	// are sent. For example, if I scheduled the quantity to be 12 on May 21 and then
	// scheduled a quantity delta change of -1, the result from that day would be 11.
	QuantityUpdates []V2ContractEditParamsUpdateSubscriptionQuantityUpdate `json:"quantity_updates,omitzero"`
	// contains filtered or unexported fields
}

The property SubscriptionID is required.

func (V2ContractEditParamsUpdateSubscription) MarshalJSON

func (r V2ContractEditParamsUpdateSubscription) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsUpdateSubscription) UnmarshalJSON added in v1.0.0

func (r *V2ContractEditParamsUpdateSubscription) UnmarshalJSON(data []byte) error

type V2ContractEditParamsUpdateSubscriptionQuantityUpdate added in v1.0.0

type V2ContractEditParamsUpdateSubscriptionQuantityUpdate struct {
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// The new quantity for the subscription. Must be provided if quantity_delta is not
	// provided. Must be non-negative.
	Quantity param.Opt[float64] `json:"quantity,omitzero"`
	// The delta to add to the subscription's quantity. Must be provided if quantity is
	// not provided. Can't be zero. It also can't result in a negative quantity on the
	// subscription.
	QuantityDelta param.Opt[float64] `json:"quantity_delta,omitzero"`
	// contains filtered or unexported fields
}

The property StartingAt is required.

func (V2ContractEditParamsUpdateSubscriptionQuantityUpdate) MarshalJSON added in v1.0.0

func (r V2ContractEditParamsUpdateSubscriptionQuantityUpdate) MarshalJSON() (data []byte, err error)

func (*V2ContractEditParamsUpdateSubscriptionQuantityUpdate) UnmarshalJSON added in v1.0.0

type V2ContractEditResponse

type V2ContractEditResponse struct {
	Data shared.ID `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractEditResponse) RawJSON added in v1.0.0

func (r V2ContractEditResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V2ContractEditResponse) UnmarshalJSON

func (r *V2ContractEditResponse) UnmarshalJSON(data []byte) error

type V2ContractGetEditHistoryParams

type V2ContractGetEditHistoryParams struct {
	ContractID string `json:"contract_id,required" format:"uuid"`
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// contains filtered or unexported fields
}

func (V2ContractGetEditHistoryParams) MarshalJSON

func (r V2ContractGetEditHistoryParams) MarshalJSON() (data []byte, err error)

func (*V2ContractGetEditHistoryParams) UnmarshalJSON added in v1.0.0

func (r *V2ContractGetEditHistoryParams) UnmarshalJSON(data []byte) error

type V2ContractGetEditHistoryResponse

type V2ContractGetEditHistoryResponse struct {
	Data []V2ContractGetEditHistoryResponseData `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponse) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponse) UnmarshalJSON

func (r *V2ContractGetEditHistoryResponse) UnmarshalJSON(data []byte) error

type V2ContractGetEditHistoryResponseData

type V2ContractGetEditHistoryResponseData struct {
	ID                                      string                                                   `json:"id,required" format:"uuid"`
	AddCommits                              []V2ContractGetEditHistoryResponseDataAddCommit          `json:"add_commits"`
	AddCredits                              []V2ContractGetEditHistoryResponseDataAddCredit          `json:"add_credits"`
	AddDiscounts                            []shared.Discount                                        `json:"add_discounts"`
	AddOverrides                            []V2ContractGetEditHistoryResponseDataAddOverride        `json:"add_overrides"`
	AddPrepaidBalanceThresholdConfiguration shared.PrepaidBalanceThresholdConfigurationV2            `json:"add_prepaid_balance_threshold_configuration"`
	AddProServices                          []shared.ProService                                      `json:"add_pro_services"`
	AddRecurringCommits                     []V2ContractGetEditHistoryResponseDataAddRecurringCommit `json:"add_recurring_commits"`
	AddRecurringCredits                     []V2ContractGetEditHistoryResponseDataAddRecurringCredit `json:"add_recurring_credits"`
	AddResellerRoyalties                    []V2ContractGetEditHistoryResponseDataAddResellerRoyalty `json:"add_reseller_royalties"`
	AddScheduledCharges                     []V2ContractGetEditHistoryResponseDataAddScheduledCharge `json:"add_scheduled_charges"`
	AddSpendThresholdConfiguration          shared.SpendThresholdConfigurationV2                     `json:"add_spend_threshold_configuration"`
	// List of subscriptions on the contract.
	AddSubscriptions        []shared.Subscription                                        `json:"add_subscriptions"`
	AddUsageFilters         []V2ContractGetEditHistoryResponseDataAddUsageFilter         `json:"add_usage_filters"`
	ArchiveCommits          []V2ContractGetEditHistoryResponseDataArchiveCommit          `json:"archive_commits"`
	ArchiveCredits          []V2ContractGetEditHistoryResponseDataArchiveCredit          `json:"archive_credits"`
	ArchiveScheduledCharges []V2ContractGetEditHistoryResponseDataArchiveScheduledCharge `json:"archive_scheduled_charges"`
	RemoveOverrides         []V2ContractGetEditHistoryResponseDataRemoveOverride         `json:"remove_overrides"`
	Timestamp               time.Time                                                    `json:"timestamp" format:"date-time"`
	// Prevents the creation of duplicates. If a request to create a record is made
	// with a previously used uniqueness key, a new record will not be created and the
	// request will fail with a 409 error.
	UniquenessKey         string                                             `json:"uniqueness_key"`
	UpdateCommits         []V2ContractGetEditHistoryResponseDataUpdateCommit `json:"update_commits"`
	UpdateContractEndDate time.Time                                          `json:"update_contract_end_date" format:"date-time"`
	// Value to update the contract name to. If not provided, the contract name will
	// remain unchanged.
	UpdateContractName                         string                                                                         `json:"update_contract_name,nullable"`
	UpdateCredits                              []V2ContractGetEditHistoryResponseDataUpdateCredit                             `json:"update_credits"`
	UpdateDiscounts                            []V2ContractGetEditHistoryResponseDataUpdateDiscount                           `json:"update_discounts"`
	UpdatePrepaidBalanceThresholdConfiguration V2ContractGetEditHistoryResponseDataUpdatePrepaidBalanceThresholdConfiguration `json:"update_prepaid_balance_threshold_configuration"`
	UpdateRecurringCommits                     []V2ContractGetEditHistoryResponseDataUpdateRecurringCommit                    `json:"update_recurring_commits"`
	UpdateRecurringCredits                     []V2ContractGetEditHistoryResponseDataUpdateRecurringCredit                    `json:"update_recurring_credits"`
	UpdateRefundInvoices                       []V2ContractGetEditHistoryResponseDataUpdateRefundInvoice                      `json:"update_refund_invoices"`
	UpdateScheduledCharges                     []V2ContractGetEditHistoryResponseDataUpdateScheduledCharge                    `json:"update_scheduled_charges"`
	UpdateSpendThresholdConfiguration          V2ContractGetEditHistoryResponseDataUpdateSpendThresholdConfiguration          `json:"update_spend_threshold_configuration"`
	// Optional list of subscriptions to update.
	UpdateSubscriptions []V2ContractGetEditHistoryResponseDataUpdateSubscription `json:"update_subscriptions"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                                         respjson.Field
		AddCommits                                 respjson.Field
		AddCredits                                 respjson.Field
		AddDiscounts                               respjson.Field
		AddOverrides                               respjson.Field
		AddPrepaidBalanceThresholdConfiguration    respjson.Field
		AddProServices                             respjson.Field
		AddRecurringCommits                        respjson.Field
		AddRecurringCredits                        respjson.Field
		AddResellerRoyalties                       respjson.Field
		AddScheduledCharges                        respjson.Field
		AddSpendThresholdConfiguration             respjson.Field
		AddSubscriptions                           respjson.Field
		AddUsageFilters                            respjson.Field
		ArchiveCommits                             respjson.Field
		ArchiveCredits                             respjson.Field
		ArchiveScheduledCharges                    respjson.Field
		RemoveOverrides                            respjson.Field
		Timestamp                                  respjson.Field
		UniquenessKey                              respjson.Field
		UpdateCommits                              respjson.Field
		UpdateContractEndDate                      respjson.Field
		UpdateContractName                         respjson.Field
		UpdateCredits                              respjson.Field
		UpdateDiscounts                            respjson.Field
		UpdatePrepaidBalanceThresholdConfiguration respjson.Field
		UpdateRecurringCommits                     respjson.Field
		UpdateRecurringCredits                     respjson.Field
		UpdateRefundInvoices                       respjson.Field
		UpdateScheduledCharges                     respjson.Field
		UpdateSpendThresholdConfiguration          respjson.Field
		UpdateSubscriptions                        respjson.Field
		ExtraFields                                map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseData) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseData) UnmarshalJSON

func (r *V2ContractGetEditHistoryResponseData) UnmarshalJSON(data []byte) error

type V2ContractGetEditHistoryResponseDataAddCommit

type V2ContractGetEditHistoryResponseDataAddCommit struct {
	ID      string                                               `json:"id,required" format:"uuid"`
	Product V2ContractGetEditHistoryResponseDataAddCommitProduct `json:"product,required"`
	// Any of "PREPAID", "POSTPAID".
	Type string `json:"type,required"`
	// The schedule that the customer will gain access to the credits purposed with
	// this commit.
	AccessSchedule        shared.ScheduleDuration `json:"access_schedule"`
	ApplicableProductIDs  []string                `json:"applicable_product_ids" format:"uuid"`
	ApplicableProductTags []string                `json:"applicable_product_tags"`
	Description           string                  `json:"description"`
	// Optional configuration for commit hierarchy access control
	HierarchyConfiguration shared.CommitHierarchyConfiguration `json:"hierarchy_configuration"`
	// The schedule that the customer will be invoiced for this commit.
	InvoiceSchedule shared.SchedulePointInTime `json:"invoice_schedule"`
	Name            string                     `json:"name"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID string `json:"netsuite_sales_order_id"`
	// If multiple credits or commits are applicable, the one with the lower priority
	// will apply first.
	Priority float64 `json:"priority"`
	// Any of "COMMIT_RATE", "LIST_RATE".
	RateType         string  `json:"rate_type"`
	RolloverFraction float64 `json:"rollover_fraction"`
	// This field's availability is dependent on your client's configuration.
	SalesforceOpportunityID string `json:"salesforce_opportunity_id"`
	// List of filters that determine what kind of customer usage draws down a commit
	// or credit. A customer's usage needs to meet the condition of at least one of the
	// specifiers to contribute to a commit's or credit's drawdown. This field cannot
	// be used together with `applicable_product_ids` or `applicable_product_tags`.
	// Instead, to target usage by product or product tag, pass those values in the
	// body of `specifiers`.
	Specifiers []shared.CommitSpecifierInput `json:"specifiers"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                      respjson.Field
		Product                 respjson.Field
		Type                    respjson.Field
		AccessSchedule          respjson.Field
		ApplicableProductIDs    respjson.Field
		ApplicableProductTags   respjson.Field
		Description             respjson.Field
		HierarchyConfiguration  respjson.Field
		InvoiceSchedule         respjson.Field
		Name                    respjson.Field
		NetsuiteSalesOrderID    respjson.Field
		Priority                respjson.Field
		RateType                respjson.Field
		RolloverFraction        respjson.Field
		SalesforceOpportunityID respjson.Field
		Specifiers              respjson.Field
		ExtraFields             map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataAddCommit) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataAddCommit) UnmarshalJSON

func (r *V2ContractGetEditHistoryResponseDataAddCommit) UnmarshalJSON(data []byte) error

type V2ContractGetEditHistoryResponseDataAddCommitProduct added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddCommitProduct struct {
	ID   string `json:"id,required" format:"uuid"`
	Name string `json:"name,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataAddCommitProduct) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataAddCommitProduct) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddCredit

type V2ContractGetEditHistoryResponseDataAddCredit struct {
	ID      string                                               `json:"id,required" format:"uuid"`
	Product V2ContractGetEditHistoryResponseDataAddCreditProduct `json:"product,required"`
	// Any of "CREDIT".
	Type string `json:"type,required"`
	// The schedule that the customer will gain access to the credits.
	AccessSchedule        shared.ScheduleDuration `json:"access_schedule"`
	ApplicableProductIDs  []string                `json:"applicable_product_ids" format:"uuid"`
	ApplicableProductTags []string                `json:"applicable_product_tags"`
	Description           string                  `json:"description"`
	// Optional configuration for recurring credit hierarchy access control
	HierarchyConfiguration shared.CommitHierarchyConfiguration `json:"hierarchy_configuration"`
	Name                   string                              `json:"name"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID string `json:"netsuite_sales_order_id"`
	// If multiple credits or commits are applicable, the one with the lower priority
	// will apply first.
	Priority float64 `json:"priority"`
	// This field's availability is dependent on your client's configuration.
	SalesforceOpportunityID string `json:"salesforce_opportunity_id"`
	// List of filters that determine what kind of customer usage draws down a commit
	// or credit. A customer's usage needs to meet the condition of at least one of the
	// specifiers to contribute to a commit's or credit's drawdown. This field cannot
	// be used together with `applicable_product_ids` or `applicable_product_tags`.
	// Instead, to target usage by product or product tag, pass those values in the
	// body of `specifiers`.
	Specifiers []shared.CommitSpecifierInput `json:"specifiers"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                      respjson.Field
		Product                 respjson.Field
		Type                    respjson.Field
		AccessSchedule          respjson.Field
		ApplicableProductIDs    respjson.Field
		ApplicableProductTags   respjson.Field
		Description             respjson.Field
		HierarchyConfiguration  respjson.Field
		Name                    respjson.Field
		NetsuiteSalesOrderID    respjson.Field
		Priority                respjson.Field
		SalesforceOpportunityID respjson.Field
		Specifiers              respjson.Field
		ExtraFields             map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataAddCredit) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataAddCredit) UnmarshalJSON

func (r *V2ContractGetEditHistoryResponseDataAddCredit) UnmarshalJSON(data []byte) error

type V2ContractGetEditHistoryResponseDataAddCreditProduct added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddCreditProduct struct {
	ID   string `json:"id,required" format:"uuid"`
	Name string `json:"name,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataAddCreditProduct) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataAddCreditProduct) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddOverride

type V2ContractGetEditHistoryResponseDataAddOverride struct {
	ID                    string                                                             `json:"id,required" format:"uuid"`
	StartingAt            time.Time                                                          `json:"starting_at,required" format:"date-time"`
	ApplicableProductTags []string                                                           `json:"applicable_product_tags"`
	EndingBefore          time.Time                                                          `json:"ending_before" format:"date-time"`
	Entitled              bool                                                               `json:"entitled"`
	IsCommitSpecific      bool                                                               `json:"is_commit_specific"`
	Multiplier            float64                                                            `json:"multiplier"`
	OverrideSpecifiers    []V2ContractGetEditHistoryResponseDataAddOverrideOverrideSpecifier `json:"override_specifiers"`
	OverrideTiers         []shared.OverrideTier                                              `json:"override_tiers"`
	OverwriteRate         shared.OverwriteRate                                               `json:"overwrite_rate"`
	Priority              float64                                                            `json:"priority"`
	Product               V2ContractGetEditHistoryResponseDataAddOverrideProduct             `json:"product"`
	// Any of "COMMIT_RATE", "LIST_RATE".
	Target string `json:"target"`
	// Any of "OVERWRITE", "MULTIPLIER", "TIERED".
	Type string `json:"type"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                    respjson.Field
		StartingAt            respjson.Field
		ApplicableProductTags respjson.Field
		EndingBefore          respjson.Field
		Entitled              respjson.Field
		IsCommitSpecific      respjson.Field
		Multiplier            respjson.Field
		OverrideSpecifiers    respjson.Field
		OverrideTiers         respjson.Field
		OverwriteRate         respjson.Field
		Priority              respjson.Field
		Product               respjson.Field
		Target                respjson.Field
		Type                  respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataAddOverride) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataAddOverride) UnmarshalJSON

type V2ContractGetEditHistoryResponseDataAddOverrideOverrideSpecifier added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddOverrideOverrideSpecifier struct {
	// Any of "MONTHLY", "QUARTERLY", "ANNUAL", "WEEKLY".
	BillingFrequency        string            `json:"billing_frequency"`
	CommitIDs               []string          `json:"commit_ids"`
	PresentationGroupValues map[string]string `json:"presentation_group_values"`
	PricingGroupValues      map[string]string `json:"pricing_group_values"`
	ProductID               string            `json:"product_id" format:"uuid"`
	ProductTags             []string          `json:"product_tags"`
	RecurringCommitIDs      []string          `json:"recurring_commit_ids"`
	RecurringCreditIDs      []string          `json:"recurring_credit_ids"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BillingFrequency        respjson.Field
		CommitIDs               respjson.Field
		PresentationGroupValues respjson.Field
		PricingGroupValues      respjson.Field
		ProductID               respjson.Field
		ProductTags             respjson.Field
		RecurringCommitIDs      respjson.Field
		RecurringCreditIDs      respjson.Field
		ExtraFields             map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataAddOverrideOverrideSpecifier) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataAddOverrideOverrideSpecifier) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddOverrideProduct added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddOverrideProduct struct {
	ID   string `json:"id,required" format:"uuid"`
	Name string `json:"name,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataAddOverrideProduct) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataAddOverrideProduct) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddRecurringCommit

type V2ContractGetEditHistoryResponseDataAddRecurringCommit struct {
	ID string `json:"id,required" format:"uuid"`
	// The amount of commit to grant.
	AccessAmount V2ContractGetEditHistoryResponseDataAddRecurringCommitAccessAmount `json:"access_amount,required"`
	// The amount of time the created commits will be valid for
	CommitDuration V2ContractGetEditHistoryResponseDataAddRecurringCommitCommitDuration `json:"commit_duration,required"`
	// Will be passed down to the individual commits
	Priority float64                                                       `json:"priority,required"`
	Product  V2ContractGetEditHistoryResponseDataAddRecurringCommitProduct `json:"product,required"`
	// Whether the created commits will use the commit rate or list rate
	//
	// Any of "COMMIT_RATE", "LIST_RATE".
	RateType string `json:"rate_type,required"`
	// Determines the start time for the first commit
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// Will be passed down to the individual commits
	ApplicableProductIDs []string `json:"applicable_product_ids" format:"uuid"`
	// Will be passed down to the individual commits
	ApplicableProductTags []string                                                       `json:"applicable_product_tags"`
	Contract              V2ContractGetEditHistoryResponseDataAddRecurringCommitContract `json:"contract"`
	// Will be passed down to the individual commits
	Description string `json:"description"`
	// Determines when the contract will stop creating recurring commits. Optional
	EndingBefore time.Time `json:"ending_before" format:"date-time"`
	// Optional configuration for recurring credit hierarchy access control
	HierarchyConfiguration shared.CommitHierarchyConfiguration `json:"hierarchy_configuration"`
	// The amount the customer should be billed for the commit. Not required.
	InvoiceAmount V2ContractGetEditHistoryResponseDataAddRecurringCommitInvoiceAmount `json:"invoice_amount"`
	// Displayed on invoices. Will be passed through to the individual commits
	Name string `json:"name"`
	// Will be passed down to the individual commits
	NetsuiteSalesOrderID string `json:"netsuite_sales_order_id"`
	// Determines whether the first and last commit will be prorated. If not provided,
	// the default is FIRST_AND_LAST (i.e. prorate both the first and last commits).
	//
	// Any of "NONE", "FIRST", "LAST", "FIRST_AND_LAST".
	Proration string `json:"proration"`
	// The frequency at which the recurring commits will be created. If not provided: -
	// The commits will be created on the usage invoice frequency. If provided: - The
	// period defined in the duration will correspond to this frequency. - Commits will
	// be created aligned with the recurring commit's starting_at rather than the usage
	// invoice dates.
	//
	// Any of "MONTHLY", "QUARTERLY", "ANNUAL", "WEEKLY".
	RecurrenceFrequency string `json:"recurrence_frequency"`
	// Will be passed down to the individual commits. This controls how much of an
	// individual unexpired commit will roll over upon contract transition. Must be
	// between 0 and 1.
	RolloverFraction float64 `json:"rollover_fraction"`
	// List of filters that determine what kind of customer usage draws down a commit
	// or credit. A customer's usage needs to meet the condition of at least one of the
	// specifiers to contribute to a commit's or credit's drawdown.
	Specifiers []shared.CommitSpecifier `json:"specifiers"`
	// Attach a subscription to the recurring commit/credit.
	SubscriptionConfig shared.RecurringCommitSubscriptionConfig `json:"subscription_config"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                     respjson.Field
		AccessAmount           respjson.Field
		CommitDuration         respjson.Field
		Priority               respjson.Field
		Product                respjson.Field
		RateType               respjson.Field
		StartingAt             respjson.Field
		ApplicableProductIDs   respjson.Field
		ApplicableProductTags  respjson.Field
		Contract               respjson.Field
		Description            respjson.Field
		EndingBefore           respjson.Field
		HierarchyConfiguration respjson.Field
		InvoiceAmount          respjson.Field
		Name                   respjson.Field
		NetsuiteSalesOrderID   respjson.Field
		Proration              respjson.Field
		RecurrenceFrequency    respjson.Field
		RolloverFraction       respjson.Field
		Specifiers             respjson.Field
		SubscriptionConfig     respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataAddRecurringCommit) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataAddRecurringCommit) UnmarshalJSON

type V2ContractGetEditHistoryResponseDataAddRecurringCommitAccessAmount added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddRecurringCommitAccessAmount struct {
	CreditTypeID string  `json:"credit_type_id,required" format:"uuid"`
	UnitPrice    float64 `json:"unit_price,required"`
	Quantity     float64 `json:"quantity"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreditTypeID respjson.Field
		UnitPrice    respjson.Field
		Quantity     respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The amount of commit to grant.

func (V2ContractGetEditHistoryResponseDataAddRecurringCommitAccessAmount) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataAddRecurringCommitAccessAmount) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddRecurringCommitCommitDuration added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddRecurringCommitCommitDuration struct {
	Value float64 `json:"value,required"`
	// Any of "PERIODS".
	Unit string `json:"unit"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Value       respjson.Field
		Unit        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The amount of time the created commits will be valid for

func (V2ContractGetEditHistoryResponseDataAddRecurringCommitCommitDuration) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataAddRecurringCommitCommitDuration) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddRecurringCommitContract added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddRecurringCommitContract struct {
	ID string `json:"id,required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataAddRecurringCommitContract) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataAddRecurringCommitContract) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddRecurringCommitInvoiceAmount added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddRecurringCommitInvoiceAmount struct {
	CreditTypeID string  `json:"credit_type_id,required" format:"uuid"`
	Quantity     float64 `json:"quantity,required"`
	UnitPrice    float64 `json:"unit_price,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreditTypeID respjson.Field
		Quantity     respjson.Field
		UnitPrice    respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The amount the customer should be billed for the commit. Not required.

func (V2ContractGetEditHistoryResponseDataAddRecurringCommitInvoiceAmount) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataAddRecurringCommitInvoiceAmount) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddRecurringCommitProduct added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddRecurringCommitProduct struct {
	ID   string `json:"id,required" format:"uuid"`
	Name string `json:"name,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataAddRecurringCommitProduct) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataAddRecurringCommitProduct) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddRecurringCredit

type V2ContractGetEditHistoryResponseDataAddRecurringCredit struct {
	ID string `json:"id,required" format:"uuid"`
	// The amount of commit to grant.
	AccessAmount V2ContractGetEditHistoryResponseDataAddRecurringCreditAccessAmount `json:"access_amount,required"`
	// The amount of time the created commits will be valid for
	CommitDuration V2ContractGetEditHistoryResponseDataAddRecurringCreditCommitDuration `json:"commit_duration,required"`
	// Will be passed down to the individual commits
	Priority float64                                                       `json:"priority,required"`
	Product  V2ContractGetEditHistoryResponseDataAddRecurringCreditProduct `json:"product,required"`
	// Whether the created commits will use the commit rate or list rate
	//
	// Any of "COMMIT_RATE", "LIST_RATE".
	RateType string `json:"rate_type,required"`
	// Determines the start time for the first commit
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// Will be passed down to the individual commits
	ApplicableProductIDs []string `json:"applicable_product_ids" format:"uuid"`
	// Will be passed down to the individual commits
	ApplicableProductTags []string                                                       `json:"applicable_product_tags"`
	Contract              V2ContractGetEditHistoryResponseDataAddRecurringCreditContract `json:"contract"`
	// Will be passed down to the individual commits
	Description string `json:"description"`
	// Determines when the contract will stop creating recurring commits. Optional
	EndingBefore time.Time `json:"ending_before" format:"date-time"`
	// Optional configuration for recurring credit hierarchy access control
	HierarchyConfiguration shared.CommitHierarchyConfiguration `json:"hierarchy_configuration"`
	// Displayed on invoices. Will be passed through to the individual commits
	Name string `json:"name"`
	// Will be passed down to the individual commits
	NetsuiteSalesOrderID string `json:"netsuite_sales_order_id"`
	// Determines whether the first and last commit will be prorated. If not provided,
	// the default is FIRST_AND_LAST (i.e. prorate both the first and last commits).
	//
	// Any of "NONE", "FIRST", "LAST", "FIRST_AND_LAST".
	Proration string `json:"proration"`
	// The frequency at which the recurring commits will be created. If not provided: -
	// The commits will be created on the usage invoice frequency. If provided: - The
	// period defined in the duration will correspond to this frequency. - Commits will
	// be created aligned with the recurring commit's starting_at rather than the usage
	// invoice dates.
	//
	// Any of "MONTHLY", "QUARTERLY", "ANNUAL", "WEEKLY".
	RecurrenceFrequency string `json:"recurrence_frequency"`
	// Will be passed down to the individual commits. This controls how much of an
	// individual unexpired commit will roll over upon contract transition. Must be
	// between 0 and 1.
	RolloverFraction float64 `json:"rollover_fraction"`
	// List of filters that determine what kind of customer usage draws down a commit
	// or credit. A customer's usage needs to meet the condition of at least one of the
	// specifiers to contribute to a commit's or credit's drawdown.
	Specifiers []shared.CommitSpecifier `json:"specifiers"`
	// Attach a subscription to the recurring commit/credit.
	SubscriptionConfig shared.RecurringCommitSubscriptionConfig `json:"subscription_config"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                     respjson.Field
		AccessAmount           respjson.Field
		CommitDuration         respjson.Field
		Priority               respjson.Field
		Product                respjson.Field
		RateType               respjson.Field
		StartingAt             respjson.Field
		ApplicableProductIDs   respjson.Field
		ApplicableProductTags  respjson.Field
		Contract               respjson.Field
		Description            respjson.Field
		EndingBefore           respjson.Field
		HierarchyConfiguration respjson.Field
		Name                   respjson.Field
		NetsuiteSalesOrderID   respjson.Field
		Proration              respjson.Field
		RecurrenceFrequency    respjson.Field
		RolloverFraction       respjson.Field
		Specifiers             respjson.Field
		SubscriptionConfig     respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataAddRecurringCredit) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataAddRecurringCredit) UnmarshalJSON

type V2ContractGetEditHistoryResponseDataAddRecurringCreditAccessAmount added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddRecurringCreditAccessAmount struct {
	CreditTypeID string  `json:"credit_type_id,required" format:"uuid"`
	UnitPrice    float64 `json:"unit_price,required"`
	Quantity     float64 `json:"quantity"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreditTypeID respjson.Field
		UnitPrice    respjson.Field
		Quantity     respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The amount of commit to grant.

func (V2ContractGetEditHistoryResponseDataAddRecurringCreditAccessAmount) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataAddRecurringCreditAccessAmount) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddRecurringCreditCommitDuration added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddRecurringCreditCommitDuration struct {
	Value float64 `json:"value,required"`
	// Any of "PERIODS".
	Unit string `json:"unit"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Value       respjson.Field
		Unit        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The amount of time the created commits will be valid for

func (V2ContractGetEditHistoryResponseDataAddRecurringCreditCommitDuration) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataAddRecurringCreditCommitDuration) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddRecurringCreditContract added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddRecurringCreditContract struct {
	ID string `json:"id,required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataAddRecurringCreditContract) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataAddRecurringCreditContract) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddRecurringCreditProduct added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddRecurringCreditProduct struct {
	ID   string `json:"id,required" format:"uuid"`
	Name string `json:"name,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataAddRecurringCreditProduct) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataAddRecurringCreditProduct) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddResellerRoyalty

type V2ContractGetEditHistoryResponseDataAddResellerRoyalty struct {
	// Any of "AWS", "AWS_PRO_SERVICE", "GCP", "GCP_PRO_SERVICE".
	ResellerType          string    `json:"reseller_type,required"`
	ApplicableProductIDs  []string  `json:"applicable_product_ids"`
	ApplicableProductTags []string  `json:"applicable_product_tags"`
	AwsAccountNumber      string    `json:"aws_account_number"`
	AwsOfferID            string    `json:"aws_offer_id"`
	AwsPayerReferenceID   string    `json:"aws_payer_reference_id"`
	EndingBefore          time.Time `json:"ending_before,nullable" format:"date-time"`
	Fraction              float64   `json:"fraction"`
	GcpAccountID          string    `json:"gcp_account_id"`
	GcpOfferID            string    `json:"gcp_offer_id"`
	NetsuiteResellerID    string    `json:"netsuite_reseller_id"`
	ResellerContractValue float64   `json:"reseller_contract_value"`
	StartingAt            time.Time `json:"starting_at" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ResellerType          respjson.Field
		ApplicableProductIDs  respjson.Field
		ApplicableProductTags respjson.Field
		AwsAccountNumber      respjson.Field
		AwsOfferID            respjson.Field
		AwsPayerReferenceID   respjson.Field
		EndingBefore          respjson.Field
		Fraction              respjson.Field
		GcpAccountID          respjson.Field
		GcpOfferID            respjson.Field
		NetsuiteResellerID    respjson.Field
		ResellerContractValue respjson.Field
		StartingAt            respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataAddResellerRoyalty) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataAddResellerRoyalty) UnmarshalJSON

type V2ContractGetEditHistoryResponseDataAddScheduledCharge

type V2ContractGetEditHistoryResponseDataAddScheduledCharge struct {
	ID       string                                                        `json:"id,required" format:"uuid"`
	Product  V2ContractGetEditHistoryResponseDataAddScheduledChargeProduct `json:"product,required"`
	Schedule shared.SchedulePointInTime                                    `json:"schedule,required"`
	// displayed on invoices
	Name string `json:"name"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID string `json:"netsuite_sales_order_id"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                   respjson.Field
		Product              respjson.Field
		Schedule             respjson.Field
		Name                 respjson.Field
		NetsuiteSalesOrderID respjson.Field
		ExtraFields          map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataAddScheduledCharge) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataAddScheduledCharge) UnmarshalJSON

type V2ContractGetEditHistoryResponseDataAddScheduledChargeProduct added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddScheduledChargeProduct struct {
	ID   string `json:"id,required" format:"uuid"`
	Name string `json:"name,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataAddScheduledChargeProduct) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataAddScheduledChargeProduct) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataAddUsageFilter

type V2ContractGetEditHistoryResponseDataAddUsageFilter struct {
	GroupKey    string   `json:"group_key,required"`
	GroupValues []string `json:"group_values,required"`
	// This will match contract starting_at value if usage filter is active from the
	// beginning of the contract.
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// This will match contract ending_before value if usage filter is active until the
	// end of the contract. It will be undefined if the contract is open-ended.
	EndingBefore time.Time `json:"ending_before" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		GroupKey     respjson.Field
		GroupValues  respjson.Field
		StartingAt   respjson.Field
		EndingBefore respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataAddUsageFilter) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataAddUsageFilter) UnmarshalJSON

type V2ContractGetEditHistoryResponseDataArchiveCommit

type V2ContractGetEditHistoryResponseDataArchiveCommit struct {
	ID string `json:"id,required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataArchiveCommit) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataArchiveCommit) UnmarshalJSON

type V2ContractGetEditHistoryResponseDataArchiveCredit

type V2ContractGetEditHistoryResponseDataArchiveCredit struct {
	ID string `json:"id,required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataArchiveCredit) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataArchiveCredit) UnmarshalJSON

type V2ContractGetEditHistoryResponseDataArchiveScheduledCharge

type V2ContractGetEditHistoryResponseDataArchiveScheduledCharge struct {
	ID string `json:"id,required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataArchiveScheduledCharge) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataArchiveScheduledCharge) UnmarshalJSON

type V2ContractGetEditHistoryResponseDataRemoveOverride

type V2ContractGetEditHistoryResponseDataRemoveOverride struct {
	ID string `json:"id,required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataRemoveOverride) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataRemoveOverride) UnmarshalJSON

type V2ContractGetEditHistoryResponseDataUpdateCommit

type V2ContractGetEditHistoryResponseDataUpdateCommit struct {
	ID             string                                                         `json:"id,required" format:"uuid"`
	AccessSchedule V2ContractGetEditHistoryResponseDataUpdateCommitAccessSchedule `json:"access_schedule"`
	// Which products the commit applies to. If applicable_product_ids,
	// applicable_product_tags or specifiers are not provided, the commit applies to
	// all products.
	ApplicableProductIDs []string `json:"applicable_product_ids,nullable" format:"uuid"`
	// Which tags the commit applies to. If applicable_product_ids,
	// applicable_product_tags or specifiers are not provided, the commit applies to
	// all products.
	ApplicableProductTags []string `json:"applicable_product_tags,nullable"`
	// Optional configuration for commit hierarchy access control
	HierarchyConfiguration shared.CommitHierarchyConfiguration                             `json:"hierarchy_configuration"`
	InvoiceSchedule        V2ContractGetEditHistoryResponseDataUpdateCommitInvoiceSchedule `json:"invoice_schedule"`
	Name                   string                                                          `json:"name"`
	NetsuiteSalesOrderID   string                                                          `json:"netsuite_sales_order_id,nullable"`
	// If multiple commits are applicable, the one with the lower priority will apply
	// first.
	Priority  float64 `json:"priority,nullable"`
	ProductID string  `json:"product_id" format:"uuid"`
	// If set, the commit's rate type was updated to the specified value.
	//
	// Any of "COMMIT_RATE", "LIST_RATE".
	RateType         string  `json:"rate_type"`
	RolloverFraction float64 `json:"rollover_fraction,nullable"`
	// List of filters that determine what kind of customer usage draws down a commit
	// or credit. A customer's usage needs to meet the condition of at least one of the
	// specifiers to contribute to a commit's or credit's drawdown. This field cannot
	// be used together with `applicable_product_ids` or `applicable_product_tags`.
	// Instead, to target usage by product or product tag, pass those values in the
	// body of `specifiers`.
	Specifiers []shared.CommitSpecifierInput `json:"specifiers,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                     respjson.Field
		AccessSchedule         respjson.Field
		ApplicableProductIDs   respjson.Field
		ApplicableProductTags  respjson.Field
		HierarchyConfiguration respjson.Field
		InvoiceSchedule        respjson.Field
		Name                   respjson.Field
		NetsuiteSalesOrderID   respjson.Field
		Priority               respjson.Field
		ProductID              respjson.Field
		RateType               respjson.Field
		RolloverFraction       respjson.Field
		Specifiers             respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateCommit) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateCommit) UnmarshalJSON

type V2ContractGetEditHistoryResponseDataUpdateCommitAccessSchedule added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateCommitAccessSchedule struct {
	AddScheduleItems    []V2ContractGetEditHistoryResponseDataUpdateCommitAccessScheduleAddScheduleItem    `json:"add_schedule_items"`
	RemoveScheduleItems []V2ContractGetEditHistoryResponseDataUpdateCommitAccessScheduleRemoveScheduleItem `json:"remove_schedule_items"`
	UpdateScheduleItems []V2ContractGetEditHistoryResponseDataUpdateCommitAccessScheduleUpdateScheduleItem `json:"update_schedule_items"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AddScheduleItems    respjson.Field
		RemoveScheduleItems respjson.Field
		UpdateScheduleItems respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateCommitAccessSchedule) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateCommitAccessSchedule) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateCommitAccessScheduleAddScheduleItem added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateCommitAccessScheduleAddScheduleItem struct {
	Amount float64 `json:"amount,required"`
	// RFC 3339 timestamp (exclusive)
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	// RFC 3339 timestamp (inclusive)
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Amount       respjson.Field
		EndingBefore respjson.Field
		StartingAt   respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateCommitAccessScheduleAddScheduleItem) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateCommitAccessScheduleAddScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateCommitAccessScheduleRemoveScheduleItem added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateCommitAccessScheduleRemoveScheduleItem struct {
	ID string `json:"id,required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateCommitAccessScheduleRemoveScheduleItem) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateCommitAccessScheduleRemoveScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateCommitAccessScheduleUpdateScheduleItem added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateCommitAccessScheduleUpdateScheduleItem struct {
	ID     string  `json:"id,required" format:"uuid"`
	Amount float64 `json:"amount"`
	// RFC 3339 timestamp (exclusive)
	EndingBefore time.Time `json:"ending_before" format:"date-time"`
	// RFC 3339 timestamp (inclusive)
	StartingAt time.Time `json:"starting_at" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID           respjson.Field
		Amount       respjson.Field
		EndingBefore respjson.Field
		StartingAt   respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateCommitAccessScheduleUpdateScheduleItem) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateCommitAccessScheduleUpdateScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateCommitInvoiceSchedule added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateCommitInvoiceSchedule struct {
	AddScheduleItems    []V2ContractGetEditHistoryResponseDataUpdateCommitInvoiceScheduleAddScheduleItem    `json:"add_schedule_items"`
	RemoveScheduleItems []V2ContractGetEditHistoryResponseDataUpdateCommitInvoiceScheduleRemoveScheduleItem `json:"remove_schedule_items"`
	UpdateScheduleItems []V2ContractGetEditHistoryResponseDataUpdateCommitInvoiceScheduleUpdateScheduleItem `json:"update_schedule_items"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AddScheduleItems    respjson.Field
		RemoveScheduleItems respjson.Field
		UpdateScheduleItems respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateCommitInvoiceSchedule) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateCommitInvoiceSchedule) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateCommitInvoiceScheduleAddScheduleItem added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateCommitInvoiceScheduleAddScheduleItem struct {
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	Amount    float64   `json:"amount"`
	Quantity  float64   `json:"quantity"`
	UnitPrice float64   `json:"unit_price"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Timestamp   respjson.Field
		Amount      respjson.Field
		Quantity    respjson.Field
		UnitPrice   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateCommitInvoiceScheduleAddScheduleItem) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateCommitInvoiceScheduleAddScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateCommitInvoiceScheduleRemoveScheduleItem added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateCommitInvoiceScheduleRemoveScheduleItem struct {
	ID string `json:"id,required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateCommitInvoiceScheduleRemoveScheduleItem) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateCommitInvoiceScheduleRemoveScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateCommitInvoiceScheduleUpdateScheduleItem added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateCommitInvoiceScheduleUpdateScheduleItem struct {
	ID        string    `json:"id,required" format:"uuid"`
	Amount    float64   `json:"amount"`
	Quantity  float64   `json:"quantity"`
	Timestamp time.Time `json:"timestamp" format:"date-time"`
	UnitPrice float64   `json:"unit_price"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Amount      respjson.Field
		Quantity    respjson.Field
		Timestamp   respjson.Field
		UnitPrice   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateCommitInvoiceScheduleUpdateScheduleItem) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateCommitInvoiceScheduleUpdateScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateCredit

type V2ContractGetEditHistoryResponseDataUpdateCredit struct {
	ID             string                                                         `json:"id,required" format:"uuid"`
	AccessSchedule V2ContractGetEditHistoryResponseDataUpdateCreditAccessSchedule `json:"access_schedule"`
	// Optional configuration for credit hierarchy access control
	HierarchyConfiguration shared.CommitHierarchyConfiguration `json:"hierarchy_configuration"`
	Name                   string                              `json:"name"`
	NetsuiteSalesOrderID   string                              `json:"netsuite_sales_order_id,nullable"`
	// If multiple credits are applicable, the one with the lower priority will apply
	// first.
	Priority float64 `json:"priority,nullable"`
	// If set, the credit's rate type was updated to the specified value.
	//
	// Any of "LIST_RATE", "COMMIT_RATE".
	RateType         string  `json:"rate_type"`
	RolloverFraction float64 `json:"rollover_fraction,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                     respjson.Field
		AccessSchedule         respjson.Field
		HierarchyConfiguration respjson.Field
		Name                   respjson.Field
		NetsuiteSalesOrderID   respjson.Field
		Priority               respjson.Field
		RateType               respjson.Field
		RolloverFraction       respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateCredit) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateCredit) UnmarshalJSON

type V2ContractGetEditHistoryResponseDataUpdateCreditAccessSchedule added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateCreditAccessSchedule struct {
	AddScheduleItems    []V2ContractGetEditHistoryResponseDataUpdateCreditAccessScheduleAddScheduleItem    `json:"add_schedule_items"`
	RemoveScheduleItems []V2ContractGetEditHistoryResponseDataUpdateCreditAccessScheduleRemoveScheduleItem `json:"remove_schedule_items"`
	UpdateScheduleItems []V2ContractGetEditHistoryResponseDataUpdateCreditAccessScheduleUpdateScheduleItem `json:"update_schedule_items"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AddScheduleItems    respjson.Field
		RemoveScheduleItems respjson.Field
		UpdateScheduleItems respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateCreditAccessSchedule) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateCreditAccessSchedule) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateCreditAccessScheduleAddScheduleItem added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateCreditAccessScheduleAddScheduleItem struct {
	Amount float64 `json:"amount,required"`
	// RFC 3339 timestamp (exclusive)
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	// RFC 3339 timestamp (inclusive)
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Amount       respjson.Field
		EndingBefore respjson.Field
		StartingAt   respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateCreditAccessScheduleAddScheduleItem) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateCreditAccessScheduleAddScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateCreditAccessScheduleRemoveScheduleItem added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateCreditAccessScheduleRemoveScheduleItem struct {
	ID string `json:"id,required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateCreditAccessScheduleRemoveScheduleItem) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateCreditAccessScheduleRemoveScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateCreditAccessScheduleUpdateScheduleItem added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateCreditAccessScheduleUpdateScheduleItem struct {
	ID     string  `json:"id,required" format:"uuid"`
	Amount float64 `json:"amount"`
	// RFC 3339 timestamp (exclusive)
	EndingBefore time.Time `json:"ending_before" format:"date-time"`
	// RFC 3339 timestamp (inclusive)
	StartingAt time.Time `json:"starting_at" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID           respjson.Field
		Amount       respjson.Field
		EndingBefore respjson.Field
		StartingAt   respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateCreditAccessScheduleUpdateScheduleItem) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateCreditAccessScheduleUpdateScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateDiscount

type V2ContractGetEditHistoryResponseDataUpdateDiscount struct {
	ID string `json:"id,required" format:"uuid"`
	// Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
	CustomFields         map[string]string `json:"custom_fields"`
	Name                 string            `json:"name"`
	NetsuiteSalesOrderID string            `json:"netsuite_sales_order_id"`
	// Must provide either schedule_items or recurring_schedule.
	Schedule V2ContractGetEditHistoryResponseDataUpdateDiscountSchedule `json:"schedule"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                   respjson.Field
		CustomFields         respjson.Field
		Name                 respjson.Field
		NetsuiteSalesOrderID respjson.Field
		Schedule             respjson.Field
		ExtraFields          map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateDiscount) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateDiscount) UnmarshalJSON

type V2ContractGetEditHistoryResponseDataUpdateDiscountSchedule added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateDiscountSchedule struct {
	// Defaults to USD (cents) if not passed.
	CreditTypeID string `json:"credit_type_id" format:"uuid"`
	// This field is only applicable to commit invoice schedules. If true, this
	// schedule will not generate an invoice.
	DoNotInvoice bool `json:"do_not_invoice"`
	// Enter the unit price and quantity for the charge or instead only send the
	// amount. If amount is sent, the unit price is assumed to be the amount and
	// quantity is inferred to be 1.
	RecurringSchedule V2ContractGetEditHistoryResponseDataUpdateDiscountScheduleRecurringSchedule `json:"recurring_schedule"`
	// Either provide amount or provide both unit_price and quantity.
	ScheduleItems []V2ContractGetEditHistoryResponseDataUpdateDiscountScheduleScheduleItem `json:"schedule_items"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreditTypeID      respjson.Field
		DoNotInvoice      respjson.Field
		RecurringSchedule respjson.Field
		ScheduleItems     respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Must provide either schedule_items or recurring_schedule.

func (V2ContractGetEditHistoryResponseDataUpdateDiscountSchedule) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateDiscountSchedule) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateDiscountScheduleRecurringSchedule added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateDiscountScheduleRecurringSchedule struct {
	// Any of "DIVIDED", "DIVIDED_ROUNDED", "EACH".
	AmountDistribution string `json:"amount_distribution,required"`
	// RFC 3339 timestamp (exclusive).
	EndingBefore time.Time `json:"ending_before,required" format:"date-time"`
	// Any of "MONTHLY", "QUARTERLY", "SEMI_ANNUAL", "ANNUAL", "WEEKLY".
	Frequency string `json:"frequency,required"`
	// RFC 3339 timestamp (inclusive).
	StartingAt time.Time `json:"starting_at,required" format:"date-time"`
	// Amount for the charge. Can be provided instead of unit_price and quantity. If
	// amount is sent, the unit_price is assumed to be the amount and quantity is
	// inferred to be 1.
	Amount float64 `json:"amount"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount and must be specified with unit_price. If specified amount cannot be
	// provided.
	Quantity float64 `json:"quantity"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified with quantity. If specified amount cannot be
	// provided.
	UnitPrice float64 `json:"unit_price"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AmountDistribution respjson.Field
		EndingBefore       respjson.Field
		Frequency          respjson.Field
		StartingAt         respjson.Field
		Amount             respjson.Field
		Quantity           respjson.Field
		UnitPrice          respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Enter the unit price and quantity for the charge or instead only send the amount. If amount is sent, the unit price is assumed to be the amount and quantity is inferred to be 1.

func (V2ContractGetEditHistoryResponseDataUpdateDiscountScheduleRecurringSchedule) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateDiscountScheduleRecurringSchedule) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateDiscountScheduleScheduleItem added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateDiscountScheduleScheduleItem struct {
	// timestamp of the scheduled event
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// Amount for the charge. Can be provided instead of unit_price and quantity. If
	// amount is sent, the unit_price is assumed to be the amount and quantity is
	// inferred to be 1.
	Amount float64 `json:"amount"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount and must be specified with unit_price. If specified amount cannot be
	// provided.
	Quantity float64 `json:"quantity"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified with quantity. If specified amount cannot be
	// provided.
	UnitPrice float64 `json:"unit_price"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Timestamp   respjson.Field
		Amount      respjson.Field
		Quantity    respjson.Field
		UnitPrice   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateDiscountScheduleScheduleItem) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateDiscountScheduleScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdatePrepaidBalanceThresholdConfiguration

type V2ContractGetEditHistoryResponseDataUpdatePrepaidBalanceThresholdConfiguration struct {
	Commit V2ContractGetEditHistoryResponseDataUpdatePrepaidBalanceThresholdConfigurationCommit `json:"commit"`
	// If provided, the threshold, recharge-to amount, and the resulting threshold
	// commit amount will be in terms of this credit type instead of the fiat currency.
	CustomCreditTypeID string `json:"custom_credit_type_id,nullable" format:"uuid"`
	// When set to false, the contract will not be evaluated against the
	// threshold_amount. Toggling to true will result an immediate evaluation,
	// regardless of prior state.
	IsEnabled         bool                       `json:"is_enabled"`
	PaymentGateConfig shared.PaymentGateConfigV2 `json:"payment_gate_config"`
	// Specify the amount the balance should be recharged to.
	RechargeToAmount float64 `json:"recharge_to_amount"`
	// Specify the threshold amount for the contract. Each time the contract's balance
	// lowers to this amount, a threshold charge will be initiated.
	ThresholdAmount float64 `json:"threshold_amount"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Commit             respjson.Field
		CustomCreditTypeID respjson.Field
		IsEnabled          respjson.Field
		PaymentGateConfig  respjson.Field
		RechargeToAmount   respjson.Field
		ThresholdAmount    respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdatePrepaidBalanceThresholdConfiguration) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdatePrepaidBalanceThresholdConfiguration) UnmarshalJSON

type V2ContractGetEditHistoryResponseDataUpdatePrepaidBalanceThresholdConfigurationCommit

type V2ContractGetEditHistoryResponseDataUpdatePrepaidBalanceThresholdConfigurationCommit struct {
	// Which products the threshold commit applies to. If both applicable_product_ids
	// and applicable_product_tags are not provided, the commit applies to all
	// products.
	ApplicableProductIDs []string `json:"applicable_product_ids,nullable" format:"uuid"`
	// Which tags the threshold commit applies to. If both applicable_product_ids and
	// applicable_product_tags are not provided, the commit applies to all products.
	ApplicableProductTags []string `json:"applicable_product_tags,nullable"`
	// List of filters that determine what kind of customer usage draws down a commit
	// or credit. A customer's usage needs to meet the condition of at least one of the
	// specifiers to contribute to a commit's or credit's drawdown. This field cannot
	// be used together with `applicable_product_ids` or `applicable_product_tags`.
	// Instead, to target usage by product or product tag, pass those values in the
	// body of `specifiers`.
	Specifiers []shared.CommitSpecifierInput `json:"specifiers,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ApplicableProductIDs  respjson.Field
		ApplicableProductTags respjson.Field
		Specifiers            respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.UpdateBaseThresholdCommit
}

func (V2ContractGetEditHistoryResponseDataUpdatePrepaidBalanceThresholdConfigurationCommit) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdatePrepaidBalanceThresholdConfigurationCommit) UnmarshalJSON

type V2ContractGetEditHistoryResponseDataUpdateRecurringCommit

type V2ContractGetEditHistoryResponseDataUpdateRecurringCommit struct {
	ID            string                                                                 `json:"id,required" format:"uuid"`
	AccessAmount  V2ContractGetEditHistoryResponseDataUpdateRecurringCommitAccessAmount  `json:"access_amount"`
	EndingBefore  time.Time                                                              `json:"ending_before" format:"date-time"`
	InvoiceAmount V2ContractGetEditHistoryResponseDataUpdateRecurringCommitInvoiceAmount `json:"invoice_amount"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID            respjson.Field
		AccessAmount  respjson.Field
		EndingBefore  respjson.Field
		InvoiceAmount respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateRecurringCommit) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateRecurringCommit) UnmarshalJSON

type V2ContractGetEditHistoryResponseDataUpdateRecurringCommitAccessAmount added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateRecurringCommitAccessAmount struct {
	Quantity  float64 `json:"quantity"`
	UnitPrice float64 `json:"unit_price"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Quantity    respjson.Field
		UnitPrice   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateRecurringCommitAccessAmount) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateRecurringCommitAccessAmount) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateRecurringCommitInvoiceAmount added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateRecurringCommitInvoiceAmount struct {
	Quantity  float64 `json:"quantity"`
	UnitPrice float64 `json:"unit_price"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Quantity    respjson.Field
		UnitPrice   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateRecurringCommitInvoiceAmount) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateRecurringCommitInvoiceAmount) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateRecurringCredit

type V2ContractGetEditHistoryResponseDataUpdateRecurringCredit struct {
	ID           string                                                                `json:"id,required" format:"uuid"`
	AccessAmount V2ContractGetEditHistoryResponseDataUpdateRecurringCreditAccessAmount `json:"access_amount"`
	EndingBefore time.Time                                                             `json:"ending_before" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID           respjson.Field
		AccessAmount respjson.Field
		EndingBefore respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateRecurringCredit) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateRecurringCredit) UnmarshalJSON

type V2ContractGetEditHistoryResponseDataUpdateRecurringCreditAccessAmount added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateRecurringCreditAccessAmount struct {
	Quantity  float64 `json:"quantity"`
	UnitPrice float64 `json:"unit_price"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Quantity    respjson.Field
		UnitPrice   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateRecurringCreditAccessAmount) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateRecurringCreditAccessAmount) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateRefundInvoice

type V2ContractGetEditHistoryResponseDataUpdateRefundInvoice struct {
	Date      time.Time `json:"date,required" format:"date-time"`
	InvoiceID string    `json:"invoice_id,required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Date        respjson.Field
		InvoiceID   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateRefundInvoice) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateRefundInvoice) UnmarshalJSON

type V2ContractGetEditHistoryResponseDataUpdateScheduledCharge

type V2ContractGetEditHistoryResponseDataUpdateScheduledCharge struct {
	ID                   string                                                                   `json:"id,required" format:"uuid"`
	InvoiceSchedule      V2ContractGetEditHistoryResponseDataUpdateScheduledChargeInvoiceSchedule `json:"invoice_schedule"`
	Name                 string                                                                   `json:"name"`
	NetsuiteSalesOrderID string                                                                   `json:"netsuite_sales_order_id,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                   respjson.Field
		InvoiceSchedule      respjson.Field
		Name                 respjson.Field
		NetsuiteSalesOrderID respjson.Field
		ExtraFields          map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateScheduledCharge) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateScheduledCharge) UnmarshalJSON

type V2ContractGetEditHistoryResponseDataUpdateScheduledChargeInvoiceSchedule added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateScheduledChargeInvoiceSchedule struct {
	AddScheduleItems    []V2ContractGetEditHistoryResponseDataUpdateScheduledChargeInvoiceScheduleAddScheduleItem    `json:"add_schedule_items"`
	RemoveScheduleItems []V2ContractGetEditHistoryResponseDataUpdateScheduledChargeInvoiceScheduleRemoveScheduleItem `json:"remove_schedule_items"`
	UpdateScheduleItems []V2ContractGetEditHistoryResponseDataUpdateScheduledChargeInvoiceScheduleUpdateScheduleItem `json:"update_schedule_items"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AddScheduleItems    respjson.Field
		RemoveScheduleItems respjson.Field
		UpdateScheduleItems respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateScheduledChargeInvoiceSchedule) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateScheduledChargeInvoiceSchedule) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateScheduledChargeInvoiceScheduleAddScheduleItem added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateScheduledChargeInvoiceScheduleAddScheduleItem struct {
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	Amount    float64   `json:"amount"`
	Quantity  float64   `json:"quantity"`
	UnitPrice float64   `json:"unit_price"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Timestamp   respjson.Field
		Amount      respjson.Field
		Quantity    respjson.Field
		UnitPrice   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateScheduledChargeInvoiceScheduleAddScheduleItem) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateScheduledChargeInvoiceScheduleAddScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateScheduledChargeInvoiceScheduleRemoveScheduleItem added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateScheduledChargeInvoiceScheduleRemoveScheduleItem struct {
	ID string `json:"id,required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateScheduledChargeInvoiceScheduleRemoveScheduleItem) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateScheduledChargeInvoiceScheduleRemoveScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateScheduledChargeInvoiceScheduleUpdateScheduleItem added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateScheduledChargeInvoiceScheduleUpdateScheduleItem struct {
	ID        string    `json:"id,required" format:"uuid"`
	Amount    float64   `json:"amount"`
	Quantity  float64   `json:"quantity"`
	Timestamp time.Time `json:"timestamp" format:"date-time"`
	UnitPrice float64   `json:"unit_price"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Amount      respjson.Field
		Quantity    respjson.Field
		Timestamp   respjson.Field
		UnitPrice   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateScheduledChargeInvoiceScheduleUpdateScheduleItem) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateScheduledChargeInvoiceScheduleUpdateScheduleItem) UnmarshalJSON added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateSpendThresholdConfiguration

type V2ContractGetEditHistoryResponseDataUpdateSpendThresholdConfiguration struct {
	Commit shared.UpdateBaseThresholdCommit `json:"commit"`
	// When set to false, the contract will not be evaluated against the
	// threshold_amount. Toggling to true will result an immediate evaluation,
	// regardless of prior state.
	IsEnabled         bool                       `json:"is_enabled"`
	PaymentGateConfig shared.PaymentGateConfigV2 `json:"payment_gate_config"`
	// Specify the threshold amount for the contract. Each time the contract's usage
	// hits this amount, a threshold charge will be initiated.
	ThresholdAmount float64 `json:"threshold_amount"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Commit            respjson.Field
		IsEnabled         respjson.Field
		PaymentGateConfig respjson.Field
		ThresholdAmount   respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateSpendThresholdConfiguration) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateSpendThresholdConfiguration) UnmarshalJSON

type V2ContractGetEditHistoryResponseDataUpdateSubscription

type V2ContractGetEditHistoryResponseDataUpdateSubscription struct {
	ID              string                                                                 `json:"id,required" format:"uuid"`
	EndingBefore    time.Time                                                              `json:"ending_before" format:"date-time"`
	QuantityUpdates []V2ContractGetEditHistoryResponseDataUpdateSubscriptionQuantityUpdate `json:"quantity_updates"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID              respjson.Field
		EndingBefore    respjson.Field
		QuantityUpdates respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateSubscription) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateSubscription) UnmarshalJSON

type V2ContractGetEditHistoryResponseDataUpdateSubscriptionQuantityUpdate added in v1.0.0

type V2ContractGetEditHistoryResponseDataUpdateSubscriptionQuantityUpdate struct {
	StartingAt    time.Time `json:"starting_at,required" format:"date-time"`
	Quantity      float64   `json:"quantity"`
	QuantityDelta float64   `json:"quantity_delta"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		StartingAt    respjson.Field
		Quantity      respjson.Field
		QuantityDelta respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetEditHistoryResponseDataUpdateSubscriptionQuantityUpdate) RawJSON added in v1.0.0

Returns the unmodified JSON received from the API

func (*V2ContractGetEditHistoryResponseDataUpdateSubscriptionQuantityUpdate) UnmarshalJSON added in v1.0.0

type V2ContractGetParams

type V2ContractGetParams struct {
	ContractID string `json:"contract_id,required" format:"uuid"`
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// Optional RFC 3339 timestamp. Return the contract as of this date. Cannot be used
	// with include_ledgers parameter.
	AsOfDate param.Opt[time.Time] `json:"as_of_date,omitzero" format:"date-time"`
	// Include the balance of credits and commits in the response. Setting this flag
	// may cause the query to be slower.
	IncludeBalance param.Opt[bool] `json:"include_balance,omitzero"`
	// Include commit/credit ledgers in the response. Setting this flag may cause the
	// query to be slower. Cannot be used with as_of_date parameter.
	IncludeLedgers param.Opt[bool] `json:"include_ledgers,omitzero"`
	// contains filtered or unexported fields
}

func (V2ContractGetParams) MarshalJSON

func (r V2ContractGetParams) MarshalJSON() (data []byte, err error)

func (*V2ContractGetParams) UnmarshalJSON added in v1.0.0

func (r *V2ContractGetParams) UnmarshalJSON(data []byte) error

type V2ContractGetResponse

type V2ContractGetResponse struct {
	Data shared.ContractV2 `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractGetResponse) RawJSON added in v1.0.0

func (r V2ContractGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V2ContractGetResponse) UnmarshalJSON

func (r *V2ContractGetResponse) UnmarshalJSON(data []byte) error

type V2ContractListParams

type V2ContractListParams struct {
	CustomerID string `json:"customer_id,required" format:"uuid"`
	// Optional RFC 3339 timestamp. Only include contracts active on the provided date.
	// This cannot be provided if starting_at filter is provided.
	CoveringDate param.Opt[time.Time] `json:"covering_date,omitzero" format:"date-time"`
	// Include archived contracts in the response.
	IncludeArchived param.Opt[bool] `json:"include_archived,omitzero"`
	// Include the balance of credits and commits in the response. Setting this flag
	// may cause the response to be slower.
	IncludeBalance param.Opt[bool] `json:"include_balance,omitzero"`
	// Include commit/credit ledgers in the response. Setting this flag may cause the
	// response to be slower.
	IncludeLedgers param.Opt[bool] `json:"include_ledgers,omitzero"`
	// Optional RFC 3339 timestamp. Only include contracts that started on or after
	// this date. This cannot be provided if covering_date filter is provided.
	StartingAt param.Opt[time.Time] `json:"starting_at,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

func (V2ContractListParams) MarshalJSON

func (r V2ContractListParams) MarshalJSON() (data []byte, err error)

func (*V2ContractListParams) UnmarshalJSON added in v1.0.0

func (r *V2ContractListParams) UnmarshalJSON(data []byte) error

type V2ContractListResponse

type V2ContractListResponse struct {
	Data []shared.ContractV2 `json:"data,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (V2ContractListResponse) RawJSON added in v1.0.0

func (r V2ContractListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V2ContractListResponse) UnmarshalJSON

func (r *V2ContractListResponse) UnmarshalJSON(data []byte) error

type V2ContractService

type V2ContractService struct {
	Options []option.RequestOption
}

V2ContractService contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV2ContractService method instead.

func NewV2ContractService

func NewV2ContractService(opts ...option.RequestOption) (r V2ContractService)

NewV2ContractService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V2ContractService) Edit

The ability to edit a contract helps you react quickly to the needs of your customers and your business.

### Use this endpoint to:

- Encode mid-term commitment and discount changes - Fix configuration mistakes and easily roll back packaging changes

### Key response fields:

  • The `id` of the edit
  • Complete edit details. For example, if you edited the contract to add new overrides and credits, you will receive the IDs of those overrides and credits in the response.

### Usage guidelines:

  • When you edit a contract, any draft invoices update immediately to reflect that edit. Finalized invoices remain unchanged - you must void and regenerate them in the UI or API to reflect the edit.
  • Contract editing must be enabled to use this endpoint. Reach out to your Metronome representative to learn more.

func (*V2ContractService) EditCommit

Edit specific details for a contract-level or customer-level commit. Use this endpoint to modify individual commit access schedules, invoice schedules, applicable products, invoicing contracts, or other fields.

### Usage guidelines:

  • As with all edits in Metronome, draft invoices will reflect the edit immediately, while finalized invoices are untouched unless voided and regenerated.
  • If a commit's invoice schedule item is associated with a finalized invoice, you cannot remove or update the invoice schedule item.
  • If a commit's invoice schedule item is associated with a voided invoice, you cannot remove the invoice schedule item.
  • You cannot remove an commit access schedule segment that was applied to a finalized invoice. You can void the invoice beforehand and then remove the access schedule segment.

func (*V2ContractService) EditCredit

Edit details for a contract-level or customer-level credit.

### Use this endpoint to:

  • Extend the duration or the amount of an existing free credit like a trial
  • Modify individual credit access schedules, applicable products, priority, or other fields.

### Usage guidelines:

  • As with all edits in Metronome, draft invoices will reflect the edit immediately, while finalized invoices are untouched unless voided and regenerated.
  • You cannot remove an access schedule segment that was applied to a finalized invoice. You can void the invoice beforehand and then remove the access schedule segment.

func (*V2ContractService) Get

Gets the details for a specific contract, including contract term, rate card information, credits and commits, and more.

### Use this endpoint to:

  • Check the duration of a customer's current contract
  • Get details on contract terms, including access schedule amounts for commitments and credits
  • Understand the state of a contract at a past time. As you can evolve the terms of a contract over time through editing, use the `as_of_date` parameter to view the full contract configuration as of that point in time.

### Usage guidelines:

  • Optionally, use the `include_balance` and `include_ledger` fields to include balances and ledgers in the credit and commit responses. Using these fields will cause the query to be slower.

func (*V2ContractService) GetEditHistory

List all the edits made to a contract over time. In Metronome, you can edit a contract at any point after it's created to fix mistakes or reflect changes in terms. Metronome stores a full history of all edits that were ever made to a contract, whether through the UI, `editContract` endpoint, or other endpoints like `updateContractEndDate`.

### Use this endpoint to:

- Understand what changes were made to a contract, when, and by who

### Key response fields:

  • An array of every edit ever made to the contract
  • Details on each individual edit - for example showing that in one edit, a user added two discounts and incremented a subscription quantity.

func (*V2ContractService) List

For a given customer, lists all of their contracts in chronological order.

### Use this endpoint to:

  • Check if a customer is provisioned with any contract, and at which tier
  • Check the duration and terms of a customer's current contract
  • Power a page in your end customer experience that shows the customer's history of tiers (e.g. this customer started out on the Pro Plan, then downgraded to the Starter plan).

### Usage guidelines:

Use the `starting_at`, `covering_date`, and `include_archived` parameters to filter the list of returned contracts. For example, to list only currently active contracts, pass `covering_date` equal to the current time.

type V2Service

type V2Service struct {
	Options   []option.RequestOption
	Contracts V2ContractService
}

V2Service contains methods and other services that help with interacting with the metronome API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV2Service method instead.

func NewV2Service

func NewV2Service(opts ...option.RequestOption) (r V2Service)

NewV2Service generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

Directories

Path Synopsis
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
Package json implements encoding and decoding of JSON as defined in RFC 7159.
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.21, and used by the Go 1.24 encoding/json package.
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.21, and used by the Go 1.24 encoding/json package.
packages

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL