metronome

package module
v0.1.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

README

Metronome Go API Library

[!WARNING] This is prerelease software that is not ready for production use. There may be bugs and there will be breaking changes version to version. Use at your own risk.

Go Reference

The Metronome Go library provides convenient access to the Metronome REST API from applications written in Go. The full API of this library can be found in api.md.

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@v0.1.0-beta.3'

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")
	)
	client.Usage.Ingest(context.TODO(), metronome.UsageIngestParams{
		Usage: []metronome.UsageIngestParamsUsage{{
			CustomerID:    metronome.F("team@example.com"),
			EventType:     metronome.F("heartbeat"),
			Timestamp:     metronome.F("2021-01-01T00:00:00Z"),
			TransactionID: metronome.F("2021-01-01T00:00:00Z_cluster42"),
		}},
	})
	if err != nil {
		panic(err.Error())
	}
}

Request fields

All request parameters are wrapped in a generic Field type, which we use to distinguish zero values from null or omitted fields.

This prevents accidentally sending a zero value if you forget a required parameter, and enables explicitly sending null, false, '', or 0 on optional parameters. Any field not specified is not sent.

To construct fields with values, use the helpers String(), Int(), Float(), or most commonly, the generic F[T](). To send a null, use Null[T](), and to send a nonconforming value, use Raw[T](any). For example:

params := FooParams{
	Name: metronome.F("hello"),

	// Explicitly send `"description": null`
	Description: metronome.Null[string](),

	Point: metronome.F(metronome.Point{
		X: metronome.Int(0),
		Y: metronome.Int(1),

		// In cases where the API specifies a given type,
		// but you want to send something else, use `Raw`:
		Z: metronome.Raw[int64](0.01), // sends a float
	}),
}
Response objects

All fields in response structs are value types (not pointers or wrappers).

If a given field is null, not present, or invalid, the corresponding field will simply be its zero value.

All response structs also include a special JSON field, containing more detailed information about each property, which you can use like so:

if res.Name == "" {
	// true if `"name"` is either not present or explicitly null
	res.JSON.Name.IsNull()

	// true if the `"name"` key was not present in the repsonse JSON at all
	res.JSON.Name.IsMissing()

	// When the API returns data that cannot be coerced to the expected type:
	if res.JSON.Name.IsInvalid() {
		raw := res.JSON.Name.Raw()

		legacyName := struct{
			First string `json:"first"`
			Last  string `json:"last"`
		}{}
		json.Unmarshal([]byte(raw), &legacyName)
		name = legacyName.First + " " + legacyName.Last
	}
}

These .JSON structs also include an Extras 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()
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.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"}),
)

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.Contracts.Products.ListAutoPaging(context.TODO(), metronome.ContractProductListParams{})
// Automatically fetches more pages as needed.
for iter.Next() {
	contractProductListResponse := iter.Current()
	fmt.Printf("%+v\n", contractProductListResponse)
}
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.Contracts.Products.List(context.TODO(), metronome.ContractProductListParams{})
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.Contracts.New(context.TODO(), metronome.ContractNewParams{
	CustomerID: metronome.F("13117714-3f05-48e5-a6e9-a66093f13b4d"),
	StartingAt: metronome.F(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 "/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.Contracts.New(
	ctx,
	metronome.ContractNewParams{
		CustomerID: metronome.F("13117714-3f05-48e5-a6e9-a66093f13b4d"),
		StartingAt: metronome.F(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 param.Field[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.FileParam(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.Contracts.New(
	context.TODO(),
	metronome.ContractNewParams{
		CustomerID: metronome.F("13117714-3f05-48e5-a6e9-a66093f13b4d"),
		StartingAt: metronome.F(time.Now()),
	},
	option.WithMaxRetries(5),
)
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]interface{}

    // 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:   metronome.F("id_xxxx"),
    Data: metronome.F(FooNewParamsData{
        FirstName: metronome.F("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.

Documentation

Index

Constants

View Source
const CommitLedgerPostpaidCommitAutomatedInvoiceDeductionLedgerEntryTypePostpaidCommitAutomatedInvoiceDeduction = shared.CommitLedgerPostpaidCommitAutomatedInvoiceDeductionLedgerEntryTypePostpaidCommitAutomatedInvoiceDeduction

This is an alias to an internal value.

View Source
const CommitLedgerPostpaidCommitExpirationLedgerEntryTypePostpaidCommitExpiration = shared.CommitLedgerPostpaidCommitExpirationLedgerEntryTypePostpaidCommitExpiration

This is an alias to an internal value.

View Source
const CommitLedgerPostpaidCommitInitialBalanceLedgerEntryTypePostpaidCommitInitialBalance = shared.CommitLedgerPostpaidCommitInitialBalanceLedgerEntryTypePostpaidCommitInitialBalance

This is an alias to an internal value.

View Source
const CommitLedgerPostpaidCommitManualLedgerEntryTypePostpaidCommitManual = shared.CommitLedgerPostpaidCommitManualLedgerEntryTypePostpaidCommitManual

This is an alias to an internal value.

View Source
const CommitLedgerPostpaidCommitRolloverLedgerEntryTypePostpaidCommitRollover = shared.CommitLedgerPostpaidCommitRolloverLedgerEntryTypePostpaidCommitRollover

This is an alias to an internal value.

View Source
const CommitLedgerPostpaidCommitTrueupLedgerEntryTypePostpaidCommitTrueup = shared.CommitLedgerPostpaidCommitTrueupLedgerEntryTypePostpaidCommitTrueup

This is an alias to an internal value.

View Source
const CommitLedgerPrepaidCommitAutomatedInvoiceDeductionLedgerEntryTypePrepaidCommitAutomatedInvoiceDeduction = shared.CommitLedgerPrepaidCommitAutomatedInvoiceDeductionLedgerEntryTypePrepaidCommitAutomatedInvoiceDeduction

This is an alias to an internal value.

View Source
const CommitLedgerPrepaidCommitCanceledLedgerEntryTypePrepaidCommitCanceled = shared.CommitLedgerPrepaidCommitCanceledLedgerEntryTypePrepaidCommitCanceled

This is an alias to an internal value.

View Source
const CommitLedgerPrepaidCommitCreditedLedgerEntryTypePrepaidCommitCredited = shared.CommitLedgerPrepaidCommitCreditedLedgerEntryTypePrepaidCommitCredited

This is an alias to an internal value.

View Source
const CommitLedgerPrepaidCommitExpirationLedgerEntryTypePrepaidCommitExpiration = shared.CommitLedgerPrepaidCommitExpirationLedgerEntryTypePrepaidCommitExpiration

This is an alias to an internal value.

View Source
const CommitLedgerPrepaidCommitManualLedgerEntryTypePrepaidCommitManual = shared.CommitLedgerPrepaidCommitManualLedgerEntryTypePrepaidCommitManual

This is an alias to an internal value.

View Source
const CommitLedgerPrepaidCommitRolloverLedgerEntryTypePrepaidCommitRollover = shared.CommitLedgerPrepaidCommitRolloverLedgerEntryTypePrepaidCommitRollover

This is an alias to an internal value.

View Source
const CommitLedgerPrepaidCommitSegmentStartLedgerEntryTypePrepaidCommitSegmentStart = shared.CommitLedgerPrepaidCommitSegmentStartLedgerEntryTypePrepaidCommitSegmentStart

This is an alias to an internal value.

View Source
const CommitLedgerTypePostpaidCommitAutomatedInvoiceDeduction = shared.CommitLedgerTypePostpaidCommitAutomatedInvoiceDeduction

This is an alias to an internal value.

View Source
const CommitLedgerTypePostpaidCommitExpiration = shared.CommitLedgerTypePostpaidCommitExpiration

This is an alias to an internal value.

View Source
const CommitLedgerTypePostpaidCommitInitialBalance = shared.CommitLedgerTypePostpaidCommitInitialBalance

This is an alias to an internal value.

View Source
const CommitLedgerTypePostpaidCommitManual = shared.CommitLedgerTypePostpaidCommitManual

This is an alias to an internal value.

View Source
const CommitLedgerTypePostpaidCommitRollover = shared.CommitLedgerTypePostpaidCommitRollover

This is an alias to an internal value.

View Source
const CommitLedgerTypePostpaidCommitTrueup = shared.CommitLedgerTypePostpaidCommitTrueup

This is an alias to an internal value.

View Source
const CommitLedgerTypePrepaidCommitAutomatedInvoiceDeduction = shared.CommitLedgerTypePrepaidCommitAutomatedInvoiceDeduction

This is an alias to an internal value.

View Source
const CommitLedgerTypePrepaidCommitCanceled = shared.CommitLedgerTypePrepaidCommitCanceled

This is an alias to an internal value.

View Source
const CommitLedgerTypePrepaidCommitCredited = shared.CommitLedgerTypePrepaidCommitCredited

This is an alias to an internal value.

View Source
const CommitLedgerTypePrepaidCommitExpiration = shared.CommitLedgerTypePrepaidCommitExpiration

This is an alias to an internal value.

View Source
const CommitLedgerTypePrepaidCommitManual = shared.CommitLedgerTypePrepaidCommitManual

This is an alias to an internal value.

View Source
const CommitLedgerTypePrepaidCommitRollover = shared.CommitLedgerTypePrepaidCommitRollover

This is an alias to an internal value.

View Source
const CommitLedgerTypePrepaidCommitSegmentStart = shared.CommitLedgerTypePrepaidCommitSegmentStart

This is an alias to an internal value.

View Source
const CommitTypePostpaid = shared.CommitTypePostpaid

This is an alias to an internal value.

View Source
const CommitTypePrepaid = shared.CommitTypePrepaid

This is an alias to an internal value.

View Source
const ContractWithoutAmendmentsResellerRoyaltiesResellerTypeAws = shared.ContractWithoutAmendmentsResellerRoyaltiesResellerTypeAws

This is an alias to an internal value.

View Source
const ContractWithoutAmendmentsResellerRoyaltiesResellerTypeAwsProService = shared.ContractWithoutAmendmentsResellerRoyaltiesResellerTypeAwsProService

This is an alias to an internal value.

View Source
const ContractWithoutAmendmentsResellerRoyaltiesResellerTypeGcp = shared.ContractWithoutAmendmentsResellerRoyaltiesResellerTypeGcp

This is an alias to an internal value.

View Source
const ContractWithoutAmendmentsResellerRoyaltiesResellerTypeGcpProService = shared.ContractWithoutAmendmentsResellerRoyaltiesResellerTypeGcpProService

This is an alias to an internal value.

View Source
const ContractWithoutAmendmentsTransitionsTypeRenewal = shared.ContractWithoutAmendmentsTransitionsTypeRenewal

This is an alias to an internal value.

View Source
const ContractWithoutAmendmentsTransitionsTypeSupersede = shared.ContractWithoutAmendmentsTransitionsTypeSupersede

This is an alias to an internal value.

View Source
const ContractWithoutAmendmentsUsageStatementScheduleFrequencyMonthly = shared.ContractWithoutAmendmentsUsageStatementScheduleFrequencyMonthly

This is an alias to an internal value.

View Source
const ContractWithoutAmendmentsUsageStatementScheduleFrequencyQuarterly = shared.ContractWithoutAmendmentsUsageStatementScheduleFrequencyQuarterly

This is an alias to an internal value.

View Source
const CreditLedgerCreditAutomatedInvoiceDeductionLedgerEntryTypeCreditAutomatedInvoiceDeduction = shared.CreditLedgerCreditAutomatedInvoiceDeductionLedgerEntryTypeCreditAutomatedInvoiceDeduction

This is an alias to an internal value.

View Source
const CreditLedgerCreditCanceledLedgerEntryTypeCreditCanceled = shared.CreditLedgerCreditCanceledLedgerEntryTypeCreditCanceled

This is an alias to an internal value.

View Source
const CreditLedgerCreditCreditedLedgerEntryTypeCreditCredited = shared.CreditLedgerCreditCreditedLedgerEntryTypeCreditCredited

This is an alias to an internal value.

View Source
const CreditLedgerCreditExpirationLedgerEntryTypeCreditExpiration = shared.CreditLedgerCreditExpirationLedgerEntryTypeCreditExpiration

This is an alias to an internal value.

View Source
const CreditLedgerCreditManualLedgerEntryTypeCreditManual = shared.CreditLedgerCreditManualLedgerEntryTypeCreditManual

This is an alias to an internal value.

View Source
const CreditLedgerCreditSegmentStartLedgerEntryTypeCreditSegmentStart = shared.CreditLedgerCreditSegmentStartLedgerEntryTypeCreditSegmentStart

This is an alias to an internal value.

View Source
const CreditLedgerTypeCreditAutomatedInvoiceDeduction = shared.CreditLedgerTypeCreditAutomatedInvoiceDeduction

This is an alias to an internal value.

View Source
const CreditLedgerTypeCreditCanceled = shared.CreditLedgerTypeCreditCanceled

This is an alias to an internal value.

View Source
const CreditLedgerTypeCreditCredited = shared.CreditLedgerTypeCreditCredited

This is an alias to an internal value.

View Source
const CreditLedgerTypeCreditExpiration = shared.CreditLedgerTypeCreditExpiration

This is an alias to an internal value.

View Source
const CreditLedgerTypeCreditManual = shared.CreditLedgerTypeCreditManual

This is an alias to an internal value.

View Source
const CreditLedgerTypeCreditSegmentStart = shared.CreditLedgerTypeCreditSegmentStart

This is an alias to an internal value.

View Source
const CreditTypeCredit = shared.CreditTypeCredit

This is an alias to an internal value.

View Source
const OverrideOverwriteRateRateTypeCustom = shared.OverrideOverwriteRateRateTypeCustom

This is an alias to an internal value.

View Source
const OverrideOverwriteRateRateTypeFlat = shared.OverrideOverwriteRateRateTypeFlat

This is an alias to an internal value.

View Source
const OverrideOverwriteRateRateTypePercentage = shared.OverrideOverwriteRateRateTypePercentage

This is an alias to an internal value.

View Source
const OverrideOverwriteRateRateTypeSubscription = shared.OverrideOverwriteRateRateTypeSubscription

This is an alias to an internal value.

View Source
const OverrideOverwriteRateRateTypeTiered = shared.OverrideOverwriteRateRateTypeTiered

This is an alias to an internal value.

View Source
const OverrideRateTypeCustom = shared.OverrideRateTypeCustom

This is an alias to an internal value.

View Source
const OverrideRateTypeFlat = shared.OverrideRateTypeFlat

This is an alias to an internal value.

View Source
const OverrideRateTypePercentage = shared.OverrideRateTypePercentage

This is an alias to an internal value.

View Source
const OverrideRateTypeSubscription = shared.OverrideRateTypeSubscription

This is an alias to an internal value.

View Source
const OverrideRateTypeTiered = shared.OverrideRateTypeTiered

This is an alias to an internal value.

View Source
const OverrideTypeMultiplier = shared.OverrideTypeMultiplier

This is an alias to an internal value.

View Source
const OverrideTypeOverwrite = shared.OverrideTypeOverwrite

This is an alias to an internal value.

View Source
const OverrideTypeTiered = shared.OverrideTypeTiered

This is an alias to an internal value.

View Source
const RateRateTypeCustom = shared.RateRateTypeCustom

This is an alias to an internal value.

View Source
const RateRateTypeFlat = shared.RateRateTypeFlat

This is an alias to an internal value.

View Source
const RateRateTypePercentage = shared.RateRateTypePercentage

This is an alias to an internal value.

View Source
const RateRateTypeSubscription = shared.RateRateTypeSubscription

This is an alias to an internal value.

View Source
const RateRateTypeTiered = shared.RateRateTypeTiered

This is an alias to an internal value.

Variables

This section is empty.

Functions

func Bool

func Bool(value bool) param.Field[bool]

Bool is a param field helper which helps specify bools.

func F

func F[T any](value T) param.Field[T]

F is a param field helper used to initialize a param.Field generic struct. This helps specify null, zero values, and overrides, as well as normal values. You can read more about this in our README.

func FileParam

func FileParam(reader io.Reader, filename string, contentType string) param.Field[io.Reader]

FileParam is a param field helper which helps files with a mime content-type.

func Float

func Float(value float64) param.Field[float64]

Float is a param field helper which helps specify floats.

func Int

func Int(value int64) param.Field[int64]

Int is a param field helper which helps specify integers. This is particularly helpful when specifying integer constants for fields.

func Null

func Null[T any]() param.Field[T]

Null is a param field helper which explicitly sends null to the API.

func Raw

func Raw[T any](value any) param.Field[T]

Raw is a param field helper for specifying values for fields when the type you are looking to send is different from the type that is specified in the SDK. For example, if the type of the field is an integer, but you want to send a float, you could do that by setting the corresponding field with Raw[int](0.5).

func String

func String(value string) param.Field[string]

String is a param field helper which helps specify strings.

Types

type AlertArchiveParams

type AlertArchiveParams struct {
	ID shared.IDParam `json:"id,required"`
}

func (AlertArchiveParams) MarshalJSON

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

type AlertArchiveResponse

type AlertArchiveResponse struct {
	Data shared.ID                `json:"data,required"`
	JSON alertArchiveResponseJSON `json:"-"`
}

func (*AlertArchiveResponse) UnmarshalJSON

func (r *AlertArchiveResponse) UnmarshalJSON(data []byte) (err error)

type AlertNewParams

type AlertNewParams struct {
	// Type of the alert
	AlertType param.Field[AlertNewParamsAlertType] `json:"alert_type,required"`
	// Name of the alert
	Name param.Field[string] `json:"name,required"`
	// Threshold value of the alert policy
	Threshold param.Field[float64] `json:"threshold,required"`
	// For alerts of type `usage_threshold_reached`, specifies which billable metric to
	// track the usage for.
	BillableMetricID param.Field[string] `json:"billable_metric_id" format:"uuid"`
	// 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 param.Field[[]string] `json:"credit_grant_type_filters"`
	CreditTypeID           param.Field[string]   `json:"credit_type_id" format:"uuid"`
	// Only present for beta contract invoices. This field's availability is dependent
	// on your client's configuration. A list of custom field filters for alert types
	// that support advanced filtering
	CustomFieldFilters param.Field[[]AlertNewParamsCustomFieldFilter] `json:"custom_field_filters"`
	// If provided, will create this alert for this specific customer. To create an
	// alert for all customers, do not specify `customer_id` or `plan_id`.
	CustomerID param.Field[string] `json:"customer_id" 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.Field[bool] `json:"evaluate_on_create"`
	// Scopes alert evaluation to a specific presentation group key on individual line
	// items. Only present for spend alerts.
	GroupKeyFilter param.Field[AlertNewParamsGroupKeyFilter] `json:"group_key_filter"`
	// Only supported for invoice_total_reached alerts. A list of invoice types to
	// evaluate.
	InvoiceTypesFilter param.Field[[]string] `json:"invoice_types_filter"`
	// If provided, will create this alert for this specific plan. To create an alert
	// for all customers, do not specify `customer_id` or `plan_id`.
	PlanID param.Field[string] `json:"plan_id" 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.Field[string] `json:"uniqueness_key"`
}

func (AlertNewParams) MarshalJSON

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

type AlertNewParamsAlertType

type AlertNewParamsAlertType string

Type of the alert

const (
	AlertNewParamsAlertTypeLowCreditBalanceReached                           AlertNewParamsAlertType = "low_credit_balance_reached"
	AlertNewParamsAlertTypeSpendThresholdReached                             AlertNewParamsAlertType = "spend_threshold_reached"
	AlertNewParamsAlertTypeMonthlyInvoiceTotalSpendThresholdReached          AlertNewParamsAlertType = "monthly_invoice_total_spend_threshold_reached"
	AlertNewParamsAlertTypeLowRemainingDaysInPlanReached                     AlertNewParamsAlertType = "low_remaining_days_in_plan_reached"
	AlertNewParamsAlertTypeLowRemainingCreditPercentageReached               AlertNewParamsAlertType = "low_remaining_credit_percentage_reached"
	AlertNewParamsAlertTypeUsageThresholdReached                             AlertNewParamsAlertType = "usage_threshold_reached"
	AlertNewParamsAlertTypeLowRemainingDaysForCommitSegmentReached           AlertNewParamsAlertType = "low_remaining_days_for_commit_segment_reached"
	AlertNewParamsAlertTypeLowRemainingCommitBalanceReached                  AlertNewParamsAlertType = "low_remaining_commit_balance_reached"
	AlertNewParamsAlertTypeLowRemainingCommitPercentageReached               AlertNewParamsAlertType = "low_remaining_commit_percentage_reached"
	AlertNewParamsAlertTypeLowRemainingDaysForContractCreditSegmentReached   AlertNewParamsAlertType = "low_remaining_days_for_contract_credit_segment_reached"
	AlertNewParamsAlertTypeLowRemainingContractCreditBalanceReached          AlertNewParamsAlertType = "low_remaining_contract_credit_balance_reached"
	AlertNewParamsAlertTypeLowRemainingContractCreditPercentageReached       AlertNewParamsAlertType = "low_remaining_contract_credit_percentage_reached"
	AlertNewParamsAlertTypeLowRemainingContractCreditAndCommitBalanceReached AlertNewParamsAlertType = "low_remaining_contract_credit_and_commit_balance_reached"
	AlertNewParamsAlertTypeInvoiceTotalReached                               AlertNewParamsAlertType = "invoice_total_reached"
)

func (AlertNewParamsAlertType) IsKnown

func (r AlertNewParamsAlertType) IsKnown() bool

type AlertNewParamsCustomFieldFilter

type AlertNewParamsCustomFieldFilter struct {
	Entity param.Field[AlertNewParamsCustomFieldFiltersEntity] `json:"entity,required"`
	Key    param.Field[string]                                 `json:"key,required"`
	Value  param.Field[string]                                 `json:"value,required"`
}

func (AlertNewParamsCustomFieldFilter) MarshalJSON

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

type AlertNewParamsCustomFieldFiltersEntity

type AlertNewParamsCustomFieldFiltersEntity string
const (
	AlertNewParamsCustomFieldFiltersEntityContract       AlertNewParamsCustomFieldFiltersEntity = "Contract"
	AlertNewParamsCustomFieldFiltersEntityCommit         AlertNewParamsCustomFieldFiltersEntity = "Commit"
	AlertNewParamsCustomFieldFiltersEntityContractCredit AlertNewParamsCustomFieldFiltersEntity = "ContractCredit"
)

func (AlertNewParamsCustomFieldFiltersEntity) IsKnown

type AlertNewParamsGroupKeyFilter

type AlertNewParamsGroupKeyFilter struct {
	Key   param.Field[string] `json:"key,required"`
	Value param.Field[string] `json:"value,required"`
}

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

func (AlertNewParamsGroupKeyFilter) MarshalJSON

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

type AlertNewResponse

type AlertNewResponse struct {
	Data shared.ID            `json:"data,required"`
	JSON alertNewResponseJSON `json:"-"`
}

func (*AlertNewResponse) UnmarshalJSON

func (r *AlertNewResponse) UnmarshalJSON(data []byte) (err error)

type AlertService

type AlertService struct {
	Options []option.RequestOption
}

AlertService 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 NewAlertService method instead.

func NewAlertService

func NewAlertService(opts ...option.RequestOption) (r *AlertService)

NewAlertService 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 (*AlertService) Archive

func (r *AlertService) Archive(ctx context.Context, body AlertArchiveParams, opts ...option.RequestOption) (res *AlertArchiveResponse, err error)

Archive an existing alert

func (*AlertService) New

func (r *AlertService) New(ctx context.Context, body AlertNewParams, opts ...option.RequestOption) (res *AlertNewResponse, err error)

Create a new alert

type AuditLogListParams

type AuditLogListParams struct {
	// RFC 3339 timestamp (exclusive). Cannot be used with 'next_page'.
	EndingBefore param.Field[time.Time] `query:"ending_before" format:"date-time"`
	// Max number of results that should be returned
	Limit param.Field[int64] `query:"limit"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
	// 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.Field[string] `query:"resource_id"`
	// 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.Field[string] `query:"resource_type"`
	// Sort order by timestamp, e.g. date_asc or date_desc. Defaults to date_asc.
	Sort param.Field[AuditLogListParamsSort] `query:"sort"`
	// RFC 3339 timestamp of the earliest audit log to return. Cannot be used with
	// 'next_page'.
	StartingOn param.Field[time.Time] `query:"starting_on" format:"date-time"`
}

func (AuditLogListParams) URLQuery

func (r AuditLogListParams) URLQuery() (v url.Values)

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

type AuditLogListParamsSort

type AuditLogListParamsSort string

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

const (
	AuditLogListParamsSortDateAsc  AuditLogListParamsSort = "date_asc"
	AuditLogListParamsSortDateDesc AuditLogListParamsSort = "date_desc"
)

func (AuditLogListParamsSort) IsKnown

func (r AuditLogListParamsSort) IsKnown() bool

type AuditLogListResponse

type AuditLogListResponse struct {
	ID           string                     `json:"id,required"`
	Timestamp    time.Time                  `json:"timestamp,required" format:"date-time"`
	Action       string                     `json:"action"`
	Actor        AuditLogListResponseActor  `json:"actor"`
	Description  string                     `json:"description"`
	ResourceID   string                     `json:"resource_id"`
	ResourceType string                     `json:"resource_type"`
	Status       AuditLogListResponseStatus `json:"status"`
	JSON         auditLogListResponseJSON   `json:"-"`
}

func (*AuditLogListResponse) UnmarshalJSON

func (r *AuditLogListResponse) UnmarshalJSON(data []byte) (err error)

type AuditLogListResponseActor

type AuditLogListResponseActor struct {
	ID    string                        `json:"id,required"`
	Name  string                        `json:"name,required"`
	Email string                        `json:"email"`
	JSON  auditLogListResponseActorJSON `json:"-"`
}

func (*AuditLogListResponseActor) UnmarshalJSON

func (r *AuditLogListResponseActor) UnmarshalJSON(data []byte) (err error)

type AuditLogListResponseStatus

type AuditLogListResponseStatus string
const (
	AuditLogListResponseStatusSuccess AuditLogListResponseStatus = "success"
	AuditLogListResponseStatusFailure AuditLogListResponseStatus = "failure"
	AuditLogListResponseStatusPending AuditLogListResponseStatus = "pending"
)

func (AuditLogListResponseStatus) IsKnown

func (r AuditLogListResponseStatus) IsKnown() bool

type AuditLogService

type AuditLogService struct {
	Options []option.RequestOption
}

AuditLogService 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 NewAuditLogService method instead.

func NewAuditLogService

func NewAuditLogService(opts ...option.RequestOption) (r *AuditLogService)

NewAuditLogService 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 (*AuditLogService) List

Retrieves a range of audit logs. If no further audit logs are currently available, the data array will be empty. As new audit logs are created, subsequent requests using the same next_page value will be in the returned data array, ensuring a continuous and uninterrupted reading of audit logs.

func (*AuditLogService) ListAutoPaging

Retrieves a range of audit logs. If no further audit logs are currently available, the data array will be empty. As new audit logs are created, subsequent requests using the same next_page value will be in the returned data array, ensuring a continuous and uninterrupted reading of audit logs.

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 BillableMetricArchiveParams

type BillableMetricArchiveParams struct {
	ID shared.IDParam `json:"id,required"`
}

func (BillableMetricArchiveParams) MarshalJSON

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

type BillableMetricArchiveResponse

type BillableMetricArchiveResponse struct {
	Data shared.ID                         `json:"data,required"`
	JSON billableMetricArchiveResponseJSON `json:"-"`
}

func (*BillableMetricArchiveResponse) UnmarshalJSON

func (r *BillableMetricArchiveResponse) UnmarshalJSON(data []byte) (err error)

type BillableMetricGetResponse

type BillableMetricGetResponse struct {
	Data BillableMetricGetResponseData `json:"data,required"`
	JSON billableMetricGetResponseJSON `json:"-"`
}

func (*BillableMetricGetResponse) UnmarshalJSON

func (r *BillableMetricGetResponse) UnmarshalJSON(data []byte) (err error)

type BillableMetricGetResponseData

type BillableMetricGetResponseData 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.
	AggregationType BillableMetricGetResponseDataAggregationType `json:"aggregation_type"`
	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 billableMetricGetResponseDataJSON `json:"-"`
}

func (*BillableMetricGetResponseData) UnmarshalJSON

func (r *BillableMetricGetResponseData) UnmarshalJSON(data []byte) (err error)

type BillableMetricGetResponseDataAggregationType

type BillableMetricGetResponseDataAggregationType string

Specifies the type of aggregation performed on matching events.

const (
	BillableMetricGetResponseDataAggregationTypeCount  BillableMetricGetResponseDataAggregationType = "COUNT"
	BillableMetricGetResponseDataAggregationTypeLatest BillableMetricGetResponseDataAggregationType = "LATEST"
	BillableMetricGetResponseDataAggregationTypeMax    BillableMetricGetResponseDataAggregationType = "MAX"
	BillableMetricGetResponseDataAggregationTypeSum    BillableMetricGetResponseDataAggregationType = "SUM"
	BillableMetricGetResponseDataAggregationTypeUnique BillableMetricGetResponseDataAggregationType = "UNIQUE"
)

func (BillableMetricGetResponseDataAggregationType) IsKnown

type BillableMetricListParams

type BillableMetricListParams struct {
	// Max number of results that should be returned
	Limit param.Field[int64] `query:"limit"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
}

func (BillableMetricListParams) URLQuery

func (r BillableMetricListParams) URLQuery() (v url.Values)

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

type BillableMetricListResponse

type BillableMetricListResponse 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.
	AggregationType BillableMetricListResponseAggregationType `json:"aggregation_type"`
	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 billableMetricListResponseJSON `json:"-"`
}

func (*BillableMetricListResponse) UnmarshalJSON

func (r *BillableMetricListResponse) UnmarshalJSON(data []byte) (err error)

type BillableMetricListResponseAggregationType

type BillableMetricListResponseAggregationType string

Specifies the type of aggregation performed on matching events.

const (
	BillableMetricListResponseAggregationTypeCount  BillableMetricListResponseAggregationType = "COUNT"
	BillableMetricListResponseAggregationTypeLatest BillableMetricListResponseAggregationType = "LATEST"
	BillableMetricListResponseAggregationTypeMax    BillableMetricListResponseAggregationType = "MAX"
	BillableMetricListResponseAggregationTypeSum    BillableMetricListResponseAggregationType = "SUM"
	BillableMetricListResponseAggregationTypeUnique BillableMetricListResponseAggregationType = "UNIQUE"
)

func (BillableMetricListResponseAggregationType) IsKnown

type BillableMetricNewParams

type BillableMetricNewParams struct {
	// Specifies the type of aggregation performed on matching events.
	AggregationType param.Field[BillableMetricNewParamsAggregationType] `json:"aggregation_type,required"`
	// The display name of the billable metric.
	Name param.Field[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 param.Field[string] `json:"aggregation_key"`
	// Custom fields to attach to the billable metric.
	CustomFields param.Field[map[string]string] `json:"custom_fields"`
	// An optional filtering rule to match the 'event_type' property of an event.
	EventTypeFilter param.Field[shared.EventTypeFilterParam] `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 param.Field[[][]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 param.Field[[]shared.PropertyFilterParam] `json:"property_filters"`
}

func (BillableMetricNewParams) MarshalJSON

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

type BillableMetricNewParamsAggregationType

type BillableMetricNewParamsAggregationType string

Specifies the type of aggregation performed on matching events.

const (
	BillableMetricNewParamsAggregationTypeCount  BillableMetricNewParamsAggregationType = "COUNT"
	BillableMetricNewParamsAggregationTypeLatest BillableMetricNewParamsAggregationType = "LATEST"
	BillableMetricNewParamsAggregationTypeMax    BillableMetricNewParamsAggregationType = "MAX"
	BillableMetricNewParamsAggregationTypeSum    BillableMetricNewParamsAggregationType = "SUM"
	BillableMetricNewParamsAggregationTypeUnique BillableMetricNewParamsAggregationType = "UNIQUE"
)

func (BillableMetricNewParamsAggregationType) IsKnown

type BillableMetricNewResponse

type BillableMetricNewResponse struct {
	Data shared.ID                     `json:"data,required"`
	JSON billableMetricNewResponseJSON `json:"-"`
}

func (*BillableMetricNewResponse) UnmarshalJSON

func (r *BillableMetricNewResponse) UnmarshalJSON(data []byte) (err error)

type BillableMetricService

type BillableMetricService struct {
	Options []option.RequestOption
}

BillableMetricService 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 NewBillableMetricService method instead.

func NewBillableMetricService

func NewBillableMetricService(opts ...option.RequestOption) (r *BillableMetricService)

NewBillableMetricService 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 (*BillableMetricService) Archive

Archive an existing billable metric.

func (*BillableMetricService) Get

func (r *BillableMetricService) Get(ctx context.Context, billableMetricID string, opts ...option.RequestOption) (res *BillableMetricGetResponse, err error)

Get a billable metric.

func (*BillableMetricService) List

List all billable metrics.

func (*BillableMetricService) ListAutoPaging

List all billable metrics.

func (*BillableMetricService) New

Creates a new Billable Metric.

type Client

type Client struct {
	Options         []option.RequestOption
	Alerts          *AlertService
	Plans           *PlanService
	CreditGrants    *CreditGrantService
	Customers       *CustomerService
	Dashboards      *DashboardService
	Usage           *UsageService
	AuditLogs       *AuditLogService
	CustomFields    *CustomFieldService
	BillableMetrics *BillableMetricService
	Services        *ServiceService
	Invoices        *InvoiceService
	Contracts       *ContractService
}

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). 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 interface{}, res interface{}, 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 interface{}, res interface{}, 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 interface{}, res interface{}, 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 interface{}, res interface{}, 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 interface{}, res interface{}, 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 interface{}, res interface{}, 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 CommitInvoiceContract

type CommitInvoiceContract = shared.CommitInvoiceContract

The contract that this commit will be billed on.

This is an alias to an internal type.

type CommitLedger

type CommitLedger = shared.CommitLedger

This is an alias to an internal type.

type CommitLedgerPostpaidCommitAutomatedInvoiceDeductionLedgerEntry

type CommitLedgerPostpaidCommitAutomatedInvoiceDeductionLedgerEntry = shared.CommitLedgerPostpaidCommitAutomatedInvoiceDeductionLedgerEntry

This is an alias to an internal type.

type CommitLedgerPostpaidCommitAutomatedInvoiceDeductionLedgerEntryType

type CommitLedgerPostpaidCommitAutomatedInvoiceDeductionLedgerEntryType = shared.CommitLedgerPostpaidCommitAutomatedInvoiceDeductionLedgerEntryType

This is an alias to an internal type.

type CommitLedgerPostpaidCommitExpirationLedgerEntry

type CommitLedgerPostpaidCommitExpirationLedgerEntry = shared.CommitLedgerPostpaidCommitExpirationLedgerEntry

This is an alias to an internal type.

type CommitLedgerPostpaidCommitExpirationLedgerEntryType

type CommitLedgerPostpaidCommitExpirationLedgerEntryType = shared.CommitLedgerPostpaidCommitExpirationLedgerEntryType

This is an alias to an internal type.

type CommitLedgerPostpaidCommitInitialBalanceLedgerEntry

type CommitLedgerPostpaidCommitInitialBalanceLedgerEntry = shared.CommitLedgerPostpaidCommitInitialBalanceLedgerEntry

This is an alias to an internal type.

type CommitLedgerPostpaidCommitInitialBalanceLedgerEntryType

type CommitLedgerPostpaidCommitInitialBalanceLedgerEntryType = shared.CommitLedgerPostpaidCommitInitialBalanceLedgerEntryType

This is an alias to an internal type.

type CommitLedgerPostpaidCommitManualLedgerEntry

type CommitLedgerPostpaidCommitManualLedgerEntry = shared.CommitLedgerPostpaidCommitManualLedgerEntry

This is an alias to an internal type.

type CommitLedgerPostpaidCommitManualLedgerEntryType

type CommitLedgerPostpaidCommitManualLedgerEntryType = shared.CommitLedgerPostpaidCommitManualLedgerEntryType

This is an alias to an internal type.

type CommitLedgerPostpaidCommitRolloverLedgerEntry

type CommitLedgerPostpaidCommitRolloverLedgerEntry = shared.CommitLedgerPostpaidCommitRolloverLedgerEntry

This is an alias to an internal type.

type CommitLedgerPostpaidCommitRolloverLedgerEntryType

type CommitLedgerPostpaidCommitRolloverLedgerEntryType = shared.CommitLedgerPostpaidCommitRolloverLedgerEntryType

This is an alias to an internal type.

type CommitLedgerPostpaidCommitTrueupLedgerEntry

type CommitLedgerPostpaidCommitTrueupLedgerEntry = shared.CommitLedgerPostpaidCommitTrueupLedgerEntry

This is an alias to an internal type.

type CommitLedgerPostpaidCommitTrueupLedgerEntryType

type CommitLedgerPostpaidCommitTrueupLedgerEntryType = shared.CommitLedgerPostpaidCommitTrueupLedgerEntryType

This is an alias to an internal type.

type CommitLedgerPrepaidCommitAutomatedInvoiceDeductionLedgerEntry

type CommitLedgerPrepaidCommitAutomatedInvoiceDeductionLedgerEntry = shared.CommitLedgerPrepaidCommitAutomatedInvoiceDeductionLedgerEntry

This is an alias to an internal type.

type CommitLedgerPrepaidCommitAutomatedInvoiceDeductionLedgerEntryType

type CommitLedgerPrepaidCommitAutomatedInvoiceDeductionLedgerEntryType = shared.CommitLedgerPrepaidCommitAutomatedInvoiceDeductionLedgerEntryType

This is an alias to an internal type.

type CommitLedgerPrepaidCommitCanceledLedgerEntry

type CommitLedgerPrepaidCommitCanceledLedgerEntry = shared.CommitLedgerPrepaidCommitCanceledLedgerEntry

This is an alias to an internal type.

type CommitLedgerPrepaidCommitCanceledLedgerEntryType

type CommitLedgerPrepaidCommitCanceledLedgerEntryType = shared.CommitLedgerPrepaidCommitCanceledLedgerEntryType

This is an alias to an internal type.

type CommitLedgerPrepaidCommitCreditedLedgerEntry

type CommitLedgerPrepaidCommitCreditedLedgerEntry = shared.CommitLedgerPrepaidCommitCreditedLedgerEntry

This is an alias to an internal type.

type CommitLedgerPrepaidCommitCreditedLedgerEntryType

type CommitLedgerPrepaidCommitCreditedLedgerEntryType = shared.CommitLedgerPrepaidCommitCreditedLedgerEntryType

This is an alias to an internal type.

type CommitLedgerPrepaidCommitExpirationLedgerEntry

type CommitLedgerPrepaidCommitExpirationLedgerEntry = shared.CommitLedgerPrepaidCommitExpirationLedgerEntry

This is an alias to an internal type.

type CommitLedgerPrepaidCommitExpirationLedgerEntryType

type CommitLedgerPrepaidCommitExpirationLedgerEntryType = shared.CommitLedgerPrepaidCommitExpirationLedgerEntryType

This is an alias to an internal type.

type CommitLedgerPrepaidCommitManualLedgerEntry

type CommitLedgerPrepaidCommitManualLedgerEntry = shared.CommitLedgerPrepaidCommitManualLedgerEntry

This is an alias to an internal type.

type CommitLedgerPrepaidCommitManualLedgerEntryType

type CommitLedgerPrepaidCommitManualLedgerEntryType = shared.CommitLedgerPrepaidCommitManualLedgerEntryType

This is an alias to an internal type.

type CommitLedgerPrepaidCommitRolloverLedgerEntry

type CommitLedgerPrepaidCommitRolloverLedgerEntry = shared.CommitLedgerPrepaidCommitRolloverLedgerEntry

This is an alias to an internal type.

type CommitLedgerPrepaidCommitRolloverLedgerEntryType

type CommitLedgerPrepaidCommitRolloverLedgerEntryType = shared.CommitLedgerPrepaidCommitRolloverLedgerEntryType

This is an alias to an internal type.

type CommitLedgerPrepaidCommitSegmentStartLedgerEntry

type CommitLedgerPrepaidCommitSegmentStartLedgerEntry = shared.CommitLedgerPrepaidCommitSegmentStartLedgerEntry

This is an alias to an internal type.

type CommitLedgerPrepaidCommitSegmentStartLedgerEntryType

type CommitLedgerPrepaidCommitSegmentStartLedgerEntryType = shared.CommitLedgerPrepaidCommitSegmentStartLedgerEntryType

This is an alias to an internal type.

type CommitLedgerType

type CommitLedgerType = shared.CommitLedgerType

This is an alias to an internal type.

type CommitProduct

type CommitProduct = shared.CommitProduct

This is an alias to an internal type.

type CommitRolledOverFrom

type CommitRolledOverFrom = shared.CommitRolledOverFrom

This is an alias to an internal type.

type CommitType

type CommitType = shared.CommitType

This is an alias to an internal type.

type ContractAddManualBalanceEntryParams

type ContractAddManualBalanceEntryParams struct {
	// ID of the balance (commit or credit) to update.
	ID param.Field[string] `json:"id,required" format:"uuid"`
	// Amount to add to the segment. A negative number will draw down from the balance.
	Amount param.Field[float64] `json:"amount,required"`
	// ID of the customer whose balance is to be updated.
	CustomerID param.Field[string] `json:"customer_id,required" format:"uuid"`
	// Reason for the manual adjustment. This will be displayed in the ledger.
	Reason param.Field[string] `json:"reason,required"`
	// ID of the segment to update.
	SegmentID param.Field[string] `json:"segment_id,required" format:"uuid"`
	// ID of the contract to update. Leave blank to update a customer level balance.
	ContractID param.Field[string] `json:"contract_id" 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.Field[time.Time] `json:"timestamp" format:"date-time"`
}

func (ContractAddManualBalanceEntryParams) MarshalJSON

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

type ContractAmendParams

type ContractAmendParams struct {
	// ID of the contract to amend
	ContractID param.Field[string] `json:"contract_id,required" format:"uuid"`
	// ID of the customer whose contract is to be amended
	CustomerID param.Field[string] `json:"customer_id,required" format:"uuid"`
	// inclusive start time for the amendment
	StartingAt   param.Field[time.Time]                   `json:"starting_at,required" format:"date-time"`
	Commits      param.Field[[]ContractAmendParamsCommit] `json:"commits"`
	Credits      param.Field[[]ContractAmendParamsCredit] `json:"credits"`
	CustomFields param.Field[map[string]string]           `json:"custom_fields"`
	// This field's availability is dependent on your client's configuration.
	Discounts param.Field[[]ContractAmendParamsDiscount] `json:"discounts"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Field[string]                        `json:"netsuite_sales_order_id"`
	Overrides            param.Field[[]ContractAmendParamsOverride] `json:"overrides"`
	// This field's availability is dependent on your client's configuration.
	ProfessionalServices param.Field[[]ContractAmendParamsProfessionalService] `json:"professional_services"`
	// This field's availability is dependent on your client's configuration.
	ResellerRoyalties param.Field[[]ContractAmendParamsResellerRoyalty] `json:"reseller_royalties"`
	// This field's availability is dependent on your client's configuration.
	SalesforceOpportunityID param.Field[string]                               `json:"salesforce_opportunity_id"`
	ScheduledCharges        param.Field[[]ContractAmendParamsScheduledCharge] `json:"scheduled_charges"`
	// This field's availability is dependent on your client's configuration.
	TotalContractValue param.Field[float64] `json:"total_contract_value"`
}

func (ContractAmendParams) MarshalJSON

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

type ContractAmendParamsCommit

type ContractAmendParamsCommit struct {
	ProductID param.Field[string]                         `json:"product_id,required" format:"uuid"`
	Type      param.Field[ContractAmendParamsCommitsType] `json:"type,required"`
	// 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 param.Field[ContractAmendParamsCommitsAccessSchedule] `json:"access_schedule"`
	// (DEPRECATED) Use access_schedule and invoice_schedule instead.
	Amount param.Field[float64] `json:"amount"`
	// Which products the commit applies to. If both applicable_product_ids and
	// applicable_product_tags are not provided, the commit applies to all products.
	ApplicableProductIDs param.Field[[]string] `json:"applicable_product_ids" format:"uuid"`
	// Which tags the commit applies to. If both applicable_product_ids and
	// applicable_product_tags are not provided, the commit applies to all products.
	ApplicableProductTags param.Field[[]string]          `json:"applicable_product_tags"`
	CustomFields          param.Field[map[string]string] `json:"custom_fields"`
	// Used only in UI/API. It is not exposed to end customers.
	Description param.Field[string] `json:"description"`
	// 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 param.Field[ContractAmendParamsCommitsInvoiceSchedule] `json:"invoice_schedule"`
	// displayed on invoices
	Name param.Field[string] `json:"name"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Field[string] `json:"netsuite_sales_order_id"`
	// If multiple commits are applicable, the one with the lower priority will apply
	// first.
	Priority param.Field[float64] `json:"priority"`
	// Fraction of unused segments that will be rolled over. Must be between 0 and 1.
	RolloverFraction param.Field[float64] `json:"rollover_fraction"`
}

func (ContractAmendParamsCommit) MarshalJSON

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

type ContractAmendParamsCommitsAccessSchedule

type ContractAmendParamsCommitsAccessSchedule struct {
	ScheduleItems param.Field[[]ContractAmendParamsCommitsAccessScheduleScheduleItem] `json:"schedule_items,required"`
	CreditTypeID  param.Field[string]                                                 `json:"credit_type_id" format:"uuid"`
}

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.

func (ContractAmendParamsCommitsAccessSchedule) MarshalJSON

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

type ContractAmendParamsCommitsAccessScheduleScheduleItem

type ContractAmendParamsCommitsAccessScheduleScheduleItem struct {
	Amount param.Field[float64] `json:"amount,required"`
	// RFC 3339 timestamp (exclusive)
	EndingBefore param.Field[time.Time] `json:"ending_before,required" format:"date-time"`
	// RFC 3339 timestamp (inclusive)
	StartingAt param.Field[time.Time] `json:"starting_at,required" format:"date-time"`
}

func (ContractAmendParamsCommitsAccessScheduleScheduleItem) MarshalJSON

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

type ContractAmendParamsCommitsInvoiceSchedule

type ContractAmendParamsCommitsInvoiceSchedule struct {
	// Defaults to USD if not passed. Only USD is supported at this time.
	CreditTypeID param.Field[string] `json:"credit_type_id" format:"uuid"`
	// 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 param.Field[ContractAmendParamsCommitsInvoiceScheduleRecurringSchedule] `json:"recurring_schedule"`
	// Either provide amount or provide both unit_price and quantity.
	ScheduleItems param.Field[[]ContractAmendParamsCommitsInvoiceScheduleScheduleItem] `json:"schedule_items"`
}

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 (ContractAmendParamsCommitsInvoiceSchedule) MarshalJSON

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

type ContractAmendParamsCommitsInvoiceScheduleRecurringSchedule

type ContractAmendParamsCommitsInvoiceScheduleRecurringSchedule struct {
	AmountDistribution param.Field[ContractAmendParamsCommitsInvoiceScheduleRecurringScheduleAmountDistribution] `json:"amount_distribution,required"`
	// RFC 3339 timestamp (exclusive).
	EndingBefore param.Field[time.Time]                                                           `json:"ending_before,required" format:"date-time"`
	Frequency    param.Field[ContractAmendParamsCommitsInvoiceScheduleRecurringScheduleFrequency] `json:"frequency,required"`
	// RFC 3339 timestamp (inclusive).
	StartingAt param.Field[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.Field[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 param.Field[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 param.Field[float64] `json:"unit_price"`
}

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 (ContractAmendParamsCommitsInvoiceScheduleRecurringSchedule) MarshalJSON

type ContractAmendParamsCommitsInvoiceScheduleRecurringScheduleAmountDistribution

type ContractAmendParamsCommitsInvoiceScheduleRecurringScheduleAmountDistribution string
const (
	ContractAmendParamsCommitsInvoiceScheduleRecurringScheduleAmountDistributionDivided        ContractAmendParamsCommitsInvoiceScheduleRecurringScheduleAmountDistribution = "DIVIDED"
	ContractAmendParamsCommitsInvoiceScheduleRecurringScheduleAmountDistributionDividedRounded ContractAmendParamsCommitsInvoiceScheduleRecurringScheduleAmountDistribution = "DIVIDED_ROUNDED"
	ContractAmendParamsCommitsInvoiceScheduleRecurringScheduleAmountDistributionEach           ContractAmendParamsCommitsInvoiceScheduleRecurringScheduleAmountDistribution = "EACH"
)

func (ContractAmendParamsCommitsInvoiceScheduleRecurringScheduleAmountDistribution) IsKnown

type ContractAmendParamsCommitsInvoiceScheduleRecurringScheduleFrequency

type ContractAmendParamsCommitsInvoiceScheduleRecurringScheduleFrequency string
const (
	ContractAmendParamsCommitsInvoiceScheduleRecurringScheduleFrequencyMonthly    ContractAmendParamsCommitsInvoiceScheduleRecurringScheduleFrequency = "MONTHLY"
	ContractAmendParamsCommitsInvoiceScheduleRecurringScheduleFrequencyQuarterly  ContractAmendParamsCommitsInvoiceScheduleRecurringScheduleFrequency = "QUARTERLY"
	ContractAmendParamsCommitsInvoiceScheduleRecurringScheduleFrequencySemiAnnual ContractAmendParamsCommitsInvoiceScheduleRecurringScheduleFrequency = "SEMI_ANNUAL"
	ContractAmendParamsCommitsInvoiceScheduleRecurringScheduleFrequencyAnnual     ContractAmendParamsCommitsInvoiceScheduleRecurringScheduleFrequency = "ANNUAL"
)

func (ContractAmendParamsCommitsInvoiceScheduleRecurringScheduleFrequency) IsKnown

type ContractAmendParamsCommitsInvoiceScheduleScheduleItem

type ContractAmendParamsCommitsInvoiceScheduleScheduleItem struct {
	// timestamp of the scheduled event
	Timestamp param.Field[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.Field[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 param.Field[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 param.Field[float64] `json:"unit_price"`
}

func (ContractAmendParamsCommitsInvoiceScheduleScheduleItem) MarshalJSON

type ContractAmendParamsCommitsType

type ContractAmendParamsCommitsType string
const (
	ContractAmendParamsCommitsTypePrepaid  ContractAmendParamsCommitsType = "PREPAID"
	ContractAmendParamsCommitsTypePostpaid ContractAmendParamsCommitsType = "POSTPAID"
)

func (ContractAmendParamsCommitsType) IsKnown

type ContractAmendParamsCredit

type ContractAmendParamsCredit struct {
	// Schedule for distributing the credit to the customer.
	AccessSchedule param.Field[ContractAmendParamsCreditsAccessSchedule] `json:"access_schedule,required"`
	ProductID      param.Field[string]                                   `json:"product_id,required" 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 param.Field[[]string] `json:"applicable_product_ids" 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 param.Field[[]string]          `json:"applicable_product_tags"`
	CustomFields          param.Field[map[string]string] `json:"custom_fields"`
	// Used only in UI/API. It is not exposed to end customers.
	Description param.Field[string] `json:"description"`
	// displayed on invoices
	Name param.Field[string] `json:"name"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Field[string] `json:"netsuite_sales_order_id"`
	// If multiple credits are applicable, the one with the lower priority will apply
	// first.
	Priority param.Field[float64] `json:"priority"`
}

func (ContractAmendParamsCredit) MarshalJSON

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

type ContractAmendParamsCreditsAccessSchedule

type ContractAmendParamsCreditsAccessSchedule struct {
	ScheduleItems param.Field[[]ContractAmendParamsCreditsAccessScheduleScheduleItem] `json:"schedule_items,required"`
	CreditTypeID  param.Field[string]                                                 `json:"credit_type_id" format:"uuid"`
}

Schedule for distributing the credit to the customer.

func (ContractAmendParamsCreditsAccessSchedule) MarshalJSON

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

type ContractAmendParamsCreditsAccessScheduleScheduleItem

type ContractAmendParamsCreditsAccessScheduleScheduleItem struct {
	Amount param.Field[float64] `json:"amount,required"`
	// RFC 3339 timestamp (exclusive)
	EndingBefore param.Field[time.Time] `json:"ending_before,required" format:"date-time"`
	// RFC 3339 timestamp (inclusive)
	StartingAt param.Field[time.Time] `json:"starting_at,required" format:"date-time"`
}

func (ContractAmendParamsCreditsAccessScheduleScheduleItem) MarshalJSON

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

type ContractAmendParamsDiscount

type ContractAmendParamsDiscount struct {
	ProductID param.Field[string] `json:"product_id,required" format:"uuid"`
	// Must provide either schedule_items or recurring_schedule.
	Schedule param.Field[ContractAmendParamsDiscountsSchedule] `json:"schedule,required"`
	// displayed on invoices
	Name param.Field[string] `json:"name"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Field[string] `json:"netsuite_sales_order_id"`
}

func (ContractAmendParamsDiscount) MarshalJSON

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

type ContractAmendParamsDiscountsSchedule

type ContractAmendParamsDiscountsSchedule struct {
	// Defaults to USD if not passed. Only USD is supported at this time.
	CreditTypeID param.Field[string] `json:"credit_type_id" format:"uuid"`
	// 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 param.Field[ContractAmendParamsDiscountsScheduleRecurringSchedule] `json:"recurring_schedule"`
	// Either provide amount or provide both unit_price and quantity.
	ScheduleItems param.Field[[]ContractAmendParamsDiscountsScheduleScheduleItem] `json:"schedule_items"`
}

Must provide either schedule_items or recurring_schedule.

func (ContractAmendParamsDiscountsSchedule) MarshalJSON

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

type ContractAmendParamsDiscountsScheduleRecurringSchedule

type ContractAmendParamsDiscountsScheduleRecurringSchedule struct {
	AmountDistribution param.Field[ContractAmendParamsDiscountsScheduleRecurringScheduleAmountDistribution] `json:"amount_distribution,required"`
	// RFC 3339 timestamp (exclusive).
	EndingBefore param.Field[time.Time]                                                      `json:"ending_before,required" format:"date-time"`
	Frequency    param.Field[ContractAmendParamsDiscountsScheduleRecurringScheduleFrequency] `json:"frequency,required"`
	// RFC 3339 timestamp (inclusive).
	StartingAt param.Field[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.Field[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 param.Field[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 param.Field[float64] `json:"unit_price"`
}

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 (ContractAmendParamsDiscountsScheduleRecurringSchedule) MarshalJSON

type ContractAmendParamsDiscountsScheduleRecurringScheduleAmountDistribution

type ContractAmendParamsDiscountsScheduleRecurringScheduleAmountDistribution string
const (
	ContractAmendParamsDiscountsScheduleRecurringScheduleAmountDistributionDivided        ContractAmendParamsDiscountsScheduleRecurringScheduleAmountDistribution = "DIVIDED"
	ContractAmendParamsDiscountsScheduleRecurringScheduleAmountDistributionDividedRounded ContractAmendParamsDiscountsScheduleRecurringScheduleAmountDistribution = "DIVIDED_ROUNDED"
	ContractAmendParamsDiscountsScheduleRecurringScheduleAmountDistributionEach           ContractAmendParamsDiscountsScheduleRecurringScheduleAmountDistribution = "EACH"
)

func (ContractAmendParamsDiscountsScheduleRecurringScheduleAmountDistribution) IsKnown

type ContractAmendParamsDiscountsScheduleRecurringScheduleFrequency

type ContractAmendParamsDiscountsScheduleRecurringScheduleFrequency string
const (
	ContractAmendParamsDiscountsScheduleRecurringScheduleFrequencyMonthly    ContractAmendParamsDiscountsScheduleRecurringScheduleFrequency = "MONTHLY"
	ContractAmendParamsDiscountsScheduleRecurringScheduleFrequencyQuarterly  ContractAmendParamsDiscountsScheduleRecurringScheduleFrequency = "QUARTERLY"
	ContractAmendParamsDiscountsScheduleRecurringScheduleFrequencySemiAnnual ContractAmendParamsDiscountsScheduleRecurringScheduleFrequency = "SEMI_ANNUAL"
	ContractAmendParamsDiscountsScheduleRecurringScheduleFrequencyAnnual     ContractAmendParamsDiscountsScheduleRecurringScheduleFrequency = "ANNUAL"
)

func (ContractAmendParamsDiscountsScheduleRecurringScheduleFrequency) IsKnown

type ContractAmendParamsDiscountsScheduleScheduleItem

type ContractAmendParamsDiscountsScheduleScheduleItem struct {
	// timestamp of the scheduled event
	Timestamp param.Field[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.Field[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 param.Field[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 param.Field[float64] `json:"unit_price"`
}

func (ContractAmendParamsDiscountsScheduleScheduleItem) MarshalJSON

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

type ContractAmendParamsOverride

type ContractAmendParamsOverride struct {
	// RFC 3339 timestamp indicating when the override will start applying (inclusive)
	StartingAt param.Field[time.Time] `json:"starting_at,required" format:"date-time"`
	// tags identifying products whose rates are being overridden
	ApplicableProductTags param.Field[[]string] `json:"applicable_product_tags"`
	// RFC 3339 timestamp indicating when the override will stop applying (exclusive)
	EndingBefore param.Field[time.Time] `json:"ending_before" format:"date-time"`
	Entitled     param.Field[bool]      `json:"entitled"`
	// Required for MULTIPLIER type. Must be >=0.
	Multiplier param.Field[float64] `json:"multiplier"`
	// 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 param.Field[[]ContractAmendParamsOverridesOverrideSpecifier] `json:"override_specifiers"`
	// Required for OVERWRITE type.
	OverwriteRate param.Field[ContractAmendParamsOverridesOverwriteRate] `json:"overwrite_rate"`
	// 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.Field[float64] `json:"priority"`
	// ID of the product whose rate is being overridden
	ProductID param.Field[string] `json:"product_id" format:"uuid"`
	// Required for TIERED type. Must have at least one tier.
	Tiers param.Field[[]ContractAmendParamsOverridesTier] `json:"tiers"`
	// Overwrites are prioritized over multipliers and tiered overrides.
	Type param.Field[ContractAmendParamsOverridesType] `json:"type"`
}

func (ContractAmendParamsOverride) MarshalJSON

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

type ContractAmendParamsOverridesOverrideSpecifier

type ContractAmendParamsOverridesOverrideSpecifier struct {
	// 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 param.Field[map[string]string] `json:"presentation_group_values"`
	// A map of pricing group names to values. The override will only apply to products
	// with the specified pricing group values.
	PricingGroupValues param.Field[map[string]string] `json:"pricing_group_values"`
	// If provided, the override will only apply to the product with the specified ID.
	ProductID param.Field[string] `json:"product_id" format:"uuid"`
	// If provided, the override will only apply to products with all the specified
	// tags.
	ProductTags param.Field[[]string] `json:"product_tags"`
}

func (ContractAmendParamsOverridesOverrideSpecifier) MarshalJSON

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

type ContractAmendParamsOverridesOverwriteRate

type ContractAmendParamsOverridesOverwriteRate struct {
	RateType     param.Field[ContractAmendParamsOverridesOverwriteRateRateType] `json:"rate_type,required"`
	CreditTypeID param.Field[string]                                            `json:"credit_type_id" format:"uuid"`
	// Only set for CUSTOM rate_type. This field is interpreted by custom rate
	// processors.
	CustomRate param.Field[map[string]interface{}] `json:"custom_rate"`
	// Default proration configuration. Only valid for SUBSCRIPTION rate_type.
	IsProrated param.Field[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 param.Field[float64] `json:"price"`
	// Default quantity. For SUBSCRIPTION rate_type, this must be >=0.
	Quantity param.Field[float64] `json:"quantity"`
	// Only set for TIERED rate_type.
	Tiers param.Field[[]shared.TierParam] `json:"tiers"`
}

Required for OVERWRITE type.

func (ContractAmendParamsOverridesOverwriteRate) MarshalJSON

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

type ContractAmendParamsOverridesOverwriteRateRateType

type ContractAmendParamsOverridesOverwriteRateRateType string
const (
	ContractAmendParamsOverridesOverwriteRateRateTypeFlat         ContractAmendParamsOverridesOverwriteRateRateType = "FLAT"
	ContractAmendParamsOverridesOverwriteRateRateTypePercentage   ContractAmendParamsOverridesOverwriteRateRateType = "PERCENTAGE"
	ContractAmendParamsOverridesOverwriteRateRateTypeSubscription ContractAmendParamsOverridesOverwriteRateRateType = "SUBSCRIPTION"
	ContractAmendParamsOverridesOverwriteRateRateTypeTiered       ContractAmendParamsOverridesOverwriteRateRateType = "TIERED"
	ContractAmendParamsOverridesOverwriteRateRateTypeCustom       ContractAmendParamsOverridesOverwriteRateRateType = "CUSTOM"
)

func (ContractAmendParamsOverridesOverwriteRateRateType) IsKnown

type ContractAmendParamsOverridesTier

type ContractAmendParamsOverridesTier struct {
	Multiplier param.Field[float64] `json:"multiplier,required"`
	Size       param.Field[float64] `json:"size"`
}

func (ContractAmendParamsOverridesTier) MarshalJSON

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

type ContractAmendParamsOverridesType

type ContractAmendParamsOverridesType string

Overwrites are prioritized over multipliers and tiered overrides.

const (
	ContractAmendParamsOverridesTypeOverwrite  ContractAmendParamsOverridesType = "OVERWRITE"
	ContractAmendParamsOverridesTypeMultiplier ContractAmendParamsOverridesType = "MULTIPLIER"
	ContractAmendParamsOverridesTypeTiered     ContractAmendParamsOverridesType = "TIERED"
)

func (ContractAmendParamsOverridesType) IsKnown

type ContractAmendParamsProfessionalService

type ContractAmendParamsProfessionalService struct {
	// Maximum amount for the term.
	MaxAmount param.Field[float64] `json:"max_amount,required"`
	ProductID param.Field[string]  `json:"product_id,required" format:"uuid"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount.
	Quantity param.Field[float64] `json:"quantity,required"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified.
	UnitPrice    param.Field[float64]           `json:"unit_price,required"`
	CustomFields param.Field[map[string]string] `json:"custom_fields"`
	Description  param.Field[string]            `json:"description"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Field[string] `json:"netsuite_sales_order_id"`
}

func (ContractAmendParamsProfessionalService) MarshalJSON

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

type ContractAmendParamsResellerRoyaltiesAwsOptions

type ContractAmendParamsResellerRoyaltiesAwsOptions struct {
	AwsAccountNumber    param.Field[string] `json:"aws_account_number"`
	AwsOfferID          param.Field[string] `json:"aws_offer_id"`
	AwsPayerReferenceID param.Field[string] `json:"aws_payer_reference_id"`
}

func (ContractAmendParamsResellerRoyaltiesAwsOptions) MarshalJSON

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

type ContractAmendParamsResellerRoyaltiesGcpOptions

type ContractAmendParamsResellerRoyaltiesGcpOptions struct {
	GcpAccountID param.Field[string] `json:"gcp_account_id"`
	GcpOfferID   param.Field[string] `json:"gcp_offer_id"`
}

func (ContractAmendParamsResellerRoyaltiesGcpOptions) MarshalJSON

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

type ContractAmendParamsResellerRoyaltiesResellerType

type ContractAmendParamsResellerRoyaltiesResellerType string
const (
	ContractAmendParamsResellerRoyaltiesResellerTypeAws           ContractAmendParamsResellerRoyaltiesResellerType = "AWS"
	ContractAmendParamsResellerRoyaltiesResellerTypeAwsProService ContractAmendParamsResellerRoyaltiesResellerType = "AWS_PRO_SERVICE"
	ContractAmendParamsResellerRoyaltiesResellerTypeGcp           ContractAmendParamsResellerRoyaltiesResellerType = "GCP"
	ContractAmendParamsResellerRoyaltiesResellerTypeGcpProService ContractAmendParamsResellerRoyaltiesResellerType = "GCP_PRO_SERVICE"
)

func (ContractAmendParamsResellerRoyaltiesResellerType) IsKnown

type ContractAmendParamsResellerRoyalty

type ContractAmendParamsResellerRoyalty struct {
	ResellerType param.Field[ContractAmendParamsResellerRoyaltiesResellerType] `json:"reseller_type,required"`
	// Must provide at least one of applicable_product_ids or applicable_product_tags.
	ApplicableProductIDs param.Field[[]string] `json:"applicable_product_ids" format:"uuid"`
	// Must provide at least one of applicable_product_ids or applicable_product_tags.
	ApplicableProductTags param.Field[[]string]                                       `json:"applicable_product_tags"`
	AwsOptions            param.Field[ContractAmendParamsResellerRoyaltiesAwsOptions] `json:"aws_options"`
	// Use null to indicate that the existing end timestamp should be removed.
	EndingBefore          param.Field[time.Time]                                      `json:"ending_before" format:"date-time"`
	Fraction              param.Field[float64]                                        `json:"fraction"`
	GcpOptions            param.Field[ContractAmendParamsResellerRoyaltiesGcpOptions] `json:"gcp_options"`
	NetsuiteResellerID    param.Field[string]                                         `json:"netsuite_reseller_id"`
	ResellerContractValue param.Field[float64]                                        `json:"reseller_contract_value"`
	StartingAt            param.Field[time.Time]                                      `json:"starting_at" format:"date-time"`
}

func (ContractAmendParamsResellerRoyalty) MarshalJSON

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

type ContractAmendParamsScheduledCharge

type ContractAmendParamsScheduledCharge struct {
	ProductID param.Field[string] `json:"product_id,required" format:"uuid"`
	// Must provide either schedule_items or recurring_schedule.
	Schedule param.Field[ContractAmendParamsScheduledChargesSchedule] `json:"schedule,required"`
	// displayed on invoices
	Name param.Field[string] `json:"name"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Field[string] `json:"netsuite_sales_order_id"`
}

func (ContractAmendParamsScheduledCharge) MarshalJSON

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

type ContractAmendParamsScheduledChargesSchedule

type ContractAmendParamsScheduledChargesSchedule struct {
	// Defaults to USD if not passed. Only USD is supported at this time.
	CreditTypeID param.Field[string] `json:"credit_type_id" format:"uuid"`
	// 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 param.Field[ContractAmendParamsScheduledChargesScheduleRecurringSchedule] `json:"recurring_schedule"`
	// Either provide amount or provide both unit_price and quantity.
	ScheduleItems param.Field[[]ContractAmendParamsScheduledChargesScheduleScheduleItem] `json:"schedule_items"`
}

Must provide either schedule_items or recurring_schedule.

func (ContractAmendParamsScheduledChargesSchedule) MarshalJSON

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

type ContractAmendParamsScheduledChargesScheduleRecurringSchedule

type ContractAmendParamsScheduledChargesScheduleRecurringSchedule struct {
	AmountDistribution param.Field[ContractAmendParamsScheduledChargesScheduleRecurringScheduleAmountDistribution] `json:"amount_distribution,required"`
	// RFC 3339 timestamp (exclusive).
	EndingBefore param.Field[time.Time]                                                             `json:"ending_before,required" format:"date-time"`
	Frequency    param.Field[ContractAmendParamsScheduledChargesScheduleRecurringScheduleFrequency] `json:"frequency,required"`
	// RFC 3339 timestamp (inclusive).
	StartingAt param.Field[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.Field[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 param.Field[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 param.Field[float64] `json:"unit_price"`
}

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 (ContractAmendParamsScheduledChargesScheduleRecurringSchedule) MarshalJSON

type ContractAmendParamsScheduledChargesScheduleRecurringScheduleAmountDistribution

type ContractAmendParamsScheduledChargesScheduleRecurringScheduleAmountDistribution string
const (
	ContractAmendParamsScheduledChargesScheduleRecurringScheduleAmountDistributionDivided        ContractAmendParamsScheduledChargesScheduleRecurringScheduleAmountDistribution = "DIVIDED"
	ContractAmendParamsScheduledChargesScheduleRecurringScheduleAmountDistributionDividedRounded ContractAmendParamsScheduledChargesScheduleRecurringScheduleAmountDistribution = "DIVIDED_ROUNDED"
	ContractAmendParamsScheduledChargesScheduleRecurringScheduleAmountDistributionEach           ContractAmendParamsScheduledChargesScheduleRecurringScheduleAmountDistribution = "EACH"
)

func (ContractAmendParamsScheduledChargesScheduleRecurringScheduleAmountDistribution) IsKnown

type ContractAmendParamsScheduledChargesScheduleRecurringScheduleFrequency

type ContractAmendParamsScheduledChargesScheduleRecurringScheduleFrequency string
const (
	ContractAmendParamsScheduledChargesScheduleRecurringScheduleFrequencyMonthly    ContractAmendParamsScheduledChargesScheduleRecurringScheduleFrequency = "MONTHLY"
	ContractAmendParamsScheduledChargesScheduleRecurringScheduleFrequencyQuarterly  ContractAmendParamsScheduledChargesScheduleRecurringScheduleFrequency = "QUARTERLY"
	ContractAmendParamsScheduledChargesScheduleRecurringScheduleFrequencySemiAnnual ContractAmendParamsScheduledChargesScheduleRecurringScheduleFrequency = "SEMI_ANNUAL"
	ContractAmendParamsScheduledChargesScheduleRecurringScheduleFrequencyAnnual     ContractAmendParamsScheduledChargesScheduleRecurringScheduleFrequency = "ANNUAL"
)

func (ContractAmendParamsScheduledChargesScheduleRecurringScheduleFrequency) IsKnown

type ContractAmendParamsScheduledChargesScheduleScheduleItem

type ContractAmendParamsScheduledChargesScheduleScheduleItem struct {
	// timestamp of the scheduled event
	Timestamp param.Field[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.Field[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 param.Field[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 param.Field[float64] `json:"unit_price"`
}

func (ContractAmendParamsScheduledChargesScheduleScheduleItem) MarshalJSON

type ContractAmendResponse

type ContractAmendResponse struct {
	Data shared.ID                 `json:"data,required"`
	JSON contractAmendResponseJSON `json:"-"`
}

func (*ContractAmendResponse) UnmarshalJSON

func (r *ContractAmendResponse) UnmarshalJSON(data []byte) (err error)

type ContractArchiveParams

type ContractArchiveParams struct {
	// ID of the contract to archive
	ContractID param.Field[string] `json:"contract_id,required" format:"uuid"`
	// ID of the customer whose contract is to be archived
	CustomerID param.Field[string] `json:"customer_id,required" format:"uuid"`
	// If false, the existing finalized invoices will remain after the contract is
	// archived.
	VoidInvoices param.Field[bool] `json:"void_invoices,required"`
}

func (ContractArchiveParams) MarshalJSON

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

type ContractArchiveResponse

type ContractArchiveResponse struct {
	Data shared.ID                   `json:"data,required"`
	JSON contractArchiveResponseJSON `json:"-"`
}

func (*ContractArchiveResponse) UnmarshalJSON

func (r *ContractArchiveResponse) UnmarshalJSON(data []byte) (err error)

type ContractGetParams

type ContractGetParams struct {
	ContractID param.Field[string] `json:"contract_id,required" format:"uuid"`
	CustomerID param.Field[string] `json:"customer_id,required" format:"uuid"`
	// Include commit ledgers in the response. Setting this flag may cause the query to
	// be slower.
	IncludeLedgers param.Field[bool] `json:"include_ledgers"`
}

func (ContractGetParams) MarshalJSON

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

type ContractGetRateScheduleParams

type ContractGetRateScheduleParams struct {
	// ID of the contract to get the rate schedule for.
	ContractID param.Field[string] `json:"contract_id,required" format:"uuid"`
	// ID of the customer for whose contract to get the rate schedule for.
	CustomerID param.Field[string] `json:"customer_id,required" format:"uuid"`
	// Max number of results that should be returned
	Limit param.Field[int64] `query:"limit"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
	// optional timestamp which overlaps with the returned rate schedule segments. When
	// not specified, the current timestamp will be used.
	At param.Field[time.Time] `json:"at" 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 param.Field[[]ContractGetRateScheduleParamsSelector] `json:"selectors"`
}

func (ContractGetRateScheduleParams) MarshalJSON

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

func (ContractGetRateScheduleParams) URLQuery

func (r ContractGetRateScheduleParams) URLQuery() (v url.Values)

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

type ContractGetRateScheduleParamsSelector

type ContractGetRateScheduleParamsSelector struct {
	// List of pricing group key value pairs, rates containing the matching key / value
	// pairs will be included in the response.
	PartialPricingGroupValues param.Field[map[string]string] `json:"partial_pricing_group_values"`
	// List of pricing group key value pairs, rates matching all of the key / value
	// pairs will be included in the response.
	PricingGroupValues param.Field[map[string]string] `json:"pricing_group_values"`
	// Rates matching the product id will be included in the response.
	ProductID param.Field[string] `json:"product_id" format:"uuid"`
	// List of product tags, rates matching any of the tags will be included in the
	// response.
	ProductTags param.Field[[]string] `json:"product_tags"`
}

func (ContractGetRateScheduleParamsSelector) MarshalJSON

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

type ContractGetRateScheduleResponse

type ContractGetRateScheduleResponse struct {
	Data     []ContractGetRateScheduleResponseData `json:"data,required"`
	NextPage string                                `json:"next_page,nullable"`
	JSON     contractGetRateScheduleResponseJSON   `json:"-"`
}

func (*ContractGetRateScheduleResponse) UnmarshalJSON

func (r *ContractGetRateScheduleResponse) UnmarshalJSON(data []byte) (err error)

type ContractGetRateScheduleResponseData

type ContractGetRateScheduleResponseData struct {
	Entitled            bool                                    `json:"entitled,required"`
	ListRate            shared.Rate                             `json:"list_rate,required"`
	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"`
	EndingBefore        time.Time                               `json:"ending_before" format:"date-time"`
	OverrideRate        shared.Rate                             `json:"override_rate"`
	PricingGroupValues  map[string]string                       `json:"pricing_group_values"`
	JSON                contractGetRateScheduleResponseDataJSON `json:"-"`
}

func (*ContractGetRateScheduleResponseData) UnmarshalJSON

func (r *ContractGetRateScheduleResponseData) UnmarshalJSON(data []byte) (err error)

type ContractGetResponse

type ContractGetResponse struct {
	Data ContractGetResponseData `json:"data,required"`
	JSON contractGetResponseJSON `json:"-"`
}

func (*ContractGetResponse) UnmarshalJSON

func (r *ContractGetResponse) UnmarshalJSON(data []byte) (err error)

type ContractGetResponseData

type ContractGetResponseData struct {
	ID           string                             `json:"id,required" format:"uuid"`
	Amendments   []ContractGetResponseDataAmendment `json:"amendments,required"`
	Current      shared.ContractWithoutAmendments   `json:"current,required"`
	CustomerID   string                             `json:"customer_id,required" format:"uuid"`
	Initial      shared.ContractWithoutAmendments   `json:"initial,required"`
	CustomFields map[string]string                  `json:"custom_fields"`
	// This field's availability is dependent on your client's configuration.
	CustomerBillingProviderConfiguration ContractGetResponseDataCustomerBillingProviderConfiguration `json:"customer_billing_provider_configuration"`
	// 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          contractGetResponseDataJSON `json:"-"`
}

func (*ContractGetResponseData) UnmarshalJSON

func (r *ContractGetResponseData) UnmarshalJSON(data []byte) (err error)

type ContractGetResponseDataAmendment

type ContractGetResponseDataAmendment struct {
	ID               string                   `json:"id,required" format:"uuid"`
	Commits          []shared.Commit          `json:"commits,required"`
	CreatedAt        time.Time                `json:"created_at,required" format:"date-time"`
	CreatedBy        string                   `json:"created_by,required"`
	Overrides        []shared.Override        `json:"overrides,required"`
	ScheduledCharges []shared.ScheduledCharge `json:"scheduled_charges,required"`
	StartingAt       time.Time                `json:"starting_at,required" format:"date-time"`
	Credits          []shared.Credit          `json:"credits"`
	// This field's availability is dependent on your client's configuration.
	Discounts []shared.Discount `json:"discounts"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID string `json:"netsuite_sales_order_id"`
	// This field's availability is dependent on your client's configuration.
	ProfessionalServices []shared.ProService `json:"professional_services"`
	// This field's availability is dependent on your client's configuration.
	ResellerRoyalties []ContractGetResponseDataAmendmentsResellerRoyalty `json:"reseller_royalties"`
	// This field's availability is dependent on your client's configuration.
	SalesforceOpportunityID string                               `json:"salesforce_opportunity_id"`
	JSON                    contractGetResponseDataAmendmentJSON `json:"-"`
}

func (*ContractGetResponseDataAmendment) UnmarshalJSON

func (r *ContractGetResponseDataAmendment) UnmarshalJSON(data []byte) (err error)

type ContractGetResponseDataAmendmentsResellerRoyaltiesResellerType

type ContractGetResponseDataAmendmentsResellerRoyaltiesResellerType string
const (
	ContractGetResponseDataAmendmentsResellerRoyaltiesResellerTypeAws           ContractGetResponseDataAmendmentsResellerRoyaltiesResellerType = "AWS"
	ContractGetResponseDataAmendmentsResellerRoyaltiesResellerTypeAwsProService ContractGetResponseDataAmendmentsResellerRoyaltiesResellerType = "AWS_PRO_SERVICE"
	ContractGetResponseDataAmendmentsResellerRoyaltiesResellerTypeGcp           ContractGetResponseDataAmendmentsResellerRoyaltiesResellerType = "GCP"
	ContractGetResponseDataAmendmentsResellerRoyaltiesResellerTypeGcpProService ContractGetResponseDataAmendmentsResellerRoyaltiesResellerType = "GCP_PRO_SERVICE"
)

func (ContractGetResponseDataAmendmentsResellerRoyaltiesResellerType) IsKnown

type ContractGetResponseDataAmendmentsResellerRoyalty

type ContractGetResponseDataAmendmentsResellerRoyalty struct {
	ResellerType          ContractGetResponseDataAmendmentsResellerRoyaltiesResellerType `json:"reseller_type,required"`
	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                  contractGetResponseDataAmendmentsResellerRoyaltyJSON           `json:"-"`
}

func (*ContractGetResponseDataAmendmentsResellerRoyalty) UnmarshalJSON

func (r *ContractGetResponseDataAmendmentsResellerRoyalty) UnmarshalJSON(data []byte) (err error)

type ContractGetResponseDataCustomerBillingProviderConfiguration

type ContractGetResponseDataCustomerBillingProviderConfiguration struct {
	BillingProvider ContractGetResponseDataCustomerBillingProviderConfigurationBillingProvider `json:"billing_provider,required"`
	DeliveryMethod  ContractGetResponseDataCustomerBillingProviderConfigurationDeliveryMethod  `json:"delivery_method,required"`
	JSON            contractGetResponseDataCustomerBillingProviderConfigurationJSON            `json:"-"`
}

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

func (*ContractGetResponseDataCustomerBillingProviderConfiguration) UnmarshalJSON

type ContractGetResponseDataCustomerBillingProviderConfigurationBillingProvider

type ContractGetResponseDataCustomerBillingProviderConfigurationBillingProvider string
const (
	ContractGetResponseDataCustomerBillingProviderConfigurationBillingProviderAwsMarketplace   ContractGetResponseDataCustomerBillingProviderConfigurationBillingProvider = "aws_marketplace"
	ContractGetResponseDataCustomerBillingProviderConfigurationBillingProviderStripe           ContractGetResponseDataCustomerBillingProviderConfigurationBillingProvider = "stripe"
	ContractGetResponseDataCustomerBillingProviderConfigurationBillingProviderNetsuite         ContractGetResponseDataCustomerBillingProviderConfigurationBillingProvider = "netsuite"
	ContractGetResponseDataCustomerBillingProviderConfigurationBillingProviderCustom           ContractGetResponseDataCustomerBillingProviderConfigurationBillingProvider = "custom"
	ContractGetResponseDataCustomerBillingProviderConfigurationBillingProviderAzureMarketplace ContractGetResponseDataCustomerBillingProviderConfigurationBillingProvider = "azure_marketplace"
	ContractGetResponseDataCustomerBillingProviderConfigurationBillingProviderQuickbooksOnline ContractGetResponseDataCustomerBillingProviderConfigurationBillingProvider = "quickbooks_online"
	ContractGetResponseDataCustomerBillingProviderConfigurationBillingProviderWorkday          ContractGetResponseDataCustomerBillingProviderConfigurationBillingProvider = "workday"
	ContractGetResponseDataCustomerBillingProviderConfigurationBillingProviderGcpMarketplace   ContractGetResponseDataCustomerBillingProviderConfigurationBillingProvider = "gcp_marketplace"
)

func (ContractGetResponseDataCustomerBillingProviderConfigurationBillingProvider) IsKnown

type ContractGetResponseDataCustomerBillingProviderConfigurationDeliveryMethod

type ContractGetResponseDataCustomerBillingProviderConfigurationDeliveryMethod string
const (
	ContractGetResponseDataCustomerBillingProviderConfigurationDeliveryMethodDirectToBillingProvider ContractGetResponseDataCustomerBillingProviderConfigurationDeliveryMethod = "direct_to_billing_provider"
	ContractGetResponseDataCustomerBillingProviderConfigurationDeliveryMethodAwsSqs                  ContractGetResponseDataCustomerBillingProviderConfigurationDeliveryMethod = "aws_sqs"
	ContractGetResponseDataCustomerBillingProviderConfigurationDeliveryMethodTackle                  ContractGetResponseDataCustomerBillingProviderConfigurationDeliveryMethod = "tackle"
	ContractGetResponseDataCustomerBillingProviderConfigurationDeliveryMethodAwsSns                  ContractGetResponseDataCustomerBillingProviderConfigurationDeliveryMethod = "aws_sns"
)

func (ContractGetResponseDataCustomerBillingProviderConfigurationDeliveryMethod) IsKnown

type ContractListBalancesParams

type ContractListBalancesParams struct {
	CustomerID param.Field[string] `json:"customer_id,required" format:"uuid"`
	ID         param.Field[string] `json:"id" format:"uuid"`
	// Return only balances that have access schedules that "cover" the provided date
	CoveringDate param.Field[time.Time] `json:"covering_date" format:"date-time"`
	// Include only balances that have any access before the provided date (exclusive)
	EffectiveBefore param.Field[time.Time] `json:"effective_before" format:"date-time"`
	// Include credits from archived contracts.
	IncludeArchived param.Field[bool] `json:"include_archived"`
	// Include balances on the contract level.
	IncludeContractBalances param.Field[bool] `json:"include_contract_balances"`
	// Include ledgers in the response. Setting this flag may cause the query to be
	// slower.
	IncludeLedgers param.Field[bool] `json:"include_ledgers"`
	// The next page token from a previous response.
	NextPage param.Field[string] `json:"next_page"`
	// Include only balances that have any access on or after the provided date
	StartingAt param.Field[time.Time] `json:"starting_at" format:"date-time"`
}

func (ContractListBalancesParams) MarshalJSON

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

type ContractListBalancesResponse

type ContractListBalancesResponse struct {
	Data     []ContractListBalancesResponseData `json:"data,required"`
	NextPage string                             `json:"next_page,required,nullable"`
	JSON     contractListBalancesResponseJSON   `json:"-"`
}

func (*ContractListBalancesResponse) UnmarshalJSON

func (r *ContractListBalancesResponse) UnmarshalJSON(data []byte) (err error)

type ContractListBalancesResponseData

type ContractListBalancesResponseData struct {
	ID string `json:"id,required" format:"uuid"`
	// This field can have the runtime type of [shared.CommitContract],
	// [shared.CreditContract].
	Contract interface{}                          `json:"contract,required"`
	Type     ContractListBalancesResponseDataType `json:"type,required"`
	Name     string                               `json:"name"`
	// If multiple credits or commits are applicable, the one with the lower priority
	// will apply first.
	Priority float64 `json:"priority"`
	// This field can have the runtime type of [shared.CommitProduct],
	// [shared.CreditProduct].
	Product interface{} `json:"product"`
	// The schedule that the customer will gain access to the credits purposed with
	// this commit.
	AccessSchedule shared.ScheduleDuration `json:"access_schedule"`
	// The schedule that the customer will be invoiced for this commit.
	InvoiceSchedule shared.SchedulePointInTime `json:"invoice_schedule"`
	// This field can have the runtime type of [shared.CommitInvoiceContract].
	InvoiceContract interface{} `json:"invoice_contract,required"`
	// This field can have the runtime type of [shared.CommitRolledOverFrom].
	RolledOverFrom   interface{} `json:"rolled_over_from,required"`
	Description      string      `json:"description"`
	RolloverFraction float64     `json:"rollover_fraction"`
	// This field can have the runtime type of [[]string].
	ApplicableProductIDs interface{} `json:"applicable_product_ids,required"`
	// This field can have the runtime type of [[]string].
	ApplicableProductTags interface{} `json:"applicable_product_tags,required"`
	// This field can have the runtime type of [[]string].
	ApplicableContractIDs interface{} `json:"applicable_contract_ids,required"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID string `json:"netsuite_sales_order_id"`
	// (DEPRECATED) Use access_schedule + invoice_schedule instead.
	Amount float64 `json:"amount"`
	// This field's availability is dependent on your client's configuration.
	SalesforceOpportunityID string `json:"salesforce_opportunity_id"`
	// This field can have the runtime type of [[]shared.CommitLedger],
	// [[]shared.CreditLedger].
	Ledger interface{} `json:"ledger,required"`
	// This field can have the runtime type of [map[string]string].
	CustomFields interface{}                          `json:"custom_fields,required"`
	JSON         contractListBalancesResponseDataJSON `json:"-"`
	// contains filtered or unexported fields
}

func (ContractListBalancesResponseData) AsUnion

AsUnion returns a ContractListBalancesResponseDataUnion interface which you can cast to the specific types for more type safety.

Possible runtime types of the union are shared.Commit, shared.Credit.

func (*ContractListBalancesResponseData) UnmarshalJSON

func (r *ContractListBalancesResponseData) UnmarshalJSON(data []byte) (err error)

type ContractListBalancesResponseDataType

type ContractListBalancesResponseDataType string
const (
	ContractListBalancesResponseDataTypePrepaid  ContractListBalancesResponseDataType = "PREPAID"
	ContractListBalancesResponseDataTypePostpaid ContractListBalancesResponseDataType = "POSTPAID"
	ContractListBalancesResponseDataTypeCredit   ContractListBalancesResponseDataType = "CREDIT"
)

func (ContractListBalancesResponseDataType) IsKnown

type ContractListBalancesResponseDataUnion

type ContractListBalancesResponseDataUnion interface {
	ImplementsContractListBalancesResponseData()
}

Union satisfied by shared.Commit or shared.Credit.

type ContractListParams

type ContractListParams struct {
	CustomerID param.Field[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.Field[time.Time] `json:"covering_date" format:"date-time"`
	// Include archived contracts in the response
	IncludeArchived param.Field[bool] `json:"include_archived"`
	// Include commit ledgers in the response. Setting this flag may cause the query to
	// be slower.
	IncludeLedgers param.Field[bool] `json:"include_ledgers"`
	// 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.Field[time.Time] `json:"starting_at" format:"date-time"`
}

func (ContractListParams) MarshalJSON

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

type ContractListResponse

type ContractListResponse struct {
	Data []ContractListResponseData `json:"data,required"`
	JSON contractListResponseJSON   `json:"-"`
}

func (*ContractListResponse) UnmarshalJSON

func (r *ContractListResponse) UnmarshalJSON(data []byte) (err error)

type ContractListResponseData

type ContractListResponseData struct {
	ID           string                              `json:"id,required" format:"uuid"`
	Amendments   []ContractListResponseDataAmendment `json:"amendments,required"`
	Current      shared.ContractWithoutAmendments    `json:"current,required"`
	CustomerID   string                              `json:"customer_id,required" format:"uuid"`
	Initial      shared.ContractWithoutAmendments    `json:"initial,required"`
	CustomFields map[string]string                   `json:"custom_fields"`
	// This field's availability is dependent on your client's configuration.
	CustomerBillingProviderConfiguration ContractListResponseDataCustomerBillingProviderConfiguration `json:"customer_billing_provider_configuration"`
	// 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          contractListResponseDataJSON `json:"-"`
}

func (*ContractListResponseData) UnmarshalJSON

func (r *ContractListResponseData) UnmarshalJSON(data []byte) (err error)

type ContractListResponseDataAmendment

type ContractListResponseDataAmendment struct {
	ID               string                   `json:"id,required" format:"uuid"`
	Commits          []shared.Commit          `json:"commits,required"`
	CreatedAt        time.Time                `json:"created_at,required" format:"date-time"`
	CreatedBy        string                   `json:"created_by,required"`
	Overrides        []shared.Override        `json:"overrides,required"`
	ScheduledCharges []shared.ScheduledCharge `json:"scheduled_charges,required"`
	StartingAt       time.Time                `json:"starting_at,required" format:"date-time"`
	Credits          []shared.Credit          `json:"credits"`
	// This field's availability is dependent on your client's configuration.
	Discounts []shared.Discount `json:"discounts"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID string `json:"netsuite_sales_order_id"`
	// This field's availability is dependent on your client's configuration.
	ProfessionalServices []shared.ProService `json:"professional_services"`
	// This field's availability is dependent on your client's configuration.
	ResellerRoyalties []ContractListResponseDataAmendmentsResellerRoyalty `json:"reseller_royalties"`
	// This field's availability is dependent on your client's configuration.
	SalesforceOpportunityID string                                `json:"salesforce_opportunity_id"`
	JSON                    contractListResponseDataAmendmentJSON `json:"-"`
}

func (*ContractListResponseDataAmendment) UnmarshalJSON

func (r *ContractListResponseDataAmendment) UnmarshalJSON(data []byte) (err error)

type ContractListResponseDataAmendmentsResellerRoyaltiesResellerType

type ContractListResponseDataAmendmentsResellerRoyaltiesResellerType string
const (
	ContractListResponseDataAmendmentsResellerRoyaltiesResellerTypeAws           ContractListResponseDataAmendmentsResellerRoyaltiesResellerType = "AWS"
	ContractListResponseDataAmendmentsResellerRoyaltiesResellerTypeAwsProService ContractListResponseDataAmendmentsResellerRoyaltiesResellerType = "AWS_PRO_SERVICE"
	ContractListResponseDataAmendmentsResellerRoyaltiesResellerTypeGcp           ContractListResponseDataAmendmentsResellerRoyaltiesResellerType = "GCP"
	ContractListResponseDataAmendmentsResellerRoyaltiesResellerTypeGcpProService ContractListResponseDataAmendmentsResellerRoyaltiesResellerType = "GCP_PRO_SERVICE"
)

func (ContractListResponseDataAmendmentsResellerRoyaltiesResellerType) IsKnown

type ContractListResponseDataAmendmentsResellerRoyalty

type ContractListResponseDataAmendmentsResellerRoyalty struct {
	ResellerType          ContractListResponseDataAmendmentsResellerRoyaltiesResellerType `json:"reseller_type,required"`
	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                  contractListResponseDataAmendmentsResellerRoyaltyJSON           `json:"-"`
}

func (*ContractListResponseDataAmendmentsResellerRoyalty) UnmarshalJSON

func (r *ContractListResponseDataAmendmentsResellerRoyalty) UnmarshalJSON(data []byte) (err error)

type ContractListResponseDataCustomerBillingProviderConfiguration

type ContractListResponseDataCustomerBillingProviderConfiguration struct {
	BillingProvider ContractListResponseDataCustomerBillingProviderConfigurationBillingProvider `json:"billing_provider,required"`
	DeliveryMethod  ContractListResponseDataCustomerBillingProviderConfigurationDeliveryMethod  `json:"delivery_method,required"`
	JSON            contractListResponseDataCustomerBillingProviderConfigurationJSON            `json:"-"`
}

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

func (*ContractListResponseDataCustomerBillingProviderConfiguration) UnmarshalJSON

type ContractListResponseDataCustomerBillingProviderConfigurationBillingProvider

type ContractListResponseDataCustomerBillingProviderConfigurationBillingProvider string
const (
	ContractListResponseDataCustomerBillingProviderConfigurationBillingProviderAwsMarketplace   ContractListResponseDataCustomerBillingProviderConfigurationBillingProvider = "aws_marketplace"
	ContractListResponseDataCustomerBillingProviderConfigurationBillingProviderStripe           ContractListResponseDataCustomerBillingProviderConfigurationBillingProvider = "stripe"
	ContractListResponseDataCustomerBillingProviderConfigurationBillingProviderNetsuite         ContractListResponseDataCustomerBillingProviderConfigurationBillingProvider = "netsuite"
	ContractListResponseDataCustomerBillingProviderConfigurationBillingProviderCustom           ContractListResponseDataCustomerBillingProviderConfigurationBillingProvider = "custom"
	ContractListResponseDataCustomerBillingProviderConfigurationBillingProviderAzureMarketplace ContractListResponseDataCustomerBillingProviderConfigurationBillingProvider = "azure_marketplace"
	ContractListResponseDataCustomerBillingProviderConfigurationBillingProviderQuickbooksOnline ContractListResponseDataCustomerBillingProviderConfigurationBillingProvider = "quickbooks_online"
	ContractListResponseDataCustomerBillingProviderConfigurationBillingProviderWorkday          ContractListResponseDataCustomerBillingProviderConfigurationBillingProvider = "workday"
	ContractListResponseDataCustomerBillingProviderConfigurationBillingProviderGcpMarketplace   ContractListResponseDataCustomerBillingProviderConfigurationBillingProvider = "gcp_marketplace"
)

func (ContractListResponseDataCustomerBillingProviderConfigurationBillingProvider) IsKnown

type ContractListResponseDataCustomerBillingProviderConfigurationDeliveryMethod

type ContractListResponseDataCustomerBillingProviderConfigurationDeliveryMethod string
const (
	ContractListResponseDataCustomerBillingProviderConfigurationDeliveryMethodDirectToBillingProvider ContractListResponseDataCustomerBillingProviderConfigurationDeliveryMethod = "direct_to_billing_provider"
	ContractListResponseDataCustomerBillingProviderConfigurationDeliveryMethodAwsSqs                  ContractListResponseDataCustomerBillingProviderConfigurationDeliveryMethod = "aws_sqs"
	ContractListResponseDataCustomerBillingProviderConfigurationDeliveryMethodTackle                  ContractListResponseDataCustomerBillingProviderConfigurationDeliveryMethod = "tackle"
	ContractListResponseDataCustomerBillingProviderConfigurationDeliveryMethodAwsSns                  ContractListResponseDataCustomerBillingProviderConfigurationDeliveryMethod = "aws_sns"
)

func (ContractListResponseDataCustomerBillingProviderConfigurationDeliveryMethod) IsKnown

type ContractNamedScheduleGetParams

type ContractNamedScheduleGetParams struct {
	// ID of the rate card whose named schedule is to be retrieved
	RateCardID param.Field[string] `json:"rate_card_id,required" format:"uuid"`
	// The identifier for the schedule to be retrieved
	ScheduleName param.Field[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.Field[time.Time] `json:"covering_date" format:"date-time"`
}

func (ContractNamedScheduleGetParams) MarshalJSON

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

type ContractNamedScheduleGetResponse

type ContractNamedScheduleGetResponse struct {
	Data []ContractNamedScheduleGetResponseData `json:"data,required"`
	JSON contractNamedScheduleGetResponseJSON   `json:"-"`
}

func (*ContractNamedScheduleGetResponse) UnmarshalJSON

func (r *ContractNamedScheduleGetResponse) UnmarshalJSON(data []byte) (err error)

type ContractNamedScheduleGetResponseData

type ContractNamedScheduleGetResponseData struct {
	StartingAt   time.Time                                `json:"starting_at,required" format:"date-time"`
	Value        interface{}                              `json:"value,required"`
	EndingBefore time.Time                                `json:"ending_before" format:"date-time"`
	JSON         contractNamedScheduleGetResponseDataJSON `json:"-"`
}

func (*ContractNamedScheduleGetResponseData) UnmarshalJSON

func (r *ContractNamedScheduleGetResponseData) UnmarshalJSON(data []byte) (err error)

type ContractNamedScheduleService

type ContractNamedScheduleService struct {
	Options []option.RequestOption
}

ContractNamedScheduleService 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 NewContractNamedScheduleService method instead.

func NewContractNamedScheduleService

func NewContractNamedScheduleService(opts ...option.RequestOption) (r *ContractNamedScheduleService)

NewContractNamedScheduleService 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 (*ContractNamedScheduleService) Get

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

func (*ContractNamedScheduleService) Update

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

type ContractNamedScheduleUpdateParams

type ContractNamedScheduleUpdateParams struct {
	// ID of the rate card whose named schedule is to be updated
	RateCardID param.Field[string] `json:"rate_card_id,required" format:"uuid"`
	// The identifier for the schedule to be updated
	ScheduleName param.Field[string]    `json:"schedule_name,required"`
	StartingAt   param.Field[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        param.Field[interface{}] `json:"value,required"`
	EndingBefore param.Field[time.Time]   `json:"ending_before" format:"date-time"`
}

func (ContractNamedScheduleUpdateParams) MarshalJSON

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

type ContractNewHistoricalInvoicesParams

type ContractNewHistoricalInvoicesParams struct {
	Invoices param.Field[[]ContractNewHistoricalInvoicesParamsInvoice] `json:"invoices,required"`
	Preview  param.Field[bool]                                         `json:"preview,required"`
}

func (ContractNewHistoricalInvoicesParams) MarshalJSON

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

type ContractNewHistoricalInvoicesParamsInvoice

type ContractNewHistoricalInvoicesParamsInvoice struct {
	ContractID         param.Field[string]                                                     `json:"contract_id,required" format:"uuid"`
	CreditTypeID       param.Field[string]                                                     `json:"credit_type_id,required" format:"uuid"`
	CustomerID         param.Field[string]                                                     `json:"customer_id,required" format:"uuid"`
	ExclusiveEndDate   param.Field[time.Time]                                                  `json:"exclusive_end_date,required" format:"date-time"`
	InclusiveStartDate param.Field[time.Time]                                                  `json:"inclusive_start_date,required" format:"date-time"`
	IssueDate          param.Field[time.Time]                                                  `json:"issue_date,required" format:"date-time"`
	UsageLineItems     param.Field[[]ContractNewHistoricalInvoicesParamsInvoicesUsageLineItem] `json:"usage_line_items,required"`
	// This field's availability is dependent on your client's configuration.
	BillableStatus       param.Field[ContractNewHistoricalInvoicesParamsInvoicesBillableStatus]       `json:"billable_status"`
	BreakdownGranularity param.Field[ContractNewHistoricalInvoicesParamsInvoicesBreakdownGranularity] `json:"breakdown_granularity"`
	CustomFields         param.Field[map[string]string]                                               `json:"custom_fields"`
}

func (ContractNewHistoricalInvoicesParamsInvoice) MarshalJSON

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

type ContractNewHistoricalInvoicesParamsInvoicesBillableStatus

type ContractNewHistoricalInvoicesParamsInvoicesBillableStatus string

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

const (
	ContractNewHistoricalInvoicesParamsInvoicesBillableStatusBillable   ContractNewHistoricalInvoicesParamsInvoicesBillableStatus = "billable"
	ContractNewHistoricalInvoicesParamsInvoicesBillableStatusUnbillable ContractNewHistoricalInvoicesParamsInvoicesBillableStatus = "unbillable"
)

func (ContractNewHistoricalInvoicesParamsInvoicesBillableStatus) IsKnown

type ContractNewHistoricalInvoicesParamsInvoicesBreakdownGranularity

type ContractNewHistoricalInvoicesParamsInvoicesBreakdownGranularity string
const (
	ContractNewHistoricalInvoicesParamsInvoicesBreakdownGranularityHour ContractNewHistoricalInvoicesParamsInvoicesBreakdownGranularity = "HOUR"
	ContractNewHistoricalInvoicesParamsInvoicesBreakdownGranularityDay  ContractNewHistoricalInvoicesParamsInvoicesBreakdownGranularity = "DAY"
)

func (ContractNewHistoricalInvoicesParamsInvoicesBreakdownGranularity) IsKnown

type ContractNewHistoricalInvoicesParamsInvoicesUsageLineItem

type ContractNewHistoricalInvoicesParamsInvoicesUsageLineItem struct {
	ExclusiveEndDate        param.Field[time.Time]                                                                        `json:"exclusive_end_date,required" format:"date-time"`
	InclusiveStartDate      param.Field[time.Time]                                                                        `json:"inclusive_start_date,required" format:"date-time"`
	ProductID               param.Field[string]                                                                           `json:"product_id,required" format:"uuid"`
	PresentationGroupValues param.Field[map[string]string]                                                                `json:"presentation_group_values"`
	PricingGroupValues      param.Field[map[string]string]                                                                `json:"pricing_group_values"`
	Quantity                param.Field[float64]                                                                          `json:"quantity"`
	SubtotalsWithQuantity   param.Field[[]ContractNewHistoricalInvoicesParamsInvoicesUsageLineItemsSubtotalsWithQuantity] `json:"subtotals_with_quantity"`
}

func (ContractNewHistoricalInvoicesParamsInvoicesUsageLineItem) MarshalJSON

type ContractNewHistoricalInvoicesParamsInvoicesUsageLineItemsSubtotalsWithQuantity

type ContractNewHistoricalInvoicesParamsInvoicesUsageLineItemsSubtotalsWithQuantity struct {
	ExclusiveEndDate   param.Field[time.Time] `json:"exclusive_end_date,required" format:"date-time"`
	InclusiveStartDate param.Field[time.Time] `json:"inclusive_start_date,required" format:"date-time"`
	Quantity           param.Field[float64]   `json:"quantity,required"`
}

func (ContractNewHistoricalInvoicesParamsInvoicesUsageLineItemsSubtotalsWithQuantity) MarshalJSON

type ContractNewHistoricalInvoicesResponse

type ContractNewHistoricalInvoicesResponse struct {
	Data []Invoice                                 `json:"data,required"`
	JSON contractNewHistoricalInvoicesResponseJSON `json:"-"`
}

func (*ContractNewHistoricalInvoicesResponse) UnmarshalJSON

func (r *ContractNewHistoricalInvoicesResponse) UnmarshalJSON(data []byte) (err error)

type ContractNewParams

type ContractNewParams struct {
	CustomerID param.Field[string] `json:"customer_id,required" format:"uuid"`
	// inclusive contract start time
	StartingAt param.Field[time.Time] `json:"starting_at,required" format:"date-time"`
	// This field's availability is dependent on your client's configuration.
	BillingProviderConfiguration param.Field[ContractNewParamsBillingProviderConfiguration] `json:"billing_provider_configuration"`
	Commits                      param.Field[[]ContractNewParamsCommit]                     `json:"commits"`
	Credits                      param.Field[[]ContractNewParamsCredit]                     `json:"credits"`
	CustomFields                 param.Field[map[string]string]                             `json:"custom_fields"`
	// This field's availability is dependent on your client's configuration.
	Discounts param.Field[[]ContractNewParamsDiscount] `json:"discounts"`
	// exclusive contract end time
	EndingBefore param.Field[time.Time] `json:"ending_before" format:"date-time"`
	// 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.
	MultiplierOverridePrioritization param.Field[ContractNewParamsMultiplierOverridePrioritization] `json:"multiplier_override_prioritization"`
	Name                             param.Field[string]                                            `json:"name"`
	NetPaymentTermsDays              param.Field[float64]                                           `json:"net_payment_terms_days"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Field[string]                      `json:"netsuite_sales_order_id"`
	Overrides            param.Field[[]ContractNewParamsOverride] `json:"overrides"`
	// This field's availability is dependent on your client's configuration.
	ProfessionalServices param.Field[[]ContractNewParamsProfessionalService] `json:"professional_services"`
	// Selects the rate card linked to the specified alias as of the contract's start
	// date.
	RateCardAlias param.Field[string] `json:"rate_card_alias"`
	RateCardID    param.Field[string] `json:"rate_card_id" format:"uuid"`
	// This field's availability is dependent on your client's configuration.
	ResellerRoyalties param.Field[[]ContractNewParamsResellerRoyalty] `json:"reseller_royalties"`
	// This field's availability is dependent on your client's configuration.
	SalesforceOpportunityID param.Field[string]                             `json:"salesforce_opportunity_id"`
	ScheduledCharges        param.Field[[]ContractNewParamsScheduledCharge] `json:"scheduled_charges"`
	// This field's availability is dependent on your client's configuration.
	TotalContractValue param.Field[float64]                     `json:"total_contract_value"`
	Transition         param.Field[ContractNewParamsTransition] `json:"transition"`
	// 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.Field[string]                                  `json:"uniqueness_key"`
	UsageFilter            param.Field[shared.BaseUsageFilterParam]             `json:"usage_filter"`
	UsageStatementSchedule param.Field[ContractNewParamsUsageStatementSchedule] `json:"usage_statement_schedule"`
}

func (ContractNewParams) MarshalJSON

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

type ContractNewParamsBillingProviderConfiguration

type ContractNewParamsBillingProviderConfiguration struct {
	BillingProvider param.Field[ContractNewParamsBillingProviderConfigurationBillingProvider] `json:"billing_provider"`
	// The Metronome ID of the billing provider configuration
	BillingProviderConfigurationID param.Field[string]                                                      `json:"billing_provider_configuration_id" format:"uuid"`
	DeliveryMethod                 param.Field[ContractNewParamsBillingProviderConfigurationDeliveryMethod] `json:"delivery_method"`
}

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

func (ContractNewParamsBillingProviderConfiguration) MarshalJSON

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

type ContractNewParamsBillingProviderConfigurationBillingProvider

type ContractNewParamsBillingProviderConfigurationBillingProvider string
const (
	ContractNewParamsBillingProviderConfigurationBillingProviderAwsMarketplace   ContractNewParamsBillingProviderConfigurationBillingProvider = "aws_marketplace"
	ContractNewParamsBillingProviderConfigurationBillingProviderAzureMarketplace ContractNewParamsBillingProviderConfigurationBillingProvider = "azure_marketplace"
	ContractNewParamsBillingProviderConfigurationBillingProviderGcpMarketplace   ContractNewParamsBillingProviderConfigurationBillingProvider = "gcp_marketplace"
	ContractNewParamsBillingProviderConfigurationBillingProviderStripe           ContractNewParamsBillingProviderConfigurationBillingProvider = "stripe"
	ContractNewParamsBillingProviderConfigurationBillingProviderNetsuite         ContractNewParamsBillingProviderConfigurationBillingProvider = "netsuite"
)

func (ContractNewParamsBillingProviderConfigurationBillingProvider) IsKnown

type ContractNewParamsBillingProviderConfigurationDeliveryMethod

type ContractNewParamsBillingProviderConfigurationDeliveryMethod string
const (
	ContractNewParamsBillingProviderConfigurationDeliveryMethodDirectToBillingProvider ContractNewParamsBillingProviderConfigurationDeliveryMethod = "direct_to_billing_provider"
	ContractNewParamsBillingProviderConfigurationDeliveryMethodAwsSqs                  ContractNewParamsBillingProviderConfigurationDeliveryMethod = "aws_sqs"
	ContractNewParamsBillingProviderConfigurationDeliveryMethodTackle                  ContractNewParamsBillingProviderConfigurationDeliveryMethod = "tackle"
	ContractNewParamsBillingProviderConfigurationDeliveryMethodAwsSns                  ContractNewParamsBillingProviderConfigurationDeliveryMethod = "aws_sns"
)

func (ContractNewParamsBillingProviderConfigurationDeliveryMethod) IsKnown

type ContractNewParamsCommit

type ContractNewParamsCommit struct {
	ProductID param.Field[string]                       `json:"product_id,required" format:"uuid"`
	Type      param.Field[ContractNewParamsCommitsType] `json:"type,required"`
	// 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 param.Field[ContractNewParamsCommitsAccessSchedule] `json:"access_schedule"`
	// (DEPRECATED) Use access_schedule and invoice_schedule instead.
	Amount param.Field[float64] `json:"amount"`
	// Which products the commit applies to. If both applicable_product_ids and
	// applicable_product_tags are not provided, the commit applies to all products.
	ApplicableProductIDs param.Field[[]string] `json:"applicable_product_ids" format:"uuid"`
	// Which tags the commit applies to. If both applicable_product_ids and
	// applicable_product_tags are not provided, the commit applies to all products.
	ApplicableProductTags param.Field[[]string]          `json:"applicable_product_tags"`
	CustomFields          param.Field[map[string]string] `json:"custom_fields"`
	// Used only in UI/API. It is not exposed to end customers.
	Description param.Field[string] `json:"description"`
	// 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 param.Field[ContractNewParamsCommitsInvoiceSchedule] `json:"invoice_schedule"`
	// displayed on invoices
	Name param.Field[string] `json:"name"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Field[string] `json:"netsuite_sales_order_id"`
	// If multiple commits are applicable, the one with the lower priority will apply
	// first.
	Priority param.Field[float64] `json:"priority"`
	// Fraction of unused segments that will be rolled over. Must be between 0 and 1.
	RolloverFraction param.Field[float64] `json:"rollover_fraction"`
}

func (ContractNewParamsCommit) MarshalJSON

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

type ContractNewParamsCommitsAccessSchedule

type ContractNewParamsCommitsAccessSchedule struct {
	ScheduleItems param.Field[[]ContractNewParamsCommitsAccessScheduleScheduleItem] `json:"schedule_items,required"`
	CreditTypeID  param.Field[string]                                               `json:"credit_type_id" format:"uuid"`
}

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.

func (ContractNewParamsCommitsAccessSchedule) MarshalJSON

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

type ContractNewParamsCommitsAccessScheduleScheduleItem

type ContractNewParamsCommitsAccessScheduleScheduleItem struct {
	Amount param.Field[float64] `json:"amount,required"`
	// RFC 3339 timestamp (exclusive)
	EndingBefore param.Field[time.Time] `json:"ending_before,required" format:"date-time"`
	// RFC 3339 timestamp (inclusive)
	StartingAt param.Field[time.Time] `json:"starting_at,required" format:"date-time"`
}

func (ContractNewParamsCommitsAccessScheduleScheduleItem) MarshalJSON

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

type ContractNewParamsCommitsInvoiceSchedule

type ContractNewParamsCommitsInvoiceSchedule struct {
	// Defaults to USD if not passed. Only USD is supported at this time.
	CreditTypeID param.Field[string] `json:"credit_type_id" format:"uuid"`
	// 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 param.Field[ContractNewParamsCommitsInvoiceScheduleRecurringSchedule] `json:"recurring_schedule"`
	// Either provide amount or provide both unit_price and quantity.
	ScheduleItems param.Field[[]ContractNewParamsCommitsInvoiceScheduleScheduleItem] `json:"schedule_items"`
}

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 (ContractNewParamsCommitsInvoiceSchedule) MarshalJSON

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

type ContractNewParamsCommitsInvoiceScheduleRecurringSchedule

type ContractNewParamsCommitsInvoiceScheduleRecurringSchedule struct {
	AmountDistribution param.Field[ContractNewParamsCommitsInvoiceScheduleRecurringScheduleAmountDistribution] `json:"amount_distribution,required"`
	// RFC 3339 timestamp (exclusive).
	EndingBefore param.Field[time.Time]                                                         `json:"ending_before,required" format:"date-time"`
	Frequency    param.Field[ContractNewParamsCommitsInvoiceScheduleRecurringScheduleFrequency] `json:"frequency,required"`
	// RFC 3339 timestamp (inclusive).
	StartingAt param.Field[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.Field[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 param.Field[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 param.Field[float64] `json:"unit_price"`
}

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 (ContractNewParamsCommitsInvoiceScheduleRecurringSchedule) MarshalJSON

type ContractNewParamsCommitsInvoiceScheduleRecurringScheduleAmountDistribution

type ContractNewParamsCommitsInvoiceScheduleRecurringScheduleAmountDistribution string
const (
	ContractNewParamsCommitsInvoiceScheduleRecurringScheduleAmountDistributionDivided        ContractNewParamsCommitsInvoiceScheduleRecurringScheduleAmountDistribution = "DIVIDED"
	ContractNewParamsCommitsInvoiceScheduleRecurringScheduleAmountDistributionDividedRounded ContractNewParamsCommitsInvoiceScheduleRecurringScheduleAmountDistribution = "DIVIDED_ROUNDED"
	ContractNewParamsCommitsInvoiceScheduleRecurringScheduleAmountDistributionEach           ContractNewParamsCommitsInvoiceScheduleRecurringScheduleAmountDistribution = "EACH"
)

func (ContractNewParamsCommitsInvoiceScheduleRecurringScheduleAmountDistribution) IsKnown

type ContractNewParamsCommitsInvoiceScheduleRecurringScheduleFrequency

type ContractNewParamsCommitsInvoiceScheduleRecurringScheduleFrequency string
const (
	ContractNewParamsCommitsInvoiceScheduleRecurringScheduleFrequencyMonthly    ContractNewParamsCommitsInvoiceScheduleRecurringScheduleFrequency = "MONTHLY"
	ContractNewParamsCommitsInvoiceScheduleRecurringScheduleFrequencyQuarterly  ContractNewParamsCommitsInvoiceScheduleRecurringScheduleFrequency = "QUARTERLY"
	ContractNewParamsCommitsInvoiceScheduleRecurringScheduleFrequencySemiAnnual ContractNewParamsCommitsInvoiceScheduleRecurringScheduleFrequency = "SEMI_ANNUAL"
	ContractNewParamsCommitsInvoiceScheduleRecurringScheduleFrequencyAnnual     ContractNewParamsCommitsInvoiceScheduleRecurringScheduleFrequency = "ANNUAL"
)

func (ContractNewParamsCommitsInvoiceScheduleRecurringScheduleFrequency) IsKnown

type ContractNewParamsCommitsInvoiceScheduleScheduleItem

type ContractNewParamsCommitsInvoiceScheduleScheduleItem struct {
	// timestamp of the scheduled event
	Timestamp param.Field[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.Field[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 param.Field[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 param.Field[float64] `json:"unit_price"`
}

func (ContractNewParamsCommitsInvoiceScheduleScheduleItem) MarshalJSON

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

type ContractNewParamsCommitsType

type ContractNewParamsCommitsType string
const (
	ContractNewParamsCommitsTypePrepaid  ContractNewParamsCommitsType = "PREPAID"
	ContractNewParamsCommitsTypePostpaid ContractNewParamsCommitsType = "POSTPAID"
)

func (ContractNewParamsCommitsType) IsKnown

func (r ContractNewParamsCommitsType) IsKnown() bool

type ContractNewParamsCredit

type ContractNewParamsCredit struct {
	// Schedule for distributing the credit to the customer.
	AccessSchedule param.Field[ContractNewParamsCreditsAccessSchedule] `json:"access_schedule,required"`
	ProductID      param.Field[string]                                 `json:"product_id,required" 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 param.Field[[]string] `json:"applicable_product_ids" 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 param.Field[[]string]          `json:"applicable_product_tags"`
	CustomFields          param.Field[map[string]string] `json:"custom_fields"`
	// Used only in UI/API. It is not exposed to end customers.
	Description param.Field[string] `json:"description"`
	// displayed on invoices
	Name param.Field[string] `json:"name"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Field[string] `json:"netsuite_sales_order_id"`
	// If multiple credits are applicable, the one with the lower priority will apply
	// first.
	Priority param.Field[float64] `json:"priority"`
}

func (ContractNewParamsCredit) MarshalJSON

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

type ContractNewParamsCreditsAccessSchedule

type ContractNewParamsCreditsAccessSchedule struct {
	ScheduleItems param.Field[[]ContractNewParamsCreditsAccessScheduleScheduleItem] `json:"schedule_items,required"`
	CreditTypeID  param.Field[string]                                               `json:"credit_type_id" format:"uuid"`
}

Schedule for distributing the credit to the customer.

func (ContractNewParamsCreditsAccessSchedule) MarshalJSON

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

type ContractNewParamsCreditsAccessScheduleScheduleItem

type ContractNewParamsCreditsAccessScheduleScheduleItem struct {
	Amount param.Field[float64] `json:"amount,required"`
	// RFC 3339 timestamp (exclusive)
	EndingBefore param.Field[time.Time] `json:"ending_before,required" format:"date-time"`
	// RFC 3339 timestamp (inclusive)
	StartingAt param.Field[time.Time] `json:"starting_at,required" format:"date-time"`
}

func (ContractNewParamsCreditsAccessScheduleScheduleItem) MarshalJSON

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

type ContractNewParamsDiscount

type ContractNewParamsDiscount struct {
	ProductID param.Field[string] `json:"product_id,required" format:"uuid"`
	// Must provide either schedule_items or recurring_schedule.
	Schedule param.Field[ContractNewParamsDiscountsSchedule] `json:"schedule,required"`
	// displayed on invoices
	Name param.Field[string] `json:"name"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Field[string] `json:"netsuite_sales_order_id"`
}

func (ContractNewParamsDiscount) MarshalJSON

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

type ContractNewParamsDiscountsSchedule

type ContractNewParamsDiscountsSchedule struct {
	// Defaults to USD if not passed. Only USD is supported at this time.
	CreditTypeID param.Field[string] `json:"credit_type_id" format:"uuid"`
	// 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 param.Field[ContractNewParamsDiscountsScheduleRecurringSchedule] `json:"recurring_schedule"`
	// Either provide amount or provide both unit_price and quantity.
	ScheduleItems param.Field[[]ContractNewParamsDiscountsScheduleScheduleItem] `json:"schedule_items"`
}

Must provide either schedule_items or recurring_schedule.

func (ContractNewParamsDiscountsSchedule) MarshalJSON

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

type ContractNewParamsDiscountsScheduleRecurringSchedule

type ContractNewParamsDiscountsScheduleRecurringSchedule struct {
	AmountDistribution param.Field[ContractNewParamsDiscountsScheduleRecurringScheduleAmountDistribution] `json:"amount_distribution,required"`
	// RFC 3339 timestamp (exclusive).
	EndingBefore param.Field[time.Time]                                                    `json:"ending_before,required" format:"date-time"`
	Frequency    param.Field[ContractNewParamsDiscountsScheduleRecurringScheduleFrequency] `json:"frequency,required"`
	// RFC 3339 timestamp (inclusive).
	StartingAt param.Field[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.Field[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 param.Field[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 param.Field[float64] `json:"unit_price"`
}

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 (ContractNewParamsDiscountsScheduleRecurringSchedule) MarshalJSON

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

type ContractNewParamsDiscountsScheduleRecurringScheduleAmountDistribution

type ContractNewParamsDiscountsScheduleRecurringScheduleAmountDistribution string
const (
	ContractNewParamsDiscountsScheduleRecurringScheduleAmountDistributionDivided        ContractNewParamsDiscountsScheduleRecurringScheduleAmountDistribution = "DIVIDED"
	ContractNewParamsDiscountsScheduleRecurringScheduleAmountDistributionDividedRounded ContractNewParamsDiscountsScheduleRecurringScheduleAmountDistribution = "DIVIDED_ROUNDED"
	ContractNewParamsDiscountsScheduleRecurringScheduleAmountDistributionEach           ContractNewParamsDiscountsScheduleRecurringScheduleAmountDistribution = "EACH"
)

func (ContractNewParamsDiscountsScheduleRecurringScheduleAmountDistribution) IsKnown

type ContractNewParamsDiscountsScheduleRecurringScheduleFrequency

type ContractNewParamsDiscountsScheduleRecurringScheduleFrequency string
const (
	ContractNewParamsDiscountsScheduleRecurringScheduleFrequencyMonthly    ContractNewParamsDiscountsScheduleRecurringScheduleFrequency = "MONTHLY"
	ContractNewParamsDiscountsScheduleRecurringScheduleFrequencyQuarterly  ContractNewParamsDiscountsScheduleRecurringScheduleFrequency = "QUARTERLY"
	ContractNewParamsDiscountsScheduleRecurringScheduleFrequencySemiAnnual ContractNewParamsDiscountsScheduleRecurringScheduleFrequency = "SEMI_ANNUAL"
	ContractNewParamsDiscountsScheduleRecurringScheduleFrequencyAnnual     ContractNewParamsDiscountsScheduleRecurringScheduleFrequency = "ANNUAL"
)

func (ContractNewParamsDiscountsScheduleRecurringScheduleFrequency) IsKnown

type ContractNewParamsDiscountsScheduleScheduleItem

type ContractNewParamsDiscountsScheduleScheduleItem struct {
	// timestamp of the scheduled event
	Timestamp param.Field[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.Field[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 param.Field[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 param.Field[float64] `json:"unit_price"`
}

func (ContractNewParamsDiscountsScheduleScheduleItem) MarshalJSON

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

type ContractNewParamsMultiplierOverridePrioritization

type ContractNewParamsMultiplierOverridePrioritization 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 (
	ContractNewParamsMultiplierOverridePrioritizationLowestMultiplier ContractNewParamsMultiplierOverridePrioritization = "LOWEST_MULTIPLIER"
	ContractNewParamsMultiplierOverridePrioritizationExplicit         ContractNewParamsMultiplierOverridePrioritization = "EXPLICIT"
)

func (ContractNewParamsMultiplierOverridePrioritization) IsKnown

type ContractNewParamsOverride

type ContractNewParamsOverride struct {
	// RFC 3339 timestamp indicating when the override will start applying (inclusive)
	StartingAt param.Field[time.Time] `json:"starting_at,required" format:"date-time"`
	// tags identifying products whose rates are being overridden
	ApplicableProductTags param.Field[[]string] `json:"applicable_product_tags"`
	// RFC 3339 timestamp indicating when the override will stop applying (exclusive)
	EndingBefore param.Field[time.Time] `json:"ending_before" format:"date-time"`
	Entitled     param.Field[bool]      `json:"entitled"`
	// Required for MULTIPLIER type. Must be >=0.
	Multiplier param.Field[float64] `json:"multiplier"`
	// 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 param.Field[[]ContractNewParamsOverridesOverrideSpecifier] `json:"override_specifiers"`
	// Required for OVERWRITE type.
	OverwriteRate param.Field[ContractNewParamsOverridesOverwriteRate] `json:"overwrite_rate"`
	// 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.Field[float64] `json:"priority"`
	// ID of the product whose rate is being overridden
	ProductID param.Field[string] `json:"product_id" format:"uuid"`
	// Required for TIERED type. Must have at least one tier.
	Tiers param.Field[[]ContractNewParamsOverridesTier] `json:"tiers"`
	// Overwrites are prioritized over multipliers and tiered overrides.
	Type param.Field[ContractNewParamsOverridesType] `json:"type"`
}

func (ContractNewParamsOverride) MarshalJSON

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

type ContractNewParamsOverridesOverrideSpecifier

type ContractNewParamsOverridesOverrideSpecifier struct {
	// 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 param.Field[map[string]string] `json:"presentation_group_values"`
	// A map of pricing group names to values. The override will only apply to products
	// with the specified pricing group values.
	PricingGroupValues param.Field[map[string]string] `json:"pricing_group_values"`
	// If provided, the override will only apply to the product with the specified ID.
	ProductID param.Field[string] `json:"product_id" format:"uuid"`
	// If provided, the override will only apply to products with all the specified
	// tags.
	ProductTags param.Field[[]string] `json:"product_tags"`
}

func (ContractNewParamsOverridesOverrideSpecifier) MarshalJSON

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

type ContractNewParamsOverridesOverwriteRate

type ContractNewParamsOverridesOverwriteRate struct {
	RateType     param.Field[ContractNewParamsOverridesOverwriteRateRateType] `json:"rate_type,required"`
	CreditTypeID param.Field[string]                                          `json:"credit_type_id" format:"uuid"`
	// Only set for CUSTOM rate_type. This field is interpreted by custom rate
	// processors.
	CustomRate param.Field[map[string]interface{}] `json:"custom_rate"`
	// Default proration configuration. Only valid for SUBSCRIPTION rate_type.
	IsProrated param.Field[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 param.Field[float64] `json:"price"`
	// Default quantity. For SUBSCRIPTION rate_type, this must be >=0.
	Quantity param.Field[float64] `json:"quantity"`
	// Only set for TIERED rate_type.
	Tiers param.Field[[]shared.TierParam] `json:"tiers"`
}

Required for OVERWRITE type.

func (ContractNewParamsOverridesOverwriteRate) MarshalJSON

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

type ContractNewParamsOverridesOverwriteRateRateType

type ContractNewParamsOverridesOverwriteRateRateType string
const (
	ContractNewParamsOverridesOverwriteRateRateTypeFlat         ContractNewParamsOverridesOverwriteRateRateType = "FLAT"
	ContractNewParamsOverridesOverwriteRateRateTypePercentage   ContractNewParamsOverridesOverwriteRateRateType = "PERCENTAGE"
	ContractNewParamsOverridesOverwriteRateRateTypeSubscription ContractNewParamsOverridesOverwriteRateRateType = "SUBSCRIPTION"
	ContractNewParamsOverridesOverwriteRateRateTypeTiered       ContractNewParamsOverridesOverwriteRateRateType = "TIERED"
	ContractNewParamsOverridesOverwriteRateRateTypeCustom       ContractNewParamsOverridesOverwriteRateRateType = "CUSTOM"
)

func (ContractNewParamsOverridesOverwriteRateRateType) IsKnown

type ContractNewParamsOverridesTier

type ContractNewParamsOverridesTier struct {
	Multiplier param.Field[float64] `json:"multiplier,required"`
	Size       param.Field[float64] `json:"size"`
}

func (ContractNewParamsOverridesTier) MarshalJSON

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

type ContractNewParamsOverridesType

type ContractNewParamsOverridesType string

Overwrites are prioritized over multipliers and tiered overrides.

const (
	ContractNewParamsOverridesTypeOverwrite  ContractNewParamsOverridesType = "OVERWRITE"
	ContractNewParamsOverridesTypeMultiplier ContractNewParamsOverridesType = "MULTIPLIER"
	ContractNewParamsOverridesTypeTiered     ContractNewParamsOverridesType = "TIERED"
)

func (ContractNewParamsOverridesType) IsKnown

type ContractNewParamsProfessionalService

type ContractNewParamsProfessionalService struct {
	// Maximum amount for the term.
	MaxAmount param.Field[float64] `json:"max_amount,required"`
	ProductID param.Field[string]  `json:"product_id,required" format:"uuid"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount.
	Quantity param.Field[float64] `json:"quantity,required"`
	// Unit price for the charge. Will be multiplied by quantity to determine the
	// amount and must be specified.
	UnitPrice    param.Field[float64]           `json:"unit_price,required"`
	CustomFields param.Field[map[string]string] `json:"custom_fields"`
	Description  param.Field[string]            `json:"description"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Field[string] `json:"netsuite_sales_order_id"`
}

func (ContractNewParamsProfessionalService) MarshalJSON

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

type ContractNewParamsResellerRoyaltiesAwsOptions

type ContractNewParamsResellerRoyaltiesAwsOptions struct {
	AwsAccountNumber    param.Field[string] `json:"aws_account_number"`
	AwsOfferID          param.Field[string] `json:"aws_offer_id"`
	AwsPayerReferenceID param.Field[string] `json:"aws_payer_reference_id"`
}

func (ContractNewParamsResellerRoyaltiesAwsOptions) MarshalJSON

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

type ContractNewParamsResellerRoyaltiesGcpOptions

type ContractNewParamsResellerRoyaltiesGcpOptions struct {
	GcpAccountID param.Field[string] `json:"gcp_account_id"`
	GcpOfferID   param.Field[string] `json:"gcp_offer_id"`
}

func (ContractNewParamsResellerRoyaltiesGcpOptions) MarshalJSON

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

type ContractNewParamsResellerRoyaltiesResellerType

type ContractNewParamsResellerRoyaltiesResellerType string
const (
	ContractNewParamsResellerRoyaltiesResellerTypeAws           ContractNewParamsResellerRoyaltiesResellerType = "AWS"
	ContractNewParamsResellerRoyaltiesResellerTypeAwsProService ContractNewParamsResellerRoyaltiesResellerType = "AWS_PRO_SERVICE"
	ContractNewParamsResellerRoyaltiesResellerTypeGcp           ContractNewParamsResellerRoyaltiesResellerType = "GCP"
	ContractNewParamsResellerRoyaltiesResellerTypeGcpProService ContractNewParamsResellerRoyaltiesResellerType = "GCP_PRO_SERVICE"
)

func (ContractNewParamsResellerRoyaltiesResellerType) IsKnown

type ContractNewParamsResellerRoyalty

type ContractNewParamsResellerRoyalty struct {
	Fraction           param.Field[float64]                                        `json:"fraction,required"`
	NetsuiteResellerID param.Field[string]                                         `json:"netsuite_reseller_id,required"`
	ResellerType       param.Field[ContractNewParamsResellerRoyaltiesResellerType] `json:"reseller_type,required"`
	StartingAt         param.Field[time.Time]                                      `json:"starting_at,required" format:"date-time"`
	// Must provide at least one of applicable_product_ids or applicable_product_tags.
	ApplicableProductIDs param.Field[[]string] `json:"applicable_product_ids" format:"uuid"`
	// Must provide at least one of applicable_product_ids or applicable_product_tags.
	ApplicableProductTags param.Field[[]string]                                     `json:"applicable_product_tags"`
	AwsOptions            param.Field[ContractNewParamsResellerRoyaltiesAwsOptions] `json:"aws_options"`
	EndingBefore          param.Field[time.Time]                                    `json:"ending_before" format:"date-time"`
	GcpOptions            param.Field[ContractNewParamsResellerRoyaltiesGcpOptions] `json:"gcp_options"`
	ResellerContractValue param.Field[float64]                                      `json:"reseller_contract_value"`
}

func (ContractNewParamsResellerRoyalty) MarshalJSON

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

type ContractNewParamsScheduledCharge

type ContractNewParamsScheduledCharge struct {
	ProductID param.Field[string] `json:"product_id,required" format:"uuid"`
	// Must provide either schedule_items or recurring_schedule.
	Schedule param.Field[ContractNewParamsScheduledChargesSchedule] `json:"schedule,required"`
	// displayed on invoices
	Name param.Field[string] `json:"name"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Field[string] `json:"netsuite_sales_order_id"`
}

func (ContractNewParamsScheduledCharge) MarshalJSON

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

type ContractNewParamsScheduledChargesSchedule

type ContractNewParamsScheduledChargesSchedule struct {
	// Defaults to USD if not passed. Only USD is supported at this time.
	CreditTypeID param.Field[string] `json:"credit_type_id" format:"uuid"`
	// 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 param.Field[ContractNewParamsScheduledChargesScheduleRecurringSchedule] `json:"recurring_schedule"`
	// Either provide amount or provide both unit_price and quantity.
	ScheduleItems param.Field[[]ContractNewParamsScheduledChargesScheduleScheduleItem] `json:"schedule_items"`
}

Must provide either schedule_items or recurring_schedule.

func (ContractNewParamsScheduledChargesSchedule) MarshalJSON

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

type ContractNewParamsScheduledChargesScheduleRecurringSchedule

type ContractNewParamsScheduledChargesScheduleRecurringSchedule struct {
	AmountDistribution param.Field[ContractNewParamsScheduledChargesScheduleRecurringScheduleAmountDistribution] `json:"amount_distribution,required"`
	// RFC 3339 timestamp (exclusive).
	EndingBefore param.Field[time.Time]                                                           `json:"ending_before,required" format:"date-time"`
	Frequency    param.Field[ContractNewParamsScheduledChargesScheduleRecurringScheduleFrequency] `json:"frequency,required"`
	// RFC 3339 timestamp (inclusive).
	StartingAt param.Field[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.Field[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 param.Field[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 param.Field[float64] `json:"unit_price"`
}

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 (ContractNewParamsScheduledChargesScheduleRecurringSchedule) MarshalJSON

type ContractNewParamsScheduledChargesScheduleRecurringScheduleAmountDistribution

type ContractNewParamsScheduledChargesScheduleRecurringScheduleAmountDistribution string
const (
	ContractNewParamsScheduledChargesScheduleRecurringScheduleAmountDistributionDivided        ContractNewParamsScheduledChargesScheduleRecurringScheduleAmountDistribution = "DIVIDED"
	ContractNewParamsScheduledChargesScheduleRecurringScheduleAmountDistributionDividedRounded ContractNewParamsScheduledChargesScheduleRecurringScheduleAmountDistribution = "DIVIDED_ROUNDED"
	ContractNewParamsScheduledChargesScheduleRecurringScheduleAmountDistributionEach           ContractNewParamsScheduledChargesScheduleRecurringScheduleAmountDistribution = "EACH"
)

func (ContractNewParamsScheduledChargesScheduleRecurringScheduleAmountDistribution) IsKnown

type ContractNewParamsScheduledChargesScheduleRecurringScheduleFrequency

type ContractNewParamsScheduledChargesScheduleRecurringScheduleFrequency string
const (
	ContractNewParamsScheduledChargesScheduleRecurringScheduleFrequencyMonthly    ContractNewParamsScheduledChargesScheduleRecurringScheduleFrequency = "MONTHLY"
	ContractNewParamsScheduledChargesScheduleRecurringScheduleFrequencyQuarterly  ContractNewParamsScheduledChargesScheduleRecurringScheduleFrequency = "QUARTERLY"
	ContractNewParamsScheduledChargesScheduleRecurringScheduleFrequencySemiAnnual ContractNewParamsScheduledChargesScheduleRecurringScheduleFrequency = "SEMI_ANNUAL"
	ContractNewParamsScheduledChargesScheduleRecurringScheduleFrequencyAnnual     ContractNewParamsScheduledChargesScheduleRecurringScheduleFrequency = "ANNUAL"
)

func (ContractNewParamsScheduledChargesScheduleRecurringScheduleFrequency) IsKnown

type ContractNewParamsScheduledChargesScheduleScheduleItem

type ContractNewParamsScheduledChargesScheduleScheduleItem struct {
	// timestamp of the scheduled event
	Timestamp param.Field[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.Field[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 param.Field[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 param.Field[float64] `json:"unit_price"`
}

func (ContractNewParamsScheduledChargesScheduleScheduleItem) MarshalJSON

type ContractNewParamsTransition

type ContractNewParamsTransition struct {
	FromContractID param.Field[string] `json:"from_contract_id,required" format:"uuid"`
	// This field's available values may vary based on your client's configuration.
	Type                  param.Field[ContractNewParamsTransitionType]                  `json:"type,required"`
	FutureInvoiceBehavior param.Field[ContractNewParamsTransitionFutureInvoiceBehavior] `json:"future_invoice_behavior"`
}

func (ContractNewParamsTransition) MarshalJSON

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

type ContractNewParamsTransitionFutureInvoiceBehavior

type ContractNewParamsTransitionFutureInvoiceBehavior struct {
	// Controls whether future trueup invoices are billed or removed. Default behavior
	// is AS_IS if not specified.
	Trueup param.Field[ContractNewParamsTransitionFutureInvoiceBehaviorTrueup] `json:"trueup"`
}

func (ContractNewParamsTransitionFutureInvoiceBehavior) MarshalJSON

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

type ContractNewParamsTransitionFutureInvoiceBehaviorTrueup

type ContractNewParamsTransitionFutureInvoiceBehaviorTrueup string

Controls whether future trueup invoices are billed or removed. Default behavior is AS_IS if not specified.

const (
	ContractNewParamsTransitionFutureInvoiceBehaviorTrueupRemove ContractNewParamsTransitionFutureInvoiceBehaviorTrueup = "REMOVE"
	ContractNewParamsTransitionFutureInvoiceBehaviorTrueupAsIs   ContractNewParamsTransitionFutureInvoiceBehaviorTrueup = "AS_IS"
)

func (ContractNewParamsTransitionFutureInvoiceBehaviorTrueup) IsKnown

type ContractNewParamsTransitionType

type ContractNewParamsTransitionType string

This field's available values may vary based on your client's configuration.

const (
	ContractNewParamsTransitionTypeSupersede ContractNewParamsTransitionType = "SUPERSEDE"
	ContractNewParamsTransitionTypeRenewal   ContractNewParamsTransitionType = "RENEWAL"
)

func (ContractNewParamsTransitionType) IsKnown

type ContractNewParamsUsageStatementSchedule

type ContractNewParamsUsageStatementSchedule struct {
	Frequency param.Field[ContractNewParamsUsageStatementScheduleFrequency] `json:"frequency,required"`
	// If not provided, defaults to the first day of the month.
	Day param.Field[ContractNewParamsUsageStatementScheduleDay] `json:"day"`
	// 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.Field[time.Time] `json:"invoice_generation_starting_at" format:"date-time"`
}

func (ContractNewParamsUsageStatementSchedule) MarshalJSON

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

type ContractNewParamsUsageStatementScheduleDay

type ContractNewParamsUsageStatementScheduleDay string

If not provided, defaults to the first day of the month.

const (
	ContractNewParamsUsageStatementScheduleDayFirstOfMonth  ContractNewParamsUsageStatementScheduleDay = "FIRST_OF_MONTH"
	ContractNewParamsUsageStatementScheduleDayContractStart ContractNewParamsUsageStatementScheduleDay = "CONTRACT_START"
)

func (ContractNewParamsUsageStatementScheduleDay) IsKnown

type ContractNewParamsUsageStatementScheduleFrequency

type ContractNewParamsUsageStatementScheduleFrequency string
const (
	ContractNewParamsUsageStatementScheduleFrequencyMonthly   ContractNewParamsUsageStatementScheduleFrequency = "MONTHLY"
	ContractNewParamsUsageStatementScheduleFrequencyQuarterly ContractNewParamsUsageStatementScheduleFrequency = "QUARTERLY"
)

func (ContractNewParamsUsageStatementScheduleFrequency) IsKnown

type ContractNewResponse

type ContractNewResponse struct {
	Data shared.ID               `json:"data,required"`
	JSON contractNewResponseJSON `json:"-"`
}

func (*ContractNewResponse) UnmarshalJSON

func (r *ContractNewResponse) UnmarshalJSON(data []byte) (err error)

type ContractProductArchiveParams

type ContractProductArchiveParams struct {
	// ID of the product to be archived
	ProductID param.Field[string] `json:"product_id,required" format:"uuid"`
}

func (ContractProductArchiveParams) MarshalJSON

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

type ContractProductArchiveResponse

type ContractProductArchiveResponse struct {
	Data shared.ID                          `json:"data,required"`
	JSON contractProductArchiveResponseJSON `json:"-"`
}

func (*ContractProductArchiveResponse) UnmarshalJSON

func (r *ContractProductArchiveResponse) UnmarshalJSON(data []byte) (err error)

type ContractProductGetParams

type ContractProductGetParams struct {
	ID shared.IDParam `json:"id,required"`
}

func (ContractProductGetParams) MarshalJSON

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

type ContractProductGetResponse

type ContractProductGetResponse struct {
	Data ContractProductGetResponseData `json:"data,required"`
	JSON contractProductGetResponseJSON `json:"-"`
}

func (*ContractProductGetResponse) UnmarshalJSON

func (r *ContractProductGetResponse) UnmarshalJSON(data []byte) (err error)

type ContractProductGetResponseData

type ContractProductGetResponseData struct {
	ID           string                                 `json:"id,required" format:"uuid"`
	Current      ProductListItemState                   `json:"current,required"`
	Initial      ProductListItemState                   `json:"initial,required"`
	Type         ContractProductGetResponseDataType     `json:"type,required"`
	Updates      []ContractProductGetResponseDataUpdate `json:"updates,required"`
	ArchivedAt   time.Time                              `json:"archived_at,nullable" format:"date-time"`
	CustomFields map[string]string                      `json:"custom_fields"`
	JSON         contractProductGetResponseDataJSON     `json:"-"`
}

func (*ContractProductGetResponseData) UnmarshalJSON

func (r *ContractProductGetResponseData) UnmarshalJSON(data []byte) (err error)

type ContractProductGetResponseDataType

type ContractProductGetResponseDataType string
const (
	ContractProductGetResponseDataTypeUsage        ContractProductGetResponseDataType = "USAGE"
	ContractProductGetResponseDataTypeSubscription ContractProductGetResponseDataType = "SUBSCRIPTION"
	ContractProductGetResponseDataTypeComposite    ContractProductGetResponseDataType = "COMPOSITE"
	ContractProductGetResponseDataTypeFixed        ContractProductGetResponseDataType = "FIXED"
	ContractProductGetResponseDataTypeProService   ContractProductGetResponseDataType = "PRO_SERVICE"
)

func (ContractProductGetResponseDataType) IsKnown

type ContractProductGetResponseDataUpdate

type ContractProductGetResponseDataUpdate 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.
	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.
	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             contractProductGetResponseDataUpdateJSON `json:"-"`
}

func (*ContractProductGetResponseDataUpdate) UnmarshalJSON

func (r *ContractProductGetResponseDataUpdate) UnmarshalJSON(data []byte) (err error)

type ContractProductListParams

type ContractProductListParams struct {
	// Max number of results that should be returned
	Limit param.Field[int64] `query:"limit"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
	// Filter options for the product list
	ArchiveFilter param.Field[ContractProductListParamsArchiveFilter] `json:"archive_filter"`
}

func (ContractProductListParams) MarshalJSON

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

func (ContractProductListParams) URLQuery

func (r ContractProductListParams) URLQuery() (v url.Values)

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

type ContractProductListParamsArchiveFilter

type ContractProductListParamsArchiveFilter string

Filter options for the product list

const (
	ContractProductListParamsArchiveFilterArchived    ContractProductListParamsArchiveFilter = "ARCHIVED"
	ContractProductListParamsArchiveFilterNotArchived ContractProductListParamsArchiveFilter = "NOT_ARCHIVED"
	ContractProductListParamsArchiveFilterAll         ContractProductListParamsArchiveFilter = "ALL"
)

func (ContractProductListParamsArchiveFilter) IsKnown

type ContractProductListResponse

type ContractProductListResponse struct {
	ID           string                              `json:"id,required" format:"uuid"`
	Current      ProductListItemState                `json:"current,required"`
	Initial      ProductListItemState                `json:"initial,required"`
	Type         ContractProductListResponseType     `json:"type,required"`
	Updates      []ContractProductListResponseUpdate `json:"updates,required"`
	ArchivedAt   time.Time                           `json:"archived_at,nullable" format:"date-time"`
	CustomFields map[string]string                   `json:"custom_fields"`
	JSON         contractProductListResponseJSON     `json:"-"`
}

func (*ContractProductListResponse) UnmarshalJSON

func (r *ContractProductListResponse) UnmarshalJSON(data []byte) (err error)

type ContractProductListResponseType

type ContractProductListResponseType string
const (
	ContractProductListResponseTypeUsage        ContractProductListResponseType = "USAGE"
	ContractProductListResponseTypeSubscription ContractProductListResponseType = "SUBSCRIPTION"
	ContractProductListResponseTypeComposite    ContractProductListResponseType = "COMPOSITE"
	ContractProductListResponseTypeFixed        ContractProductListResponseType = "FIXED"
	ContractProductListResponseTypeProService   ContractProductListResponseType = "PRO_SERVICE"
)

func (ContractProductListResponseType) IsKnown

type ContractProductListResponseUpdate

type ContractProductListResponseUpdate 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.
	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.
	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             contractProductListResponseUpdateJSON `json:"-"`
}

func (*ContractProductListResponseUpdate) UnmarshalJSON

func (r *ContractProductListResponseUpdate) UnmarshalJSON(data []byte) (err error)

type ContractProductNewParams

type ContractProductNewParams struct {
	// displayed on invoices
	Name param.Field[string]                       `json:"name,required"`
	Type param.Field[ContractProductNewParamsType] `json:"type,required"`
	// Required for USAGE products
	BillableMetricID param.Field[string] `json:"billable_metric_id" format:"uuid"`
	// Required for COMPOSITE products
	CompositeProductIDs param.Field[[]string] `json:"composite_product_ids" format:"uuid"`
	// Required for COMPOSITE products
	CompositeTags param.Field[[]string] `json:"composite_tags"`
	// 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.Field[bool] `json:"exclude_free_usage"`
	// This field's availability is dependent on your client's configuration. Defaults
	// to true
	IsRefundable param.Field[bool] `json:"is_refundable"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteInternalItemID param.Field[string] `json:"netsuite_internal_item_id"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteOverageItemID param.Field[string] `json:"netsuite_overage_item_id"`
	// For USAGE products only. Groups usage line items on invoices.
	PresentationGroupKey param.Field[[]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.
	PricingGroupKey param.Field[[]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 param.Field[QuantityConversionParam] `json:"quantity_conversion"`
	// 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 param.Field[QuantityRoundingParam] `json:"quantity_rounding"`
	Tags             param.Field[[]string]              `json:"tags"`
}

func (ContractProductNewParams) MarshalJSON

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

type ContractProductNewParamsType

type ContractProductNewParamsType string
const (
	ContractProductNewParamsTypeFixed               ContractProductNewParamsType = "FIXED"
	ContractProductNewParamsTypeUsage               ContractProductNewParamsType = "USAGE"
	ContractProductNewParamsTypeComposite           ContractProductNewParamsType = "COMPOSITE"
	ContractProductNewParamsTypeSubscription        ContractProductNewParamsType = "SUBSCRIPTION"
	ContractProductNewParamsTypeProfessionalService ContractProductNewParamsType = "PROFESSIONAL_SERVICE"
	ContractProductNewParamsTypeProService          ContractProductNewParamsType = "PRO_SERVICE"
)

func (ContractProductNewParamsType) IsKnown

func (r ContractProductNewParamsType) IsKnown() bool

type ContractProductNewResponse

type ContractProductNewResponse struct {
	Data shared.ID                      `json:"data,required"`
	JSON contractProductNewResponseJSON `json:"-"`
}

func (*ContractProductNewResponse) UnmarshalJSON

func (r *ContractProductNewResponse) UnmarshalJSON(data []byte) (err error)

type ContractProductService

type ContractProductService struct {
	Options []option.RequestOption
}

ContractProductService 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 NewContractProductService method instead.

func NewContractProductService

func NewContractProductService(opts ...option.RequestOption) (r *ContractProductService)

NewContractProductService 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 (*ContractProductService) Archive

Archive a product

func (*ContractProductService) Get

Get a specific product

func (*ContractProductService) List

List products

func (*ContractProductService) ListAutoPaging

List products

func (*ContractProductService) New

Create a new product

func (*ContractProductService) Update

Update a product

type ContractProductUpdateParams

type ContractProductUpdateParams struct {
	// ID of the product to update
	ProductID param.Field[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 param.Field[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.Field[string] `json:"billable_metric_id" format:"uuid"`
	// Available for COMPOSITE products only. If not provided, defaults to product's
	// current composite_product_ids.
	CompositeProductIDs param.Field[[]string] `json:"composite_product_ids" format:"uuid"`
	// Available for COMPOSITE products only. If not provided, defaults to product's
	// current composite_tags.
	CompositeTags param.Field[[]string] `json:"composite_tags"`
	// 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.Field[bool] `json:"exclude_free_usage"`
	// Defaults to product's current refundability status. This field's availability is
	// dependent on your client's configuration.
	IsRefundable param.Field[bool] `json:"is_refundable"`
	// displayed on invoices. If not provided, defaults to product's current name.
	Name param.Field[string] `json:"name"`
	// 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.Field[string] `json:"netsuite_internal_item_id"`
	// 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.Field[string] `json:"netsuite_overage_item_id"`
	// For USAGE products only. Groups usage line items on invoices.
	PresentationGroupKey param.Field[[]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.
	PricingGroupKey param.Field[[]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 param.Field[QuantityConversionParam] `json:"quantity_conversion"`
	// 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 param.Field[QuantityRoundingParam] `json:"quantity_rounding"`
	// If not provided, defaults to product's current tags
	Tags param.Field[[]string] `json:"tags"`
}

func (ContractProductUpdateParams) MarshalJSON

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

type ContractProductUpdateResponse

type ContractProductUpdateResponse struct {
	Data shared.ID                         `json:"data,required"`
	JSON contractProductUpdateResponseJSON `json:"-"`
}

func (*ContractProductUpdateResponse) UnmarshalJSON

func (r *ContractProductUpdateResponse) UnmarshalJSON(data []byte) (err error)

type ContractRateCardGetParams

type ContractRateCardGetParams struct {
	ID shared.IDParam `json:"id,required"`
}

func (ContractRateCardGetParams) MarshalJSON

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

type ContractRateCardGetRateScheduleParams

type ContractRateCardGetRateScheduleParams struct {
	// ID of the rate card to get the schedule for
	RateCardID param.Field[string] `json:"rate_card_id,required" format:"uuid"`
	// inclusive starting point for the rates schedule
	StartingAt param.Field[time.Time] `json:"starting_at,required" format:"date-time"`
	// Max number of results that should be returned
	Limit param.Field[int64] `query:"limit"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
	// optional exclusive end date for the rates schedule. When not specified rates
	// will show all future schedule segments.
	EndingBefore param.Field[time.Time] `json:"ending_before" 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 param.Field[[]ContractRateCardGetRateScheduleParamsSelector] `json:"selectors"`
}

func (ContractRateCardGetRateScheduleParams) MarshalJSON

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

func (ContractRateCardGetRateScheduleParams) URLQuery

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

type ContractRateCardGetRateScheduleParamsSelector

type ContractRateCardGetRateScheduleParamsSelector struct {
	// List of pricing group key value pairs, rates containing the matching key / value
	// pairs will be included in the response.
	PartialPricingGroupValues param.Field[map[string]string] `json:"partial_pricing_group_values"`
	// List of pricing group key value pairs, rates matching all of the key / value
	// pairs will be included in the response.
	PricingGroupValues param.Field[map[string]string] `json:"pricing_group_values"`
	// Rates matching the product id will be included in the response.
	ProductID param.Field[string] `json:"product_id" format:"uuid"`
}

func (ContractRateCardGetRateScheduleParamsSelector) MarshalJSON

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

type ContractRateCardGetRateScheduleResponse

type ContractRateCardGetRateScheduleResponse struct {
	Data     []ContractRateCardGetRateScheduleResponseData `json:"data,required"`
	NextPage string                                        `json:"next_page,nullable"`
	JSON     contractRateCardGetRateScheduleResponseJSON   `json:"-"`
}

func (*ContractRateCardGetRateScheduleResponse) UnmarshalJSON

func (r *ContractRateCardGetRateScheduleResponse) UnmarshalJSON(data []byte) (err error)

type ContractRateCardGetRateScheduleResponseData

type ContractRateCardGetRateScheduleResponseData struct {
	Entitled           bool                                            `json:"entitled,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"`
	EndingBefore       time.Time                                       `json:"ending_before" format:"date-time"`
	PricingGroupValues map[string]string                               `json:"pricing_group_values"`
	JSON               contractRateCardGetRateScheduleResponseDataJSON `json:"-"`
}

func (*ContractRateCardGetRateScheduleResponseData) UnmarshalJSON

func (r *ContractRateCardGetRateScheduleResponseData) UnmarshalJSON(data []byte) (err error)

type ContractRateCardGetResponse

type ContractRateCardGetResponse struct {
	Data ContractRateCardGetResponseData `json:"data,required"`
	JSON contractRateCardGetResponseJSON `json:"-"`
}

func (*ContractRateCardGetResponse) UnmarshalJSON

func (r *ContractRateCardGetResponse) UnmarshalJSON(data []byte) (err error)

type ContractRateCardGetResponseData

type ContractRateCardGetResponseData 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"`
	RateCardEntries       map[string]ContractRateCardGetResponseDataRateCardEntry `json:"rate_card_entries,required"`
	Aliases               []ContractRateCardGetResponseDataAlias                  `json:"aliases"`
	CreditTypeConversions []ContractRateCardGetResponseDataCreditTypeConversion   `json:"credit_type_conversions"`
	CustomFields          map[string]string                                       `json:"custom_fields"`
	Description           string                                                  `json:"description"`
	FiatCreditType        shared.CreditType                                       `json:"fiat_credit_type"`
	JSON                  contractRateCardGetResponseDataJSON                     `json:"-"`
}

func (*ContractRateCardGetResponseData) UnmarshalJSON

func (r *ContractRateCardGetResponseData) UnmarshalJSON(data []byte) (err error)

type ContractRateCardGetResponseDataAlias

type ContractRateCardGetResponseDataAlias 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         contractRateCardGetResponseDataAliasJSON `json:"-"`
}

func (*ContractRateCardGetResponseDataAlias) UnmarshalJSON

func (r *ContractRateCardGetResponseDataAlias) UnmarshalJSON(data []byte) (err error)

type ContractRateCardGetResponseDataCreditTypeConversion

type ContractRateCardGetResponseDataCreditTypeConversion struct {
	CustomCreditType    shared.CreditType                                       `json:"custom_credit_type,required"`
	FiatPerCustomCredit string                                                  `json:"fiat_per_custom_credit,required"`
	JSON                contractRateCardGetResponseDataCreditTypeConversionJSON `json:"-"`
}

func (*ContractRateCardGetResponseDataCreditTypeConversion) UnmarshalJSON

func (r *ContractRateCardGetResponseDataCreditTypeConversion) UnmarshalJSON(data []byte) (err error)

type ContractRateCardGetResponseDataRateCardEntriesCurrent

type ContractRateCardGetResponseDataRateCardEntriesCurrent struct {
	ID           string                                                        `json:"id" format:"uuid"`
	CreatedAt    time.Time                                                     `json:"created_at" format:"date-time"`
	CreatedBy    string                                                        `json:"created_by"`
	CreditType   shared.CreditType                                             `json:"credit_type"`
	CustomRate   map[string]interface{}                                        `json:"custom_rate"`
	EndingBefore time.Time                                                     `json:"ending_before" format:"date-time"`
	Entitled     bool                                                          `json:"entitled"`
	Price        float64                                                       `json:"price"`
	ProductID    string                                                        `json:"product_id" format:"uuid"`
	RateType     ContractRateCardGetResponseDataRateCardEntriesCurrentRateType `json:"rate_type"`
	StartingAt   time.Time                                                     `json:"starting_at" format:"date-time"`
	Tiers        []shared.Tier                                                 `json:"tiers"`
	JSON         contractRateCardGetResponseDataRateCardEntriesCurrentJSON     `json:"-"`
}

func (*ContractRateCardGetResponseDataRateCardEntriesCurrent) UnmarshalJSON

func (r *ContractRateCardGetResponseDataRateCardEntriesCurrent) UnmarshalJSON(data []byte) (err error)

type ContractRateCardGetResponseDataRateCardEntriesCurrentRateType

type ContractRateCardGetResponseDataRateCardEntriesCurrentRateType string
const (
	ContractRateCardGetResponseDataRateCardEntriesCurrentRateTypeFlat         ContractRateCardGetResponseDataRateCardEntriesCurrentRateType = "FLAT"
	ContractRateCardGetResponseDataRateCardEntriesCurrentRateTypePercentage   ContractRateCardGetResponseDataRateCardEntriesCurrentRateType = "PERCENTAGE"
	ContractRateCardGetResponseDataRateCardEntriesCurrentRateTypeSubscription ContractRateCardGetResponseDataRateCardEntriesCurrentRateType = "SUBSCRIPTION"
	ContractRateCardGetResponseDataRateCardEntriesCurrentRateTypeCustom       ContractRateCardGetResponseDataRateCardEntriesCurrentRateType = "CUSTOM"
	ContractRateCardGetResponseDataRateCardEntriesCurrentRateTypeTiered       ContractRateCardGetResponseDataRateCardEntriesCurrentRateType = "TIERED"
)

func (ContractRateCardGetResponseDataRateCardEntriesCurrentRateType) IsKnown

type ContractRateCardGetResponseDataRateCardEntriesUpdate

type ContractRateCardGetResponseDataRateCardEntriesUpdate struct {
	ID           string                                                        `json:"id,required" format:"uuid"`
	CreatedAt    time.Time                                                     `json:"created_at,required" format:"date-time"`
	CreatedBy    string                                                        `json:"created_by,required"`
	Entitled     bool                                                          `json:"entitled,required"`
	ProductID    string                                                        `json:"product_id,required" format:"uuid"`
	RateType     ContractRateCardGetResponseDataRateCardEntriesUpdatesRateType `json:"rate_type,required"`
	StartingAt   time.Time                                                     `json:"starting_at,required" format:"date-time"`
	CreditType   shared.CreditType                                             `json:"credit_type"`
	CustomRate   map[string]interface{}                                        `json:"custom_rate"`
	EndingBefore time.Time                                                     `json:"ending_before" format:"date-time"`
	IsProrated   bool                                                          `json:"is_prorated"`
	Price        float64                                                       `json:"price"`
	Quantity     float64                                                       `json:"quantity"`
	Tiers        []shared.Tier                                                 `json:"tiers"`
	JSON         contractRateCardGetResponseDataRateCardEntriesUpdateJSON      `json:"-"`
}

func (*ContractRateCardGetResponseDataRateCardEntriesUpdate) UnmarshalJSON

func (r *ContractRateCardGetResponseDataRateCardEntriesUpdate) UnmarshalJSON(data []byte) (err error)

type ContractRateCardGetResponseDataRateCardEntriesUpdatesRateType

type ContractRateCardGetResponseDataRateCardEntriesUpdatesRateType string
const (
	ContractRateCardGetResponseDataRateCardEntriesUpdatesRateTypeFlat         ContractRateCardGetResponseDataRateCardEntriesUpdatesRateType = "FLAT"
	ContractRateCardGetResponseDataRateCardEntriesUpdatesRateTypePercentage   ContractRateCardGetResponseDataRateCardEntriesUpdatesRateType = "PERCENTAGE"
	ContractRateCardGetResponseDataRateCardEntriesUpdatesRateTypeSubscription ContractRateCardGetResponseDataRateCardEntriesUpdatesRateType = "SUBSCRIPTION"
	ContractRateCardGetResponseDataRateCardEntriesUpdatesRateTypeCustom       ContractRateCardGetResponseDataRateCardEntriesUpdatesRateType = "CUSTOM"
	ContractRateCardGetResponseDataRateCardEntriesUpdatesRateTypeTiered       ContractRateCardGetResponseDataRateCardEntriesUpdatesRateType = "TIERED"
)

func (ContractRateCardGetResponseDataRateCardEntriesUpdatesRateType) IsKnown

type ContractRateCardGetResponseDataRateCardEntry

type ContractRateCardGetResponseDataRateCardEntry struct {
	Current ContractRateCardGetResponseDataRateCardEntriesCurrent  `json:"current,nullable"`
	Updates []ContractRateCardGetResponseDataRateCardEntriesUpdate `json:"updates"`
	JSON    contractRateCardGetResponseDataRateCardEntryJSON       `json:"-"`
}

func (*ContractRateCardGetResponseDataRateCardEntry) UnmarshalJSON

func (r *ContractRateCardGetResponseDataRateCardEntry) UnmarshalJSON(data []byte) (err error)

type ContractRateCardListParams

type ContractRateCardListParams struct {
	Body interface{} `json:"body,required"`
	// Max number of results that should be returned
	Limit param.Field[int64] `query:"limit"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
}

func (ContractRateCardListParams) MarshalJSON

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

func (ContractRateCardListParams) URLQuery

func (r ContractRateCardListParams) URLQuery() (v url.Values)

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

type ContractRateCardListResponse

type ContractRateCardListResponse 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"`
	RateCardEntries       map[string]ContractRateCardListResponseRateCardEntry `json:"rate_card_entries,required"`
	Aliases               []ContractRateCardListResponseAlias                  `json:"aliases"`
	CreditTypeConversions []ContractRateCardListResponseCreditTypeConversion   `json:"credit_type_conversions"`
	CustomFields          map[string]string                                    `json:"custom_fields"`
	Description           string                                               `json:"description"`
	FiatCreditType        shared.CreditType                                    `json:"fiat_credit_type"`
	JSON                  contractRateCardListResponseJSON                     `json:"-"`
}

func (*ContractRateCardListResponse) UnmarshalJSON

func (r *ContractRateCardListResponse) UnmarshalJSON(data []byte) (err error)

type ContractRateCardListResponseAlias

type ContractRateCardListResponseAlias 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         contractRateCardListResponseAliasJSON `json:"-"`
}

func (*ContractRateCardListResponseAlias) UnmarshalJSON

func (r *ContractRateCardListResponseAlias) UnmarshalJSON(data []byte) (err error)

type ContractRateCardListResponseCreditTypeConversion

type ContractRateCardListResponseCreditTypeConversion struct {
	CustomCreditType    shared.CreditType                                    `json:"custom_credit_type,required"`
	FiatPerCustomCredit string                                               `json:"fiat_per_custom_credit,required"`
	JSON                contractRateCardListResponseCreditTypeConversionJSON `json:"-"`
}

func (*ContractRateCardListResponseCreditTypeConversion) UnmarshalJSON

func (r *ContractRateCardListResponseCreditTypeConversion) UnmarshalJSON(data []byte) (err error)

type ContractRateCardListResponseRateCardEntriesCurrent

type ContractRateCardListResponseRateCardEntriesCurrent struct {
	ID           string                                                     `json:"id" format:"uuid"`
	CreatedAt    time.Time                                                  `json:"created_at" format:"date-time"`
	CreatedBy    string                                                     `json:"created_by"`
	CreditType   shared.CreditType                                          `json:"credit_type"`
	CustomRate   map[string]interface{}                                     `json:"custom_rate"`
	EndingBefore time.Time                                                  `json:"ending_before" format:"date-time"`
	Entitled     bool                                                       `json:"entitled"`
	Price        float64                                                    `json:"price"`
	ProductID    string                                                     `json:"product_id" format:"uuid"`
	RateType     ContractRateCardListResponseRateCardEntriesCurrentRateType `json:"rate_type"`
	StartingAt   time.Time                                                  `json:"starting_at" format:"date-time"`
	Tiers        []shared.Tier                                              `json:"tiers"`
	JSON         contractRateCardListResponseRateCardEntriesCurrentJSON     `json:"-"`
}

func (*ContractRateCardListResponseRateCardEntriesCurrent) UnmarshalJSON

func (r *ContractRateCardListResponseRateCardEntriesCurrent) UnmarshalJSON(data []byte) (err error)

type ContractRateCardListResponseRateCardEntriesCurrentRateType

type ContractRateCardListResponseRateCardEntriesCurrentRateType string
const (
	ContractRateCardListResponseRateCardEntriesCurrentRateTypeFlat         ContractRateCardListResponseRateCardEntriesCurrentRateType = "FLAT"
	ContractRateCardListResponseRateCardEntriesCurrentRateTypePercentage   ContractRateCardListResponseRateCardEntriesCurrentRateType = "PERCENTAGE"
	ContractRateCardListResponseRateCardEntriesCurrentRateTypeSubscription ContractRateCardListResponseRateCardEntriesCurrentRateType = "SUBSCRIPTION"
	ContractRateCardListResponseRateCardEntriesCurrentRateTypeCustom       ContractRateCardListResponseRateCardEntriesCurrentRateType = "CUSTOM"
	ContractRateCardListResponseRateCardEntriesCurrentRateTypeTiered       ContractRateCardListResponseRateCardEntriesCurrentRateType = "TIERED"
)

func (ContractRateCardListResponseRateCardEntriesCurrentRateType) IsKnown

type ContractRateCardListResponseRateCardEntriesUpdate

type ContractRateCardListResponseRateCardEntriesUpdate struct {
	ID           string                                                     `json:"id,required" format:"uuid"`
	CreatedAt    time.Time                                                  `json:"created_at,required" format:"date-time"`
	CreatedBy    string                                                     `json:"created_by,required"`
	Entitled     bool                                                       `json:"entitled,required"`
	ProductID    string                                                     `json:"product_id,required" format:"uuid"`
	RateType     ContractRateCardListResponseRateCardEntriesUpdatesRateType `json:"rate_type,required"`
	StartingAt   time.Time                                                  `json:"starting_at,required" format:"date-time"`
	CreditType   shared.CreditType                                          `json:"credit_type"`
	CustomRate   map[string]interface{}                                     `json:"custom_rate"`
	EndingBefore time.Time                                                  `json:"ending_before" format:"date-time"`
	IsProrated   bool                                                       `json:"is_prorated"`
	Price        float64                                                    `json:"price"`
	Quantity     float64                                                    `json:"quantity"`
	Tiers        []shared.Tier                                              `json:"tiers"`
	JSON         contractRateCardListResponseRateCardEntriesUpdateJSON      `json:"-"`
}

func (*ContractRateCardListResponseRateCardEntriesUpdate) UnmarshalJSON

func (r *ContractRateCardListResponseRateCardEntriesUpdate) UnmarshalJSON(data []byte) (err error)

type ContractRateCardListResponseRateCardEntriesUpdatesRateType

type ContractRateCardListResponseRateCardEntriesUpdatesRateType string
const (
	ContractRateCardListResponseRateCardEntriesUpdatesRateTypeFlat         ContractRateCardListResponseRateCardEntriesUpdatesRateType = "FLAT"
	ContractRateCardListResponseRateCardEntriesUpdatesRateTypePercentage   ContractRateCardListResponseRateCardEntriesUpdatesRateType = "PERCENTAGE"
	ContractRateCardListResponseRateCardEntriesUpdatesRateTypeSubscription ContractRateCardListResponseRateCardEntriesUpdatesRateType = "SUBSCRIPTION"
	ContractRateCardListResponseRateCardEntriesUpdatesRateTypeCustom       ContractRateCardListResponseRateCardEntriesUpdatesRateType = "CUSTOM"
	ContractRateCardListResponseRateCardEntriesUpdatesRateTypeTiered       ContractRateCardListResponseRateCardEntriesUpdatesRateType = "TIERED"
)

func (ContractRateCardListResponseRateCardEntriesUpdatesRateType) IsKnown

type ContractRateCardListResponseRateCardEntry

type ContractRateCardListResponseRateCardEntry struct {
	Current ContractRateCardListResponseRateCardEntriesCurrent  `json:"current,nullable"`
	Updates []ContractRateCardListResponseRateCardEntriesUpdate `json:"updates"`
	JSON    contractRateCardListResponseRateCardEntryJSON       `json:"-"`
}

func (*ContractRateCardListResponseRateCardEntry) UnmarshalJSON

func (r *ContractRateCardListResponseRateCardEntry) UnmarshalJSON(data []byte) (err error)

type ContractRateCardNamedScheduleGetParams

type ContractRateCardNamedScheduleGetParams struct {
	// ID of the contract whose named schedule is to be retrieved
	ContractID param.Field[string] `json:"contract_id,required" format:"uuid"`
	// ID of the customer whose named schedule is to be retrieved
	CustomerID param.Field[string] `json:"customer_id,required" format:"uuid"`
	// The identifier for the schedule to be retrieved
	ScheduleName param.Field[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.Field[time.Time] `json:"covering_date" format:"date-time"`
}

func (ContractRateCardNamedScheduleGetParams) MarshalJSON

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

type ContractRateCardNamedScheduleGetResponse

type ContractRateCardNamedScheduleGetResponse struct {
	Data []ContractRateCardNamedScheduleGetResponseData `json:"data,required"`
	JSON contractRateCardNamedScheduleGetResponseJSON   `json:"-"`
}

func (*ContractRateCardNamedScheduleGetResponse) UnmarshalJSON

func (r *ContractRateCardNamedScheduleGetResponse) UnmarshalJSON(data []byte) (err error)

type ContractRateCardNamedScheduleGetResponseData

type ContractRateCardNamedScheduleGetResponseData struct {
	StartingAt   time.Time                                        `json:"starting_at,required" format:"date-time"`
	Value        interface{}                                      `json:"value,required"`
	EndingBefore time.Time                                        `json:"ending_before" format:"date-time"`
	JSON         contractRateCardNamedScheduleGetResponseDataJSON `json:"-"`
}

func (*ContractRateCardNamedScheduleGetResponseData) UnmarshalJSON

func (r *ContractRateCardNamedScheduleGetResponseData) UnmarshalJSON(data []byte) (err error)

type ContractRateCardNamedScheduleService

type ContractRateCardNamedScheduleService struct {
	Options []option.RequestOption
}

ContractRateCardNamedScheduleService 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 NewContractRateCardNamedScheduleService method instead.

func NewContractRateCardNamedScheduleService

func NewContractRateCardNamedScheduleService(opts ...option.RequestOption) (r *ContractRateCardNamedScheduleService)

NewContractRateCardNamedScheduleService 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 (*ContractRateCardNamedScheduleService) Get

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

func (*ContractRateCardNamedScheduleService) Update

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

type ContractRateCardNamedScheduleUpdateParams

type ContractRateCardNamedScheduleUpdateParams struct {
	// ID of the contract whose named schedule is to be updated
	ContractID param.Field[string] `json:"contract_id,required" format:"uuid"`
	// ID of the customer whose named schedule is to be updated
	CustomerID param.Field[string] `json:"customer_id,required" format:"uuid"`
	// The identifier for the schedule to be updated
	ScheduleName param.Field[string]    `json:"schedule_name,required"`
	StartingAt   param.Field[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        param.Field[interface{}] `json:"value,required"`
	EndingBefore param.Field[time.Time]   `json:"ending_before" format:"date-time"`
}

func (ContractRateCardNamedScheduleUpdateParams) MarshalJSON

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

type ContractRateCardNewParams

type ContractRateCardNewParams struct {
	// Used only in UI/API. It is not exposed to end customers.
	Name param.Field[string] `json:"name,required"`
	// 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 param.Field[[]ContractRateCardNewParamsAlias] `json:"aliases"`
	// Required when using custom pricing units in rates.
	CreditTypeConversions param.Field[[]ContractRateCardNewParamsCreditTypeConversion] `json:"credit_type_conversions"`
	CustomFields          param.Field[map[string]string]                               `json:"custom_fields"`
	Description           param.Field[string]                                          `json:"description"`
	// "The Metronome ID of the credit type to associate with the rate card, defaults
	// to USD (cents) if not passed."
	FiatCreditTypeID param.Field[string] `json:"fiat_credit_type_id" format:"uuid"`
}

func (ContractRateCardNewParams) MarshalJSON

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

type ContractRateCardNewParamsAlias

type ContractRateCardNewParamsAlias struct {
	Name         param.Field[string]    `json:"name,required"`
	EndingBefore param.Field[time.Time] `json:"ending_before" format:"date-time"`
	StartingAt   param.Field[time.Time] `json:"starting_at" format:"date-time"`
}

func (ContractRateCardNewParamsAlias) MarshalJSON

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

type ContractRateCardNewParamsCreditTypeConversion

type ContractRateCardNewParamsCreditTypeConversion struct {
	CustomCreditTypeID  param.Field[string]  `json:"custom_credit_type_id,required" format:"uuid"`
	FiatPerCustomCredit param.Field[float64] `json:"fiat_per_custom_credit,required"`
}

func (ContractRateCardNewParamsCreditTypeConversion) MarshalJSON

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

type ContractRateCardNewResponse

type ContractRateCardNewResponse struct {
	Data shared.ID                       `json:"data,required"`
	JSON contractRateCardNewResponseJSON `json:"-"`
}

func (*ContractRateCardNewResponse) UnmarshalJSON

func (r *ContractRateCardNewResponse) UnmarshalJSON(data []byte) (err error)

type ContractRateCardProductOrderService

type ContractRateCardProductOrderService struct {
	Options []option.RequestOption
}

ContractRateCardProductOrderService 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 NewContractRateCardProductOrderService method instead.

func NewContractRateCardProductOrderService

func NewContractRateCardProductOrderService(opts ...option.RequestOption) (r *ContractRateCardProductOrderService)

NewContractRateCardProductOrderService 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 (*ContractRateCardProductOrderService) Set

Sets the ordering of products within a rate card

func (*ContractRateCardProductOrderService) Update

Updates ordering of specified products

type ContractRateCardProductOrderSetParams

type ContractRateCardProductOrderSetParams struct {
	ProductOrder param.Field[[]string] `json:"product_order,required" format:"uuid"`
	// ID of the rate card to update
	RateCardID param.Field[string] `json:"rate_card_id,required" format:"uuid"`
}

func (ContractRateCardProductOrderSetParams) MarshalJSON

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

type ContractRateCardProductOrderSetResponse

type ContractRateCardProductOrderSetResponse struct {
	Data shared.ID                                   `json:"data,required"`
	JSON contractRateCardProductOrderSetResponseJSON `json:"-"`
}

func (*ContractRateCardProductOrderSetResponse) UnmarshalJSON

func (r *ContractRateCardProductOrderSetResponse) UnmarshalJSON(data []byte) (err error)

type ContractRateCardProductOrderUpdateParams

type ContractRateCardProductOrderUpdateParams struct {
	ProductMoves param.Field[[]ContractRateCardProductOrderUpdateParamsProductMove] `json:"product_moves,required"`
	// ID of the rate card to update
	RateCardID param.Field[string] `json:"rate_card_id,required" format:"uuid"`
}

func (ContractRateCardProductOrderUpdateParams) MarshalJSON

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

type ContractRateCardProductOrderUpdateParamsProductMove

type ContractRateCardProductOrderUpdateParamsProductMove struct {
	// 0-based index of the new position of the product
	Position param.Field[float64] `json:"position,required"`
	// ID of the product to move
	ProductID param.Field[string] `json:"product_id,required" format:"uuid"`
}

func (ContractRateCardProductOrderUpdateParamsProductMove) MarshalJSON

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

type ContractRateCardProductOrderUpdateResponse

type ContractRateCardProductOrderUpdateResponse struct {
	Data shared.ID                                      `json:"data,required"`
	JSON contractRateCardProductOrderUpdateResponseJSON `json:"-"`
}

func (*ContractRateCardProductOrderUpdateResponse) UnmarshalJSON

func (r *ContractRateCardProductOrderUpdateResponse) UnmarshalJSON(data []byte) (err error)

type ContractRateCardRateAddManyParams

type ContractRateCardRateAddManyParams struct {
	RateCardID param.Field[string]                                  `json:"rate_card_id" format:"uuid"`
	Rates      param.Field[[]ContractRateCardRateAddManyParamsRate] `json:"rates"`
}

func (ContractRateCardRateAddManyParams) MarshalJSON

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

type ContractRateCardRateAddManyParamsRate

type ContractRateCardRateAddManyParamsRate struct {
	Entitled param.Field[bool] `json:"entitled,required"`
	// ID of the product to add a rate for
	ProductID param.Field[string]                                         `json:"product_id,required" format:"uuid"`
	RateType  param.Field[ContractRateCardRateAddManyParamsRatesRateType] `json:"rate_type,required"`
	// inclusive effective date
	StartingAt param.Field[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.Field[string] `json:"credit_type_id" format:"uuid"`
	// Only set for CUSTOM rate_type. This field is interpreted by custom rate
	// processors.
	CustomRate param.Field[map[string]interface{}] `json:"custom_rate"`
	// exclusive end date
	EndingBefore param.Field[time.Time] `json:"ending_before" format:"date-time"`
	// Default proration configuration. Only valid for SUBSCRIPTION rate_type.
	IsProrated param.Field[bool] `json:"is_prorated"`
	// 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.Field[float64] `json:"price"`
	// Optional. List of pricing group key value pairs which will be used to calculate
	// the price.
	PricingGroupValues param.Field[map[string]string] `json:"pricing_group_values"`
	// Default quantity. For SUBSCRIPTION rate_type, this must be >=0.
	Quantity param.Field[float64] `json:"quantity"`
	// Only set for TIERED rate_type.
	Tiers param.Field[[]shared.TierParam] `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 param.Field[bool] `json:"use_list_prices"`
}

func (ContractRateCardRateAddManyParamsRate) MarshalJSON

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

type ContractRateCardRateAddManyParamsRatesRateType

type ContractRateCardRateAddManyParamsRatesRateType string
const (
	ContractRateCardRateAddManyParamsRatesRateTypeFlat         ContractRateCardRateAddManyParamsRatesRateType = "FLAT"
	ContractRateCardRateAddManyParamsRatesRateTypePercentage   ContractRateCardRateAddManyParamsRatesRateType = "PERCENTAGE"
	ContractRateCardRateAddManyParamsRatesRateTypeSubscription ContractRateCardRateAddManyParamsRatesRateType = "SUBSCRIPTION"
	ContractRateCardRateAddManyParamsRatesRateTypeTiered       ContractRateCardRateAddManyParamsRatesRateType = "TIERED"
	ContractRateCardRateAddManyParamsRatesRateTypeCustom       ContractRateCardRateAddManyParamsRatesRateType = "CUSTOM"
)

func (ContractRateCardRateAddManyParamsRatesRateType) IsKnown

type ContractRateCardRateAddManyResponse

type ContractRateCardRateAddManyResponse struct {
	// The ID of the rate card to which the rates were added.
	Data shared.ID                               `json:"data,required"`
	JSON contractRateCardRateAddManyResponseJSON `json:"-"`
}

func (*ContractRateCardRateAddManyResponse) UnmarshalJSON

func (r *ContractRateCardRateAddManyResponse) UnmarshalJSON(data []byte) (err error)

type ContractRateCardRateAddParams

type ContractRateCardRateAddParams struct {
	Entitled param.Field[bool] `json:"entitled,required"`
	// ID of the product to add a rate for
	ProductID param.Field[string] `json:"product_id,required" format:"uuid"`
	// ID of the rate card to update
	RateCardID param.Field[string]                                `json:"rate_card_id,required" format:"uuid"`
	RateType   param.Field[ContractRateCardRateAddParamsRateType] `json:"rate_type,required"`
	// inclusive effective date
	StartingAt param.Field[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.Field[string] `json:"credit_type_id" format:"uuid"`
	// Only set for CUSTOM rate_type. This field is interpreted by custom rate
	// processors.
	CustomRate param.Field[map[string]interface{}] `json:"custom_rate"`
	// exclusive end date
	EndingBefore param.Field[time.Time] `json:"ending_before" format:"date-time"`
	// Default proration configuration. Only valid for SUBSCRIPTION rate_type.
	IsProrated param.Field[bool] `json:"is_prorated"`
	// 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.Field[float64] `json:"price"`
	// Optional. List of pricing group key value pairs which will be used to calculate
	// the price.
	PricingGroupValues param.Field[map[string]string] `json:"pricing_group_values"`
	// Default quantity. For SUBSCRIPTION rate_type, this must be >=0.
	Quantity param.Field[float64] `json:"quantity"`
	// Only set for TIERED rate_type.
	Tiers param.Field[[]shared.TierParam] `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 param.Field[bool] `json:"use_list_prices"`
}

func (ContractRateCardRateAddParams) MarshalJSON

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

type ContractRateCardRateAddParamsRateType

type ContractRateCardRateAddParamsRateType string
const (
	ContractRateCardRateAddParamsRateTypeFlat         ContractRateCardRateAddParamsRateType = "FLAT"
	ContractRateCardRateAddParamsRateTypePercentage   ContractRateCardRateAddParamsRateType = "PERCENTAGE"
	ContractRateCardRateAddParamsRateTypeSubscription ContractRateCardRateAddParamsRateType = "SUBSCRIPTION"
	ContractRateCardRateAddParamsRateTypeTiered       ContractRateCardRateAddParamsRateType = "TIERED"
	ContractRateCardRateAddParamsRateTypeCustom       ContractRateCardRateAddParamsRateType = "CUSTOM"
)

func (ContractRateCardRateAddParamsRateType) IsKnown

type ContractRateCardRateAddResponse

type ContractRateCardRateAddResponse struct {
	Data shared.Rate                         `json:"data,required"`
	JSON contractRateCardRateAddResponseJSON `json:"-"`
}

func (*ContractRateCardRateAddResponse) UnmarshalJSON

func (r *ContractRateCardRateAddResponse) UnmarshalJSON(data []byte) (err error)

type ContractRateCardRateListParams

type ContractRateCardRateListParams struct {
	// inclusive starting point for the rates schedule
	At param.Field[time.Time] `json:"at,required" format:"date-time"`
	// ID of the rate card to get the schedule for
	RateCardID param.Field[string] `json:"rate_card_id,required" format:"uuid"`
	// Max number of results that should be returned
	Limit param.Field[int64] `query:"limit"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
	// 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 param.Field[[]ContractRateCardRateListParamsSelector] `json:"selectors"`
}

func (ContractRateCardRateListParams) MarshalJSON

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

func (ContractRateCardRateListParams) URLQuery

func (r ContractRateCardRateListParams) URLQuery() (v url.Values)

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

type ContractRateCardRateListParamsSelector

type ContractRateCardRateListParamsSelector struct {
	// List of pricing group key value pairs, rates containing the matching key / value
	// pairs will be included in the response.
	PartialPricingGroupValues param.Field[map[string]string] `json:"partial_pricing_group_values"`
	// List of pricing group key value pairs, rates matching all of the key / value
	// pairs will be included in the response.
	PricingGroupValues param.Field[map[string]string] `json:"pricing_group_values"`
	// Rates matching the product id will be included in the response.
	ProductID param.Field[string] `json:"product_id" format:"uuid"`
	// List of product tags, rates matching any of the tags will be included in the
	// response.
	ProductTags param.Field[[]string] `json:"product_tags"`
}

func (ContractRateCardRateListParamsSelector) MarshalJSON

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

type ContractRateCardRateListResponse

type ContractRateCardRateListResponse struct {
	Entitled           bool                                 `json:"entitled,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"`
	EndingBefore       time.Time                            `json:"ending_before" format:"date-time"`
	PricingGroupValues map[string]string                    `json:"pricing_group_values"`
	JSON               contractRateCardRateListResponseJSON `json:"-"`
}

func (*ContractRateCardRateListResponse) UnmarshalJSON

func (r *ContractRateCardRateListResponse) UnmarshalJSON(data []byte) (err error)

type ContractRateCardRateService

type ContractRateCardRateService struct {
	Options []option.RequestOption
}

ContractRateCardRateService 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 NewContractRateCardRateService method instead.

func NewContractRateCardRateService

func NewContractRateCardRateService(opts ...option.RequestOption) (r *ContractRateCardRateService)

NewContractRateCardRateService 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 (*ContractRateCardRateService) Add

Add a new rate

func (*ContractRateCardRateService) AddMany

Add new rates

func (*ContractRateCardRateService) List

Get rate card rates for a specific time.

func (*ContractRateCardRateService) ListAutoPaging

Get rate card rates for a specific time.

type ContractRateCardService

type ContractRateCardService struct {
	Options        []option.RequestOption
	ProductOrders  *ContractRateCardProductOrderService
	Rates          *ContractRateCardRateService
	NamedSchedules *ContractRateCardNamedScheduleService
}

ContractRateCardService 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 NewContractRateCardService method instead.

func NewContractRateCardService

func NewContractRateCardService(opts ...option.RequestOption) (r *ContractRateCardService)

NewContractRateCardService 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 (*ContractRateCardService) Get

Get a specific rate card NOTE: Use `/contract-pricing/rate-cards/getRates` to retrieve rate card rates.

func (*ContractRateCardService) GetRateSchedule

Get a specific rate schedule including all rate card entries

func (*ContractRateCardService) List

List rate cards NOTE: Use `/contract-pricing/rate-cards/getRates` to retrieve rate card rates.

func (*ContractRateCardService) ListAutoPaging

List rate cards NOTE: Use `/contract-pricing/rate-cards/getRates` to retrieve rate card rates.

func (*ContractRateCardService) New

Create a new rate card

func (*ContractRateCardService) Update

Update a rate card

type ContractRateCardUpdateParams

type ContractRateCardUpdateParams struct {
	// ID of the rate card to update
	RateCardID param.Field[string] `json:"rate_card_id,required" 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      param.Field[[]ContractRateCardUpdateParamsAlias] `json:"aliases"`
	CustomFields param.Field[map[string]string]                   `json:"custom_fields"`
	Description  param.Field[string]                              `json:"description"`
	// Used only in UI/API. It is not exposed to end customers.
	Name param.Field[string] `json:"name"`
}

func (ContractRateCardUpdateParams) MarshalJSON

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

type ContractRateCardUpdateParamsAlias

type ContractRateCardUpdateParamsAlias struct {
	Name         param.Field[string]    `json:"name,required"`
	EndingBefore param.Field[time.Time] `json:"ending_before" format:"date-time"`
	StartingAt   param.Field[time.Time] `json:"starting_at" format:"date-time"`
}

func (ContractRateCardUpdateParamsAlias) MarshalJSON

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

type ContractRateCardUpdateResponse

type ContractRateCardUpdateResponse struct {
	Data shared.ID                          `json:"data,required"`
	JSON contractRateCardUpdateResponseJSON `json:"-"`
}

func (*ContractRateCardUpdateResponse) UnmarshalJSON

func (r *ContractRateCardUpdateResponse) UnmarshalJSON(data []byte) (err error)

type ContractScheduleProServicesInvoiceParams

type ContractScheduleProServicesInvoiceParams struct {
	ContractID param.Field[string] `json:"contract_id,required" format:"uuid"`
	CustomerID param.Field[string] `json:"customer_id,required" format:"uuid"`
	// The date the invoice is issued
	IssuedAt param.Field[time.Time] `json:"issued_at,required" format:"date-time"`
	// Each line requires an amount or both unit_price and quantity.
	LineItems param.Field[[]ContractScheduleProServicesInvoiceParamsLineItem] `json:"line_items,required"`
	// The end date of the invoice header in Netsuite
	NetsuiteInvoiceHeaderEnd param.Field[time.Time] `json:"netsuite_invoice_header_end" format:"date-time"`
	// The start date of the invoice header in Netsuite
	NetsuiteInvoiceHeaderStart param.Field[time.Time] `json:"netsuite_invoice_header_start" format:"date-time"`
}

func (ContractScheduleProServicesInvoiceParams) MarshalJSON

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

type ContractScheduleProServicesInvoiceParamsLineItem

type ContractScheduleProServicesInvoiceParamsLineItem struct {
	ProfessionalServiceID param.Field[string] `json:"professional_service_id,required" format:"uuid"`
	// If the professional_service_id was added on an amendment, this is required.
	AmendmentID param.Field[string] `json:"amendment_id" format:"uuid"`
	// Amount for the term on the new invoice.
	Amount param.Field[float64] `json:"amount"`
	// For client use.
	Metadata param.Field[string] `json:"metadata"`
	// The end date for the billing period on the invoice.
	NetsuiteInvoiceBillingEnd param.Field[time.Time] `json:"netsuite_invoice_billing_end" format:"date-time"`
	// The start date for the billing period on the invoice.
	NetsuiteInvoiceBillingStart param.Field[time.Time] `json:"netsuite_invoice_billing_start" format:"date-time"`
	// Quantity for the charge. Will be multiplied by unit_price to determine the
	// amount.
	Quantity param.Field[float64] `json:"quantity"`
	// 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.Field[float64] `json:"unit_price"`
}

Describes the line item for a professional service charge on an invoice.

func (ContractScheduleProServicesInvoiceParamsLineItem) MarshalJSON

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

type ContractScheduleProServicesInvoiceResponse

type ContractScheduleProServicesInvoiceResponse struct {
	Data []Invoice                                      `json:"data,required"`
	JSON contractScheduleProServicesInvoiceResponseJSON `json:"-"`
}

func (*ContractScheduleProServicesInvoiceResponse) UnmarshalJSON

func (r *ContractScheduleProServicesInvoiceResponse) UnmarshalJSON(data []byte) (err error)

type ContractService

type ContractService struct {
	Options        []option.RequestOption
	Products       *ContractProductService
	RateCards      *ContractRateCardService
	NamedSchedules *ContractNamedScheduleService
}

ContractService 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 NewContractService method instead.

func NewContractService

func NewContractService(opts ...option.RequestOption) (r *ContractService)

NewContractService 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 (*ContractService) AddManualBalanceEntry

func (r *ContractService) AddManualBalanceEntry(ctx context.Context, body ContractAddManualBalanceEntryParams, opts ...option.RequestOption) (err error)

Add a manual balance entry

func (*ContractService) Amend

Amend a contract

func (*ContractService) Archive

Archive a contract

func (*ContractService) Get

Get a specific contract

func (*ContractService) GetRateSchedule

Get the rate schedule for the rate card on a given contract.

func (*ContractService) List

List all contracts for a customer

func (*ContractService) ListBalances

List balances (commits and credits).

func (*ContractService) New

Create a new contract

func (*ContractService) NewHistoricalInvoices

Creates historical usage invoices for a contract

func (*ContractService) 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 (*ContractService) SetUsageFilter

func (r *ContractService) SetUsageFilter(ctx context.Context, body ContractSetUsageFilterParams, opts ...option.RequestOption) (err error)

Set usage filter for a contract

func (*ContractService) UpdateEndDate

Update the end date of a contract

type ContractSetUsageFilterParams

type ContractSetUsageFilterParams struct {
	ContractID  param.Field[string]    `json:"contract_id,required" format:"uuid"`
	CustomerID  param.Field[string]    `json:"customer_id,required" format:"uuid"`
	GroupKey    param.Field[string]    `json:"group_key,required"`
	GroupValues param.Field[[]string]  `json:"group_values,required"`
	StartingAt  param.Field[time.Time] `json:"starting_at,required" format:"date-time"`
}

func (ContractSetUsageFilterParams) MarshalJSON

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

type ContractUpdateEndDateParams

type ContractUpdateEndDateParams struct {
	// ID of the contract to update
	ContractID param.Field[string] `json:"contract_id,required" format:"uuid"`
	// ID of the customer whose contract is to be updated
	CustomerID param.Field[string] `json:"customer_id,required" format:"uuid"`
	// RFC 3339 timestamp indicating when the contract will end (exclusive). If not
	// provided, the contract will be updated to be open-ended.
	EndingBefore param.Field[time.Time] `json:"ending_before" format:"date-time"`
}

func (ContractUpdateEndDateParams) MarshalJSON

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

type ContractUpdateEndDateResponse

type ContractUpdateEndDateResponse struct {
	Data shared.ID                         `json:"data,required"`
	JSON contractUpdateEndDateResponseJSON `json:"-"`
}

func (*ContractUpdateEndDateResponse) UnmarshalJSON

func (r *ContractUpdateEndDateResponse) UnmarshalJSON(data []byte) (err error)

type ContractWithoutAmendments

type ContractWithoutAmendments = shared.ContractWithoutAmendments

This is an alias to an internal type.

type ContractWithoutAmendmentsResellerRoyaltiesResellerType

type ContractWithoutAmendmentsResellerRoyaltiesResellerType = shared.ContractWithoutAmendmentsResellerRoyaltiesResellerType

This is an alias to an internal type.

type ContractWithoutAmendmentsResellerRoyalty

type ContractWithoutAmendmentsResellerRoyalty = shared.ContractWithoutAmendmentsResellerRoyalty

This is an alias to an internal type.

type ContractWithoutAmendmentsTransition

type ContractWithoutAmendmentsTransition = shared.ContractWithoutAmendmentsTransition

This is an alias to an internal type.

type ContractWithoutAmendmentsTransitionsType

type ContractWithoutAmendmentsTransitionsType = shared.ContractWithoutAmendmentsTransitionsType

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 ContractWithoutAmendmentsUsageStatementScheduleFrequency

type ContractWithoutAmendmentsUsageStatementScheduleFrequency = shared.ContractWithoutAmendmentsUsageStatementScheduleFrequency

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 CreditGrantEditParams

type CreditGrantEditParams struct {
	// the ID of the credit grant
	ID param.Field[string] `json:"id,required" format:"uuid"`
	// the updated credit grant type
	CreditGrantType param.Field[string] `json:"credit_grant_type"`
	// the updated expiration date for the credit grant
	ExpiresAt param.Field[time.Time] `json:"expires_at" format:"date-time"`
	// the updated name for the credit grant
	Name param.Field[string] `json:"name"`
}

func (CreditGrantEditParams) MarshalJSON

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

type CreditGrantEditResponse

type CreditGrantEditResponse struct {
	Data shared.ID                   `json:"data,required"`
	JSON creditGrantEditResponseJSON `json:"-"`
}

func (*CreditGrantEditResponse) UnmarshalJSON

func (r *CreditGrantEditResponse) UnmarshalJSON(data []byte) (err error)

type CreditGrantListCreditTypesParams

type CreditGrantListCreditTypesParams struct {
	// Max number of results that should be returned
	Limit param.Field[int64] `query:"limit"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
}

func (CreditGrantListCreditTypesParams) URLQuery

func (r CreditGrantListCreditTypesParams) URLQuery() (v url.Values)

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

type CreditGrantListCreditTypesResponse

type CreditGrantListCreditTypesResponse struct {
	ID         string                                 `json:"id" format:"uuid"`
	IsCurrency bool                                   `json:"is_currency"`
	Name       string                                 `json:"name"`
	JSON       creditGrantListCreditTypesResponseJSON `json:"-"`
}

func (*CreditGrantListCreditTypesResponse) UnmarshalJSON

func (r *CreditGrantListCreditTypesResponse) UnmarshalJSON(data []byte) (err error)

type CreditGrantListEntriesParams

type CreditGrantListEntriesParams struct {
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
	// A list of Metronome credit type IDs to fetch ledger entries for. If absent,
	// ledger entries for all credit types will be returned.
	CreditTypeIDs param.Field[[]string] `json:"credit_type_ids" format:"uuid"`
	// A list of Metronome customer IDs to fetch ledger entries for. If absent, ledger
	// entries for all customers will be returned.
	CustomerIDs param.Field[[]string] `json:"customer_ids" format:"uuid"`
	// 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.Field[time.Time] `json:"ending_before" format:"date-time"`
	// If supplied, only ledger entries effective at or after this time will be
	// returned.
	StartingOn param.Field[time.Time] `json:"starting_on" format:"date-time"`
}

func (CreditGrantListEntriesParams) MarshalJSON

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

func (CreditGrantListEntriesParams) URLQuery

func (r CreditGrantListEntriesParams) URLQuery() (v url.Values)

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

type CreditGrantListEntriesResponse

type CreditGrantListEntriesResponse struct {
	Data     []CreditGrantListEntriesResponseData `json:"data,required"`
	NextPage string                               `json:"next_page,required,nullable"`
	JSON     creditGrantListEntriesResponseJSON   `json:"-"`
}

func (*CreditGrantListEntriesResponse) UnmarshalJSON

func (r *CreditGrantListEntriesResponse) UnmarshalJSON(data []byte) (err error)

type CreditGrantListEntriesResponseData

type CreditGrantListEntriesResponseData struct {
	CustomerID string                                     `json:"customer_id,required" format:"uuid"`
	Ledgers    []CreditGrantListEntriesResponseDataLedger `json:"ledgers,required"`
	JSON       creditGrantListEntriesResponseDataJSON     `json:"-"`
}

func (*CreditGrantListEntriesResponseData) UnmarshalJSON

func (r *CreditGrantListEntriesResponseData) UnmarshalJSON(data []byte) (err error)

type CreditGrantListEntriesResponseDataLedger

type CreditGrantListEntriesResponseDataLedger struct {
	CreditType shared.CreditType `json:"credit_type,required"`
	// the effective balances at the end of the specified time window
	EndingBalance   CreditGrantListEntriesResponseDataLedgersEndingBalance   `json:"ending_balance,required"`
	Entries         []CreditLedgerEntry                                      `json:"entries,required"`
	PendingEntries  []CreditLedgerEntry                                      `json:"pending_entries,required"`
	StartingBalance CreditGrantListEntriesResponseDataLedgersStartingBalance `json:"starting_balance,required"`
	JSON            creditGrantListEntriesResponseDataLedgerJSON             `json:"-"`
}

func (*CreditGrantListEntriesResponseDataLedger) UnmarshalJSON

func (r *CreditGrantListEntriesResponseDataLedger) UnmarshalJSON(data []byte) (err error)

type CreditGrantListEntriesResponseDataLedgersEndingBalance

type CreditGrantListEntriesResponseDataLedgersEndingBalance 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             creditGrantListEntriesResponseDataLedgersEndingBalanceJSON `json:"-"`
}

the effective balances at the end of the specified time window

func (*CreditGrantListEntriesResponseDataLedgersEndingBalance) UnmarshalJSON

func (r *CreditGrantListEntriesResponseDataLedgersEndingBalance) UnmarshalJSON(data []byte) (err error)

type CreditGrantListEntriesResponseDataLedgersStartingBalance

type CreditGrantListEntriesResponseDataLedgersStartingBalance 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             creditGrantListEntriesResponseDataLedgersStartingBalanceJSON `json:"-"`
}

func (*CreditGrantListEntriesResponseDataLedgersStartingBalance) UnmarshalJSON

type CreditGrantListParams

type CreditGrantListParams struct {
	// Max number of results that should be returned
	Limit param.Field[int64] `query:"limit"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
	// An array of credit grant IDs. If this is specified, neither credit_type_ids nor
	// customer_ids may be specified.
	CreditGrantIDs param.Field[[]string] `json:"credit_grant_ids" format:"uuid"`
	// An array of credit type IDs. This must not be specified if credit_grant_ids is
	// specified.
	CreditTypeIDs param.Field[[]string] `json:"credit_type_ids" format:"uuid"`
	// An array of Metronome customer IDs. This must not be specified if
	// credit_grant_ids is specified.
	CustomerIDs param.Field[[]string] `json:"customer_ids" format:"uuid"`
	// Only return credit grants that are effective before this timestamp (exclusive).
	EffectiveBefore param.Field[time.Time] `json:"effective_before" format:"date-time"`
	// Only return credit grants that expire at or after this timestamp.
	NotExpiringBefore param.Field[time.Time] `json:"not_expiring_before" format:"date-time"`
}

func (CreditGrantListParams) MarshalJSON

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

func (CreditGrantListParams) URLQuery

func (r CreditGrantListParams) URLQuery() (v url.Values)

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

type CreditGrantListResponse

type CreditGrantListResponse 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      CreditGrantListResponseBalance `json:"balance,required"`
	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 CreditGrantListResponseGrantAmount `json:"grant_amount,required"`
	Name        string                             `json:"name,required"`
	// the amount paid for this credit grant
	PaidAmount        CreditGrantListResponsePaidAmount `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 []CreditGrantListResponseProduct `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          creditGrantListResponseJSON `json:"-"`
}

func (*CreditGrantListResponse) UnmarshalJSON

func (r *CreditGrantListResponse) UnmarshalJSON(data []byte) (err error)

type CreditGrantListResponseBalance

type CreditGrantListResponseBalance 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             creditGrantListResponseBalanceJSON `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 (*CreditGrantListResponseBalance) UnmarshalJSON

func (r *CreditGrantListResponseBalance) UnmarshalJSON(data []byte) (err error)

type CreditGrantListResponseGrantAmount

type CreditGrantListResponseGrantAmount struct {
	Amount float64 `json:"amount,required"`
	// the credit type for the amount granted
	CreditType shared.CreditType                      `json:"credit_type,required"`
	JSON       creditGrantListResponseGrantAmountJSON `json:"-"`
}

the amount of credits initially granted

func (*CreditGrantListResponseGrantAmount) UnmarshalJSON

func (r *CreditGrantListResponseGrantAmount) UnmarshalJSON(data []byte) (err error)

type CreditGrantListResponsePaidAmount

type CreditGrantListResponsePaidAmount struct {
	Amount float64 `json:"amount,required"`
	// the credit type for the amount paid
	CreditType shared.CreditType                     `json:"credit_type,required"`
	JSON       creditGrantListResponsePaidAmountJSON `json:"-"`
}

the amount paid for this credit grant

func (*CreditGrantListResponsePaidAmount) UnmarshalJSON

func (r *CreditGrantListResponsePaidAmount) UnmarshalJSON(data []byte) (err error)

type CreditGrantListResponseProduct

type CreditGrantListResponseProduct struct {
	ID   string                             `json:"id,required"`
	Name string                             `json:"name,required"`
	JSON creditGrantListResponseProductJSON `json:"-"`
}

func (*CreditGrantListResponseProduct) UnmarshalJSON

func (r *CreditGrantListResponseProduct) UnmarshalJSON(data []byte) (err error)

type CreditGrantNewParams

type CreditGrantNewParams struct {
	// the Metronome ID of the customer
	CustomerID param.Field[string] `json:"customer_id,required" format:"uuid"`
	// The credit grant will only apply to billing periods that end before this
	// timestamp.
	ExpiresAt param.Field[time.Time] `json:"expires_at,required" format:"date-time"`
	// the amount of credits granted
	GrantAmount param.Field[CreditGrantNewParamsGrantAmount] `json:"grant_amount,required"`
	// the name of the credit grant as it will appear on invoices
	Name param.Field[string] `json:"name,required"`
	// the amount paid for this credit grant
	PaidAmount      param.Field[CreditGrantNewParamsPaidAmount] `json:"paid_amount,required"`
	Priority        param.Field[float64]                        `json:"priority,required"`
	CreditGrantType param.Field[string]                         `json:"credit_grant_type"`
	// Custom fields to attach to the credit grant.
	CustomFields param.Field[map[string]string] `json:"custom_fields"`
	// The credit grant will only apply to billing periods that end at or after this
	// timestamp.
	EffectiveAt param.Field[time.Time] `json:"effective_at" format:"date-time"`
	// The date to issue an invoice for the paid_amount.
	InvoiceDate param.Field[time.Time] `json:"invoice_date" format:"date-time"`
	// 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 param.Field[[]string] `json:"product_ids" format:"uuid"`
	Reason     param.Field[string]   `json:"reason"`
	// 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 param.Field[CreditGrantNewParamsRolloverSettings] `json:"rollover_settings"`
	// 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.Field[string] `json:"uniqueness_key"`
}

func (CreditGrantNewParams) MarshalJSON

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

type CreditGrantNewParamsGrantAmount

type CreditGrantNewParamsGrantAmount struct {
	Amount       param.Field[float64] `json:"amount,required"`
	CreditTypeID param.Field[string]  `json:"credit_type_id,required" format:"uuid"`
}

the amount of credits granted

func (CreditGrantNewParamsGrantAmount) MarshalJSON

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

type CreditGrantNewParamsPaidAmount

type CreditGrantNewParamsPaidAmount struct {
	Amount       param.Field[float64] `json:"amount,required"`
	CreditTypeID param.Field[string]  `json:"credit_type_id,required" format:"uuid"`
}

the amount paid for this credit grant

func (CreditGrantNewParamsPaidAmount) MarshalJSON

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

type CreditGrantNewParamsRolloverSettings

type CreditGrantNewParamsRolloverSettings struct {
	// The date to expire the rollover credits.
	ExpiresAt param.Field[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 param.Field[float64] `json:"priority,required"`
	// Specify how much to rollover to the rollover credit grant
	RolloverAmount param.Field[CreditGrantNewParamsRolloverSettingsRolloverAmountUnion] `json:"rollover_amount,required"`
}

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.

func (CreditGrantNewParamsRolloverSettings) MarshalJSON

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

type CreditGrantNewParamsRolloverSettingsRolloverAmount

type CreditGrantNewParamsRolloverSettingsRolloverAmount struct {
	// Rollover up to a percentage of the original credit grant amount.
	Type param.Field[CreditGrantNewParamsRolloverSettingsRolloverAmountType] `json:"type,required"`
	// The maximum percentage (0-1) of the original credit grant to rollover.
	Value param.Field[float64] `json:"value,required"`
}

Specify how much to rollover to the rollover credit grant

func (CreditGrantNewParamsRolloverSettingsRolloverAmount) MarshalJSON

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

type CreditGrantNewParamsRolloverSettingsRolloverAmountType

type CreditGrantNewParamsRolloverSettingsRolloverAmountType string

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

const (
	CreditGrantNewParamsRolloverSettingsRolloverAmountTypeMaxPercentage CreditGrantNewParamsRolloverSettingsRolloverAmountType = "MAX_PERCENTAGE"
	CreditGrantNewParamsRolloverSettingsRolloverAmountTypeMaxAmount     CreditGrantNewParamsRolloverSettingsRolloverAmountType = "MAX_AMOUNT"
)

func (CreditGrantNewParamsRolloverSettingsRolloverAmountType) IsKnown

type CreditGrantNewParamsRolloverSettingsRolloverAmountUnion

type CreditGrantNewParamsRolloverSettingsRolloverAmountUnion interface {
	// contains filtered or unexported methods
}

Specify how much to rollover to the rollover credit grant

Satisfied by RolloverAmountMaxPercentageParam, RolloverAmountMaxAmountParam, CreditGrantNewParamsRolloverSettingsRolloverAmount.

type CreditGrantNewResponse

type CreditGrantNewResponse struct {
	Data shared.ID                  `json:"data,required"`
	JSON creditGrantNewResponseJSON `json:"-"`
}

func (*CreditGrantNewResponse) UnmarshalJSON

func (r *CreditGrantNewResponse) UnmarshalJSON(data []byte) (err error)

type CreditGrantService

type CreditGrantService struct {
	Options []option.RequestOption
}

CreditGrantService 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 NewCreditGrantService method instead.

func NewCreditGrantService

func NewCreditGrantService(opts ...option.RequestOption) (r *CreditGrantService)

NewCreditGrantService 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 (*CreditGrantService) Edit

Edit an existing credit grant

func (*CreditGrantService) List

List credit grants. This list does not included voided grants.

func (*CreditGrantService) ListAutoPaging

List credit grants. This list does not included voided grants.

func (*CreditGrantService) ListCreditTypes

List all pricing units (known in the API by the legacy term "credit types").

func (*CreditGrantService) ListCreditTypesAutoPaging

List all pricing units (known in the API by the legacy term "credit types").

func (*CreditGrantService) 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 (*CreditGrantService) New

Create a new credit grant

func (*CreditGrantService) Void

Void a credit grant

type CreditGrantVoidParams

type CreditGrantVoidParams struct {
	ID param.Field[string] `json:"id,required" format:"uuid"`
	// If true, resets the uniqueness key on this grant so it can be re-used
	ReleaseUniquenessKey param.Field[bool] `json:"release_uniqueness_key"`
	// If true, void the purchase invoice associated with the grant
	VoidCreditPurchaseInvoice param.Field[bool] `json:"void_credit_purchase_invoice"`
}

func (CreditGrantVoidParams) MarshalJSON

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

type CreditGrantVoidResponse

type CreditGrantVoidResponse struct {
	Data shared.ID                   `json:"data,required"`
	JSON creditGrantVoidResponseJSON `json:"-"`
}

func (*CreditGrantVoidResponse) UnmarshalJSON

func (r *CreditGrantVoidResponse) UnmarshalJSON(data []byte) (err error)

type CreditLedger

type CreditLedger = shared.CreditLedger

This is an alias to an internal type.

type CreditLedgerCreditAutomatedInvoiceDeductionLedgerEntry

type CreditLedgerCreditAutomatedInvoiceDeductionLedgerEntry = shared.CreditLedgerCreditAutomatedInvoiceDeductionLedgerEntry

This is an alias to an internal type.

type CreditLedgerCreditAutomatedInvoiceDeductionLedgerEntryType

type CreditLedgerCreditAutomatedInvoiceDeductionLedgerEntryType = shared.CreditLedgerCreditAutomatedInvoiceDeductionLedgerEntryType

This is an alias to an internal type.

type CreditLedgerCreditCanceledLedgerEntry

type CreditLedgerCreditCanceledLedgerEntry = shared.CreditLedgerCreditCanceledLedgerEntry

This is an alias to an internal type.

type CreditLedgerCreditCanceledLedgerEntryType

type CreditLedgerCreditCanceledLedgerEntryType = shared.CreditLedgerCreditCanceledLedgerEntryType

This is an alias to an internal type.

type CreditLedgerCreditCreditedLedgerEntry

type CreditLedgerCreditCreditedLedgerEntry = shared.CreditLedgerCreditCreditedLedgerEntry

This is an alias to an internal type.

type CreditLedgerCreditCreditedLedgerEntryType

type CreditLedgerCreditCreditedLedgerEntryType = shared.CreditLedgerCreditCreditedLedgerEntryType

This is an alias to an internal type.

type CreditLedgerCreditExpirationLedgerEntry

type CreditLedgerCreditExpirationLedgerEntry = shared.CreditLedgerCreditExpirationLedgerEntry

This is an alias to an internal type.

type CreditLedgerCreditExpirationLedgerEntryType

type CreditLedgerCreditExpirationLedgerEntryType = shared.CreditLedgerCreditExpirationLedgerEntryType

This is an alias to an internal type.

type CreditLedgerCreditManualLedgerEntry

type CreditLedgerCreditManualLedgerEntry = shared.CreditLedgerCreditManualLedgerEntry

This is an alias to an internal type.

type CreditLedgerCreditManualLedgerEntryType

type CreditLedgerCreditManualLedgerEntryType = shared.CreditLedgerCreditManualLedgerEntryType

This is an alias to an internal type.

type CreditLedgerCreditSegmentStartLedgerEntry

type CreditLedgerCreditSegmentStartLedgerEntry = shared.CreditLedgerCreditSegmentStartLedgerEntry

This is an alias to an internal type.

type CreditLedgerCreditSegmentStartLedgerEntryType

type CreditLedgerCreditSegmentStartLedgerEntryType = shared.CreditLedgerCreditSegmentStartLedgerEntryType

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      creditLedgerEntryJSON `json:"-"`
}

func (*CreditLedgerEntry) UnmarshalJSON

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

type CreditLedgerType

type CreditLedgerType = shared.CreditLedgerType

This is an alias to an internal type.

type CreditProduct

type CreditProduct = shared.CreditProduct

This is an alias to an internal type.

type CreditType

type CreditType = shared.CreditType

This is an alias to an internal type.

type CustomFieldAddKeyParams

type CustomFieldAddKeyParams struct {
	EnforceUniqueness param.Field[bool]                          `json:"enforce_uniqueness,required"`
	Entity            param.Field[CustomFieldAddKeyParamsEntity] `json:"entity,required"`
	Key               param.Field[string]                        `json:"key,required"`
}

func (CustomFieldAddKeyParams) MarshalJSON

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

type CustomFieldAddKeyParamsEntity

type CustomFieldAddKeyParamsEntity string
const (
	CustomFieldAddKeyParamsEntityAlert               CustomFieldAddKeyParamsEntity = "alert"
	CustomFieldAddKeyParamsEntityBillableMetric      CustomFieldAddKeyParamsEntity = "billable_metric"
	CustomFieldAddKeyParamsEntityCharge              CustomFieldAddKeyParamsEntity = "charge"
	CustomFieldAddKeyParamsEntityCommit              CustomFieldAddKeyParamsEntity = "commit"
	CustomFieldAddKeyParamsEntityContractCredit      CustomFieldAddKeyParamsEntity = "contract_credit"
	CustomFieldAddKeyParamsEntityContractProduct     CustomFieldAddKeyParamsEntity = "contract_product"
	CustomFieldAddKeyParamsEntityContract            CustomFieldAddKeyParamsEntity = "contract"
	CustomFieldAddKeyParamsEntityCreditGrant         CustomFieldAddKeyParamsEntity = "credit_grant"
	CustomFieldAddKeyParamsEntityCustomerPlan        CustomFieldAddKeyParamsEntity = "customer_plan"
	CustomFieldAddKeyParamsEntityCustomer            CustomFieldAddKeyParamsEntity = "customer"
	CustomFieldAddKeyParamsEntityInvoice             CustomFieldAddKeyParamsEntity = "invoice"
	CustomFieldAddKeyParamsEntityPlan                CustomFieldAddKeyParamsEntity = "plan"
	CustomFieldAddKeyParamsEntityProfessionalService CustomFieldAddKeyParamsEntity = "professional_service"
	CustomFieldAddKeyParamsEntityProduct             CustomFieldAddKeyParamsEntity = "product"
	CustomFieldAddKeyParamsEntityRateCard            CustomFieldAddKeyParamsEntity = "rate_card"
	CustomFieldAddKeyParamsEntityScheduledCharge     CustomFieldAddKeyParamsEntity = "scheduled_charge"
)

func (CustomFieldAddKeyParamsEntity) IsKnown

func (r CustomFieldAddKeyParamsEntity) IsKnown() bool

type CustomFieldDeleteValuesParams

type CustomFieldDeleteValuesParams struct {
	Entity   param.Field[CustomFieldDeleteValuesParamsEntity] `json:"entity,required"`
	EntityID param.Field[string]                              `json:"entity_id,required" format:"uuid"`
	Keys     param.Field[[]string]                            `json:"keys,required"`
}

func (CustomFieldDeleteValuesParams) MarshalJSON

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

type CustomFieldDeleteValuesParamsEntity

type CustomFieldDeleteValuesParamsEntity string
const (
	CustomFieldDeleteValuesParamsEntityAlert               CustomFieldDeleteValuesParamsEntity = "alert"
	CustomFieldDeleteValuesParamsEntityBillableMetric      CustomFieldDeleteValuesParamsEntity = "billable_metric"
	CustomFieldDeleteValuesParamsEntityCharge              CustomFieldDeleteValuesParamsEntity = "charge"
	CustomFieldDeleteValuesParamsEntityCommit              CustomFieldDeleteValuesParamsEntity = "commit"
	CustomFieldDeleteValuesParamsEntityContractCredit      CustomFieldDeleteValuesParamsEntity = "contract_credit"
	CustomFieldDeleteValuesParamsEntityContractProduct     CustomFieldDeleteValuesParamsEntity = "contract_product"
	CustomFieldDeleteValuesParamsEntityContract            CustomFieldDeleteValuesParamsEntity = "contract"
	CustomFieldDeleteValuesParamsEntityCreditGrant         CustomFieldDeleteValuesParamsEntity = "credit_grant"
	CustomFieldDeleteValuesParamsEntityCustomerPlan        CustomFieldDeleteValuesParamsEntity = "customer_plan"
	CustomFieldDeleteValuesParamsEntityCustomer            CustomFieldDeleteValuesParamsEntity = "customer"
	CustomFieldDeleteValuesParamsEntityInvoice             CustomFieldDeleteValuesParamsEntity = "invoice"
	CustomFieldDeleteValuesParamsEntityPlan                CustomFieldDeleteValuesParamsEntity = "plan"
	CustomFieldDeleteValuesParamsEntityProfessionalService CustomFieldDeleteValuesParamsEntity = "professional_service"
	CustomFieldDeleteValuesParamsEntityProduct             CustomFieldDeleteValuesParamsEntity = "product"
	CustomFieldDeleteValuesParamsEntityRateCard            CustomFieldDeleteValuesParamsEntity = "rate_card"
	CustomFieldDeleteValuesParamsEntityScheduledCharge     CustomFieldDeleteValuesParamsEntity = "scheduled_charge"
)

func (CustomFieldDeleteValuesParamsEntity) IsKnown

type CustomFieldListKeysParams

type CustomFieldListKeysParams struct {
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
	// Optional list of entity types to return keys for
	Entities param.Field[[]CustomFieldListKeysParamsEntity] `json:"entities"`
}

func (CustomFieldListKeysParams) MarshalJSON

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

func (CustomFieldListKeysParams) URLQuery

func (r CustomFieldListKeysParams) URLQuery() (v url.Values)

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

type CustomFieldListKeysParamsEntity

type CustomFieldListKeysParamsEntity string
const (
	CustomFieldListKeysParamsEntityAlert               CustomFieldListKeysParamsEntity = "alert"
	CustomFieldListKeysParamsEntityBillableMetric      CustomFieldListKeysParamsEntity = "billable_metric"
	CustomFieldListKeysParamsEntityCharge              CustomFieldListKeysParamsEntity = "charge"
	CustomFieldListKeysParamsEntityCommit              CustomFieldListKeysParamsEntity = "commit"
	CustomFieldListKeysParamsEntityContractCredit      CustomFieldListKeysParamsEntity = "contract_credit"
	CustomFieldListKeysParamsEntityContractProduct     CustomFieldListKeysParamsEntity = "contract_product"
	CustomFieldListKeysParamsEntityContract            CustomFieldListKeysParamsEntity = "contract"
	CustomFieldListKeysParamsEntityCreditGrant         CustomFieldListKeysParamsEntity = "credit_grant"
	CustomFieldListKeysParamsEntityCustomerPlan        CustomFieldListKeysParamsEntity = "customer_plan"
	CustomFieldListKeysParamsEntityCustomer            CustomFieldListKeysParamsEntity = "customer"
	CustomFieldListKeysParamsEntityInvoice             CustomFieldListKeysParamsEntity = "invoice"
	CustomFieldListKeysParamsEntityPlan                CustomFieldListKeysParamsEntity = "plan"
	CustomFieldListKeysParamsEntityProfessionalService CustomFieldListKeysParamsEntity = "professional_service"
	CustomFieldListKeysParamsEntityProduct             CustomFieldListKeysParamsEntity = "product"
	CustomFieldListKeysParamsEntityRateCard            CustomFieldListKeysParamsEntity = "rate_card"
	CustomFieldListKeysParamsEntityScheduledCharge     CustomFieldListKeysParamsEntity = "scheduled_charge"
)

func (CustomFieldListKeysParamsEntity) IsKnown

type CustomFieldListKeysResponse

type CustomFieldListKeysResponse struct {
	Data     []CustomFieldListKeysResponseData `json:"data,required"`
	NextPage string                            `json:"next_page,required,nullable"`
	JSON     customFieldListKeysResponseJSON   `json:"-"`
}

func (*CustomFieldListKeysResponse) UnmarshalJSON

func (r *CustomFieldListKeysResponse) UnmarshalJSON(data []byte) (err error)

type CustomFieldListKeysResponseData

type CustomFieldListKeysResponseData struct {
	EnforceUniqueness bool                                  `json:"enforce_uniqueness,required"`
	Entity            CustomFieldListKeysResponseDataEntity `json:"entity,required"`
	Key               string                                `json:"key,required"`
	JSON              customFieldListKeysResponseDataJSON   `json:"-"`
}

func (*CustomFieldListKeysResponseData) UnmarshalJSON

func (r *CustomFieldListKeysResponseData) UnmarshalJSON(data []byte) (err error)

type CustomFieldListKeysResponseDataEntity

type CustomFieldListKeysResponseDataEntity string
const (
	CustomFieldListKeysResponseDataEntityAlert               CustomFieldListKeysResponseDataEntity = "alert"
	CustomFieldListKeysResponseDataEntityBillableMetric      CustomFieldListKeysResponseDataEntity = "billable_metric"
	CustomFieldListKeysResponseDataEntityCharge              CustomFieldListKeysResponseDataEntity = "charge"
	CustomFieldListKeysResponseDataEntityCommit              CustomFieldListKeysResponseDataEntity = "commit"
	CustomFieldListKeysResponseDataEntityContractCredit      CustomFieldListKeysResponseDataEntity = "contract_credit"
	CustomFieldListKeysResponseDataEntityContractProduct     CustomFieldListKeysResponseDataEntity = "contract_product"
	CustomFieldListKeysResponseDataEntityContract            CustomFieldListKeysResponseDataEntity = "contract"
	CustomFieldListKeysResponseDataEntityCreditGrant         CustomFieldListKeysResponseDataEntity = "credit_grant"
	CustomFieldListKeysResponseDataEntityCustomerPlan        CustomFieldListKeysResponseDataEntity = "customer_plan"
	CustomFieldListKeysResponseDataEntityCustomer            CustomFieldListKeysResponseDataEntity = "customer"
	CustomFieldListKeysResponseDataEntityInvoice             CustomFieldListKeysResponseDataEntity = "invoice"
	CustomFieldListKeysResponseDataEntityPlan                CustomFieldListKeysResponseDataEntity = "plan"
	CustomFieldListKeysResponseDataEntityProfessionalService CustomFieldListKeysResponseDataEntity = "professional_service"
	CustomFieldListKeysResponseDataEntityProduct             CustomFieldListKeysResponseDataEntity = "product"
	CustomFieldListKeysResponseDataEntityRateCard            CustomFieldListKeysResponseDataEntity = "rate_card"
	CustomFieldListKeysResponseDataEntityScheduledCharge     CustomFieldListKeysResponseDataEntity = "scheduled_charge"
)

func (CustomFieldListKeysResponseDataEntity) IsKnown

type CustomFieldRemoveKeyParams

type CustomFieldRemoveKeyParams struct {
	Entity param.Field[CustomFieldRemoveKeyParamsEntity] `json:"entity,required"`
	Key    param.Field[string]                           `json:"key,required"`
}

func (CustomFieldRemoveKeyParams) MarshalJSON

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

type CustomFieldRemoveKeyParamsEntity

type CustomFieldRemoveKeyParamsEntity string
const (
	CustomFieldRemoveKeyParamsEntityAlert               CustomFieldRemoveKeyParamsEntity = "alert"
	CustomFieldRemoveKeyParamsEntityBillableMetric      CustomFieldRemoveKeyParamsEntity = "billable_metric"
	CustomFieldRemoveKeyParamsEntityCharge              CustomFieldRemoveKeyParamsEntity = "charge"
	CustomFieldRemoveKeyParamsEntityCommit              CustomFieldRemoveKeyParamsEntity = "commit"
	CustomFieldRemoveKeyParamsEntityContractCredit      CustomFieldRemoveKeyParamsEntity = "contract_credit"
	CustomFieldRemoveKeyParamsEntityContractProduct     CustomFieldRemoveKeyParamsEntity = "contract_product"
	CustomFieldRemoveKeyParamsEntityContract            CustomFieldRemoveKeyParamsEntity = "contract"
	CustomFieldRemoveKeyParamsEntityCreditGrant         CustomFieldRemoveKeyParamsEntity = "credit_grant"
	CustomFieldRemoveKeyParamsEntityCustomerPlan        CustomFieldRemoveKeyParamsEntity = "customer_plan"
	CustomFieldRemoveKeyParamsEntityCustomer            CustomFieldRemoveKeyParamsEntity = "customer"
	CustomFieldRemoveKeyParamsEntityInvoice             CustomFieldRemoveKeyParamsEntity = "invoice"
	CustomFieldRemoveKeyParamsEntityPlan                CustomFieldRemoveKeyParamsEntity = "plan"
	CustomFieldRemoveKeyParamsEntityProfessionalService CustomFieldRemoveKeyParamsEntity = "professional_service"
	CustomFieldRemoveKeyParamsEntityProduct             CustomFieldRemoveKeyParamsEntity = "product"
	CustomFieldRemoveKeyParamsEntityRateCard            CustomFieldRemoveKeyParamsEntity = "rate_card"
	CustomFieldRemoveKeyParamsEntityScheduledCharge     CustomFieldRemoveKeyParamsEntity = "scheduled_charge"
)

func (CustomFieldRemoveKeyParamsEntity) IsKnown

type CustomFieldService

type CustomFieldService struct {
	Options []option.RequestOption
}

CustomFieldService 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 NewCustomFieldService method instead.

func NewCustomFieldService

func NewCustomFieldService(opts ...option.RequestOption) (r *CustomFieldService)

NewCustomFieldService 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 (*CustomFieldService) AddKey

Add a key to the allow list for a given entity. There is a 100 character limit on custom field keys.

func (*CustomFieldService) DeleteValues

func (r *CustomFieldService) DeleteValues(ctx context.Context, body CustomFieldDeleteValuesParams, opts ...option.RequestOption) (err error)

Deletes one or more custom fields on an instance of a Metronome entity.

func (*CustomFieldService) ListKeys

List all active custom field keys, optionally filtered by entity type.

func (*CustomFieldService) RemoveKey

Remove a key from the allow list for a given entity.

func (*CustomFieldService) SetValues

Sets one or more custom fields on an instance of a Metronome entity. If a key/value pair passed in this request matches one already set on the entity, its value will be overwritten. Any key/value pairs that exist on the entity that do not match those passed in this request will remain untouched. This endpoint is transactional and will update all key/value pairs or no key/value pairs. Partial updates are not supported. There is a 200 character limit on custom field values.

type CustomFieldSetValuesParams

type CustomFieldSetValuesParams struct {
	CustomFields param.Field[map[string]string]                `json:"custom_fields,required"`
	Entity       param.Field[CustomFieldSetValuesParamsEntity] `json:"entity,required"`
	EntityID     param.Field[string]                           `json:"entity_id,required" format:"uuid"`
}

func (CustomFieldSetValuesParams) MarshalJSON

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

type CustomFieldSetValuesParamsEntity

type CustomFieldSetValuesParamsEntity string
const (
	CustomFieldSetValuesParamsEntityAlert               CustomFieldSetValuesParamsEntity = "alert"
	CustomFieldSetValuesParamsEntityBillableMetric      CustomFieldSetValuesParamsEntity = "billable_metric"
	CustomFieldSetValuesParamsEntityCharge              CustomFieldSetValuesParamsEntity = "charge"
	CustomFieldSetValuesParamsEntityCommit              CustomFieldSetValuesParamsEntity = "commit"
	CustomFieldSetValuesParamsEntityContractCredit      CustomFieldSetValuesParamsEntity = "contract_credit"
	CustomFieldSetValuesParamsEntityContractProduct     CustomFieldSetValuesParamsEntity = "contract_product"
	CustomFieldSetValuesParamsEntityContract            CustomFieldSetValuesParamsEntity = "contract"
	CustomFieldSetValuesParamsEntityCreditGrant         CustomFieldSetValuesParamsEntity = "credit_grant"
	CustomFieldSetValuesParamsEntityCustomerPlan        CustomFieldSetValuesParamsEntity = "customer_plan"
	CustomFieldSetValuesParamsEntityCustomer            CustomFieldSetValuesParamsEntity = "customer"
	CustomFieldSetValuesParamsEntityInvoice             CustomFieldSetValuesParamsEntity = "invoice"
	CustomFieldSetValuesParamsEntityPlan                CustomFieldSetValuesParamsEntity = "plan"
	CustomFieldSetValuesParamsEntityProfessionalService CustomFieldSetValuesParamsEntity = "professional_service"
	CustomFieldSetValuesParamsEntityProduct             CustomFieldSetValuesParamsEntity = "product"
	CustomFieldSetValuesParamsEntityRateCard            CustomFieldSetValuesParamsEntity = "rate_card"
	CustomFieldSetValuesParamsEntityScheduledCharge     CustomFieldSetValuesParamsEntity = "scheduled_charge"
)

func (CustomFieldSetValuesParamsEntity) IsKnown

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"`
	CustomFields  map[string]string `json:"custom_fields"`
	JSON          customerJSON      `json:"-"`
}

func (*Customer) UnmarshalJSON

func (r *Customer) UnmarshalJSON(data []byte) (err 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.
	CustomerStatus CustomerAlertCustomerStatus `json:"customer_status,required,nullable"`
	// If present, indicates the reason the alert was triggered.
	TriggeredBy string            `json:"triggered_by,nullable"`
	JSON        customerAlertJSON `json:"-"`
}

func (*CustomerAlert) UnmarshalJSON

func (r *CustomerAlert) UnmarshalJSON(data []byte) (err 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
	Status CustomerAlertAlertStatus `json:"status,required"`
	// Threshold value of the alert policy
	Threshold float64 `json:"threshold,required"`
	// Type of the alert
	Type CustomerAlertAlertType `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.CreditType `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 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          customerAlertAlertJSON `json:"-"`
}

func (*CustomerAlertAlert) UnmarshalJSON

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

type CustomerAlertAlertCustomFieldFilter

type CustomerAlertAlertCustomFieldFilter struct {
	Entity CustomerAlertAlertCustomFieldFiltersEntity `json:"entity,required"`
	Key    string                                     `json:"key,required"`
	Value  string                                     `json:"value,required"`
	JSON   customerAlertAlertCustomFieldFilterJSON    `json:"-"`
}

func (*CustomerAlertAlertCustomFieldFilter) UnmarshalJSON

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

type CustomerAlertAlertCustomFieldFiltersEntity

type CustomerAlertAlertCustomFieldFiltersEntity string
const (
	CustomerAlertAlertCustomFieldFiltersEntityContract       CustomerAlertAlertCustomFieldFiltersEntity = "Contract"
	CustomerAlertAlertCustomFieldFiltersEntityCommit         CustomerAlertAlertCustomFieldFiltersEntity = "Commit"
	CustomerAlertAlertCustomFieldFiltersEntityContractCredit CustomerAlertAlertCustomFieldFiltersEntity = "ContractCredit"
)

func (CustomerAlertAlertCustomFieldFiltersEntity) IsKnown

type CustomerAlertAlertGroupKeyFilter

type CustomerAlertAlertGroupKeyFilter struct {
	Key   string                               `json:"key,required"`
	Value string                               `json:"value,required"`
	JSON  customerAlertAlertGroupKeyFilterJSON `json:"-"`
}

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

func (*CustomerAlertAlertGroupKeyFilter) UnmarshalJSON

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

type CustomerAlertAlertStatus

type CustomerAlertAlertStatus string

Status of the alert

const (
	CustomerAlertAlertStatusEnabled  CustomerAlertAlertStatus = "enabled"
	CustomerAlertAlertStatusArchived CustomerAlertAlertStatus = "archived"
	CustomerAlertAlertStatusDisabled CustomerAlertAlertStatus = "disabled"
)

func (CustomerAlertAlertStatus) IsKnown

func (r CustomerAlertAlertStatus) IsKnown() bool

type CustomerAlertAlertType

type CustomerAlertAlertType string

Type of the alert

const (
	CustomerAlertAlertTypeLowCreditBalanceReached                           CustomerAlertAlertType = "low_credit_balance_reached"
	CustomerAlertAlertTypeSpendThresholdReached                             CustomerAlertAlertType = "spend_threshold_reached"
	CustomerAlertAlertTypeMonthlyInvoiceTotalSpendThresholdReached          CustomerAlertAlertType = "monthly_invoice_total_spend_threshold_reached"
	CustomerAlertAlertTypeLowRemainingDaysInPlanReached                     CustomerAlertAlertType = "low_remaining_days_in_plan_reached"
	CustomerAlertAlertTypeLowRemainingCreditPercentageReached               CustomerAlertAlertType = "low_remaining_credit_percentage_reached"
	CustomerAlertAlertTypeUsageThresholdReached                             CustomerAlertAlertType = "usage_threshold_reached"
	CustomerAlertAlertTypeLowRemainingDaysForCommitSegmentReached           CustomerAlertAlertType = "low_remaining_days_for_commit_segment_reached"
	CustomerAlertAlertTypeLowRemainingCommitBalanceReached                  CustomerAlertAlertType = "low_remaining_commit_balance_reached"
	CustomerAlertAlertTypeLowRemainingCommitPercentageReached               CustomerAlertAlertType = "low_remaining_commit_percentage_reached"
	CustomerAlertAlertTypeLowRemainingDaysForContractCreditSegmentReached   CustomerAlertAlertType = "low_remaining_days_for_contract_credit_segment_reached"
	CustomerAlertAlertTypeLowRemainingContractCreditBalanceReached          CustomerAlertAlertType = "low_remaining_contract_credit_balance_reached"
	CustomerAlertAlertTypeLowRemainingContractCreditPercentageReached       CustomerAlertAlertType = "low_remaining_contract_credit_percentage_reached"
	CustomerAlertAlertTypeLowRemainingContractCreditAndCommitBalanceReached CustomerAlertAlertType = "low_remaining_contract_credit_and_commit_balance_reached"
	CustomerAlertAlertTypeInvoiceTotalReached                               CustomerAlertAlertType = "invoice_total_reached"
)

func (CustomerAlertAlertType) IsKnown

func (r CustomerAlertAlertType) IsKnown() bool

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"
)

func (CustomerAlertCustomerStatus) IsKnown

func (r CustomerAlertCustomerStatus) IsKnown() bool

type CustomerAlertGetParams

type CustomerAlertGetParams struct {
	// The Metronome ID of the alert
	AlertID param.Field[string] `json:"alert_id,required" format:"uuid"`
	// The Metronome ID of the customer
	CustomerID param.Field[string] `json:"customer_id,required" format:"uuid"`
}

func (CustomerAlertGetParams) MarshalJSON

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

type CustomerAlertGetResponse

type CustomerAlertGetResponse struct {
	Data CustomerAlert                `json:"data,required"`
	JSON customerAlertGetResponseJSON `json:"-"`
}

func (*CustomerAlertGetResponse) UnmarshalJSON

func (r *CustomerAlertGetResponse) UnmarshalJSON(data []byte) (err error)

type CustomerAlertListParams

type CustomerAlertListParams struct {
	// The Metronome ID of the customer
	CustomerID param.Field[string] `json:"customer_id,required" format:"uuid"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
	// Optionally filter by alert status. If absent, only enabled alerts will be
	// returned.
	AlertStatuses param.Field[[]CustomerAlertListParamsAlertStatus] `json:"alert_statuses"`
}

func (CustomerAlertListParams) MarshalJSON

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

func (CustomerAlertListParams) URLQuery

func (r CustomerAlertListParams) URLQuery() (v url.Values)

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

type CustomerAlertListParamsAlertStatus

type CustomerAlertListParamsAlertStatus string
const (
	CustomerAlertListParamsAlertStatusEnabled  CustomerAlertListParamsAlertStatus = "ENABLED"
	CustomerAlertListParamsAlertStatusDisabled CustomerAlertListParamsAlertStatus = "DISABLED"
	CustomerAlertListParamsAlertStatusArchived CustomerAlertListParamsAlertStatus = "ARCHIVED"
)

func (CustomerAlertListParamsAlertStatus) IsKnown

type CustomerAlertListResponse

type CustomerAlertListResponse struct {
	Data     []CustomerAlert               `json:"data,required"`
	NextPage string                        `json:"next_page,required,nullable"`
	JSON     customerAlertListResponseJSON `json:"-"`
}

func (*CustomerAlertListResponse) UnmarshalJSON

func (r *CustomerAlertListResponse) UnmarshalJSON(data []byte) (err error)

type CustomerAlertResetParams

type CustomerAlertResetParams struct {
	// The Metronome ID of the alert
	AlertID param.Field[string] `json:"alert_id,required" format:"uuid"`
	// The Metronome ID of the customer
	CustomerID param.Field[string] `json:"customer_id,required" format:"uuid"`
}

func (CustomerAlertResetParams) MarshalJSON

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

type CustomerAlertService

type CustomerAlertService struct {
	Options []option.RequestOption
}

CustomerAlertService 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 NewCustomerAlertService method instead.

func NewCustomerAlertService

func NewCustomerAlertService(opts ...option.RequestOption) (r *CustomerAlertService)

NewCustomerAlertService 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 (*CustomerAlertService) Get

Get the customer alert status and alert information for the specified customer and alert

func (*CustomerAlertService) List

Fetch all customer alert statuses and alert information for a customer

func (*CustomerAlertService) Reset

Reset state for an alert by customer id and force re-evaluation

type CustomerArchiveParams

type CustomerArchiveParams struct {
	ID shared.IDParam `json:"id,required"`
}

func (CustomerArchiveParams) MarshalJSON

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

type CustomerArchiveResponse

type CustomerArchiveResponse struct {
	Data shared.ID                   `json:"data,required"`
	JSON customerArchiveResponseJSON `json:"-"`
}

func (*CustomerArchiveResponse) UnmarshalJSON

func (r *CustomerArchiveResponse) UnmarshalJSON(data []byte) (err error)

type CustomerBillingConfigDeleteParamsBillingProviderType

type CustomerBillingConfigDeleteParamsBillingProviderType string
const (
	CustomerBillingConfigDeleteParamsBillingProviderTypeAwsMarketplace   CustomerBillingConfigDeleteParamsBillingProviderType = "aws_marketplace"
	CustomerBillingConfigDeleteParamsBillingProviderTypeStripe           CustomerBillingConfigDeleteParamsBillingProviderType = "stripe"
	CustomerBillingConfigDeleteParamsBillingProviderTypeNetsuite         CustomerBillingConfigDeleteParamsBillingProviderType = "netsuite"
	CustomerBillingConfigDeleteParamsBillingProviderTypeCustom           CustomerBillingConfigDeleteParamsBillingProviderType = "custom"
	CustomerBillingConfigDeleteParamsBillingProviderTypeAzureMarketplace CustomerBillingConfigDeleteParamsBillingProviderType = "azure_marketplace"
	CustomerBillingConfigDeleteParamsBillingProviderTypeQuickbooksOnline CustomerBillingConfigDeleteParamsBillingProviderType = "quickbooks_online"
	CustomerBillingConfigDeleteParamsBillingProviderTypeWorkday          CustomerBillingConfigDeleteParamsBillingProviderType = "workday"
	CustomerBillingConfigDeleteParamsBillingProviderTypeGcpMarketplace   CustomerBillingConfigDeleteParamsBillingProviderType = "gcp_marketplace"
)

func (CustomerBillingConfigDeleteParamsBillingProviderType) IsKnown

type CustomerBillingConfigGetParamsBillingProviderType

type CustomerBillingConfigGetParamsBillingProviderType string
const (
	CustomerBillingConfigGetParamsBillingProviderTypeAwsMarketplace   CustomerBillingConfigGetParamsBillingProviderType = "aws_marketplace"
	CustomerBillingConfigGetParamsBillingProviderTypeStripe           CustomerBillingConfigGetParamsBillingProviderType = "stripe"
	CustomerBillingConfigGetParamsBillingProviderTypeNetsuite         CustomerBillingConfigGetParamsBillingProviderType = "netsuite"
	CustomerBillingConfigGetParamsBillingProviderTypeCustom           CustomerBillingConfigGetParamsBillingProviderType = "custom"
	CustomerBillingConfigGetParamsBillingProviderTypeAzureMarketplace CustomerBillingConfigGetParamsBillingProviderType = "azure_marketplace"
	CustomerBillingConfigGetParamsBillingProviderTypeQuickbooksOnline CustomerBillingConfigGetParamsBillingProviderType = "quickbooks_online"
	CustomerBillingConfigGetParamsBillingProviderTypeWorkday          CustomerBillingConfigGetParamsBillingProviderType = "workday"
	CustomerBillingConfigGetParamsBillingProviderTypeGcpMarketplace   CustomerBillingConfigGetParamsBillingProviderType = "gcp_marketplace"
)

func (CustomerBillingConfigGetParamsBillingProviderType) IsKnown

type CustomerBillingConfigGetResponse

type CustomerBillingConfigGetResponse struct {
	Data CustomerBillingConfigGetResponseData `json:"data,required"`
	JSON customerBillingConfigGetResponseJSON `json:"-"`
}

func (*CustomerBillingConfigGetResponse) UnmarshalJSON

func (r *CustomerBillingConfigGetResponse) UnmarshalJSON(data []byte) (err error)

type CustomerBillingConfigGetResponseData

type CustomerBillingConfigGetResponseData struct {
	// Contract expiration date for the customer. The expected format is RFC 3339 and
	// can be retrieved from AWS's GetEntitlements API. (See
	// https://docs.aws.amazon.com/marketplaceentitlement/latest/APIReference/API_GetEntitlements.html.)
	AwsExpirationDate time.Time                                     `json:"aws_expiration_date" format:"date-time"`
	AwsProductCode    string                                        `json:"aws_product_code"`
	AwsRegion         CustomerBillingConfigGetResponseDataAwsRegion `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. (See
	// 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. (See
	// 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"`
	AzureSubscriptionStatus   CustomerBillingConfigGetResponseDataAzureSubscriptionStatus `json:"azure_subscription_status"`
	BillingProviderCustomerID string                                                      `json:"billing_provider_customer_id"`
	StripeCollectionMethod    CustomerBillingConfigGetResponseDataStripeCollectionMethod  `json:"stripe_collection_method"`
	JSON                      customerBillingConfigGetResponseDataJSON                    `json:"-"`
}

func (*CustomerBillingConfigGetResponseData) UnmarshalJSON

func (r *CustomerBillingConfigGetResponseData) UnmarshalJSON(data []byte) (err error)

type CustomerBillingConfigGetResponseDataAwsRegion

type CustomerBillingConfigGetResponseDataAwsRegion string
const (
	CustomerBillingConfigGetResponseDataAwsRegionAfSouth1     CustomerBillingConfigGetResponseDataAwsRegion = "af-south-1"
	CustomerBillingConfigGetResponseDataAwsRegionApEast1      CustomerBillingConfigGetResponseDataAwsRegion = "ap-east-1"
	CustomerBillingConfigGetResponseDataAwsRegionApNortheast1 CustomerBillingConfigGetResponseDataAwsRegion = "ap-northeast-1"
	CustomerBillingConfigGetResponseDataAwsRegionApNortheast2 CustomerBillingConfigGetResponseDataAwsRegion = "ap-northeast-2"
	CustomerBillingConfigGetResponseDataAwsRegionApNortheast3 CustomerBillingConfigGetResponseDataAwsRegion = "ap-northeast-3"
	CustomerBillingConfigGetResponseDataAwsRegionApSouth1     CustomerBillingConfigGetResponseDataAwsRegion = "ap-south-1"
	CustomerBillingConfigGetResponseDataAwsRegionApSoutheast1 CustomerBillingConfigGetResponseDataAwsRegion = "ap-southeast-1"
	CustomerBillingConfigGetResponseDataAwsRegionApSoutheast2 CustomerBillingConfigGetResponseDataAwsRegion = "ap-southeast-2"
	CustomerBillingConfigGetResponseDataAwsRegionCaCentral1   CustomerBillingConfigGetResponseDataAwsRegion = "ca-central-1"
	CustomerBillingConfigGetResponseDataAwsRegionCnNorth1     CustomerBillingConfigGetResponseDataAwsRegion = "cn-north-1"
	CustomerBillingConfigGetResponseDataAwsRegionCnNorthwest1 CustomerBillingConfigGetResponseDataAwsRegion = "cn-northwest-1"
	CustomerBillingConfigGetResponseDataAwsRegionEuCentral1   CustomerBillingConfigGetResponseDataAwsRegion = "eu-central-1"
	CustomerBillingConfigGetResponseDataAwsRegionEuNorth1     CustomerBillingConfigGetResponseDataAwsRegion = "eu-north-1"
	CustomerBillingConfigGetResponseDataAwsRegionEuSouth1     CustomerBillingConfigGetResponseDataAwsRegion = "eu-south-1"
	CustomerBillingConfigGetResponseDataAwsRegionEuWest1      CustomerBillingConfigGetResponseDataAwsRegion = "eu-west-1"
	CustomerBillingConfigGetResponseDataAwsRegionEuWest2      CustomerBillingConfigGetResponseDataAwsRegion = "eu-west-2"
	CustomerBillingConfigGetResponseDataAwsRegionEuWest3      CustomerBillingConfigGetResponseDataAwsRegion = "eu-west-3"
	CustomerBillingConfigGetResponseDataAwsRegionMeSouth1     CustomerBillingConfigGetResponseDataAwsRegion = "me-south-1"
	CustomerBillingConfigGetResponseDataAwsRegionSaEast1      CustomerBillingConfigGetResponseDataAwsRegion = "sa-east-1"
	CustomerBillingConfigGetResponseDataAwsRegionUsEast1      CustomerBillingConfigGetResponseDataAwsRegion = "us-east-1"
	CustomerBillingConfigGetResponseDataAwsRegionUsEast2      CustomerBillingConfigGetResponseDataAwsRegion = "us-east-2"
	CustomerBillingConfigGetResponseDataAwsRegionUsGovEast1   CustomerBillingConfigGetResponseDataAwsRegion = "us-gov-east-1"
	CustomerBillingConfigGetResponseDataAwsRegionUsGovWest1   CustomerBillingConfigGetResponseDataAwsRegion = "us-gov-west-1"
	CustomerBillingConfigGetResponseDataAwsRegionUsWest1      CustomerBillingConfigGetResponseDataAwsRegion = "us-west-1"
	CustomerBillingConfigGetResponseDataAwsRegionUsWest2      CustomerBillingConfigGetResponseDataAwsRegion = "us-west-2"
)

func (CustomerBillingConfigGetResponseDataAwsRegion) IsKnown

type CustomerBillingConfigGetResponseDataAzureSubscriptionStatus

type CustomerBillingConfigGetResponseDataAzureSubscriptionStatus string
const (
	CustomerBillingConfigGetResponseDataAzureSubscriptionStatusSubscribed              CustomerBillingConfigGetResponseDataAzureSubscriptionStatus = "Subscribed"
	CustomerBillingConfigGetResponseDataAzureSubscriptionStatusUnsubscribed            CustomerBillingConfigGetResponseDataAzureSubscriptionStatus = "Unsubscribed"
	CustomerBillingConfigGetResponseDataAzureSubscriptionStatusSuspended               CustomerBillingConfigGetResponseDataAzureSubscriptionStatus = "Suspended"
	CustomerBillingConfigGetResponseDataAzureSubscriptionStatusPendingFulfillmentStart CustomerBillingConfigGetResponseDataAzureSubscriptionStatus = "PendingFulfillmentStart"
)

func (CustomerBillingConfigGetResponseDataAzureSubscriptionStatus) IsKnown

type CustomerBillingConfigGetResponseDataStripeCollectionMethod

type CustomerBillingConfigGetResponseDataStripeCollectionMethod string
const (
	CustomerBillingConfigGetResponseDataStripeCollectionMethodChargeAutomatically CustomerBillingConfigGetResponseDataStripeCollectionMethod = "charge_automatically"
	CustomerBillingConfigGetResponseDataStripeCollectionMethodSendInvoice         CustomerBillingConfigGetResponseDataStripeCollectionMethod = "send_invoice"
)

func (CustomerBillingConfigGetResponseDataStripeCollectionMethod) IsKnown

type CustomerBillingConfigNewParams

type CustomerBillingConfigNewParams struct {
	// The customer ID in the billing provider's system. For Azure, this is the
	// subscription ID.
	BillingProviderCustomerID param.Field[string]                                               `json:"billing_provider_customer_id,required"`
	AwsProductCode            param.Field[string]                                               `json:"aws_product_code"`
	AwsRegion                 param.Field[CustomerBillingConfigNewParamsAwsRegion]              `json:"aws_region"`
	StripeCollectionMethod    param.Field[CustomerBillingConfigNewParamsStripeCollectionMethod] `json:"stripe_collection_method"`
}

func (CustomerBillingConfigNewParams) MarshalJSON

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

type CustomerBillingConfigNewParamsAwsRegion

type CustomerBillingConfigNewParamsAwsRegion string
const (
	CustomerBillingConfigNewParamsAwsRegionAfSouth1     CustomerBillingConfigNewParamsAwsRegion = "af-south-1"
	CustomerBillingConfigNewParamsAwsRegionApEast1      CustomerBillingConfigNewParamsAwsRegion = "ap-east-1"
	CustomerBillingConfigNewParamsAwsRegionApNortheast1 CustomerBillingConfigNewParamsAwsRegion = "ap-northeast-1"
	CustomerBillingConfigNewParamsAwsRegionApNortheast2 CustomerBillingConfigNewParamsAwsRegion = "ap-northeast-2"
	CustomerBillingConfigNewParamsAwsRegionApNortheast3 CustomerBillingConfigNewParamsAwsRegion = "ap-northeast-3"
	CustomerBillingConfigNewParamsAwsRegionApSouth1     CustomerBillingConfigNewParamsAwsRegion = "ap-south-1"
	CustomerBillingConfigNewParamsAwsRegionApSoutheast1 CustomerBillingConfigNewParamsAwsRegion = "ap-southeast-1"
	CustomerBillingConfigNewParamsAwsRegionApSoutheast2 CustomerBillingConfigNewParamsAwsRegion = "ap-southeast-2"
	CustomerBillingConfigNewParamsAwsRegionCaCentral1   CustomerBillingConfigNewParamsAwsRegion = "ca-central-1"
	CustomerBillingConfigNewParamsAwsRegionCnNorth1     CustomerBillingConfigNewParamsAwsRegion = "cn-north-1"
	CustomerBillingConfigNewParamsAwsRegionCnNorthwest1 CustomerBillingConfigNewParamsAwsRegion = "cn-northwest-1"
	CustomerBillingConfigNewParamsAwsRegionEuCentral1   CustomerBillingConfigNewParamsAwsRegion = "eu-central-1"
	CustomerBillingConfigNewParamsAwsRegionEuNorth1     CustomerBillingConfigNewParamsAwsRegion = "eu-north-1"
	CustomerBillingConfigNewParamsAwsRegionEuSouth1     CustomerBillingConfigNewParamsAwsRegion = "eu-south-1"
	CustomerBillingConfigNewParamsAwsRegionEuWest1      CustomerBillingConfigNewParamsAwsRegion = "eu-west-1"
	CustomerBillingConfigNewParamsAwsRegionEuWest2      CustomerBillingConfigNewParamsAwsRegion = "eu-west-2"
	CustomerBillingConfigNewParamsAwsRegionEuWest3      CustomerBillingConfigNewParamsAwsRegion = "eu-west-3"
	CustomerBillingConfigNewParamsAwsRegionMeSouth1     CustomerBillingConfigNewParamsAwsRegion = "me-south-1"
	CustomerBillingConfigNewParamsAwsRegionSaEast1      CustomerBillingConfigNewParamsAwsRegion = "sa-east-1"
	CustomerBillingConfigNewParamsAwsRegionUsEast1      CustomerBillingConfigNewParamsAwsRegion = "us-east-1"
	CustomerBillingConfigNewParamsAwsRegionUsEast2      CustomerBillingConfigNewParamsAwsRegion = "us-east-2"
	CustomerBillingConfigNewParamsAwsRegionUsGovEast1   CustomerBillingConfigNewParamsAwsRegion = "us-gov-east-1"
	CustomerBillingConfigNewParamsAwsRegionUsGovWest1   CustomerBillingConfigNewParamsAwsRegion = "us-gov-west-1"
	CustomerBillingConfigNewParamsAwsRegionUsWest1      CustomerBillingConfigNewParamsAwsRegion = "us-west-1"
	CustomerBillingConfigNewParamsAwsRegionUsWest2      CustomerBillingConfigNewParamsAwsRegion = "us-west-2"
)

func (CustomerBillingConfigNewParamsAwsRegion) IsKnown

type CustomerBillingConfigNewParamsBillingProviderType

type CustomerBillingConfigNewParamsBillingProviderType string
const (
	CustomerBillingConfigNewParamsBillingProviderTypeAwsMarketplace   CustomerBillingConfigNewParamsBillingProviderType = "aws_marketplace"
	CustomerBillingConfigNewParamsBillingProviderTypeStripe           CustomerBillingConfigNewParamsBillingProviderType = "stripe"
	CustomerBillingConfigNewParamsBillingProviderTypeNetsuite         CustomerBillingConfigNewParamsBillingProviderType = "netsuite"
	CustomerBillingConfigNewParamsBillingProviderTypeCustom           CustomerBillingConfigNewParamsBillingProviderType = "custom"
	CustomerBillingConfigNewParamsBillingProviderTypeAzureMarketplace CustomerBillingConfigNewParamsBillingProviderType = "azure_marketplace"
	CustomerBillingConfigNewParamsBillingProviderTypeQuickbooksOnline CustomerBillingConfigNewParamsBillingProviderType = "quickbooks_online"
	CustomerBillingConfigNewParamsBillingProviderTypeWorkday          CustomerBillingConfigNewParamsBillingProviderType = "workday"
	CustomerBillingConfigNewParamsBillingProviderTypeGcpMarketplace   CustomerBillingConfigNewParamsBillingProviderType = "gcp_marketplace"
)

func (CustomerBillingConfigNewParamsBillingProviderType) IsKnown

type CustomerBillingConfigNewParamsStripeCollectionMethod

type CustomerBillingConfigNewParamsStripeCollectionMethod string
const (
	CustomerBillingConfigNewParamsStripeCollectionMethodChargeAutomatically CustomerBillingConfigNewParamsStripeCollectionMethod = "charge_automatically"
	CustomerBillingConfigNewParamsStripeCollectionMethodSendInvoice         CustomerBillingConfigNewParamsStripeCollectionMethod = "send_invoice"
)

func (CustomerBillingConfigNewParamsStripeCollectionMethod) IsKnown

type CustomerBillingConfigService

type CustomerBillingConfigService struct {
	Options []option.RequestOption
}

CustomerBillingConfigService 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 NewCustomerBillingConfigService method instead.

func NewCustomerBillingConfigService

func NewCustomerBillingConfigService(opts ...option.RequestOption) (r *CustomerBillingConfigService)

NewCustomerBillingConfigService 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 (*CustomerBillingConfigService) Delete

Delete the billing configuration for a given customer. Note: this is unsupported for Azure and AWS Marketplace customers.

func (*CustomerBillingConfigService) Get

Fetch the billing configuration for the given customer.

func (*CustomerBillingConfigService) New

Set the billing configuration for a given customer.

type CustomerCommitListParams

type CustomerCommitListParams struct {
	CustomerID param.Field[string] `json:"customer_id,required" format:"uuid"`
	CommitID   param.Field[string] `json:"commit_id" format:"uuid"`
	// Include only commits that have access schedules that "cover" the provided date
	CoveringDate param.Field[time.Time] `json:"covering_date" format:"date-time"`
	// Include only commits that have any access before the provided date (exclusive)
	EffectiveBefore param.Field[time.Time] `json:"effective_before" format:"date-time"`
	// Include commits from archived contracts.
	IncludeArchived param.Field[bool] `json:"include_archived"`
	// Include commits on the contract level.
	IncludeContractCommits param.Field[bool] `json:"include_contract_commits"`
	// Include commit ledgers in the response. Setting this flag may cause the query to
	// be slower.
	IncludeLedgers param.Field[bool] `json:"include_ledgers"`
	// The next page token from a previous response.
	NextPage param.Field[string] `json:"next_page"`
	// Include only commits that have any access on or after the provided date
	StartingAt param.Field[time.Time] `json:"starting_at" format:"date-time"`
}

func (CustomerCommitListParams) MarshalJSON

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

type CustomerCommitListResponse

type CustomerCommitListResponse struct {
	Data     []shared.Commit                `json:"data,required"`
	NextPage string                         `json:"next_page,required,nullable"`
	JSON     customerCommitListResponseJSON `json:"-"`
}

func (*CustomerCommitListResponse) UnmarshalJSON

func (r *CustomerCommitListResponse) UnmarshalJSON(data []byte) (err error)

type CustomerCommitNewParams

type CustomerCommitNewParams 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 param.Field[CustomerCommitNewParamsAccessSchedule] `json:"access_schedule,required"`
	CustomerID     param.Field[string]                                `json:"customer_id,required" format:"uuid"`
	// If multiple credits or commits are applicable, the one with the lower priority
	// will apply first.
	Priority  param.Field[float64]                     `json:"priority,required"`
	ProductID param.Field[string]                      `json:"product_id,required" format:"uuid"`
	Type      param.Field[CustomerCommitNewParamsType] `json:"type,required"`
	// Which contract the commit applies to. If not provided, the commit applies to all
	// contracts.
	ApplicableContractIDs param.Field[[]string] `json:"applicable_contract_ids"`
	// Which products the commit applies to. If both applicable_product_ids and
	// applicable_product_tags are not provided, the commit applies to all products.
	ApplicableProductIDs param.Field[[]string] `json:"applicable_product_ids" format:"uuid"`
	// Which tags the commit applies to. If both applicable_product_ids and
	// applicable_product_tags are not provided, the commit applies to all products.
	ApplicableProductTags param.Field[[]string]          `json:"applicable_product_tags"`
	CustomFields          param.Field[map[string]string] `json:"custom_fields"`
	// Used only in UI/API. It is not exposed to end customers.
	Description param.Field[string] `json:"description"`
	// 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.Field[string] `json:"invoice_contract_id" format:"uuid"`
	// 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 param.Field[CustomerCommitNewParamsInvoiceSchedule] `json:"invoice_schedule"`
	// displayed on invoices
	Name param.Field[string] `json:"name"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Field[string] `json:"netsuite_sales_order_id"`
	// This field's availability is dependent on your client's configuration.
	SalesforceOpportunityID param.Field[string] `json:"salesforce_opportunity_id"`
}

func (CustomerCommitNewParams) MarshalJSON

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

type CustomerCommitNewParamsAccessSchedule

type CustomerCommitNewParamsAccessSchedule struct {
	ScheduleItems param.Field[[]CustomerCommitNewParamsAccessScheduleScheduleItem] `json:"schedule_items,required"`
	CreditTypeID  param.Field[string]                                              `json:"credit_type_id" format:"uuid"`
}

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

func (CustomerCommitNewParamsAccessSchedule) MarshalJSON

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

type CustomerCommitNewParamsAccessScheduleScheduleItem

type CustomerCommitNewParamsAccessScheduleScheduleItem struct {
	Amount param.Field[float64] `json:"amount,required"`
	// RFC 3339 timestamp (exclusive)
	EndingBefore param.Field[time.Time] `json:"ending_before,required" format:"date-time"`
	// RFC 3339 timestamp (inclusive)
	StartingAt param.Field[time.Time] `json:"starting_at,required" format:"date-time"`
}

func (CustomerCommitNewParamsAccessScheduleScheduleItem) MarshalJSON

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

type CustomerCommitNewParamsInvoiceSchedule

type CustomerCommitNewParamsInvoiceSchedule struct {
	// Defaults to USD if not passed. Only USD is supported at this time.
	CreditTypeID param.Field[string] `json:"credit_type_id" format:"uuid"`
	// 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 param.Field[CustomerCommitNewParamsInvoiceScheduleRecurringSchedule] `json:"recurring_schedule"`
	// Either provide amount or provide both unit_price and quantity.
	ScheduleItems param.Field[[]CustomerCommitNewParamsInvoiceScheduleScheduleItem] `json:"schedule_items"`
}

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 (CustomerCommitNewParamsInvoiceSchedule) MarshalJSON

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

type CustomerCommitNewParamsInvoiceScheduleRecurringSchedule

type CustomerCommitNewParamsInvoiceScheduleRecurringSchedule struct {
	AmountDistribution param.Field[CustomerCommitNewParamsInvoiceScheduleRecurringScheduleAmountDistribution] `json:"amount_distribution,required"`
	// RFC 3339 timestamp (exclusive).
	EndingBefore param.Field[time.Time]                                                        `json:"ending_before,required" format:"date-time"`
	Frequency    param.Field[CustomerCommitNewParamsInvoiceScheduleRecurringScheduleFrequency] `json:"frequency,required"`
	// RFC 3339 timestamp (inclusive).
	StartingAt param.Field[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.Field[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 param.Field[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 param.Field[float64] `json:"unit_price"`
}

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 (CustomerCommitNewParamsInvoiceScheduleRecurringSchedule) MarshalJSON

type CustomerCommitNewParamsInvoiceScheduleRecurringScheduleAmountDistribution

type CustomerCommitNewParamsInvoiceScheduleRecurringScheduleAmountDistribution string
const (
	CustomerCommitNewParamsInvoiceScheduleRecurringScheduleAmountDistributionDivided        CustomerCommitNewParamsInvoiceScheduleRecurringScheduleAmountDistribution = "DIVIDED"
	CustomerCommitNewParamsInvoiceScheduleRecurringScheduleAmountDistributionDividedRounded CustomerCommitNewParamsInvoiceScheduleRecurringScheduleAmountDistribution = "DIVIDED_ROUNDED"
	CustomerCommitNewParamsInvoiceScheduleRecurringScheduleAmountDistributionEach           CustomerCommitNewParamsInvoiceScheduleRecurringScheduleAmountDistribution = "EACH"
)

func (CustomerCommitNewParamsInvoiceScheduleRecurringScheduleAmountDistribution) IsKnown

type CustomerCommitNewParamsInvoiceScheduleRecurringScheduleFrequency

type CustomerCommitNewParamsInvoiceScheduleRecurringScheduleFrequency string
const (
	CustomerCommitNewParamsInvoiceScheduleRecurringScheduleFrequencyMonthly    CustomerCommitNewParamsInvoiceScheduleRecurringScheduleFrequency = "MONTHLY"
	CustomerCommitNewParamsInvoiceScheduleRecurringScheduleFrequencyQuarterly  CustomerCommitNewParamsInvoiceScheduleRecurringScheduleFrequency = "QUARTERLY"
	CustomerCommitNewParamsInvoiceScheduleRecurringScheduleFrequencySemiAnnual CustomerCommitNewParamsInvoiceScheduleRecurringScheduleFrequency = "SEMI_ANNUAL"
	CustomerCommitNewParamsInvoiceScheduleRecurringScheduleFrequencyAnnual     CustomerCommitNewParamsInvoiceScheduleRecurringScheduleFrequency = "ANNUAL"
)

func (CustomerCommitNewParamsInvoiceScheduleRecurringScheduleFrequency) IsKnown

type CustomerCommitNewParamsInvoiceScheduleScheduleItem

type CustomerCommitNewParamsInvoiceScheduleScheduleItem struct {
	// timestamp of the scheduled event
	Timestamp param.Field[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.Field[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 param.Field[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 param.Field[float64] `json:"unit_price"`
}

func (CustomerCommitNewParamsInvoiceScheduleScheduleItem) MarshalJSON

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

type CustomerCommitNewParamsType

type CustomerCommitNewParamsType string
const (
	CustomerCommitNewParamsTypePrepaid  CustomerCommitNewParamsType = "PREPAID"
	CustomerCommitNewParamsTypePostpaid CustomerCommitNewParamsType = "POSTPAID"
)

func (CustomerCommitNewParamsType) IsKnown

func (r CustomerCommitNewParamsType) IsKnown() bool

type CustomerCommitNewResponse

type CustomerCommitNewResponse struct {
	Data shared.ID                     `json:"data,required"`
	JSON customerCommitNewResponseJSON `json:"-"`
}

func (*CustomerCommitNewResponse) UnmarshalJSON

func (r *CustomerCommitNewResponse) UnmarshalJSON(data []byte) (err error)

type CustomerCommitService

type CustomerCommitService struct {
	Options []option.RequestOption
}

CustomerCommitService 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 NewCustomerCommitService method instead.

func NewCustomerCommitService

func NewCustomerCommitService(opts ...option.RequestOption) (r *CustomerCommitService)

NewCustomerCommitService 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 (*CustomerCommitService) List

List commits.

func (*CustomerCommitService) New

Create a new commit at the customer level.

func (*CustomerCommitService) UpdateEndDate

Update the end date of a PREPAID commit

type CustomerCommitUpdateEndDateParams

type CustomerCommitUpdateEndDateParams struct {
	// ID of the commit to update. Only supports "PREPAID" commits.
	CommitID param.Field[string] `json:"commit_id,required" format:"uuid"`
	// ID of the customer whose commit is to be updated
	CustomerID param.Field[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.Field[time.Time] `json:"access_ending_before" 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.Field[time.Time] `json:"invoices_ending_before" format:"date-time"`
}

func (CustomerCommitUpdateEndDateParams) MarshalJSON

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

type CustomerCommitUpdateEndDateResponse

type CustomerCommitUpdateEndDateResponse struct {
	Data shared.ID                               `json:"data,required"`
	JSON customerCommitUpdateEndDateResponseJSON `json:"-"`
}

func (*CustomerCommitUpdateEndDateResponse) UnmarshalJSON

func (r *CustomerCommitUpdateEndDateResponse) UnmarshalJSON(data []byte) (err error)

type CustomerCreditListParams

type CustomerCreditListParams struct {
	CustomerID param.Field[string] `json:"customer_id,required" format:"uuid"`
	// Return only credits that have access schedules that "cover" the provided date
	CoveringDate param.Field[time.Time] `json:"covering_date" format:"date-time"`
	CreditID     param.Field[string]    `json:"credit_id" format:"uuid"`
	// Include only credits that have any access before the provided date (exclusive)
	EffectiveBefore param.Field[time.Time] `json:"effective_before" format:"date-time"`
	// Include credits from archived contracts.
	IncludeArchived param.Field[bool] `json:"include_archived"`
	// Include credits on the contract level.
	IncludeContractCredits param.Field[bool] `json:"include_contract_credits"`
	// Include credit ledgers in the response. Setting this flag may cause the query to
	// be slower.
	IncludeLedgers param.Field[bool] `json:"include_ledgers"`
	// The next page token from a previous response.
	NextPage param.Field[string] `json:"next_page"`
	// Include only credits that have any access on or after the provided date
	StartingAt param.Field[time.Time] `json:"starting_at" format:"date-time"`
}

func (CustomerCreditListParams) MarshalJSON

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

type CustomerCreditListResponse

type CustomerCreditListResponse struct {
	Data     []shared.Credit                `json:"data,required"`
	NextPage string                         `json:"next_page,required,nullable"`
	JSON     customerCreditListResponseJSON `json:"-"`
}

func (*CustomerCreditListResponse) UnmarshalJSON

func (r *CustomerCreditListResponse) UnmarshalJSON(data []byte) (err error)

type CustomerCreditNewParams

type CustomerCreditNewParams struct {
	// Schedule for distributing the credit to the customer.
	AccessSchedule param.Field[CustomerCreditNewParamsAccessSchedule] `json:"access_schedule,required"`
	CustomerID     param.Field[string]                                `json:"customer_id,required" format:"uuid"`
	// If multiple credits or commits are applicable, the one with the lower priority
	// will apply first.
	Priority  param.Field[float64] `json:"priority,required"`
	ProductID param.Field[string]  `json:"product_id,required" format:"uuid"`
	// Which contract the credit applies to. If not provided, the credit applies to all
	// contracts.
	ApplicableContractIDs param.Field[[]string] `json:"applicable_contract_ids"`
	// 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 param.Field[[]string] `json:"applicable_product_ids" 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 param.Field[[]string]          `json:"applicable_product_tags"`
	CustomFields          param.Field[map[string]string] `json:"custom_fields"`
	// Used only in UI/API. It is not exposed to end customers.
	Description param.Field[string] `json:"description"`
	// displayed on invoices
	Name param.Field[string] `json:"name"`
	// This field's availability is dependent on your client's configuration.
	NetsuiteSalesOrderID param.Field[string] `json:"netsuite_sales_order_id"`
	// This field's availability is dependent on your client's configuration.
	SalesforceOpportunityID param.Field[string] `json:"salesforce_opportunity_id"`
}

func (CustomerCreditNewParams) MarshalJSON

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

type CustomerCreditNewParamsAccessSchedule

type CustomerCreditNewParamsAccessSchedule struct {
	ScheduleItems param.Field[[]CustomerCreditNewParamsAccessScheduleScheduleItem] `json:"schedule_items,required"`
	CreditTypeID  param.Field[string]                                              `json:"credit_type_id" format:"uuid"`
}

Schedule for distributing the credit to the customer.

func (CustomerCreditNewParamsAccessSchedule) MarshalJSON

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

type CustomerCreditNewParamsAccessScheduleScheduleItem

type CustomerCreditNewParamsAccessScheduleScheduleItem struct {
	Amount param.Field[float64] `json:"amount,required"`
	// RFC 3339 timestamp (exclusive)
	EndingBefore param.Field[time.Time] `json:"ending_before,required" format:"date-time"`
	// RFC 3339 timestamp (inclusive)
	StartingAt param.Field[time.Time] `json:"starting_at,required" format:"date-time"`
}

func (CustomerCreditNewParamsAccessScheduleScheduleItem) MarshalJSON

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

type CustomerCreditNewResponse

type CustomerCreditNewResponse struct {
	Data shared.ID                     `json:"data,required"`
	JSON customerCreditNewResponseJSON `json:"-"`
}

func (*CustomerCreditNewResponse) UnmarshalJSON

func (r *CustomerCreditNewResponse) UnmarshalJSON(data []byte) (err error)

type CustomerCreditService

type CustomerCreditService struct {
	Options []option.RequestOption
}

CustomerCreditService 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 NewCustomerCreditService method instead.

func NewCustomerCreditService

func NewCustomerCreditService(opts ...option.RequestOption) (r *CustomerCreditService)

NewCustomerCreditService 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 (*CustomerCreditService) List

List credits.

func (*CustomerCreditService) New

Create a new credit at the customer level.

func (*CustomerCreditService) UpdateEndDate

Update the end date of a credit

type CustomerCreditUpdateEndDateParams

type CustomerCreditUpdateEndDateParams 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 param.Field[time.Time] `json:"access_ending_before,required" format:"date-time"`
	// ID of the commit to update
	CreditID param.Field[string] `json:"credit_id,required" format:"uuid"`
	// ID of the customer whose credit is to be updated
	CustomerID param.Field[string] `json:"customer_id,required" format:"uuid"`
}

func (CustomerCreditUpdateEndDateParams) MarshalJSON

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

type CustomerCreditUpdateEndDateResponse

type CustomerCreditUpdateEndDateResponse struct {
	Data shared.ID                               `json:"data,required"`
	JSON customerCreditUpdateEndDateResponseJSON `json:"-"`
}

func (*CustomerCreditUpdateEndDateResponse) UnmarshalJSON

func (r *CustomerCreditUpdateEndDateResponse) UnmarshalJSON(data []byte) (err error)

type CustomerDetail

type CustomerDetail struct {
	// the Metronome ID of the customer
	ID             string                       `json:"id,required" format:"uuid"`
	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"`
	// This field's availability is dependent on your client's configuration.
	CurrentBillableStatus CustomerDetailCurrentBillableStatus `json:"current_billable_status"`
	JSON                  customerDetailJSON                  `json:"-"`
}

func (*CustomerDetail) UnmarshalJSON

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

type CustomerDetailCurrentBillableStatus

type CustomerDetailCurrentBillableStatus struct {
	Value       CustomerDetailCurrentBillableStatusValue `json:"value,required"`
	EffectiveAt time.Time                                `json:"effective_at,nullable" format:"date-time"`
	JSON        customerDetailCurrentBillableStatusJSON  `json:"-"`
}

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

func (*CustomerDetailCurrentBillableStatus) UnmarshalJSON

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

type CustomerDetailCurrentBillableStatusValue

type CustomerDetailCurrentBillableStatusValue string
const (
	CustomerDetailCurrentBillableStatusValueBillable   CustomerDetailCurrentBillableStatusValue = "billable"
	CustomerDetailCurrentBillableStatusValueUnbillable CustomerDetailCurrentBillableStatusValue = "unbillable"
)

func (CustomerDetailCurrentBillableStatusValue) IsKnown

type CustomerDetailCustomerConfig

type CustomerDetailCustomerConfig struct {
	// The Salesforce account ID for the customer
	SalesforceAccountID string                           `json:"salesforce_account_id,required,nullable"`
	JSON                customerDetailCustomerConfigJSON `json:"-"`
}

func (*CustomerDetailCustomerConfig) UnmarshalJSON

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

type CustomerGetResponse

type CustomerGetResponse struct {
	Data CustomerDetail          `json:"data,required"`
	JSON customerGetResponseJSON `json:"-"`
}

func (*CustomerGetResponse) UnmarshalJSON

func (r *CustomerGetResponse) UnmarshalJSON(data []byte) (err error)

type CustomerInvoiceAddChargeParams

type CustomerInvoiceAddChargeParams struct {
	// 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 param.Field[string] `json:"charge_id,required" format:"uuid"`
	// The Metronome ID of the customer plan to add the charge to.
	CustomerPlanID param.Field[string] `json:"customer_plan_id,required" format:"uuid"`
	Description    param.Field[string] `json:"description,required"`
	// The start_timestamp of the invoice to add the charge to.
	InvoiceStartTimestamp param.Field[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    param.Field[float64] `json:"price,required"`
	Quantity param.Field[float64] `json:"quantity,required"`
}

func (CustomerInvoiceAddChargeParams) MarshalJSON

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

type CustomerInvoiceAddChargeResponse

type CustomerInvoiceAddChargeResponse struct {
	JSON customerInvoiceAddChargeResponseJSON `json:"-"`
}

func (*CustomerInvoiceAddChargeResponse) UnmarshalJSON

func (r *CustomerInvoiceAddChargeResponse) UnmarshalJSON(data []byte) (err error)

type CustomerInvoiceGetParams

type CustomerInvoiceGetParams struct {
	// If set, all zero quantity line items will be filtered out of the response
	SkipZeroQtyLineItems param.Field[bool] `query:"skip_zero_qty_line_items"`
}

func (CustomerInvoiceGetParams) URLQuery

func (r CustomerInvoiceGetParams) URLQuery() (v url.Values)

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

type CustomerInvoiceGetResponse

type CustomerInvoiceGetResponse struct {
	Data Invoice                        `json:"data,required"`
	JSON customerInvoiceGetResponseJSON `json:"-"`
}

func (*CustomerInvoiceGetResponse) UnmarshalJSON

func (r *CustomerInvoiceGetResponse) UnmarshalJSON(data []byte) (err error)

type CustomerInvoiceListBreakdownsParams

type CustomerInvoiceListBreakdownsParams struct {
	// RFC 3339 timestamp. Breakdowns will only be returned for time windows that end
	// on or before this time.
	EndingBefore param.Field[time.Time] `query:"ending_before,required" format:"date-time"`
	// RFC 3339 timestamp. Breakdowns will only be returned for time windows that start
	// on or after this time.
	StartingOn param.Field[time.Time] `query:"starting_on,required" format:"date-time"`
	// Only return invoices for the specified credit type
	CreditTypeID param.Field[string] `query:"credit_type_id"`
	// 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.Field[int64] `query:"limit"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
	// If set, all zero quantity line items will be filtered out of the response
	SkipZeroQtyLineItems param.Field[bool] `query:"skip_zero_qty_line_items"`
	// Invoice sort order by issued_at, e.g. date_asc or date_desc. Defaults to
	// date_asc.
	Sort param.Field[CustomerInvoiceListBreakdownsParamsSort] `query:"sort"`
	// Invoice status, e.g. DRAFT or FINALIZED
	Status param.Field[string] `query:"status"`
	// The granularity of the breakdowns to return. Defaults to day.
	WindowSize param.Field[CustomerInvoiceListBreakdownsParamsWindowSize] `query:"window_size"`
}

func (CustomerInvoiceListBreakdownsParams) URLQuery

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

type CustomerInvoiceListBreakdownsParamsSort

type CustomerInvoiceListBreakdownsParamsSort string

Invoice sort order by issued_at, e.g. date_asc or date_desc. Defaults to date_asc.

const (
	CustomerInvoiceListBreakdownsParamsSortDateAsc  CustomerInvoiceListBreakdownsParamsSort = "date_asc"
	CustomerInvoiceListBreakdownsParamsSortDateDesc CustomerInvoiceListBreakdownsParamsSort = "date_desc"
)

func (CustomerInvoiceListBreakdownsParamsSort) IsKnown

type CustomerInvoiceListBreakdownsParamsWindowSize

type CustomerInvoiceListBreakdownsParamsWindowSize string

The granularity of the breakdowns to return. Defaults to day.

const (
	CustomerInvoiceListBreakdownsParamsWindowSizeHour CustomerInvoiceListBreakdownsParamsWindowSize = "HOUR"
	CustomerInvoiceListBreakdownsParamsWindowSizeDay  CustomerInvoiceListBreakdownsParamsWindowSize = "DAY"
)

func (CustomerInvoiceListBreakdownsParamsWindowSize) IsKnown

type CustomerInvoiceListBreakdownsResponse

type CustomerInvoiceListBreakdownsResponse struct {
	BreakdownEndTimestamp   time.Time                                 `json:"breakdown_end_timestamp,required" format:"date-time"`
	BreakdownStartTimestamp time.Time                                 `json:"breakdown_start_timestamp,required" format:"date-time"`
	JSON                    customerInvoiceListBreakdownsResponseJSON `json:"-"`
	Invoice
}

func (*CustomerInvoiceListBreakdownsResponse) UnmarshalJSON

func (r *CustomerInvoiceListBreakdownsResponse) UnmarshalJSON(data []byte) (err error)

type CustomerInvoiceListParams

type CustomerInvoiceListParams struct {
	// Only return invoices for the specified credit type
	CreditTypeID param.Field[string] `query:"credit_type_id"`
	// RFC 3339 timestamp (exclusive). Invoices will only be returned for billing
	// periods that end before this time.
	EndingBefore param.Field[time.Time] `query:"ending_before" format:"date-time"`
	// Max number of results that should be returned
	Limit param.Field[int64] `query:"limit"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
	// If set, all zero quantity line items will be filtered out of the response
	SkipZeroQtyLineItems param.Field[bool] `query:"skip_zero_qty_line_items"`
	// Invoice sort order by issued_at, e.g. date_asc or date_desc. Defaults to
	// date_asc.
	Sort param.Field[CustomerInvoiceListParamsSort] `query:"sort"`
	// RFC 3339 timestamp (inclusive). Invoices will only be returned for billing
	// periods that start at or after this time.
	StartingOn param.Field[time.Time] `query:"starting_on" format:"date-time"`
	// Invoice status, e.g. DRAFT, FINALIZED, or VOID
	Status param.Field[string] `query:"status"`
}

func (CustomerInvoiceListParams) URLQuery

func (r CustomerInvoiceListParams) URLQuery() (v url.Values)

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

type CustomerInvoiceListParamsSort

type CustomerInvoiceListParamsSort string

Invoice sort order by issued_at, e.g. date_asc or date_desc. Defaults to date_asc.

const (
	CustomerInvoiceListParamsSortDateAsc  CustomerInvoiceListParamsSort = "date_asc"
	CustomerInvoiceListParamsSortDateDesc CustomerInvoiceListParamsSort = "date_desc"
)

func (CustomerInvoiceListParamsSort) IsKnown

func (r CustomerInvoiceListParamsSort) IsKnown() bool

type CustomerInvoiceService

type CustomerInvoiceService struct {
	Options []option.RequestOption
}

CustomerInvoiceService 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 NewCustomerInvoiceService method instead.

func NewCustomerInvoiceService

func NewCustomerInvoiceService(opts ...option.RequestOption) (r *CustomerInvoiceService)

NewCustomerInvoiceService 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 (*CustomerInvoiceService) AddCharge

Add a one time charge to the specified invoice

func (*CustomerInvoiceService) Get

Fetch a specific invoice for a given customer.

func (*CustomerInvoiceService) List

List all invoices for a given customer, optionally filtered by status, date range, and/or credit type.

func (*CustomerInvoiceService) ListAutoPaging

List all invoices for a given customer, optionally filtered by status, date range, and/or credit type.

func (*CustomerInvoiceService) ListBreakdowns

List daily or hourly breakdown invoices for a given customer, optionally filtered by status, date range, and/or credit type.

func (*CustomerInvoiceService) ListBreakdownsAutoPaging

List daily or hourly breakdown invoices for a given customer, optionally filtered by status, date range, and/or credit type.

type CustomerListBillableMetricsParams

type CustomerListBillableMetricsParams struct {
	// Max number of results that should be returned
	Limit param.Field[int64] `query:"limit"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
	// If true, the list of metrics will be filtered to just ones that are on the
	// customer's current plan
	OnCurrentPlan param.Field[bool] `query:"on_current_plan"`
}

func (CustomerListBillableMetricsParams) URLQuery

func (r CustomerListBillableMetricsParams) URLQuery() (v url.Values)

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

type CustomerListBillableMetricsResponse

type CustomerListBillableMetricsResponse 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.
	AggregationType CustomerListBillableMetricsResponseAggregationType `json:"aggregation_type"`
	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]interface{} `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 customerListBillableMetricsResponseJSON `json:"-"`
}

func (*CustomerListBillableMetricsResponse) UnmarshalJSON

func (r *CustomerListBillableMetricsResponse) UnmarshalJSON(data []byte) (err error)

type CustomerListBillableMetricsResponseAggregationType

type CustomerListBillableMetricsResponseAggregationType string

Specifies the type of aggregation performed on matching events.

const (
	CustomerListBillableMetricsResponseAggregationTypeCount  CustomerListBillableMetricsResponseAggregationType = "COUNT"
	CustomerListBillableMetricsResponseAggregationTypeLatest CustomerListBillableMetricsResponseAggregationType = "LATEST"
	CustomerListBillableMetricsResponseAggregationTypeMax    CustomerListBillableMetricsResponseAggregationType = "MAX"
	CustomerListBillableMetricsResponseAggregationTypeSum    CustomerListBillableMetricsResponseAggregationType = "SUM"
	CustomerListBillableMetricsResponseAggregationTypeUnique CustomerListBillableMetricsResponseAggregationType = "UNIQUE"
)

func (CustomerListBillableMetricsResponseAggregationType) IsKnown

type CustomerListCostsParams

type CustomerListCostsParams struct {
	// RFC 3339 timestamp (exclusive)
	EndingBefore param.Field[time.Time] `query:"ending_before,required" format:"date-time"`
	// RFC 3339 timestamp (inclusive)
	StartingOn param.Field[time.Time] `query:"starting_on,required" format:"date-time"`
	// Max number of results that should be returned
	Limit param.Field[int64] `query:"limit"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
}

func (CustomerListCostsParams) URLQuery

func (r CustomerListCostsParams) URLQuery() (v url.Values)

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

type CustomerListCostsResponse

type CustomerListCostsResponse struct {
	CreditTypes    map[string]CustomerListCostsResponseCreditType `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           customerListCostsResponseJSON                  `json:"-"`
}

func (*CustomerListCostsResponse) UnmarshalJSON

func (r *CustomerListCostsResponse) UnmarshalJSON(data []byte) (err error)

type CustomerListCostsResponseCreditType

type CustomerListCostsResponseCreditType struct {
	Cost              float64                                                 `json:"cost"`
	LineItemBreakdown []CustomerListCostsResponseCreditTypesLineItemBreakdown `json:"line_item_breakdown"`
	Name              string                                                  `json:"name"`
	JSON              customerListCostsResponseCreditTypeJSON                 `json:"-"`
}

func (*CustomerListCostsResponseCreditType) UnmarshalJSON

func (r *CustomerListCostsResponseCreditType) UnmarshalJSON(data []byte) (err error)

type CustomerListCostsResponseCreditTypesLineItemBreakdown

type CustomerListCostsResponseCreditTypesLineItemBreakdown struct {
	Cost       float64                                                   `json:"cost,required"`
	Name       string                                                    `json:"name,required"`
	GroupKey   string                                                    `json:"group_key"`
	GroupValue string                                                    `json:"group_value,nullable"`
	JSON       customerListCostsResponseCreditTypesLineItemBreakdownJSON `json:"-"`
}

func (*CustomerListCostsResponseCreditTypesLineItemBreakdown) UnmarshalJSON

func (r *CustomerListCostsResponseCreditTypesLineItemBreakdown) UnmarshalJSON(data []byte) (err error)

type CustomerListParams

type CustomerListParams struct {
	// Filter the customer list by customer_id. Up to 100 ids can be provided.
	CustomerIDs param.Field[[]string] `query:"customer_ids"`
	// Filter the customer list by ingest_alias
	IngestAlias param.Field[string] `query:"ingest_alias"`
	// Max number of results that should be returned
	Limit param.Field[int64] `query:"limit"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
	// Filter the customer list by only archived customers.
	OnlyArchived param.Field[bool] `query:"only_archived"`
	// Filter the customer list by salesforce_account_id. Up to 100 ids can be
	// provided.
	SalesforceAccountIDs param.Field[[]string] `query:"salesforce_account_ids"`
}

func (CustomerListParams) URLQuery

func (r CustomerListParams) URLQuery() (v url.Values)

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

type CustomerNamedScheduleGetParams

type CustomerNamedScheduleGetParams struct {
	// ID of the customer whose named schedule is to be retrieved
	CustomerID param.Field[string] `json:"customer_id,required" format:"uuid"`
	// The identifier for the schedule to be retrieved
	ScheduleName param.Field[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.Field[time.Time] `json:"covering_date" format:"date-time"`
}

func (CustomerNamedScheduleGetParams) MarshalJSON

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

type CustomerNamedScheduleGetResponse

type CustomerNamedScheduleGetResponse struct {
	Data []CustomerNamedScheduleGetResponseData `json:"data,required"`
	JSON customerNamedScheduleGetResponseJSON   `json:"-"`
}

func (*CustomerNamedScheduleGetResponse) UnmarshalJSON

func (r *CustomerNamedScheduleGetResponse) UnmarshalJSON(data []byte) (err error)

type CustomerNamedScheduleGetResponseData

type CustomerNamedScheduleGetResponseData struct {
	StartingAt   time.Time                                `json:"starting_at,required" format:"date-time"`
	Value        interface{}                              `json:"value,required"`
	EndingBefore time.Time                                `json:"ending_before" format:"date-time"`
	JSON         customerNamedScheduleGetResponseDataJSON `json:"-"`
}

func (*CustomerNamedScheduleGetResponseData) UnmarshalJSON

func (r *CustomerNamedScheduleGetResponseData) UnmarshalJSON(data []byte) (err error)

type CustomerNamedScheduleService

type CustomerNamedScheduleService struct {
	Options []option.RequestOption
}

CustomerNamedScheduleService 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 NewCustomerNamedScheduleService method instead.

func NewCustomerNamedScheduleService

func NewCustomerNamedScheduleService(opts ...option.RequestOption) (r *CustomerNamedScheduleService)

NewCustomerNamedScheduleService 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 (*CustomerNamedScheduleService) Get

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

func (*CustomerNamedScheduleService) Update

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

type CustomerNamedScheduleUpdateParams

type CustomerNamedScheduleUpdateParams struct {
	// ID of the customer whose named schedule is to be updated
	CustomerID param.Field[string] `json:"customer_id,required" format:"uuid"`
	// The identifier for the schedule to be updated
	ScheduleName param.Field[string]    `json:"schedule_name,required"`
	StartingAt   param.Field[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        param.Field[interface{}] `json:"value,required"`
	EndingBefore param.Field[time.Time]   `json:"ending_before" format:"date-time"`
}

func (CustomerNamedScheduleUpdateParams) MarshalJSON

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

type CustomerNewParams

type CustomerNewParams struct {
	// This will be truncated to 160 characters if the provided name is longer.
	Name          param.Field[string]                         `json:"name,required"`
	BillingConfig param.Field[CustomerNewParamsBillingConfig] `json:"billing_config"`
	CustomFields  param.Field[map[string]string]              `json:"custom_fields"`
	// (deprecated, use ingest_aliases instead) the first ID (Metronome ID or ingest
	// alias) that can be used in usage events
	ExternalID param.Field[string] `json:"external_id"`
	// Aliases that can be used to refer to this customer in usage events
	IngestAliases param.Field[[]string] `json:"ingest_aliases"`
}

func (CustomerNewParams) MarshalJSON

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

type CustomerNewParamsBillingConfig

type CustomerNewParamsBillingConfig struct {
	BillingProviderCustomerID param.Field[string]                                               `json:"billing_provider_customer_id,required"`
	BillingProviderType       param.Field[CustomerNewParamsBillingConfigBillingProviderType]    `json:"billing_provider_type,required"`
	AwsProductCode            param.Field[string]                                               `json:"aws_product_code"`
	AwsRegion                 param.Field[CustomerNewParamsBillingConfigAwsRegion]              `json:"aws_region"`
	StripeCollectionMethod    param.Field[CustomerNewParamsBillingConfigStripeCollectionMethod] `json:"stripe_collection_method"`
}

func (CustomerNewParamsBillingConfig) MarshalJSON

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

type CustomerNewParamsBillingConfigAwsRegion

type CustomerNewParamsBillingConfigAwsRegion string
const (
	CustomerNewParamsBillingConfigAwsRegionAfSouth1     CustomerNewParamsBillingConfigAwsRegion = "af-south-1"
	CustomerNewParamsBillingConfigAwsRegionApEast1      CustomerNewParamsBillingConfigAwsRegion = "ap-east-1"
	CustomerNewParamsBillingConfigAwsRegionApNortheast1 CustomerNewParamsBillingConfigAwsRegion = "ap-northeast-1"
	CustomerNewParamsBillingConfigAwsRegionApNortheast2 CustomerNewParamsBillingConfigAwsRegion = "ap-northeast-2"
	CustomerNewParamsBillingConfigAwsRegionApNortheast3 CustomerNewParamsBillingConfigAwsRegion = "ap-northeast-3"
	CustomerNewParamsBillingConfigAwsRegionApSouth1     CustomerNewParamsBillingConfigAwsRegion = "ap-south-1"
	CustomerNewParamsBillingConfigAwsRegionApSoutheast1 CustomerNewParamsBillingConfigAwsRegion = "ap-southeast-1"
	CustomerNewParamsBillingConfigAwsRegionApSoutheast2 CustomerNewParamsBillingConfigAwsRegion = "ap-southeast-2"
	CustomerNewParamsBillingConfigAwsRegionCaCentral1   CustomerNewParamsBillingConfigAwsRegion = "ca-central-1"
	CustomerNewParamsBillingConfigAwsRegionCnNorth1     CustomerNewParamsBillingConfigAwsRegion = "cn-north-1"
	CustomerNewParamsBillingConfigAwsRegionCnNorthwest1 CustomerNewParamsBillingConfigAwsRegion = "cn-northwest-1"
	CustomerNewParamsBillingConfigAwsRegionEuCentral1   CustomerNewParamsBillingConfigAwsRegion = "eu-central-1"
	CustomerNewParamsBillingConfigAwsRegionEuNorth1     CustomerNewParamsBillingConfigAwsRegion = "eu-north-1"
	CustomerNewParamsBillingConfigAwsRegionEuSouth1     CustomerNewParamsBillingConfigAwsRegion = "eu-south-1"
	CustomerNewParamsBillingConfigAwsRegionEuWest1      CustomerNewParamsBillingConfigAwsRegion = "eu-west-1"
	CustomerNewParamsBillingConfigAwsRegionEuWest2      CustomerNewParamsBillingConfigAwsRegion = "eu-west-2"
	CustomerNewParamsBillingConfigAwsRegionEuWest3      CustomerNewParamsBillingConfigAwsRegion = "eu-west-3"
	CustomerNewParamsBillingConfigAwsRegionMeSouth1     CustomerNewParamsBillingConfigAwsRegion = "me-south-1"
	CustomerNewParamsBillingConfigAwsRegionSaEast1      CustomerNewParamsBillingConfigAwsRegion = "sa-east-1"
	CustomerNewParamsBillingConfigAwsRegionUsEast1      CustomerNewParamsBillingConfigAwsRegion = "us-east-1"
	CustomerNewParamsBillingConfigAwsRegionUsEast2      CustomerNewParamsBillingConfigAwsRegion = "us-east-2"
	CustomerNewParamsBillingConfigAwsRegionUsGovEast1   CustomerNewParamsBillingConfigAwsRegion = "us-gov-east-1"
	CustomerNewParamsBillingConfigAwsRegionUsGovWest1   CustomerNewParamsBillingConfigAwsRegion = "us-gov-west-1"
	CustomerNewParamsBillingConfigAwsRegionUsWest1      CustomerNewParamsBillingConfigAwsRegion = "us-west-1"
	CustomerNewParamsBillingConfigAwsRegionUsWest2      CustomerNewParamsBillingConfigAwsRegion = "us-west-2"
)

func (CustomerNewParamsBillingConfigAwsRegion) IsKnown

type CustomerNewParamsBillingConfigBillingProviderType

type CustomerNewParamsBillingConfigBillingProviderType string
const (
	CustomerNewParamsBillingConfigBillingProviderTypeAwsMarketplace   CustomerNewParamsBillingConfigBillingProviderType = "aws_marketplace"
	CustomerNewParamsBillingConfigBillingProviderTypeStripe           CustomerNewParamsBillingConfigBillingProviderType = "stripe"
	CustomerNewParamsBillingConfigBillingProviderTypeNetsuite         CustomerNewParamsBillingConfigBillingProviderType = "netsuite"
	CustomerNewParamsBillingConfigBillingProviderTypeCustom           CustomerNewParamsBillingConfigBillingProviderType = "custom"
	CustomerNewParamsBillingConfigBillingProviderTypeAzureMarketplace CustomerNewParamsBillingConfigBillingProviderType = "azure_marketplace"
	CustomerNewParamsBillingConfigBillingProviderTypeQuickbooksOnline CustomerNewParamsBillingConfigBillingProviderType = "quickbooks_online"
	CustomerNewParamsBillingConfigBillingProviderTypeWorkday          CustomerNewParamsBillingConfigBillingProviderType = "workday"
	CustomerNewParamsBillingConfigBillingProviderTypeGcpMarketplace   CustomerNewParamsBillingConfigBillingProviderType = "gcp_marketplace"
)

func (CustomerNewParamsBillingConfigBillingProviderType) IsKnown

type CustomerNewParamsBillingConfigStripeCollectionMethod

type CustomerNewParamsBillingConfigStripeCollectionMethod string
const (
	CustomerNewParamsBillingConfigStripeCollectionMethodChargeAutomatically CustomerNewParamsBillingConfigStripeCollectionMethod = "charge_automatically"
	CustomerNewParamsBillingConfigStripeCollectionMethodSendInvoice         CustomerNewParamsBillingConfigStripeCollectionMethod = "send_invoice"
)

func (CustomerNewParamsBillingConfigStripeCollectionMethod) IsKnown

type CustomerNewResponse

type CustomerNewResponse struct {
	Data Customer                `json:"data,required"`
	JSON customerNewResponseJSON `json:"-"`
}

func (*CustomerNewResponse) UnmarshalJSON

func (r *CustomerNewResponse) UnmarshalJSON(data []byte) (err error)

type CustomerPlanAddParams

type CustomerPlanAddParams struct {
	PlanID param.Field[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 param.Field[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.Field[time.Time] `json:"ending_before" format:"date-time"`
	// Number of days after issuance of invoice after which the invoice is due (e.g.
	// Net 30).
	NetPaymentTermsDays param.Field[float64] `json:"net_payment_terms_days"`
	// 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 param.Field[[]CustomerPlanAddParamsOverageRateAdjustment] `json:"overage_rate_adjustments"`
	// A list of price adjustments can be applied on top of the pricing in the plans.
	// See the
	// [price adjustments documentation](https://docs.metronome.com/pricing/managing-plans/#price-adjustments)
	// for details.
	PriceAdjustments param.Field[[]CustomerPlanAddParamsPriceAdjustment] `json:"price_adjustments"`
	// 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 param.Field[CustomerPlanAddParamsTrialSpec] `json:"trial_spec"`
}

func (CustomerPlanAddParams) MarshalJSON

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

type CustomerPlanAddParamsOverageRateAdjustment

type CustomerPlanAddParamsOverageRateAdjustment struct {
	CustomCreditTypeID       param.Field[string] `json:"custom_credit_type_id,required" format:"uuid"`
	FiatCurrencyCreditTypeID param.Field[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 param.Field[float64] `json:"to_fiat_conversion_factor,required"`
}

func (CustomerPlanAddParamsOverageRateAdjustment) MarshalJSON

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

type CustomerPlanAddParamsPriceAdjustment

type CustomerPlanAddParamsPriceAdjustment struct {
	AdjustmentType param.Field[CustomerPlanAddParamsPriceAdjustmentsAdjustmentType] `json:"adjustment_type,required"`
	ChargeID       param.Field[string]                                              `json:"charge_id,required" format:"uuid"`
	// Used in price ramps. Indicates how many billing periods pass before the charge
	// applies.
	StartPeriod param.Field[float64] `json:"start_period,required"`
	// the overridden quantity for a fixed charge
	Quantity param.Field[float64] `json:"quantity"`
	// Used in pricing tiers. Indicates at what metric value the price applies.
	Tier param.Field[float64] `json:"tier"`
	// 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.Field[float64] `json:"value"`
}

func (CustomerPlanAddParamsPriceAdjustment) MarshalJSON

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

type CustomerPlanAddParamsPriceAdjustmentsAdjustmentType

type CustomerPlanAddParamsPriceAdjustmentsAdjustmentType string
const (
	CustomerPlanAddParamsPriceAdjustmentsAdjustmentTypePercentage CustomerPlanAddParamsPriceAdjustmentsAdjustmentType = "percentage"
	CustomerPlanAddParamsPriceAdjustmentsAdjustmentTypeFixed      CustomerPlanAddParamsPriceAdjustmentsAdjustmentType = "fixed"
	CustomerPlanAddParamsPriceAdjustmentsAdjustmentTypeOverride   CustomerPlanAddParamsPriceAdjustmentsAdjustmentType = "override"
	CustomerPlanAddParamsPriceAdjustmentsAdjustmentTypeQuantity   CustomerPlanAddParamsPriceAdjustmentsAdjustmentType = "quantity"
)

func (CustomerPlanAddParamsPriceAdjustmentsAdjustmentType) IsKnown

type CustomerPlanAddParamsTrialSpec

type CustomerPlanAddParamsTrialSpec struct {
	// Length of the trial period in days.
	LengthInDays param.Field[float64]                                   `json:"length_in_days,required"`
	SpendingCap  param.Field[CustomerPlanAddParamsTrialSpecSpendingCap] `json:"spending_cap"`
}

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.

func (CustomerPlanAddParamsTrialSpec) MarshalJSON

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

type CustomerPlanAddParamsTrialSpecSpendingCap

type CustomerPlanAddParamsTrialSpecSpendingCap struct {
	// The credit amount in the given denomination based on the credit type, e.g. US
	// cents.
	Amount param.Field[float64] `json:"amount,required"`
	// The credit type ID for the spending cap.
	CreditTypeID param.Field[string] `json:"credit_type_id,required"`
}

func (CustomerPlanAddParamsTrialSpecSpendingCap) MarshalJSON

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

type CustomerPlanAddResponse

type CustomerPlanAddResponse struct {
	Data shared.ID                   `json:"data,required"`
	JSON customerPlanAddResponseJSON `json:"-"`
}

func (*CustomerPlanAddResponse) UnmarshalJSON

func (r *CustomerPlanAddResponse) UnmarshalJSON(data []byte) (err error)

type CustomerPlanEndParams

type CustomerPlanEndParams struct {
	// 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.Field[time.Time] `json:"ending_before" 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.Field[bool] `json:"void_invoices"`
	// 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.Field[bool] `json:"void_stripe_invoices"`
}

func (CustomerPlanEndParams) MarshalJSON

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

type CustomerPlanEndResponse

type CustomerPlanEndResponse struct {
	JSON customerPlanEndResponseJSON `json:"-"`
}

func (*CustomerPlanEndResponse) UnmarshalJSON

func (r *CustomerPlanEndResponse) UnmarshalJSON(data []byte) (err error)

type CustomerPlanListParams

type CustomerPlanListParams struct {
	// Max number of results that should be returned
	Limit param.Field[int64] `query:"limit"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
}

func (CustomerPlanListParams) URLQuery

func (r CustomerPlanListParams) URLQuery() (v url.Values)

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

type CustomerPlanListPriceAdjustmentsParams

type CustomerPlanListPriceAdjustmentsParams struct {
	// Max number of results that should be returned
	Limit param.Field[int64] `query:"limit"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
}

func (CustomerPlanListPriceAdjustmentsParams) URLQuery

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

type CustomerPlanListPriceAdjustmentsResponse

type CustomerPlanListPriceAdjustmentsResponse struct {
	ChargeID    string                                             `json:"charge_id,required" format:"uuid"`
	ChargeType  CustomerPlanListPriceAdjustmentsResponseChargeType `json:"charge_type,required"`
	Prices      []CustomerPlanListPriceAdjustmentsResponsePrice    `json:"prices,required"`
	StartPeriod float64                                            `json:"start_period,required"`
	Quantity    float64                                            `json:"quantity"`
	JSON        customerPlanListPriceAdjustmentsResponseJSON       `json:"-"`
}

func (*CustomerPlanListPriceAdjustmentsResponse) UnmarshalJSON

func (r *CustomerPlanListPriceAdjustmentsResponse) UnmarshalJSON(data []byte) (err error)

type CustomerPlanListPriceAdjustmentsResponseChargeType

type CustomerPlanListPriceAdjustmentsResponseChargeType string
const (
	CustomerPlanListPriceAdjustmentsResponseChargeTypeUsage     CustomerPlanListPriceAdjustmentsResponseChargeType = "usage"
	CustomerPlanListPriceAdjustmentsResponseChargeTypeFixed     CustomerPlanListPriceAdjustmentsResponseChargeType = "fixed"
	CustomerPlanListPriceAdjustmentsResponseChargeTypeComposite CustomerPlanListPriceAdjustmentsResponseChargeType = "composite"
	CustomerPlanListPriceAdjustmentsResponseChargeTypeMinimum   CustomerPlanListPriceAdjustmentsResponseChargeType = "minimum"
	CustomerPlanListPriceAdjustmentsResponseChargeTypeSeat      CustomerPlanListPriceAdjustmentsResponseChargeType = "seat"
)

func (CustomerPlanListPriceAdjustmentsResponseChargeType) IsKnown

type CustomerPlanListPriceAdjustmentsResponsePrice

type CustomerPlanListPriceAdjustmentsResponsePrice struct {
	// Determines how the value will be applied.
	AdjustmentType CustomerPlanListPriceAdjustmentsResponsePricesAdjustmentType `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  customerPlanListPriceAdjustmentsResponsePriceJSON `json:"-"`
}

func (*CustomerPlanListPriceAdjustmentsResponsePrice) UnmarshalJSON

func (r *CustomerPlanListPriceAdjustmentsResponsePrice) UnmarshalJSON(data []byte) (err error)

type CustomerPlanListPriceAdjustmentsResponsePricesAdjustmentType

type CustomerPlanListPriceAdjustmentsResponsePricesAdjustmentType string

Determines how the value will be applied.

const (
	CustomerPlanListPriceAdjustmentsResponsePricesAdjustmentTypeFixed      CustomerPlanListPriceAdjustmentsResponsePricesAdjustmentType = "fixed"
	CustomerPlanListPriceAdjustmentsResponsePricesAdjustmentTypeQuantity   CustomerPlanListPriceAdjustmentsResponsePricesAdjustmentType = "quantity"
	CustomerPlanListPriceAdjustmentsResponsePricesAdjustmentTypePercentage CustomerPlanListPriceAdjustmentsResponsePricesAdjustmentType = "percentage"
	CustomerPlanListPriceAdjustmentsResponsePricesAdjustmentTypeOverride   CustomerPlanListPriceAdjustmentsResponsePricesAdjustmentType = "override"
)

func (CustomerPlanListPriceAdjustmentsResponsePricesAdjustmentType) IsKnown

type CustomerPlanListResponse

type CustomerPlanListResponse struct {
	// the ID of the customer plan
	ID              string            `json:"id,required" format:"uuid"`
	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           CustomerPlanListResponseTrialInfo `json:"trial_info"`
	JSON                customerPlanListResponseJSON      `json:"-"`
}

func (*CustomerPlanListResponse) UnmarshalJSON

func (r *CustomerPlanListResponse) UnmarshalJSON(data []byte) (err error)

type CustomerPlanListResponseTrialInfo

type CustomerPlanListResponseTrialInfo struct {
	EndingBefore time.Time                                      `json:"ending_before,required" format:"date-time"`
	SpendingCaps []CustomerPlanListResponseTrialInfoSpendingCap `json:"spending_caps,required"`
	JSON         customerPlanListResponseTrialInfoJSON          `json:"-"`
}

func (*CustomerPlanListResponseTrialInfo) UnmarshalJSON

func (r *CustomerPlanListResponseTrialInfo) UnmarshalJSON(data []byte) (err error)

type CustomerPlanListResponseTrialInfoSpendingCap

type CustomerPlanListResponseTrialInfoSpendingCap struct {
	Amount          float64                                          `json:"amount,required"`
	AmountRemaining float64                                          `json:"amount_remaining,required"`
	CreditType      shared.CreditType                                `json:"credit_type,required"`
	JSON            customerPlanListResponseTrialInfoSpendingCapJSON `json:"-"`
}

func (*CustomerPlanListResponseTrialInfoSpendingCap) UnmarshalJSON

func (r *CustomerPlanListResponseTrialInfoSpendingCap) UnmarshalJSON(data []byte) (err error)

type CustomerPlanService

type CustomerPlanService struct {
	Options []option.RequestOption
}

CustomerPlanService 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 NewCustomerPlanService method instead.

func NewCustomerPlanService

func NewCustomerPlanService(opts ...option.RequestOption) (r *CustomerPlanService)

NewCustomerPlanService 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 (*CustomerPlanService) Add

Associate an existing customer with a plan for a specified date range. See the [price adjustments documentation](https://docs.metronome.com/pricing/managing-plans/#price-adjustments) for details on the price adjustments.

func (*CustomerPlanService) End

func (r *CustomerPlanService) End(ctx context.Context, customerID string, customerPlanID string, body CustomerPlanEndParams, opts ...option.RequestOption) (res *CustomerPlanEndResponse, err error)

Change the end date of a customer's plan.

func (*CustomerPlanService) List

List the given customer's plans in reverse-chronological order.

func (*CustomerPlanService) ListAutoPaging

List the given customer's plans in reverse-chronological order.

func (*CustomerPlanService) ListPriceAdjustments

Lists a customer plans adjustments. See the [price adjustments documentation](https://docs.metronome.com/pricing/managing-plans/#price-adjustments) for details.

func (*CustomerPlanService) ListPriceAdjustmentsAutoPaging

Lists a customer plans adjustments. See the [price adjustments documentation](https://docs.metronome.com/pricing/managing-plans/#price-adjustments) for details.

type CustomerService

type CustomerService struct {
	Options        []option.RequestOption
	Alerts         *CustomerAlertService
	Plans          *CustomerPlanService
	Invoices       *CustomerInvoiceService
	BillingConfig  *CustomerBillingConfigService
	Commits        *CustomerCommitService
	Credits        *CustomerCreditService
	NamedSchedules *CustomerNamedScheduleService
}

CustomerService 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 NewCustomerService method instead.

func NewCustomerService

func NewCustomerService(opts ...option.RequestOption) (r *CustomerService)

NewCustomerService 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 (*CustomerService) Archive

Archive a customer

func (*CustomerService) Get

func (r *CustomerService) Get(ctx context.Context, customerID string, opts ...option.RequestOption) (res *CustomerGetResponse, err error)

Get a customer by Metronome ID.

func (*CustomerService) List

List all customers.

func (*CustomerService) ListAutoPaging

List all customers.

func (*CustomerService) ListBillableMetrics

Get all billable metrics for a given customer.

func (*CustomerService) ListBillableMetricsAutoPaging

Get all billable metrics for a given customer.

func (*CustomerService) 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 (*CustomerService) 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 (*CustomerService) New

Create a new customer

func (*CustomerService) SetIngestAliases

func (r *CustomerService) SetIngestAliases(ctx context.Context, customerID string, body CustomerSetIngestAliasesParams, opts ...option.RequestOption) (err error)

Sets the ingest aliases for a customer. Ingest aliases can be used in the `customer_id` field when sending usage events to Metronome. This call is idempotent. It fully replaces the set of ingest aliases for the given customer.

func (*CustomerService) SetName

func (r *CustomerService) SetName(ctx context.Context, customerID string, body CustomerSetNameParams, opts ...option.RequestOption) (res *CustomerSetNameResponse, err error)

Updates the specified customer's name.

func (*CustomerService) UpdateConfig

func (r *CustomerService) UpdateConfig(ctx context.Context, customerID string, body CustomerUpdateConfigParams, opts ...option.RequestOption) (err error)

Updates the specified customer's config.

type CustomerSetIngestAliasesParams

type CustomerSetIngestAliasesParams struct {
	IngestAliases param.Field[[]string] `json:"ingest_aliases,required"`
}

func (CustomerSetIngestAliasesParams) MarshalJSON

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

type CustomerSetNameParams

type CustomerSetNameParams struct {
	// The new name for the customer. This will be truncated to 160 characters if the
	// provided name is longer.
	Name param.Field[string] `json:"name,required"`
}

func (CustomerSetNameParams) MarshalJSON

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

type CustomerSetNameResponse

type CustomerSetNameResponse struct {
	Data Customer                    `json:"data,required"`
	JSON customerSetNameResponseJSON `json:"-"`
}

func (*CustomerSetNameResponse) UnmarshalJSON

func (r *CustomerSetNameResponse) UnmarshalJSON(data []byte) (err error)

type CustomerUpdateConfigParams

type CustomerUpdateConfigParams struct {
	// 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.Field[bool] `json:"leave_stripe_invoices_in_draft"`
	// The Salesforce account ID for the customer
	SalesforceAccountID param.Field[string] `json:"salesforce_account_id"`
}

func (CustomerUpdateConfigParams) MarshalJSON

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

type DashboardGetEmbeddableURLParams

type DashboardGetEmbeddableURLParams struct {
	CustomerID param.Field[string] `json:"customer_id,required" format:"uuid"`
	// The type of dashboard to retrieve.
	Dashboard param.Field[DashboardGetEmbeddableURLParamsDashboard] `json:"dashboard,required"`
	// Optional list of billable metric group key overrides
	BmGroupKeyOverrides param.Field[[]DashboardGetEmbeddableURLParamsBmGroupKeyOverride] `json:"bm_group_key_overrides"`
	// Optional list of colors to override
	ColorOverrides param.Field[[]DashboardGetEmbeddableURLParamsColorOverride] `json:"color_overrides"`
	// Optional dashboard specific options
	DashboardOptions param.Field[[]DashboardGetEmbeddableURLParamsDashboardOption] `json:"dashboard_options"`
}

func (DashboardGetEmbeddableURLParams) MarshalJSON

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

type DashboardGetEmbeddableURLParamsBmGroupKeyOverride

type DashboardGetEmbeddableURLParamsBmGroupKeyOverride struct {
	// The name of the billable metric group key.
	GroupKeyName param.Field[string] `json:"group_key_name,required"`
	// The display name for the billable metric group key
	DisplayName param.Field[string] `json:"display_name"`
	// <key, value> pairs of the billable metric group key values and their display
	// names. e.g. {"a": "Asia", "b": "Euro"}
	ValueDisplayNames param.Field[map[string]interface{}] `json:"value_display_names"`
}

func (DashboardGetEmbeddableURLParamsBmGroupKeyOverride) MarshalJSON

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

type DashboardGetEmbeddableURLParamsColorOverride

type DashboardGetEmbeddableURLParamsColorOverride struct {
	// The color to override
	Name param.Field[DashboardGetEmbeddableURLParamsColorOverridesName] `json:"name"`
	// Hex value representation of the color
	Value param.Field[string] `json:"value"`
}

func (DashboardGetEmbeddableURLParamsColorOverride) MarshalJSON

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

type DashboardGetEmbeddableURLParamsColorOverridesName

type DashboardGetEmbeddableURLParamsColorOverridesName string

The color to override

const (
	DashboardGetEmbeddableURLParamsColorOverridesNameGrayDark       DashboardGetEmbeddableURLParamsColorOverridesName = "Gray_dark"
	DashboardGetEmbeddableURLParamsColorOverridesNameGrayMedium     DashboardGetEmbeddableURLParamsColorOverridesName = "Gray_medium"
	DashboardGetEmbeddableURLParamsColorOverridesNameGrayLight      DashboardGetEmbeddableURLParamsColorOverridesName = "Gray_light"
	DashboardGetEmbeddableURLParamsColorOverridesNameGrayExtralight DashboardGetEmbeddableURLParamsColorOverridesName = "Gray_extralight"
	DashboardGetEmbeddableURLParamsColorOverridesNameWhite          DashboardGetEmbeddableURLParamsColorOverridesName = "White"
	DashboardGetEmbeddableURLParamsColorOverridesNamePrimaryMedium  DashboardGetEmbeddableURLParamsColorOverridesName = "Primary_medium"
	DashboardGetEmbeddableURLParamsColorOverridesNamePrimaryLight   DashboardGetEmbeddableURLParamsColorOverridesName = "Primary_light"
	DashboardGetEmbeddableURLParamsColorOverridesNameUsageLine0     DashboardGetEmbeddableURLParamsColorOverridesName = "UsageLine_0"
	DashboardGetEmbeddableURLParamsColorOverridesNameUsageLine1     DashboardGetEmbeddableURLParamsColorOverridesName = "UsageLine_1"
	DashboardGetEmbeddableURLParamsColorOverridesNameUsageLine2     DashboardGetEmbeddableURLParamsColorOverridesName = "UsageLine_2"
	DashboardGetEmbeddableURLParamsColorOverridesNameUsageLine3     DashboardGetEmbeddableURLParamsColorOverridesName = "UsageLine_3"
	DashboardGetEmbeddableURLParamsColorOverridesNameUsageLine4     DashboardGetEmbeddableURLParamsColorOverridesName = "UsageLine_4"
	DashboardGetEmbeddableURLParamsColorOverridesNameUsageLine5     DashboardGetEmbeddableURLParamsColorOverridesName = "UsageLine_5"
	DashboardGetEmbeddableURLParamsColorOverridesNameUsageLine6     DashboardGetEmbeddableURLParamsColorOverridesName = "UsageLine_6"
	DashboardGetEmbeddableURLParamsColorOverridesNameUsageLine7     DashboardGetEmbeddableURLParamsColorOverridesName = "UsageLine_7"
	DashboardGetEmbeddableURLParamsColorOverridesNameUsageLine8     DashboardGetEmbeddableURLParamsColorOverridesName = "UsageLine_8"
	DashboardGetEmbeddableURLParamsColorOverridesNameUsageLine9     DashboardGetEmbeddableURLParamsColorOverridesName = "UsageLine_9"
	DashboardGetEmbeddableURLParamsColorOverridesNamePrimaryGreen   DashboardGetEmbeddableURLParamsColorOverridesName = "Primary_green"
	DashboardGetEmbeddableURLParamsColorOverridesNamePrimaryRed     DashboardGetEmbeddableURLParamsColorOverridesName = "Primary_red"
)

func (DashboardGetEmbeddableURLParamsColorOverridesName) IsKnown

type DashboardGetEmbeddableURLParamsDashboard

type DashboardGetEmbeddableURLParamsDashboard string

The type of dashboard to retrieve.

const (
	DashboardGetEmbeddableURLParamsDashboardInvoices DashboardGetEmbeddableURLParamsDashboard = "invoices"
	DashboardGetEmbeddableURLParamsDashboardUsage    DashboardGetEmbeddableURLParamsDashboard = "usage"
	DashboardGetEmbeddableURLParamsDashboardCredits  DashboardGetEmbeddableURLParamsDashboard = "credits"
)

func (DashboardGetEmbeddableURLParamsDashboard) IsKnown

type DashboardGetEmbeddableURLParamsDashboardOption

type DashboardGetEmbeddableURLParamsDashboardOption struct {
	// The option key name
	Key param.Field[string] `json:"key,required"`
	// The option value
	Value param.Field[string] `json:"value,required"`
}

func (DashboardGetEmbeddableURLParamsDashboardOption) MarshalJSON

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

type DashboardGetEmbeddableURLResponse

type DashboardGetEmbeddableURLResponse struct {
	Data DashboardGetEmbeddableURLResponseData `json:"data,required"`
	JSON dashboardGetEmbeddableURLResponseJSON `json:"-"`
}

func (*DashboardGetEmbeddableURLResponse) UnmarshalJSON

func (r *DashboardGetEmbeddableURLResponse) UnmarshalJSON(data []byte) (err error)

type DashboardGetEmbeddableURLResponseData

type DashboardGetEmbeddableURLResponseData struct {
	URL  string                                    `json:"url"`
	JSON dashboardGetEmbeddableURLResponseDataJSON `json:"-"`
}

func (*DashboardGetEmbeddableURLResponseData) UnmarshalJSON

func (r *DashboardGetEmbeddableURLResponseData) UnmarshalJSON(data []byte) (err error)

type DashboardService

type DashboardService struct {
	Options []option.RequestOption
}

DashboardService 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 NewDashboardService method instead.

func NewDashboardService

func NewDashboardService(opts ...option.RequestOption) (r *DashboardService)

NewDashboardService 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 (*DashboardService) GetEmbeddableURL

Retrieve an embeddable dashboard url for a customer. The dashboard can be embedded using an iframe in a website. This will show information such as usage data and customer invoices.

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 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.CreditType `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.
	BillableStatus       InvoiceBillableStatus   `json:"billable_status"`
	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]interface{} `json:"custom_fields"`
	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"`
	PlanCustomFields     map[string]string `json:"plan_custom_fields"`
	PlanID               string            `json:"plan_id" format:"uuid"`
	PlanName             string            `json:"plan_name"`
	// only present for beta 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           invoiceJSON `json:"-"`
}

func (*Invoice) UnmarshalJSON

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

type InvoiceBillableStatus

type InvoiceBillableStatus string

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

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

func (InvoiceBillableStatus) IsKnown

func (r InvoiceBillableStatus) IsKnown() bool

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                     invoiceCorrectionRecordJSON                     `json:"-"`
}

func (*InvoiceCorrectionRecord) UnmarshalJSON

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

type InvoiceCorrectionRecordCorrectedExternalInvoice

type InvoiceCorrectionRecordCorrectedExternalInvoice struct {
	BillingProviderType InvoiceCorrectionRecordCorrectedExternalInvoiceBillingProviderType `json:"billing_provider_type,required"`
	ExternalStatus      InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatus      `json:"external_status"`
	InvoiceID           string                                                             `json:"invoice_id"`
	IssuedAtTimestamp   time.Time                                                          `json:"issued_at_timestamp" format:"date-time"`
	JSON                invoiceCorrectionRecordCorrectedExternalInvoiceJSON                `json:"-"`
}

func (*InvoiceCorrectionRecordCorrectedExternalInvoice) UnmarshalJSON

func (r *InvoiceCorrectionRecordCorrectedExternalInvoice) UnmarshalJSON(data []byte) (err error)

type InvoiceCorrectionRecordCorrectedExternalInvoiceBillingProviderType

type InvoiceCorrectionRecordCorrectedExternalInvoiceBillingProviderType string
const (
	InvoiceCorrectionRecordCorrectedExternalInvoiceBillingProviderTypeAwsMarketplace   InvoiceCorrectionRecordCorrectedExternalInvoiceBillingProviderType = "aws_marketplace"
	InvoiceCorrectionRecordCorrectedExternalInvoiceBillingProviderTypeStripe           InvoiceCorrectionRecordCorrectedExternalInvoiceBillingProviderType = "stripe"
	InvoiceCorrectionRecordCorrectedExternalInvoiceBillingProviderTypeNetsuite         InvoiceCorrectionRecordCorrectedExternalInvoiceBillingProviderType = "netsuite"
	InvoiceCorrectionRecordCorrectedExternalInvoiceBillingProviderTypeCustom           InvoiceCorrectionRecordCorrectedExternalInvoiceBillingProviderType = "custom"
	InvoiceCorrectionRecordCorrectedExternalInvoiceBillingProviderTypeAzureMarketplace InvoiceCorrectionRecordCorrectedExternalInvoiceBillingProviderType = "azure_marketplace"
	InvoiceCorrectionRecordCorrectedExternalInvoiceBillingProviderTypeQuickbooksOnline InvoiceCorrectionRecordCorrectedExternalInvoiceBillingProviderType = "quickbooks_online"
	InvoiceCorrectionRecordCorrectedExternalInvoiceBillingProviderTypeWorkday          InvoiceCorrectionRecordCorrectedExternalInvoiceBillingProviderType = "workday"
	InvoiceCorrectionRecordCorrectedExternalInvoiceBillingProviderTypeGcpMarketplace   InvoiceCorrectionRecordCorrectedExternalInvoiceBillingProviderType = "gcp_marketplace"
)

func (InvoiceCorrectionRecordCorrectedExternalInvoiceBillingProviderType) IsKnown

type InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatus

type InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatus string
const (
	InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatusDraft               InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatus = "DRAFT"
	InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatusFinalized           InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatus = "FINALIZED"
	InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatusPaid                InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatus = "PAID"
	InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatusUncollectible       InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatus = "UNCOLLECTIBLE"
	InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatusVoid                InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatus = "VOID"
	InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatusDeleted             InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatus = "DELETED"
	InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatusPaymentFailed       InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatus = "PAYMENT_FAILED"
	InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatusInvalidRequestError InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatus = "INVALID_REQUEST_ERROR"
	InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatusSkipped             InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatus = "SKIPPED"
	InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatusSent                InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatus = "SENT"
	InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatusQueued              InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatus = "QUEUED"
)

func (InvoiceCorrectionRecordCorrectedExternalInvoiceExternalStatus) IsKnown

type InvoiceExternalInvoice

type InvoiceExternalInvoice struct {
	BillingProviderType InvoiceExternalInvoiceBillingProviderType `json:"billing_provider_type,required"`
	ExternalStatus      InvoiceExternalInvoiceExternalStatus      `json:"external_status"`
	InvoiceID           string                                    `json:"invoice_id"`
	IssuedAtTimestamp   time.Time                                 `json:"issued_at_timestamp" format:"date-time"`
	JSON                invoiceExternalInvoiceJSON                `json:"-"`
}

func (*InvoiceExternalInvoice) UnmarshalJSON

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

type InvoiceExternalInvoiceBillingProviderType

type InvoiceExternalInvoiceBillingProviderType string
const (
	InvoiceExternalInvoiceBillingProviderTypeAwsMarketplace   InvoiceExternalInvoiceBillingProviderType = "aws_marketplace"
	InvoiceExternalInvoiceBillingProviderTypeStripe           InvoiceExternalInvoiceBillingProviderType = "stripe"
	InvoiceExternalInvoiceBillingProviderTypeNetsuite         InvoiceExternalInvoiceBillingProviderType = "netsuite"
	InvoiceExternalInvoiceBillingProviderTypeCustom           InvoiceExternalInvoiceBillingProviderType = "custom"
	InvoiceExternalInvoiceBillingProviderTypeAzureMarketplace InvoiceExternalInvoiceBillingProviderType = "azure_marketplace"
	InvoiceExternalInvoiceBillingProviderTypeQuickbooksOnline InvoiceExternalInvoiceBillingProviderType = "quickbooks_online"
	InvoiceExternalInvoiceBillingProviderTypeWorkday          InvoiceExternalInvoiceBillingProviderType = "workday"
	InvoiceExternalInvoiceBillingProviderTypeGcpMarketplace   InvoiceExternalInvoiceBillingProviderType = "gcp_marketplace"
)

func (InvoiceExternalInvoiceBillingProviderType) IsKnown

type InvoiceExternalInvoiceExternalStatus

type InvoiceExternalInvoiceExternalStatus string
const (
	InvoiceExternalInvoiceExternalStatusDraft               InvoiceExternalInvoiceExternalStatus = "DRAFT"
	InvoiceExternalInvoiceExternalStatusFinalized           InvoiceExternalInvoiceExternalStatus = "FINALIZED"
	InvoiceExternalInvoiceExternalStatusPaid                InvoiceExternalInvoiceExternalStatus = "PAID"
	InvoiceExternalInvoiceExternalStatusUncollectible       InvoiceExternalInvoiceExternalStatus = "UNCOLLECTIBLE"
	InvoiceExternalInvoiceExternalStatusVoid                InvoiceExternalInvoiceExternalStatus = "VOID"
	InvoiceExternalInvoiceExternalStatusDeleted             InvoiceExternalInvoiceExternalStatus = "DELETED"
	InvoiceExternalInvoiceExternalStatusPaymentFailed       InvoiceExternalInvoiceExternalStatus = "PAYMENT_FAILED"
	InvoiceExternalInvoiceExternalStatusInvalidRequestError InvoiceExternalInvoiceExternalStatus = "INVALID_REQUEST_ERROR"
	InvoiceExternalInvoiceExternalStatusSkipped             InvoiceExternalInvoiceExternalStatus = "SKIPPED"
	InvoiceExternalInvoiceExternalStatusSent                InvoiceExternalInvoiceExternalStatus = "SENT"
	InvoiceExternalInvoiceExternalStatusQueued              InvoiceExternalInvoiceExternalStatus = "QUEUED"
)

func (InvoiceExternalInvoiceExternalStatus) IsKnown

type InvoiceInvoiceAdjustment

type InvoiceInvoiceAdjustment struct {
	CreditType              shared.CreditType            `json:"credit_type,required"`
	Name                    string                       `json:"name,required"`
	Total                   float64                      `json:"total,required"`
	CreditGrantCustomFields map[string]string            `json:"credit_grant_custom_fields"`
	CreditGrantID           string                       `json:"credit_grant_id"`
	JSON                    invoiceInvoiceAdjustmentJSON `json:"-"`
}

func (*InvoiceInvoiceAdjustment) UnmarshalJSON

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

type InvoiceLineItem

type InvoiceLineItem struct {
	CreditType         shared.CreditType `json:"credit_type,required"`
	Name               string            `json:"name,required"`
	Total              float64           `json:"total,required"`
	CommitCustomFields map[string]string `json:"commit_custom_fields"`
	// only present for beta contract invoices
	CommitID string `json:"commit_id" format:"uuid"`
	// only present for beta contract invoices. This field's availability is dependent
	// on your client's configuration.
	CommitNetsuiteItemID string `json:"commit_netsuite_item_id"`
	// only present for beta contract invoices. This field's availability is dependent
	// on your client's configuration.
	CommitNetsuiteSalesOrderID string `json:"commit_netsuite_sales_order_id"`
	// only present for beta contract invoices
	CommitSegmentID string `json:"commit_segment_id" format:"uuid"`
	// only present for beta contract invoices
	CommitType   string            `json:"commit_type"`
	CustomFields map[string]string `json:"custom_fields"`
	// only present for beta contract invoices
	EndingBefore time.Time `json:"ending_before" format:"date-time"`
	GroupKey     string    `json:"group_key"`
	GroupValue   string    `json:"group_value,nullable"`
	// only present for beta contract invoices
	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"`
	// only present for beta contract invoices. This field's availability is dependent
	// on your client's configuration.
	NetsuiteItemID string `json:"netsuite_item_id"`
	// only present for beta contract invoices
	PostpaidCommit InvoiceLineItemsPostpaidCommit `json:"postpaid_commit"`
	// if presentation groups are used, this will contain the values used to break down
	// the line item
	PresentationGroupValues map[string]string `json:"presentation_group_values"`
	// if pricing groups are used, this will contain the values used to calculate the
	// price
	PricingGroupValues              map[string]string `json:"pricing_group_values"`
	ProductCustomFields             map[string]string `json:"product_custom_fields"`
	ProductID                       string            `json:"product_id" format:"uuid"`
	ProductType                     string            `json:"product_type"`
	ProfessionalServiceCustomFields map[string]string `json:"professional_service_custom_fields"`
	// only present for beta contract invoices
	ProfessionalServiceID       string                       `json:"professional_service_id" format:"uuid"`
	Quantity                    float64                      `json:"quantity"`
	ResellerType                InvoiceLineItemsResellerType `json:"reseller_type"`
	ScheduledChargeCustomFields map[string]string            `json:"scheduled_charge_custom_fields"`
	// only present for beta contract invoices
	ScheduledChargeID string `json:"scheduled_charge_id" format:"uuid"`
	// only present for beta contract invoices
	StartingAt   time.Time                     `json:"starting_at" format:"date-time"`
	SubLineItems []InvoiceLineItemsSubLineItem `json:"sub_line_items"`
	// only present for beta contract invoices
	UnitPrice float64             `json:"unit_price"`
	JSON      invoiceLineItemJSON `json:"-"`
}

func (*InvoiceLineItem) UnmarshalJSON

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

type InvoiceLineItemsPostpaidCommit

type InvoiceLineItemsPostpaidCommit struct {
	ID   string                             `json:"id,required" format:"uuid"`
	JSON invoiceLineItemsPostpaidCommitJSON `json:"-"`
}

only present for beta contract invoices

func (*InvoiceLineItemsPostpaidCommit) UnmarshalJSON

func (r *InvoiceLineItemsPostpaidCommit) UnmarshalJSON(data []byte) (err error)

type InvoiceLineItemsResellerType

type InvoiceLineItemsResellerType string
const (
	InvoiceLineItemsResellerTypeAws           InvoiceLineItemsResellerType = "AWS"
	InvoiceLineItemsResellerTypeAwsProService InvoiceLineItemsResellerType = "AWS_PRO_SERVICE"
	InvoiceLineItemsResellerTypeGcp           InvoiceLineItemsResellerType = "GCP"
	InvoiceLineItemsResellerTypeGcpProService InvoiceLineItemsResellerType = "GCP_PRO_SERVICE"
)

func (InvoiceLineItemsResellerType) IsKnown

func (r InvoiceLineItemsResellerType) IsKnown() bool

type InvoiceLineItemsSubLineItem

type InvoiceLineItemsSubLineItem struct {
	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 InvoiceLineItemsSubLineItemsTierPeriod `json:"tier_period"`
	Tiers      []InvoiceLineItemsSubLineItemsTier     `json:"tiers"`
	JSON       invoiceLineItemsSubLineItemJSON        `json:"-"`
}

func (*InvoiceLineItemsSubLineItem) UnmarshalJSON

func (r *InvoiceLineItemsSubLineItem) UnmarshalJSON(data []byte) (err error)

type InvoiceLineItemsSubLineItemsTier

type InvoiceLineItemsSubLineItemsTier 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       invoiceLineItemsSubLineItemsTierJSON `json:"-"`
}

func (*InvoiceLineItemsSubLineItemsTier) UnmarshalJSON

func (r *InvoiceLineItemsSubLineItemsTier) UnmarshalJSON(data []byte) (err error)

type InvoiceLineItemsSubLineItemsTierPeriod

type InvoiceLineItemsSubLineItemsTierPeriod struct {
	StartingAt   time.Time                                  `json:"starting_at,required" format:"date-time"`
	EndingBefore time.Time                                  `json:"ending_before" format:"date-time"`
	JSON         invoiceLineItemsSubLineItemsTierPeriodJSON `json:"-"`
}

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

func (*InvoiceLineItemsSubLineItemsTierPeriod) UnmarshalJSON

func (r *InvoiceLineItemsSubLineItemsTierPeriod) UnmarshalJSON(data []byte) (err error)

type InvoiceRegenerateParams

type InvoiceRegenerateParams struct {
	// The invoice id to regenerate
	ID param.Field[string] `json:"id,required" format:"uuid"`
}

func (InvoiceRegenerateParams) MarshalJSON

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

type InvoiceRegenerateResponse

type InvoiceRegenerateResponse struct {
	Data InvoiceRegenerateResponseData `json:"data"`
	JSON invoiceRegenerateResponseJSON `json:"-"`
}

func (*InvoiceRegenerateResponse) UnmarshalJSON

func (r *InvoiceRegenerateResponse) UnmarshalJSON(data []byte) (err error)

type InvoiceRegenerateResponseData

type InvoiceRegenerateResponseData struct {
	// The new invoice id
	ID   string                            `json:"id,required" format:"uuid"`
	JSON invoiceRegenerateResponseDataJSON `json:"-"`
}

func (*InvoiceRegenerateResponseData) UnmarshalJSON

func (r *InvoiceRegenerateResponseData) UnmarshalJSON(data []byte) (err error)

type InvoiceResellerRoyalty

type InvoiceResellerRoyalty struct {
	Fraction           string                             `json:"fraction,required"`
	NetsuiteResellerID string                             `json:"netsuite_reseller_id,required"`
	ResellerType       InvoiceResellerRoyaltyResellerType `json:"reseller_type,required"`
	AwsOptions         InvoiceResellerRoyaltyAwsOptions   `json:"aws_options"`
	GcpOptions         InvoiceResellerRoyaltyGcpOptions   `json:"gcp_options"`
	JSON               invoiceResellerRoyaltyJSON         `json:"-"`
}

only present for beta contract invoices with reseller royalties

func (*InvoiceResellerRoyalty) UnmarshalJSON

func (r *InvoiceResellerRoyalty) UnmarshalJSON(data []byte) (err 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                invoiceResellerRoyaltyAwsOptionsJSON `json:"-"`
}

func (*InvoiceResellerRoyaltyAwsOptions) UnmarshalJSON

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

type InvoiceResellerRoyaltyGcpOptions

type InvoiceResellerRoyaltyGcpOptions struct {
	GcpAccountID string                               `json:"gcp_account_id"`
	GcpOfferID   string                               `json:"gcp_offer_id"`
	JSON         invoiceResellerRoyaltyGcpOptionsJSON `json:"-"`
}

func (*InvoiceResellerRoyaltyGcpOptions) UnmarshalJSON

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

type InvoiceResellerRoyaltyResellerType

type InvoiceResellerRoyaltyResellerType string
const (
	InvoiceResellerRoyaltyResellerTypeAws           InvoiceResellerRoyaltyResellerType = "AWS"
	InvoiceResellerRoyaltyResellerTypeAwsProService InvoiceResellerRoyaltyResellerType = "AWS_PRO_SERVICE"
	InvoiceResellerRoyaltyResellerTypeGcp           InvoiceResellerRoyaltyResellerType = "GCP"
	InvoiceResellerRoyaltyResellerTypeGcpProService InvoiceResellerRoyaltyResellerType = "GCP_PRO_SERVICE"
)

func (InvoiceResellerRoyaltyResellerType) IsKnown

type InvoiceService

type InvoiceService struct {
	Options []option.RequestOption
}

InvoiceService 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 NewInvoiceService method instead.

func NewInvoiceService

func NewInvoiceService(opts ...option.RequestOption) (r *InvoiceService)

NewInvoiceService 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 (*InvoiceService) Regenerate

Regenerate a voided contract invoice

func (*InvoiceService) Void

Void an invoice

type InvoiceVoidParams

type InvoiceVoidParams struct {
	// The invoice id to void
	ID param.Field[string] `json:"id,required" format:"uuid"`
}

func (InvoiceVoidParams) MarshalJSON

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

type InvoiceVoidResponse

type InvoiceVoidResponse struct {
	Data InvoiceVoidResponseData `json:"data"`
	JSON invoiceVoidResponseJSON `json:"-"`
}

func (*InvoiceVoidResponse) UnmarshalJSON

func (r *InvoiceVoidResponse) UnmarshalJSON(data []byte) (err error)

type InvoiceVoidResponseData

type InvoiceVoidResponseData struct {
	ID   string                      `json:"id,required" format:"uuid"`
	JSON invoiceVoidResponseDataJSON `json:"-"`
}

func (*InvoiceVoidResponseData) UnmarshalJSON

func (r *InvoiceVoidResponseData) UnmarshalJSON(data []byte) (err 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 OverrideOverrideTier

type OverrideOverrideTier = shared.OverrideOverrideTier

This is an alias to an internal type.

type OverrideOverwriteRate

type OverrideOverwriteRate = shared.OverrideOverwriteRate

This is an alias to an internal type.

type OverrideOverwriteRateRateType

type OverrideOverwriteRateRateType = shared.OverrideOverwriteRateRateType

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 OverrideType

type OverrideType = shared.OverrideType

This is an alias to an internal type.

type PlanDetail

type PlanDetail struct {
	ID           string                  `json:"id,required" format:"uuid"`
	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         planDetailJSON          `json:"-"`
}

func (*PlanDetail) UnmarshalJSON

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

type PlanDetailCreditGrant

type PlanDetailCreditGrant struct {
	AmountGranted           float64                   `json:"amount_granted,required"`
	AmountGrantedCreditType shared.CreditType         `json:"amount_granted_credit_type,required"`
	AmountPaid              float64                   `json:"amount_paid,required"`
	AmountPaidCreditType    shared.CreditType         `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                    planDetailCreditGrantJSON `json:"-"`
}

func (*PlanDetailCreditGrant) UnmarshalJSON

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

type PlanDetailMinimum

type PlanDetailMinimum struct {
	CreditType shared.CreditType `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        planDetailMinimumJSON `json:"-"`
}

func (*PlanDetailMinimum) UnmarshalJSON

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

type PlanDetailOverageRate

type PlanDetailOverageRate struct {
	CreditType     shared.CreditType `json:"credit_type,required"`
	FiatCreditType shared.CreditType `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                   planDetailOverageRateJSON `json:"-"`
}

func (*PlanDetailOverageRate) UnmarshalJSON

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

type PlanGetDetailsResponse

type PlanGetDetailsResponse struct {
	Data PlanDetail                 `json:"data,required"`
	JSON planGetDetailsResponseJSON `json:"-"`
}

func (*PlanGetDetailsResponse) UnmarshalJSON

func (r *PlanGetDetailsResponse) UnmarshalJSON(data []byte) (err error)

type PlanListChargesParams

type PlanListChargesParams struct {
	// Max number of results that should be returned
	Limit param.Field[int64] `query:"limit"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
}

func (PlanListChargesParams) URLQuery

func (r PlanListChargesParams) URLQuery() (v url.Values)

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

type PlanListChargesResponse

type PlanListChargesResponse struct {
	ID           string                            `json:"id,required" format:"uuid"`
	ChargeType   PlanListChargesResponseChargeType `json:"charge_type,required"`
	CreditType   shared.CreditType                 `json:"credit_type,required"`
	CustomFields map[string]string                 `json:"custom_fields,required"`
	Name         string                            `json:"name,required"`
	Prices       []PlanListChargesResponsePrice    `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 PlanListChargesResponseUnitConversion `json:"unit_conversion"`
	JSON           planListChargesResponseJSON           `json:"-"`
}

func (*PlanListChargesResponse) UnmarshalJSON

func (r *PlanListChargesResponse) UnmarshalJSON(data []byte) (err error)

type PlanListChargesResponseChargeType

type PlanListChargesResponseChargeType string
const (
	PlanListChargesResponseChargeTypeUsage     PlanListChargesResponseChargeType = "usage"
	PlanListChargesResponseChargeTypeFixed     PlanListChargesResponseChargeType = "fixed"
	PlanListChargesResponseChargeTypeComposite PlanListChargesResponseChargeType = "composite"
	PlanListChargesResponseChargeTypeMinimum   PlanListChargesResponseChargeType = "minimum"
	PlanListChargesResponseChargeTypeSeat      PlanListChargesResponseChargeType = "seat"
)

func (PlanListChargesResponseChargeType) IsKnown

type PlanListChargesResponsePrice

type PlanListChargesResponsePrice 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               planListChargesResponsePriceJSON `json:"-"`
}

func (*PlanListChargesResponsePrice) UnmarshalJSON

func (r *PlanListChargesResponsePrice) UnmarshalJSON(data []byte) (err error)

type PlanListChargesResponseUnitConversion

type PlanListChargesResponseUnitConversion 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.
	RoundingBehavior PlanListChargesResponseUnitConversionRoundingBehavior `json:"rounding_behavior"`
	JSON             planListChargesResponseUnitConversionJSON             `json:"-"`
}

Specifies how quantities for usage based charges will be converted.

func (*PlanListChargesResponseUnitConversion) UnmarshalJSON

func (r *PlanListChargesResponseUnitConversion) UnmarshalJSON(data []byte) (err error)

type PlanListChargesResponseUnitConversionRoundingBehavior

type PlanListChargesResponseUnitConversionRoundingBehavior string

Whether usage should be rounded down or up to the nearest whole number. If null, quantity will be rounded to 20 decimal places.

const (
	PlanListChargesResponseUnitConversionRoundingBehaviorFloor   PlanListChargesResponseUnitConversionRoundingBehavior = "floor"
	PlanListChargesResponseUnitConversionRoundingBehaviorCeiling PlanListChargesResponseUnitConversionRoundingBehavior = "ceiling"
)

func (PlanListChargesResponseUnitConversionRoundingBehavior) IsKnown

type PlanListCustomersParams

type PlanListCustomersParams struct {
	// Max number of results that should be returned
	Limit param.Field[int64] `query:"limit"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
	// 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.
	Status param.Field[PlanListCustomersParamsStatus] `query:"status"`
}

func (PlanListCustomersParams) URLQuery

func (r PlanListCustomersParams) URLQuery() (v url.Values)

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

type PlanListCustomersParamsStatus

type PlanListCustomersParamsStatus 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 (
	PlanListCustomersParamsStatusAll      PlanListCustomersParamsStatus = "all"
	PlanListCustomersParamsStatusActive   PlanListCustomersParamsStatus = "active"
	PlanListCustomersParamsStatusEnded    PlanListCustomersParamsStatus = "ended"
	PlanListCustomersParamsStatusUpcoming PlanListCustomersParamsStatus = "upcoming"
)

func (PlanListCustomersParamsStatus) IsKnown

func (r PlanListCustomersParamsStatus) IsKnown() bool

type PlanListCustomersResponse

type PlanListCustomersResponse struct {
	CustomerDetails CustomerDetail                       `json:"customer_details,required"`
	PlanDetails     PlanListCustomersResponsePlanDetails `json:"plan_details,required"`
	JSON            planListCustomersResponseJSON        `json:"-"`
}

func (*PlanListCustomersResponse) UnmarshalJSON

func (r *PlanListCustomersResponse) UnmarshalJSON(data []byte) (err error)

type PlanListCustomersResponsePlanDetails

type PlanListCustomersResponsePlanDetails struct {
	ID             string            `json:"id,required" format:"uuid"`
	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         planListCustomersResponsePlanDetailsJSON `json:"-"`
}

func (*PlanListCustomersResponsePlanDetails) UnmarshalJSON

func (r *PlanListCustomersResponsePlanDetails) UnmarshalJSON(data []byte) (err error)

type PlanListParams

type PlanListParams struct {
	// Max number of results that should be returned
	Limit param.Field[int64] `query:"limit"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
}

func (PlanListParams) URLQuery

func (r PlanListParams) URLQuery() (v url.Values)

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

type PlanListResponse

type PlanListResponse struct {
	ID           string               `json:"id,required" format:"uuid"`
	Description  string               `json:"description,required"`
	Name         string               `json:"name,required"`
	CustomFields map[string]string    `json:"custom_fields"`
	JSON         planListResponseJSON `json:"-"`
}

func (*PlanListResponse) UnmarshalJSON

func (r *PlanListResponse) UnmarshalJSON(data []byte) (err error)

type PlanService

type PlanService struct {
	Options []option.RequestOption
}

PlanService 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 NewPlanService method instead.

func NewPlanService

func NewPlanService(opts ...option.RequestOption) (r *PlanService)

NewPlanService 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 (*PlanService) GetDetails

func (r *PlanService) GetDetails(ctx context.Context, planID string, opts ...option.RequestOption) (res *PlanGetDetailsResponse, err error)

Fetch high level details of a specific plan.

func (*PlanService) List

List all available plans.

func (*PlanService) ListAutoPaging

List all available plans.

func (*PlanService) ListCharges

Fetches a list of charges of a specific plan.

func (*PlanService) ListChargesAutoPaging

Fetches a list of charges of a specific plan.

func (*PlanService) ListCustomers

Fetches a list of customers on a specific plan (by default, only currently active plans are included)

func (*PlanService) ListCustomersAutoPaging

Fetches a list of customers on a specific plan (by default, only currently active plans are included)

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.
	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.
	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             productListItemStateJSON `json:"-"`
}

func (*ProductListItemState) UnmarshalJSON

func (r *ProductListItemState) UnmarshalJSON(data []byte) (err 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
	Operation QuantityConversionOperation `json:"operation,required"`
	// Optional name for this conversion.
	Name string                 `json:"name"`
	JSON quantityConversionJSON `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) UnmarshalJSON

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

type QuantityConversionOperation

type QuantityConversionOperation string

The operation to perform on the quantity

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

func (QuantityConversionOperation) IsKnown

func (r QuantityConversionOperation) IsKnown() bool

type QuantityConversionParam

type QuantityConversionParam struct {
	// The factor to multiply or divide the quantity by.
	ConversionFactor param.Field[float64] `json:"conversion_factor,required"`
	// The operation to perform on the quantity
	Operation param.Field[QuantityConversionOperation] `json:"operation,required"`
	// Optional name for this conversion.
	Name param.Field[string] `json:"name"`
}

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 (QuantityConversionParam) MarshalJSON

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

type QuantityRounding

type QuantityRounding struct {
	DecimalPlaces  float64                        `json:"decimal_places,required"`
	RoundingMethod QuantityRoundingRoundingMethod `json:"rounding_method,required"`
	JSON           quantityRoundingJSON           `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) UnmarshalJSON

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

type QuantityRoundingParam

type QuantityRoundingParam struct {
	DecimalPlaces  param.Field[float64]                        `json:"decimal_places,required"`
	RoundingMethod param.Field[QuantityRoundingRoundingMethod] `json:"rounding_method,required"`
}

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 (QuantityRoundingParam) MarshalJSON

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

type QuantityRoundingRoundingMethod

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

func (QuantityRoundingRoundingMethod) IsKnown

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 RolloverAmountMaxAmountParam

type RolloverAmountMaxAmountParam struct {
	// Rollover up to a fixed amount of the original credit grant amount.
	Type param.Field[RolloverAmountMaxAmountType] `json:"type,required"`
	// The maximum amount to rollover.
	Value param.Field[float64] `json:"value,required"`
}

func (RolloverAmountMaxAmountParam) MarshalJSON

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

type RolloverAmountMaxAmountType

type RolloverAmountMaxAmountType string

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

const (
	RolloverAmountMaxAmountTypeMaxAmount RolloverAmountMaxAmountType = "MAX_AMOUNT"
)

func (RolloverAmountMaxAmountType) IsKnown

func (r RolloverAmountMaxAmountType) IsKnown() bool

type RolloverAmountMaxPercentageParam

type RolloverAmountMaxPercentageParam struct {
	// Rollover up to a percentage of the original credit grant amount.
	Type param.Field[RolloverAmountMaxPercentageType] `json:"type,required"`
	// The maximum percentage (0-1) of the original credit grant to rollover.
	Value param.Field[float64] `json:"value,required"`
}

func (RolloverAmountMaxPercentageParam) MarshalJSON

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

type RolloverAmountMaxPercentageType

type RolloverAmountMaxPercentageType string

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

const (
	RolloverAmountMaxPercentageTypeMaxPercentage RolloverAmountMaxPercentageType = "MAX_PERCENTAGE"
)

func (RolloverAmountMaxPercentageType) IsKnown

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 ServiceListResponse

type ServiceListResponse struct {
	Services []ServiceListResponseService `json:"services,required"`
	JSON     serviceListResponseJSON      `json:"-"`
}

func (*ServiceListResponse) UnmarshalJSON

func (r *ServiceListResponse) UnmarshalJSON(data []byte) (err error)

type ServiceListResponseService

type ServiceListResponseService struct {
	IPs   []string                         `json:"ips,required"`
	Name  string                           `json:"name,required"`
	Usage ServiceListResponseServicesUsage `json:"usage,required"`
	JSON  serviceListResponseServiceJSON   `json:"-"`
}

func (*ServiceListResponseService) UnmarshalJSON

func (r *ServiceListResponseService) UnmarshalJSON(data []byte) (err error)

type ServiceListResponseServicesUsage

type ServiceListResponseServicesUsage string
const (
	ServiceListResponseServicesUsageMakesConnectionsFrom ServiceListResponseServicesUsage = "makes_connections_from"
	ServiceListResponseServicesUsageAcceptsConnectionsAt ServiceListResponseServicesUsage = "accepts_connections_at"
)

func (ServiceListResponseServicesUsage) IsKnown

type ServiceService

type ServiceService struct {
	Options []option.RequestOption
}

ServiceService 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 NewServiceService method instead.

func NewServiceService

func NewServiceService(opts ...option.RequestOption) (r *ServiceService)

NewServiceService 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 (*ServiceService) List

func (r *ServiceService) List(ctx context.Context, opts ...option.RequestOption) (res *ServiceListResponse, err error)

Fetches a list of services used by Metronome and the associated IP addresses. IP addresses are not necessarily unique between services. In most cases, IP addresses will appear in the list at least 30 days before they are used for the first time.

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 UsageIngestParams

type UsageIngestParams struct {
	Usage []UsageIngestParamsUsage `json:"usage,required"`
}

func (UsageIngestParams) MarshalJSON

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

type UsageIngestParamsUsage

type UsageIngestParamsUsage struct {
	CustomerID param.Field[string] `json:"customer_id,required"`
	EventType  param.Field[string] `json:"event_type,required"`
	// RFC 3339 formatted
	Timestamp     param.Field[string]                 `json:"timestamp,required"`
	TransactionID param.Field[string]                 `json:"transaction_id,required"`
	Properties    param.Field[map[string]interface{}] `json:"properties"`
}

func (UsageIngestParamsUsage) MarshalJSON

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

type UsageListParams

type UsageListParams struct {
	EndingBefore param.Field[time.Time] `json:"ending_before,required" format:"date-time"`
	StartingOn   param.Field[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.
	WindowSize param.Field[UsageListParamsWindowSize] `json:"window_size,required"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
	// A list of billable metrics to fetch usage for. If absent, all billable metrics
	// will be returned.
	BillableMetrics param.Field[[]UsageListParamsBillableMetric] `json:"billable_metrics"`
	// A list of Metronome customer IDs to fetch usage for. If absent, usage for all
	// customers will be returned.
	CustomerIDs param.Field[[]string] `json:"customer_ids" format:"uuid"`
}

func (UsageListParams) MarshalJSON

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

func (UsageListParams) URLQuery

func (r UsageListParams) URLQuery() (v url.Values)

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

type UsageListParamsBillableMetric

type UsageListParamsBillableMetric struct {
	ID      param.Field[string]                                `json:"id,required" format:"uuid"`
	GroupBy param.Field[UsageListParamsBillableMetricsGroupBy] `json:"group_by"`
}

func (UsageListParamsBillableMetric) MarshalJSON

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

type UsageListParamsBillableMetricsGroupBy

type UsageListParamsBillableMetricsGroupBy struct {
	// The name of the group_by key to use
	Key param.Field[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 param.Field[[]string] `json:"values"`
}

func (UsageListParamsBillableMetricsGroupBy) MarshalJSON

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

type UsageListParamsWindowSize

type UsageListParamsWindowSize 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 (
	UsageListParamsWindowSizeHour UsageListParamsWindowSize = "HOUR"
	UsageListParamsWindowSizeDay  UsageListParamsWindowSize = "DAY"
	UsageListParamsWindowSizeNone UsageListParamsWindowSize = "NONE"
)

func (UsageListParamsWindowSize) IsKnown

func (r UsageListParamsWindowSize) IsKnown() bool

type UsageListResponse

type UsageListResponse struct {
	Data     []UsageListResponseData `json:"data,required"`
	NextPage string                  `json:"next_page,required,nullable"`
	JSON     usageListResponseJSON   `json:"-"`
}

func (*UsageListResponse) UnmarshalJSON

func (r *UsageListResponse) UnmarshalJSON(data []byte) (err error)

type UsageListResponseData

type UsageListResponseData 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,nullable"`
	// 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   usageListResponseDataJSON `json:"-"`
}

func (*UsageListResponseData) UnmarshalJSON

func (r *UsageListResponseData) UnmarshalJSON(data []byte) (err error)

type UsageListWithGroupsParams

type UsageListWithGroupsParams struct {
	BillableMetricID param.Field[string] `json:"billable_metric_id,required" format:"uuid"`
	CustomerID       param.Field[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.
	WindowSize param.Field[UsageListWithGroupsParamsWindowSize] `json:"window_size,required"`
	// Max number of results that should be returned
	Limit param.Field[int64] `query:"limit"`
	// Cursor that indicates where the next page of results should start.
	NextPage param.Field[string] `query:"next_page"`
	// 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.Field[bool]                             `json:"current_period"`
	EndingBefore  param.Field[time.Time]                        `json:"ending_before" format:"date-time"`
	GroupBy       param.Field[UsageListWithGroupsParamsGroupBy] `json:"group_by"`
	StartingOn    param.Field[time.Time]                        `json:"starting_on" format:"date-time"`
}

func (UsageListWithGroupsParams) MarshalJSON

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

func (UsageListWithGroupsParams) URLQuery

func (r UsageListWithGroupsParams) URLQuery() (v url.Values)

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

type UsageListWithGroupsParamsGroupBy

type UsageListWithGroupsParamsGroupBy struct {
	// The name of the group_by key to use
	Key param.Field[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 param.Field[[]string] `json:"values"`
}

func (UsageListWithGroupsParamsGroupBy) MarshalJSON

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

type UsageListWithGroupsParamsWindowSize

type UsageListWithGroupsParamsWindowSize 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 (
	UsageListWithGroupsParamsWindowSizeHour UsageListWithGroupsParamsWindowSize = "HOUR"
	UsageListWithGroupsParamsWindowSizeDay  UsageListWithGroupsParamsWindowSize = "DAY"
	UsageListWithGroupsParamsWindowSizeNone UsageListWithGroupsParamsWindowSize = "NONE"
)

func (UsageListWithGroupsParamsWindowSize) IsKnown

type UsageListWithGroupsResponse

type UsageListWithGroupsResponse struct {
	EndingBefore time.Time                       `json:"ending_before,required" format:"date-time"`
	GroupKey     string                          `json:"group_key,required,nullable"`
	GroupValue   string                          `json:"group_value,required,nullable"`
	StartingOn   time.Time                       `json:"starting_on,required" format:"date-time"`
	Value        float64                         `json:"value,required,nullable"`
	JSON         usageListWithGroupsResponseJSON `json:"-"`
}

func (*UsageListWithGroupsResponse) UnmarshalJSON

func (r *UsageListWithGroupsResponse) UnmarshalJSON(data []byte) (err error)

type UsageService

type UsageService struct {
	Options []option.RequestOption
}

UsageService 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 NewUsageService method instead.

func NewUsageService

func NewUsageService(opts ...option.RequestOption) (r *UsageService)

NewUsageService 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 (*UsageService) Ingest

func (r *UsageService) Ingest(ctx context.Context, body UsageIngestParams, opts ...option.RequestOption) (err error)

Send usage events to Metronome. The body of this request is expected to be a JSON array of between 1 and 100 usage events. Compressed request bodies are supported with a `Content-Encoding: gzip` header. See [Getting usage into Metronome](https://docs.metronome.com/getting-usage-data-into-metronome/overview) to learn more about usage events.

func (*UsageService) List

func (r *UsageService) List(ctx context.Context, params UsageListParams, opts ...option.RequestOption) (res *UsageListResponse, err error)

Fetch aggregated usage data for multiple customers and billable-metrics, broken into intervals of the specified length.

func (*UsageService) ListWithGroups

Fetch aggregated usage data for the specified customer, billable-metric, and optional group, broken into intervals of the specified length.

func (*UsageService) ListWithGroupsAutoPaging

Fetch aggregated usage data for the specified customer, billable-metric, and optional group, broken into intervals of the specified length.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL