meteroid

package module
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

README ¶

Meteroid Go SDK

The official Go SDK for Meteroid, the open-source billing and pricing platform. Meteroid manages subscriptions, usage-based billing and metering, invoicing and revenue analytics; this library calls its REST API and verifies its webhooks, against Meteroid Cloud (https://api.meteroid.com) or a self-hosted instance.

Website · Documentation · API reference · Meteroid on GitHub

Requires Go 1.23 or later.

go get github.com/meteroid-oss/meteroid-go

Every method of the API is listed in api.md.

Usage

import meteroid "github.com/meteroid-oss/meteroid-go"

client := meteroid.New("your-api-key", nil)

addOn, err := client.AddOns().Retrieve(ctx, "addon_id")
if err != nil {
	return err
}
fmt.Println(addOn)

Every API area hangs off the client as an accessor method, and every method takes a context.Context first. Required parameters are arguments; optional ones go in an options struct whose fields are pointers (meteroid.Ptr(v)), nil to send none. Request bodies are structs of the package:

onboardingLinkResponse, err := client.Connect().CreateOnboardingLink(ctx, "id", meteroid.CreateOnboardingLinkRequest{RedirectURL: "redirect_url"})

Models keep the properties this SDK version does not know in ExtraFields, and send them back.

Environment

New("", nil) reads the token from METEROID_API_KEY, and METEROID_BASE_URL overrides the default server. Explicit arguments win: meteroid.New(token, &meteroid.Options{ServerURL: "https://..."}). The default server, meteroid.DefaultServerURL, is https://api.meteroid.com.

Errors

Every error is a meteroid.SDKError. A non-2xx response is an *meteroid.APIError, whose Body is the error body decoded as the schema the operation declares (else plain JSON); a timeout is a *TimeoutError, a failed connection a *TransportError, an undecodable response a *DecodeError:

_, err := client.AddOns().Retrieve(ctx, "addon_id")
var apiErr *meteroid.APIError
switch {
case errors.Is(err, meteroid.ErrNotFound):
	// ...
case errors.As(err, &apiErr):
	log.Printf("status %d, request %s", apiErr.StatusCode, apiErr.RequestID())
}
Pagination

A list method returns its first page, a *meteroid.AddOnsListPage. The page embeds the decoded AddOnListResponse response, so its fields read directly on the page, and holds its Items; HasNextPage() and NextPage(ctx) step to the next page, nil after the last one. A response field named like one of these members stays reachable through the embedded response, page.AddOnListResponse:

page, err := client.AddOns().List(ctx, nil)
for page != nil && err == nil {
	// page.PaginationMeta.TotalPages, page.Items, page.HasNextPage()
	page, err = page.NextPage(ctx)
}

Its ...AutoPaging twin returns an *AutoPager[T] over every item, fetching further pages on demand:

for addOn, err := range client.AddOns().ListAutoPaging(ctx, nil).All() {
	if err != nil {
		return err
	}
	fmt.Println(addOn)
}

Without range, loop on the pager's Next(), read Current(), then check Err().

Raw responses

WithResponseInto gives the *http.Response of a call, for its status and headers:

var resp *http.Response
addOn, err := client.AddOns().Retrieve(ctx, "addon_id", meteroid.WithResponseInto(&resp))
log.Print(resp.Header.Get("X-Request-Id"))
Retries and timeouts

Connection errors, timeouts, 408, 429 and 5xx responses are retried twice with jittered backoff, honoring Retry-After and retry-after-ms, when the request is idempotent or carries an Idempotency-Key. Each attempt times out after DefaultTimeout. Options sets them for the client (MaxRetries, Timeout), and request options for one call: meteroid.WithMaxRetries(0), meteroid.WithTimeout(time.Minute), meteroid.WithIdempotencyKey(key), meteroid.WithHeader(name, value). Options.Logger logs every attempt at debug level.

addOn, err := client.AddOns().Retrieve(ctx, "addon_id", meteroid.WithMaxRetries(0), meteroid.WithTimeout(5*time.Second))

Generated by perseid.

Documentation ¶

Overview ¶

Package meteroid is the Go SDK for the Meteroid API.

The entry point is New, which returns a Client. Every API area hangs off the client as an accessor method, and every method takes a context first and trailing RequestOption values, such as WithTimeout or WithResponseInto:

client := meteroid.New("", nil) // reads METEROID_API_KEY

METEROID_BASE_URL, or Options.ServerURL, overrides the API's default server. When the API declares none, calls fail with a *RequestError until one of them is set.

Optional request fields and query parameters are pointers, see Ptr: a nil pointer means "not sent". Required fields and parameters are plain values. Models keep the properties this SDK version does not know in ExtraFields.

Every error is an SDKError. One returned for a non-2xx response is an *APIError: errors.Is matches it against status sentinels such as ErrNotFound, and its Body holds the decoded error body.

List operations return their first page, which embeds the decoded response and holds its Items, HasNextPage and NextPage, and have a ...AutoPaging twin returning an AutoPager over every item. Event streams are a Stream of decoded events, or an EventStream of raw ones.

Index ¶

Constants ¶

View Source
const (
	// DefaultServerURL is the Meteroid API endpoint used when neither
	// Options.ServerURL nor the METEROID_BASE_URL environment variable is
	// set. Empty when the API declares no server: calls then fail with a
	// [*RequestError] until one of them is set.
	DefaultServerURL = "https://api.meteroid.com"

	// DefaultMaxRetries is how many times a request is retried when it fails
	// transiently: connection errors, timeouts, 408, 429 and 5xx responses, as
	// long as the request is idempotent or carries an Idempotency-Key, which POSTs get when
	// the API deduplicates by it.
	DefaultMaxRetries = 2

	// APIKeyEnv names the environment variable [New] reads the API token from
	// when it is given an empty one.
	APIKeyEnv = "METEROID_API_KEY"

	// ClientIDEnv names the environment variable [New] reads the OAuth2 client id from when
	// Options.ClientID is empty.
	ClientIDEnv = "METEROID_CLIENT_ID"

	// ClientSecretEnv names the environment variable [New] reads the OAuth2 client secret from
	// when Options.ClientSecret is empty.
	ClientSecretEnv = "METEROID_CLIENT_SECRET"

	// BaseURLEnv names the environment variable that overrides
	// DefaultServerURL when Options.ServerURL is empty.
	BaseURLEnv = "METEROID_BASE_URL"
)
View Source
const DefaultTimeout = 60 * time.Second

DefaultTimeout bounds a single request attempt, response body included.

View Source
const Version = "0.30.0"

Version is the version of this SDK, sent in the User-Agent header.

View Source
const WebhookSecretPrefix = "whsec_"

WebhookSecretPrefix is the optional prefix of webhook signing secrets.

View Source
const WebhookTolerance = 5 * time.Minute

WebhookTolerance is how far the signed timestamp may drift from the current time.

Variables ¶

View Source
var (
	ErrBadRequest          error = &statusError{"bad request", 400, 400}
	ErrUnauthorized        error = &statusError{"unauthorized", 401, 401}
	ErrForbidden           error = &statusError{"forbidden", 403, 403}
	ErrNotFound            error = &statusError{"not found", 404, 404}
	ErrConflict            error = &statusError{"conflict", 409, 409}
	ErrUnprocessableEntity error = &statusError{"unprocessable entity", 422, 422}
	ErrRateLimited         error = &statusError{"rate limited", 429, 429}
	ErrServer              error = &statusError{"server error", 500, 599}
)

Sentinels that errors.Is matches against the status of an *APIError:

if errors.Is(err, meteroid.ErrNotFound) {
	// ...
}
View Source
var (
	ErrWebhookMissingHeaders      = errors.New("meteroid: missing webhook signature headers")
	ErrWebhookInvalidTimestamp    = errors.New("meteroid: invalid webhook timestamp header")
	ErrWebhookTimestampTooOld     = errors.New("meteroid: webhook timestamp is too old")
	ErrWebhookTimestampTooNew     = errors.New("meteroid: webhook timestamp is too far in the future")
	ErrWebhookNoMatchingSignature = errors.New("meteroid: no matching webhook signature")
)

Errors returned by Webhook.Verify.

AllBatchJobStatusValues lists every BatchJobStatus value known to this SDK version.

AllBatchJobTypeValues lists every BatchJobType value known to this SDK version.

AllBillingMetricAggregateEnumValues lists every BillingMetricAggregateEnum value known to this SDK version.

AllBillingPeriodEnumValues lists every BillingPeriodEnum value known to this SDK version.

AllBillingTypeEnumValues lists every BillingTypeEnum value known to this SDK version.

View Source
var AllBillingTypeValues = []BillingType{
	BillingTypeAdvance,
	BillingTypeArrears,
}

AllBillingTypeValues lists every BillingType value known to this SDK version.

AllCalendarUnitValues lists every CalendarUnit value known to this SDK version.

AllCheckoutSessionStatusValues lists every CheckoutSessionStatus value known to this SDK version.

AllCheckoutTypeValues lists every CheckoutType value known to this SDK version.

AllConfigValueTypeValues lists every ConfigValueType value known to this SDK version.

AllConnectionStatusValues lists every ConnectionStatus value known to this SDK version.

AllConnectionTypeValues lists every ConnectionType value known to this SDK version.

AllCouponFilterValues lists every CouponFilter value known to this SDK version.

AllCreditNoteStatusValues lists every CreditNoteStatus value known to this SDK version.

AllCreditTypeValues lists every CreditType value known to this SDK version.

View Source
var AllCurrencyValues = []Currency{}/* 159 elements not displayed */

AllCurrencyValues lists every Currency value known to this SDK version.

AllCustomPropertyEntityTypeValues lists every CustomPropertyEntityType value known to this SDK version.

AllCustomPropertyTypeValues lists every CustomPropertyType value known to this SDK version.

AllCustomerPortalScopeValues lists every CustomerPortalScope value known to this SDK version.

AllCustomerTypeValues lists every CustomerType value known to this SDK version.

AllDeclineKindValues lists every DeclineKind value known to this SDK version.

AllEInvoicingStatusValues lists every EInvoicingStatus value known to this SDK version.

AllErrorCodeValues lists every ErrorCode value known to this SDK version.

AllEventTypeValues lists every EventType value known to this SDK version.

AllExtraRecurringBillingTypeEnumValues lists every ExtraRecurringBillingTypeEnum value known to this SDK version.

AllFeatureStatusValues lists every FeatureStatus value known to this SDK version.

AllInvoicePaymentStatusValues lists every InvoicePaymentStatus value known to this SDK version.

AllInvoiceStatusValues lists every InvoiceStatus value known to this SDK version.

AllInvoiceTypeValues lists every InvoiceType value known to this SDK version.

AllMetricFilterOperatorValues lists every MetricFilterOperator value known to this SDK version.

AllOAuthErrorCodeValues lists every OAuthErrorCode value known to this SDK version.

AllOnboardingModeValues lists every OnboardingMode value known to this SDK version.

AllPaymentMethodTypeEnumValues lists every PaymentMethodTypeEnum value known to this SDK version.

AllPaymentStatusEnumValues lists every PaymentStatusEnum value known to this SDK version.

AllPaymentTypeEnumValues lists every PaymentTypeEnum value known to this SDK version.

AllPlanStatusEnumValues lists every PlanStatusEnum value known to this SDK version.

AllPlanTypeEnumValues lists every PlanTypeEnum value known to this SDK version.

AllProductFeeTypeEnumValues lists every ProductFeeTypeEnum value known to this SDK version.

View Source
var AllRefundModeValues = []RefundMode{
	RefundModeOnline,
	RefundModeOffline,
}

AllRefundModeValues lists every RefundMode value known to this SDK version.

AllReversalKindValues lists every ReversalKind value known to this SDK version.

AllSlotDowngradePolicyEnumValues lists every SlotDowngradePolicyEnum value known to this SDK version.

View Source
var AllSlotUpgradePolicyEnumValues = []SlotUpgradePolicyEnum{
	SlotUpgradePolicyEnumProrated,
}

AllSlotUpgradePolicyEnumValues lists every SlotUpgradePolicyEnum value known to this SDK version.

AllSubscriptionActivationConditionEnumValues lists every SubscriptionActivationConditionEnum value known to this SDK version.

AllSubscriptionFeeBillingPeriodEnumValues lists every SubscriptionFeeBillingPeriodEnum value known to this SDK version.

AllSubscriptionStatusEnumValues lists every SubscriptionStatusEnum value known to this SDK version.

AllSubscriptionUpdateTypeValues lists every SubscriptionUpdateType value known to this SDK version.

AllTaxExemptionTypeValues lists every TaxExemptionType value known to this SDK version.

AllUnitConversionRoundingEnumValues lists every UnitConversionRoundingEnum value known to this SDK version.

AllUsageModelEnumValues lists every UsageModelEnum value known to this SDK version.

AllWebhookDeliveryStatusValues lists every WebhookDeliveryStatus value known to this SDK version.

AllWebhookEndpointDisabledReasonValues lists every WebhookEndpointDisabledReason value known to this SDK version.

Functions ¶

func ErrorBody ¶

func ErrorBody[T any](err error) (*T, bool)

ErrorBody decodes the body of the *APIError in err's chain as a T, such as an error schema of the API. It reports false when err holds no APIError or its body is not JSON. APIError.Body already holds the body decoded as the error schema the operation declares for the status.

func Ptr ¶

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

Ptr returns a pointer to v. Optional request fields and query parameters are pointers, and Go has no way to take the address of a literal, so this saves a temporary variable:

limit := meteroid.Ptr(int32(10))

Types ¶

type APIError ¶

type APIError struct {
	StatusCode int
	// Header holds the response headers, such as the request id to quote to support.
	Header http.Header
	// Body is the body decoded as the error schema the operation declares for
	// the status, such as *ErrorResponse, else as plain JSON; nil when not JSON.
	Body    any
	RawBody []byte
}

APIError is returned for every non-2xx response. errors.Is matches it against status sentinels such as ErrNotFound, and ErrorBody decodes its body.

func (*APIError) Detail ¶

func (e *APIError) Detail() *RestErrorResponse

Detail decodes the body of the error as a RestErrorResponse, the error schema of the Meteroid API, or returns nil when the body is not JSON.

func (*APIError) Error ¶

func (e *APIError) Error() string

func (*APIError) Is ¶

func (e *APIError) Is(target error) bool

Is reports whether target is the status sentinel, such as ErrNotFound, matching the status of the response.

func (*APIError) RequestID ¶

func (e *APIError) RequestID() string

RequestID returns the id the API gave the request, to quote to support.

type AddOn ¶

type AddOn struct {
	// RFC 3339 timestamp.
	ArchivedAt *time.Time `json:"archived_at,omitempty"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Description *string `json:"description,omitempty"`

	Entitlements []Entitlement `json:"entitlements,omitempty"`

	FeeType *ProductFeeTypeEnum `json:"fee_type,omitempty"`

	ID AddOnID `json:"id"`

	MaxInstancesPerSubscription *int32 `json:"max_instances_per_subscription,omitempty"`

	Name string `json:"name"`

	PriceID PriceID `json:"price_id"`

	ProductID ProductID `json:"product_id"`

	SelfServiceable bool `json:"self_serviceable"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

AddOn is the AddOn object of the Meteroid API.

func (AddOn) MarshalJSON ¶

func (v AddOn) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*AddOn) UnmarshalJSON ¶

func (v *AddOn) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type AddOnEvent ¶

type AddOnEvent struct {
	AddOnID AddOnID `json:"add_on_id"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Description *string `json:"description,omitempty"`

	FeeType *ProductFeeTypeEnum `json:"fee_type,omitempty"`

	MaxInstancesPerSubscription *int32 `json:"max_instances_per_subscription,omitempty"`

	Name string `json:"name"`

	PriceID PriceID `json:"price_id"`

	ProductID ProductID `json:"product_id"`

	SelfServiceable bool `json:"self_serviceable"`

	ID EventID `json:"id"`

	// RFC 3339 timestamp.
	Timestamp time.Time `json:"timestamp"`

	Type EventType `json:"type"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

AddOnEvent is the AddOnEvent object of the Meteroid API.

func (AddOnEvent) MarshalJSON ¶

func (v AddOnEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*AddOnEvent) UnmarshalJSON ¶

func (v *AddOnEvent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type AddOnEventData ¶

type AddOnEventData struct {
	AddOnID AddOnID `json:"add_on_id"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Description *string `json:"description,omitempty"`

	FeeType *ProductFeeTypeEnum `json:"fee_type,omitempty"`

	MaxInstancesPerSubscription *int32 `json:"max_instances_per_subscription,omitempty"`

	Name string `json:"name"`

	PriceID PriceID `json:"price_id"`

	ProductID ProductID `json:"product_id"`

	SelfServiceable bool `json:"self_serviceable"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

AddOnEventData is the AddOnEventData object of the Meteroid API.

func (AddOnEventData) MarshalJSON ¶

func (v AddOnEventData) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*AddOnEventData) UnmarshalJSON ¶

func (v *AddOnEventData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type AddOnID ¶

type AddOnID = string

AddOnID is the AddOnId string of the Meteroid API.

type AddOnListResponse ¶

type AddOnListResponse struct {
	Data RequiredSlice[AddOn] `json:"data"`

	PaginationMeta PaginationResponse `json:"pagination_meta"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

AddOnListResponse is the AddOnListResponse object of the Meteroid API.

func (AddOnListResponse) MarshalJSON ¶

func (v AddOnListResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*AddOnListResponse) UnmarshalJSON ¶

func (v *AddOnListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type AddOns ¶

type AddOns struct {
	// contains filtered or unexported fields
}

AddOns groups the add ons operations of the Meteroid API.

func (*AddOns) Archive ¶

func (a *AddOns) Archive(ctx context.Context, addonID string, opts ...RequestOption) error

Archive an add-on

func (*AddOns) Create ¶

func (a *AddOns) Create(ctx context.Context, createAddOnRequest CreateAddOnRequest, opts ...RequestOption) (*AddOn, error)

Create an add-on

func (*AddOns) Entitlements ¶ added in v0.29.0

func (a *AddOns) Entitlements() *AddOnsEntitlements

Entitlements returns the entitlements API.

func (*AddOns) List ¶

func (a *AddOns) List(ctx context.Context, options *AddOnsListOptions, opts ...RequestOption) (*AddOnsListPage, error)

List add-ons

AddOns.ListAutoPaging iterates over every item instead.

func (*AddOns) ListAutoPaging ¶ added in v0.28.0

func (a *AddOns) ListAutoPaging(ctx context.Context, options *AddOnsListOptions, opts ...RequestOption) *AutoPager[AddOn]

ListAutoPaging iterates over every item of AddOns.List, fetching further pages on demand.

func (*AddOns) Retrieve ¶

func (a *AddOns) Retrieve(ctx context.Context, addonID string, opts ...RequestOption) (*AddOn, error)

Retrieve sends GET /api/v1/addons/{addon_id}.

Get add-on details

func (*AddOns) Unarchive ¶

func (a *AddOns) Unarchive(ctx context.Context, addonID string, opts ...RequestOption) error

Unarchive an add-on

func (*AddOns) Update ¶

func (a *AddOns) Update(ctx context.Context, addonID string, updateAddOnRequest UpdateAddOnRequest, opts ...RequestOption) (*AddOn, error)

Update an add-on

type AddOnsEntitlements ¶ added in v0.29.0

type AddOnsEntitlements struct {
	// contains filtered or unexported fields
}

AddOnsEntitlements groups the add ons entitlements operations of the Meteroid API.

func (*AddOnsEntitlements) Create ¶ added in v0.29.0

func (a *AddOnsEntitlements) Create(ctx context.Context, addonID string, createEntitlementsRequest CreateEntitlementsRequest, opts ...RequestOption) (*EntitlementListResponse, error)

Create add-on entitlements

Entitlements already present on this add-on are skipped.

func (*AddOnsEntitlements) List ¶ added in v0.29.0

List add-on entitlements

type AddOnsListOptions ¶

type AddOnsListOptions struct {
	Search *string

	Currency *string

	// Include archived add-ons in the results (default: false)
	IncludeArchived *bool

	// Sort order. Format: `column.direction`. Allowed columns: `name`, `created_at`. Direction: `asc` or `desc`. Default: `created_at.desc`.
	OrderBy *string

	// Page number (0-indexed)
	Page *int32

	// Number of items per page
	PerPage *int32
}

AddOnsListOptions carries the optional query and header parameters of AddOns.List. Leave a field nil to omit it.

type AddOnsListPage ¶ added in v0.28.0

type AddOnsListPage struct {
	AddOnListResponse

	// Items holds the items of this page.
	Items []AddOn
	// contains filtered or unexported fields
}

AddOnsListPage is a page of AddOns.List. It embeds the decoded AddOnListResponse, promoting its fields, with the Items of the page; a field named like a page member stays reachable through the embedded AddOnListResponse.

func (*AddOnsListPage) HasNextPage ¶ added in v0.28.0

func (p *AddOnsListPage) HasNextPage() bool

HasNextPage reports whether another page follows this one.

func (AddOnsListPage) MarshalJSON ¶ added in v0.28.0

func (p AddOnsListPage) MarshalJSON() ([]byte, error)

MarshalJSON encodes the AddOnListResponse of the page, as received.

func (*AddOnsListPage) NextPage ¶ added in v0.28.0

func (p *AddOnsListPage) NextPage(ctx context.Context) (*AddOnsListPage, error)

NextPage fetches the page after this one. It returns nil and no error after the last page.

type Address ¶

type Address struct {
	City *string `json:"city,omitempty"`

	Country *CountryCode `json:"country,omitempty"`

	Line1 *string `json:"line1,omitempty"`

	Line2 *string `json:"line2,omitempty"`

	State *string `json:"state,omitempty"`

	ZipCode *string `json:"zip_code,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

Address is the Address object of the Meteroid API.

func (Address) MarshalJSON ¶

func (v Address) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*Address) UnmarshalJSON ¶

func (v *Address) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type AllComponentsScope ¶

type AllComponentsScope struct {
	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

AllComponentsScope is the AllComponentsScope object of the Meteroid API.

Every revenue line counts toward the floor.

func (AllComponentsScope) MarshalJSON ¶

func (v AllComponentsScope) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*AllComponentsScope) UnmarshalJSON ¶

func (v *AllComponentsScope) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type AppliedCoupon ¶

type AppliedCoupon struct {
	AppliedAmount *string `json:"applied_amount,omitempty"`

	AppliedCount *int32 `json:"applied_count,omitempty"`

	CouponID CouponID `json:"coupon_id"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	ID AppliedCouponID `json:"id"`

	IsActive bool `json:"is_active"`

	// RFC 3339 timestamp.
	LastAppliedAt *time.Time `json:"last_applied_at,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

AppliedCoupon is the AppliedCoupon object of the Meteroid API.

func (AppliedCoupon) MarshalJSON ¶

func (v AppliedCoupon) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*AppliedCoupon) UnmarshalJSON ¶

func (v *AppliedCoupon) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type AppliedCouponDetailed ¶

type AppliedCouponDetailed struct {
	AppliedCoupon AppliedCoupon `json:"applied_coupon"`

	Coupon SubscriptionCoupon `json:"coupon"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

AppliedCouponDetailed is the AppliedCouponDetailed object of the Meteroid API.

func (AppliedCouponDetailed) MarshalJSON ¶

func (v AppliedCouponDetailed) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*AppliedCouponDetailed) UnmarshalJSON ¶

func (v *AppliedCouponDetailed) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type AppliedCouponID ¶

type AppliedCouponID = string

AppliedCouponID is the AppliedCouponId string of the Meteroid API.

type AutoPager ¶

type AutoPager[T any] struct {
	// contains filtered or unexported fields
}

AutoPager iterates over every item of a paginated list operation, as its ListAutoPaging method returns it, fetching each page once the previous one is consumed: loop on Next, then check Err, or range over AutoPager.All.

func (*AutoPager[T]) All ¶

func (p *AutoPager[T]) All() iter.Seq2[T, error]

All yields every item, then the error that stopped the iteration, if any.

func (*AutoPager[T]) Current ¶

func (p *AutoPager[T]) Current() T

Current returns the item Next advanced to.

func (*AutoPager[T]) Err ¶

func (p *AutoPager[T]) Err() error

Err returns the error that stopped the iteration, if any.

func (*AutoPager[T]) Next ¶

func (p *AutoPager[T]) Next() bool

Next advances to the next item. It returns false once every item has been read or when a request failed, see Err.

type AvailableParameters ¶

type AvailableParameters struct {
	// Map of component_id -> available billing periods (e.g., "MONTHLY", "ANNUAL")
	BillingPeriods map[string][]BillingPeriodEnum `json:"billing_periods,omitempty"`

	// Map of component_id -> available capacity values
	CapacityThresholds map[string][]int64 `json:"capacity_thresholds,omitempty"`

	// List of component_ids that support slot parametrization (initial slot count)
	SlotComponents []string `json:"slot_components,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

AvailableParameters is the AvailableParameters object of the Meteroid API.

func (AvailableParameters) MarshalJSON ¶

func (v AvailableParameters) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*AvailableParameters) UnmarshalJSON ¶

func (v *AvailableParameters) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type BankAccountID ¶

type BankAccountID = string

BankAccountID is the BankAccountId string of the Meteroid API.

type BankTransferPaymentMethodConfig ¶

type BankTransferPaymentMethodConfig struct {
	AccountID *BankAccountID `json:"account_id,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

BankTransferPaymentMethodConfig is the BankTransferPaymentMethodConfig object of the Meteroid API.

func (BankTransferPaymentMethodConfig) MarshalJSON ¶

func (v BankTransferPaymentMethodConfig) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*BankTransferPaymentMethodConfig) UnmarshalJSON ¶

func (v *BankTransferPaymentMethodConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type BasicAuth ¶

type BasicAuth struct {
	Username string
	Password string
}

BasicAuth holds HTTP basic credentials.

type BatchJobChunkID ¶

type BatchJobChunkID = string

BatchJobChunkID is the BatchJobChunkId string of the Meteroid API.

type BatchJobDetailResponse ¶

type BatchJobDetailResponse struct {
	// RFC 3339 timestamp.
	CompletedAt *time.Time `json:"completed_at,omitempty"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	CreatedBy uuid.UUID `json:"created_by"`

	ErrorCsvURL *string `json:"error_csv_url,omitempty"`

	FailedItems int32 `json:"failed_items"`

	FailureCount int64 `json:"failure_count"`

	HasErrorCsv bool `json:"has_error_csv"`

	HasOutput bool `json:"has_output"`

	ID BatchJobID `json:"id"`

	InputFileName *string `json:"input_file_name,omitempty"`

	InputFileURL *string `json:"input_file_url,omitempty"`

	JobType BatchJobType `json:"job_type"`

	OutputURL *string `json:"output_url,omitempty"`

	ProcessedItems int32 `json:"processed_items"`

	Status BatchJobStatus `json:"status"`

	TotalItems *int32 `json:"total_items,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

BatchJobDetailResponse is the BatchJobDetailResponse object of the Meteroid API.

func (BatchJobDetailResponse) MarshalJSON ¶

func (v BatchJobDetailResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*BatchJobDetailResponse) UnmarshalJSON ¶

func (v *BatchJobDetailResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type BatchJobFailuresResponse ¶

type BatchJobFailuresResponse struct {
	Data RequiredSlice[BatchJobItemFailureResponse] `json:"data"`

	TotalCount int64 `json:"total_count"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

BatchJobFailuresResponse is the BatchJobFailuresResponse object of the Meteroid API.

func (BatchJobFailuresResponse) MarshalJSON ¶

func (v BatchJobFailuresResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*BatchJobFailuresResponse) UnmarshalJSON ¶

func (v *BatchJobFailuresResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type BatchJobID ¶

type BatchJobID = string

BatchJobID is the BatchJobId string of the Meteroid API.

type BatchJobItemFailureResponse ¶

type BatchJobItemFailureResponse struct {
	ChunkID BatchJobChunkID `json:"chunk_id"`

	ID uuid.UUID `json:"id"`

	ItemIdentifier *string `json:"item_identifier,omitempty"`

	ItemIndex int32 `json:"item_index"`

	Reason string `json:"reason"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

BatchJobItemFailureResponse is the BatchJobItemFailureResponse object of the Meteroid API.

func (BatchJobItemFailureResponse) MarshalJSON ¶

func (v BatchJobItemFailureResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*BatchJobItemFailureResponse) UnmarshalJSON ¶

func (v *BatchJobItemFailureResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type BatchJobListResponse ¶

type BatchJobListResponse struct {
	Data RequiredSlice[BatchJobResponse] `json:"data"`

	PaginationMeta PaginationResponse `json:"pagination_meta"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

BatchJobListResponse is the BatchJobListResponse object of the Meteroid API.

func (BatchJobListResponse) MarshalJSON ¶

func (v BatchJobListResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*BatchJobListResponse) UnmarshalJSON ¶

func (v *BatchJobListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type BatchJobResponse ¶

type BatchJobResponse struct {
	// RFC 3339 timestamp.
	CompletedAt *time.Time `json:"completed_at,omitempty"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	CreatedBy uuid.UUID `json:"created_by"`

	FailedItems int32 `json:"failed_items"`

	ID BatchJobID `json:"id"`

	InputFileName *string `json:"input_file_name,omitempty"`

	JobType BatchJobType `json:"job_type"`

	ProcessedItems int32 `json:"processed_items"`

	Status BatchJobStatus `json:"status"`

	TotalItems *int32 `json:"total_items,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

BatchJobResponse is the BatchJobResponse object of the Meteroid API.

func (BatchJobResponse) MarshalJSON ¶

func (v BatchJobResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*BatchJobResponse) UnmarshalJSON ¶

func (v *BatchJobResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type BatchJobStatus ¶

type BatchJobStatus string

BatchJobStatus is one of AllBatchJobStatusValues, or a value this SDK version does not know.

const (
	BatchJobStatusPending             BatchJobStatus = "PENDING"
	BatchJobStatusChunking            BatchJobStatus = "CHUNKING"
	BatchJobStatusProcessing          BatchJobStatus = "PROCESSING"
	BatchJobStatusCompleted           BatchJobStatus = "COMPLETED"
	BatchJobStatusCompletedWithErrors BatchJobStatus = "COMPLETED_WITH_ERRORS"
	BatchJobStatusFailed              BatchJobStatus = "FAILED"
	BatchJobStatusCancelled           BatchJobStatus = "CANCELLED"
)

Known values of BatchJobStatus.

The API may add new values over time; unknown values round-trip unchanged.

func (BatchJobStatus) IsKnown ¶

func (e BatchJobStatus) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (BatchJobStatus) String ¶

func (e BatchJobStatus) String() string

String returns the wire representation of the value.

type BatchJobType ¶

type BatchJobType string

BatchJobType is one of AllBatchJobTypeValues, or a value this SDK version does not know.

const (
	BatchJobTypeEventCsvImport            BatchJobType = "EVENT_CSV_IMPORT"
	BatchJobTypeCustomerCsvImport         BatchJobType = "CUSTOMER_CSV_IMPORT"
	BatchJobTypeSubscriptionCsvImport     BatchJobType = "SUBSCRIPTION_CSV_IMPORT"
	BatchJobTypeSubscriptionPlanMigration BatchJobType = "SUBSCRIPTION_PLAN_MIGRATION"
	BatchJobTypeTaxReportExport           BatchJobType = "TAX_REPORT_EXPORT"
)

Known values of BatchJobType.

The API may add new values over time; unknown values round-trip unchanged.

func (BatchJobType) IsKnown ¶

func (e BatchJobType) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (BatchJobType) String ¶

func (e BatchJobType) String() string

String returns the wire representation of the value.

type BatchJobs ¶

type BatchJobs struct {
	// contains filtered or unexported fields
}

BatchJobs groups the batch jobs operations of the Meteroid API.

func (*BatchJobs) List ¶

List batch jobs with optional filtering by type and status.

BatchJobs.ListAutoPaging iterates over every item instead.

func (*BatchJobs) ListAutoPaging ¶ added in v0.28.0

func (a *BatchJobs) ListAutoPaging(ctx context.Context, options *BatchJobsListOptions, opts ...RequestOption) *AutoPager[BatchJobResponse]

ListAutoPaging iterates over every item of BatchJobs.List, fetching further pages on demand.

func (*BatchJobs) ListFailures ¶

func (a *BatchJobs) ListFailures(ctx context.Context, batchJobID string, options *BatchJobsListFailuresOptions, opts ...RequestOption) (*BatchJobsListFailuresPage, error)

ListFailures sends GET /api/v1/batch-jobs/{batch_job_id}/failures and returns the first page of results.

List batch job failures ¶

Retrieve paginated failures for a batch job.

BatchJobs.ListFailuresAutoPaging iterates over every item instead.

func (*BatchJobs) ListFailuresAutoPaging ¶ added in v0.28.0

func (a *BatchJobs) ListFailuresAutoPaging(ctx context.Context, batchJobID string, options *BatchJobsListFailuresOptions, opts ...RequestOption) *AutoPager[BatchJobItemFailureResponse]

ListFailuresAutoPaging iterates over every item of BatchJobs.ListFailures, fetching further pages on demand.

func (*BatchJobs) Retrieve ¶

func (a *BatchJobs) Retrieve(ctx context.Context, batchJobID string, opts ...RequestOption) (*BatchJobDetailResponse, error)

Retrieve sends GET /api/v1/batch-jobs/{batch_job_id}.

Get batch job detail ¶

Retrieve a single batch job with its chunks and failures.

type BatchJobsListFailuresOptions ¶

type BatchJobsListFailuresOptions struct {
	ChunkID *BatchJobChunkID

	Limit *int32

	Offset *int32
}

BatchJobsListFailuresOptions carries the optional query and header parameters of BatchJobs.ListFailures. Leave a field nil to omit it.

type BatchJobsListFailuresPage ¶ added in v0.28.0

type BatchJobsListFailuresPage struct {
	BatchJobFailuresResponse

	// Items holds the items of this page.
	Items []BatchJobItemFailureResponse
	// contains filtered or unexported fields
}

BatchJobsListFailuresPage is a page of BatchJobs.ListFailures. It embeds the decoded BatchJobFailuresResponse, promoting its fields, with the Items of the page; a field named like a page member stays reachable through the embedded BatchJobFailuresResponse.

func (*BatchJobsListFailuresPage) HasNextPage ¶ added in v0.28.0

func (p *BatchJobsListFailuresPage) HasNextPage() bool

HasNextPage reports whether another page follows this one.

func (BatchJobsListFailuresPage) MarshalJSON ¶ added in v0.28.0

func (p BatchJobsListFailuresPage) MarshalJSON() ([]byte, error)

MarshalJSON encodes the BatchJobFailuresResponse of the page, as received.

func (*BatchJobsListFailuresPage) NextPage ¶ added in v0.28.0

NextPage fetches the page after this one. It returns nil and no error after the last page.

type BatchJobsListOptions ¶

type BatchJobsListOptions struct {
	JobType *BatchJobType

	Status []BatchJobStatus

	// Page number (0-indexed)
	Page *int32

	// Number of items per page
	PerPage *int32
}

BatchJobsListOptions carries the optional query and header parameters of BatchJobs.List. Leave a field nil to omit it.

type BatchJobsListPage ¶ added in v0.28.0

type BatchJobsListPage struct {
	BatchJobListResponse

	// Items holds the items of this page.
	Items []BatchJobResponse
	// contains filtered or unexported fields
}

BatchJobsListPage is a page of BatchJobs.List. It embeds the decoded BatchJobListResponse, promoting its fields, with the Items of the page; a field named like a page member stays reachable through the embedded BatchJobListResponse.

func (*BatchJobsListPage) HasNextPage ¶ added in v0.28.0

func (p *BatchJobsListPage) HasNextPage() bool

HasNextPage reports whether another page follows this one.

func (BatchJobsListPage) MarshalJSON ¶ added in v0.28.0

func (p BatchJobsListPage) MarshalJSON() ([]byte, error)

MarshalJSON encodes the BatchJobListResponse of the page, as received.

func (*BatchJobsListPage) NextPage ¶ added in v0.28.0

NextPage fetches the page after this one. It returns nil and no error after the last page.

type BillableMetricID ¶

type BillableMetricID = string

BillableMetricID is the BillableMetricId string of the Meteroid API.

type BillingConfig ¶

type BillingConfig struct {
	BillingCycles *int32 `json:"billing_cycles,omitempty"`

	NetTerms *int32 `json:"net_terms,omitempty"`

	PeriodStartDay *int32 `json:"period_start_day,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

BillingConfig is the BillingConfig object of the Meteroid API.

func (BillingConfig) MarshalJSON ¶

func (v BillingConfig) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*BillingConfig) UnmarshalJSON ¶

func (v *BillingConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type BillingCycleResetPeriod ¶

type BillingCycleResetPeriod struct {
	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

BillingCycleResetPeriod is the BillingCycleResetPeriod object of the Meteroid API.

Resets each time your subscription renews — anchored to your billing cycle.

func (BillingCycleResetPeriod) MarshalJSON ¶

func (v BillingCycleResetPeriod) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*BillingCycleResetPeriod) UnmarshalJSON ¶

func (v *BillingCycleResetPeriod) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type BillingMetricAggregateEnum ¶

type BillingMetricAggregateEnum string

BillingMetricAggregateEnum is one of AllBillingMetricAggregateEnumValues, or a value this SDK version does not know.

const (
	BillingMetricAggregateEnumCount         BillingMetricAggregateEnum = "COUNT"
	BillingMetricAggregateEnumLatest        BillingMetricAggregateEnum = "LATEST"
	BillingMetricAggregateEnumMax           BillingMetricAggregateEnum = "MAX"
	BillingMetricAggregateEnumMin           BillingMetricAggregateEnum = "MIN"
	BillingMetricAggregateEnumMean          BillingMetricAggregateEnum = "MEAN"
	BillingMetricAggregateEnumSum           BillingMetricAggregateEnum = "SUM"
	BillingMetricAggregateEnumCountDistinct BillingMetricAggregateEnum = "COUNT_DISTINCT"
)

Known values of BillingMetricAggregateEnum.

The API may add new values over time; unknown values round-trip unchanged.

func (BillingMetricAggregateEnum) IsKnown ¶

func (e BillingMetricAggregateEnum) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (BillingMetricAggregateEnum) String ¶

String returns the wire representation of the value.

type BillingPeriodEnum ¶

type BillingPeriodEnum string

BillingPeriodEnum is one of AllBillingPeriodEnumValues, or a value this SDK version does not know.

const (
	BillingPeriodEnumMonthly    BillingPeriodEnum = "MONTHLY"
	BillingPeriodEnumQuarterly  BillingPeriodEnum = "QUARTERLY"
	BillingPeriodEnumSemiannual BillingPeriodEnum = "SEMIANNUAL"
	BillingPeriodEnumAnnual     BillingPeriodEnum = "ANNUAL"
)

Known values of BillingPeriodEnum.

The API may add new values over time; unknown values round-trip unchanged.

func (BillingPeriodEnum) IsKnown ¶

func (e BillingPeriodEnum) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (BillingPeriodEnum) String ¶

func (e BillingPeriodEnum) String() string

String returns the wire representation of the value.

type BillingType ¶

type BillingType string

BillingType is one of AllBillingTypeValues, or a value this SDK version does not know.

const (
	BillingTypeAdvance BillingType = "ADVANCE"
	BillingTypeArrears BillingType = "ARREARS"
)

Known values of BillingType.

The API may add new values over time; unknown values round-trip unchanged.

func (BillingType) IsKnown ¶

func (e BillingType) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (BillingType) String ¶

func (e BillingType) String() string

String returns the wire representation of the value.

type BillingTypeEnum ¶

type BillingTypeEnum string

BillingTypeEnum is one of AllBillingTypeEnumValues, or a value this SDK version does not know.

const (
	BillingTypeEnumAdvance BillingTypeEnum = "ADVANCE"
	BillingTypeEnumArrears BillingTypeEnum = "ARREARS"
)

Known values of BillingTypeEnum.

The API may add new values over time; unknown values round-trip unchanged.

func (BillingTypeEnum) IsKnown ¶

func (e BillingTypeEnum) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (BillingTypeEnum) String ¶

func (e BillingTypeEnum) String() string

String returns the wire representation of the value.

type BooleanConfigValue ¶

type BooleanConfigValue struct {
	Value bool `json:"value"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

BooleanConfigValue is the BooleanConfigValue object of the Meteroid API.

A boolean config value.

func (BooleanConfigValue) MarshalJSON ¶

func (v BooleanConfigValue) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*BooleanConfigValue) UnmarshalJSON ¶

func (v *BooleanConfigValue) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type BooleanEffectiveEntitlementValue ¶

type BooleanEffectiveEntitlementValue struct {
	Enabled bool `json:"enabled"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

BooleanEffectiveEntitlementValue is the BooleanEffectiveEntitlementValue object of the Meteroid API.

func (BooleanEffectiveEntitlementValue) MarshalJSON ¶

func (v BooleanEffectiveEntitlementValue) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*BooleanEffectiveEntitlementValue) UnmarshalJSON ¶

func (v *BooleanEffectiveEntitlementValue) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type BooleanEntitlementValue ¶

type BooleanEntitlementValue struct {
	Enabled bool `json:"enabled"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

BooleanEntitlementValue is the BooleanEntitlementValue object of the Meteroid API.

func (BooleanEntitlementValue) MarshalJSON ¶

func (v BooleanEntitlementValue) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*BooleanEntitlementValue) UnmarshalJSON ¶

func (v *BooleanEntitlementValue) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type BooleanFeatureType ¶

type BooleanFeatureType struct {
	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

BooleanFeatureType is the BooleanFeatureType object of the Meteroid API.

func (BooleanFeatureType) MarshalJSON ¶

func (v BooleanFeatureType) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*BooleanFeatureType) UnmarshalJSON ¶

func (v *BooleanFeatureType) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type BooleanResolvedEntitlementValue ¶

type BooleanResolvedEntitlementValue struct {
	Enabled bool `json:"enabled"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

BooleanResolvedEntitlementValue is the BooleanResolvedEntitlementValue object of the Meteroid API.

func (BooleanResolvedEntitlementValue) MarshalJSON ¶

func (v BooleanResolvedEntitlementValue) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*BooleanResolvedEntitlementValue) UnmarshalJSON ¶

func (v *BooleanResolvedEntitlementValue) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CalendarResetPeriod ¶

type CalendarResetPeriod struct {
	Interval int32 `json:"interval"`

	Unit CalendarUnit `json:"unit"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CalendarResetPeriod is the CalendarResetPeriod object of the Meteroid API.

Resets on calendar boundaries (e.g. the 1st of every month) — not tied to subscription start date.

func (CalendarResetPeriod) MarshalJSON ¶

func (v CalendarResetPeriod) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CalendarResetPeriod) UnmarshalJSON ¶

func (v *CalendarResetPeriod) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CalendarUnit ¶

type CalendarUnit string

CalendarUnit is one of AllCalendarUnitValues, or a value this SDK version does not know.

const (
	CalendarUnitHour  CalendarUnit = "HOUR"
	CalendarUnitDay   CalendarUnit = "DAY"
	CalendarUnitWeek  CalendarUnit = "WEEK"
	CalendarUnitMonth CalendarUnit = "MONTH"
	CalendarUnitYear  CalendarUnit = "YEAR"
)

Known values of CalendarUnit.

The API may add new values over time; unknown values round-trip unchanged.

func (CalendarUnit) IsKnown ¶

func (e CalendarUnit) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (CalendarUnit) String ¶

func (e CalendarUnit) String() string

String returns the wire representation of the value.

type CancelCheckoutSessionResponse ¶

type CancelCheckoutSessionResponse struct {
	Session CheckoutSession `json:"session"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CancelCheckoutSessionResponse is the CancelCheckoutSessionResponse object of the Meteroid API.

func (CancelCheckoutSessionResponse) MarshalJSON ¶

func (v CancelCheckoutSessionResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CancelCheckoutSessionResponse) UnmarshalJSON ¶

func (v *CancelCheckoutSessionResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CancelSubscriptionRequest ¶

type CancelSubscriptionRequest struct {
	// If not provided, the cancellation will be effective at the end of the current billing or committed period.
	EffectiveDate *Date `json:"effective_date,omitempty"`

	Reason *string `json:"reason,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CancelSubscriptionRequest is the CancelSubscriptionRequest object of the Meteroid API.

func (CancelSubscriptionRequest) MarshalJSON ¶

func (v CancelSubscriptionRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CancelSubscriptionRequest) UnmarshalJSON ¶

func (v *CancelSubscriptionRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CancelSubscriptionResponse ¶

type CancelSubscriptionResponse struct {
	Subscription Subscription `json:"subscription"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CancelSubscriptionResponse is the CancelSubscriptionResponse object of the Meteroid API.

func (CancelSubscriptionResponse) MarshalJSON ¶

func (v CancelSubscriptionResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CancelSubscriptionResponse) UnmarshalJSON ¶

func (v *CancelSubscriptionResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CapacityFee ¶

type CapacityFee struct {
	Included int64 `json:"included"`

	MetricID BillableMetricID `json:"metric_id"`

	OverageRate string `json:"overage_rate"`

	Rate string `json:"rate"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CapacityFee is the CapacityFee object of the Meteroid API.

func (CapacityFee) MarshalJSON ¶

func (v CapacityFee) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CapacityFee) UnmarshalJSON ¶

func (v *CapacityFee) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CapacityFeeStructure ¶

type CapacityFeeStructure struct {
	MetricID BillableMetricID `json:"metric_id"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CapacityFeeStructure is the CapacityFeeStructure object of the Meteroid API.

func (CapacityFeeStructure) MarshalJSON ¶

func (v CapacityFeeStructure) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CapacityFeeStructure) UnmarshalJSON ¶

func (v *CapacityFeeStructure) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CapacityPlanFee ¶

type CapacityPlanFee struct {
	Cadence BillingPeriodEnum `json:"cadence"`

	MetricID BillableMetricID `json:"metric_id"`

	Thresholds RequiredSlice[CapacityThreshold] `json:"thresholds"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CapacityPlanFee is the CapacityPlanFee object of the Meteroid API.

Capacity-based fee with included committed usage and overage

func (CapacityPlanFee) MarshalJSON ¶

func (v CapacityPlanFee) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CapacityPlanFee) UnmarshalJSON ¶

func (v *CapacityPlanFee) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CapacityPricing ¶

type CapacityPricing struct {
	Included int64 `json:"included"`

	OverageRate string `json:"overage_rate"`

	Rate string `json:"rate"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CapacityPricing is the CapacityPricing object of the Meteroid API.

func (CapacityPricing) MarshalJSON ¶

func (v CapacityPricing) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CapacityPricing) UnmarshalJSON ¶

func (v *CapacityPricing) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CapacityThreshold ¶

type CapacityThreshold struct {
	IncludedAmount int64 `json:"included_amount"`

	PerUnitOverage string `json:"per_unit_overage"`

	Price string `json:"price"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CapacityThreshold is the CapacityThreshold object of the Meteroid API.

func (CapacityThreshold) MarshalJSON ¶

func (v CapacityThreshold) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CapacityThreshold) UnmarshalJSON ¶

func (v *CapacityThreshold) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CheckoutSession ¶

type CheckoutSession struct {
	BillingDayAnchor *int32 `json:"billing_day_anchor,omitempty"`

	BillingStartDate *Date `json:"billing_start_date,omitempty"`

	CancelURL *string `json:"cancel_url,omitempty"`

	CheckoutType CheckoutType `json:"checkout_type"`

	CheckoutURL *string `json:"checkout_url,omitempty"`

	// RFC 3339 timestamp.
	CompletedAt *time.Time `json:"completed_at,omitempty"`

	CouponCode *string `json:"coupon_code,omitempty"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	CustomerID CustomerID `json:"customer_id"`

	// When the session expires. None means the session never expires.
	// RFC 3339 timestamp.
	ExpiresAt *time.Time `json:"expires_at,omitempty"`

	ID CheckoutSessionID `json:"id"`

	NetTerms *int32 `json:"net_terms,omitempty"`

	PaymentMethodsConfig *PaymentMethodsConfig `json:"payment_methods_config,omitempty"`

	PlanVersionID PlanVersionID `json:"plan_version_id"`

	Status CheckoutSessionStatus `json:"status"`

	SubscriptionID *SubscriptionID `json:"subscription_id,omitempty"`

	SuccessURL *string `json:"success_url,omitempty"`

	TrialDurationDays *int32 `json:"trial_duration_days,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CheckoutSession is the CheckoutSession object of the Meteroid API.

func (CheckoutSession) MarshalJSON ¶

func (v CheckoutSession) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CheckoutSession) UnmarshalJSON ¶

func (v *CheckoutSession) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CheckoutSessionID ¶

type CheckoutSessionID = string

CheckoutSessionID is the CheckoutSessionId string of the Meteroid API.

type CheckoutSessionStatus ¶

type CheckoutSessionStatus string

CheckoutSessionStatus is one of AllCheckoutSessionStatusValues, or a value this SDK version does not know.

const (
	CheckoutSessionStatusCreated         CheckoutSessionStatus = "CREATED"
	CheckoutSessionStatusAwaitingPayment CheckoutSessionStatus = "AWAITING_PAYMENT"
	CheckoutSessionStatusCompleted       CheckoutSessionStatus = "COMPLETED"
	CheckoutSessionStatusExpired         CheckoutSessionStatus = "EXPIRED"
	CheckoutSessionStatusCancelled       CheckoutSessionStatus = "CANCELLED"
)

Known values of CheckoutSessionStatus.

The API may add new values over time; unknown values round-trip unchanged.

func (CheckoutSessionStatus) IsKnown ¶

func (e CheckoutSessionStatus) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (CheckoutSessionStatus) String ¶

func (e CheckoutSessionStatus) String() string

String returns the wire representation of the value.

type CheckoutSessions ¶

type CheckoutSessions struct {
	// contains filtered or unexported fields
}

CheckoutSessions groups the checkout sessions operations of the Meteroid API.

func (*CheckoutSessions) Cancel ¶

Cancel a checkout session

func (*CheckoutSessions) Create ¶

func (a *CheckoutSessions) Create(ctx context.Context, createCheckoutSessionRequest CreateCheckoutSessionRequest, opts ...RequestOption) (*CreateCheckoutSessionResponse, error)

Create a checkout session

func (*CheckoutSessions) List ¶

List checkout sessions

func (*CheckoutSessions) Retrieve ¶

Retrieve sends GET /api/v1/checkout-sessions/{id}.

Get a checkout session by ID

type CheckoutSessionsListOptions ¶

type CheckoutSessionsListOptions struct {
	CustomerID *CustomerID

	Status *CheckoutSessionStatus
}

CheckoutSessionsListOptions carries the optional query and header parameters of CheckoutSessions.List. Leave a field nil to omit it.

type CheckoutType ¶

type CheckoutType string

CheckoutType is one of AllCheckoutTypeValues, or a value this SDK version does not know.

const (
	CheckoutTypeSelfServe              CheckoutType = "SELF_SERVE"
	CheckoutTypeSubscriptionActivation CheckoutType = "SUBSCRIPTION_ACTIVATION"
	CheckoutTypePlanChange             CheckoutType = "PLAN_CHANGE"
	CheckoutTypeAddonPurchase          CheckoutType = "ADDON_PURCHASE"
)

Known values of CheckoutType.

The API may add new values over time; unknown values round-trip unchanged.

func (CheckoutType) IsKnown ¶

func (e CheckoutType) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (CheckoutType) String ¶

func (e CheckoutType) String() string

String returns the wire representation of the value.

type Client ¶

type Client struct {
	// contains filtered or unexported fields
}

Client is the entry point of the Meteroid SDK.

A Client is safe for concurrent use by multiple goroutines. Each API area is reached through an accessor method:

client := meteroid.New("", nil) // reads METEROID_API_KEY
result, err := client.AddOns().List(ctx, nil)

Homepage: https://meteroid.com Source: https://github.com/meteroid-oss/meteroid-go License: Apache-2.0

func New ¶

func New(token string, options *Options) *Client

New builds a Client authenticated with the given API token, or with the METEROID_API_KEY environment variable when token is empty.

Pass nil options to use the defaults: METEROID_BASE_URL or https://api.meteroid.com as the server, a 60 second timeout per attempt and two retries on transient failures.

func (*Client) AddOns ¶

func (c *Client) AddOns() *AddOns

AddOns returns the add ons API.

func (*Client) BatchJobs ¶

func (c *Client) BatchJobs() *BatchJobs

BatchJobs returns the batch jobs API.

func (*Client) CheckoutSessions ¶

func (c *Client) CheckoutSessions() *CheckoutSessions

CheckoutSessions returns the checkout sessions API.

func (*Client) Connect ¶

func (c *Client) Connect() *Connect

Connect returns the connect API.

func (*Client) Coupons ¶

func (c *Client) Coupons() *Coupons

Coupons returns the coupons API.

func (*Client) CreditNotes ¶

func (c *Client) CreditNotes() *CreditNotes

CreditNotes returns the credit notes API.

func (*Client) CustomProperties ¶

func (c *Client) CustomProperties() *CustomProperties

CustomProperties returns the custom properties API.

func (*Client) Customers ¶

func (c *Client) Customers() *Customers

Customers returns the customers API.

func (*Client) Entitlements ¶

func (c *Client) Entitlements() *Entitlements

Entitlements returns the entitlements API.

func (*Client) Events ¶

func (c *Client) Events() *Events

Events returns the events API.

func (*Client) Features ¶

func (c *Client) Features() *Features

Features returns the features API.

func (*Client) Invoices ¶

func (c *Client) Invoices() *Invoices

Invoices returns the invoices API.

func (*Client) Metrics ¶

func (c *Client) Metrics() *Metrics

Metrics returns the metrics API.

func (*Client) Oauth ¶

func (c *Client) Oauth() *Oauth

Oauth returns the oauth API.

func (*Client) OauthApps ¶

func (c *Client) OauthApps() *OauthApps

OauthApps returns the oauth apps API.

func (*Client) Plans ¶

func (c *Client) Plans() *Plans

Plans returns the plans API.

func (*Client) ProductFamilies ¶

func (c *Client) ProductFamilies() *ProductFamilies

ProductFamilies returns the product families API.

func (*Client) Products ¶

func (c *Client) Products() *Products

Products returns the products API.

func (*Client) Subscriptions ¶

func (c *Client) Subscriptions() *Subscriptions

Subscriptions returns the subscriptions API.

func (*Client) Usage ¶

func (c *Client) Usage() *Usage

Usage returns the usage API.

func (*Client) WebhookEndpoints ¶ added in v0.30.0

func (c *Client) WebhookEndpoints() *WebhookEndpoints

WebhookEndpoints returns the webhook endpoints API.

func (*Client) WithToken ¶

func (c *Client) WithToken(token string) *Client

WithToken returns a copy of the client that authenticates with a different API token, reusing the underlying HTTP client and every other setting.

type ComponentOverride ¶

type ComponentOverride struct {
	ComponentID PriceComponentID `json:"component_id"`

	Name string `json:"name"`

	PriceEntry PriceEntry `json:"price_entry"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ComponentOverride is the ComponentOverride object of the Meteroid API.

func (ComponentOverride) MarshalJSON ¶

func (v ComponentOverride) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ComponentOverride) UnmarshalJSON ¶

func (v *ComponentOverride) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ComponentParameterization ¶

type ComponentParameterization struct {
	ComponentID PriceComponentID `json:"component_id"`

	Parameters ComponentParameters `json:"parameters"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ComponentParameterization is the ComponentParameterization object of the Meteroid API.

func (ComponentParameterization) MarshalJSON ¶

func (v ComponentParameterization) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ComponentParameterization) UnmarshalJSON ¶

func (v *ComponentParameterization) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ComponentParameters ¶

type ComponentParameters struct {
	BillingPeriod *BillingPeriodEnum `json:"billing_period,omitempty"`

	CommittedCapacity *int64 `json:"committed_capacity,omitempty"`

	InitialSlotCount *int32 `json:"initial_slot_count,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ComponentParameters is the ComponentParameters object of the Meteroid API.

func (ComponentParameters) MarshalJSON ¶

func (v ComponentParameters) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ComponentParameters) UnmarshalJSON ¶

func (v *ComponentParameters) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ComponentsScope ¶

type ComponentsScope struct {
	ComponentNames RequiredSlice[string] `json:"component_names"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ComponentsScope is the ComponentsScope object of the Meteroid API.

Component names — matched against `ReplacePlanRequest::components[].name`.

func (ComponentsScope) MarshalJSON ¶

func (v ComponentsScope) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ComponentsScope) UnmarshalJSON ¶

func (v *ComponentsScope) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ConfigEffectiveEntitlementValue ¶

type ConfigEffectiveEntitlementValue struct {
	Value ConfigValue `json:"value"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ConfigEffectiveEntitlementValue is the ConfigEffectiveEntitlementValue object of the Meteroid API.

func (ConfigEffectiveEntitlementValue) MarshalJSON ¶

func (v ConfigEffectiveEntitlementValue) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ConfigEffectiveEntitlementValue) UnmarshalJSON ¶

func (v *ConfigEffectiveEntitlementValue) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ConfigEntitlementValue ¶

type ConfigEntitlementValue struct {
	Value ConfigValue `json:"value"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ConfigEntitlementValue is the ConfigEntitlementValue object of the Meteroid API.

func (ConfigEntitlementValue) MarshalJSON ¶

func (v ConfigEntitlementValue) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ConfigEntitlementValue) UnmarshalJSON ¶

func (v *ConfigEntitlementValue) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ConfigFeatureType ¶

type ConfigFeatureType struct {
	// Allowed values when `value_type = SELECT`. Empty otherwise.
	Options []string `json:"options,omitempty"`

	// The feature's value type, fixed at creation.
	ValueType ConfigValueType `json:"value_type"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ConfigFeatureType is the ConfigFeatureType object of the Meteroid API.

A static, typed configuration value. No metric — resolved synchronously.

func (ConfigFeatureType) MarshalJSON ¶

func (v ConfigFeatureType) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ConfigFeatureType) UnmarshalJSON ¶

func (v *ConfigFeatureType) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ConfigResolvedEntitlementValue ¶

type ConfigResolvedEntitlementValue struct {
	Value ConfigValue `json:"value"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ConfigResolvedEntitlementValue is the ConfigResolvedEntitlementValue object of the Meteroid API.

func (ConfigResolvedEntitlementValue) MarshalJSON ¶

func (v ConfigResolvedEntitlementValue) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ConfigResolvedEntitlementValue) UnmarshalJSON ¶

func (v *ConfigResolvedEntitlementValue) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ConfigValue ¶

type ConfigValue struct {
	// Kind selects the active variant. Compare it against the
	// ConfigValue* constants.
	Kind ConfigValueKind `json:"kind"`

	// Number is set when Kind is ConfigValueNumber.
	Number *NumberConfigValue `json:"-"`
	// Boolean is set when Kind is ConfigValueBoolean.
	Boolean *BooleanConfigValue `json:"-"`
	// Text is set when Kind is ConfigValueText.
	Text *TextConfigValue `json:"-"`
	// JSON is set when Kind is ConfigValueJSON.
	JSON *JSONConfigValue `json:"-"`
	// contains filtered or unexported fields
}

ConfigValue is a tagged union discriminated by the kind field.

A static, typed configuration value carried by a Config entitlement. Resolved synchronously through the entitlement hierarchy — no metric, no usage counter.

When ConfigValue.IsKnown reports true, exactly one variant pointer is set, matching Kind. A variant added to the API after this SDK version was released still decodes without error, but with every variant pointer nil: always give a `switch` on Kind a `default:` branch (or check IsKnown first) instead of dereferencing a pointer unconditionally. The unknown variant's JSON is available from ConfigValue.Raw.

func NewConfigValueBoolean ¶

func NewConfigValueBoolean(value BooleanConfigValue) ConfigValue

NewConfigValueBoolean builds a ConfigValue holding the BOOLEAN variant.

func NewConfigValueJSON ¶

func NewConfigValueJSON(value JSONConfigValue) ConfigValue

NewConfigValueJSON builds a ConfigValue holding the JSON variant.

func NewConfigValueNumber ¶

func NewConfigValueNumber(value NumberConfigValue) ConfigValue

NewConfigValueNumber builds a ConfigValue holding the NUMBER variant.

func NewConfigValueText ¶

func NewConfigValueText(value TextConfigValue) ConfigValue

NewConfigValueText builds a ConfigValue holding the TEXT variant.

func (ConfigValue) IsKnown ¶

func (u ConfigValue) IsKnown() bool

IsKnown reports whether Kind is one of the variants this SDK version knows about, i.e. one of the ConfigValue* constants. It is false for a variant added to the API later, whose payload is then only available from ConfigValue.Raw.

func (ConfigValue) MarshalJSON ¶

func (u ConfigValue) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (ConfigValue) Raw ¶

func (u ConfigValue) Raw() json.RawMessage

Raw returns the JSON of a variant this SDK version does not know about, as decoded (see ConfigValue.IsKnown). It is nil for a known variant, and for a value that was not decoded from JSON. The returned slice is a copy.

func (*ConfigValue) UnmarshalJSON ¶

func (u *ConfigValue) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Payloads carrying an unrecognized discriminator are kept rather than rejected, so a newer API version does not break older SDK builds. Re-encoding such a value reproduces the same JSON document, though not necessarily the same bytes: `encoding/json` compacts whitespace and escapes `<`, `>` and `&`.

type ConfigValueKind ¶

type ConfigValueKind string

ConfigValueKind is the kind of a ConfigValue, one of the ConfigValue* constants for a variant this SDK version knows.

const (
	ConfigValueNumber  ConfigValueKind = "NUMBER"
	ConfigValueBoolean ConfigValueKind = "BOOLEAN"
	ConfigValueText    ConfigValueKind = "TEXT"
	ConfigValueJSON    ConfigValueKind = "JSON"
)

Discriminator values for ConfigValue.

type ConfigValueType ¶

type ConfigValueType string

ConfigValueType is one of AllConfigValueTypeValues, or a value this SDK version does not know.

Authoritative value type of a Config feature. `MAP`/`JSON` both carry a JSON value.

const (
	ConfigValueTypeNumber  ConfigValueType = "NUMBER"
	ConfigValueTypeBoolean ConfigValueType = "BOOLEAN"
	ConfigValueTypeText    ConfigValueType = "TEXT"
	ConfigValueTypeMap     ConfigValueType = "MAP"
	ConfigValueTypeJSON    ConfigValueType = "JSON"
	ConfigValueTypeSelect  ConfigValueType = "SELECT"
)

Known values of ConfigValueType.

The API may add new values over time; unknown values round-trip unchanged.

func (ConfigValueType) IsKnown ¶

func (e ConfigValueType) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (ConfigValueType) String ¶

func (e ConfigValueType) String() string

String returns the wire representation of the value.

type Connect ¶

type Connect struct {
	// contains filtered or unexported fields
}

Connect groups the connect operations of the Meteroid API.

func (*Connect) CreateConnectedAccount ¶

func (a *Connect) CreateConnectedAccount(ctx context.Context, createConnectedAccountRequest CreateConnectedAccountRequest, opts ...RequestOption) (*ConnectedAccount, error)

CreateConnectedAccount sends POST /api/v1/connected-accounts.

Create connected account ¶

Create a new connected account (Express flow). Returns the account and an onboarding link for the user to complete setup.

func (a *Connect) CreateOnboardingLink(ctx context.Context, id string, createOnboardingLinkRequest CreateOnboardingLinkRequest, opts ...RequestOption) (*OnboardingLinkResponse, error)

CreateOnboardingLink sends POST /api/v1/connected-accounts/{id}/onboarding.

Generate a new onboarding link for a connected account. Any existing unused link is invalidated. The link expires after a configured duration.

func (*Connect) DisconnectAccount ¶

func (a *Connect) DisconnectAccount(ctx context.Context, id string, opts ...RequestOption) error

DisconnectAccount sends DELETE /api/v1/connected-accounts/{id}.

Disconnect account ¶

Revoke a connected account. All associated tokens are invalidated.

func (*Connect) ListConnectedAccounts ¶

func (a *Connect) ListConnectedAccounts(ctx context.Context, opts ...RequestOption) (*ConnectedAccountsResponse, error)

ListConnectedAccounts sends GET /api/v1/connected-accounts.

List connected accounts ¶

List all connected accounts for this platform.

func (*Connect) RetrieveConnectedAccount ¶

func (a *Connect) RetrieveConnectedAccount(ctx context.Context, id string, opts ...RequestOption) (*ConnectedAccount, error)

RetrieveConnectedAccount sends GET /api/v1/connected-accounts/{id}.

Get connected account ¶

Retrieve a connected account by ID.

type ConnectedAccount ¶

type ConnectedAccount struct {
	ConnectedOrganizationID *OrganizationID `json:"connected_organization_id,omitempty"`

	ConnectedTenantID *TenantID `json:"connected_tenant_id,omitempty"`

	ConnectionType ConnectionType `json:"connection_type"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	ID ConnectedAccountID `json:"id"`

	Metadata json.RawMessage `json:"metadata,omitempty"`

	// RFC 3339 timestamp.
	OnboardingCompletedAt *time.Time `json:"onboarding_completed_at,omitempty"`

	OnboardingMode OnboardingMode `json:"onboarding_mode"`

	PendingCountry *CountryCode `json:"pending_country,omitempty"`

	// Email of the user being invited (express flow only)
	PendingEmail *string `json:"pending_email,omitempty"`

	// Name of the organization to be created (express flow only)
	PendingOrganizationName *string `json:"pending_organization_name,omitempty"`

	PlatformCustomerID *CustomerID `json:"platform_customer_id,omitempty"`

	PlatformOrganizationID OrganizationID `json:"platform_organization_id"`

	// RFC 3339 timestamp.
	RevokedAt *time.Time `json:"revoked_at,omitempty"`

	Status ConnectionStatus `json:"status"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ConnectedAccount is the ConnectedAccount object of the Meteroid API.

A connected account (relationship between platform and connected org)

func (ConnectedAccount) MarshalJSON ¶

func (v ConnectedAccount) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ConnectedAccount) UnmarshalJSON ¶

func (v *ConnectedAccount) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ConnectedAccountID ¶

type ConnectedAccountID = string

ConnectedAccountID is the ConnectedAccountId string of the Meteroid API.

type ConnectedAccountsResponse ¶

type ConnectedAccountsResponse struct {
	Data RequiredSlice[ConnectedAccount] `json:"data"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ConnectedAccountsResponse is the ConnectedAccountsResponse object of the Meteroid API.

func (ConnectedAccountsResponse) MarshalJSON ¶

func (v ConnectedAccountsResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ConnectedAccountsResponse) UnmarshalJSON ¶

func (v *ConnectedAccountsResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ConnectionStatus ¶

type ConnectionStatus string

ConnectionStatus is one of AllConnectionStatusValues, or a value this SDK version does not know.

Status of a connected account

const (
	ConnectionStatusPending   ConnectionStatus = "pending"
	ConnectionStatusActive    ConnectionStatus = "active"
	ConnectionStatusRevoked   ConnectionStatus = "revoked"
	ConnectionStatusSuspended ConnectionStatus = "suspended"
)

Known values of ConnectionStatus.

The API may add new values over time; unknown values round-trip unchanged.

func (ConnectionStatus) IsKnown ¶

func (e ConnectionStatus) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (ConnectionStatus) String ¶

func (e ConnectionStatus) String() string

String returns the wire representation of the value.

type ConnectionType ¶

type ConnectionType string

ConnectionType is one of AllConnectionTypeValues, or a value this SDK version does not know.

Type of connection between platform and connected account

const (
	ConnectionTypeStandard ConnectionType = "standard"
	ConnectionTypeExpress  ConnectionType = "express"
)

Known values of ConnectionType.

The API may add new values over time; unknown values round-trip unchanged.

func (ConnectionType) IsKnown ¶

func (e ConnectionType) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (ConnectionType) String ¶

func (e ConnectionType) String() string

String returns the wire representation of the value.

type CountryCode ¶

type CountryCode = string

CountryCode is the CountryCode string of the Meteroid API.

type Coupon ¶

type Coupon struct {
	// RFC 3339 timestamp.
	ArchivedAt *time.Time `json:"archived_at,omitempty"`

	Code string `json:"code"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Description *string `json:"description,omitempty"`

	Disabled bool `json:"disabled"`

	Discount CouponDiscount `json:"discount"`

	// RFC 3339 timestamp.
	ExpiresAt *time.Time `json:"expires_at,omitempty"`

	ID CouponID `json:"id"`

	PlanIDs RequiredSlice[PlanID] `json:"plan_ids"`

	RecurringValue *int32 `json:"recurring_value,omitempty"`

	RedemptionCount int32 `json:"redemption_count"`

	RedemptionLimit *int32 `json:"redemption_limit,omitempty"`

	Reusable bool `json:"reusable"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

Coupon is the Coupon object of the Meteroid API.

func (Coupon) MarshalJSON ¶

func (v Coupon) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*Coupon) UnmarshalJSON ¶

func (v *Coupon) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CouponDiscount ¶

type CouponDiscount struct {
	// Type selects the active variant. Compare it against the
	// CouponDiscount* constants.
	Type CouponDiscountType `json:"type"`

	// Percentage is set when Type is CouponDiscountPercentage.
	Percentage *PercentageDiscount `json:"-"`
	// Fixed is set when Type is CouponDiscountFixed.
	Fixed *FixedDiscount `json:"-"`
	// contains filtered or unexported fields
}

CouponDiscount is a tagged union discriminated by the type field.

When CouponDiscount.IsKnown reports true, exactly one variant pointer is set, matching Type. A variant added to the API after this SDK version was released still decodes without error, but with every variant pointer nil: always give a `switch` on Type a `default:` branch (or check IsKnown first) instead of dereferencing a pointer unconditionally. The unknown variant's JSON is available from CouponDiscount.Raw.

func NewCouponDiscountFixed ¶

func NewCouponDiscountFixed(value FixedDiscount) CouponDiscount

NewCouponDiscountFixed builds a CouponDiscount holding the FIXED variant.

func NewCouponDiscountPercentage ¶

func NewCouponDiscountPercentage(value PercentageDiscount) CouponDiscount

NewCouponDiscountPercentage builds a CouponDiscount holding the PERCENTAGE variant.

func (CouponDiscount) IsKnown ¶

func (u CouponDiscount) IsKnown() bool

IsKnown reports whether Type is one of the variants this SDK version knows about, i.e. one of the CouponDiscount* constants. It is false for a variant added to the API later, whose payload is then only available from CouponDiscount.Raw.

func (CouponDiscount) MarshalJSON ¶

func (u CouponDiscount) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (CouponDiscount) Raw ¶

func (u CouponDiscount) Raw() json.RawMessage

Raw returns the JSON of a variant this SDK version does not know about, as decoded (see CouponDiscount.IsKnown). It is nil for a known variant, and for a value that was not decoded from JSON. The returned slice is a copy.

func (*CouponDiscount) UnmarshalJSON ¶

func (u *CouponDiscount) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Payloads carrying an unrecognized discriminator are kept rather than rejected, so a newer API version does not break older SDK builds. Re-encoding such a value reproduces the same JSON document, though not necessarily the same bytes: `encoding/json` compacts whitespace and escapes `<`, `>` and `&`.

type CouponDiscountType ¶

type CouponDiscountType string

CouponDiscountType is the type of a CouponDiscount, one of the CouponDiscount* constants for a variant this SDK version knows.

const (
	CouponDiscountPercentage CouponDiscountType = "PERCENTAGE"
	CouponDiscountFixed      CouponDiscountType = "FIXED"
)

Discriminator values for CouponDiscount.

type CouponEvent ¶

type CouponEvent struct {
	Code string `json:"code"`

	CouponID CouponID `json:"coupon_id"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Description string `json:"description"`

	Disabled bool `json:"disabled"`

	Discount CouponDiscount `json:"discount"`

	// RFC 3339 timestamp.
	ExpiresAt *time.Time `json:"expires_at,omitempty"`

	RecurringValue *int32 `json:"recurring_value,omitempty"`

	RedemptionLimit *int32 `json:"redemption_limit,omitempty"`

	Reusable bool `json:"reusable"`

	ID EventID `json:"id"`

	// RFC 3339 timestamp.
	Timestamp time.Time `json:"timestamp"`

	Type EventType `json:"type"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CouponEvent is the CouponEvent object of the Meteroid API.

func (CouponEvent) MarshalJSON ¶

func (v CouponEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CouponEvent) UnmarshalJSON ¶

func (v *CouponEvent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CouponEventData ¶

type CouponEventData struct {
	Code string `json:"code"`

	CouponID CouponID `json:"coupon_id"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Description string `json:"description"`

	Disabled bool `json:"disabled"`

	Discount CouponDiscount `json:"discount"`

	// RFC 3339 timestamp.
	ExpiresAt *time.Time `json:"expires_at,omitempty"`

	RecurringValue *int32 `json:"recurring_value,omitempty"`

	RedemptionLimit *int32 `json:"redemption_limit,omitempty"`

	Reusable bool `json:"reusable"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CouponEventData is the CouponEventData object of the Meteroid API.

func (CouponEventData) MarshalJSON ¶

func (v CouponEventData) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CouponEventData) UnmarshalJSON ¶

func (v *CouponEventData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CouponFilter ¶

type CouponFilter string

CouponFilter is one of AllCouponFilterValues, or a value this SDK version does not know.

const (
	CouponFilterAll      CouponFilter = "ALL"
	CouponFilterActive   CouponFilter = "ACTIVE"
	CouponFilterInactive CouponFilter = "INACTIVE"
	CouponFilterArchived CouponFilter = "ARCHIVED"
)

Known values of CouponFilter.

The API may add new values over time; unknown values round-trip unchanged.

func (CouponFilter) IsKnown ¶

func (e CouponFilter) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (CouponFilter) String ¶

func (e CouponFilter) String() string

String returns the wire representation of the value.

type CouponID ¶

type CouponID = string

CouponID is the CouponId string of the Meteroid API.

type CouponLineItem ¶

type CouponLineItem struct {
	CouponID string `json:"coupon_id"`

	Name string `json:"name"`

	Total int64 `json:"total"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CouponLineItem is the CouponLineItem object of the Meteroid API.

func (CouponLineItem) MarshalJSON ¶

func (v CouponLineItem) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CouponLineItem) UnmarshalJSON ¶

func (v *CouponLineItem) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CouponListResponse ¶

type CouponListResponse struct {
	Data RequiredSlice[Coupon] `json:"data"`

	PaginationMeta PaginationResponse `json:"pagination_meta"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CouponListResponse is the CouponListResponse object of the Meteroid API.

func (CouponListResponse) MarshalJSON ¶

func (v CouponListResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CouponListResponse) UnmarshalJSON ¶

func (v *CouponListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type Coupons ¶

type Coupons struct {
	// contains filtered or unexported fields
}

Coupons groups the coupons operations of the Meteroid API.

func (*Coupons) Archive ¶

func (a *Coupons) Archive(ctx context.Context, couponID string, opts ...RequestOption) error

Archive a coupon

func (*Coupons) Create ¶

func (a *Coupons) Create(ctx context.Context, createCouponRequest CreateCouponRequest, opts ...RequestOption) (*Coupon, error)

Create a coupon

func (*Coupons) Disable ¶

func (a *Coupons) Disable(ctx context.Context, couponID string, opts ...RequestOption) error

Disable a coupon

func (*Coupons) Enable ¶

func (a *Coupons) Enable(ctx context.Context, couponID string, opts ...RequestOption) error

Enable a coupon

func (*Coupons) List ¶

func (a *Coupons) List(ctx context.Context, options *CouponsListOptions, opts ...RequestOption) (*CouponsListPage, error)

List coupons

Coupons.ListAutoPaging iterates over every item instead.

func (*Coupons) ListAutoPaging ¶ added in v0.28.0

func (a *Coupons) ListAutoPaging(ctx context.Context, options *CouponsListOptions, opts ...RequestOption) *AutoPager[Coupon]

ListAutoPaging iterates over every item of Coupons.List, fetching further pages on demand.

func (*Coupons) Retrieve ¶

func (a *Coupons) Retrieve(ctx context.Context, couponID string, opts ...RequestOption) (*Coupon, error)

Retrieve sends GET /api/v1/coupons/{coupon_id}.

Get coupon details

func (*Coupons) Unarchive ¶

func (a *Coupons) Unarchive(ctx context.Context, couponID string, opts ...RequestOption) error

Unarchive a coupon

func (*Coupons) Update ¶

func (a *Coupons) Update(ctx context.Context, couponID string, updateCouponRequest UpdateCouponRequest, opts ...RequestOption) (*Coupon, error)

Update a coupon

type CouponsListOptions ¶

type CouponsListOptions struct {
	Search *string

	Filter *CouponFilter

	// Sort order. Format: `column.direction`. Allowed columns: `code`, `created_at`, `expires_at`. Direction: `asc` or `desc`. Default: `created_at.desc`.
	OrderBy *string

	// Page number (0-indexed)
	Page *int32

	// Number of items per page
	PerPage *int32
}

CouponsListOptions carries the optional query and header parameters of Coupons.List. Leave a field nil to omit it.

type CouponsListPage ¶ added in v0.28.0

type CouponsListPage struct {
	CouponListResponse

	// Items holds the items of this page.
	Items []Coupon
	// contains filtered or unexported fields
}

CouponsListPage is a page of Coupons.List. It embeds the decoded CouponListResponse, promoting its fields, with the Items of the page; a field named like a page member stays reachable through the embedded CouponListResponse.

func (*CouponsListPage) HasNextPage ¶ added in v0.28.0

func (p *CouponsListPage) HasNextPage() bool

HasNextPage reports whether another page follows this one.

func (CouponsListPage) MarshalJSON ¶ added in v0.28.0

func (p CouponsListPage) MarshalJSON() ([]byte, error)

MarshalJSON encodes the CouponListResponse of the page, as received.

func (*CouponsListPage) NextPage ¶ added in v0.28.0

func (p *CouponsListPage) NextPage(ctx context.Context) (*CouponsListPage, error)

NextPage fetches the page after this one. It returns nil and no error after the last page.

type CreateAddOnRequest ¶

type CreateAddOnRequest struct {
	Description *string `json:"description,omitempty"`

	MaxInstancesPerSubscription *int32 `json:"max_instances_per_subscription,omitempty"`

	Name string `json:"name"`

	PriceID PriceID `json:"price_id"`

	ProductID ProductID `json:"product_id"`

	SelfServiceable *bool `json:"self_serviceable,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CreateAddOnRequest is the CreateAddOnRequest object of the Meteroid API.

func (CreateAddOnRequest) MarshalJSON ¶

func (v CreateAddOnRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CreateAddOnRequest) UnmarshalJSON ¶

func (v *CreateAddOnRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CreateCheckoutSessionRequest ¶

type CreateCheckoutSessionRequest struct {
	AddOns []CreateSubscriptionAddOn `json:"add_ons,omitempty"`

	// If false, invoices will stay in Draft until manually reviewed and finalized. Default is true.
	AutoAdvanceInvoices *bool `json:"auto_advance_invoices,omitempty"`

	BillingDayAnchor *int32 `json:"billing_day_anchor,omitempty"`

	BillingStartDate *Date `json:"billing_start_date,omitempty"`

	// Absolute http(s) URL offered to the customer to leave the checkout without paying.
	CancelURL *string `json:"cancel_url,omitempty"`

	// Automatically try to charge the customer's configured payment method on finalize. Default is true.
	ChargeAutomatically *bool `json:"charge_automatically,omitempty"`

	Components *CreateSubscriptionComponents `json:"components,omitempty"`

	CouponCode *string `json:"coupon_code,omitempty"`

	CouponIDs []CouponID `json:"coupon_ids,omitempty"`

	// Customer ID or alias
	CustomerID string `json:"customer_id"`

	EndDate *Date `json:"end_date,omitempty"`

	// Session expiry time in hours. Default is 1 hour for self-serve checkout.
	ExpiresInHours *int32 `json:"expires_in_hours,omitempty"`

	InvoiceMemo *string `json:"invoice_memo,omitempty"`

	InvoiceThreshold *string `json:"invoice_threshold,omitempty"`

	Metadata json.RawMessage `json:"metadata,omitempty"`

	NetTerms *int32 `json:"net_terms,omitempty"`

	PaymentMethodsConfig *PaymentMethodsConfig `json:"payment_methods_config,omitempty"`

	PlanVersionID PlanVersionID `json:"plan_version_id"`

	PurchaseOrder *string `json:"purchase_order,omitempty"`

	// Absolute http(s) URL the customer is sent to after a successful checkout.
	// `checkout_session_id` is appended as a query parameter. Without it the customer stays on
	// the hosted confirmation page.
	SuccessURL *string `json:"success_url,omitempty"`

	TrialDurationDays *int32 `json:"trial_duration_days,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CreateCheckoutSessionRequest is the CreateCheckoutSessionRequest object of the Meteroid API.

func (CreateCheckoutSessionRequest) MarshalJSON ¶

func (v CreateCheckoutSessionRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CreateCheckoutSessionRequest) UnmarshalJSON ¶

func (v *CreateCheckoutSessionRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CreateCheckoutSessionResponse ¶

type CreateCheckoutSessionResponse struct {
	Session CheckoutSession `json:"session"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CreateCheckoutSessionResponse is the CreateCheckoutSessionResponse object of the Meteroid API.

func (CreateCheckoutSessionResponse) MarshalJSON ¶

func (v CreateCheckoutSessionResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CreateCheckoutSessionResponse) UnmarshalJSON ¶

func (v *CreateCheckoutSessionResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CreateConnectedAccountRequest ¶

type CreateConnectedAccountRequest struct {
	ConnectedOrganizationID uuid.UUID `json:"connected_organization_id"`

	ConnectionType *ConnectionType `json:"connection_type,omitempty"`

	Metadata json.RawMessage `json:"metadata,omitempty"`

	PlatformCustomerID *CustomerID `json:"platform_customer_id,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CreateConnectedAccountRequest is the CreateConnectedAccountRequest object of the Meteroid API.

func (CreateConnectedAccountRequest) MarshalJSON ¶

func (v CreateConnectedAccountRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CreateConnectedAccountRequest) UnmarshalJSON ¶

func (v *CreateConnectedAccountRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CreateCouponRequest ¶

type CreateCouponRequest struct {
	Code string `json:"code"`

	Description *string `json:"description,omitempty"`

	Discount CouponDiscount `json:"discount"`

	// RFC 3339 timestamp.
	ExpiresAt *time.Time `json:"expires_at,omitempty"`

	PlanIDs []PlanID `json:"plan_ids,omitempty"`

	RecurringValue *int32 `json:"recurring_value,omitempty"`

	RedemptionLimit *int32 `json:"redemption_limit,omitempty"`

	Reusable *bool `json:"reusable,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CreateCouponRequest is the CreateCouponRequest object of the Meteroid API.

func (CreateCouponRequest) MarshalJSON ¶

func (v CreateCouponRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CreateCouponRequest) UnmarshalJSON ¶

func (v *CreateCouponRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CreateEntitlementsRequest ¶

type CreateEntitlementsRequest struct {
	Entitlements RequiredSlice[EntitlementSpecRequest] `json:"entitlements"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CreateEntitlementsRequest is the CreateEntitlementsRequest object of the Meteroid API.

Entitlements already present on the entity are skipped, so the call can be replayed.

func (CreateEntitlementsRequest) MarshalJSON ¶

func (v CreateEntitlementsRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CreateEntitlementsRequest) UnmarshalJSON ¶

func (v *CreateEntitlementsRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CreateFeatureRequest ¶

type CreateFeatureRequest struct {
	// Unique key used to reference this feature in your code. Cannot be changed after creation.
	Code string `json:"code"`

	Description *string `json:"description,omitempty"`

	Entitlement *EntitlementValue `json:"entitlement,omitempty"`

	// Fixed at creation — a feature never changes type.
	FeatureType FeatureType `json:"feature_type"`

	Name string `json:"name"`

	ProductID *ProductID `json:"product_id,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CreateFeatureRequest is the CreateFeatureRequest object of the Meteroid API.

func (CreateFeatureRequest) MarshalJSON ¶

func (v CreateFeatureRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CreateFeatureRequest) UnmarshalJSON ¶

func (v *CreateFeatureRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CreateMetricRequest ¶

type CreateMetricRequest struct {
	AggregationKey *string `json:"aggregation_key,omitempty"`

	AggregationType BillingMetricAggregateEnum `json:"aggregation_type"`

	Code string `json:"code"`

	Description *string `json:"description,omitempty"`

	// Pre-aggregation property filters. Optional and backward-compatible; omit for none.
	Filters []MetricFilter `json:"filters,omitempty"`

	Name string `json:"name"`

	ProductFamilyID ProductFamilyID `json:"product_family_id"`

	ProductID *ProductID `json:"product_id,omitempty"`

	SegmentationMatrix *MetricSegmentationMatrix `json:"segmentation_matrix,omitempty"`

	UnitConversion *UnitConversion `json:"unit_conversion,omitempty"`

	UsageGroupKey *string `json:"usage_group_key,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CreateMetricRequest is the CreateMetricRequest object of the Meteroid API.

func (CreateMetricRequest) MarshalJSON ¶

func (v CreateMetricRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CreateMetricRequest) UnmarshalJSON ¶

func (v *CreateMetricRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CreateOAuthAppRequest ¶

type CreateOAuthAppRequest struct {
	Name string `json:"name"`

	RedirectURIs RequiredSlice[string] `json:"redirect_uris"`

	Scopes []string `json:"scopes,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CreateOAuthAppRequest is the CreateOAuthAppRequest object of the Meteroid API.

func (CreateOAuthAppRequest) MarshalJSON ¶

func (v CreateOAuthAppRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CreateOAuthAppRequest) UnmarshalJSON ¶

func (v *CreateOAuthAppRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CreateOnboardingLinkRequest ¶

type CreateOnboardingLinkRequest struct {
	RedirectURL string `json:"redirect_url"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CreateOnboardingLinkRequest is the CreateOnboardingLinkRequest object of the Meteroid API.

func (CreateOnboardingLinkRequest) MarshalJSON ¶

func (v CreateOnboardingLinkRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CreateOnboardingLinkRequest) UnmarshalJSON ¶

func (v *CreateOnboardingLinkRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CreatePlanRequest ¶

type CreatePlanRequest struct {
	AddOns []PlanAddOnInput `json:"add_ons,omitempty"`

	Billing *BillingConfig `json:"billing,omitempty"`

	Components RequiredSlice[PriceComponentInput] `json:"components"`

	Currency string `json:"currency"`

	Description *string `json:"description,omitempty"`

	// Entitlements to attach to this plan's version. Replacing a published plan creates a
	// new version, and entitlements belong to a version, so passing them here keeps them
	// attached to whichever version the call produces.
	Entitlements []EntitlementSpecRequest `json:"entitlements,omitempty"`

	Name string `json:"name"`

	PlanType PlanTypeEnum `json:"plan_type"`

	ProductFamilyID ProductFamilyID `json:"product_family_id"`

	SelfServiceRank *int32 `json:"self_service_rank,omitempty"`

	Status PlanStatusEnum `json:"status"`

	// The plan's amounts are quoted tax-included ("9.99 incl. VAT"): tax is carved out of
	// them at invoice time instead of being added on top, so the customer pays the quoted
	// price whatever rate applies. A customer who bears no tax (reverse charge, exempt,
	// export) still pays it in full. Defaults to `false`.
	TaxInclusive *bool `json:"tax_inclusive,omitempty"`

	Trial *TrialConfig `json:"trial,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CreatePlanRequest is the CreatePlanRequest object of the Meteroid API.

func (CreatePlanRequest) MarshalJSON ¶

func (v CreatePlanRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CreatePlanRequest) UnmarshalJSON ¶

func (v *CreatePlanRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CreateProductRequest ¶

type CreateProductRequest struct {
	Catalog *bool `json:"catalog,omitempty"`

	Description *string `json:"description,omitempty"`

	FeeStructure ProductFeeStructure `json:"fee_structure"`

	Name string `json:"name"`

	ProductFamilyID ProductFamilyID `json:"product_family_id"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CreateProductRequest is the CreateProductRequest object of the Meteroid API.

func (CreateProductRequest) MarshalJSON ¶

func (v CreateProductRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CreateProductRequest) UnmarshalJSON ¶

func (v *CreateProductRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CreateSubscriptionAddOn ¶

type CreateSubscriptionAddOn struct {
	AddOnID AddOnID `json:"add_on_id"`

	Customization *SubscriptionAddOnCustomization `json:"customization,omitempty"`

	Quantity *int32 `json:"quantity,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CreateSubscriptionAddOn is the CreateSubscriptionAddOn object of the Meteroid API.

func (CreateSubscriptionAddOn) MarshalJSON ¶

func (v CreateSubscriptionAddOn) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CreateSubscriptionAddOn) UnmarshalJSON ¶

func (v *CreateSubscriptionAddOn) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CreateSubscriptionComponents ¶

type CreateSubscriptionComponents struct {
	ExtraComponents []ExtraComponent `json:"extra_components,omitempty"`

	OverriddenComponents []ComponentOverride `json:"overridden_components,omitempty"`

	ParameterizedComponents []ComponentParameterization `json:"parameterized_components,omitempty"`

	RemoveComponents []PriceComponentID `json:"remove_components,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CreateSubscriptionComponents is the CreateSubscriptionComponents object of the Meteroid API.

func (CreateSubscriptionComponents) MarshalJSON ¶

func (v CreateSubscriptionComponents) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CreateSubscriptionComponents) UnmarshalJSON ¶

func (v *CreateSubscriptionComponents) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CreateWebhookEndpointRequest ¶ added in v0.30.0

type CreateWebhookEndpointRequest struct {
	Description *string `json:"description,omitempty"`

	// Event types to subscribe to. Omit or leave empty to receive every event type.
	EventTypes []string `json:"event_types,omitempty"`

	// Custom headers sent with every delivery.
	Headers []WebhookHeaderInput `json:"headers,omitempty"`

	// Deliveries started per second, at most (1 to 1000).
	RateLimitPerSec *int32 `json:"rate_limit_per_sec,omitempty"`

	// HTTPS destination. Private and loopback addresses are rejected unless the
	// instance is configured to allow them.
	URL string `json:"url"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CreateWebhookEndpointRequest is the CreateWebhookEndpointRequest object of the Meteroid API.

func (CreateWebhookEndpointRequest) MarshalJSON ¶ added in v0.30.0

func (v CreateWebhookEndpointRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CreateWebhookEndpointRequest) UnmarshalJSON ¶ added in v0.30.0

func (v *CreateWebhookEndpointRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CreatedWebhookEndpoint ¶ added in v0.30.0

type CreatedWebhookEndpoint struct {
	// Failures since the last success, reset to 0 on any 2xx.
	ConsecutiveFailures int32 `json:"consecutive_failures"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Description *string `json:"description,omitempty"`

	Disabled bool `json:"disabled"`

	DisabledReason *WebhookEndpointDisabledReason `json:"disabled_reason,omitempty"`

	// Subscribed event types. Empty means every event type.
	EventTypes RequiredSlice[string] `json:"event_types"`

	// Custom headers sent with every delivery.
	Headers RequiredSlice[WebhookHeader] `json:"headers"`

	ID WebhookEndpointID `json:"id"`

	// RFC 3339 timestamp.
	LastFailureAt *time.Time `json:"last_failure_at,omitempty"`

	// RFC 3339 timestamp.
	LastSuccessAt *time.Time `json:"last_success_at,omitempty"`

	// How many deliveries this endpoint may have in flight at once. Read-only; it is
	// set from the tenant's environment when the endpoint is created.
	MaxInFlight int32 `json:"max_in_flight"`

	// A sensitive header still waits for its value; the endpoint cannot be enabled
	// until it is set.
	NeedsSetup bool `json:"needs_setup"`

	// The endpoint was unreachable several times in a row: nothing is sent before
	// this time, then it is retried one delivery at a time until it answers again.
	// RFC 3339 timestamp.
	PausedUntil *time.Time `json:"paused_until,omitempty"`

	// Deliveries started per second, at most.
	RateLimitPerSec *int32 `json:"rate_limit_per_sec,omitempty"`

	// RFC 3339 timestamp.
	UpdatedAt *time.Time `json:"updated_at,omitempty"`

	URL string `json:"url"`

	Secret string `json:"secret"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CreatedWebhookEndpoint is the CreatedWebhookEndpoint object of the Meteroid API.

The signing secret is returned in full here and never again outside the reveal and rotate endpoints.

func (CreatedWebhookEndpoint) MarshalJSON ¶ added in v0.30.0

func (v CreatedWebhookEndpoint) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CreatedWebhookEndpoint) UnmarshalJSON ¶ added in v0.30.0

func (v *CreatedWebhookEndpoint) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CreditNote ¶

type CreditNote struct {
	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	CreditNoteNumber string `json:"credit_note_number"`

	CreditType CreditType `json:"credit_type"`

	CreditedAmountCents int64 `json:"credited_amount_cents"`

	Currency Currency `json:"currency"`

	// User-defined custom property values, keyed by definition `key`.
	CustomProperties json.RawMessage `json:"custom_properties"`

	CustomerID CustomerID `json:"customer_id"`

	// RFC 3339 timestamp.
	FinalizedAt *time.Time `json:"finalized_at,omitempty"`

	ID CreditNoteID `json:"id"`

	InvoiceID InvoiceID `json:"invoice_id"`

	InvoiceNumber string `json:"invoice_number"`

	LineItems RequiredSlice[InvoiceLineItem] `json:"line_items"`

	Memo *string `json:"memo,omitempty"`

	PlanVersionID *PlanVersionID `json:"plan_version_id,omitempty"`

	Reason *string `json:"reason,omitempty"`

	RefundedAmountCents int64 `json:"refunded_amount_cents"`

	Status CreditNoteStatus `json:"status"`

	SubscriptionID *SubscriptionID `json:"subscription_id,omitempty"`

	Subtotal int64 `json:"subtotal"`

	TaxAmount int64 `json:"tax_amount"`

	TaxBreakdown RequiredSlice[TaxBreakdownItem] `json:"tax_breakdown"`

	Total int64 `json:"total"`

	// RFC 3339 timestamp.
	UpdatedAt *time.Time `json:"updated_at,omitempty"`

	// RFC 3339 timestamp.
	VoidedAt *time.Time `json:"voided_at,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CreditNote is the CreditNote object of the Meteroid API.

func (CreditNote) MarshalJSON ¶

func (v CreditNote) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CreditNote) UnmarshalJSON ¶

func (v *CreditNote) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CreditNoteCustomPropertiesRequest ¶

type CreditNoteCustomPropertiesRequest struct {
	CustomProperties json.RawMessage `json:"custom_properties"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CreditNoteCustomPropertiesRequest is the CreditNoteCustomPropertiesRequest object of the Meteroid API.

Merge update of a credit note's custom property values (send a key with `null` to remove it). Allowed at any status — custom properties stay editable after the credit note is finalized.

func (CreditNoteCustomPropertiesRequest) MarshalJSON ¶

func (v CreditNoteCustomPropertiesRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CreditNoteCustomPropertiesRequest) UnmarshalJSON ¶

func (v *CreditNoteCustomPropertiesRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CreditNoteEvent ¶

type CreditNoteEvent struct {
	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	CreditNoteID CreditNoteID `json:"credit_note_id"`

	// Absent while the credit note is a draft — the number is assigned at finalization.
	CreditNoteNumber *string `json:"credit_note_number,omitempty"`

	CreditedAmountCents int64 `json:"credited_amount_cents"`

	Currency string `json:"currency"`

	// User-defined custom property values, keyed by definition key.
	CustomProperties json.RawMessage `json:"custom_properties"`

	CustomerID CustomerID `json:"customer_id"`

	InvoiceID InvoiceID `json:"invoice_id"`

	// Number of the invoice being credited.
	InvoiceNumber *string `json:"invoice_number,omitempty"`

	// Credited line items (negated amounts).
	LineItems RequiredSlice[InvoiceLineItem] `json:"line_items"`

	Memo *string `json:"memo,omitempty"`

	Reason *string `json:"reason,omitempty"`

	RefundedAmountCents int64 `json:"refunded_amount_cents"`

	Status CreditNoteStatus `json:"status"`

	Subtotal int64 `json:"subtotal"`

	TaxAmount int64 `json:"tax_amount"`

	// Per-rate tax (VAT) breakdown for the credited amount.
	TaxBreakdown RequiredSlice[TaxBreakdownItem] `json:"tax_breakdown"`

	Total int64 `json:"total"`

	ID EventID `json:"id"`

	// RFC 3339 timestamp.
	Timestamp time.Time `json:"timestamp"`

	Type EventType `json:"type"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CreditNoteEvent is the CreditNoteEvent object of the Meteroid API.

func (CreditNoteEvent) MarshalJSON ¶

func (v CreditNoteEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CreditNoteEvent) UnmarshalJSON ¶

func (v *CreditNoteEvent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CreditNoteEventData ¶

type CreditNoteEventData struct {
	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	CreditNoteID CreditNoteID `json:"credit_note_id"`

	// Absent while the credit note is a draft — the number is assigned at finalization.
	CreditNoteNumber *string `json:"credit_note_number,omitempty"`

	CreditedAmountCents int64 `json:"credited_amount_cents"`

	Currency string `json:"currency"`

	// User-defined custom property values, keyed by definition key.
	CustomProperties json.RawMessage `json:"custom_properties"`

	CustomerID CustomerID `json:"customer_id"`

	InvoiceID InvoiceID `json:"invoice_id"`

	// Number of the invoice being credited.
	InvoiceNumber *string `json:"invoice_number,omitempty"`

	// Credited line items (negated amounts).
	LineItems RequiredSlice[InvoiceLineItem] `json:"line_items"`

	Memo *string `json:"memo,omitempty"`

	Reason *string `json:"reason,omitempty"`

	RefundedAmountCents int64 `json:"refunded_amount_cents"`

	Status CreditNoteStatus `json:"status"`

	Subtotal int64 `json:"subtotal"`

	TaxAmount int64 `json:"tax_amount"`

	// Per-rate tax (VAT) breakdown for the credited amount.
	TaxBreakdown RequiredSlice[TaxBreakdownItem] `json:"tax_breakdown"`

	Total int64 `json:"total"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CreditNoteEventData is the CreditNoteEventData object of the Meteroid API.

func (CreditNoteEventData) MarshalJSON ¶

func (v CreditNoteEventData) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CreditNoteEventData) UnmarshalJSON ¶

func (v *CreditNoteEventData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CreditNoteID ¶

type CreditNoteID = string

CreditNoteID is the CreditNoteId string of the Meteroid API.

type CreditNoteListResponse ¶

type CreditNoteListResponse struct {
	Data RequiredSlice[CreditNote] `json:"data"`

	PaginationMeta PaginationResponse `json:"pagination_meta"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CreditNoteListResponse is the CreditNoteListResponse object of the Meteroid API.

func (CreditNoteListResponse) MarshalJSON ¶

func (v CreditNoteListResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CreditNoteListResponse) UnmarshalJSON ¶

func (v *CreditNoteListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CreditNoteStatus ¶

type CreditNoteStatus string

CreditNoteStatus is one of AllCreditNoteStatusValues, or a value this SDK version does not know.

const (
	CreditNoteStatusDraft     CreditNoteStatus = "DRAFT"
	CreditNoteStatusFinalized CreditNoteStatus = "FINALIZED"
	CreditNoteStatusVoided    CreditNoteStatus = "VOIDED"
)

Known values of CreditNoteStatus.

The API may add new values over time; unknown values round-trip unchanged.

func (CreditNoteStatus) IsKnown ¶

func (e CreditNoteStatus) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (CreditNoteStatus) String ¶

func (e CreditNoteStatus) String() string

String returns the wire representation of the value.

type CreditNotes ¶

type CreditNotes struct {
	// contains filtered or unexported fields
}

CreditNotes groups the credit notes operations of the Meteroid API.

func (*CreditNotes) Download ¶

func (a *CreditNotes) Download(ctx context.Context, creditNoteID string, opts ...RequestOption) ([]byte, error)

Download sends GET /api/v1/credit-notes/{credit_note_id}/download.

func (*CreditNotes) DownloadXML ¶

func (a *CreditNotes) DownloadXML(ctx context.Context, creditNoteID string, opts ...RequestOption) ([]byte, error)

DownloadXML sends GET /api/v1/credit-notes/{credit_note_id}/xml.

Download credit note e-invoice XML ¶

Download the structured e-invoice (EN 16931 XML) issued with a credit note. For Factur-X the same XML is also embedded in the PDF.

func (*CreditNotes) List ¶

List credit notes

List a tenant's credit notes, optionally filtered by customer, invoice or status.

CreditNotes.ListAutoPaging iterates over every item instead.

func (*CreditNotes) ListAutoPaging ¶ added in v0.28.0

func (a *CreditNotes) ListAutoPaging(ctx context.Context, options *CreditNotesListOptions, opts ...RequestOption) *AutoPager[CreditNote]

ListAutoPaging iterates over every item of CreditNotes.List, fetching further pages on demand.

func (*CreditNotes) Retrieve ¶

func (a *CreditNotes) Retrieve(ctx context.Context, creditNoteID string, opts ...RequestOption) (*CreditNote, error)

Retrieve sends GET /api/v1/credit-notes/{credit_note_id}.

Get credit note ¶

Retrieve a single credit note by ID.

func (*CreditNotes) UpdateCustomProperties ¶

func (a *CreditNotes) UpdateCustomProperties(ctx context.Context, creditNoteID string, creditNoteCustomPropertiesRequest CreditNoteCustomPropertiesRequest, opts ...RequestOption) (*CreditNote, error)

UpdateCustomProperties sends PATCH /api/v1/credit-notes/{credit_note_id}/custom-properties.

Update credit note custom properties ¶

Merge custom property values onto a credit note (send a key with `null` to remove it). Values are validated against the tenant's `CREDIT_NOTE` property definitions. Allowed at any status — custom properties are external workflow metadata and stay editable after the credit note is finalized.

type CreditNotesListOptions ¶

type CreditNotesListOptions struct {
	// Filter by customer ID
	CustomerID *CustomerID

	// Filter by invoice ID
	InvoiceID *InvoiceID

	Status *CreditNoteStatus

	// Free-text search over credit note number.
	Search *string

	// Sort order. Format: `column.direction`. Allowed columns: `created_at`, `credit_note_number`, `total`, `status`. Direction: `asc` or `desc`. Default: `created_at.desc`.
	OrderBy *string

	// Page number (0-indexed)
	Page *int32

	// Number of items per page
	PerPage *int32
}

CreditNotesListOptions carries the optional query and header parameters of CreditNotes.List. Leave a field nil to omit it.

type CreditNotesListPage ¶ added in v0.28.0

type CreditNotesListPage struct {
	CreditNoteListResponse

	// Items holds the items of this page.
	Items []CreditNote
	// contains filtered or unexported fields
}

CreditNotesListPage is a page of CreditNotes.List. It embeds the decoded CreditNoteListResponse, promoting its fields, with the Items of the page; a field named like a page member stays reachable through the embedded CreditNoteListResponse.

func (*CreditNotesListPage) HasNextPage ¶ added in v0.28.0

func (p *CreditNotesListPage) HasNextPage() bool

HasNextPage reports whether another page follows this one.

func (CreditNotesListPage) MarshalJSON ¶ added in v0.28.0

func (p CreditNotesListPage) MarshalJSON() ([]byte, error)

MarshalJSON encodes the CreditNoteListResponse of the page, as received.

func (*CreditNotesListPage) NextPage ¶ added in v0.28.0

NextPage fetches the page after this one. It returns nil and no error after the last page.

type CreditType ¶

type CreditType string

CreditType is one of AllCreditTypeValues, or a value this SDK version does not know.

const (
	CreditTypeCreditToBalance  CreditType = "CREDIT_TO_BALANCE"
	CreditTypeRefund           CreditType = "REFUND"
	CreditTypeDebtCancellation CreditType = "DEBT_CANCELLATION"
)

Known values of CreditType.

The API may add new values over time; unknown values round-trip unchanged.

func (CreditType) IsKnown ¶

func (e CreditType) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (CreditType) String ¶

func (e CreditType) String() string

String returns the wire representation of the value.

type Currency ¶

type Currency string

Currency is one of AllCurrencyValues, or a value this SDK version does not know.

const (
	CurrencyAed Currency = "AED"
	CurrencyAfn Currency = "AFN"
	CurrencyAll Currency = "ALL"
	CurrencyAmd Currency = "AMD"
	CurrencyAng Currency = "ANG"
	CurrencyAoa Currency = "AOA"
	CurrencyArs Currency = "ARS"
	CurrencyAud Currency = "AUD"
	CurrencyAwg Currency = "AWG"
	CurrencyAzn Currency = "AZN"
	CurrencyBam Currency = "BAM"
	CurrencyBbd Currency = "BBD"
	CurrencyBdt Currency = "BDT"
	CurrencyBgn Currency = "BGN"
	CurrencyBhd Currency = "BHD"
	CurrencyBif Currency = "BIF"
	CurrencyBmd Currency = "BMD"
	CurrencyBnd Currency = "BND"
	CurrencyBob Currency = "BOB"
	CurrencyBrl Currency = "BRL"
	CurrencyBsd Currency = "BSD"
	CurrencyBtn Currency = "BTN"
	CurrencyBwp Currency = "BWP"
	CurrencyByn Currency = "BYN"
	CurrencyBzd Currency = "BZD"
	CurrencyCad Currency = "CAD"
	CurrencyCdf Currency = "CDF"
	CurrencyChf Currency = "CHF"
	CurrencyClp Currency = "CLP"
	CurrencyCnh Currency = "CNH"
	CurrencyCny Currency = "CNY"
	CurrencyCop Currency = "COP"
	CurrencyCrc Currency = "CRC"
	CurrencyCuc Currency = "CUC"
	CurrencyCup Currency = "CUP"
	CurrencyCve Currency = "CVE"
	CurrencyCzk Currency = "CZK"
	CurrencyDjf Currency = "DJF"
	CurrencyDkk Currency = "DKK"
	CurrencyDop Currency = "DOP"
	CurrencyDzd Currency = "DZD"
	CurrencyEgp Currency = "EGP"
	CurrencyErn Currency = "ERN"
	CurrencyEtb Currency = "ETB"
	CurrencyEur Currency = "EUR"
	CurrencyFjd Currency = "FJD"
	CurrencyFkp Currency = "FKP"
	CurrencyGbp Currency = "GBP"
	CurrencyGel Currency = "GEL"
	CurrencyGhs Currency = "GHS"
	CurrencyGip Currency = "GIP"
	CurrencyGmd Currency = "GMD"
	CurrencyGnf Currency = "GNF"
	CurrencyGtq Currency = "GTQ"
	CurrencyGyd Currency = "GYD"
	CurrencyHkd Currency = "HKD"
	CurrencyHnl Currency = "HNL"
	CurrencyHrk Currency = "HRK"
	CurrencyHtg Currency = "HTG"
	CurrencyHuf Currency = "HUF"
	CurrencyIdr Currency = "IDR"
	CurrencyIls Currency = "ILS"
	CurrencyInr Currency = "INR"
	CurrencyIqd Currency = "IQD"
	CurrencyIrr Currency = "IRR"
	CurrencyIsk Currency = "ISK"
	CurrencyJmd Currency = "JMD"
	CurrencyJod Currency = "JOD"
	CurrencyJpy Currency = "JPY"
	CurrencyKes Currency = "KES"
	CurrencyKgs Currency = "KGS"
	CurrencyKhr Currency = "KHR"
	CurrencyKmf Currency = "KMF"
	CurrencyKpw Currency = "KPW"
	CurrencyKrw Currency = "KRW"
	CurrencyKwd Currency = "KWD"
	CurrencyKyd Currency = "KYD"
	CurrencyKzt Currency = "KZT"
	CurrencyLak Currency = "LAK"
	CurrencyLbp Currency = "LBP"
	CurrencyLkr Currency = "LKR"
	CurrencyLrd Currency = "LRD"
	CurrencyLsl Currency = "LSL"
	CurrencyLyd Currency = "LYD"
	CurrencyMad Currency = "MAD"
	CurrencyMdl Currency = "MDL"
	CurrencyMga Currency = "MGA"
	CurrencyMkd Currency = "MKD"
	CurrencyMmk Currency = "MMK"
	CurrencyMnt Currency = "MNT"
	CurrencyMop Currency = "MOP"
	CurrencyMru Currency = "MRU"
	CurrencyMur Currency = "MUR"
	CurrencyMvr Currency = "MVR"
	CurrencyMwk Currency = "MWK"
	CurrencyMxn Currency = "MXN"
	CurrencyMyr Currency = "MYR"
	CurrencyMzn Currency = "MZN"
	CurrencyNad Currency = "NAD"
	CurrencyNgn Currency = "NGN"
	CurrencyNio Currency = "NIO"
	CurrencyNok Currency = "NOK"
	CurrencyNpr Currency = "NPR"
	CurrencyNzd Currency = "NZD"
	CurrencyOmr Currency = "OMR"
	CurrencyPab Currency = "PAB"
	CurrencyPen Currency = "PEN"
	CurrencyPgk Currency = "PGK"
	CurrencyPhp Currency = "PHP"
	CurrencyPkr Currency = "PKR"
	CurrencyPln Currency = "PLN"
	CurrencyPyg Currency = "PYG"
	CurrencyQar Currency = "QAR"
	CurrencyRon Currency = "RON"
	CurrencyRsd Currency = "RSD"
	CurrencyRub Currency = "RUB"
	CurrencyRwf Currency = "RWF"
	CurrencySar Currency = "SAR"
	CurrencySbd Currency = "SBD"
	CurrencyScr Currency = "SCR"
	CurrencySdg Currency = "SDG"
	CurrencySek Currency = "SEK"
	CurrencySgd Currency = "SGD"
	CurrencyShp Currency = "SHP"
	CurrencySll Currency = "SLL"
	CurrencySos Currency = "SOS"
	CurrencySrd Currency = "SRD"
	CurrencySsp Currency = "SSP"
	CurrencyStd Currency = "STD"
	CurrencyStn Currency = "STN"
	CurrencySvc Currency = "SVC"
	CurrencySyp Currency = "SYP"
	CurrencySzl Currency = "SZL"
	CurrencyThb Currency = "THB"
	CurrencyTjs Currency = "TJS"
	CurrencyTmt Currency = "TMT"
	CurrencyTnd Currency = "TND"
	CurrencyTop Currency = "TOP"
	CurrencyTry Currency = "TRY"
	CurrencyTtd Currency = "TTD"
	CurrencyTwd Currency = "TWD"
	CurrencyTzs Currency = "TZS"
	CurrencyUah Currency = "UAH"
	CurrencyUgx Currency = "UGX"
	CurrencyUsd Currency = "USD"
	CurrencyUyu Currency = "UYU"
	CurrencyUzs Currency = "UZS"
	CurrencyVes Currency = "VES"
	CurrencyVnd Currency = "VND"
	CurrencyVuv Currency = "VUV"
	CurrencyWst Currency = "WST"
	CurrencyXaf Currency = "XAF"
	CurrencyXcd Currency = "XCD"
	CurrencyXof Currency = "XOF"
	CurrencyXpf Currency = "XPF"
	CurrencyYer Currency = "YER"
	CurrencyZar Currency = "ZAR"
	CurrencyZmw Currency = "ZMW"
	CurrencyZwl Currency = "ZWL"
)

Known values of Currency.

The API may add new values over time; unknown values round-trip unchanged.

func (Currency) IsKnown ¶

func (e Currency) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (Currency) String ¶

func (e Currency) String() string

String returns the wire representation of the value.

type CustomProperties ¶

type CustomProperties struct {
	// contains filtered or unexported fields
}

CustomProperties groups the custom properties operations of the Meteroid API.

func (*CustomProperties) ArchiveDefinition ¶

func (a *CustomProperties) ArchiveDefinition(ctx context.Context, id string, opts ...RequestOption) (*CustomPropertyDefinition, error)

ArchiveDefinition sends DELETE /api/v1/custom-property-definitions/{id}.

Archive a custom property definition ¶

Soft-deletes the definition. Existing property values on entities are preserved; the definition simply stops being enforced on new writes.

func (*CustomProperties) CreateCustomPropertyDefinition ¶

func (a *CustomProperties) CreateCustomPropertyDefinition(ctx context.Context, customPropertyDefinitionCreateRequest CustomPropertyDefinitionCreateRequest, opts ...RequestOption) (*CustomPropertyDefinition, error)

CreateCustomPropertyDefinition sends POST /api/v1/custom-property-definitions.

Create a custom property definition

func (*CustomProperties) ListCustomPropertyDefinitions ¶

ListCustomPropertyDefinitions sends GET /api/v1/custom-property-definitions and returns the first page of results.

List custom property definitions ¶

CustomProperties.ListCustomPropertyDefinitionsAutoPaging iterates over every item instead.

func (*CustomProperties) ListCustomPropertyDefinitionsAutoPaging ¶ added in v0.28.0

ListCustomPropertyDefinitionsAutoPaging iterates over every item of CustomProperties.ListCustomPropertyDefinitions, fetching further pages on demand.

func (*CustomProperties) RetrieveCustomPropertyDefinition ¶

func (a *CustomProperties) RetrieveCustomPropertyDefinition(ctx context.Context, id string, opts ...RequestOption) (*CustomPropertyDefinition, error)

RetrieveCustomPropertyDefinition sends GET /api/v1/custom-property-definitions/{id}.

Get a custom property definition

func (*CustomProperties) UpdateCustomPropertyDefinition ¶

func (a *CustomProperties) UpdateCustomPropertyDefinition(ctx context.Context, id string, customPropertyDefinitionUpdateRequest CustomPropertyDefinitionUpdateRequest, opts ...RequestOption) (*CustomPropertyDefinition, error)

UpdateCustomPropertyDefinition sends PUT /api/v1/custom-property-definitions/{id}.

Update a custom property definition

type CustomPropertiesListCustomPropertyDefinitionsOptions ¶

type CustomPropertiesListCustomPropertyDefinitionsOptions struct {
	// Filter to a single entity type.
	EntityType *CustomPropertyEntityType

	// Include archived (soft-deleted) definitions. Defaults to false.
	IncludeArchived *bool

	// Page number (0-indexed)
	Page *int32

	// Number of items per page
	PerPage *int32
}

CustomPropertiesListCustomPropertyDefinitionsOptions carries the optional query and header parameters of CustomProperties.ListCustomPropertyDefinitions. Leave a field nil to omit it.

type CustomPropertiesListCustomPropertyDefinitionsPage ¶ added in v0.28.0

type CustomPropertiesListCustomPropertyDefinitionsPage struct {
	CustomPropertyDefinitionListResponse

	// Items holds the items of this page.
	Items []CustomPropertyDefinition
	// contains filtered or unexported fields
}

CustomPropertiesListCustomPropertyDefinitionsPage is a page of CustomProperties.ListCustomPropertyDefinitions. It embeds the decoded CustomPropertyDefinitionListResponse, promoting its fields, with the Items of the page; a field named like a page member stays reachable through the embedded CustomPropertyDefinitionListResponse.

func (*CustomPropertiesListCustomPropertyDefinitionsPage) HasNextPage ¶ added in v0.28.0

HasNextPage reports whether another page follows this one.

func (CustomPropertiesListCustomPropertyDefinitionsPage) MarshalJSON ¶ added in v0.28.0

MarshalJSON encodes the CustomPropertyDefinitionListResponse of the page, as received.

func (*CustomPropertiesListCustomPropertyDefinitionsPage) NextPage ¶ added in v0.28.0

NextPage fetches the page after this one. It returns nil and no error after the last page.

type CustomPropertyDefinition ¶

type CustomPropertyDefinition struct {
	Archived bool `json:"archived"`

	Config PropertyConfig `json:"config"`

	DefaultValue json.RawMessage `json:"default_value,omitempty"`

	Description *string `json:"description,omitempty"`

	DisplayOrder int32 `json:"display_order"`

	EntityType CustomPropertyEntityType `json:"entity_type"`

	ID CustomPropertyDefinitionID `json:"id"`

	Key string `json:"key"`

	Name string `json:"name"`

	PropertyType CustomPropertyType `json:"property_type"`

	Required bool `json:"required"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CustomPropertyDefinition is the CustomPropertyDefinition object of the Meteroid API.

func (CustomPropertyDefinition) MarshalJSON ¶

func (v CustomPropertyDefinition) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CustomPropertyDefinition) UnmarshalJSON ¶

func (v *CustomPropertyDefinition) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CustomPropertyDefinitionCreateRequest ¶

type CustomPropertyDefinitionCreateRequest struct {
	Config *PropertyConfig `json:"config,omitempty"`

	DefaultValue json.RawMessage `json:"default_value,omitempty"`

	Description *string `json:"description,omitempty"`

	DisplayOrder *int32 `json:"display_order,omitempty"`

	EntityType CustomPropertyEntityType `json:"entity_type"`

	// Immutable machine name; letters, digits and underscores only. Unique per entity type.
	Key string `json:"key"`

	Name string `json:"name"`

	PropertyType CustomPropertyType `json:"property_type"`

	Required *bool `json:"required,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CustomPropertyDefinitionCreateRequest is the CustomPropertyDefinitionCreateRequest object of the Meteroid API.

func (CustomPropertyDefinitionCreateRequest) MarshalJSON ¶

func (v CustomPropertyDefinitionCreateRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CustomPropertyDefinitionCreateRequest) UnmarshalJSON ¶

func (v *CustomPropertyDefinitionCreateRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CustomPropertyDefinitionID ¶

type CustomPropertyDefinitionID = string

CustomPropertyDefinitionID is the CustomPropertyDefinitionId string of the Meteroid API.

type CustomPropertyDefinitionListResponse ¶

type CustomPropertyDefinitionListResponse struct {
	Data RequiredSlice[CustomPropertyDefinition] `json:"data"`

	PaginationMeta PaginationResponse `json:"pagination_meta"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CustomPropertyDefinitionListResponse is the CustomPropertyDefinitionListResponse object of the Meteroid API.

func (CustomPropertyDefinitionListResponse) MarshalJSON ¶

func (v CustomPropertyDefinitionListResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CustomPropertyDefinitionListResponse) UnmarshalJSON ¶

func (v *CustomPropertyDefinitionListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CustomPropertyDefinitionUpdateRequest ¶

type CustomPropertyDefinitionUpdateRequest struct {
	Config *PropertyConfig `json:"config,omitempty"`

	DefaultValue json.RawMessage `json:"default_value,omitempty"`

	Description *string `json:"description,omitempty"`

	DisplayOrder *int32 `json:"display_order,omitempty"`

	Name *string `json:"name,omitempty"`

	Required *bool `json:"required,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CustomPropertyDefinitionUpdateRequest is the CustomPropertyDefinitionUpdateRequest object of the Meteroid API.

Update of a definition. `key`, `entity_type` and `property_type` are immutable and cannot be changed here. Any field left absent is unchanged.

func (CustomPropertyDefinitionUpdateRequest) MarshalJSON ¶

func (v CustomPropertyDefinitionUpdateRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CustomPropertyDefinitionUpdateRequest) UnmarshalJSON ¶

func (v *CustomPropertyDefinitionUpdateRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CustomPropertyEntityType ¶

type CustomPropertyEntityType string

CustomPropertyEntityType is one of AllCustomPropertyEntityTypeValues, or a value this SDK version does not know.

const (
	CustomPropertyEntityTypeCustomer     CustomPropertyEntityType = "CUSTOMER"
	CustomPropertyEntityTypeSubscription CustomPropertyEntityType = "SUBSCRIPTION"
	CustomPropertyEntityTypeInvoice      CustomPropertyEntityType = "INVOICE"
	CustomPropertyEntityTypeCreditNote   CustomPropertyEntityType = "CREDIT_NOTE"
	CustomPropertyEntityTypeQuote        CustomPropertyEntityType = "QUOTE"
)

Known values of CustomPropertyEntityType.

The API may add new values over time; unknown values round-trip unchanged.

func (CustomPropertyEntityType) IsKnown ¶

func (e CustomPropertyEntityType) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (CustomPropertyEntityType) String ¶

func (e CustomPropertyEntityType) String() string

String returns the wire representation of the value.

type CustomPropertyType ¶

type CustomPropertyType string

CustomPropertyType is one of AllCustomPropertyTypeValues, or a value this SDK version does not know.

const (
	CustomPropertyTypeText         CustomPropertyType = "TEXT"
	CustomPropertyTypeNumber       CustomPropertyType = "NUMBER"
	CustomPropertyTypeBoolean      CustomPropertyType = "BOOLEAN"
	CustomPropertyTypeDate         CustomPropertyType = "DATE"
	CustomPropertyTypeDatetime     CustomPropertyType = "DATETIME"
	CustomPropertyTypeSingleSelect CustomPropertyType = "SINGLE_SELECT"
	CustomPropertyTypeMultiSelect  CustomPropertyType = "MULTI_SELECT"
	CustomPropertyTypeJSON         CustomPropertyType = "JSON"
	CustomPropertyTypeURL          CustomPropertyType = "URL"
	CustomPropertyTypeEmail        CustomPropertyType = "EMAIL"
)

Known values of CustomPropertyType.

The API may add new values over time; unknown values round-trip unchanged.

func (CustomPropertyType) IsKnown ¶

func (e CustomPropertyType) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (CustomPropertyType) String ¶

func (e CustomPropertyType) String() string

String returns the wire representation of the value.

type CustomTaxRate ¶

type CustomTaxRate struct {
	Name string `json:"name"`

	Rate string `json:"rate"`

	TaxCode string `json:"tax_code"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CustomTaxRate is the CustomTaxRate object of the Meteroid API.

func (CustomTaxRate) MarshalJSON ¶

func (v CustomTaxRate) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CustomTaxRate) UnmarshalJSON ¶

func (v *CustomTaxRate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type Customer ¶

type Customer struct {
	Alias *string `json:"alias,omitempty"`

	BillingAddress *Address `json:"billing_address,omitempty"`

	BillingEmail *string `json:"billing_email,omitempty"`

	// BT-10 — the reference the buyer routes invoices by (a Leitweg-ID for German
	// public bodies). Required by XRechnung.
	BuyerReference *string `json:"buyer_reference,omitempty"`

	ConnectedAccountID *string `json:"connected_account_id,omitempty"`

	Currency Currency `json:"currency"`

	// User-defined custom property values, keyed by definition `key`.
	CustomProperties json.RawMessage `json:"custom_properties"`

	CustomTaxes RequiredSlice[CustomTaxRate] `json:"custom_taxes"`

	CustomerType *CustomerType `json:"customer_type,omitempty"`

	FirstName *string `json:"first_name,omitempty"`

	ID CustomerID `json:"id"`

	InvoicingEmails RequiredSlice[string] `json:"invoicing_emails"`

	InvoicingEntityID InvoicingEntityID `json:"invoicing_entity_id"`

	// Deprecated: the first entry of `preferred_locales`.
	//
	// Deprecated: this field is deprecated in the Meteroid API.
	InvoicingLanguage *string `json:"invoicing_language,omitempty"`

	LastName *string `json:"last_name,omitempty"`

	// BT-47 — the buyer's national register identifier (SIREN/SIRET, HRB).
	LegalNumber *string `json:"legal_number,omitempty"`

	Name string `json:"name"`

	Phone *string `json:"phone,omitempty"`

	// Preferred document languages, most-preferred first (BCP-47 tags, e.g.
	// `["fr-FR", "en"]`); overrides the invoicing entity default.
	PreferredLocales RequiredSlice[string] `json:"preferred_locales"`

	ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"`

	VatNumber *string `json:"vat_number,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

Customer is the Customer object of the Meteroid API.

func (Customer) MarshalJSON ¶

func (v Customer) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*Customer) UnmarshalJSON ¶

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

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CustomerCreateRequest ¶

type CustomerCreateRequest struct {
	Alias *string `json:"alias,omitempty"`

	BillingAddress *Address `json:"billing_address,omitempty"`

	BillingEmail *string `json:"billing_email,omitempty"`

	// BT-10 — the reference the buyer routes invoices by (a Leitweg-ID for German
	// public bodies). Required by XRechnung.
	BuyerReference *string `json:"buyer_reference,omitempty"`

	ConnectedAccountID *string `json:"connected_account_id,omitempty"`

	Currency Currency `json:"currency"`

	// User-defined custom property values, keyed by definition `key`. Validated against the
	// tenant's `CUSTOMER` property definitions. Omit to leave unset.
	CustomProperties json.RawMessage `json:"custom_properties,omitempty"`

	CustomTaxes []CustomTaxRate `json:"custom_taxes,omitempty"`

	// `INDIVIDUAL` requires `first_name`, `last_name`, and a billing-address country.
	CustomerType *CustomerType `json:"customer_type,omitempty"`

	// Free-text legal exemption mention surfaced on exempt invoices.
	ExemptionReason *string `json:"exemption_reason,omitempty"`

	FirstName *string `json:"first_name,omitempty"`

	InvoicingEmails []string `json:"invoicing_emails,omitempty"`

	InvoicingEntityID *InvoicingEntityID `json:"invoicing_entity_id,omitempty"`

	// Deprecated: use `preferred_locales`. Applied only when `preferred_locales` is absent.
	//
	// Deprecated: this field is deprecated in the Meteroid API.
	InvoicingLanguage *string `json:"invoicing_language,omitempty"`

	IsTaxExempt *bool `json:"is_tax_exempt,omitempty"`

	LastName *string `json:"last_name,omitempty"`

	// BT-47 — the buyer's national register identifier (SIREN/SIRET, HRB).
	LegalNumber *string `json:"legal_number,omitempty"`

	// Required for `COMPANY`. Ignored for `INDIVIDUAL`: derived from `first_name` + `last_name`.
	Name *string `json:"name,omitempty"`

	Phone *string `json:"phone,omitempty"`

	// Preferred document languages, most-preferred first (BCP-47 tags, e.g.
	// `["fr-FR", "en"]`); overrides the invoicing entity default. The first one the
	// renderer has a template for wins, so an unsupported entry alongside a supported
	// one just falls through; a list of only unsupported ones is rejected.
	PreferredLocales []string `json:"preferred_locales,omitempty"`

	ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"`

	VatNumber *string `json:"vat_number,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CustomerCreateRequest is the CustomerCreateRequest object of the Meteroid API.

func (CustomerCreateRequest) MarshalJSON ¶

func (v CustomerCreateRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CustomerCreateRequest) UnmarshalJSON ¶

func (v *CustomerCreateRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CustomerDetails ¶

type CustomerDetails struct {
	Alias *string `json:"alias,omitempty"`

	BillingAddress *Address `json:"billing_address,omitempty"`

	Email *string `json:"email,omitempty"`

	ID CustomerID `json:"id"`

	Name string `json:"name"`

	// RFC 3339 timestamp.
	SnapshotAt time.Time `json:"snapshot_at"`

	VatNumber *string `json:"vat_number,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CustomerDetails is the CustomerDetails object of the Meteroid API.

func (CustomerDetails) MarshalJSON ¶

func (v CustomerDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CustomerDetails) UnmarshalJSON ¶

func (v *CustomerDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CustomerEvent ¶

type CustomerEvent struct {
	Alias *string `json:"alias,omitempty"`

	BillingEmail *string `json:"billing_email,omitempty"`

	Currency string `json:"currency"`

	// User-defined custom property values, keyed by definition key.
	CustomProperties json.RawMessage `json:"custom_properties"`

	CustomerID CustomerID `json:"customer_id"`

	InvoicingEmails RequiredSlice[string] `json:"invoicing_emails"`

	Name string `json:"name"`

	Phone *string `json:"phone,omitempty"`

	ID EventID `json:"id"`

	// RFC 3339 timestamp.
	Timestamp time.Time `json:"timestamp"`

	Type EventType `json:"type"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CustomerEvent is the CustomerEvent object of the Meteroid API.

Event-specific webhook schemas for type-safe webhook payloads

func (CustomerEvent) MarshalJSON ¶

func (v CustomerEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CustomerEvent) UnmarshalJSON ¶

func (v *CustomerEvent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CustomerEventData ¶

type CustomerEventData struct {
	Alias *string `json:"alias,omitempty"`

	BillingEmail *string `json:"billing_email,omitempty"`

	Currency string `json:"currency"`

	// User-defined custom property values, keyed by definition key.
	CustomProperties json.RawMessage `json:"custom_properties"`

	CustomerID CustomerID `json:"customer_id"`

	InvoicingEmails RequiredSlice[string] `json:"invoicing_emails"`

	Name string `json:"name"`

	Phone *string `json:"phone,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CustomerEventData is the CustomerEventData object of the Meteroid API.

func (CustomerEventData) MarshalJSON ¶

func (v CustomerEventData) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CustomerEventData) UnmarshalJSON ¶

func (v *CustomerEventData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CustomerID ¶

type CustomerID = string

CustomerID is the CustomerId string of the Meteroid API.

type CustomerListResponse ¶

type CustomerListResponse struct {
	Data RequiredSlice[Customer] `json:"data"`

	PaginationMeta PaginationResponse `json:"pagination_meta"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CustomerListResponse is the CustomerListResponse object of the Meteroid API.

func (CustomerListResponse) MarshalJSON ¶

func (v CustomerListResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CustomerListResponse) UnmarshalJSON ¶

func (v *CustomerListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CustomerPatchRequest ¶

type CustomerPatchRequest struct {
	Alias *Nullable[string] `json:"alias,omitempty"`

	BillingAddress *Nullable[Address] `json:"billing_address,omitempty"`

	BillingEmail *Nullable[string] `json:"billing_email,omitempty"`

	// BT-10 — the reference the buyer routes invoices by (a Leitweg-ID for German
	// public bodies). Required by XRechnung.
	BuyerReference *Nullable[string] `json:"buyer_reference,omitempty"`

	Currency *Nullable[Currency] `json:"currency,omitempty"`

	// Partial update of custom property values (merge; send a key with `null` to remove it).
	// Omit to leave unchanged.
	CustomProperties json.RawMessage `json:"custom_properties,omitempty"`

	CustomTaxes *Nullable[[]CustomTaxRate] `json:"custom_taxes,omitempty"`

	CustomerType *Nullable[CustomerType] `json:"customer_type,omitempty"`

	// Free-text legal exemption mention surfaced on exempt invoices.
	ExemptionReason *Nullable[string] `json:"exemption_reason,omitempty"`

	FirstName *Nullable[string] `json:"first_name,omitempty"`

	InvoicingEmails *Nullable[[]string] `json:"invoicing_emails,omitempty"`

	InvoicingEntityID *Nullable[InvoicingEntityID] `json:"invoicing_entity_id,omitempty"`

	// Deprecated: use `preferred_locales`. Applied only when `preferred_locales` is absent.
	//
	// Deprecated: this field is deprecated in the Meteroid API.
	InvoicingLanguage *Nullable[string] `json:"invoicing_language,omitempty"`

	IsTaxExempt *Nullable[bool] `json:"is_tax_exempt,omitempty"`

	LastName *Nullable[string] `json:"last_name,omitempty"`

	// BT-47 — the buyer's national register identifier (SIREN/SIRET, HRB).
	LegalNumber *Nullable[string] `json:"legal_number,omitempty"`

	Name *Nullable[string] `json:"name,omitempty"`

	Phone *Nullable[string] `json:"phone,omitempty"`

	// Preferred document languages, most-preferred first (BCP-47 tags, e.g.
	// `["fr-FR", "en"]`); overrides the invoicing entity default. Omit to leave
	// unchanged, send `[]` to reset to that default.
	PreferredLocales *Nullable[[]string] `json:"preferred_locales,omitempty"`

	ShippingAddress *Nullable[ShippingAddress] `json:"shipping_address,omitempty"`

	VatNumber *Nullable[string] `json:"vat_number,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CustomerPatchRequest is the CustomerPatchRequest object of the Meteroid API.

func (CustomerPatchRequest) MarshalJSON ¶

func (v CustomerPatchRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CustomerPatchRequest) UnmarshalJSON ¶

func (v *CustomerPatchRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CustomerPaymentMethodID ¶

type CustomerPaymentMethodID = string

CustomerPaymentMethodID is the CustomerPaymentMethodId string of the Meteroid API.

type CustomerPortalScope ¶

type CustomerPortalScope string

CustomerPortalScope is one of AllCustomerPortalScopeValues, or a value this SDK version does not know.

What a customer portal token may do.

const (
	CustomerPortalScopeRead   CustomerPortalScope = "read"
	CustomerPortalScopeManage CustomerPortalScope = "manage"
)

Known values of CustomerPortalScope.

The API may add new values over time; unknown values round-trip unchanged.

func (CustomerPortalScope) IsKnown ¶

func (e CustomerPortalScope) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (CustomerPortalScope) String ¶

func (e CustomerPortalScope) String() string

String returns the wire representation of the value.

type CustomerPortalTokenRequest ¶

type CustomerPortalTokenRequest struct {
	// Token lifetime in seconds. Defaults to 86400 (24 hours).
	// Must be between 60 and 2592000 (30 days).
	ExpiresInSeconds *int32 `json:"expires_in_seconds,omitempty"`

	// Scopes granted to the token. Defaults to `["read", "manage"]`.
	// Use `["read"]` for tokens that only read billing state, e.g. to gate features in a browser.
	Scopes []CustomerPortalScope `json:"scopes,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CustomerPortalTokenRequest is the CustomerPortalTokenRequest object of the Meteroid API.

func (CustomerPortalTokenRequest) MarshalJSON ¶

func (v CustomerPortalTokenRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CustomerPortalTokenRequest) UnmarshalJSON ¶

func (v *CustomerPortalTokenRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CustomerPortalTokenResponse ¶

type CustomerPortalTokenResponse struct {
	// Base URL of the public REST API
	APIURL string `json:"api_url"`

	// When the token expires (RFC 3339)
	// RFC 3339 timestamp.
	ExpiresAt time.Time `json:"expires_at"`

	// Hosted customer portal URL, token included
	PortalLink string `json:"portal_link"`

	// Base URL of the customer portal
	PortalURL string `json:"portal_url"`

	// JWT token for portal access
	Token string `json:"token"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CustomerPortalTokenResponse is the CustomerPortalTokenResponse object of the Meteroid API.

func (CustomerPortalTokenResponse) MarshalJSON ¶

func (v CustomerPortalTokenResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CustomerPortalTokenResponse) UnmarshalJSON ¶

func (v *CustomerPortalTokenResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type CustomerType ¶

type CustomerType string

CustomerType is one of AllCustomerTypeValues, or a value this SDK version does not know.

Company vs. individual (B2C). Defaults to `COMPANY`.

const (
	CustomerTypeCompany    CustomerType = "COMPANY"
	CustomerTypeIndividual CustomerType = "INDIVIDUAL"
)

Known values of CustomerType.

The API may add new values over time; unknown values round-trip unchanged.

func (CustomerType) IsKnown ¶

func (e CustomerType) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (CustomerType) String ¶

func (e CustomerType) String() string

String returns the wire representation of the value.

type CustomerUpdateRequest ¶

type CustomerUpdateRequest struct {
	Alias *string `json:"alias,omitempty"`

	BillingAddress *Address `json:"billing_address,omitempty"`

	BillingEmail *string `json:"billing_email,omitempty"`

	// BT-10 — the reference the buyer routes invoices by (a Leitweg-ID for German
	// public bodies). Required by XRechnung.
	BuyerReference *string `json:"buyer_reference,omitempty"`

	Currency Currency `json:"currency"`

	// User-defined custom property values (full replace). Omit to leave unchanged.
	CustomProperties json.RawMessage `json:"custom_properties,omitempty"`

	CustomTaxes RequiredSlice[CustomTaxRate] `json:"custom_taxes"`

	CustomerType *CustomerType `json:"customer_type,omitempty"`

	// Free-text legal exemption mention surfaced on exempt invoices.
	ExemptionReason *string `json:"exemption_reason,omitempty"`

	// Omit to keep the stored value (a full replace does not blank a person's name).
	FirstName *string `json:"first_name,omitempty"`

	InvoicingEmails RequiredSlice[string] `json:"invoicing_emails"`

	InvoicingEntityID InvoicingEntityID `json:"invoicing_entity_id"`

	// Deprecated: use `preferred_locales`. Applied only when `preferred_locales` is absent.
	//
	// Deprecated: this field is deprecated in the Meteroid API.
	InvoicingLanguage *string `json:"invoicing_language,omitempty"`

	IsTaxExempt *bool `json:"is_tax_exempt,omitempty"`

	LastName *string `json:"last_name,omitempty"`

	// BT-47 — the buyer's national register identifier (SIREN/SIRET, HRB).
	LegalNumber *string `json:"legal_number,omitempty"`

	// Required for `COMPANY`. Ignored for `INDIVIDUAL`: derived from `first_name` + `last_name`.
	Name *string `json:"name,omitempty"`

	Phone *string `json:"phone,omitempty"`

	// Preferred document languages, most-preferred first (BCP-47 tags, e.g.
	// `["fr-FR", "en"]`); overrides the invoicing entity default. Omit or send `[]` to
	// reset to that default (full-replace update).
	PreferredLocales []string `json:"preferred_locales,omitempty"`

	ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"`

	VatNumber *string `json:"vat_number,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

CustomerUpdateRequest is the CustomerUpdateRequest object of the Meteroid API.

func (CustomerUpdateRequest) MarshalJSON ¶

func (v CustomerUpdateRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*CustomerUpdateRequest) UnmarshalJSON ¶

func (v *CustomerUpdateRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type Customers ¶

type Customers struct {
	// contains filtered or unexported fields
}

Customers groups the customers operations of the Meteroid API.

func (*Customers) Archive ¶

func (a *Customers) Archive(ctx context.Context, idOrAlias string, opts ...RequestOption) error

Archive a customer

No linked entity will be deleted. You need to terminate all active subscriptions before archiving a customer, or the call will fail.

func (*Customers) Create ¶

func (a *Customers) Create(ctx context.Context, customerCreateRequest CustomerCreateRequest, opts ...RequestOption) (*Customer, error)

Create customer

func (*Customers) CreatePortalToken ¶

func (a *Customers) CreatePortalToken(ctx context.Context, idOrAlias string, customerPortalTokenRequest CustomerPortalTokenRequest, opts ...RequestOption) (*CustomerPortalTokenResponse, error)

CreatePortalToken sends POST /api/v1/customers/{id_or_alias}/portal-token.

Generate a portal token for a customer ¶

Generates a JWT token that grants access to the customer portal. The token can be used to access invoices, payment methods, and other portal features.

func (*Customers) List ¶

List customers with optional pagination and search filtering.

Customers.ListAutoPaging iterates over every item instead.

func (*Customers) ListAutoPaging ¶ added in v0.28.0

func (a *Customers) ListAutoPaging(ctx context.Context, options *CustomersListOptions, opts ...RequestOption) *AutoPager[Customer]

ListAutoPaging iterates over every item of Customers.List, fetching further pages on demand.

func (*Customers) ListEntitlements ¶

func (a *Customers) ListEntitlements(ctx context.Context, idOrAlias string, opts ...RequestOption) (*EffectiveEntitlementListResponse, error)

ListEntitlements sends GET /api/v1/customers/{id_or_alias}/entitlements.

List customer entitlements

func (*Customers) Replace ¶

func (a *Customers) Replace(ctx context.Context, idOrAlias string, customerUpdateRequest CustomerUpdateRequest, opts ...RequestOption) (*Customer, error)

Replace sends PUT /api/v1/customers/{id_or_alias}.

Update customer

func (*Customers) Retrieve ¶

func (a *Customers) Retrieve(ctx context.Context, idOrAlias string, opts ...RequestOption) (*Customer, error)

Retrieve sends GET /api/v1/customers/{id_or_alias}.

Get customer ¶

Retrieve a single customer by ID or alias.

func (*Customers) Unarchive ¶

func (a *Customers) Unarchive(ctx context.Context, idOrAlias string, opts ...RequestOption) error

Unarchive sends POST /api/v1/customers/{id_or_alias}/unarchive.

Restore an archived customer

func (*Customers) Update ¶

func (a *Customers) Update(ctx context.Context, idOrAlias string, customerPatchRequest CustomerPatchRequest, opts ...RequestOption) (*Customer, error)

Update sends PATCH /api/v1/customers/{id_or_alias}.

Patch customer ¶

Partially update a customer. Only provided fields will be updated.

type CustomersListOptions ¶

type CustomersListOptions struct {
	// Sort order. Format: `column.direction`. Allowed columns: `name`, `email`, `alias`, `created_at`. Direction: `asc` or `desc`. Default: `created_at.desc`.
	OrderBy *string

	// Page number (0-indexed)
	Page *int32

	// Number of items per page
	PerPage *int32

	Search *string

	Archived *bool
}

CustomersListOptions carries the optional query and header parameters of Customers.List. Leave a field nil to omit it.

type CustomersListPage ¶ added in v0.28.0

type CustomersListPage struct {
	CustomerListResponse

	// Items holds the items of this page.
	Items []Customer
	// contains filtered or unexported fields
}

CustomersListPage is a page of Customers.List. It embeds the decoded CustomerListResponse, promoting its fields, with the Items of the page; a field named like a page member stays reachable through the embedded CustomerListResponse.

func (*CustomersListPage) HasNextPage ¶ added in v0.28.0

func (p *CustomersListPage) HasNextPage() bool

HasNextPage reports whether another page follows this one.

func (CustomersListPage) MarshalJSON ¶ added in v0.28.0

func (p CustomersListPage) MarshalJSON() ([]byte, error)

MarshalJSON encodes the CustomerListResponse of the page, as received.

func (*CustomersListPage) NextPage ¶ added in v0.28.0

NextPage fetches the page after this one. It returns nil and no error after the last page.

type Date ¶

type Date struct {
	Year  int
	Month time.Month
	Day   int
}

Date is a calendar date, without a time of day or a time zone: the values of `format: date`, sent as "2006-01-02".

func DateOf ¶

func DateOf(t time.Time) Date

DateOf returns the date of t in t's location.

func ParseDate ¶

func ParseDate(text string) (Date, error)

ParseDate parses a "2006-01-02" date.

func (Date) In ¶

func (d Date) In(loc *time.Location) time.Time

In returns the start of the date in loc.

func (Date) IsZero ¶

func (d Date) IsZero() bool

IsZero reports whether d is the zero Date.

func (Date) MarshalText ¶

func (d Date) MarshalText() ([]byte, error)

MarshalText encodes the date as "2006-01-02", in JSON too.

func (Date) String ¶

func (d Date) String() string

String returns the date as "2006-01-02".

func (*Date) UnmarshalText ¶

func (d *Date) UnmarshalText(data []byte) error

UnmarshalText decodes a "2006-01-02" date, in JSON too.

type DeclineKind ¶

type DeclineKind string

DeclineKind is one of AllDeclineKindValues, or a value this SDK version does not know.

Why the payment provider declined a charge.

const (
	DeclineKindInsufficientFunds      DeclineKind = "INSUFFICIENT_FUNDS"
	DeclineKindDoNotHonor             DeclineKind = "DO_NOT_HONOR"
	DeclineKindCardExpired            DeclineKind = "CARD_EXPIRED"
	DeclineKindAuthenticationRequired DeclineKind = "AUTHENTICATION_REQUIRED"
	DeclineKindMandateInactive        DeclineKind = "MANDATE_INACTIVE"
	DeclineKindFraud                  DeclineKind = "FRAUD"
	DeclineKindProcessingError        DeclineKind = "PROCESSING_ERROR"
	DeclineKindOther                  DeclineKind = "OTHER"
)

Known values of DeclineKind.

The API may add new values over time; unknown values round-trip unchanged.

func (DeclineKind) IsKnown ¶

func (e DeclineKind) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (DeclineKind) String ¶

func (e DeclineKind) String() string

String returns the wire representation of the value.

type DecodeError ¶

type DecodeError struct {
	StatusCode int
	RawBody    []byte
	Err        error
}

DecodeError is returned when a 2xx response body, or an event of a stream, could not be decoded.

func (*DecodeError) Error ¶

func (e *DecodeError) Error() string

func (*DecodeError) Unwrap ¶

func (e *DecodeError) Unwrap() error

type DoubleSegmentationMatrix ¶

type DoubleSegmentationMatrix struct {
	Dimension1 MetricDimension `json:"dimension1"`

	Dimension2 MetricDimension `json:"dimension2"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

DoubleSegmentationMatrix is the DoubleSegmentationMatrix object of the Meteroid API.

func (DoubleSegmentationMatrix) MarshalJSON ¶

func (v DoubleSegmentationMatrix) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*DoubleSegmentationMatrix) UnmarshalJSON ¶

func (v *DoubleSegmentationMatrix) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type EInvoicingFinding ¶

type EInvoicingFinding struct {
	Hint *string `json:"hint,omitempty"`

	Message string `json:"message"`

	// The rule identifier — "BR-11", "PEPPOL-EN16931-R003".
	Rule string `json:"rule"`

	// The business term path it is about — "BG-8/BT-55".
	Term string `json:"term"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

EInvoicingFinding is the EInvoicingFinding object of the Meteroid API.

One rule the document did not satisfy, in the standard's own vocabulary.

func (EInvoicingFinding) MarshalJSON ¶

func (v EInvoicingFinding) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*EInvoicingFinding) UnmarshalJSON ¶

func (v *EInvoicingFinding) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type EInvoicingStatus ¶

type EInvoicingStatus string

EInvoicingStatus is one of AllEInvoicingStatusValues, or a value this SDK version does not know.

Whether the structured e-invoice was produced with the accounting PDF. Absent when the invoicing entity had not opted in at the time the invoice was issued.

const (
	EInvoicingStatusGenerated EInvoicingStatus = "GENERATED"
	EInvoicingStatusFailed    EInvoicingStatus = "FAILED"
)

Known values of EInvoicingStatus.

The API may add new values over time; unknown values round-trip unchanged.

func (EInvoicingStatus) IsKnown ¶

func (e EInvoicingStatus) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (EInvoicingStatus) String ¶

func (e EInvoicingStatus) String() string

String returns the wire representation of the value.

type EffectiveEntitlement ¶

type EffectiveEntitlement struct {
	Feature FeatureRef `json:"feature"`

	Value EffectiveEntitlementValue `json:"value"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

EffectiveEntitlement is the EffectiveEntitlement object of the Meteroid API.

Merged entitlement value for a feature for a specific customer, enriched with live usage data.

func (EffectiveEntitlement) MarshalJSON ¶

func (v EffectiveEntitlement) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*EffectiveEntitlement) UnmarshalJSON ¶

func (v *EffectiveEntitlement) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type EffectiveEntitlementListResponse ¶

type EffectiveEntitlementListResponse struct {
	Data RequiredSlice[EffectiveEntitlement] `json:"data"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

EffectiveEntitlementListResponse is the EffectiveEntitlementListResponse object of the Meteroid API.

func (EffectiveEntitlementListResponse) MarshalJSON ¶

func (v EffectiveEntitlementListResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*EffectiveEntitlementListResponse) UnmarshalJSON ¶

func (v *EffectiveEntitlementListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type EffectiveEntitlementValue ¶

type EffectiveEntitlementValue struct {
	// Type selects the active variant. Compare it against the
	// EffectiveEntitlementValue* constants.
	Type EffectiveEntitlementValueType `json:"type"`

	// Boolean is set when Type is EffectiveEntitlementValueBoolean.
	Boolean *BooleanEffectiveEntitlementValue `json:"-"`
	// Metered is set when Type is EffectiveEntitlementValueMetered.
	Metered *MeteredEffectiveEntitlementValue `json:"-"`
	// Config is set when Type is EffectiveEntitlementValueConfig.
	Config *ConfigEffectiveEntitlementValue `json:"-"`
	// contains filtered or unexported fields
}

EffectiveEntitlementValue is a tagged union discriminated by the type field.

When EffectiveEntitlementValue.IsKnown reports true, exactly one variant pointer is set, matching Type. A variant added to the API after this SDK version was released still decodes without error, but with every variant pointer nil: always give a `switch` on Type a `default:` branch (or check IsKnown first) instead of dereferencing a pointer unconditionally. The unknown variant's JSON is available from EffectiveEntitlementValue.Raw.

func NewEffectiveEntitlementValueBoolean ¶

func NewEffectiveEntitlementValueBoolean(value BooleanEffectiveEntitlementValue) EffectiveEntitlementValue

NewEffectiveEntitlementValueBoolean builds a EffectiveEntitlementValue holding the BOOLEAN variant.

func NewEffectiveEntitlementValueConfig ¶

func NewEffectiveEntitlementValueConfig(value ConfigEffectiveEntitlementValue) EffectiveEntitlementValue

NewEffectiveEntitlementValueConfig builds a EffectiveEntitlementValue holding the CONFIG variant.

func NewEffectiveEntitlementValueMetered ¶

func NewEffectiveEntitlementValueMetered(value MeteredEffectiveEntitlementValue) EffectiveEntitlementValue

NewEffectiveEntitlementValueMetered builds a EffectiveEntitlementValue holding the METERED variant.

func (EffectiveEntitlementValue) IsKnown ¶

func (u EffectiveEntitlementValue) IsKnown() bool

IsKnown reports whether Type is one of the variants this SDK version knows about, i.e. one of the EffectiveEntitlementValue* constants. It is false for a variant added to the API later, whose payload is then only available from EffectiveEntitlementValue.Raw.

func (EffectiveEntitlementValue) MarshalJSON ¶

func (u EffectiveEntitlementValue) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (EffectiveEntitlementValue) Raw ¶

Raw returns the JSON of a variant this SDK version does not know about, as decoded (see EffectiveEntitlementValue.IsKnown). It is nil for a known variant, and for a value that was not decoded from JSON. The returned slice is a copy.

func (*EffectiveEntitlementValue) UnmarshalJSON ¶

func (u *EffectiveEntitlementValue) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Payloads carrying an unrecognized discriminator are kept rather than rejected, so a newer API version does not break older SDK builds. Re-encoding such a value reproduces the same JSON document, though not necessarily the same bytes: `encoding/json` compacts whitespace and escapes `<`, `>` and `&`.

type EffectiveEntitlementValueType ¶

type EffectiveEntitlementValueType string

EffectiveEntitlementValueType is the type of an EffectiveEntitlementValue, one of the EffectiveEntitlementValue* constants for a variant this SDK version knows.

const (
	EffectiveEntitlementValueBoolean EffectiveEntitlementValueType = "BOOLEAN"
	EffectiveEntitlementValueMetered EffectiveEntitlementValueType = "METERED"
	EffectiveEntitlementValueConfig  EffectiveEntitlementValueType = "CONFIG"
)

Discriminator values for EffectiveEntitlementValue.

type Entitlement ¶

type Entitlement struct {
	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	FeatureID FeatureID `json:"feature_id"`

	ID EntitlementID `json:"id"`

	// RFC 3339 timestamp.
	UpdatedAt time.Time `json:"updated_at"`

	Value EntitlementValue `json:"value"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

Entitlement is the Entitlement object of the Meteroid API.

A raw entitlement row attached to one entity (feature, plan version, add-on, or subscription).

func (Entitlement) MarshalJSON ¶

func (v Entitlement) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*Entitlement) UnmarshalJSON ¶

func (v *Entitlement) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type EntitlementID ¶

type EntitlementID = string

EntitlementID is the EntitlementId string of the Meteroid API.

type EntitlementListResponse ¶

type EntitlementListResponse struct {
	Data RequiredSlice[Entitlement] `json:"data"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

EntitlementListResponse is the EntitlementListResponse object of the Meteroid API.

func (EntitlementListResponse) MarshalJSON ¶

func (v EntitlementListResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*EntitlementListResponse) UnmarshalJSON ¶

func (v *EntitlementListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type EntitlementProductRef ¶

type EntitlementProductRef struct {
	ID ProductID `json:"id"`

	Name string `json:"name"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

EntitlementProductRef is the EntitlementProductRef object of the Meteroid API.

Minimal reference to the product a feature belongs to.

func (EntitlementProductRef) MarshalJSON ¶

func (v EntitlementProductRef) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*EntitlementProductRef) UnmarshalJSON ¶

func (v *EntitlementProductRef) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type EntitlementSpecRequest ¶

type EntitlementSpecRequest struct {
	FeatureID FeatureID `json:"feature_id"`

	Value EntitlementValue `json:"value"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

EntitlementSpecRequest is the EntitlementSpecRequest object of the Meteroid API.

One entitlement to create: which feature, and the value granted by the entity.

func (EntitlementSpecRequest) MarshalJSON ¶

func (v EntitlementSpecRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*EntitlementSpecRequest) UnmarshalJSON ¶

func (v *EntitlementSpecRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type EntitlementValue ¶

type EntitlementValue struct {
	// Type selects the active variant. Compare it against the
	// EntitlementValue* constants.
	Type EntitlementValueType `json:"type"`

	// Boolean is set when Type is EntitlementValueBoolean.
	Boolean *BooleanEntitlementValue `json:"-"`
	// Metered is set when Type is EntitlementValueMetered.
	Metered *MeteredEntitlementValue `json:"-"`
	// Config is set when Type is EntitlementValueConfig.
	Config *ConfigEntitlementValue `json:"-"`
	// contains filtered or unexported fields
}

EntitlementValue is a tagged union discriminated by the type field.

When EntitlementValue.IsKnown reports true, exactly one variant pointer is set, matching Type. A variant added to the API after this SDK version was released still decodes without error, but with every variant pointer nil: always give a `switch` on Type a `default:` branch (or check IsKnown first) instead of dereferencing a pointer unconditionally. The unknown variant's JSON is available from EntitlementValue.Raw.

func NewEntitlementValueBoolean ¶

func NewEntitlementValueBoolean(value BooleanEntitlementValue) EntitlementValue

NewEntitlementValueBoolean builds a EntitlementValue holding the BOOLEAN variant.

func NewEntitlementValueConfig ¶

func NewEntitlementValueConfig(value ConfigEntitlementValue) EntitlementValue

NewEntitlementValueConfig builds a EntitlementValue holding the CONFIG variant.

func NewEntitlementValueMetered ¶

func NewEntitlementValueMetered(value MeteredEntitlementValue) EntitlementValue

NewEntitlementValueMetered builds a EntitlementValue holding the METERED variant.

func (EntitlementValue) IsKnown ¶

func (u EntitlementValue) IsKnown() bool

IsKnown reports whether Type is one of the variants this SDK version knows about, i.e. one of the EntitlementValue* constants. It is false for a variant added to the API later, whose payload is then only available from EntitlementValue.Raw.

func (EntitlementValue) MarshalJSON ¶

func (u EntitlementValue) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (EntitlementValue) Raw ¶

Raw returns the JSON of a variant this SDK version does not know about, as decoded (see EntitlementValue.IsKnown). It is nil for a known variant, and for a value that was not decoded from JSON. The returned slice is a copy.

func (*EntitlementValue) UnmarshalJSON ¶

func (u *EntitlementValue) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Payloads carrying an unrecognized discriminator are kept rather than rejected, so a newer API version does not break older SDK builds. Re-encoding such a value reproduces the same JSON document, though not necessarily the same bytes: `encoding/json` compacts whitespace and escapes `<`, `>` and `&`.

type EntitlementValueType ¶

type EntitlementValueType string

EntitlementValueType is the type of an EntitlementValue, one of the EntitlementValue* constants for a variant this SDK version knows.

const (
	EntitlementValueBoolean EntitlementValueType = "BOOLEAN"
	EntitlementValueMetered EntitlementValueType = "METERED"
	EntitlementValueConfig  EntitlementValueType = "CONFIG"
)

Discriminator values for EntitlementValue.

type Entitlements ¶

type Entitlements struct {
	// contains filtered or unexported fields
}

Entitlements groups the entitlements operations of the Meteroid API.

func (*Entitlements) Delete ¶

func (a *Entitlements) Delete(ctx context.Context, entitlementID string, opts ...RequestOption) error

Delete an entitlement

func (*Entitlements) Retrieve ¶

func (a *Entitlements) Retrieve(ctx context.Context, entitlementID string, opts ...RequestOption) (*Entitlement, error)

Retrieve sends GET /api/v1/entitlements/{entitlement_id}.

Get entitlement details

func (*Entitlements) Update ¶

func (a *Entitlements) Update(ctx context.Context, entitlementID string, updateEntitlementRequest UpdateEntitlementRequest, opts ...RequestOption) (*Entitlement, error)

Update an entitlement

The new value must match the feature's declared type.

type ErrorCode ¶

type ErrorCode string

ErrorCode is one of AllErrorCodeValues, or a value this SDK version does not know.

const (
	ErrorCodeBadRequest          ErrorCode = "BAD_REQUEST"
	ErrorCodeNotFound            ErrorCode = "NOT_FOUND"
	ErrorCodeConflict            ErrorCode = "CONFLICT"
	ErrorCodeForbidden           ErrorCode = "FORBIDDEN"
	ErrorCodeUnauthorized        ErrorCode = "UNAUTHORIZED"
	ErrorCodeTokenExpired        ErrorCode = "TOKEN_EXPIRED"
	ErrorCodeTooManyRequests     ErrorCode = "TOO_MANY_REQUESTS"
	ErrorCodeInternalServerError ErrorCode = "INTERNAL_SERVER_ERROR"
)

Known values of ErrorCode.

The API may add new values over time; unknown values round-trip unchanged.

func (ErrorCode) IsKnown ¶

func (e ErrorCode) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (ErrorCode) String ¶

func (e ErrorCode) String() string

String returns the wire representation of the value.

type Event ¶

type Event struct {
	// Billable metric code. Max 512 characters.
	Code string `json:"code"`

	// Meteroid customer ID or external customer alias.
	CustomerID string `json:"customer_id"`

	// Unique event identifier. Max 255 characters. A UUID or ULID is recommended.
	EventID string `json:"event_id"`

	// Arbitrary string key-value pairs used by billable metrics for filtering and aggregation.
	Properties map[string]string `json:"properties,omitempty"`

	// RFC 3339 timestamp. Defaults to ingestion time if omitted.
	// Must be between 24 hours ago and 1 hour from now. Set `allow_backfilling` to remove the past limit.
	// RFC 3339 timestamp.
	Timestamp *time.Time `json:"timestamp,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

Event is the Event object of the Meteroid API.

func (Event) MarshalJSON ¶

func (v Event) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*Event) UnmarshalJSON ¶

func (v *Event) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type EventID ¶

type EventID = string

EventID is the EventId string of the Meteroid API.

type EventStream ¶

type EventStream struct {
	// contains filtered or unexported fields
}

EventStream is a live text/event-stream response: loop on Next, check Err, and Close it once done. The client timeout only covers opening the stream.

func (*EventStream) All ¶

func (s *EventStream) All() iter.Seq2[SSEEvent, error]

All yields every event, then the error that ended the stream, if any.

func (*EventStream) Close ¶

func (s *EventStream) Close() error

Close closes the connection.

func (*EventStream) Err ¶

func (s *EventStream) Err() error

Err returns the error that ended the stream, if any.

func (*EventStream) Event ¶

func (s *EventStream) Event() SSEEvent

Event returns the event Next read.

func (*EventStream) LastEventID ¶

func (s *EventStream) LastEventID() string

LastEventID returns the ID of the last event read, including events with no data.

func (*EventStream) Next ¶

func (s *EventStream) Next() bool

Next reads the next event. It returns false at the end of the stream or on error, see Err.

type EventType ¶

type EventType string

EventType is one of AllEventTypeValues, or a value this SDK version does not know.

const (
	EventTypeMetricCreated                 EventType = "metric.created"
	EventTypeCustomerCreated               EventType = "customer.created"
	EventTypeSubscriptionCreated           EventType = "subscription.created"
	EventTypeSubscriptionUpdated           EventType = "subscription.updated"
	EventTypeSubscriptionCancelled         EventType = "subscription.cancelled"
	EventTypeSubscriptionEnded             EventType = "subscription.ended"
	EventTypeInvoiceCreated                EventType = "invoice.created"
	EventTypeInvoiceFinalized              EventType = "invoice.finalized"
	EventTypeInvoicePaid                   EventType = "invoice.paid"
	EventTypeInvoiceVoided                 EventType = "invoice.voided"
	EventTypeInvoiceClosed                 EventType = "invoice.closed"
	EventTypeInvoiceConsolidated           EventType = "invoice.consolidated"
	EventTypeInvoiceDeleted                EventType = "invoice.deleted"
	EventTypeInvoiceAccountingPdfGenerated EventType = "invoice.accounting_pdf_generated"
	EventTypeQuoteAccepted                 EventType = "quote.accepted"
	EventTypeQuoteConverted                EventType = "quote.converted"
	EventTypeCreditNoteCreated             EventType = "credit_note.created"
	EventTypeCreditNoteFinalized           EventType = "credit_note.finalized"
	EventTypeCreditNoteVoided              EventType = "credit_note.voided"
	EventTypePlanCreated                   EventType = "plan.created"
	EventTypePlanPublished                 EventType = "plan.published"
	EventTypePlanArchived                  EventType = "plan.archived"
	EventTypeProductCreated                EventType = "product.created"
	EventTypeProductUpdated                EventType = "product.updated"
	EventTypeProductArchived               EventType = "product.archived"
	EventTypeMetricUpdated                 EventType = "metric.updated"
	EventTypeMetricArchived                EventType = "metric.archived"
	EventTypeCouponCreated                 EventType = "coupon.created"
	EventTypeCouponUpdated                 EventType = "coupon.updated"
	EventTypeCouponArchived                EventType = "coupon.archived"
	EventTypeAddonCreated                  EventType = "addon.created"
	EventTypeAddonUpdated                  EventType = "addon.updated"
	EventTypeAddonArchived                 EventType = "addon.archived"
	EventTypeRefundIssued                  EventType = "refund.issued"
	EventTypeRefundSettled                 EventType = "refund.settled"
	EventTypeRefundFailed                  EventType = "refund.failed"
	EventTypePaymentReversed               EventType = "payment.reversed"
	EventTypePaymentFailed                 EventType = "payment.failed"
)

Known values of EventType.

The API may add new values over time; unknown values round-trip unchanged.

func (EventType) IsKnown ¶

func (e EventType) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (EventType) String ¶

func (e EventType) String() string

String returns the wire representation of the value.

type Events ¶

type Events struct {
	// contains filtered or unexported fields
}

Events groups the events operations of the Meteroid API.

func (*Events) Ingest ¶

func (a *Events) Ingest(ctx context.Context, ingestEventsRequest IngestEventsRequest, opts ...RequestOption) (*IngestEventsResponse, error)

Ingest events

Ingest usage events for metering and billing purposes.

Events are deduplicated by `(event_id, customer_id)` — re-sending the same pair will not be double-counted. If timestamps differ across duplicates, the event with the latest timestamp is used.

By default, any invalid event rejects the entire batch. Set `allow_partial_failures` to `true` to ingest valid events and receive per-event failure details in the response body.

type ExistingPriceRef ¶

type ExistingPriceRef struct {
	ID PriceID `json:"id"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ExistingPriceRef is the ExistingPriceRef object of the Meteroid API.

func (ExistingPriceRef) MarshalJSON ¶

func (v ExistingPriceRef) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ExistingPriceRef) UnmarshalJSON ¶

func (v *ExistingPriceRef) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ExistingProductRef ¶

type ExistingProductRef struct {
	ID ProductID `json:"id"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ExistingProductRef is the ExistingProductRef object of the Meteroid API.

func (ExistingProductRef) MarshalJSON ¶

func (v ExistingProductRef) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ExistingProductRef) UnmarshalJSON ¶

func (v *ExistingProductRef) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ExternalPaymentMethodConfig ¶

type ExternalPaymentMethodConfig struct {
	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ExternalPaymentMethodConfig is the ExternalPaymentMethodConfig object of the Meteroid API.

func (ExternalPaymentMethodConfig) MarshalJSON ¶

func (v ExternalPaymentMethodConfig) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ExternalPaymentMethodConfig) UnmarshalJSON ¶

func (v *ExternalPaymentMethodConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ExtraComponent ¶

type ExtraComponent struct {
	Name string `json:"name"`

	PriceEntry PriceEntry `json:"price_entry"`

	ProductRef ProductRef `json:"product_ref"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ExtraComponent is the ExtraComponent object of the Meteroid API.

func (ExtraComponent) MarshalJSON ¶

func (v ExtraComponent) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ExtraComponent) UnmarshalJSON ¶

func (v *ExtraComponent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ExtraRecurringBillingTypeEnum ¶

type ExtraRecurringBillingTypeEnum string

ExtraRecurringBillingTypeEnum is one of AllExtraRecurringBillingTypeEnumValues, or a value this SDK version does not know.

const (
	ExtraRecurringBillingTypeEnumAdvance ExtraRecurringBillingTypeEnum = "ADVANCE"
	ExtraRecurringBillingTypeEnumArrears ExtraRecurringBillingTypeEnum = "ARREARS"
)

Known values of ExtraRecurringBillingTypeEnum.

The API may add new values over time; unknown values round-trip unchanged.

func (ExtraRecurringBillingTypeEnum) IsKnown ¶

func (e ExtraRecurringBillingTypeEnum) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (ExtraRecurringBillingTypeEnum) String ¶

String returns the wire representation of the value.

type ExtraRecurringFeeStructure ¶

type ExtraRecurringFeeStructure struct {
	BillingType ExtraRecurringBillingTypeEnum `json:"billing_type"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ExtraRecurringFeeStructure is the ExtraRecurringFeeStructure object of the Meteroid API.

func (ExtraRecurringFeeStructure) MarshalJSON ¶

func (v ExtraRecurringFeeStructure) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ExtraRecurringFeeStructure) UnmarshalJSON ¶

func (v *ExtraRecurringFeeStructure) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ExtraRecurringPlanFee ¶

type ExtraRecurringPlanFee struct {
	BillingType BillingType `json:"billing_type"`

	Cadence BillingPeriodEnum `json:"cadence"`

	Quantity int32 `json:"quantity"`

	UnitPrice string `json:"unit_price"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ExtraRecurringPlanFee is the ExtraRecurringPlanFee object of the Meteroid API.

Extra recurring fee

func (ExtraRecurringPlanFee) MarshalJSON ¶

func (v ExtraRecurringPlanFee) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ExtraRecurringPlanFee) UnmarshalJSON ¶

func (v *ExtraRecurringPlanFee) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ExtraRecurringPricing ¶

type ExtraRecurringPricing struct {
	Quantity int32 `json:"quantity"`

	UnitPrice string `json:"unit_price"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ExtraRecurringPricing is the ExtraRecurringPricing object of the Meteroid API.

func (ExtraRecurringPricing) MarshalJSON ¶

func (v ExtraRecurringPricing) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ExtraRecurringPricing) UnmarshalJSON ¶

func (v *ExtraRecurringPricing) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type Feature ¶

type Feature struct {
	// Unique key used to reference this feature in your code. Cannot be changed after creation.
	Code string `json:"code"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Description *string `json:"description,omitempty"`

	Entitlement *Entitlement `json:"entitlement,omitempty"`

	FeatureType FeatureType `json:"feature_type"`

	ID FeatureID `json:"id"`

	Name string `json:"name"`

	Product *EntitlementProductRef `json:"product,omitempty"`

	Status FeatureStatus `json:"status"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

Feature is the Feature object of the Meteroid API.

func (Feature) MarshalJSON ¶

func (v Feature) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*Feature) UnmarshalJSON ¶

func (v *Feature) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type FeatureID ¶

type FeatureID = string

FeatureID is the FeatureId string of the Meteroid API.

type FeatureListResponse ¶

type FeatureListResponse struct {
	Data RequiredSlice[Feature] `json:"data"`

	PaginationMeta PaginationResponse `json:"pagination_meta"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

FeatureListResponse is the FeatureListResponse object of the Meteroid API.

func (FeatureListResponse) MarshalJSON ¶

func (v FeatureListResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*FeatureListResponse) UnmarshalJSON ¶

func (v *FeatureListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type FeatureRef ¶

type FeatureRef struct {
	// Unique key used to reference this feature in your code. Cannot be changed after creation.
	Code string `json:"code"`

	ID FeatureID `json:"id"`

	Name string `json:"name"`

	Product *EntitlementProductRef `json:"product,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

FeatureRef is the FeatureRef object of the Meteroid API.

func (FeatureRef) MarshalJSON ¶

func (v FeatureRef) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*FeatureRef) UnmarshalJSON ¶

func (v *FeatureRef) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type FeatureStatus ¶

type FeatureStatus string

FeatureStatus is one of AllFeatureStatusValues, or a value this SDK version does not know.

Lifecycle status of a feature.

const (
	FeatureStatusActive   FeatureStatus = "ACTIVE"
	FeatureStatusDisabled FeatureStatus = "DISABLED"
	FeatureStatusArchived FeatureStatus = "ARCHIVED"
)

Known values of FeatureStatus.

The API may add new values over time; unknown values round-trip unchanged.

func (FeatureStatus) IsKnown ¶

func (e FeatureStatus) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (FeatureStatus) String ¶

func (e FeatureStatus) String() string

String returns the wire representation of the value.

type FeatureType ¶

type FeatureType struct {
	// Type selects the active variant. Compare it against the
	// FeatureType* constants.
	Type FeatureTypeType `json:"type"`

	// Boolean is set when Type is FeatureTypeBoolean.
	Boolean *BooleanFeatureType `json:"-"`
	// Metered is set when Type is FeatureTypeMetered.
	Metered *MeteredFeatureType `json:"-"`
	// Config is set when Type is FeatureTypeConfig.
	Config *ConfigFeatureType `json:"-"`
	// contains filtered or unexported fields
}

FeatureType is a tagged union discriminated by the type field.

When FeatureType.IsKnown reports true, exactly one variant pointer is set, matching Type. A variant added to the API after this SDK version was released still decodes without error, but with every variant pointer nil: always give a `switch` on Type a `default:` branch (or check IsKnown first) instead of dereferencing a pointer unconditionally. The unknown variant's JSON is available from FeatureType.Raw.

func NewFeatureTypeBoolean ¶

func NewFeatureTypeBoolean(value BooleanFeatureType) FeatureType

NewFeatureTypeBoolean builds a FeatureType holding the BOOLEAN variant.

func NewFeatureTypeConfig ¶

func NewFeatureTypeConfig(value ConfigFeatureType) FeatureType

NewFeatureTypeConfig builds a FeatureType holding the CONFIG variant.

func NewFeatureTypeMetered ¶

func NewFeatureTypeMetered(value MeteredFeatureType) FeatureType

NewFeatureTypeMetered builds a FeatureType holding the METERED variant.

func (FeatureType) IsKnown ¶

func (u FeatureType) IsKnown() bool

IsKnown reports whether Type is one of the variants this SDK version knows about, i.e. one of the FeatureType* constants. It is false for a variant added to the API later, whose payload is then only available from FeatureType.Raw.

func (FeatureType) MarshalJSON ¶

func (u FeatureType) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (FeatureType) Raw ¶

func (u FeatureType) Raw() json.RawMessage

Raw returns the JSON of a variant this SDK version does not know about, as decoded (see FeatureType.IsKnown). It is nil for a known variant, and for a value that was not decoded from JSON. The returned slice is a copy.

func (*FeatureType) UnmarshalJSON ¶

func (u *FeatureType) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Payloads carrying an unrecognized discriminator are kept rather than rejected, so a newer API version does not break older SDK builds. Re-encoding such a value reproduces the same JSON document, though not necessarily the same bytes: `encoding/json` compacts whitespace and escapes `<`, `>` and `&`.

type FeatureTypeType ¶

type FeatureTypeType string

FeatureTypeType is the type of a FeatureType, one of the FeatureType* constants for a variant this SDK version knows.

const (
	FeatureTypeBoolean FeatureTypeType = "BOOLEAN"
	FeatureTypeMetered FeatureTypeType = "METERED"
	FeatureTypeConfig  FeatureTypeType = "CONFIG"
)

Discriminator values for FeatureType.

type Features ¶

type Features struct {
	// contains filtered or unexported fields
}

Features groups the features operations of the Meteroid API.

func (*Features) Archive ¶

func (a *Features) Archive(ctx context.Context, idOrCode string, opts ...RequestOption) error

Archive a feature

Keeps the feature and its entitlements but hides them from resolution.

func (*Features) Create ¶

func (a *Features) Create(ctx context.Context, createFeatureRequest CreateFeatureRequest, opts ...RequestOption) (*Feature, error)

Create a feature

func (*Features) List ¶

func (a *Features) List(ctx context.Context, options *FeaturesListOptions, opts ...RequestOption) (*FeaturesListPage, error)

List features

Features.ListAutoPaging iterates over every item instead.

func (*Features) ListAutoPaging ¶ added in v0.28.0

func (a *Features) ListAutoPaging(ctx context.Context, options *FeaturesListOptions, opts ...RequestOption) *AutoPager[Feature]

ListAutoPaging iterates over every item of Features.List, fetching further pages on demand.

func (*Features) Retrieve ¶

func (a *Features) Retrieve(ctx context.Context, idOrCode string, opts ...RequestOption) (*Feature, error)

Retrieve sends GET /api/v1/features/{id_or_code}.

Get feature details

func (*Features) Unarchive ¶

func (a *Features) Unarchive(ctx context.Context, idOrCode string, opts ...RequestOption) error

Unarchive a feature

func (*Features) Update ¶

func (a *Features) Update(ctx context.Context, idOrCode string, updateFeatureRequest UpdateFeatureRequest, opts ...RequestOption) (*Feature, error)

Update a feature

Partially update feature fields. Code, feature type and product are immutable.

type FeaturesListOptions ¶

type FeaturesListOptions struct {
	// Filter by feature status. Repeat the param to select multiple, omit to return all.
	Statuses []FeatureStatus

	// Filter by product. Omit to return features across all products.
	ProductID *ProductID

	// Search by feature name.
	Search *string

	// Page number (0-indexed)
	Page *int32

	// Number of items per page
	PerPage *int32
}

FeaturesListOptions carries the optional query and header parameters of Features.List. Leave a field nil to omit it.

type FeaturesListPage ¶ added in v0.28.0

type FeaturesListPage struct {
	FeatureListResponse

	// Items holds the items of this page.
	Items []Feature
	// contains filtered or unexported fields
}

FeaturesListPage is a page of Features.List. It embeds the decoded FeatureListResponse, promoting its fields, with the Items of the page; a field named like a page member stays reachable through the embedded FeatureListResponse.

func (*FeaturesListPage) HasNextPage ¶ added in v0.28.0

func (p *FeaturesListPage) HasNextPage() bool

HasNextPage reports whether another page follows this one.

func (FeaturesListPage) MarshalJSON ¶ added in v0.28.0

func (p FeaturesListPage) MarshalJSON() ([]byte, error)

MarshalJSON encodes the FeatureListResponse of the page, as received.

func (*FeaturesListPage) NextPage ¶ added in v0.28.0

func (p *FeaturesListPage) NextPage(ctx context.Context) (*FeaturesListPage, error)

NextPage fetches the page after this one. It returns nil and no error after the last page.

type Fee ¶

type Fee struct {
	// Type selects the active variant. Compare it against the
	// Fee* constants.
	Type FeeType `json:"type"`

	// Rate is set when Type is FeeRate.
	Rate *RatePlanFee `json:"-"`
	// Slot is set when Type is FeeSlot.
	Slot *SlotPlanFee `json:"-"`
	// Capacity is set when Type is FeeCapacity.
	Capacity *CapacityPlanFee `json:"-"`
	// Usage is set when Type is FeeUsage.
	Usage *UsagePlanFee `json:"-"`
	// ExtraRecurring is set when Type is FeeExtraRecurring.
	ExtraRecurring *ExtraRecurringPlanFee `json:"-"`
	// OneTime is set when Type is FeeOneTime.
	OneTime *OneTimePlanFee `json:"-"`
	// contains filtered or unexported fields
}

Fee is a tagged union discriminated by the type field.

When Fee.IsKnown reports true, exactly one variant pointer is set, matching Type. A variant added to the API after this SDK version was released still decodes without error, but with every variant pointer nil: always give a `switch` on Type a `default:` branch (or check IsKnown first) instead of dereferencing a pointer unconditionally. The unknown variant's JSON is available from Fee.Raw.

func NewFeeCapacity ¶

func NewFeeCapacity(value CapacityPlanFee) Fee

NewFeeCapacity builds a Fee holding the CAPACITY variant.

func NewFeeExtraRecurring ¶

func NewFeeExtraRecurring(value ExtraRecurringPlanFee) Fee

NewFeeExtraRecurring builds a Fee holding the EXTRA_RECURRING variant.

func NewFeeOneTime ¶

func NewFeeOneTime(value OneTimePlanFee) Fee

NewFeeOneTime builds a Fee holding the ONE_TIME variant.

func NewFeeRate ¶

func NewFeeRate(value RatePlanFee) Fee

NewFeeRate builds a Fee holding the RATE variant.

func NewFeeSlot ¶

func NewFeeSlot(value SlotPlanFee) Fee

NewFeeSlot builds a Fee holding the SLOT variant.

func NewFeeUsage ¶

func NewFeeUsage(value UsagePlanFee) Fee

NewFeeUsage builds a Fee holding the USAGE variant.

func (Fee) IsKnown ¶

func (u Fee) IsKnown() bool

IsKnown reports whether Type is one of the variants this SDK version knows about, i.e. one of the Fee* constants. It is false for a variant added to the API later, whose payload is then only available from Fee.Raw.

func (Fee) MarshalJSON ¶

func (u Fee) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (Fee) Raw ¶

func (u Fee) Raw() json.RawMessage

Raw returns the JSON of a variant this SDK version does not know about, as decoded (see Fee.IsKnown). It is nil for a known variant, and for a value that was not decoded from JSON. The returned slice is a copy.

func (*Fee) UnmarshalJSON ¶

func (u *Fee) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Payloads carrying an unrecognized discriminator are kept rather than rejected, so a newer API version does not break older SDK builds. Re-encoding such a value reproduces the same JSON document, though not necessarily the same bytes: `encoding/json` compacts whitespace and escapes `<`, `>` and `&`.

type FeeType ¶

type FeeType string

FeeType is the type of a Fee, one of the Fee* constants for a variant this SDK version knows.

const (
	FeeRate           FeeType = "RATE"
	FeeSlot           FeeType = "SLOT"
	FeeCapacity       FeeType = "CAPACITY"
	FeeUsage          FeeType = "USAGE"
	FeeExtraRecurring FeeType = "EXTRA_RECURRING"
	FeeOneTime        FeeType = "ONE_TIME"
)

Discriminator values for Fee.

type FixedDiscount ¶

type FixedDiscount struct {
	Amount string `json:"amount"`

	Currency string `json:"currency"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

FixedDiscount is the FixedDiscount object of the Meteroid API.

func (FixedDiscount) MarshalJSON ¶

func (v FixedDiscount) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*FixedDiscount) UnmarshalJSON ¶

func (v *FixedDiscount) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type FixedWindowResetPeriod ¶

type FixedWindowResetPeriod struct {
	Interval int32 `json:"interval"`

	Unit CalendarUnit `json:"unit"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

FixedWindowResetPeriod is the FixedWindowResetPeriod object of the Meteroid API.

Resets at regular intervals — anchored to your subscription's exact activation time.

func (FixedWindowResetPeriod) MarshalJSON ¶

func (v FixedWindowResetPeriod) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*FixedWindowResetPeriod) UnmarshalJSON ¶

func (v *FixedWindowResetPeriod) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type GetCheckoutSessionResponse ¶

type GetCheckoutSessionResponse struct {
	Session CheckoutSession `json:"session"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

GetCheckoutSessionResponse is the GetCheckoutSessionResponse object of the Meteroid API.

func (GetCheckoutSessionResponse) MarshalJSON ¶

func (v GetCheckoutSessionResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*GetCheckoutSessionResponse) UnmarshalJSON ¶

func (v *GetCheckoutSessionResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type GroupedUsage ¶

type GroupedUsage struct {
	Dimensions RequiredMap[string] `json:"dimensions"`

	Value string `json:"value"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

GroupedUsage is the GroupedUsage object of the Meteroid API.

func (GroupedUsage) MarshalJSON ¶

func (v GroupedUsage) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*GroupedUsage) UnmarshalJSON ¶

func (v *GroupedUsage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type IngestEventsRequest ¶

type IngestEventsRequest struct {
	// Allow events with timestamps more than 1 day in the past. Defaults to `false`.
	AllowBackfilling *bool `json:"allow_backfilling,omitempty"`

	// Accept the batch even if some events fail validation. Defaults to `false`.
	// When `true`, valid events are ingested and failures are reported in the response body.
	// When `false` (default), any invalid event rejects the entire batch.
	AllowPartialFailures *bool `json:"allow_partial_failures,omitempty"`

	// 1–100 events per request.
	Events RequiredSlice[Event] `json:"events"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

IngestEventsRequest is the IngestEventsRequest object of the Meteroid API.

func (IngestEventsRequest) MarshalJSON ¶

func (v IngestEventsRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*IngestEventsRequest) UnmarshalJSON ¶

func (v *IngestEventsRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type IngestEventsResponse ¶

type IngestEventsResponse struct {
	// Events that failed to ingest. Omitted when no failures.
	Failures []IngestFailure `json:"failures,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

IngestEventsResponse is the IngestEventsResponse object of the Meteroid API.

func (IngestEventsResponse) MarshalJSON ¶

func (v IngestEventsResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*IngestEventsResponse) UnmarshalJSON ¶

func (v *IngestEventsResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type IngestFailure ¶

type IngestFailure struct {
	EventID string `json:"event_id"`

	Reason string `json:"reason"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

IngestFailure is the IngestFailure object of the Meteroid API.

func (IngestFailure) MarshalJSON ¶

func (v IngestFailure) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*IngestFailure) UnmarshalJSON ¶

func (v *IngestFailure) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type IntrospectionRequest ¶

type IntrospectionRequest struct {
	// The token to introspect
	Token string `json:"token"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

IntrospectionRequest is the IntrospectionRequest object of the Meteroid API.

Token introspection request

func (IntrospectionRequest) MarshalJSON ¶

func (v IntrospectionRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*IntrospectionRequest) UnmarshalJSON ¶

func (v *IntrospectionRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type Invoice ¶

type Invoice struct {
	AmountDue int64 `json:"amount_due"`

	AppliedCredits int64 `json:"applied_credits"`

	// The period/moment this invoice is about — the subscription period start, or the invoice's
	// own date for manual/one-off. Stable and always present, distinct from `invoice_date` (the
	// emission date). Shown as "Invoice date".
	BillingPeriodStart *Date `json:"billing_period_start,omitempty"`

	ChildInvoiceID *InvoiceID `json:"child_invoice_id,omitempty"`

	Coupons RequiredSlice[CouponLineItem] `json:"coupons"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Currency Currency `json:"currency"`

	// User-defined custom property values, keyed by definition `key`.
	CustomProperties json.RawMessage `json:"custom_properties"`

	CustomerDetails CustomerDetails `json:"customer_details"`

	CustomerID CustomerID `json:"customer_id"`

	DueDate *Date `json:"due_date,omitempty"`

	EinvoicingStatus *EInvoicingStatus `json:"einvoicing_status,omitempty"`

	// RFC 3339 timestamp.
	FinalizedAt *time.Time `json:"finalized_at,omitempty"`

	ID InvoiceID `json:"id"`

	InvoiceDate Date `json:"invoice_date"`

	InvoiceNumber string `json:"invoice_number"`

	InvoiceType InvoiceType `json:"invoice_type"`

	LineItems RequiredSlice[InvoiceLineItem] `json:"line_items"`

	// RFC 3339 timestamp.
	MarkedAsUncollectibleAt *time.Time `json:"marked_as_uncollectible_at,omitempty"`

	Memo *string `json:"memo,omitempty"`

	NetTerms int32 `json:"net_terms"`

	// RFC 3339 timestamp.
	PaidAt *time.Time `json:"paid_at,omitempty"`

	ParentInvoiceID *InvoiceID `json:"parent_invoice_id,omitempty"`

	PaymentStatus InvoicePaymentStatus `json:"payment_status"`

	PurchaseOrder *string `json:"purchase_order,omitempty"`

	Reference *string `json:"reference,omitempty"`

	Status InvoiceStatus `json:"status"`

	SubscriptionID *SubscriptionID `json:"subscription_id,omitempty"`

	Subtotal int64 `json:"subtotal"`

	SubtotalRecurring int64 `json:"subtotal_recurring"`

	TaxAmount int64 `json:"tax_amount"`

	TaxBreakdown RequiredSlice[TaxBreakdownItem] `json:"tax_breakdown"`

	// The prices billed were quoted tax-included. Amounts are net regardless: the tax was
	// carved out of the quoted price, so `total` is that price to the unit.
	TaxInclusive bool `json:"tax_inclusive"`

	Total int64 `json:"total"`

	Transactions RequiredSlice[Transaction] `json:"transactions"`

	// RFC 3339 timestamp.
	UpdatedAt *time.Time `json:"updated_at,omitempty"`

	// RFC 3339 timestamp.
	VoidedAt *time.Time `json:"voided_at,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

Invoice is the Invoice object of the Meteroid API.

func (Invoice) MarshalJSON ¶

func (v Invoice) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*Invoice) UnmarshalJSON ¶

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

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type InvoiceCustomPropertiesRequest ¶

type InvoiceCustomPropertiesRequest struct {
	CustomProperties json.RawMessage `json:"custom_properties"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

InvoiceCustomPropertiesRequest is the InvoiceCustomPropertiesRequest object of the Meteroid API.

Merge update of an invoice's custom property values (send a key with `null` to remove it). Allowed at any status — custom properties stay editable after the invoice is finalized.

func (InvoiceCustomPropertiesRequest) MarshalJSON ¶

func (v InvoiceCustomPropertiesRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*InvoiceCustomPropertiesRequest) UnmarshalJSON ¶

func (v *InvoiceCustomPropertiesRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type InvoiceDocumentsEvent ¶

type InvoiceDocumentsEvent struct {
	CustomerID CustomerID `json:"customer_id"`

	// Set when generation failed for a reason that is not a business rule.
	EinvoicingError *string `json:"einvoicing_error,omitempty"`

	// Empty unless the status is `failed`.
	EinvoicingFindings RequiredSlice[EInvoicingFinding] `json:"einvoicing_findings"`

	// The profile the document was checked against, e.g. "EN 16931".
	EinvoicingProfile *string `json:"einvoicing_profile,omitempty"`

	EinvoicingStatus *EInvoicingStatus `json:"einvoicing_status,omitempty"`

	InvoiceID InvoiceID `json:"invoice_id"`

	PdfDocumentID string `json:"pdf_document_id"`

	// The structured e-invoice stored beside the PDF, when one was produced.
	XMLDocumentID *string `json:"xml_document_id,omitempty"`

	ID EventID `json:"id"`

	// RFC 3339 timestamp.
	Timestamp time.Time `json:"timestamp"`

	Type EventType `json:"type"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

InvoiceDocumentsEvent is the InvoiceDocumentsEvent object of the Meteroid API.

func (InvoiceDocumentsEvent) MarshalJSON ¶

func (v InvoiceDocumentsEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*InvoiceDocumentsEvent) UnmarshalJSON ¶

func (v *InvoiceDocumentsEvent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type InvoiceDocumentsEventData ¶

type InvoiceDocumentsEventData struct {
	CustomerID CustomerID `json:"customer_id"`

	// Set when generation failed for a reason that is not a business rule.
	EinvoicingError *string `json:"einvoicing_error,omitempty"`

	// Empty unless the status is `failed`.
	EinvoicingFindings RequiredSlice[EInvoicingFinding] `json:"einvoicing_findings"`

	// The profile the document was checked against, e.g. "EN 16931".
	EinvoicingProfile *string `json:"einvoicing_profile,omitempty"`

	EinvoicingStatus *EInvoicingStatus `json:"einvoicing_status,omitempty"`

	InvoiceID InvoiceID `json:"invoice_id"`

	PdfDocumentID string `json:"pdf_document_id"`

	// The structured e-invoice stored beside the PDF, when one was produced.
	XMLDocumentID *string `json:"xml_document_id,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

InvoiceDocumentsEventData is the InvoiceDocumentsEventData object of the Meteroid API.

Emitted once the accounting PDF is stored. This is also the moment the e-invoicing outcome is known: the structured document is produced with the PDF, not at finalization.

func (InvoiceDocumentsEventData) MarshalJSON ¶

func (v InvoiceDocumentsEventData) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*InvoiceDocumentsEventData) UnmarshalJSON ¶

func (v *InvoiceDocumentsEventData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type InvoiceEvent ¶

type InvoiceEvent struct {
	ConsolidatedIntoInvoiceID *InvoiceID `json:"consolidated_into_invoice_id,omitempty"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Currency string `json:"currency"`

	// User-defined custom property values, keyed by definition key.
	CustomProperties json.RawMessage `json:"custom_properties"`

	CustomerID CustomerID `json:"customer_id"`

	InvoiceID InvoiceID `json:"invoice_id"`

	// Absent while the invoice is a draft — the number is assigned at finalization.
	InvoiceNumber *string `json:"invoice_number,omitempty"`

	ParentInvoiceID *InvoiceID `json:"parent_invoice_id,omitempty"`

	Status InvoiceStatus `json:"status"`

	TaxAmount int64 `json:"tax_amount"`

	Total int64 `json:"total"`

	ID EventID `json:"id"`

	// RFC 3339 timestamp.
	Timestamp time.Time `json:"timestamp"`

	Type EventType `json:"type"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

InvoiceEvent is the InvoiceEvent object of the Meteroid API.

func (InvoiceEvent) MarshalJSON ¶

func (v InvoiceEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*InvoiceEvent) UnmarshalJSON ¶

func (v *InvoiceEvent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type InvoiceEventData ¶

type InvoiceEventData struct {
	ConsolidatedIntoInvoiceID *InvoiceID `json:"consolidated_into_invoice_id,omitempty"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Currency string `json:"currency"`

	// User-defined custom property values, keyed by definition key.
	CustomProperties json.RawMessage `json:"custom_properties"`

	CustomerID CustomerID `json:"customer_id"`

	InvoiceID InvoiceID `json:"invoice_id"`

	// Absent while the invoice is a draft — the number is assigned at finalization.
	InvoiceNumber *string `json:"invoice_number,omitempty"`

	ParentInvoiceID *InvoiceID `json:"parent_invoice_id,omitempty"`

	Status InvoiceStatus `json:"status"`

	TaxAmount int64 `json:"tax_amount"`

	Total int64 `json:"total"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

InvoiceEventData is the InvoiceEventData object of the Meteroid API.

func (InvoiceEventData) MarshalJSON ¶

func (v InvoiceEventData) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*InvoiceEventData) UnmarshalJSON ¶

func (v *InvoiceEventData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type InvoiceID ¶

type InvoiceID = string

InvoiceID is the InvoiceId string of the Meteroid API.

type InvoiceLineItem ¶

type InvoiceLineItem struct {
	AmountTotal int64 `json:"amount_total"`

	Description *string `json:"description,omitempty"`

	EndDate Date `json:"end_date"`

	Name string `json:"name"`

	Quantity *string `json:"quantity,omitempty"`

	// The tax-included unit price the customer was quoted, on a line billed from
	// tax-inclusive prices. `unit_price` is its net counterpart.
	QuotedUnitPrice *string `json:"quoted_unit_price,omitempty"`

	StartDate Date `json:"start_date"`

	SubLineItems RequiredSlice[SubLineItem] `json:"sub_line_items"`

	TaxRate string `json:"tax_rate"`

	UnitPrice *string `json:"unit_price,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

InvoiceLineItem is the InvoiceLineItem object of the Meteroid API.

func (InvoiceLineItem) MarshalJSON ¶

func (v InvoiceLineItem) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*InvoiceLineItem) UnmarshalJSON ¶

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

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type InvoiceListResponse ¶

type InvoiceListResponse struct {
	Data RequiredSlice[Invoice] `json:"data"`

	PaginationMeta PaginationResponse `json:"pagination_meta"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

InvoiceListResponse is the InvoiceListResponse object of the Meteroid API.

func (InvoiceListResponse) MarshalJSON ¶

func (v InvoiceListResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*InvoiceListResponse) UnmarshalJSON ¶

func (v *InvoiceListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type InvoicePaymentStatus ¶

type InvoicePaymentStatus string

InvoicePaymentStatus is one of AllInvoicePaymentStatusValues, or a value this SDK version does not know.

const (
	InvoicePaymentStatusUnpaid        InvoicePaymentStatus = "UNPAID"
	InvoicePaymentStatusPartiallyPaid InvoicePaymentStatus = "PARTIALLY_PAID"
	InvoicePaymentStatusPaid          InvoicePaymentStatus = "PAID"
	InvoicePaymentStatusErrored       InvoicePaymentStatus = "ERRORED"
	InvoicePaymentStatusProcessing    InvoicePaymentStatus = "PROCESSING"
)

Known values of InvoicePaymentStatus.

The API may add new values over time; unknown values round-trip unchanged.

func (InvoicePaymentStatus) IsKnown ¶

func (e InvoicePaymentStatus) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (InvoicePaymentStatus) String ¶

func (e InvoicePaymentStatus) String() string

String returns the wire representation of the value.

type InvoiceStatus ¶

type InvoiceStatus string

InvoiceStatus is one of AllInvoiceStatusValues, or a value this SDK version does not know.

const (
	InvoiceStatusDraft         InvoiceStatus = "DRAFT"
	InvoiceStatusFinalized     InvoiceStatus = "FINALIZED"
	InvoiceStatusUncollectible InvoiceStatus = "UNCOLLECTIBLE"
	InvoiceStatusVoid          InvoiceStatus = "VOID"
	InvoiceStatusClosed        InvoiceStatus = "CLOSED"
)

Known values of InvoiceStatus.

The API may add new values over time; unknown values round-trip unchanged.

func (InvoiceStatus) IsKnown ¶

func (e InvoiceStatus) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (InvoiceStatus) String ¶

func (e InvoiceStatus) String() string

String returns the wire representation of the value.

type InvoiceType ¶

type InvoiceType string

InvoiceType is one of AllInvoiceTypeValues, or a value this SDK version does not know.

const (
	InvoiceTypeRecurring      InvoiceType = "RECURRING"
	InvoiceTypeOneOff         InvoiceType = "ONE_OFF"
	InvoiceTypeAdjustment     InvoiceType = "ADJUSTMENT"
	InvoiceTypeUsageThreshold InvoiceType = "USAGE_THRESHOLD"
)

Known values of InvoiceType.

The API may add new values over time; unknown values round-trip unchanged.

func (InvoiceType) IsKnown ¶

func (e InvoiceType) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (InvoiceType) String ¶

func (e InvoiceType) String() string

String returns the wire representation of the value.

type Invoices ¶

type Invoices struct {
	// contains filtered or unexported fields
}

Invoices groups the invoices operations of the Meteroid API.

func (*Invoices) Download ¶

func (a *Invoices) Download(ctx context.Context, invoiceID string, opts ...RequestOption) ([]byte, error)

Download invoice PDF

Download the PDF document for an invoice.

func (*Invoices) DownloadXML ¶

func (a *Invoices) DownloadXML(ctx context.Context, invoiceID string, opts ...RequestOption) ([]byte, error)

DownloadXML sends GET /api/v1/invoices/{invoice_id}/xml.

Download invoice e-invoice XML ¶

Download the structured e-invoice (EN 16931 XML) issued with an invoice. For Factur-X the same XML is also embedded in the PDF.

func (*Invoices) List ¶

func (a *Invoices) List(ctx context.Context, options *InvoicesListOptions, opts ...RequestOption) (*InvoicesListPage, error)

List invoices with optional filtering by customer, subscription, or status.

Invoices.ListAutoPaging iterates over every item instead.

func (*Invoices) ListAutoPaging ¶ added in v0.28.0

func (a *Invoices) ListAutoPaging(ctx context.Context, options *InvoicesListOptions, opts ...RequestOption) *AutoPager[Invoice]

ListAutoPaging iterates over every item of Invoices.List, fetching further pages on demand.

func (*Invoices) Refresh ¶

func (a *Invoices) Refresh(ctx context.Context, invoiceID string, opts ...RequestOption) (*Invoice, error)

Refresh invoice

Recompute a draft invoice against current usage, credits, coupons and tax, and return it. Drafts are also refreshed periodically in the background; use this to force it, e.g. after ingesting late events. Rejected while a payment for the invoice is in progress or when the invoice was merged into a consolidated parent.

func (*Invoices) Retrieve ¶

func (a *Invoices) Retrieve(ctx context.Context, invoiceID string, opts ...RequestOption) (*Invoice, error)

Retrieve sends GET /api/v1/invoices/{invoice_id}.

Get invoice ¶

Retrieve a single invoice with its payment transactions.

func (*Invoices) UpdateCustomProperties ¶

func (a *Invoices) UpdateCustomProperties(ctx context.Context, invoiceID string, invoiceCustomPropertiesRequest InvoiceCustomPropertiesRequest, opts ...RequestOption) (*Invoice, error)

UpdateCustomProperties sends PATCH /api/v1/invoices/{invoice_id}/custom-properties.

Update invoice custom properties ¶

Merge custom property values onto an invoice (send a key with `null` to remove it). Values are validated against the tenant's `INVOICE` property definitions. Allowed at any status — custom properties are external workflow metadata and stay editable after the invoice is finalized.

type InvoicesListOptions ¶

type InvoicesListOptions struct {
	// Filter by customer ID or alias
	CustomerID *string

	SubscriptionID *SubscriptionID

	Statuses []InvoiceStatus

	// Only invoices whose e-invoice was generated, or failed. Invoices from entities that
	// had not opted in carry no status and match neither.
	EinvoicingStatus *EInvoicingStatus

	// Sort order. Format: `column.direction`. Allowed columns: `invoice_number`, `customer_name`, `amount`, `invoice_date`, `status`, `payment_status`. Direction: `asc` or `desc`. Default: `invoice_date.desc`.
	OrderBy *string

	// Page number (0-indexed)
	Page *int32

	// Number of items per page
	PerPage *int32
}

InvoicesListOptions carries the optional query and header parameters of Invoices.List. Leave a field nil to omit it.

type InvoicesListPage ¶ added in v0.28.0

type InvoicesListPage struct {
	InvoiceListResponse

	// Items holds the items of this page.
	Items []Invoice
	// contains filtered or unexported fields
}

InvoicesListPage is a page of Invoices.List. It embeds the decoded InvoiceListResponse, promoting its fields, with the Items of the page; a field named like a page member stays reachable through the embedded InvoiceListResponse.

func (*InvoicesListPage) HasNextPage ¶ added in v0.28.0

func (p *InvoicesListPage) HasNextPage() bool

HasNextPage reports whether another page follows this one.

func (InvoicesListPage) MarshalJSON ¶ added in v0.28.0

func (p InvoicesListPage) MarshalJSON() ([]byte, error)

MarshalJSON encodes the InvoiceListResponse of the page, as received.

func (*InvoicesListPage) NextPage ¶ added in v0.28.0

func (p *InvoicesListPage) NextPage(ctx context.Context) (*InvoicesListPage, error)

NextPage fetches the page after this one. It returns nil and no error after the last page.

type InvoicingEntityID ¶

type InvoicingEntityID = string

InvoicingEntityID is the InvoicingEntityId string of the Meteroid API.

type JSONConfigValue ¶

type JSONConfigValue struct {
	Value json.RawMessage `json:"value"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

JSONConfigValue is the JsonConfigValue object of the Meteroid API.

A structured (JSON) config value — the "metadata" case, several fields in one entitlement.

func (JSONConfigValue) MarshalJSON ¶

func (v JSONConfigValue) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*JSONConfigValue) UnmarshalJSON ¶

func (v *JSONConfigValue) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type LinkedSegmentationMatrix ¶

type LinkedSegmentationMatrix struct {
	Dimension1Key string `json:"dimension1_key"`

	Dimension2Key string `json:"dimension2_key"`

	Values RequiredMap[[]string] `json:"values"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

LinkedSegmentationMatrix is the LinkedSegmentationMatrix object of the Meteroid API.

func (LinkedSegmentationMatrix) MarshalJSON ¶

func (v LinkedSegmentationMatrix) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*LinkedSegmentationMatrix) UnmarshalJSON ¶

func (v *LinkedSegmentationMatrix) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ListCheckoutSessionsResponse ¶

type ListCheckoutSessionsResponse struct {
	Sessions RequiredSlice[CheckoutSession] `json:"sessions"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ListCheckoutSessionsResponse is the ListCheckoutSessionsResponse object of the Meteroid API.

func (ListCheckoutSessionsResponse) MarshalJSON ¶

func (v ListCheckoutSessionsResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ListCheckoutSessionsResponse) UnmarshalJSON ¶

func (v *ListCheckoutSessionsResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type MatrixDimension ¶

type MatrixDimension struct {
	Key string `json:"key"`

	Value string `json:"value"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

MatrixDimension is the MatrixDimension object of the Meteroid API.

func (MatrixDimension) MarshalJSON ¶

func (v MatrixDimension) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*MatrixDimension) UnmarshalJSON ¶

func (v *MatrixDimension) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type MatrixPlanPricing ¶

type MatrixPlanPricing struct {
	Rates RequiredSlice[MatrixRow] `json:"rates"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

MatrixPlanPricing is the MatrixPlanPricing object of the Meteroid API.

func (MatrixPlanPricing) MarshalJSON ¶

func (v MatrixPlanPricing) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*MatrixPlanPricing) UnmarshalJSON ¶

func (v *MatrixPlanPricing) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type MatrixPricing ¶

type MatrixPricing struct {
	Rates RequiredSlice[MatrixRow] `json:"rates"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

MatrixPricing is the MatrixPricing object of the Meteroid API.

func (MatrixPricing) MarshalJSON ¶

func (v MatrixPricing) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*MatrixPricing) UnmarshalJSON ¶

func (v *MatrixPricing) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type MatrixRow ¶

type MatrixRow struct {
	Dimension1 MatrixDimension `json:"dimension1"`

	Dimension2 *MatrixDimension `json:"dimension2,omitempty"`

	PerUnitPrice string `json:"per_unit_price"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

MatrixRow is the MatrixRow object of the Meteroid API.

func (MatrixRow) MarshalJSON ¶

func (v MatrixRow) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*MatrixRow) UnmarshalJSON ¶

func (v *MatrixRow) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type MeteredEffectiveEntitlementValue ¶

type MeteredEffectiveEntitlementValue struct {
	Spec MeteredEntitlementSpec `json:"spec"`

	Usage MeteredEntitlementUsage `json:"usage"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

MeteredEffectiveEntitlementValue is the MeteredEffectiveEntitlementValue object of the Meteroid API.

func (MeteredEffectiveEntitlementValue) MarshalJSON ¶

func (v MeteredEffectiveEntitlementValue) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*MeteredEffectiveEntitlementValue) UnmarshalJSON ¶

func (v *MeteredEffectiveEntitlementValue) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type MeteredEntitlementSpec ¶

type MeteredEntitlementSpec struct {
	Enabled bool `json:"enabled"`

	Limit *string `json:"limit,omitempty"`

	MetricID BillableMetricID `json:"metric_id"`

	ResetPeriod ResetPeriod `json:"reset_period"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

MeteredEntitlementSpec is the MeteredEntitlementSpec object of the Meteroid API.

func (MeteredEntitlementSpec) MarshalJSON ¶

func (v MeteredEntitlementSpec) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*MeteredEntitlementSpec) UnmarshalJSON ¶

func (v *MeteredEntitlementSpec) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type MeteredEntitlementUsage ¶

type MeteredEntitlementUsage struct {
	Consumed *string `json:"consumed,omitempty"`

	Remaining *string `json:"remaining,omitempty"`

	// RFC 3339 timestamp.
	ResetAt *time.Time `json:"reset_at,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

MeteredEntitlementUsage is the MeteredEntitlementUsage object of the Meteroid API.

func (MeteredEntitlementUsage) MarshalJSON ¶

func (v MeteredEntitlementUsage) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*MeteredEntitlementUsage) UnmarshalJSON ¶

func (v *MeteredEntitlementUsage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type MeteredEntitlementValue ¶

type MeteredEntitlementValue struct {
	// Per-entitlement kill switch. `false` means disabled.
	Enabled *bool `json:"enabled,omitempty"`

	// Cap on usage. Null means unlimited.
	Limit *string `json:"limit,omitempty"`

	ResetPeriod *ResetPeriod `json:"reset_period,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

MeteredEntitlementValue is the MeteredEntitlementValue object of the Meteroid API.

func (MeteredEntitlementValue) MarshalJSON ¶

func (v MeteredEntitlementValue) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*MeteredEntitlementValue) UnmarshalJSON ¶

func (v *MeteredEntitlementValue) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type MeteredFeatureType ¶

type MeteredFeatureType struct {
	MetricID BillableMetricID `json:"metric_id"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

MeteredFeatureType is the MeteredFeatureType object of the Meteroid API.

func (MeteredFeatureType) MarshalJSON ¶

func (v MeteredFeatureType) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*MeteredFeatureType) UnmarshalJSON ¶

func (v *MeteredFeatureType) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type MeteredResolvedEntitlementValue ¶

type MeteredResolvedEntitlementValue struct {
	Enabled bool `json:"enabled"`

	Limit *string `json:"limit,omitempty"`

	MetricID BillableMetricID `json:"metric_id"`

	ResetPeriod ResetPeriod `json:"reset_period"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

MeteredResolvedEntitlementValue is the MeteredResolvedEntitlementValue object of the Meteroid API.

func (MeteredResolvedEntitlementValue) MarshalJSON ¶

func (v MeteredResolvedEntitlementValue) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*MeteredResolvedEntitlementValue) UnmarshalJSON ¶

func (v *MeteredResolvedEntitlementValue) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type Metric ¶

type Metric struct {
	AggregationKey *string `json:"aggregation_key,omitempty"`

	AggregationType BillingMetricAggregateEnum `json:"aggregation_type"`

	// RFC 3339 timestamp.
	ArchivedAt *time.Time `json:"archived_at,omitempty"`

	Code string `json:"code"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Description *string `json:"description,omitempty"`

	Filters []MetricFilter `json:"filters,omitempty"`

	ID BillableMetricID `json:"id"`

	Name string `json:"name"`

	ProductFamilyID ProductFamilyID `json:"product_family_id"`

	ProductID *ProductID `json:"product_id,omitempty"`

	SegmentationMatrix *MetricSegmentationMatrix `json:"segmentation_matrix,omitempty"`

	UnitConversion *UnitConversion `json:"unit_conversion,omitempty"`

	UsageGroupKey *string `json:"usage_group_key,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

Metric is the Metric object of the Meteroid API.

func (Metric) MarshalJSON ¶

func (v Metric) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*Metric) UnmarshalJSON ¶

func (v *Metric) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type MetricDimension ¶

type MetricDimension struct {
	Key string `json:"key"`

	Values RequiredSlice[string] `json:"values"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

MetricDimension is the MetricDimension object of the Meteroid API.

func (MetricDimension) MarshalJSON ¶

func (v MetricDimension) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*MetricDimension) UnmarshalJSON ¶

func (v *MetricDimension) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type MetricEvent ¶

type MetricEvent struct {
	AggregationKey *string `json:"aggregation_key,omitempty"`

	AggregationType BillingMetricAggregateEnum `json:"aggregation_type"`

	Code string `json:"code"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Description *string `json:"description,omitempty"`

	MetricID BillableMetricID `json:"metric_id"`

	Name string `json:"name"`

	ProductFamilyID ProductFamilyID `json:"product_family_id"`

	ProductID *ProductID `json:"product_id,omitempty"`

	SegmentationMatrix *MetricSegmentationMatrix `json:"segmentation_matrix,omitempty"`

	UnitConversionFactor *int32 `json:"unit_conversion_factor,omitempty"`

	UnitConversionRounding *UnitConversionRoundingEnum `json:"unit_conversion_rounding,omitempty"`

	UsageGroupKey *string `json:"usage_group_key,omitempty"`

	ID EventID `json:"id"`

	// RFC 3339 timestamp.
	Timestamp time.Time `json:"timestamp"`

	Type EventType `json:"type"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

MetricEvent is the MetricEvent object of the Meteroid API.

func (MetricEvent) MarshalJSON ¶

func (v MetricEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*MetricEvent) UnmarshalJSON ¶

func (v *MetricEvent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type MetricEventData ¶

type MetricEventData struct {
	AggregationKey *string `json:"aggregation_key,omitempty"`

	AggregationType BillingMetricAggregateEnum `json:"aggregation_type"`

	Code string `json:"code"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Description *string `json:"description,omitempty"`

	MetricID BillableMetricID `json:"metric_id"`

	Name string `json:"name"`

	ProductFamilyID ProductFamilyID `json:"product_family_id"`

	ProductID *ProductID `json:"product_id,omitempty"`

	SegmentationMatrix *MetricSegmentationMatrix `json:"segmentation_matrix,omitempty"`

	UnitConversionFactor *int32 `json:"unit_conversion_factor,omitempty"`

	UnitConversionRounding *UnitConversionRoundingEnum `json:"unit_conversion_rounding,omitempty"`

	UsageGroupKey *string `json:"usage_group_key,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

MetricEventData is the MetricEventData object of the Meteroid API.

func (MetricEventData) MarshalJSON ¶

func (v MetricEventData) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*MetricEventData) UnmarshalJSON ¶

func (v *MetricEventData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type MetricFilter ¶

type MetricFilter struct {
	Op MetricFilterOperator `json:"op"`

	Property string `json:"property"`

	Values RequiredSlice[string] `json:"values"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

MetricFilter is the MetricFilter object of the Meteroid API.

A pre-aggregation filter: only events whose `property` matches feed the metric's aggregation. Distinct from a segmentation dimension (which splits pricing). Multiple filters are ANDed.

func (MetricFilter) MarshalJSON ¶

func (v MetricFilter) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*MetricFilter) UnmarshalJSON ¶

func (v *MetricFilter) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type MetricFilterOperator ¶

type MetricFilterOperator string

MetricFilterOperator is one of AllMetricFilterOperatorValues, or a value this SDK version does not know.

Operator of a pre-aggregation [`MetricFilter`]. `EQUAL`/`NOT_EQUAL` are the single-value forms of `IN`/`NOT_IN`. Negation (`NOT_EQUAL`/`NOT_IN`) is presence-required: an event missing the property is excluded.

const (
	MetricFilterOperatorEqual    MetricFilterOperator = "EQUAL"
	MetricFilterOperatorNotEqual MetricFilterOperator = "NOT_EQUAL"
	MetricFilterOperatorIn       MetricFilterOperator = "IN"
	MetricFilterOperatorNotIn    MetricFilterOperator = "NOT_IN"
)

Known values of MetricFilterOperator.

The API may add new values over time; unknown values round-trip unchanged.

func (MetricFilterOperator) IsKnown ¶

func (e MetricFilterOperator) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (MetricFilterOperator) String ¶

func (e MetricFilterOperator) String() string

String returns the wire representation of the value.

type MetricListResponse ¶

type MetricListResponse struct {
	Data RequiredSlice[MetricSummary] `json:"data"`

	PaginationMeta PaginationResponse `json:"pagination_meta"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

MetricListResponse is the MetricListResponse object of the Meteroid API.

func (MetricListResponse) MarshalJSON ¶

func (v MetricListResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*MetricListResponse) UnmarshalJSON ¶

func (v *MetricListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type MetricSegmentationMatrix ¶

type MetricSegmentationMatrix struct {
	// Type selects the active variant. Compare it against the
	// MetricSegmentationMatrix* constants.
	Type MetricSegmentationMatrixType `json:"type"`

	// Single is set when Type is MetricSegmentationMatrixSingle.
	Single *MetricDimension `json:"-"`
	// Double is set when Type is MetricSegmentationMatrixDouble.
	Double *DoubleSegmentationMatrix `json:"-"`
	// Linked is set when Type is MetricSegmentationMatrixLinked.
	Linked *LinkedSegmentationMatrix `json:"-"`
	// contains filtered or unexported fields
}

MetricSegmentationMatrix is a tagged union discriminated by the type field.

When MetricSegmentationMatrix.IsKnown reports true, exactly one variant pointer is set, matching Type. A variant added to the API after this SDK version was released still decodes without error, but with every variant pointer nil: always give a `switch` on Type a `default:` branch (or check IsKnown first) instead of dereferencing a pointer unconditionally. The unknown variant's JSON is available from MetricSegmentationMatrix.Raw.

func NewMetricSegmentationMatrixDouble ¶

func NewMetricSegmentationMatrixDouble(value DoubleSegmentationMatrix) MetricSegmentationMatrix

NewMetricSegmentationMatrixDouble builds a MetricSegmentationMatrix holding the DOUBLE variant.

func NewMetricSegmentationMatrixLinked ¶

func NewMetricSegmentationMatrixLinked(value LinkedSegmentationMatrix) MetricSegmentationMatrix

NewMetricSegmentationMatrixLinked builds a MetricSegmentationMatrix holding the LINKED variant.

func NewMetricSegmentationMatrixSingle ¶

func NewMetricSegmentationMatrixSingle(value MetricDimension) MetricSegmentationMatrix

NewMetricSegmentationMatrixSingle builds a MetricSegmentationMatrix holding the SINGLE variant.

func (MetricSegmentationMatrix) IsKnown ¶

func (u MetricSegmentationMatrix) IsKnown() bool

IsKnown reports whether Type is one of the variants this SDK version knows about, i.e. one of the MetricSegmentationMatrix* constants. It is false for a variant added to the API later, whose payload is then only available from MetricSegmentationMatrix.Raw.

func (MetricSegmentationMatrix) MarshalJSON ¶

func (u MetricSegmentationMatrix) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (MetricSegmentationMatrix) Raw ¶

Raw returns the JSON of a variant this SDK version does not know about, as decoded (see MetricSegmentationMatrix.IsKnown). It is nil for a known variant, and for a value that was not decoded from JSON. The returned slice is a copy.

func (*MetricSegmentationMatrix) UnmarshalJSON ¶

func (u *MetricSegmentationMatrix) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Payloads carrying an unrecognized discriminator are kept rather than rejected, so a newer API version does not break older SDK builds. Re-encoding such a value reproduces the same JSON document, though not necessarily the same bytes: `encoding/json` compacts whitespace and escapes `<`, `>` and `&`.

type MetricSegmentationMatrixType ¶

type MetricSegmentationMatrixType string

MetricSegmentationMatrixType is the type of a MetricSegmentationMatrix, one of the MetricSegmentationMatrix* constants for a variant this SDK version knows.

const (
	MetricSegmentationMatrixSingle MetricSegmentationMatrixType = "SINGLE"
	MetricSegmentationMatrixDouble MetricSegmentationMatrixType = "DOUBLE"
	MetricSegmentationMatrixLinked MetricSegmentationMatrixType = "LINKED"
)

Discriminator values for MetricSegmentationMatrix.

type MetricSummary ¶

type MetricSummary struct {
	AggregationKey *string `json:"aggregation_key,omitempty"`

	AggregationType BillingMetricAggregateEnum `json:"aggregation_type"`

	// RFC 3339 timestamp.
	ArchivedAt *time.Time `json:"archived_at,omitempty"`

	Code string `json:"code"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Description *string `json:"description,omitempty"`

	ID BillableMetricID `json:"id"`

	Name string `json:"name"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

MetricSummary is the MetricSummary object of the Meteroid API.

func (MetricSummary) MarshalJSON ¶

func (v MetricSummary) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*MetricSummary) UnmarshalJSON ¶

func (v *MetricSummary) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type MetricUsage ¶

type MetricUsage struct {
	GroupedUsage RequiredSlice[GroupedUsage] `json:"grouped_usage"`

	MetricCode string `json:"metric_code"`

	MetricID BillableMetricID `json:"metric_id"`

	MetricName string `json:"metric_name"`

	TotalValue string `json:"total_value"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

MetricUsage is the MetricUsage object of the Meteroid API.

func (MetricUsage) MarshalJSON ¶

func (v MetricUsage) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*MetricUsage) UnmarshalJSON ¶

func (v *MetricUsage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type Metrics ¶

type Metrics struct {
	// contains filtered or unexported fields
}

Metrics groups the metrics operations of the Meteroid API.

func (*Metrics) Archive ¶

func (a *Metrics) Archive(ctx context.Context, metricID string, opts ...RequestOption) error

Archive a billable metric

func (*Metrics) Create ¶

func (a *Metrics) Create(ctx context.Context, createMetricRequest CreateMetricRequest, opts ...RequestOption) (*Metric, error)

Create a billable metric

func (*Metrics) List ¶

func (a *Metrics) List(ctx context.Context, options *MetricsListOptions, opts ...RequestOption) (*MetricsListPage, error)

List billable metrics

Metrics.ListAutoPaging iterates over every item instead.

func (*Metrics) ListAutoPaging ¶ added in v0.28.0

func (a *Metrics) ListAutoPaging(ctx context.Context, options *MetricsListOptions, opts ...RequestOption) *AutoPager[MetricSummary]

ListAutoPaging iterates over every item of Metrics.List, fetching further pages on demand.

func (*Metrics) Retrieve ¶

func (a *Metrics) Retrieve(ctx context.Context, metricID string, opts ...RequestOption) (*Metric, error)

Retrieve sends GET /api/v1/metrics/{metric_id}.

Get metric details

func (*Metrics) Unarchive ¶

func (a *Metrics) Unarchive(ctx context.Context, metricID string, opts ...RequestOption) error

Unarchive a billable metric

func (*Metrics) Update ¶

func (a *Metrics) Update(ctx context.Context, metricID string, updateMetricRequest UpdateMetricRequest, opts ...RequestOption) (*Metric, error)

Update a billable metric

Partially update metric fields. Code and aggregation_type are immutable.

type MetricsListOptions ¶

type MetricsListOptions struct {
	ProductFamilyID *ProductFamilyID

	// Search by metric name or code
	Search *string

	// Sort order. Format: `column.direction`. Allowed columns: `name`, `code`, `created_at`. Direction: `asc` or `desc`. Default: `name.asc`.
	OrderBy *string

	// Page number (0-indexed)
	Page *int32

	// Number of items per page
	PerPage *int32
}

MetricsListOptions carries the optional query and header parameters of Metrics.List. Leave a field nil to omit it.

type MetricsListPage ¶ added in v0.28.0

type MetricsListPage struct {
	MetricListResponse

	// Items holds the items of this page.
	Items []MetricSummary
	// contains filtered or unexported fields
}

MetricsListPage is a page of Metrics.List. It embeds the decoded MetricListResponse, promoting its fields, with the Items of the page; a field named like a page member stays reachable through the embedded MetricListResponse.

func (*MetricsListPage) HasNextPage ¶ added in v0.28.0

func (p *MetricsListPage) HasNextPage() bool

HasNextPage reports whether another page follows this one.

func (MetricsListPage) MarshalJSON ¶ added in v0.28.0

func (p MetricsListPage) MarshalJSON() ([]byte, error)

MarshalJSON encodes the MetricListResponse of the page, as received.

func (*MetricsListPage) NextPage ¶ added in v0.28.0

func (p *MetricsListPage) NextPage(ctx context.Context) (*MetricsListPage, error)

NextPage fetches the page after this one. It returns nil and no error after the last page.

type Middleware ¶

type Middleware func(next http.RoundTripper) http.RoundTripper

Middleware wraps the transport of every HTTP attempt, inside the retry loop: call next.RoundTrip to continue, or return a response of your own, e.g. from a cache. The first entry of Options.Middleware is the outermost.

type MinimumCommitment ¶

type MinimumCommitment struct {
	// Decimal string in the plan currency, e.g. "100.00".
	Amount string `json:"amount"`

	Scope MinimumCommitmentScope `json:"scope"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

MinimumCommitment is the MinimumCommitment object of the Meteroid API.

func (MinimumCommitment) MarshalJSON ¶

func (v MinimumCommitment) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*MinimumCommitment) UnmarshalJSON ¶

func (v *MinimumCommitment) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type MinimumCommitmentInput ¶

type MinimumCommitmentInput struct {
	// Decimal string in the plan currency.
	Amount string `json:"amount"`

	Scope MinimumCommitmentInputScope `json:"scope"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

MinimumCommitmentInput is the MinimumCommitmentInput object of the Meteroid API.

func (MinimumCommitmentInput) MarshalJSON ¶

func (v MinimumCommitmentInput) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*MinimumCommitmentInput) UnmarshalJSON ¶

func (v *MinimumCommitmentInput) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type MinimumCommitmentInputScope ¶

type MinimumCommitmentInputScope struct {
	// Type selects the active variant. Compare it against the
	// MinimumCommitmentInputScope* constants.
	Type MinimumCommitmentInputScopeType `json:"type"`

	// AllComponents is set when Type is MinimumCommitmentInputScopeAllComponents.
	AllComponents *AllComponentsScope `json:"-"`
	// Components is set when Type is MinimumCommitmentInputScopeComponents.
	Components *ComponentsScope `json:"-"`
	// contains filtered or unexported fields
}

MinimumCommitmentInputScope is a tagged union discriminated by the type field.

When MinimumCommitmentInputScope.IsKnown reports true, exactly one variant pointer is set, matching Type. A variant added to the API after this SDK version was released still decodes without error, but with every variant pointer nil: always give a `switch` on Type a `default:` branch (or check IsKnown first) instead of dereferencing a pointer unconditionally. The unknown variant's JSON is available from MinimumCommitmentInputScope.Raw.

func NewMinimumCommitmentInputScopeAllComponents ¶

func NewMinimumCommitmentInputScopeAllComponents(value AllComponentsScope) MinimumCommitmentInputScope

NewMinimumCommitmentInputScopeAllComponents builds a MinimumCommitmentInputScope holding the all_components variant.

func NewMinimumCommitmentInputScopeComponents ¶

func NewMinimumCommitmentInputScopeComponents(value ComponentsScope) MinimumCommitmentInputScope

NewMinimumCommitmentInputScopeComponents builds a MinimumCommitmentInputScope holding the components variant.

func (MinimumCommitmentInputScope) IsKnown ¶

func (u MinimumCommitmentInputScope) IsKnown() bool

IsKnown reports whether Type is one of the variants this SDK version knows about, i.e. one of the MinimumCommitmentInputScope* constants. It is false for a variant added to the API later, whose payload is then only available from MinimumCommitmentInputScope.Raw.

func (MinimumCommitmentInputScope) MarshalJSON ¶

func (u MinimumCommitmentInputScope) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (MinimumCommitmentInputScope) Raw ¶

Raw returns the JSON of a variant this SDK version does not know about, as decoded (see MinimumCommitmentInputScope.IsKnown). It is nil for a known variant, and for a value that was not decoded from JSON. The returned slice is a copy.

func (*MinimumCommitmentInputScope) UnmarshalJSON ¶

func (u *MinimumCommitmentInputScope) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Payloads carrying an unrecognized discriminator are kept rather than rejected, so a newer API version does not break older SDK builds. Re-encoding such a value reproduces the same JSON document, though not necessarily the same bytes: `encoding/json` compacts whitespace and escapes `<`, `>` and `&`.

type MinimumCommitmentInputScopeType ¶

type MinimumCommitmentInputScopeType string

MinimumCommitmentInputScopeType is the type of a MinimumCommitmentInputScope, one of the MinimumCommitmentInputScope* constants for a variant this SDK version knows.

const (
	MinimumCommitmentInputScopeAllComponents MinimumCommitmentInputScopeType = "all_components"
	MinimumCommitmentInputScopeComponents    MinimumCommitmentInputScopeType = "components"
)

Discriminator values for MinimumCommitmentInputScope.

type MinimumCommitmentScope ¶

type MinimumCommitmentScope struct {
	// Type selects the active variant. Compare it against the
	// MinimumCommitmentScope* constants.
	Type MinimumCommitmentScopeType `json:"type"`

	// AllComponents is set when Type is MinimumCommitmentScopeAllComponents.
	AllComponents *AllComponentsScope `json:"-"`
	// Products is set when Type is MinimumCommitmentScopeProducts.
	Products *ProductsScope `json:"-"`
	// contains filtered or unexported fields
}

MinimumCommitmentScope is a tagged union discriminated by the type field.

When MinimumCommitmentScope.IsKnown reports true, exactly one variant pointer is set, matching Type. A variant added to the API after this SDK version was released still decodes without error, but with every variant pointer nil: always give a `switch` on Type a `default:` branch (or check IsKnown first) instead of dereferencing a pointer unconditionally. The unknown variant's JSON is available from MinimumCommitmentScope.Raw.

func NewMinimumCommitmentScopeAllComponents ¶

func NewMinimumCommitmentScopeAllComponents(value AllComponentsScope) MinimumCommitmentScope

NewMinimumCommitmentScopeAllComponents builds a MinimumCommitmentScope holding the all_components variant.

func NewMinimumCommitmentScopeProducts ¶

func NewMinimumCommitmentScopeProducts(value ProductsScope) MinimumCommitmentScope

NewMinimumCommitmentScopeProducts builds a MinimumCommitmentScope holding the products variant.

func (MinimumCommitmentScope) IsKnown ¶

func (u MinimumCommitmentScope) IsKnown() bool

IsKnown reports whether Type is one of the variants this SDK version knows about, i.e. one of the MinimumCommitmentScope* constants. It is false for a variant added to the API later, whose payload is then only available from MinimumCommitmentScope.Raw.

func (MinimumCommitmentScope) MarshalJSON ¶

func (u MinimumCommitmentScope) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (MinimumCommitmentScope) Raw ¶

Raw returns the JSON of a variant this SDK version does not know about, as decoded (see MinimumCommitmentScope.IsKnown). It is nil for a known variant, and for a value that was not decoded from JSON. The returned slice is a copy.

func (*MinimumCommitmentScope) UnmarshalJSON ¶

func (u *MinimumCommitmentScope) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Payloads carrying an unrecognized discriminator are kept rather than rejected, so a newer API version does not break older SDK builds. Re-encoding such a value reproduces the same JSON document, though not necessarily the same bytes: `encoding/json` compacts whitespace and escapes `<`, `>` and `&`.

type MinimumCommitmentScopeType ¶

type MinimumCommitmentScopeType string

MinimumCommitmentScopeType is the type of a MinimumCommitmentScope, one of the MinimumCommitmentScope* constants for a variant this SDK version knows.

const (
	MinimumCommitmentScopeAllComponents MinimumCommitmentScopeType = "all_components"
	MinimumCommitmentScopeProducts      MinimumCommitmentScopeType = "products"
)

Discriminator values for MinimumCommitmentScope.

type NeverResetPeriod ¶

type NeverResetPeriod struct {
	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

NeverResetPeriod is the NeverResetPeriod object of the Meteroid API.

Never resets — counts all usage since the subscription was activated.

func (NeverResetPeriod) MarshalJSON ¶

func (v NeverResetPeriod) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*NeverResetPeriod) UnmarshalJSON ¶

func (v *NeverResetPeriod) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type NewProductRef ¶

type NewProductRef struct {
	FeeStructure ProductFeeStructure `json:"fee_structure"`

	FeeType ProductFeeTypeEnum `json:"fee_type"`

	Name string `json:"name"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

NewProductRef is the NewProductRef object of the Meteroid API.

func (NewProductRef) MarshalJSON ¶

func (v NewProductRef) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*NewProductRef) UnmarshalJSON ¶

func (v *NewProductRef) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type Nullable ¶

type Nullable[T any] struct {
	// contains filtered or unexported fields
}

Nullable distinguishes the three states a JSON field can be in on a PATCH style request: absent, explicitly null, or set to a value. Used as *Nullable[T] together with `omitempty`, the three states map onto Go as:

field = nil                                        // absent, the server leaves it untouched
field = meteroid.ExplicitNull[string]()    // null, the server clears it
field = meteroid.NewNullable("value")      // set to "value"

The optional nullable fields of PATCH request bodies have this type. Decoding a JSON null leaves a *Nullable nil, as encoding/json does for every pointer.

func ExplicitNull ¶

func ExplicitNull[T any]() *Nullable[T]

ExplicitNull builds a Nullable that serializes as an explicit JSON null.

func NewNullable ¶

func NewNullable[T any](value T) *Nullable[T]

NewNullable builds a Nullable holding value.

func (*Nullable[T]) Get ¶

func (n *Nullable[T]) Get() (T, bool)

Get returns the wrapped value and whether one is present. It reports false for both an absent (nil) and an explicitly null value.

func (*Nullable[T]) IsNull ¶

func (n *Nullable[T]) IsNull() bool

IsNull reports whether the value is an explicit null. It is false for an absent (nil) value: test n == nil for absence.

func (Nullable[T]) MarshalJSON ¶

func (n Nullable[T]) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Nullable[T]) UnmarshalJSON ¶

func (n *Nullable[T]) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type NumberConfigValue ¶

type NumberConfigValue struct {
	Value string `json:"value"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

NumberConfigValue is the NumberConfigValue object of the Meteroid API.

A number config value (decimal, encoded as a string).

func (NumberConfigValue) MarshalJSON ¶

func (v NumberConfigValue) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*NumberConfigValue) UnmarshalJSON ¶

func (v *NumberConfigValue) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type OAuthApp ¶

type OAuthApp struct {
	ClientID string `json:"client_id"`

	ClientSecretHint string `json:"client_secret_hint"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	ID OAuthAppID `json:"id"`

	IsActive bool `json:"is_active"`

	Name string `json:"name"`

	OrganizationID OrganizationID `json:"organization_id"`

	RedirectURIs RequiredSlice[string] `json:"redirect_uris"`

	Scopes RequiredSlice[string] `json:"scopes"`

	// RFC 3339 timestamp.
	UpdatedAt *time.Time `json:"updated_at,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

OAuthApp is the OAuthApp object of the Meteroid API.

An OAuth application registered by a platform

func (OAuthApp) MarshalJSON ¶

func (v OAuthApp) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*OAuthApp) UnmarshalJSON ¶

func (v *OAuthApp) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type OAuthAppID ¶

type OAuthAppID = string

OAuthAppID is the OAuthAppId string of the Meteroid API.

type OAuthAppWithSecret ¶

type OAuthAppWithSecret struct {
	App OAuthApp `json:"app"`

	ClientSecret string `json:"client_secret"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

OAuthAppWithSecret is the OAuthAppWithSecret object of the Meteroid API.

Result of creating an OAuth app (includes the plain-text secret)

func (OAuthAppWithSecret) MarshalJSON ¶

func (v OAuthAppWithSecret) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*OAuthAppWithSecret) UnmarshalJSON ¶

func (v *OAuthAppWithSecret) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type OAuthAppsResponse ¶

type OAuthAppsResponse struct {
	Data RequiredSlice[OAuthApp] `json:"data"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

OAuthAppsResponse is the OAuthAppsResponse object of the Meteroid API.

func (OAuthAppsResponse) MarshalJSON ¶

func (v OAuthAppsResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*OAuthAppsResponse) UnmarshalJSON ¶

func (v *OAuthAppsResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type OAuthErrorCode ¶

type OAuthErrorCode string

OAuthErrorCode is one of AllOAuthErrorCodeValues, or a value this SDK version does not know.

OAuth 2.0 error codes as per RFC 6749

const (
	OAuthErrorCodeInvalidRequest          OAuthErrorCode = "invalid_request"
	OAuthErrorCodeUnauthorizedClient      OAuthErrorCode = "unauthorized_client"
	OAuthErrorCodeAccessDenied            OAuthErrorCode = "access_denied"
	OAuthErrorCodeUnsupportedResponseType OAuthErrorCode = "unsupported_response_type"
	OAuthErrorCodeInvalidScope            OAuthErrorCode = "invalid_scope"
	OAuthErrorCodeServerError             OAuthErrorCode = "server_error"
	OAuthErrorCodeTemporarilyUnavailable  OAuthErrorCode = "temporarily_unavailable"
	OAuthErrorCodeInvalidGrant            OAuthErrorCode = "invalid_grant"
	OAuthErrorCodeInvalidClient           OAuthErrorCode = "invalid_client"
	OAuthErrorCodeUnsupportedGrantType    OAuthErrorCode = "unsupported_grant_type"
)

Known values of OAuthErrorCode.

The API may add new values over time; unknown values round-trip unchanged.

func (OAuthErrorCode) IsKnown ¶

func (e OAuthErrorCode) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (OAuthErrorCode) String ¶

func (e OAuthErrorCode) String() string

String returns the wire representation of the value.

type OAuthErrorResponse ¶

type OAuthErrorResponse struct {
	Error OAuthErrorCode `json:"error"`

	ErrorDescription *string `json:"error_description,omitempty"`

	ErrorURI *string `json:"error_uri,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

OAuthErrorResponse is the OAuthErrorResponse object of the Meteroid API.

OAuth 2.0 error response as per RFC 6749 Section 5.2

func (OAuthErrorResponse) MarshalJSON ¶

func (v OAuthErrorResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*OAuthErrorResponse) UnmarshalJSON ¶

func (v *OAuthErrorResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type Oauth ¶

type Oauth struct {
	// contains filtered or unexported fields
}

Oauth groups the oauth operations of the Meteroid API.

func (*Oauth) Introspect ¶

func (a *Oauth) Introspect(ctx context.Context, introspectionRequest IntrospectionRequest, opts ...RequestOption) (*TokenIntrospectionResponse, error)

Introspect token

Token introspection endpoint (RFC 7662). Requires client credentials via HTTP Basic auth.

An error response is an *APIError whose Body is an *OAuthErrorResponse (401) or a *RestErrorResponse (429).

func (*Oauth) Revoke ¶

func (a *Oauth) Revoke(ctx context.Context, revocationRequest RevocationRequest, opts ...RequestOption) error

Revoke token

Token revocation endpoint (RFC 7009). Always returns 200 per spec. Requires client credentials via HTTP Basic auth.

An error response is an *APIError whose Body is an *OAuthErrorResponse (401) or a *RestErrorResponse (429).

func (*Oauth) Token ¶

func (a *Oauth) Token(ctx context.Context, tokenRequest TokenRequest, opts ...RequestOption) (*TokenResponse, error)

Token sends POST /api/v1/oauth/token.

Exchange tokens ¶

OAuth 2.0 token endpoint. Supports two grant types: - `authorization_code`: Exchange an authorization code for tokens - `refresh_token`: Refresh an access token

Authenticate via HTTP Basic auth (`client_id:client_secret`) or body parameters.

An error response is an *APIError whose Body is an *OAuthErrorResponse (400, 401) or a *RestErrorResponse (429).

type OauthApps ¶

type OauthApps struct {
	// contains filtered or unexported fields
}

OauthApps groups the oauth apps operations of the Meteroid API.

func (*OauthApps) Create ¶

func (a *OauthApps) Create(ctx context.Context, createOAuthAppRequest CreateOAuthAppRequest, opts ...RequestOption) (*OAuthAppWithSecret, error)

Create OAuth app

Register a new OAuth application. Returns the app with its client secret (only shown once).

func (*OauthApps) Delete ¶

func (a *OauthApps) Delete(ctx context.Context, id string, opts ...RequestOption) error

Delete OAuth app

Delete an OAuth application and revoke all associated tokens.

func (*OauthApps) List ¶

func (a *OauthApps) List(ctx context.Context, opts ...RequestOption) (*OAuthAppsResponse, error)

List OAuth apps

List all OAuth applications registered for this platform.

func (*OauthApps) Retrieve ¶

func (a *OauthApps) Retrieve(ctx context.Context, id string, opts ...RequestOption) (*OAuthApp, error)

Retrieve sends GET /api/v1/oauth-apps/{id}.

Get OAuth app ¶

Retrieve an OAuth application by ID.

func (*OauthApps) Rotate ¶

func (a *OauthApps) Rotate(ctx context.Context, id string, opts ...RequestOption) (*RotatedSecret, error)

Rotate client secret

Generate a new client secret for an OAuth app. The old secret is immediately invalidated.

type OnboardingLinkResponse ¶

type OnboardingLinkResponse struct {
	// RFC 3339 timestamp.
	ExpiresAt time.Time `json:"expires_at"`

	URL string `json:"url"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

OnboardingLinkResponse is the OnboardingLinkResponse object of the Meteroid API.

Result of creating an onboarding link

func (OnboardingLinkResponse) MarshalJSON ¶

func (v OnboardingLinkResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*OnboardingLinkResponse) UnmarshalJSON ¶

func (v *OnboardingLinkResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type OnboardingMode ¶

type OnboardingMode string

OnboardingMode is one of AllOnboardingModeValues, or a value this SDK version does not know.

Onboarding mode for connected accounts

const (
	OnboardingModeExpress OnboardingMode = "express"
	OnboardingModeFull    OnboardingMode = "full"
)

Known values of OnboardingMode.

The API may add new values over time; unknown values round-trip unchanged.

func (OnboardingMode) IsKnown ¶

func (e OnboardingMode) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (OnboardingMode) String ¶

func (e OnboardingMode) String() string

String returns the wire representation of the value.

type OneTimeFee ¶

type OneTimeFee struct {
	Quantity int32 `json:"quantity"`

	Rate string `json:"rate"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

OneTimeFee is the OneTimeFee object of the Meteroid API.

func (OneTimeFee) MarshalJSON ¶

func (v OneTimeFee) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*OneTimeFee) UnmarshalJSON ¶

func (v *OneTimeFee) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type OneTimeFeeStructure ¶

type OneTimeFeeStructure struct {
	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

OneTimeFeeStructure is the OneTimeFeeStructure object of the Meteroid API.

func (OneTimeFeeStructure) MarshalJSON ¶

func (v OneTimeFeeStructure) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*OneTimeFeeStructure) UnmarshalJSON ¶

func (v *OneTimeFeeStructure) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type OneTimePlanFee ¶

type OneTimePlanFee struct {
	Quantity int32 `json:"quantity"`

	UnitPrice string `json:"unit_price"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

OneTimePlanFee is the OneTimePlanFee object of the Meteroid API.

One-time fee

func (OneTimePlanFee) MarshalJSON ¶

func (v OneTimePlanFee) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*OneTimePlanFee) UnmarshalJSON ¶

func (v *OneTimePlanFee) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type OneTimePricing ¶

type OneTimePricing struct {
	Quantity int32 `json:"quantity"`

	UnitPrice string `json:"unit_price"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

OneTimePricing is the OneTimePricing object of the Meteroid API.

func (OneTimePricing) MarshalJSON ¶

func (v OneTimePricing) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*OneTimePricing) UnmarshalJSON ¶

func (v *OneTimePricing) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type OnlineMethodConfig ¶

type OnlineMethodConfig struct {
	Enabled bool `json:"enabled"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

OnlineMethodConfig is the OnlineMethodConfig object of the Meteroid API.

func (OnlineMethodConfig) MarshalJSON ¶

func (v OnlineMethodConfig) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*OnlineMethodConfig) UnmarshalJSON ¶

func (v *OnlineMethodConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type OnlineMethodsConfig ¶

type OnlineMethodsConfig struct {
	Card *OnlineMethodConfig `json:"card,omitempty"`

	DirectDebit *OnlineMethodConfig `json:"direct_debit,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

OnlineMethodsConfig is the OnlineMethodsConfig object of the Meteroid API.

func (OnlineMethodsConfig) MarshalJSON ¶

func (v OnlineMethodsConfig) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*OnlineMethodsConfig) UnmarshalJSON ¶

func (v *OnlineMethodsConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type OnlinePaymentMethodConfig ¶

type OnlinePaymentMethodConfig struct {
	Config *OnlineMethodsConfig `json:"config,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

OnlinePaymentMethodConfig is the OnlinePaymentMethodConfig object of the Meteroid API.

func (OnlinePaymentMethodConfig) MarshalJSON ¶

func (v OnlinePaymentMethodConfig) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*OnlinePaymentMethodConfig) UnmarshalJSON ¶

func (v *OnlinePaymentMethodConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type Options ¶

type Options struct {
	// ServerURL overrides the API base URL. Defaults to the METEROID_BASE_URL
	// environment variable, then DefaultServerURL.
	ServerURL string

	// HTTPClient is the client used to perform requests. Supply your own to
	// control proxies, TLS or connection pooling. Defaults to a client with no
	// timeout of its own; per-attempt deadlines come from Timeout instead.
	HTTPClient *http.Client

	// Middleware wraps every HTTP attempt: caching, logging, custom headers.
	Middleware []Middleware

	// Timeout bounds a single attempt, from dialing until the response body has
	// been read. Zero selects DefaultTimeout; a negative value disables it.
	Timeout time.Duration

	// MaxRetries is the number of retries attempted on transient failures,
	// waiting 500ms, 1s, 2s... (up to 8s) minus a random jitter, or the
	// server's Retry-After when it is under a minute. Zero selects
	// DefaultMaxRetries and a negative value disables retries.
	MaxRetries int

	// RetrySchedule is the delay to wait before each retry, and takes
	// precedence over MaxRetries. Set it to an empty (non-nil) slice to disable
	// retries entirely.
	RetrySchedule []time.Duration

	// UserAgent overrides the User-Agent header sent with every request.
	UserAgent string

	// Logger receives a debug record for every attempt and response.
	Logger *slog.Logger

	// TokenProvider is called before each request for a fresh bearer token,
	// e.g. an OAuth2 access token. It takes precedence over the client token.
	TokenProvider func(ctx context.Context) (string, error)

	// ClientID and ClientSecret are the credentials of the OAuth2 client credentials flow.
	// Together they make the client fetch the access token of an OAuth2 security scheme from
	// its token URL on first use, keep it until it expires, and fetch a new one when the API
	// rejects it. TokenProvider and the client token take precedence. They default to the
	// METEROID_CLIENT_ID and METEROID_CLIENT_SECRET environment variables.
	ClientID     string
	ClientSecret string

	// OAuthClientAuth is how the client credentials reach the token endpoint: "basic" (the
	// default) in an HTTP basic Authorization header, or "body" as form fields.
	OAuthClientAuth string

	// BasicAuth holds the credentials of HTTP basic security schemes.
	BasicAuth *BasicAuth

	// APIKeys holds API keys by security scheme name. Schemes left out use the
	// client token.
	APIKeys map[string]string
}

Options configures a Client. The zero value is valid and selects the defaults documented on each field.

type OrganizationID ¶

type OrganizationID = string

OrganizationID is the OrganizationId string of the Meteroid API.

type PackagePlanPricing ¶

type PackagePlanPricing struct {
	BlockSize int64 `json:"block_size"`

	Rate string `json:"rate"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

PackagePlanPricing is the PackagePlanPricing object of the Meteroid API.

func (PackagePlanPricing) MarshalJSON ¶

func (v PackagePlanPricing) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*PackagePlanPricing) UnmarshalJSON ¶

func (v *PackagePlanPricing) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type PackagePricing ¶

type PackagePricing struct {
	BlockSize int64 `json:"block_size"`

	Rate string `json:"rate"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

PackagePricing is the PackagePricing object of the Meteroid API.

func (PackagePricing) MarshalJSON ¶

func (v PackagePricing) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*PackagePricing) UnmarshalJSON ¶

func (v *PackagePricing) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type PaginationResponse ¶

type PaginationResponse struct {
	Page int32 `json:"page"`

	PerPage int32 `json:"per_page"`

	TotalItems int64 `json:"total_items"`

	TotalPages int32 `json:"total_pages"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

PaginationResponse is the PaginationResponse object of the Meteroid API.

func (PaginationResponse) MarshalJSON ¶

func (v PaginationResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*PaginationResponse) UnmarshalJSON ¶

func (v *PaginationResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type PatchPlanRequest ¶

type PatchPlanRequest struct {
	Description *Nullable[string] `json:"description,omitempty"`

	Name *Nullable[string] `json:"name,omitempty"`

	SelfServiceRank *Nullable[int32] `json:"self_service_rank,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

PatchPlanRequest is the PatchPlanRequest object of the Meteroid API.

func (PatchPlanRequest) MarshalJSON ¶

func (v PatchPlanRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*PatchPlanRequest) UnmarshalJSON ¶

func (v *PatchPlanRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type PaymentEvent ¶

type PaymentEvent struct {
	Amount int64 `json:"amount"`

	AmountRefunded int64 `json:"amount_refunded"`

	AmountReversed int64 `json:"amount_reversed"`

	CreditNoteID *CreditNoteID `json:"credit_note_id,omitempty"`

	Currency string `json:"currency"`

	DeclineKind *DeclineKind `json:"decline_kind,omitempty"`

	Error *string `json:"error,omitempty"`

	InvoiceID *InvoiceID `json:"invoice_id,omitempty"`

	ParentTransactionID *PaymentTransactionID `json:"parent_transaction_id,omitempty"`

	PaymentType PaymentTypeEnum `json:"payment_type"`

	// RFC 3339 timestamp.
	ProcessedAt *time.Time `json:"processed_at,omitempty"`

	ProviderTransactionID *string `json:"provider_transaction_id,omitempty"`

	RefundMode *RefundMode `json:"refund_mode,omitempty"`

	ReversalKind *ReversalKind `json:"reversal_kind,omitempty"`

	Status PaymentStatusEnum `json:"status"`

	TransactionID PaymentTransactionID `json:"transaction_id"`

	ID EventID `json:"id"`

	// RFC 3339 timestamp.
	Timestamp time.Time `json:"timestamp"`

	Type EventType `json:"type"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

PaymentEvent is the PaymentEvent object of the Meteroid API.

func (PaymentEvent) MarshalJSON ¶

func (v PaymentEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*PaymentEvent) UnmarshalJSON ¶

func (v *PaymentEvent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type PaymentMethodInfo ¶

type PaymentMethodInfo struct {
	AccountNumberHint *string `json:"account_number_hint,omitempty"`

	CardBrand *string `json:"card_brand,omitempty"`

	CardLast4 *string `json:"card_last4,omitempty"`

	PaymentMethodType PaymentMethodTypeEnum `json:"payment_method_type"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

PaymentMethodInfo is the PaymentMethodInfo object of the Meteroid API.

func (PaymentMethodInfo) MarshalJSON ¶

func (v PaymentMethodInfo) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*PaymentMethodInfo) UnmarshalJSON ¶

func (v *PaymentMethodInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type PaymentMethodTypeEnum ¶

type PaymentMethodTypeEnum string

PaymentMethodTypeEnum is one of AllPaymentMethodTypeEnumValues, or a value this SDK version does not know.

const (
	PaymentMethodTypeEnumCard         PaymentMethodTypeEnum = "CARD"
	PaymentMethodTypeEnumBankTransfer PaymentMethodTypeEnum = "BANK_TRANSFER"
	PaymentMethodTypeEnumWallet       PaymentMethodTypeEnum = "WALLET"
	PaymentMethodTypeEnumOther        PaymentMethodTypeEnum = "OTHER"
)

Known values of PaymentMethodTypeEnum.

The API may add new values over time; unknown values round-trip unchanged.

func (PaymentMethodTypeEnum) IsKnown ¶

func (e PaymentMethodTypeEnum) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (PaymentMethodTypeEnum) String ¶

func (e PaymentMethodTypeEnum) String() string

String returns the wire representation of the value.

type PaymentMethodsConfig ¶

type PaymentMethodsConfig struct {
	// Type selects the active variant. Compare it against the
	// PaymentMethodsConfig* constants.
	Type PaymentMethodsConfigType `json:"type"`

	// Online is set when Type is PaymentMethodsConfigOnline.
	Online *OnlinePaymentMethodConfig `json:"-"`
	// BankTransfer is set when Type is PaymentMethodsConfigBankTransfer.
	BankTransfer *BankTransferPaymentMethodConfig `json:"-"`
	// External is set when Type is PaymentMethodsConfigExternal.
	External *ExternalPaymentMethodConfig `json:"-"`
	// contains filtered or unexported fields
}

PaymentMethodsConfig is a tagged union discriminated by the type field.

Online (card/direct debit), BankTransfer, or External.

When PaymentMethodsConfig.IsKnown reports true, exactly one variant pointer is set, matching Type. A variant added to the API after this SDK version was released still decodes without error, but with every variant pointer nil: always give a `switch` on Type a `default:` branch (or check IsKnown first) instead of dereferencing a pointer unconditionally. The unknown variant's JSON is available from PaymentMethodsConfig.Raw.

func NewPaymentMethodsConfigBankTransfer ¶

func NewPaymentMethodsConfigBankTransfer(value BankTransferPaymentMethodConfig) PaymentMethodsConfig

NewPaymentMethodsConfigBankTransfer builds a PaymentMethodsConfig holding the bank_transfer variant.

func NewPaymentMethodsConfigExternal ¶

func NewPaymentMethodsConfigExternal(value ExternalPaymentMethodConfig) PaymentMethodsConfig

NewPaymentMethodsConfigExternal builds a PaymentMethodsConfig holding the external variant.

func NewPaymentMethodsConfigOnline ¶

func NewPaymentMethodsConfigOnline(value OnlinePaymentMethodConfig) PaymentMethodsConfig

NewPaymentMethodsConfigOnline builds a PaymentMethodsConfig holding the online variant.

func (PaymentMethodsConfig) IsKnown ¶

func (u PaymentMethodsConfig) IsKnown() bool

IsKnown reports whether Type is one of the variants this SDK version knows about, i.e. one of the PaymentMethodsConfig* constants. It is false for a variant added to the API later, whose payload is then only available from PaymentMethodsConfig.Raw.

func (PaymentMethodsConfig) MarshalJSON ¶

func (u PaymentMethodsConfig) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (PaymentMethodsConfig) Raw ¶

Raw returns the JSON of a variant this SDK version does not know about, as decoded (see PaymentMethodsConfig.IsKnown). It is nil for a known variant, and for a value that was not decoded from JSON. The returned slice is a copy.

func (*PaymentMethodsConfig) UnmarshalJSON ¶

func (u *PaymentMethodsConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Payloads carrying an unrecognized discriminator are kept rather than rejected, so a newer API version does not break older SDK builds. Re-encoding such a value reproduces the same JSON document, though not necessarily the same bytes: `encoding/json` compacts whitespace and escapes `<`, `>` and `&`.

type PaymentMethodsConfigType ¶

type PaymentMethodsConfigType string

PaymentMethodsConfigType is the type of a PaymentMethodsConfig, one of the PaymentMethodsConfig* constants for a variant this SDK version knows.

const (
	PaymentMethodsConfigOnline       PaymentMethodsConfigType = "online"
	PaymentMethodsConfigBankTransfer PaymentMethodsConfigType = "bank_transfer"
	PaymentMethodsConfigExternal     PaymentMethodsConfigType = "external"
)

Discriminator values for PaymentMethodsConfig.

type PaymentStatusEnum ¶

type PaymentStatusEnum string

PaymentStatusEnum is one of AllPaymentStatusEnumValues, or a value this SDK version does not know.

const (
	PaymentStatusEnumReady     PaymentStatusEnum = "READY"
	PaymentStatusEnumPending   PaymentStatusEnum = "PENDING"
	PaymentStatusEnumSettled   PaymentStatusEnum = "SETTLED"
	PaymentStatusEnumCancelled PaymentStatusEnum = "CANCELLED"
	PaymentStatusEnumFailed    PaymentStatusEnum = "FAILED"
	PaymentStatusEnumRefunded  PaymentStatusEnum = "REFUNDED"
)

Known values of PaymentStatusEnum.

The API may add new values over time; unknown values round-trip unchanged.

func (PaymentStatusEnum) IsKnown ¶

func (e PaymentStatusEnum) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (PaymentStatusEnum) String ¶

func (e PaymentStatusEnum) String() string

String returns the wire representation of the value.

type PaymentTransactionID ¶

type PaymentTransactionID = string

PaymentTransactionID is the PaymentTransactionId string of the Meteroid API.

type PaymentTypeEnum ¶

type PaymentTypeEnum string

PaymentTypeEnum is one of AllPaymentTypeEnumValues, or a value this SDK version does not know.

const (
	PaymentTypeEnumPayment PaymentTypeEnum = "PAYMENT"
	PaymentTypeEnumRefund  PaymentTypeEnum = "REFUND"
)

Known values of PaymentTypeEnum.

The API may add new values over time; unknown values round-trip unchanged.

func (PaymentTypeEnum) IsKnown ¶

func (e PaymentTypeEnum) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (PaymentTypeEnum) String ¶

func (e PaymentTypeEnum) String() string

String returns the wire representation of the value.

type PerUnitPlanPricing ¶

type PerUnitPlanPricing struct {
	Rate string `json:"rate"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

PerUnitPlanPricing is the PerUnitPlanPricing object of the Meteroid API.

func (PerUnitPlanPricing) MarshalJSON ¶

func (v PerUnitPlanPricing) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*PerUnitPlanPricing) UnmarshalJSON ¶

func (v *PerUnitPlanPricing) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type PerUnitPricing ¶

type PerUnitPricing struct {
	Rate string `json:"rate"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

PerUnitPricing is the PerUnitPricing object of the Meteroid API.

func (PerUnitPricing) MarshalJSON ¶

func (v PerUnitPricing) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*PerUnitPricing) UnmarshalJSON ¶

func (v *PerUnitPricing) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type PercentageDiscount ¶

type PercentageDiscount struct {
	Percentage string `json:"percentage"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

PercentageDiscount is the PercentageDiscount object of the Meteroid API.

func (PercentageDiscount) MarshalJSON ¶

func (v PercentageDiscount) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*PercentageDiscount) UnmarshalJSON ¶

func (v *PercentageDiscount) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type Plan ¶

type Plan struct {
	AvailableParameters AvailableParameters `json:"available_parameters"`

	BillingCycles *int32 `json:"billing_cycles,omitempty"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Currency Currency `json:"currency"`

	Description *string `json:"description,omitempty"`

	Entitlements []Entitlement `json:"entitlements,omitempty"`

	ID PlanID `json:"id"`

	MinimumCommitment *MinimumCommitment `json:"minimum_commitment,omitempty"`

	Name string `json:"name"`

	NetTerms int32 `json:"net_terms"`

	PeriodStartDay *int32 `json:"period_start_day,omitempty"`

	PlanType PlanTypeEnum `json:"plan_type"`

	PriceComponents RequiredSlice[PriceComponent] `json:"price_components"`

	ProductFamily ProductFamily `json:"product_family"`

	SelfServiceRank *int32 `json:"self_service_rank,omitempty"`

	Status PlanStatusEnum `json:"status"`

	// The plan's amounts are quoted tax-included ("9.99 incl. VAT"): tax is carved out of
	// them at invoice time instead of being added on top, so the customer pays the quoted
	// price whatever rate applies. A customer who bears no tax (reverse charge, exempt,
	// export) still pays it in full. Defaults to `false`.
	TaxInclusive bool `json:"tax_inclusive"`

	Trial *TrialConfig `json:"trial,omitempty"`

	Version int32 `json:"version"`

	VersionID PlanVersionID `json:"version_id"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

Plan is the Plan object of the Meteroid API.

func (Plan) MarshalJSON ¶

func (v Plan) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*Plan) UnmarshalJSON ¶

func (v *Plan) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type PlanAddOnInput ¶

type PlanAddOnInput struct {
	AddOnID AddOnID `json:"add_on_id"`

	MaxInstances *int32 `json:"max_instances,omitempty"`

	PriceID *PriceID `json:"price_id,omitempty"`

	SelfServiceable *bool `json:"self_serviceable,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

PlanAddOnInput is the PlanAddOnInput object of the Meteroid API.

func (PlanAddOnInput) MarshalJSON ¶

func (v PlanAddOnInput) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*PlanAddOnInput) UnmarshalJSON ¶

func (v *PlanAddOnInput) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type PlanEvent ¶

type PlanEvent struct {
	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Currency string `json:"currency"`

	Description *string `json:"description,omitempty"`

	Name string `json:"name"`

	PlanID PlanID `json:"plan_id"`

	PlanType PlanTypeEnum `json:"plan_type"`

	Status PlanStatusEnum `json:"status"`

	Version int32 `json:"version"`

	ID EventID `json:"id"`

	// RFC 3339 timestamp.
	Timestamp time.Time `json:"timestamp"`

	Type EventType `json:"type"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

PlanEvent is the PlanEvent object of the Meteroid API.

func (PlanEvent) MarshalJSON ¶

func (v PlanEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*PlanEvent) UnmarshalJSON ¶

func (v *PlanEvent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type PlanEventData ¶

type PlanEventData struct {
	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Currency string `json:"currency"`

	Description *string `json:"description,omitempty"`

	Name string `json:"name"`

	PlanID PlanID `json:"plan_id"`

	PlanType PlanTypeEnum `json:"plan_type"`

	Status PlanStatusEnum `json:"status"`

	Version int32 `json:"version"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

PlanEventData is the PlanEventData object of the Meteroid API.

func (PlanEventData) MarshalJSON ¶

func (v PlanEventData) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*PlanEventData) UnmarshalJSON ¶

func (v *PlanEventData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type PlanID ¶

type PlanID = string

PlanID is the PlanId string of the Meteroid API.

type PlanListResponse ¶

type PlanListResponse struct {
	Data RequiredSlice[Plan] `json:"data"`

	PaginationMeta PaginationResponse `json:"pagination_meta"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

PlanListResponse is the PlanListResponse object of the Meteroid API.

func (PlanListResponse) MarshalJSON ¶

func (v PlanListResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*PlanListResponse) UnmarshalJSON ¶

func (v *PlanListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type PlanStatusEnum ¶

type PlanStatusEnum string

PlanStatusEnum is one of AllPlanStatusEnumValues, or a value this SDK version does not know.

const (
	PlanStatusEnumDraft    PlanStatusEnum = "DRAFT"
	PlanStatusEnumActive   PlanStatusEnum = "ACTIVE"
	PlanStatusEnumInactive PlanStatusEnum = "INACTIVE"
	PlanStatusEnumArchived PlanStatusEnum = "ARCHIVED"
)

Known values of PlanStatusEnum.

The API may add new values over time; unknown values round-trip unchanged.

func (PlanStatusEnum) IsKnown ¶

func (e PlanStatusEnum) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (PlanStatusEnum) String ¶

func (e PlanStatusEnum) String() string

String returns the wire representation of the value.

type PlanTypeEnum ¶

type PlanTypeEnum string

PlanTypeEnum is one of AllPlanTypeEnumValues, or a value this SDK version does not know.

const (
	PlanTypeEnumStandard PlanTypeEnum = "STANDARD"
	PlanTypeEnumFree     PlanTypeEnum = "FREE"
	PlanTypeEnumCustom   PlanTypeEnum = "CUSTOM"
)

Known values of PlanTypeEnum.

The API may add new values over time; unknown values round-trip unchanged.

func (PlanTypeEnum) IsKnown ¶

func (e PlanTypeEnum) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (PlanTypeEnum) String ¶

func (e PlanTypeEnum) String() string

String returns the wire representation of the value.

type PlanUsagePricingModel ¶

type PlanUsagePricingModel struct {
	// Type selects the active variant. Compare it against the
	// PlanUsagePricingModel* constants.
	Type PlanUsagePricingModelType `json:"type"`

	// PerUnit is set when Type is PlanUsagePricingModelPerUnit.
	PerUnit *PerUnitPlanPricing `json:"-"`
	// Tiered is set when Type is PlanUsagePricingModelTiered.
	Tiered *TieredPlanPricing `json:"-"`
	// Volume is set when Type is PlanUsagePricingModelVolume.
	Volume *VolumePlanPricing `json:"-"`
	// Package is set when Type is PlanUsagePricingModelPackage.
	Package *PackagePlanPricing `json:"-"`
	// Matrix is set when Type is PlanUsagePricingModelMatrix.
	Matrix *MatrixPlanPricing `json:"-"`
	// contains filtered or unexported fields
}

PlanUsagePricingModel is a tagged union discriminated by the type field.

When PlanUsagePricingModel.IsKnown reports true, exactly one variant pointer is set, matching Type. A variant added to the API after this SDK version was released still decodes without error, but with every variant pointer nil: always give a `switch` on Type a `default:` branch (or check IsKnown first) instead of dereferencing a pointer unconditionally. The unknown variant's JSON is available from PlanUsagePricingModel.Raw.

func NewPlanUsagePricingModelMatrix ¶

func NewPlanUsagePricingModelMatrix(value MatrixPlanPricing) PlanUsagePricingModel

NewPlanUsagePricingModelMatrix builds a PlanUsagePricingModel holding the MATRIX variant.

func NewPlanUsagePricingModelPackage ¶

func NewPlanUsagePricingModelPackage(value PackagePlanPricing) PlanUsagePricingModel

NewPlanUsagePricingModelPackage builds a PlanUsagePricingModel holding the PACKAGE variant.

func NewPlanUsagePricingModelPerUnit ¶

func NewPlanUsagePricingModelPerUnit(value PerUnitPlanPricing) PlanUsagePricingModel

NewPlanUsagePricingModelPerUnit builds a PlanUsagePricingModel holding the PER_UNIT variant.

func NewPlanUsagePricingModelTiered ¶

func NewPlanUsagePricingModelTiered(value TieredPlanPricing) PlanUsagePricingModel

NewPlanUsagePricingModelTiered builds a PlanUsagePricingModel holding the TIERED variant.

func NewPlanUsagePricingModelVolume ¶

func NewPlanUsagePricingModelVolume(value VolumePlanPricing) PlanUsagePricingModel

NewPlanUsagePricingModelVolume builds a PlanUsagePricingModel holding the VOLUME variant.

func (PlanUsagePricingModel) IsKnown ¶

func (u PlanUsagePricingModel) IsKnown() bool

IsKnown reports whether Type is one of the variants this SDK version knows about, i.e. one of the PlanUsagePricingModel* constants. It is false for a variant added to the API later, whose payload is then only available from PlanUsagePricingModel.Raw.

func (PlanUsagePricingModel) MarshalJSON ¶

func (u PlanUsagePricingModel) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (PlanUsagePricingModel) Raw ¶

Raw returns the JSON of a variant this SDK version does not know about, as decoded (see PlanUsagePricingModel.IsKnown). It is nil for a known variant, and for a value that was not decoded from JSON. The returned slice is a copy.

func (*PlanUsagePricingModel) UnmarshalJSON ¶

func (u *PlanUsagePricingModel) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Payloads carrying an unrecognized discriminator are kept rather than rejected, so a newer API version does not break older SDK builds. Re-encoding such a value reproduces the same JSON document, though not necessarily the same bytes: `encoding/json` compacts whitespace and escapes `<`, `>` and `&`.

type PlanUsagePricingModelType ¶

type PlanUsagePricingModelType string

PlanUsagePricingModelType is the type of a PlanUsagePricingModel, one of the PlanUsagePricingModel* constants for a variant this SDK version knows.

const (
	PlanUsagePricingModelPerUnit PlanUsagePricingModelType = "PER_UNIT"
	PlanUsagePricingModelTiered  PlanUsagePricingModelType = "TIERED"
	PlanUsagePricingModelVolume  PlanUsagePricingModelType = "VOLUME"
	PlanUsagePricingModelPackage PlanUsagePricingModelType = "PACKAGE"
	PlanUsagePricingModelMatrix  PlanUsagePricingModelType = "MATRIX"
)

Discriminator values for PlanUsagePricingModel.

type PlanVersionID ¶

type PlanVersionID = string

PlanVersionID is the PlanVersionId string of the Meteroid API.

type PlanVersionListResponse ¶

type PlanVersionListResponse struct {
	Data RequiredSlice[PlanVersionSummary] `json:"data"`

	PaginationMeta PaginationResponse `json:"pagination_meta"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

PlanVersionListResponse is the PlanVersionListResponse object of the Meteroid API.

func (PlanVersionListResponse) MarshalJSON ¶

func (v PlanVersionListResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*PlanVersionListResponse) UnmarshalJSON ¶

func (v *PlanVersionListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type PlanVersionSummary ¶

type PlanVersionSummary struct {
	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Currency Currency `json:"currency"`

	ID PlanVersionID `json:"id"`

	IsDraft bool `json:"is_draft"`

	Version int32 `json:"version"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

PlanVersionSummary is the PlanVersionSummary object of the Meteroid API.

func (PlanVersionSummary) MarshalJSON ¶

func (v PlanVersionSummary) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*PlanVersionSummary) UnmarshalJSON ¶

func (v *PlanVersionSummary) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type Plans ¶

type Plans struct {
	// contains filtered or unexported fields
}

Plans groups the plans operations of the Meteroid API.

func (*Plans) Archive ¶

func (a *Plans) Archive(ctx context.Context, planID string, opts ...RequestOption) error

Archive a plan

func (*Plans) Create ¶

func (a *Plans) Create(ctx context.Context, createPlanRequest CreatePlanRequest, opts ...RequestOption) (*Plan, error)

Create a plan

Create a new plan with components and pricing. Set `status` to `ACTIVE` to publish immediately, or `DRAFT` to stage for review.

func (*Plans) CreatePlanVersionEntitlement ¶

func (a *Plans) CreatePlanVersionEntitlement(ctx context.Context, planVersionID string, createEntitlementsRequest CreateEntitlementsRequest, opts ...RequestOption) (*EntitlementListResponse, error)

CreatePlanVersionEntitlement sends POST /api/v1/plan-versions/{plan_version_id}/entitlements.

Create plan version entitlements ¶

Entitlements already present on this plan version are skipped.

func (*Plans) List ¶

func (a *Plans) List(ctx context.Context, options *PlansListOptions, opts ...RequestOption) (*PlansListPage, error)

List plans

Plans.ListAutoPaging iterates over every item instead.

func (*Plans) ListAutoPaging ¶ added in v0.28.0

func (a *Plans) ListAutoPaging(ctx context.Context, options *PlansListOptions, opts ...RequestOption) *AutoPager[Plan]

ListAutoPaging iterates over every item of Plans.List, fetching further pages on demand.

func (*Plans) ListPlanVersionEntitlements ¶

func (a *Plans) ListPlanVersionEntitlements(ctx context.Context, planVersionID string, opts ...RequestOption) (*ResolvedEntitlementListResponse, error)

ListPlanVersionEntitlements sends GET /api/v1/plan-versions/{plan_version_id}/entitlements.

List plan version entitlements

func (*Plans) Publish ¶

func (a *Plans) Publish(ctx context.Context, planID string, opts ...RequestOption) (*Plan, error)

Publish a draft plan version

Publishes the current draft version, making it the active version.

func (*Plans) Replace ¶

func (a *Plans) Replace(ctx context.Context, planID string, replacePlanRequest ReplacePlanRequest, opts ...RequestOption) (*Plan, error)

Replace a plan

Full replacement of a plan's version. On a draft plan, updates in-place. On a published plan, creates a new version. Set `status` to `DRAFT` to stage as a new draft without publishing.

func (*Plans) Retrieve ¶

func (a *Plans) Retrieve(ctx context.Context, planID string, options *PlansRetrieveOptions, opts ...RequestOption) (*Plan, error)

Retrieve sends GET /api/v1/plans/{plan_id}.

Get plan details ¶

Retrieve a specific plan. Use `?version=draft` for the draft version, `?version=2` for a specific version number, or omit for the active version.

func (*Plans) Unarchive ¶

func (a *Plans) Unarchive(ctx context.Context, planID string, opts ...RequestOption) error

Unarchive a plan

func (*Plans) Update ¶

func (a *Plans) Update(ctx context.Context, planID string, patchPlanRequest PatchPlanRequest, opts ...RequestOption) (*Plan, error)

Update plan metadata

Partially update plan-level fields (name, description, self_service_rank). Does not modify version-level configuration or components.

func (*Plans) Versions ¶ added in v0.29.0

func (a *Plans) Versions() *PlansVersions

Versions returns the versions API.

type PlansListOptions ¶

type PlansListOptions struct {
	ProductFamilyID *ProductFamilyID

	// Search by plan name
	Search *string

	// Filter by plan status (can be repeated)
	Status []PlanStatusEnum

	// Filter by plan type (can be repeated)
	PlanType []PlanTypeEnum

	// Sort order. Format: `column.direction`. Allowed columns: `name`, `status`, `plan_type`, `created_at`. Direction: `asc` or `desc`. Default: `created_at.desc`.
	OrderBy *string

	// Page number (0-indexed)
	Page *int32

	// Number of items per page
	PerPage *int32
}

PlansListOptions carries the optional query and header parameters of Plans.List. Leave a field nil to omit it.

type PlansListPage ¶ added in v0.28.0

type PlansListPage struct {
	PlanListResponse

	// Items holds the items of this page.
	Items []Plan
	// contains filtered or unexported fields
}

PlansListPage is a page of Plans.List. It embeds the decoded PlanListResponse, promoting its fields, with the Items of the page; a field named like a page member stays reachable through the embedded PlanListResponse.

func (*PlansListPage) HasNextPage ¶ added in v0.28.0

func (p *PlansListPage) HasNextPage() bool

HasNextPage reports whether another page follows this one.

func (PlansListPage) MarshalJSON ¶ added in v0.28.0

func (p PlansListPage) MarshalJSON() ([]byte, error)

MarshalJSON encodes the PlanListResponse of the page, as received.

func (*PlansListPage) NextPage ¶ added in v0.28.0

func (p *PlansListPage) NextPage(ctx context.Context) (*PlansListPage, error)

NextPage fetches the page after this one. It returns nil and no error after the last page.

type PlansRetrieveOptions ¶

type PlansRetrieveOptions struct {
	// Filter by version: "draft", a version number, or omitted for active
	Version *string
}

PlansRetrieveOptions carries the optional query and header parameters of Plans.Retrieve. Leave a field nil to omit it.

type PlansVersions ¶ added in v0.29.0

type PlansVersions struct {
	// contains filtered or unexported fields
}

PlansVersions groups the plans versions operations of the Meteroid API.

func (*PlansVersions) DeleteMinimum ¶ added in v0.29.0

func (a *PlansVersions) DeleteMinimum(ctx context.Context, planVersionID string, opts ...RequestOption) error

DeleteMinimum sends DELETE /api/v1/plans/versions/{plan_version_id}/minimum.

Remove the plan-level minimum commitment for a draft plan version.

func (*PlansVersions) List ¶ added in v0.29.0

List plan versions

PlansVersions.ListAutoPaging iterates over every item instead.

func (*PlansVersions) ListAutoPaging ¶ added in v0.29.0

func (a *PlansVersions) ListAutoPaging(ctx context.Context, planID string, options *PlansVersionsListOptions, opts ...RequestOption) *AutoPager[PlanVersionSummary]

ListAutoPaging iterates over every item of PlansVersions.List, fetching further pages on demand.

func (*PlansVersions) UpdateMinimum ¶ added in v0.29.0

func (a *PlansVersions) UpdateMinimum(ctx context.Context, planVersionID string, minimumCommitment MinimumCommitment, opts ...RequestOption) (*MinimumCommitment, error)

UpdateMinimum sends PUT /api/v1/plans/versions/{plan_version_id}/minimum.

Set or replace the plan-level minimum commitment for a draft plan version.

type PlansVersionsListOptions ¶ added in v0.29.0

type PlansVersionsListOptions struct {
	// Page number (0-indexed)
	Page *int32

	// Number of items per page
	PerPage *int32
}

PlansVersionsListOptions carries the optional query and header parameters of PlansVersions.List. Leave a field nil to omit it.

type PlansVersionsListPage ¶ added in v0.29.0

type PlansVersionsListPage struct {
	PlanVersionListResponse

	// Items holds the items of this page.
	Items []PlanVersionSummary
	// contains filtered or unexported fields
}

PlansVersionsListPage is a page of PlansVersions.List. It embeds the decoded PlanVersionListResponse, promoting its fields, with the Items of the page; a field named like a page member stays reachable through the embedded PlanVersionListResponse.

func (*PlansVersionsListPage) HasNextPage ¶ added in v0.29.0

func (p *PlansVersionsListPage) HasNextPage() bool

HasNextPage reports whether another page follows this one.

func (PlansVersionsListPage) MarshalJSON ¶ added in v0.29.0

func (p PlansVersionsListPage) MarshalJSON() ([]byte, error)

MarshalJSON encodes the PlanVersionListResponse of the page, as received.

func (*PlansVersionsListPage) NextPage ¶ added in v0.29.0

NextPage fetches the page after this one. It returns nil and no error after the last page.

type PriceComponent ¶

type PriceComponent struct {
	Fee *Fee `json:"fee,omitempty"`

	ID PriceComponentID `json:"id"`

	Name string `json:"name"`

	ProductID *ProductID `json:"product_id,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

PriceComponent is the PriceComponent object of the Meteroid API.

func (PriceComponent) MarshalJSON ¶

func (v PriceComponent) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*PriceComponent) UnmarshalJSON ¶

func (v *PriceComponent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type PriceComponentID ¶

type PriceComponentID = string

PriceComponentID is the PriceComponentId string of the Meteroid API.

type PriceComponentInput ¶

type PriceComponentInput struct {
	Fee Fee `json:"fee"`

	Name string `json:"name"`

	ProductID *ProductID `json:"product_id,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

PriceComponentInput is the PriceComponentInput object of the Meteroid API.

func (PriceComponentInput) MarshalJSON ¶

func (v PriceComponentInput) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*PriceComponentInput) UnmarshalJSON ¶

func (v *PriceComponentInput) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type PriceEntry ¶

type PriceEntry struct {
	// Type selects the active variant. Compare it against the
	// PriceEntry* constants.
	Type PriceEntryType `json:"type"`

	// Existing is set when Type is PriceEntryExisting.
	Existing *ExistingPriceRef `json:"-"`
	// New is set when Type is PriceEntryNew.
	New *PriceInput `json:"-"`
	// contains filtered or unexported fields
}

PriceEntry is a tagged union discriminated by the type field.

When PriceEntry.IsKnown reports true, exactly one variant pointer is set, matching Type. A variant added to the API after this SDK version was released still decodes without error, but with every variant pointer nil: always give a `switch` on Type a `default:` branch (or check IsKnown first) instead of dereferencing a pointer unconditionally. The unknown variant's JSON is available from PriceEntry.Raw.

func NewPriceEntryExisting ¶

func NewPriceEntryExisting(value ExistingPriceRef) PriceEntry

NewPriceEntryExisting builds a PriceEntry holding the EXISTING variant.

func NewPriceEntryNew ¶

func NewPriceEntryNew(value PriceInput) PriceEntry

NewPriceEntryNew builds a PriceEntry holding the NEW variant.

func (PriceEntry) IsKnown ¶

func (u PriceEntry) IsKnown() bool

IsKnown reports whether Type is one of the variants this SDK version knows about, i.e. one of the PriceEntry* constants. It is false for a variant added to the API later, whose payload is then only available from PriceEntry.Raw.

func (PriceEntry) MarshalJSON ¶

func (u PriceEntry) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (PriceEntry) Raw ¶

func (u PriceEntry) Raw() json.RawMessage

Raw returns the JSON of a variant this SDK version does not know about, as decoded (see PriceEntry.IsKnown). It is nil for a known variant, and for a value that was not decoded from JSON. The returned slice is a copy.

func (*PriceEntry) UnmarshalJSON ¶

func (u *PriceEntry) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Payloads carrying an unrecognized discriminator are kept rather than rejected, so a newer API version does not break older SDK builds. Re-encoding such a value reproduces the same JSON document, though not necessarily the same bytes: `encoding/json` compacts whitespace and escapes `<`, `>` and `&`.

type PriceEntryType ¶

type PriceEntryType string

PriceEntryType is the type of a PriceEntry, one of the PriceEntry* constants for a variant this SDK version knows.

const (
	PriceEntryExisting PriceEntryType = "EXISTING"
	PriceEntryNew      PriceEntryType = "NEW"
)

Discriminator values for PriceEntry.

type PriceID ¶

type PriceID = string

PriceID is the PriceId string of the Meteroid API.

type PriceInput ¶

type PriceInput struct {
	Cadence BillingPeriodEnum `json:"cadence"`

	Currency string `json:"currency"`

	Pricing Pricing `json:"pricing"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

PriceInput is the PriceInput object of the Meteroid API.

func (PriceInput) MarshalJSON ¶

func (v PriceInput) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*PriceInput) UnmarshalJSON ¶

func (v *PriceInput) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type Pricing ¶

type Pricing struct {
	// Type selects the active variant. Compare it against the
	// Pricing* constants.
	Type PricingType `json:"type"`

	// Rate is set when Type is PricingRate.
	Rate *RatePricing `json:"-"`
	// Slot is set when Type is PricingSlot.
	Slot *SlotPricing `json:"-"`
	// Capacity is set when Type is PricingCapacity.
	Capacity *CapacityPricing `json:"-"`
	// Usage is set when Type is PricingUsage.
	Usage *UsagePricing `json:"-"`
	// ExtraRecurring is set when Type is PricingExtraRecurring.
	ExtraRecurring *ExtraRecurringPricing `json:"-"`
	// OneTime is set when Type is PricingOneTime.
	OneTime *OneTimePricing `json:"-"`
	// contains filtered or unexported fields
}

Pricing is a tagged union discriminated by the type field.

When Pricing.IsKnown reports true, exactly one variant pointer is set, matching Type. A variant added to the API after this SDK version was released still decodes without error, but with every variant pointer nil: always give a `switch` on Type a `default:` branch (or check IsKnown first) instead of dereferencing a pointer unconditionally. The unknown variant's JSON is available from Pricing.Raw.

func NewPricingCapacity ¶

func NewPricingCapacity(value CapacityPricing) Pricing

NewPricingCapacity builds a Pricing holding the CAPACITY variant.

func NewPricingExtraRecurring ¶

func NewPricingExtraRecurring(value ExtraRecurringPricing) Pricing

NewPricingExtraRecurring builds a Pricing holding the EXTRA_RECURRING variant.

func NewPricingOneTime ¶

func NewPricingOneTime(value OneTimePricing) Pricing

NewPricingOneTime builds a Pricing holding the ONE_TIME variant.

func NewPricingRate ¶

func NewPricingRate(value RatePricing) Pricing

NewPricingRate builds a Pricing holding the RATE variant.

func NewPricingSlot ¶

func NewPricingSlot(value SlotPricing) Pricing

NewPricingSlot builds a Pricing holding the SLOT variant.

func NewPricingUsage ¶

func NewPricingUsage(value UsagePricing) Pricing

NewPricingUsage builds a Pricing holding the USAGE variant.

func (Pricing) IsKnown ¶

func (u Pricing) IsKnown() bool

IsKnown reports whether Type is one of the variants this SDK version knows about, i.e. one of the Pricing* constants. It is false for a variant added to the API later, whose payload is then only available from Pricing.Raw.

func (Pricing) MarshalJSON ¶

func (u Pricing) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (Pricing) Raw ¶

func (u Pricing) Raw() json.RawMessage

Raw returns the JSON of a variant this SDK version does not know about, as decoded (see Pricing.IsKnown). It is nil for a known variant, and for a value that was not decoded from JSON. The returned slice is a copy.

func (*Pricing) UnmarshalJSON ¶

func (u *Pricing) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Payloads carrying an unrecognized discriminator are kept rather than rejected, so a newer API version does not break older SDK builds. Re-encoding such a value reproduces the same JSON document, though not necessarily the same bytes: `encoding/json` compacts whitespace and escapes `<`, `>` and `&`.

type PricingType ¶

type PricingType string

PricingType is the type of a Pricing, one of the Pricing* constants for a variant this SDK version knows.

const (
	PricingRate           PricingType = "RATE"
	PricingSlot           PricingType = "SLOT"
	PricingCapacity       PricingType = "CAPACITY"
	PricingUsage          PricingType = "USAGE"
	PricingExtraRecurring PricingType = "EXTRA_RECURRING"
	PricingOneTime        PricingType = "ONE_TIME"
)

Discriminator values for Pricing.

type Product ¶

type Product struct {
	// RFC 3339 timestamp.
	ArchivedAt *time.Time `json:"archived_at,omitempty"`

	Catalog bool `json:"catalog"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Description *string `json:"description,omitempty"`

	FeeStructure ProductFeeStructure `json:"fee_structure"`

	FeeType ProductFeeTypeEnum `json:"fee_type"`

	ID ProductID `json:"id"`

	Name string `json:"name"`

	ProductFamilyID ProductFamilyID `json:"product_family_id"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

Product is the Product object of the Meteroid API.

func (Product) MarshalJSON ¶

func (v Product) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*Product) UnmarshalJSON ¶

func (v *Product) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ProductEvent ¶

type ProductEvent struct {
	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Description *string `json:"description,omitempty"`

	FeeType ProductFeeTypeEnum `json:"fee_type"`

	Name string `json:"name"`

	ProductFamilyID ProductFamilyID `json:"product_family_id"`

	ProductID ProductID `json:"product_id"`

	ID EventID `json:"id"`

	// RFC 3339 timestamp.
	Timestamp time.Time `json:"timestamp"`

	Type EventType `json:"type"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ProductEvent is the ProductEvent object of the Meteroid API.

func (ProductEvent) MarshalJSON ¶

func (v ProductEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ProductEvent) UnmarshalJSON ¶

func (v *ProductEvent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ProductEventData ¶

type ProductEventData struct {
	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Description *string `json:"description,omitempty"`

	FeeType ProductFeeTypeEnum `json:"fee_type"`

	Name string `json:"name"`

	ProductFamilyID ProductFamilyID `json:"product_family_id"`

	ProductID ProductID `json:"product_id"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ProductEventData is the ProductEventData object of the Meteroid API.

func (ProductEventData) MarshalJSON ¶

func (v ProductEventData) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ProductEventData) UnmarshalJSON ¶

func (v *ProductEventData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ProductFamilies ¶

type ProductFamilies struct {
	// contains filtered or unexported fields
}

ProductFamilies groups the product families operations of the Meteroid API.

func (*ProductFamilies) Create ¶

func (a *ProductFamilies) Create(ctx context.Context, productFamilyCreateRequest ProductFamilyCreateRequest, opts ...RequestOption) (*ProductFamily, error)

Create product family

func (*ProductFamilies) List ¶

List product families

ProductFamilies.ListAutoPaging iterates over every item instead.

func (*ProductFamilies) ListAutoPaging ¶ added in v0.28.0

ListAutoPaging iterates over every item of ProductFamilies.List, fetching further pages on demand.

func (*ProductFamilies) Retrieve ¶

func (a *ProductFamilies) Retrieve(ctx context.Context, idOrAlias string, opts ...RequestOption) (*ProductFamily, error)

Retrieve sends GET /api/v1/product_families/{id_or_alias}.

Get product family ¶

Retrieve a single product family by ID or alias.

type ProductFamiliesListOptions ¶

type ProductFamiliesListOptions struct {
	// Sort order. Format: `column.direction`. Allowed columns: `name`, `created_at`. Direction: `asc` or `desc`. Default: `created_at.desc`.
	OrderBy *string

	// Page number (0-indexed)
	Page *int32

	// Number of items per page
	PerPage *int32

	Search *string
}

ProductFamiliesListOptions carries the optional query and header parameters of ProductFamilies.List. Leave a field nil to omit it.

type ProductFamiliesListPage ¶ added in v0.28.0

type ProductFamiliesListPage struct {
	ProductFamilyListResponse

	// Items holds the items of this page.
	Items []ProductFamily
	// contains filtered or unexported fields
}

ProductFamiliesListPage is a page of ProductFamilies.List. It embeds the decoded ProductFamilyListResponse, promoting its fields, with the Items of the page; a field named like a page member stays reachable through the embedded ProductFamilyListResponse.

func (*ProductFamiliesListPage) HasNextPage ¶ added in v0.28.0

func (p *ProductFamiliesListPage) HasNextPage() bool

HasNextPage reports whether another page follows this one.

func (ProductFamiliesListPage) MarshalJSON ¶ added in v0.28.0

func (p ProductFamiliesListPage) MarshalJSON() ([]byte, error)

MarshalJSON encodes the ProductFamilyListResponse of the page, as received.

func (*ProductFamiliesListPage) NextPage ¶ added in v0.28.0

NextPage fetches the page after this one. It returns nil and no error after the last page.

type ProductFamily ¶

type ProductFamily struct {
	ID ProductFamilyID `json:"id"`

	Name string `json:"name"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ProductFamily is the ProductFamily object of the Meteroid API.

func (ProductFamily) MarshalJSON ¶

func (v ProductFamily) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ProductFamily) UnmarshalJSON ¶

func (v *ProductFamily) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ProductFamilyCreateRequest ¶

type ProductFamilyCreateRequest struct {
	Name string `json:"name"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ProductFamilyCreateRequest is the ProductFamilyCreateRequest object of the Meteroid API.

func (ProductFamilyCreateRequest) MarshalJSON ¶

func (v ProductFamilyCreateRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ProductFamilyCreateRequest) UnmarshalJSON ¶

func (v *ProductFamilyCreateRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ProductFamilyID ¶

type ProductFamilyID = string

ProductFamilyID is the ProductFamilyId string of the Meteroid API.

type ProductFamilyListResponse ¶

type ProductFamilyListResponse struct {
	Data RequiredSlice[ProductFamily] `json:"data"`

	PaginationMeta PaginationResponse `json:"pagination_meta"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ProductFamilyListResponse is the ProductFamilyListResponse object of the Meteroid API.

func (ProductFamilyListResponse) MarshalJSON ¶

func (v ProductFamilyListResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ProductFamilyListResponse) UnmarshalJSON ¶

func (v *ProductFamilyListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ProductFeeStructure ¶

type ProductFeeStructure struct {
	// Type selects the active variant. Compare it against the
	// ProductFeeStructure* constants.
	Type ProductFeeStructureType `json:"type"`

	// Rate is set when Type is ProductFeeStructureRate.
	Rate *RateFeeStructure `json:"-"`
	// Slot is set when Type is ProductFeeStructureSlot.
	Slot *SlotFeeStructure `json:"-"`
	// Capacity is set when Type is ProductFeeStructureCapacity.
	Capacity *CapacityFeeStructure `json:"-"`
	// Usage is set when Type is ProductFeeStructureUsage.
	Usage *UsageFeeStructure `json:"-"`
	// ExtraRecurring is set when Type is ProductFeeStructureExtraRecurring.
	ExtraRecurring *ExtraRecurringFeeStructure `json:"-"`
	// OneTime is set when Type is ProductFeeStructureOneTime.
	OneTime *OneTimeFeeStructure `json:"-"`
	// contains filtered or unexported fields
}

ProductFeeStructure is a tagged union discriminated by the type field.

When ProductFeeStructure.IsKnown reports true, exactly one variant pointer is set, matching Type. A variant added to the API after this SDK version was released still decodes without error, but with every variant pointer nil: always give a `switch` on Type a `default:` branch (or check IsKnown first) instead of dereferencing a pointer unconditionally. The unknown variant's JSON is available from ProductFeeStructure.Raw.

func NewProductFeeStructureCapacity ¶

func NewProductFeeStructureCapacity(value CapacityFeeStructure) ProductFeeStructure

NewProductFeeStructureCapacity builds a ProductFeeStructure holding the CAPACITY variant.

func NewProductFeeStructureExtraRecurring ¶

func NewProductFeeStructureExtraRecurring(value ExtraRecurringFeeStructure) ProductFeeStructure

NewProductFeeStructureExtraRecurring builds a ProductFeeStructure holding the EXTRA_RECURRING variant.

func NewProductFeeStructureOneTime ¶

func NewProductFeeStructureOneTime(value OneTimeFeeStructure) ProductFeeStructure

NewProductFeeStructureOneTime builds a ProductFeeStructure holding the ONE_TIME variant.

func NewProductFeeStructureRate ¶

func NewProductFeeStructureRate(value RateFeeStructure) ProductFeeStructure

NewProductFeeStructureRate builds a ProductFeeStructure holding the RATE variant.

func NewProductFeeStructureSlot ¶

func NewProductFeeStructureSlot(value SlotFeeStructure) ProductFeeStructure

NewProductFeeStructureSlot builds a ProductFeeStructure holding the SLOT variant.

func NewProductFeeStructureUsage ¶

func NewProductFeeStructureUsage(value UsageFeeStructure) ProductFeeStructure

NewProductFeeStructureUsage builds a ProductFeeStructure holding the USAGE variant.

func (ProductFeeStructure) IsKnown ¶

func (u ProductFeeStructure) IsKnown() bool

IsKnown reports whether Type is one of the variants this SDK version knows about, i.e. one of the ProductFeeStructure* constants. It is false for a variant added to the API later, whose payload is then only available from ProductFeeStructure.Raw.

func (ProductFeeStructure) MarshalJSON ¶

func (u ProductFeeStructure) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (ProductFeeStructure) Raw ¶

Raw returns the JSON of a variant this SDK version does not know about, as decoded (see ProductFeeStructure.IsKnown). It is nil for a known variant, and for a value that was not decoded from JSON. The returned slice is a copy.

func (*ProductFeeStructure) UnmarshalJSON ¶

func (u *ProductFeeStructure) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Payloads carrying an unrecognized discriminator are kept rather than rejected, so a newer API version does not break older SDK builds. Re-encoding such a value reproduces the same JSON document, though not necessarily the same bytes: `encoding/json` compacts whitespace and escapes `<`, `>` and `&`.

type ProductFeeStructureType ¶

type ProductFeeStructureType string

ProductFeeStructureType is the type of a ProductFeeStructure, one of the ProductFeeStructure* constants for a variant this SDK version knows.

const (
	ProductFeeStructureRate           ProductFeeStructureType = "RATE"
	ProductFeeStructureSlot           ProductFeeStructureType = "SLOT"
	ProductFeeStructureCapacity       ProductFeeStructureType = "CAPACITY"
	ProductFeeStructureUsage          ProductFeeStructureType = "USAGE"
	ProductFeeStructureExtraRecurring ProductFeeStructureType = "EXTRA_RECURRING"
	ProductFeeStructureOneTime        ProductFeeStructureType = "ONE_TIME"
)

Discriminator values for ProductFeeStructure.

type ProductFeeTypeEnum ¶

type ProductFeeTypeEnum string

ProductFeeTypeEnum is one of AllProductFeeTypeEnumValues, or a value this SDK version does not know.

const (
	ProductFeeTypeEnumRate           ProductFeeTypeEnum = "RATE"
	ProductFeeTypeEnumSlot           ProductFeeTypeEnum = "SLOT"
	ProductFeeTypeEnumCapacity       ProductFeeTypeEnum = "CAPACITY"
	ProductFeeTypeEnumUsage          ProductFeeTypeEnum = "USAGE"
	ProductFeeTypeEnumExtraRecurring ProductFeeTypeEnum = "EXTRA_RECURRING"
	ProductFeeTypeEnumOneTime        ProductFeeTypeEnum = "ONE_TIME"
)

Known values of ProductFeeTypeEnum.

The API may add new values over time; unknown values round-trip unchanged.

func (ProductFeeTypeEnum) IsKnown ¶

func (e ProductFeeTypeEnum) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (ProductFeeTypeEnum) String ¶

func (e ProductFeeTypeEnum) String() string

String returns the wire representation of the value.

type ProductID ¶

type ProductID = string

ProductID is the ProductId string of the Meteroid API.

type ProductListResponse ¶

type ProductListResponse struct {
	Data RequiredSlice[Product] `json:"data"`

	PaginationMeta PaginationResponse `json:"pagination_meta"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ProductListResponse is the ProductListResponse object of the Meteroid API.

func (ProductListResponse) MarshalJSON ¶

func (v ProductListResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ProductListResponse) UnmarshalJSON ¶

func (v *ProductListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ProductRef ¶

type ProductRef struct {
	// Type selects the active variant. Compare it against the
	// ProductRef* constants.
	Type ProductRefType `json:"type"`

	// Existing is set when Type is ProductRefExisting.
	Existing *ExistingProductRef `json:"-"`
	// New is set when Type is ProductRefNew.
	New *NewProductRef `json:"-"`
	// contains filtered or unexported fields
}

ProductRef is a tagged union discriminated by the type field.

When ProductRef.IsKnown reports true, exactly one variant pointer is set, matching Type. A variant added to the API after this SDK version was released still decodes without error, but with every variant pointer nil: always give a `switch` on Type a `default:` branch (or check IsKnown first) instead of dereferencing a pointer unconditionally. The unknown variant's JSON is available from ProductRef.Raw.

func NewProductRefExisting ¶

func NewProductRefExisting(value ExistingProductRef) ProductRef

NewProductRefExisting builds a ProductRef holding the EXISTING variant.

func NewProductRefNew ¶

func NewProductRefNew(value NewProductRef) ProductRef

NewProductRefNew builds a ProductRef holding the NEW variant.

func (ProductRef) IsKnown ¶

func (u ProductRef) IsKnown() bool

IsKnown reports whether Type is one of the variants this SDK version knows about, i.e. one of the ProductRef* constants. It is false for a variant added to the API later, whose payload is then only available from ProductRef.Raw.

func (ProductRef) MarshalJSON ¶

func (u ProductRef) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (ProductRef) Raw ¶

func (u ProductRef) Raw() json.RawMessage

Raw returns the JSON of a variant this SDK version does not know about, as decoded (see ProductRef.IsKnown). It is nil for a known variant, and for a value that was not decoded from JSON. The returned slice is a copy.

func (*ProductRef) UnmarshalJSON ¶

func (u *ProductRef) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Payloads carrying an unrecognized discriminator are kept rather than rejected, so a newer API version does not break older SDK builds. Re-encoding such a value reproduces the same JSON document, though not necessarily the same bytes: `encoding/json` compacts whitespace and escapes `<`, `>` and `&`.

type ProductRefType ¶

type ProductRefType string

ProductRefType is the type of a ProductRef, one of the ProductRef* constants for a variant this SDK version knows.

const (
	ProductRefExisting ProductRefType = "EXISTING"
	ProductRefNew      ProductRefType = "NEW"
)

Discriminator values for ProductRef.

type Products ¶

type Products struct {
	// contains filtered or unexported fields
}

Products groups the products operations of the Meteroid API.

func (*Products) Archive ¶

func (a *Products) Archive(ctx context.Context, productID string, opts ...RequestOption) error

Archive a product

func (*Products) Create ¶

func (a *Products) Create(ctx context.Context, createProductRequest CreateProductRequest, opts ...RequestOption) (*Product, error)

Create a product

func (*Products) Entitlements ¶ added in v0.29.0

func (a *Products) Entitlements() *ProductsEntitlements

Entitlements returns the entitlements API.

func (*Products) List ¶

func (a *Products) List(ctx context.Context, options *ProductsListOptions, opts ...RequestOption) (*ProductsListPage, error)

List products

Products.ListAutoPaging iterates over every item instead.

func (*Products) ListAutoPaging ¶ added in v0.28.0

func (a *Products) ListAutoPaging(ctx context.Context, options *ProductsListOptions, opts ...RequestOption) *AutoPager[Product]

ListAutoPaging iterates over every item of Products.List, fetching further pages on demand.

func (*Products) Retrieve ¶

func (a *Products) Retrieve(ctx context.Context, productID string, opts ...RequestOption) (*Product, error)

Retrieve sends GET /api/v1/products/{product_id}.

Get product details

func (*Products) Unarchive ¶

func (a *Products) Unarchive(ctx context.Context, productID string, opts ...RequestOption) error

Unarchive a product

func (*Products) Update ¶

func (a *Products) Update(ctx context.Context, productID string, updateProductRequest UpdateProductRequest, opts ...RequestOption) (*Product, error)

Update a product

Partially update product fields. The fee_type is immutable and cannot be changed.

type ProductsEntitlements ¶ added in v0.29.0

type ProductsEntitlements struct {
	// contains filtered or unexported fields
}

ProductsEntitlements groups the products entitlements operations of the Meteroid API.

func (*ProductsEntitlements) Create ¶ added in v0.29.0

func (a *ProductsEntitlements) Create(ctx context.Context, productID string, createEntitlementsRequest CreateEntitlementsRequest, opts ...RequestOption) (*EntitlementListResponse, error)

Create product entitlements

A product has no entitlement rows of its own: its entitlements are the feature-level defaults of the features scoped to it, which is what `GET` on this path resolves. Every spec must therefore target a feature belonging to `product_id`. Features that already carry a default entitlement are skipped.

Specs are validated up front, but the writes are not atomic: each feature is written on its own, so a failure part-way can leave earlier specs committed. Retrying is safe.

func (*ProductsEntitlements) List ¶ added in v0.29.0

List product entitlements

type ProductsListOptions ¶

type ProductsListOptions struct {
	ProductFamilyID *ProductFamilyID

	Search *string

	// Sort order. Format: `column.direction`. Allowed columns: `name`, `created_at`. Direction: `asc` or `desc`. Default: `name.asc`.
	OrderBy *string

	// Page number (0-indexed)
	Page *int32

	// Number of items per page
	PerPage *int32
}

ProductsListOptions carries the optional query and header parameters of Products.List. Leave a field nil to omit it.

type ProductsListPage ¶ added in v0.28.0

type ProductsListPage struct {
	ProductListResponse

	// Items holds the items of this page.
	Items []Product
	// contains filtered or unexported fields
}

ProductsListPage is a page of Products.List. It embeds the decoded ProductListResponse, promoting its fields, with the Items of the page; a field named like a page member stays reachable through the embedded ProductListResponse.

func (*ProductsListPage) HasNextPage ¶ added in v0.28.0

func (p *ProductsListPage) HasNextPage() bool

HasNextPage reports whether another page follows this one.

func (ProductsListPage) MarshalJSON ¶ added in v0.28.0

func (p ProductsListPage) MarshalJSON() ([]byte, error)

MarshalJSON encodes the ProductListResponse of the page, as received.

func (*ProductsListPage) NextPage ¶ added in v0.28.0

func (p *ProductsListPage) NextPage(ctx context.Context) (*ProductsListPage, error)

NextPage fetches the page after this one. It returns nil and no error after the last page.

type ProductsScope ¶

type ProductsScope struct {
	ProductIDs RequiredSlice[string] `json:"product_ids"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ProductsScope is the ProductsScope object of the Meteroid API.

Only lines for the listed products count. A product is the identity shared by plan components, overrides and ad-hoc extras, so a subscription's billed set is matched uniformly.

func (ProductsScope) MarshalJSON ¶

func (v ProductsScope) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ProductsScope) UnmarshalJSON ¶

func (v *ProductsScope) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type PropertyConfig ¶

type PropertyConfig struct {
	Max *float64 `json:"max,omitempty"`

	// Maximum length for `TEXT`.
	MaxLength *int32 `json:"max_length,omitempty"`

	// Inclusive numeric bounds for `NUMBER`.
	Min *float64 `json:"min,omitempty"`

	// Allowed choices for `SINGLE_SELECT` / `MULTI_SELECT`.
	Options []SelectOption `json:"options,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

PropertyConfig is the PropertyConfig object of the Meteroid API.

Type-specific configuration. Only the fields relevant to `property_type` are interpreted.

func (PropertyConfig) MarshalJSON ¶

func (v PropertyConfig) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*PropertyConfig) UnmarshalJSON ¶

func (v *PropertyConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type QuoteEvent ¶

type QuoteEvent struct {
	CustomerID CustomerID `json:"customer_id"`

	QuoteID QuoteID `json:"quote_id"`

	SubscriptionID *SubscriptionID `json:"subscription_id,omitempty"`

	ID EventID `json:"id"`

	// RFC 3339 timestamp.
	Timestamp time.Time `json:"timestamp"`

	Type EventType `json:"type"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

QuoteEvent is the QuoteEvent object of the Meteroid API.

func (QuoteEvent) MarshalJSON ¶

func (v QuoteEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*QuoteEvent) UnmarshalJSON ¶

func (v *QuoteEvent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type QuoteEventData ¶

type QuoteEventData struct {
	CustomerID CustomerID `json:"customer_id"`

	QuoteID QuoteID `json:"quote_id"`

	SubscriptionID *SubscriptionID `json:"subscription_id,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

QuoteEventData is the QuoteEventData object of the Meteroid API.

func (QuoteEventData) MarshalJSON ¶

func (v QuoteEventData) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*QuoteEventData) UnmarshalJSON ¶

func (v *QuoteEventData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type QuoteID ¶

type QuoteID = string

QuoteID is the QuoteId string of the Meteroid API.

type RateFee ¶

type RateFee struct {
	Rate string `json:"rate"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

RateFee is the RateFee object of the Meteroid API.

func (RateFee) MarshalJSON ¶

func (v RateFee) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*RateFee) UnmarshalJSON ¶

func (v *RateFee) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type RateFeeStructure ¶

type RateFeeStructure struct {
	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

RateFeeStructure is the RateFeeStructure object of the Meteroid API.

func (RateFeeStructure) MarshalJSON ¶

func (v RateFeeStructure) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*RateFeeStructure) UnmarshalJSON ¶

func (v *RateFeeStructure) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type RatePlanFee ¶

type RatePlanFee struct {
	Rates RequiredSlice[TermRate] `json:"rates"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

RatePlanFee is the RatePlanFee object of the Meteroid API.

Recurring rate fee (e.g., monthly subscription)

func (RatePlanFee) MarshalJSON ¶

func (v RatePlanFee) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*RatePlanFee) UnmarshalJSON ¶

func (v *RatePlanFee) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type RatePricing ¶

type RatePricing struct {
	Rate string `json:"rate"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

RatePricing is the RatePricing object of the Meteroid API.

func (RatePricing) MarshalJSON ¶

func (v RatePricing) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*RatePricing) UnmarshalJSON ¶

func (v *RatePricing) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type RecurringFee ¶

type RecurringFee struct {
	BillingType BillingTypeEnum `json:"billing_type"`

	Quantity int32 `json:"quantity"`

	Rate string `json:"rate"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

RecurringFee is the RecurringFee object of the Meteroid API.

func (RecurringFee) MarshalJSON ¶

func (v RecurringFee) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*RecurringFee) UnmarshalJSON ¶

func (v *RecurringFee) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type RefundEventData ¶

type RefundEventData struct {
	Amount int64 `json:"amount"`

	AmountRefunded int64 `json:"amount_refunded"`

	AmountReversed int64 `json:"amount_reversed"`

	CreditNoteID *CreditNoteID `json:"credit_note_id,omitempty"`

	Currency string `json:"currency"`

	DeclineKind *DeclineKind `json:"decline_kind,omitempty"`

	Error *string `json:"error,omitempty"`

	InvoiceID *InvoiceID `json:"invoice_id,omitempty"`

	ParentTransactionID *PaymentTransactionID `json:"parent_transaction_id,omitempty"`

	PaymentType PaymentTypeEnum `json:"payment_type"`

	// RFC 3339 timestamp.
	ProcessedAt *time.Time `json:"processed_at,omitempty"`

	ProviderTransactionID *string `json:"provider_transaction_id,omitempty"`

	RefundMode *RefundMode `json:"refund_mode,omitempty"`

	ReversalKind *ReversalKind `json:"reversal_kind,omitempty"`

	Status PaymentStatusEnum `json:"status"`

	TransactionID PaymentTransactionID `json:"transaction_id"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

RefundEventData is the RefundEventData object of the Meteroid API.

A refund row, or the payment that failed or was clawed back — the same shape the REST invoice exposes as a transaction. `reversal_reason` is deliberately absent: it is free provider text and is not carried on the outbox event.

func (RefundEventData) MarshalJSON ¶

func (v RefundEventData) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*RefundEventData) UnmarshalJSON ¶

func (v *RefundEventData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type RefundMode ¶

type RefundMode string

RefundMode is one of AllRefundModeValues, or a value this SDK version does not know.

How a voluntary refund was issued: through the provider, or recorded after a wire or cash movement made outside Meteroid.

const (
	RefundModeOnline  RefundMode = "ONLINE"
	RefundModeOffline RefundMode = "OFFLINE"
)

Known values of RefundMode.

The API may add new values over time; unknown values round-trip unchanged.

func (RefundMode) IsKnown ¶

func (e RefundMode) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (RefundMode) String ¶

func (e RefundMode) String() string

String returns the wire representation of the value.

type ReplacePlanRequest ¶

type ReplacePlanRequest struct {
	AddOns []PlanAddOnInput `json:"add_ons,omitempty"`

	Billing *BillingConfig `json:"billing,omitempty"`

	Components RequiredSlice[PriceComponentInput] `json:"components"`

	Currency string `json:"currency"`

	Description *string `json:"description,omitempty"`

	// Entitlements to attach to this plan's version. Replacing a published plan creates a
	// new version, and entitlements belong to a version, so passing them here keeps them
	// attached to whichever version the call produces.
	Entitlements []EntitlementSpecRequest `json:"entitlements,omitempty"`

	MinimumCommitment *MinimumCommitmentInput `json:"minimum_commitment,omitempty"`

	Name string `json:"name"`

	Status *PlanStatusEnum `json:"status,omitempty"`

	// The plan's amounts are quoted tax-included ("9.99 incl. VAT"): tax is carved out of
	// them at invoice time instead of being added on top, so the customer pays the quoted
	// price whatever rate applies. A customer who bears no tax (reverse charge, exempt,
	// export) still pays it in full. Defaults to `false`.
	TaxInclusive *bool `json:"tax_inclusive,omitempty"`

	Trial *TrialConfig `json:"trial,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ReplacePlanRequest is the ReplacePlanRequest object of the Meteroid API.

func (ReplacePlanRequest) MarshalJSON ¶

func (v ReplacePlanRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ReplacePlanRequest) UnmarshalJSON ¶

func (v *ReplacePlanRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type RequestError ¶

type RequestError struct {
	Err error
}

RequestError is returned when a request could not be built: a body or parameter that does not encode, an invalid URL or a failing token provider.

func (*RequestError) Error ¶

func (e *RequestError) Error() string

func (*RequestError) Unwrap ¶

func (e *RequestError) Unwrap() error

type RequestOption ¶

type RequestOption func(*callConfig)

RequestOption adjusts a single call, on top of the client's Options. Every method takes them last:

opts := []meteroid.RequestOption{meteroid.WithTimeout(time.Minute), meteroid.WithMaxRetries(0)}

func WithHeader ¶

func WithHeader(name, value string) RequestOption

WithHeader sets a header on the request, replacing any value the SDK would send.

func WithIdempotencyKey ¶

func WithIdempotencyKey(key string) RequestOption

WithIdempotencyKey sets the key that lets the server deduplicate retried requests, and makes a POST safe to retry.

func WithMaxRetries ¶

func WithMaxRetries(retries int) RequestOption

WithMaxRetries sets how many times the request is retried; zero disables retries.

func WithResponseInto ¶

func WithResponseInto(dst **http.Response) RequestOption

WithResponseInto stores the HTTP response of the call in *dst, for its status and headers, such as the request id. Its body has already been read into the result, and can be read again; for an event stream, it is the stream itself. It is also set when the call fails with an *APIError.

var resp *http.Response
opt := meteroid.WithResponseInto(&resp)
// after the call:
log.Print(resp.StatusCode, resp.Header.Get("X-Request-Id"))

func WithTimeout ¶

func WithTimeout(timeout time.Duration) RequestOption

WithTimeout bounds each attempt of the request; zero or less disables the timeout.

type RequiredMap ¶

type RequiredMap[V any] map[string]V

RequiredMap is the type of object fields the API schema declares required and non-nullable. It is the map counterpart of RequiredSlice: a nil RequiredMap marshals as `{}` rather than as null.

RequiredMap[V] is a defined type over map[string]V, so map literals assign to it and indexing, range and len work unchanged. Reading from a nil RequiredMap is fine; writing to one panics, exactly as it does for a nil map.

func (RequiredMap[V]) MarshalJSON ¶

func (m RequiredMap[V]) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. A nil RequiredMap is written as an empty object rather than as null.

type RequiredSlice ¶

type RequiredSlice[T any] []T

RequiredSlice is the type of array fields the API schema declares required and non-nullable.

It exists because the zero value of a Go slice is nil and `encoding/json` writes nil slices as `null`, which those fields do not accept. A nil RequiredSlice marshals as `[]` instead, so leaving a required list unset still produces a schema-valid request.

RequiredSlice[T] is a defined type over []T, so it behaves like the slice it wraps: plain slice literals assign to it, and len, index, range, append and comparison against nil all work unchanged:

var tags meteroid.RequiredSlice[string] // encodes as []
tags = []string{"a", "b"}

Optional array fields keep the plain []T type: for those, nil means "absent" and `omitempty` drops them from the payload entirely.

func (RequiredSlice[T]) MarshalJSON ¶

func (s RequiredSlice[T]) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. A nil RequiredSlice is written as an empty array rather than as null.

type ResetPeriod ¶

type ResetPeriod struct {
	// Type selects the active variant. Compare it against the
	// ResetPeriod* constants.
	Type ResetPeriodType `json:"type"`

	// BillingCycle is set when Type is ResetPeriodBillingCycle.
	BillingCycle *BillingCycleResetPeriod `json:"-"`
	// Calendar is set when Type is ResetPeriodCalendar.
	Calendar *CalendarResetPeriod `json:"-"`
	// FixedWindow is set when Type is ResetPeriodFixedWindow.
	FixedWindow *FixedWindowResetPeriod `json:"-"`
	// SlidingWindow is set when Type is ResetPeriodSlidingWindow.
	SlidingWindow *SlidingWindowResetPeriod `json:"-"`
	// Never is set when Type is ResetPeriodNever.
	Never *NeverResetPeriod `json:"-"`
	// contains filtered or unexported fields
}

ResetPeriod is a tagged union discriminated by the type field.

When ResetPeriod.IsKnown reports true, exactly one variant pointer is set, matching Type. A variant added to the API after this SDK version was released still decodes without error, but with every variant pointer nil: always give a `switch` on Type a `default:` branch (or check IsKnown first) instead of dereferencing a pointer unconditionally. The unknown variant's JSON is available from ResetPeriod.Raw.

func NewResetPeriodBillingCycle ¶

func NewResetPeriodBillingCycle(value BillingCycleResetPeriod) ResetPeriod

NewResetPeriodBillingCycle builds a ResetPeriod holding the BILLING_CYCLE variant.

func NewResetPeriodCalendar ¶

func NewResetPeriodCalendar(value CalendarResetPeriod) ResetPeriod

NewResetPeriodCalendar builds a ResetPeriod holding the CALENDAR variant.

func NewResetPeriodFixedWindow ¶

func NewResetPeriodFixedWindow(value FixedWindowResetPeriod) ResetPeriod

NewResetPeriodFixedWindow builds a ResetPeriod holding the FIXED_WINDOW variant.

func NewResetPeriodNever ¶

func NewResetPeriodNever(value NeverResetPeriod) ResetPeriod

NewResetPeriodNever builds a ResetPeriod holding the NEVER variant.

func NewResetPeriodSlidingWindow ¶

func NewResetPeriodSlidingWindow(value SlidingWindowResetPeriod) ResetPeriod

NewResetPeriodSlidingWindow builds a ResetPeriod holding the SLIDING_WINDOW variant.

func (ResetPeriod) IsKnown ¶

func (u ResetPeriod) IsKnown() bool

IsKnown reports whether Type is one of the variants this SDK version knows about, i.e. one of the ResetPeriod* constants. It is false for a variant added to the API later, whose payload is then only available from ResetPeriod.Raw.

func (ResetPeriod) MarshalJSON ¶

func (u ResetPeriod) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (ResetPeriod) Raw ¶

func (u ResetPeriod) Raw() json.RawMessage

Raw returns the JSON of a variant this SDK version does not know about, as decoded (see ResetPeriod.IsKnown). It is nil for a known variant, and for a value that was not decoded from JSON. The returned slice is a copy.

func (*ResetPeriod) UnmarshalJSON ¶

func (u *ResetPeriod) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Payloads carrying an unrecognized discriminator are kept rather than rejected, so a newer API version does not break older SDK builds. Re-encoding such a value reproduces the same JSON document, though not necessarily the same bytes: `encoding/json` compacts whitespace and escapes `<`, `>` and `&`.

type ResetPeriodType ¶

type ResetPeriodType string

ResetPeriodType is the type of a ResetPeriod, one of the ResetPeriod* constants for a variant this SDK version knows.

const (
	ResetPeriodBillingCycle  ResetPeriodType = "BILLING_CYCLE"
	ResetPeriodCalendar      ResetPeriodType = "CALENDAR"
	ResetPeriodFixedWindow   ResetPeriodType = "FIXED_WINDOW"
	ResetPeriodSlidingWindow ResetPeriodType = "SLIDING_WINDOW"
	ResetPeriodNever         ResetPeriodType = "NEVER"
)

Discriminator values for ResetPeriod.

type ResolvedEntitlement ¶

type ResolvedEntitlement struct {
	Feature FeatureRef `json:"feature"`

	Value ResolvedEntitlementValue `json:"value"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ResolvedEntitlement is the ResolvedEntitlement object of the Meteroid API.

Merged entitlement value for a feature across the priority hierarchy, without usage data.

func (ResolvedEntitlement) MarshalJSON ¶

func (v ResolvedEntitlement) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ResolvedEntitlement) UnmarshalJSON ¶

func (v *ResolvedEntitlement) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ResolvedEntitlementListResponse ¶

type ResolvedEntitlementListResponse struct {
	Data RequiredSlice[ResolvedEntitlement] `json:"data"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ResolvedEntitlementListResponse is the ResolvedEntitlementListResponse object of the Meteroid API.

func (ResolvedEntitlementListResponse) MarshalJSON ¶

func (v ResolvedEntitlementListResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ResolvedEntitlementListResponse) UnmarshalJSON ¶

func (v *ResolvedEntitlementListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ResolvedEntitlementValue ¶

type ResolvedEntitlementValue struct {
	// Type selects the active variant. Compare it against the
	// ResolvedEntitlementValue* constants.
	Type ResolvedEntitlementValueType `json:"type"`

	// Boolean is set when Type is ResolvedEntitlementValueBoolean.
	Boolean *BooleanResolvedEntitlementValue `json:"-"`
	// Metered is set when Type is ResolvedEntitlementValueMetered.
	Metered *MeteredResolvedEntitlementValue `json:"-"`
	// Config is set when Type is ResolvedEntitlementValueConfig.
	Config *ConfigResolvedEntitlementValue `json:"-"`
	// contains filtered or unexported fields
}

ResolvedEntitlementValue is a tagged union discriminated by the type field.

When ResolvedEntitlementValue.IsKnown reports true, exactly one variant pointer is set, matching Type. A variant added to the API after this SDK version was released still decodes without error, but with every variant pointer nil: always give a `switch` on Type a `default:` branch (or check IsKnown first) instead of dereferencing a pointer unconditionally. The unknown variant's JSON is available from ResolvedEntitlementValue.Raw.

func NewResolvedEntitlementValueBoolean ¶

func NewResolvedEntitlementValueBoolean(value BooleanResolvedEntitlementValue) ResolvedEntitlementValue

NewResolvedEntitlementValueBoolean builds a ResolvedEntitlementValue holding the BOOLEAN variant.

func NewResolvedEntitlementValueConfig ¶

func NewResolvedEntitlementValueConfig(value ConfigResolvedEntitlementValue) ResolvedEntitlementValue

NewResolvedEntitlementValueConfig builds a ResolvedEntitlementValue holding the CONFIG variant.

func NewResolvedEntitlementValueMetered ¶

func NewResolvedEntitlementValueMetered(value MeteredResolvedEntitlementValue) ResolvedEntitlementValue

NewResolvedEntitlementValueMetered builds a ResolvedEntitlementValue holding the METERED variant.

func (ResolvedEntitlementValue) IsKnown ¶

func (u ResolvedEntitlementValue) IsKnown() bool

IsKnown reports whether Type is one of the variants this SDK version knows about, i.e. one of the ResolvedEntitlementValue* constants. It is false for a variant added to the API later, whose payload is then only available from ResolvedEntitlementValue.Raw.

func (ResolvedEntitlementValue) MarshalJSON ¶

func (u ResolvedEntitlementValue) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (ResolvedEntitlementValue) Raw ¶

Raw returns the JSON of a variant this SDK version does not know about, as decoded (see ResolvedEntitlementValue.IsKnown). It is nil for a known variant, and for a value that was not decoded from JSON. The returned slice is a copy.

func (*ResolvedEntitlementValue) UnmarshalJSON ¶

func (u *ResolvedEntitlementValue) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Payloads carrying an unrecognized discriminator are kept rather than rejected, so a newer API version does not break older SDK builds. Re-encoding such a value reproduces the same JSON document, though not necessarily the same bytes: `encoding/json` compacts whitespace and escapes `<`, `>` and `&`.

type ResolvedEntitlementValueType ¶

type ResolvedEntitlementValueType string

ResolvedEntitlementValueType is the type of a ResolvedEntitlementValue, one of the ResolvedEntitlementValue* constants for a variant this SDK version knows.

const (
	ResolvedEntitlementValueBoolean ResolvedEntitlementValueType = "BOOLEAN"
	ResolvedEntitlementValueMetered ResolvedEntitlementValueType = "METERED"
	ResolvedEntitlementValueConfig  ResolvedEntitlementValueType = "CONFIG"
)

Discriminator values for ResolvedEntitlementValue.

type RestErrorResponse ¶

type RestErrorResponse struct {
	Code ErrorCode `json:"code"`

	Message string `json:"message"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

RestErrorResponse is the RestErrorResponse object of the Meteroid API.

func (RestErrorResponse) MarshalJSON ¶

func (v RestErrorResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*RestErrorResponse) UnmarshalJSON ¶

func (v *RestErrorResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ReversalKind ¶

type ReversalKind string

ReversalKind is one of AllReversalKindValues, or a value this SDK version does not know.

Why a payment was involuntarily clawed back.

const (
	ReversalKindRefund            ReversalKind = "REFUND"
	ReversalKindChargeback        ReversalKind = "CHARGEBACK"
	ReversalKindDebtorRecall      ReversalKind = "DEBTOR_RECALL"
	ReversalKindInsufficientFunds ReversalKind = "INSUFFICIENT_FUNDS"
	ReversalKindMandateInvalid    ReversalKind = "MANDATE_INVALID"
	ReversalKindReturned          ReversalKind = "RETURNED"
	ReversalKindDispute           ReversalKind = "DISPUTE"
	ReversalKindOther             ReversalKind = "OTHER"
)

Known values of ReversalKind.

The API may add new values over time; unknown values round-trip unchanged.

func (ReversalKind) IsKnown ¶

func (e ReversalKind) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (ReversalKind) String ¶

func (e ReversalKind) String() string

String returns the wire representation of the value.

type RevocationRequest ¶

type RevocationRequest struct {
	// The token to revoke
	Token string `json:"token"`

	// Optional hint about the token type (access_token or refresh_token)
	TokenTypeHint *string `json:"token_type_hint,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

RevocationRequest is the RevocationRequest object of the Meteroid API.

Token revocation request

func (RevocationRequest) MarshalJSON ¶

func (v RevocationRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*RevocationRequest) UnmarshalJSON ¶

func (v *RevocationRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type RotatedSecret ¶

type RotatedSecret struct {
	ClientSecret string `json:"client_secret"`

	ClientSecretHint string `json:"client_secret_hint"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

RotatedSecret is the RotatedSecret object of the Meteroid API.

Result of rotating a client secret

func (RotatedSecret) MarshalJSON ¶

func (v RotatedSecret) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*RotatedSecret) UnmarshalJSON ¶

func (v *RotatedSecret) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type RoundTripperFunc ¶

type RoundTripperFunc func(*http.Request) (*http.Response, error)

RoundTripperFunc adapts a function to an http.RoundTripper.

func (RoundTripperFunc) RoundTrip ¶

func (f RoundTripperFunc) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper.

type SDKError ¶

type SDKError interface {
	error
	// contains filtered or unexported methods
}

SDKError is implemented by every error the SDK returns: *APIError for a non-2xx response, *TimeoutError when an attempt ran out of time, *TransportError when no response came, *DecodeError for a response body that does not decode, and *RequestError for a request that could not be built.

var sdkErr meteroid.SDKError
if errors.As(err, &sdkErr) {
	// ...
}

type SSEEvent ¶

type SSEEvent struct {
	Event string
	Data  string
	// ID is the last event ID, including updates from events with no data.
	ID string
	// Retry is the server-provided reconnection delay. The SDK does not reconnect.
	Retry time.Duration
}

SSEEvent is one server-sent event. Data lines are joined with a newline; nothing is JSON-decoded.

type SelectOption ¶

type SelectOption struct {
	Label *string `json:"label,omitempty"`

	Value string `json:"value"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

SelectOption is the SelectOption object of the Meteroid API.

func (SelectOption) MarshalJSON ¶

func (v SelectOption) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*SelectOption) UnmarshalJSON ¶

func (v *SelectOption) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type ShippingAddress ¶

type ShippingAddress struct {
	Address *Address `json:"address,omitempty"`

	SameAsBilling bool `json:"same_as_billing"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

ShippingAddress is the ShippingAddress object of the Meteroid API.

func (ShippingAddress) MarshalJSON ¶

func (v ShippingAddress) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*ShippingAddress) UnmarshalJSON ¶

func (v *ShippingAddress) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type SlidingWindowResetPeriod ¶

type SlidingWindowResetPeriod struct {
	Interval int32 `json:"interval"`

	Unit CalendarUnit `json:"unit"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

SlidingWindowResetPeriod is the SlidingWindowResetPeriod object of the Meteroid API.

Always ends at now — e.g. 30 days means the last 30 days, old usage drops off automatically.

func (SlidingWindowResetPeriod) MarshalJSON ¶

func (v SlidingWindowResetPeriod) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*SlidingWindowResetPeriod) UnmarshalJSON ¶

func (v *SlidingWindowResetPeriod) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type SlotDowngradePolicyEnum ¶

type SlotDowngradePolicyEnum string

SlotDowngradePolicyEnum is one of AllSlotDowngradePolicyEnumValues, or a value this SDK version does not know.

const (
	SlotDowngradePolicyEnumRemoveAtEndOfPeriod SlotDowngradePolicyEnum = "REMOVE_AT_END_OF_PERIOD"
)

Known values of SlotDowngradePolicyEnum.

The API may add new values over time; unknown values round-trip unchanged.

func (SlotDowngradePolicyEnum) IsKnown ¶

func (e SlotDowngradePolicyEnum) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (SlotDowngradePolicyEnum) String ¶

func (e SlotDowngradePolicyEnum) String() string

String returns the wire representation of the value.

type SlotFee ¶

type SlotFee struct {
	InitialSlots int32 `json:"initial_slots"`

	MaxSlots *int32 `json:"max_slots,omitempty"`

	MinSlots *int32 `json:"min_slots,omitempty"`

	Unit string `json:"unit"`

	UnitRate string `json:"unit_rate"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

SlotFee is the SlotFee object of the Meteroid API.

func (SlotFee) MarshalJSON ¶

func (v SlotFee) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*SlotFee) UnmarshalJSON ¶

func (v *SlotFee) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type SlotFeeStructure ¶

type SlotFeeStructure struct {
	DowngradePolicy SlotDowngradePolicyEnum `json:"downgrade_policy"`

	SlotUnitName string `json:"slot_unit_name"`

	UpgradePolicy SlotUpgradePolicyEnum `json:"upgrade_policy"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

SlotFeeStructure is the SlotFeeStructure object of the Meteroid API.

func (SlotFeeStructure) MarshalJSON ¶

func (v SlotFeeStructure) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*SlotFeeStructure) UnmarshalJSON ¶

func (v *SlotFeeStructure) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type SlotPlanFee ¶

type SlotPlanFee struct {
	MinimumCount *int32 `json:"minimum_count,omitempty"`

	Quota *int32 `json:"quota,omitempty"`

	Rates RequiredSlice[TermRate] `json:"rates"`

	SlotUnitName string `json:"slot_unit_name"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

SlotPlanFee is the SlotPlanFee object of the Meteroid API.

Slot-based fee (e.g., per-seat pricing)

func (SlotPlanFee) MarshalJSON ¶

func (v SlotPlanFee) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*SlotPlanFee) UnmarshalJSON ¶

func (v *SlotPlanFee) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type SlotPricing ¶

type SlotPricing struct {
	MaxSlots *int32 `json:"max_slots,omitempty"`

	MinSlots *int32 `json:"min_slots,omitempty"`

	UnitRate string `json:"unit_rate"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

SlotPricing is the SlotPricing object of the Meteroid API.

func (SlotPricing) MarshalJSON ¶

func (v SlotPricing) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*SlotPricing) UnmarshalJSON ¶

func (v *SlotPricing) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type SlotUpgradePolicyEnum ¶

type SlotUpgradePolicyEnum string

SlotUpgradePolicyEnum is one of AllSlotUpgradePolicyEnumValues, or a value this SDK version does not know.

const (
	SlotUpgradePolicyEnumProrated SlotUpgradePolicyEnum = "PRORATED"
)

Known values of SlotUpgradePolicyEnum.

The API may add new values over time; unknown values round-trip unchanged.

func (SlotUpgradePolicyEnum) IsKnown ¶

func (e SlotUpgradePolicyEnum) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (SlotUpgradePolicyEnum) String ¶

func (e SlotUpgradePolicyEnum) String() string

String returns the wire representation of the value.

type Stream ¶

type Stream[T any] struct {
	// contains filtered or unexported fields
}

Stream is a live text/event-stream response whose events carry JSON T values: loop on Next, check Err, and Close it once done. It ends at a `[DONE]` event.

func (*Stream[T]) All ¶

func (s *Stream[T]) All() iter.Seq2[T, error]

All yields every value, then the error that ended the stream, if any.

func (*Stream[T]) Close ¶

func (s *Stream[T]) Close() error

Close closes the connection.

func (*Stream[T]) Current ¶

func (s *Stream[T]) Current() T

Current returns the value Next decoded.

func (*Stream[T]) Err ¶

func (s *Stream[T]) Err() error

Err returns the error that ended the stream, if any.

func (*Stream[T]) Event ¶

func (s *Stream[T]) Event() SSEEvent

Event returns the raw event Next decoded, with its name and id.

func (*Stream[T]) Next ¶

func (s *Stream[T]) Next() bool

Next reads and decodes the next event. It returns false at the end of the stream or on error, see Err.

type SubLineItem ¶

type SubLineItem struct {
	ID string `json:"id"`

	Name string `json:"name"`

	Quantity string `json:"quantity"`

	Total int64 `json:"total"`

	UnitPrice string `json:"unit_price"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

SubLineItem is the SubLineItem object of the Meteroid API.

func (SubLineItem) MarshalJSON ¶

func (v SubLineItem) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*SubLineItem) UnmarshalJSON ¶

func (v *SubLineItem) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type Subscription ¶

type Subscription struct {
	// When the subscription was activated (first payment or activation condition met)
	// RFC 3339 timestamp.
	ActivatedAt *time.Time `json:"activated_at,omitempty"`

	// If false, invoices will stay in Draft until manually reviewed and finalized. Default to true.
	AutoAdvanceInvoices bool `json:"auto_advance_invoices"`

	BillingDayAnchor int32 `json:"billing_day_anchor"`

	// When billing started (after any trial period)
	BillingStartDate *Date `json:"billing_start_date,omitempty"`

	// Automatically try to charge the customer's configured payment method on finalize.
	ChargeAutomatically bool `json:"charge_automatically"`

	// When the subscription was created
	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Currency Currency `json:"currency"`

	// Current billing period end date
	CurrentPeriodEnd *Date `json:"current_period_end,omitempty"`

	// Current billing period start date
	CurrentPeriodStart Date `json:"current_period_start"`

	// User-defined custom property values, keyed by definition `key`.
	CustomProperties json.RawMessage `json:"custom_properties"`

	CustomerAlias *string `json:"customer_alias,omitempty"`

	CustomerID CustomerID `json:"customer_id"`

	CustomerName string `json:"customer_name"`

	// When the subscription ends (if set)
	EndDate *Date `json:"end_date,omitempty"`

	ID SubscriptionID `json:"id"`

	// Default memo for invoices
	InvoiceMemo *string `json:"invoice_memo,omitempty"`

	// Monthly recurring revenue in cents
	MrrCents int64 `json:"mrr_cents"`

	// Payment terms in days (0 = due on issue)
	NetTerms int32 `json:"net_terms"`

	PaymentMethodsConfig *PaymentMethodsConfig `json:"payment_methods_config,omitempty"`

	// Billing period (monthly, annual, etc.)
	Period BillingPeriodEnum `json:"period"`

	PlanDescription *string `json:"plan_description,omitempty"`

	PlanID PlanID `json:"plan_id"`

	PlanName string `json:"plan_name"`

	PlanVersion int32 `json:"plan_version"`

	PlanVersionID PlanVersionID `json:"plan_version_id"`

	PurchaseOrder *string `json:"purchase_order,omitempty"`

	// When the subscription contract starts (benefits apply from this date)
	StartDate Date `json:"start_date"`

	Status SubscriptionStatusEnum `json:"status"`

	// The subscription's prices are quoted tax-included (snapshotted from its plan version).
	TaxInclusive bool `json:"tax_inclusive"`

	// Trial duration in days
	TrialDuration *int32 `json:"trial_duration,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

Subscription is the Subscription object of the Meteroid API.

func (Subscription) MarshalJSON ¶

func (v Subscription) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*Subscription) UnmarshalJSON ¶

func (v *Subscription) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type SubscriptionActivationConditionEnum ¶

type SubscriptionActivationConditionEnum string

SubscriptionActivationConditionEnum is one of AllSubscriptionActivationConditionEnumValues, or a value this SDK version does not know.

const (
	SubscriptionActivationConditionEnumOnStart    SubscriptionActivationConditionEnum = "ON_START"
	SubscriptionActivationConditionEnumOnCheckout SubscriptionActivationConditionEnum = "ON_CHECKOUT"
	SubscriptionActivationConditionEnumManual     SubscriptionActivationConditionEnum = "MANUAL"
)

Known values of SubscriptionActivationConditionEnum.

The API may add new values over time; unknown values round-trip unchanged.

func (SubscriptionActivationConditionEnum) IsKnown ¶

IsKnown reports whether the value is one this SDK version knows about.

func (SubscriptionActivationConditionEnum) String ¶

String returns the wire representation of the value.

type SubscriptionAddOn ¶

type SubscriptionAddOn struct {
	AddOnID *AddOnID `json:"add_on_id,omitempty"`

	Fee SubscriptionFee `json:"fee"`

	ID *SubscriptionAddOnID `json:"id,omitempty"`

	Name string `json:"name"`

	Period SubscriptionFeeBillingPeriodEnum `json:"period"`

	Quantity int32 `json:"quantity"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

SubscriptionAddOn is the SubscriptionAddOn object of the Meteroid API.

func (SubscriptionAddOn) MarshalJSON ¶

func (v SubscriptionAddOn) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*SubscriptionAddOn) UnmarshalJSON ¶

func (v *SubscriptionAddOn) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type SubscriptionAddOnCustomization ¶

type SubscriptionAddOnCustomization struct {
	// Type selects the active variant. Compare it against the
	// SubscriptionAddOnCustomization* constants.
	Type SubscriptionAddOnCustomizationType `json:"type"`

	// PriceOverride is set when Type is SubscriptionAddOnCustomizationPriceOverride.
	PriceOverride *SubscriptionAddOnPriceOverride `json:"-"`
	// Parameterization is set when Type is SubscriptionAddOnCustomizationParameterization.
	Parameterization *SubscriptionAddOnParameterization `json:"-"`
	// contains filtered or unexported fields
}

SubscriptionAddOnCustomization is a tagged union discriminated by the type field.

When SubscriptionAddOnCustomization.IsKnown reports true, exactly one variant pointer is set, matching Type. A variant added to the API after this SDK version was released still decodes without error, but with every variant pointer nil: always give a `switch` on Type a `default:` branch (or check IsKnown first) instead of dereferencing a pointer unconditionally. The unknown variant's JSON is available from SubscriptionAddOnCustomization.Raw.

func NewSubscriptionAddOnCustomizationParameterization ¶

func NewSubscriptionAddOnCustomizationParameterization(value SubscriptionAddOnParameterization) SubscriptionAddOnCustomization

NewSubscriptionAddOnCustomizationParameterization builds a SubscriptionAddOnCustomization holding the PARAMETERIZATION variant.

func NewSubscriptionAddOnCustomizationPriceOverride ¶

func NewSubscriptionAddOnCustomizationPriceOverride(value SubscriptionAddOnPriceOverride) SubscriptionAddOnCustomization

NewSubscriptionAddOnCustomizationPriceOverride builds a SubscriptionAddOnCustomization holding the PRICE_OVERRIDE variant.

func (SubscriptionAddOnCustomization) IsKnown ¶

IsKnown reports whether Type is one of the variants this SDK version knows about, i.e. one of the SubscriptionAddOnCustomization* constants. It is false for a variant added to the API later, whose payload is then only available from SubscriptionAddOnCustomization.Raw.

func (SubscriptionAddOnCustomization) MarshalJSON ¶

func (u SubscriptionAddOnCustomization) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (SubscriptionAddOnCustomization) Raw ¶

Raw returns the JSON of a variant this SDK version does not know about, as decoded (see SubscriptionAddOnCustomization.IsKnown). It is nil for a known variant, and for a value that was not decoded from JSON. The returned slice is a copy.

func (*SubscriptionAddOnCustomization) UnmarshalJSON ¶

func (u *SubscriptionAddOnCustomization) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Payloads carrying an unrecognized discriminator are kept rather than rejected, so a newer API version does not break older SDK builds. Re-encoding such a value reproduces the same JSON document, though not necessarily the same bytes: `encoding/json` compacts whitespace and escapes `<`, `>` and `&`.

type SubscriptionAddOnCustomizationType ¶

type SubscriptionAddOnCustomizationType string

SubscriptionAddOnCustomizationType is the type of a SubscriptionAddOnCustomization, one of the SubscriptionAddOnCustomization* constants for a variant this SDK version knows.

const (
	SubscriptionAddOnCustomizationPriceOverride    SubscriptionAddOnCustomizationType = "PRICE_OVERRIDE"
	SubscriptionAddOnCustomizationParameterization SubscriptionAddOnCustomizationType = "PARAMETERIZATION"
)

Discriminator values for SubscriptionAddOnCustomization.

type SubscriptionAddOnID ¶

type SubscriptionAddOnID = string

SubscriptionAddOnID is the SubscriptionAddOnId string of the Meteroid API.

type SubscriptionAddOnParameterization ¶

type SubscriptionAddOnParameterization struct {
	BillingPeriod *BillingPeriodEnum `json:"billing_period,omitempty"`

	CommittedCapacity *int64 `json:"committed_capacity,omitempty"`

	InitialSlotCount *int32 `json:"initial_slot_count,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

SubscriptionAddOnParameterization is the SubscriptionAddOnParameterization object of the Meteroid API.

func (SubscriptionAddOnParameterization) MarshalJSON ¶

func (v SubscriptionAddOnParameterization) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*SubscriptionAddOnParameterization) UnmarshalJSON ¶

func (v *SubscriptionAddOnParameterization) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type SubscriptionAddOnPriceOverride ¶

type SubscriptionAddOnPriceOverride struct {
	Name *string `json:"name,omitempty"`

	PriceEntry PriceEntry `json:"price_entry"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

SubscriptionAddOnPriceOverride is the SubscriptionAddOnPriceOverride object of the Meteroid API.

func (SubscriptionAddOnPriceOverride) MarshalJSON ¶

func (v SubscriptionAddOnPriceOverride) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*SubscriptionAddOnPriceOverride) UnmarshalJSON ¶

func (v *SubscriptionAddOnPriceOverride) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type SubscriptionComponent ¶

type SubscriptionComponent struct {
	Fee SubscriptionFee `json:"fee"`

	Name string `json:"name"`

	Period SubscriptionFeeBillingPeriodEnum `json:"period"`

	PriceComponentID *PriceComponentID `json:"price_component_id,omitempty"`

	ProductID *ProductID `json:"product_id,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

SubscriptionComponent is the SubscriptionComponent object of the Meteroid API.

func (SubscriptionComponent) MarshalJSON ¶

func (v SubscriptionComponent) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*SubscriptionComponent) UnmarshalJSON ¶

func (v *SubscriptionComponent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type SubscriptionCoupon ¶

type SubscriptionCoupon struct {
	Code string `json:"code"`

	Description string `json:"description"`

	Disabled bool `json:"disabled"`

	Discount CouponDiscount `json:"discount"`

	// RFC 3339 timestamp.
	ExpiresAt *time.Time `json:"expires_at,omitempty"`

	ID CouponID `json:"id"`

	RecurringValue *int32 `json:"recurring_value,omitempty"`

	RedemptionLimit *int32 `json:"redemption_limit,omitempty"`

	Reusable bool `json:"reusable"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

SubscriptionCoupon is the SubscriptionCoupon object of the Meteroid API.

Coupon as embedded in subscription details — a subset of the `Coupon` resource returned by the coupons API.

func (SubscriptionCoupon) MarshalJSON ¶

func (v SubscriptionCoupon) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*SubscriptionCoupon) UnmarshalJSON ¶

func (v *SubscriptionCoupon) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type SubscriptionCreateRequest ¶

type SubscriptionCreateRequest struct {
	ActivationCondition SubscriptionActivationConditionEnum `json:"activation_condition"`

	AddOns []CreateSubscriptionAddOn `json:"add_ons,omitempty"`

	AutoAdvanceInvoices *bool `json:"auto_advance_invoices,omitempty"`

	// Historical import mode: when true, invoices finalized for this subscription keep their
	// billing-period date as the invoice date instead of being stamped with the emission date.
	BackdateInvoices *bool `json:"backdate_invoices,omitempty"`

	BillingDayAnchor *int32 `json:"billing_day_anchor,omitempty"`

	ChargeAutomatically *bool `json:"charge_automatically,omitempty"`

	CouponCodes []string `json:"coupon_codes,omitempty"`

	// User-defined custom property values, keyed by definition `key`. Validated against the
	// tenant's subscription definitions.
	CustomProperties json.RawMessage `json:"custom_properties,omitempty"`

	CustomerIDOrAlias string `json:"customer_id_or_alias"`

	EndDate *Date `json:"end_date,omitempty"`

	InvoiceMemo *string `json:"invoice_memo,omitempty"`

	NetTerms *int32 `json:"net_terms,omitempty"`

	// Payment methods configuration. If not specified, inherits from the invoicing entity.
	PaymentMethodsConfig *PaymentMethodsConfig `json:"payment_methods_config,omitempty"`

	PlanID PlanID `json:"plan_id"`

	PriceComponents *CreateSubscriptionComponents `json:"price_components,omitempty"`

	PurchaseOrder *string `json:"purchase_order,omitempty"`

	// Migration mode: when true with a past start_date, skip creating invoices for past cycles.
	// The subscription will be set to the current billing period with correct cycle_index.
	SkipPastInvoices *bool `json:"skip_past_invoices,omitempty"`

	StartDate Date `json:"start_date"`

	TrialDays *int32 `json:"trial_days,omitempty"`

	Version *int32 `json:"version,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

SubscriptionCreateRequest is the SubscriptionCreateRequest object of the Meteroid API.

func (SubscriptionCreateRequest) MarshalJSON ¶

func (v SubscriptionCreateRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*SubscriptionCreateRequest) UnmarshalJSON ¶

func (v *SubscriptionCreateRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type SubscriptionDetails ¶

type SubscriptionDetails struct {
	// When the subscription was activated (first payment or activation condition met)
	// RFC 3339 timestamp.
	ActivatedAt *time.Time `json:"activated_at,omitempty"`

	AddOns RequiredSlice[SubscriptionAddOn] `json:"add_ons"`

	AppliedCoupons RequiredSlice[AppliedCouponDetailed] `json:"applied_coupons"`

	AutoAdvanceInvoices bool `json:"auto_advance_invoices"`

	BillingDayAnchor int32 `json:"billing_day_anchor"`

	// When billing started (after any trial period)
	BillingStartDate *Date `json:"billing_start_date,omitempty"`

	ChargeAutomatically bool `json:"charge_automatically"`

	CheckoutURL *string `json:"checkout_url,omitempty"`

	Components RequiredSlice[SubscriptionComponent] `json:"components"`

	// When the subscription was created
	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Currency Currency `json:"currency"`

	// Current billing period end date
	CurrentPeriodEnd *Date `json:"current_period_end,omitempty"`

	// Current billing period start date
	CurrentPeriodStart Date `json:"current_period_start"`

	// User-defined custom property values, keyed by definition `key`.
	CustomProperties json.RawMessage `json:"custom_properties"`

	CustomerAlias *string `json:"customer_alias,omitempty"`

	CustomerID CustomerID `json:"customer_id"`

	CustomerName string `json:"customer_name"`

	// When the subscription ends (if set)
	EndDate *Date `json:"end_date,omitempty"`

	Entitlements []Entitlement `json:"entitlements,omitempty"`

	ID SubscriptionID `json:"id"`

	// Default memo for invoices
	InvoiceMemo *string `json:"invoice_memo,omitempty"`

	MinimumCommitment *MinimumCommitment `json:"minimum_commitment,omitempty"`

	// Monthly recurring revenue in cents
	MrrCents int64 `json:"mrr_cents"`

	// Payment terms in days (0 = due on issue)
	NetTerms int32 `json:"net_terms"`

	PaymentMethodsConfig *PaymentMethodsConfig `json:"payment_methods_config,omitempty"`

	// Billing period (monthly, annual, etc.)
	Period BillingPeriodEnum `json:"period"`

	PlanID PlanID `json:"plan_id"`

	PlanName string `json:"plan_name"`

	PlanVersion int32 `json:"plan_version"`

	PlanVersionID PlanVersionID `json:"plan_version_id"`

	PurchaseOrder *string `json:"purchase_order,omitempty"`

	// When the subscription contract starts (benefits apply from this date)
	StartDate Date `json:"start_date"`

	Status SubscriptionStatusEnum `json:"status"`

	// The subscription's prices are quoted tax-included (snapshotted from its plan version).
	TaxInclusive bool `json:"tax_inclusive"`

	// Trial duration in days
	TrialDuration *int32 `json:"trial_duration,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

SubscriptionDetails is the SubscriptionDetails object of the Meteroid API.

func (SubscriptionDetails) MarshalJSON ¶

func (v SubscriptionDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*SubscriptionDetails) UnmarshalJSON ¶

func (v *SubscriptionDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type SubscriptionEvent ¶

type SubscriptionEvent struct {
	// RFC 3339 timestamp.
	ActivatedAt *time.Time `json:"activated_at,omitempty"`

	AutoAdvanceInvoices bool `json:"auto_advance_invoices"`

	BillingDayAnchor int32 `json:"billing_day_anchor"`

	BillingStartDate *Date `json:"billing_start_date,omitempty"`

	// Present on `subscription.cancelled` when a reason was supplied.
	CancellationReason *string `json:"cancellation_reason,omitempty"`

	ChangeType *SubscriptionUpdateType `json:"change_type,omitempty"`

	ChargeAutomatically bool `json:"charge_automatically"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Currency string `json:"currency"`

	// User-defined custom property values, keyed by definition key.
	CustomProperties json.RawMessage `json:"custom_properties"`

	CustomerAlias *string `json:"customer_alias,omitempty"`

	CustomerID CustomerID `json:"customer_id"`

	CustomerName string `json:"customer_name"`

	EndDate *Date `json:"end_date,omitempty"`

	InvoiceMemo *string `json:"invoice_memo,omitempty"`

	InvoiceThreshold *string `json:"invoice_threshold,omitempty"`

	MrrCents int64 `json:"mrr_cents"`

	NetTerms int32 `json:"net_terms"`

	Period BillingPeriodEnum `json:"period"`

	PlanName string `json:"plan_name"`

	PurchaseOrder *string `json:"purchase_order,omitempty"`

	StartDate Date `json:"start_date"`

	Status SubscriptionStatusEnum `json:"status"`

	SubscriptionID SubscriptionID `json:"subscription_id"`

	TrialDuration *int32 `json:"trial_duration,omitempty"`

	Version int32 `json:"version"`

	ID EventID `json:"id"`

	// RFC 3339 timestamp.
	Timestamp time.Time `json:"timestamp"`

	Type EventType `json:"type"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

SubscriptionEvent is the SubscriptionEvent object of the Meteroid API.

func (SubscriptionEvent) MarshalJSON ¶

func (v SubscriptionEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*SubscriptionEvent) UnmarshalJSON ¶

func (v *SubscriptionEvent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type SubscriptionEventData ¶

type SubscriptionEventData struct {
	// RFC 3339 timestamp.
	ActivatedAt *time.Time `json:"activated_at,omitempty"`

	AutoAdvanceInvoices bool `json:"auto_advance_invoices"`

	BillingDayAnchor int32 `json:"billing_day_anchor"`

	BillingStartDate *Date `json:"billing_start_date,omitempty"`

	// Present on `subscription.cancelled` when a reason was supplied.
	CancellationReason *string `json:"cancellation_reason,omitempty"`

	ChangeType *SubscriptionUpdateType `json:"change_type,omitempty"`

	ChargeAutomatically bool `json:"charge_automatically"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Currency string `json:"currency"`

	// User-defined custom property values, keyed by definition key.
	CustomProperties json.RawMessage `json:"custom_properties"`

	CustomerAlias *string `json:"customer_alias,omitempty"`

	CustomerID CustomerID `json:"customer_id"`

	CustomerName string `json:"customer_name"`

	EndDate *Date `json:"end_date,omitempty"`

	InvoiceMemo *string `json:"invoice_memo,omitempty"`

	InvoiceThreshold *string `json:"invoice_threshold,omitempty"`

	MrrCents int64 `json:"mrr_cents"`

	NetTerms int32 `json:"net_terms"`

	Period BillingPeriodEnum `json:"period"`

	PlanName string `json:"plan_name"`

	PurchaseOrder *string `json:"purchase_order,omitempty"`

	StartDate Date `json:"start_date"`

	Status SubscriptionStatusEnum `json:"status"`

	SubscriptionID SubscriptionID `json:"subscription_id"`

	TrialDuration *int32 `json:"trial_duration,omitempty"`

	Version int32 `json:"version"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

SubscriptionEventData is the SubscriptionEventData object of the Meteroid API.

func (SubscriptionEventData) MarshalJSON ¶

func (v SubscriptionEventData) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*SubscriptionEventData) UnmarshalJSON ¶

func (v *SubscriptionEventData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type SubscriptionFee ¶

type SubscriptionFee struct {
	// Type selects the active variant. Compare it against the
	// SubscriptionFee* constants.
	Type SubscriptionFeeType `json:"type"`

	// Rate is set when Type is SubscriptionFeeRate.
	Rate *RateFee `json:"-"`
	// OneTime is set when Type is SubscriptionFeeOneTime.
	OneTime *OneTimeFee `json:"-"`
	// Recurring is set when Type is SubscriptionFeeRecurring.
	Recurring *RecurringFee `json:"-"`
	// Capacity is set when Type is SubscriptionFeeCapacity.
	Capacity *CapacityFee `json:"-"`
	// Slot is set when Type is SubscriptionFeeSlot.
	Slot *SlotFee `json:"-"`
	// Usage is set when Type is SubscriptionFeeUsage.
	Usage *UsageFee `json:"-"`
	// contains filtered or unexported fields
}

SubscriptionFee is a tagged union discriminated by the type field.

When SubscriptionFee.IsKnown reports true, exactly one variant pointer is set, matching Type. A variant added to the API after this SDK version was released still decodes without error, but with every variant pointer nil: always give a `switch` on Type a `default:` branch (or check IsKnown first) instead of dereferencing a pointer unconditionally. The unknown variant's JSON is available from SubscriptionFee.Raw.

func NewSubscriptionFeeCapacity ¶

func NewSubscriptionFeeCapacity(value CapacityFee) SubscriptionFee

NewSubscriptionFeeCapacity builds a SubscriptionFee holding the CAPACITY variant.

func NewSubscriptionFeeOneTime ¶

func NewSubscriptionFeeOneTime(value OneTimeFee) SubscriptionFee

NewSubscriptionFeeOneTime builds a SubscriptionFee holding the ONE_TIME variant.

func NewSubscriptionFeeRate ¶

func NewSubscriptionFeeRate(value RateFee) SubscriptionFee

NewSubscriptionFeeRate builds a SubscriptionFee holding the RATE variant.

func NewSubscriptionFeeRecurring ¶

func NewSubscriptionFeeRecurring(value RecurringFee) SubscriptionFee

NewSubscriptionFeeRecurring builds a SubscriptionFee holding the RECURRING variant.

func NewSubscriptionFeeSlot ¶

func NewSubscriptionFeeSlot(value SlotFee) SubscriptionFee

NewSubscriptionFeeSlot builds a SubscriptionFee holding the SLOT variant.

func NewSubscriptionFeeUsage ¶

func NewSubscriptionFeeUsage(value UsageFee) SubscriptionFee

NewSubscriptionFeeUsage builds a SubscriptionFee holding the USAGE variant.

func (SubscriptionFee) IsKnown ¶

func (u SubscriptionFee) IsKnown() bool

IsKnown reports whether Type is one of the variants this SDK version knows about, i.e. one of the SubscriptionFee* constants. It is false for a variant added to the API later, whose payload is then only available from SubscriptionFee.Raw.

func (SubscriptionFee) MarshalJSON ¶

func (u SubscriptionFee) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (SubscriptionFee) Raw ¶

Raw returns the JSON of a variant this SDK version does not know about, as decoded (see SubscriptionFee.IsKnown). It is nil for a known variant, and for a value that was not decoded from JSON. The returned slice is a copy.

func (*SubscriptionFee) UnmarshalJSON ¶

func (u *SubscriptionFee) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Payloads carrying an unrecognized discriminator are kept rather than rejected, so a newer API version does not break older SDK builds. Re-encoding such a value reproduces the same JSON document, though not necessarily the same bytes: `encoding/json` compacts whitespace and escapes `<`, `>` and `&`.

type SubscriptionFeeBillingPeriodEnum ¶

type SubscriptionFeeBillingPeriodEnum string

SubscriptionFeeBillingPeriodEnum is one of AllSubscriptionFeeBillingPeriodEnumValues, or a value this SDK version does not know.

const (
	SubscriptionFeeBillingPeriodEnumOneTime    SubscriptionFeeBillingPeriodEnum = "ONE_TIME"
	SubscriptionFeeBillingPeriodEnumMonthly    SubscriptionFeeBillingPeriodEnum = "MONTHLY"
	SubscriptionFeeBillingPeriodEnumQuarterly  SubscriptionFeeBillingPeriodEnum = "QUARTERLY"
	SubscriptionFeeBillingPeriodEnumSemiannual SubscriptionFeeBillingPeriodEnum = "SEMIANNUAL"
	SubscriptionFeeBillingPeriodEnumAnnual     SubscriptionFeeBillingPeriodEnum = "ANNUAL"
)

Known values of SubscriptionFeeBillingPeriodEnum.

The API may add new values over time; unknown values round-trip unchanged.

func (SubscriptionFeeBillingPeriodEnum) IsKnown ¶

IsKnown reports whether the value is one this SDK version knows about.

func (SubscriptionFeeBillingPeriodEnum) String ¶

String returns the wire representation of the value.

type SubscriptionFeeType ¶

type SubscriptionFeeType string

SubscriptionFeeType is the type of a SubscriptionFee, one of the SubscriptionFee* constants for a variant this SDK version knows.

const (
	SubscriptionFeeRate      SubscriptionFeeType = "RATE"
	SubscriptionFeeOneTime   SubscriptionFeeType = "ONE_TIME"
	SubscriptionFeeRecurring SubscriptionFeeType = "RECURRING"
	SubscriptionFeeCapacity  SubscriptionFeeType = "CAPACITY"
	SubscriptionFeeSlot      SubscriptionFeeType = "SLOT"
	SubscriptionFeeUsage     SubscriptionFeeType = "USAGE"
)

Discriminator values for SubscriptionFee.

type SubscriptionID ¶

type SubscriptionID = string

SubscriptionID is the SubscriptionId string of the Meteroid API.

type SubscriptionListResponse ¶

type SubscriptionListResponse struct {
	Data RequiredSlice[Subscription] `json:"data"`

	PaginationMeta PaginationResponse `json:"pagination_meta"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

SubscriptionListResponse is the SubscriptionListResponse object of the Meteroid API.

func (SubscriptionListResponse) MarshalJSON ¶

func (v SubscriptionListResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*SubscriptionListResponse) UnmarshalJSON ¶

func (v *SubscriptionListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type SubscriptionStatusEnum ¶

type SubscriptionStatusEnum string

SubscriptionStatusEnum is one of AllSubscriptionStatusEnumValues, or a value this SDK version does not know.

const (
	SubscriptionStatusEnumPendingActivation SubscriptionStatusEnum = "PENDING_ACTIVATION"
	SubscriptionStatusEnumPendingCharge     SubscriptionStatusEnum = "PENDING_CHARGE"
	SubscriptionStatusEnumTrialActive       SubscriptionStatusEnum = "TRIAL_ACTIVE"
	SubscriptionStatusEnumActive            SubscriptionStatusEnum = "ACTIVE"
	SubscriptionStatusEnumTrialExpired      SubscriptionStatusEnum = "TRIAL_EXPIRED"
	SubscriptionStatusEnumPaused            SubscriptionStatusEnum = "PAUSED"
	SubscriptionStatusEnumSuspended         SubscriptionStatusEnum = "SUSPENDED"
	SubscriptionStatusEnumCancelled         SubscriptionStatusEnum = "CANCELLED"
	SubscriptionStatusEnumAborted           SubscriptionStatusEnum = "ABORTED"
	SubscriptionStatusEnumCompleted         SubscriptionStatusEnum = "COMPLETED"
	SubscriptionStatusEnumSuperseded        SubscriptionStatusEnum = "SUPERSEDED"
	SubscriptionStatusEnumErrored           SubscriptionStatusEnum = "ERRORED"
)

Known values of SubscriptionStatusEnum.

The API may add new values over time; unknown values round-trip unchanged.

func (SubscriptionStatusEnum) IsKnown ¶

func (e SubscriptionStatusEnum) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (SubscriptionStatusEnum) String ¶

func (e SubscriptionStatusEnum) String() string

String returns the wire representation of the value.

type SubscriptionUpdateRequest ¶

type SubscriptionUpdateRequest struct {
	// If false, invoices will stay in Draft until manually reviewed and finalized.
	AutoAdvanceInvoices *Nullable[bool] `json:"auto_advance_invoices,omitempty"`

	// Automatically try to charge the customer's configured payment method on finalize.
	ChargeAutomatically *Nullable[bool] `json:"charge_automatically,omitempty"`

	// Partial update of custom property values (merge; send a key with `null` to remove it).
	// Validated against the tenant's `SUBSCRIPTION` property definitions. Omit to leave unchanged.
	CustomProperties json.RawMessage `json:"custom_properties,omitempty"`

	// Default memo for invoices
	InvoiceMemo *Nullable[string] `json:"invoice_memo,omitempty"`

	// Payment terms in days (0 = due on issue)
	NetTerms *Nullable[int32] `json:"net_terms,omitempty"`

	PaymentMethodsConfig *Nullable[PaymentMethodsConfig] `json:"payment_methods_config,omitempty"`

	// Purchase order number
	PurchaseOrder *Nullable[string] `json:"purchase_order,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

SubscriptionUpdateRequest is the SubscriptionUpdateRequest object of the Meteroid API.

func (SubscriptionUpdateRequest) MarshalJSON ¶

func (v SubscriptionUpdateRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*SubscriptionUpdateRequest) UnmarshalJSON ¶

func (v *SubscriptionUpdateRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type SubscriptionUpdateResponse ¶

type SubscriptionUpdateResponse struct {
	Subscription SubscriptionDetails `json:"subscription"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

SubscriptionUpdateResponse is the SubscriptionUpdateResponse object of the Meteroid API.

func (SubscriptionUpdateResponse) MarshalJSON ¶

func (v SubscriptionUpdateResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*SubscriptionUpdateResponse) UnmarshalJSON ¶

func (v *SubscriptionUpdateResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type SubscriptionUpdateType ¶

type SubscriptionUpdateType string

SubscriptionUpdateType is one of AllSubscriptionUpdateTypeValues, or a value this SDK version does not know.

Identifies which mutation triggered a `subscription.updated` webhook.

const (
	SubscriptionUpdateTypeActivated                   SubscriptionUpdateType = "activated"
	SubscriptionUpdateTypeTrialEnded                  SubscriptionUpdateType = "trial_ended"
	SubscriptionUpdateTypeBillingConfigurationUpdated SubscriptionUpdateType = "billing_configuration_updated"
	SubscriptionUpdateTypePlanChanged                 SubscriptionUpdateType = "plan_changed"
	SubscriptionUpdateTypeAmended                     SubscriptionUpdateType = "amended"
	SubscriptionUpdateTypeUnitsChanged                SubscriptionUpdateType = "units_changed"
	SubscriptionUpdateTypePaused                      SubscriptionUpdateType = "paused"
	SubscriptionUpdateTypeCancellationScheduled       SubscriptionUpdateType = "cancellation_scheduled"
)

Known values of SubscriptionUpdateType.

The API may add new values over time; unknown values round-trip unchanged.

func (SubscriptionUpdateType) IsKnown ¶

func (e SubscriptionUpdateType) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (SubscriptionUpdateType) String ¶

func (e SubscriptionUpdateType) String() string

String returns the wire representation of the value.

type Subscriptions ¶

type Subscriptions struct {
	// contains filtered or unexported fields
}

Subscriptions groups the subscriptions operations of the Meteroid API.

func (*Subscriptions) Cancel ¶

func (a *Subscriptions) Cancel(ctx context.Context, subscriptionID string, cancelSubscriptionRequest CancelSubscriptionRequest, opts ...RequestOption) (*CancelSubscriptionResponse, error)

Cancel subscription

Cancel a subscription either immediately or at the end of the billing period.

func (*Subscriptions) Create ¶

func (a *Subscriptions) Create(ctx context.Context, subscriptionCreateRequest SubscriptionCreateRequest, opts ...RequestOption) (*SubscriptionDetails, error)

Create subscription

Create a new subscription for a customer with a specific plan.

func (*Subscriptions) List ¶

List subscriptions with optional filtering by customer or plan.

Subscriptions.ListAutoPaging iterates over every item instead.

func (*Subscriptions) ListAutoPaging ¶ added in v0.28.0

func (a *Subscriptions) ListAutoPaging(ctx context.Context, options *SubscriptionsListOptions, opts ...RequestOption) *AutoPager[Subscription]

ListAutoPaging iterates over every item of Subscriptions.List, fetching further pages on demand.

func (*Subscriptions) ListEntitlements ¶

func (a *Subscriptions) ListEntitlements(ctx context.Context, subscriptionID string, opts ...RequestOption) (*EffectiveEntitlementListResponse, error)

ListEntitlements sends GET /api/v1/subscriptions/{subscription_id}/entitlements.

List subscription entitlements

func (*Subscriptions) Retrieve ¶

func (a *Subscriptions) Retrieve(ctx context.Context, subscriptionID string, opts ...RequestOption) (*SubscriptionDetails, error)

Retrieve sends GET /api/v1/subscriptions/{subscription_id}.

Get subscription details ¶

Retrieve detailed information about a subscription including price components and schedules.

func (*Subscriptions) RetrieveSummary ¶

func (a *Subscriptions) RetrieveSummary(ctx context.Context, subscriptionID string, opts ...RequestOption) (*Subscription, error)

RetrieveSummary sends GET /api/v1/subscriptions/{subscription_id}/summary.

Get subscription summary ¶

Retrieve a subscription without its components, add-ons, coupons and entitlements: the same shape as list items, for callers that only need status and billing dates.

func (*Subscriptions) Update ¶

func (a *Subscriptions) Update(ctx context.Context, subscriptionID string, subscriptionUpdateRequest SubscriptionUpdateRequest, opts ...RequestOption) (*SubscriptionUpdateResponse, error)

Update subscription settings like payment configuration, billing options, etc.

type SubscriptionsListOptions ¶

type SubscriptionsListOptions struct {
	// Filter by customer ID or alias
	CustomerID *string

	PlanID *PlanID

	Statuses []SubscriptionStatusEnum

	// Sort order. Format: `column.direction`. Allowed columns: `customer_name`, `plan_name`, `mrr_cents`, `billing_start_date`, `end_date`, `status`, `created_at`. Direction: `asc` or `desc`. Default: `created_at.desc`.
	OrderBy *string

	// Page number (0-indexed)
	Page *int32

	// Number of items per page
	PerPage *int32
}

SubscriptionsListOptions carries the optional query and header parameters of Subscriptions.List. Leave a field nil to omit it.

type SubscriptionsListPage ¶ added in v0.28.0

type SubscriptionsListPage struct {
	SubscriptionListResponse

	// Items holds the items of this page.
	Items []Subscription
	// contains filtered or unexported fields
}

SubscriptionsListPage is a page of Subscriptions.List. It embeds the decoded SubscriptionListResponse, promoting its fields, with the Items of the page; a field named like a page member stays reachable through the embedded SubscriptionListResponse.

func (*SubscriptionsListPage) HasNextPage ¶ added in v0.28.0

func (p *SubscriptionsListPage) HasNextPage() bool

HasNextPage reports whether another page follows this one.

func (SubscriptionsListPage) MarshalJSON ¶ added in v0.28.0

func (p SubscriptionsListPage) MarshalJSON() ([]byte, error)

MarshalJSON encodes the SubscriptionListResponse of the page, as received.

func (*SubscriptionsListPage) NextPage ¶ added in v0.28.0

NextPage fetches the page after this one. It returns nil and no error after the last page.

type TaxBreakdownItem ¶

type TaxBreakdownItem struct {
	// Free-text legal exemption mention (EU exempt/reverse-charge invoices).
	ExemptionReason *string `json:"exemption_reason,omitempty"`

	ExemptionType *TaxExemptionType `json:"exemption_type,omitempty"`

	Name string `json:"name"`

	TaxAmount int64 `json:"tax_amount"`

	TaxRate string `json:"tax_rate"`

	// Accounting/reporting code of the tax rate for this line, for exports.
	TaxReference *string `json:"tax_reference,omitempty"`

	TaxableAmount int64 `json:"taxable_amount"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

TaxBreakdownItem is the TaxBreakdownItem object of the Meteroid API.

func (TaxBreakdownItem) MarshalJSON ¶

func (v TaxBreakdownItem) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*TaxBreakdownItem) UnmarshalJSON ¶

func (v *TaxBreakdownItem) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type TaxExemptionType ¶

type TaxExemptionType string

TaxExemptionType is one of AllTaxExemptionTypeValues, or a value this SDK version does not know.

const (
	TaxExemptionTypeReverseCharge  TaxExemptionType = "REVERSE_CHARGE"
	TaxExemptionTypeTaxExempt      TaxExemptionType = "TAX_EXEMPT"
	TaxExemptionTypeNotRegistered  TaxExemptionType = "NOT_REGISTERED"
	TaxExemptionTypeExport         TaxExemptionType = "EXPORT"
	TaxExemptionTypeNoVatTerritory TaxExemptionType = "NO_VAT_TERRITORY"
)

Known values of TaxExemptionType.

The API may add new values over time; unknown values round-trip unchanged.

func (TaxExemptionType) IsKnown ¶

func (e TaxExemptionType) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (TaxExemptionType) String ¶

func (e TaxExemptionType) String() string

String returns the wire representation of the value.

type TenantID ¶

type TenantID = string

TenantID is the TenantId string of the Meteroid API.

type TermRate ¶

type TermRate struct {
	Price string `json:"price"`

	Term BillingPeriodEnum `json:"term"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

TermRate is the TermRate object of the Meteroid API.

func (TermRate) MarshalJSON ¶

func (v TermRate) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*TermRate) UnmarshalJSON ¶

func (v *TermRate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type TextConfigValue ¶

type TextConfigValue struct {
	Value string `json:"value"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

TextConfigValue is the TextConfigValue object of the Meteroid API.

A text config value.

func (TextConfigValue) MarshalJSON ¶

func (v TextConfigValue) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*TextConfigValue) UnmarshalJSON ¶

func (v *TextConfigValue) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type TierRow ¶

type TierRow struct {
	FirstUnit int64 `json:"first_unit"`

	FlatCap *string `json:"flat_cap,omitempty"`

	FlatFee *string `json:"flat_fee,omitempty"`

	Rate string `json:"rate"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

TierRow is the TierRow object of the Meteroid API.

func (TierRow) MarshalJSON ¶

func (v TierRow) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*TierRow) UnmarshalJSON ¶

func (v *TierRow) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type TieredPlanPricing ¶

type TieredPlanPricing struct {
	BlockSize *int64 `json:"block_size,omitempty"`

	Tiers RequiredSlice[TierRow] `json:"tiers"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

TieredPlanPricing is the TieredPlanPricing object of the Meteroid API.

func (TieredPlanPricing) MarshalJSON ¶

func (v TieredPlanPricing) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*TieredPlanPricing) UnmarshalJSON ¶

func (v *TieredPlanPricing) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type TieredPricing ¶

type TieredPricing struct {
	BlockSize *int64 `json:"block_size,omitempty"`

	Tiers RequiredSlice[TierRow] `json:"tiers"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

TieredPricing is the TieredPricing object of the Meteroid API.

func (TieredPricing) MarshalJSON ¶

func (v TieredPricing) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*TieredPricing) UnmarshalJSON ¶

func (v *TieredPricing) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type TimeoutError ¶

type TimeoutError struct {
	Method string
	Path   string
	Err    error
}

TimeoutError is returned when an attempt, or the context of the call, ran out of time. It wraps the cause, so errors.Is(err, context.DeadlineExceeded) holds when the deadline was a context's.

func (*TimeoutError) Error ¶

func (e *TimeoutError) Error() string

func (*TimeoutError) Unwrap ¶

func (e *TimeoutError) Unwrap() error

type TokenIntrospectionResponse ¶

type TokenIntrospectionResponse struct {
	Active bool `json:"active"`

	ClientID *string `json:"client_id,omitempty"`

	Exp *int64 `json:"exp,omitempty"`

	Iat *int64 `json:"iat,omitempty"`

	Scope *string `json:"scope,omitempty"`

	Sub *string `json:"sub,omitempty"`

	TokenType *string `json:"token_type,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

TokenIntrospectionResponse is the TokenIntrospectionResponse object of the Meteroid API.

Token introspection response as per RFC 7662

func (TokenIntrospectionResponse) MarshalJSON ¶

func (v TokenIntrospectionResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*TokenIntrospectionResponse) UnmarshalJSON ¶

func (v *TokenIntrospectionResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type TokenRequest ¶

type TokenRequest struct {
	// Client ID (if not using HTTP Basic auth)
	ClientID *string `json:"client_id,omitempty"`

	// Client secret (if not using HTTP Basic auth)
	ClientSecret *string `json:"client_secret,omitempty"`

	// Authorization code (for authorization_code grant)
	Code *string `json:"code,omitempty"`

	// PKCE code verifier (for authorization_code grant with PKCE)
	CodeVerifier *string `json:"code_verifier,omitempty"`

	// Grant type: "authorization_code" or "refresh_token"
	GrantType string `json:"grant_type"`

	// Redirect URI (for authorization_code grant, must match the one used in /authorize)
	RedirectURI *string `json:"redirect_uri,omitempty"`

	// Refresh token (for refresh_token grant)
	RefreshToken *string `json:"refresh_token,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

TokenRequest is the TokenRequest object of the Meteroid API.

Token request (from POST body, application/x-www-form-urlencoded)

func (TokenRequest) MarshalJSON ¶

func (v TokenRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*TokenRequest) UnmarshalJSON ¶

func (v *TokenRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type TokenResponse ¶

type TokenResponse struct {
	AccessToken string `json:"access_token"`

	ExpiresIn int64 `json:"expires_in"`

	RefreshToken *string `json:"refresh_token,omitempty"`

	Scope *string `json:"scope,omitempty"`

	TokenType string `json:"token_type"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

TokenResponse is the TokenResponse object of the Meteroid API.

Token response as per OAuth 2.0 spec

func (TokenResponse) MarshalJSON ¶

func (v TokenResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*TokenResponse) UnmarshalJSON ¶

func (v *TokenResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type Transaction ¶

type Transaction struct {
	Amount int64 `json:"amount"`

	// On a PAYMENT: how much was voluntarily given back (the sum of its settled REFUND
	// children). The invoice stays paid — the Refund credit note is what reduces it.
	AmountRefunded int64 `json:"amount_refunded"`

	// On a PAYMENT: how much was involuntarily clawed back (chargeback, bank recall, lost
	// dispute). This is what the invoice nets out, reopening it.
	AmountReversed int64 `json:"amount_reversed"`

	CreditNoteID *CreditNoteID `json:"credit_note_id,omitempty"`

	Currency string `json:"currency"`

	Error *string `json:"error,omitempty"`

	ID PaymentTransactionID `json:"id"`

	ParentTransactionID *PaymentTransactionID `json:"parent_transaction_id,omitempty"`

	PaymentMethodID *CustomerPaymentMethodID `json:"payment_method_id,omitempty"`

	PaymentMethodInfo *PaymentMethodInfo `json:"payment_method_info,omitempty"`

	PaymentType PaymentTypeEnum `json:"payment_type"`

	// RFC 3339 timestamp.
	ProcessedAt *time.Time `json:"processed_at,omitempty"`

	ProviderTransactionID *string `json:"provider_transaction_id,omitempty"`

	RefundMode *RefundMode `json:"refund_mode,omitempty"`

	ReversalKind *ReversalKind `json:"reversal_kind,omitempty"`

	// The provider's raw cause, or what the operator typed when reversing by hand.
	ReversalReason *string `json:"reversal_reason,omitempty"`

	Status PaymentStatusEnum `json:"status"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

Transaction is the Transaction object of the Meteroid API.

func (Transaction) MarshalJSON ¶

func (v Transaction) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*Transaction) UnmarshalJSON ¶

func (v *Transaction) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type TransportError ¶

type TransportError struct {
	Method string
	Path   string
	Err    error
}

TransportError is returned when no response was received: the connection failed or the call was canceled. A timeout is a *TimeoutError instead.

func (*TransportError) Error ¶

func (e *TransportError) Error() string

func (*TransportError) Unwrap ¶

func (e *TransportError) Unwrap() error

type TrialConfig ¶

type TrialConfig struct {
	DurationDays int32 `json:"duration_days"`

	IsFree bool `json:"is_free"`

	TrialingPlanID *PlanID `json:"trialing_plan_id,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

TrialConfig is the TrialConfig object of the Meteroid API.

func (TrialConfig) MarshalJSON ¶

func (v TrialConfig) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*TrialConfig) UnmarshalJSON ¶

func (v *TrialConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type UnionError ¶

type UnionError struct {
	Union         string
	Discriminator string
	Reason        string
}

UnionError reports a tagged union that could not be encoded.

func (*UnionError) Error ¶

func (e *UnionError) Error() string

type UnitConversion ¶

type UnitConversion struct {
	Factor int32 `json:"factor"`

	Rounding UnitConversionRoundingEnum `json:"rounding"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

UnitConversion is the UnitConversion object of the Meteroid API.

func (UnitConversion) MarshalJSON ¶

func (v UnitConversion) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*UnitConversion) UnmarshalJSON ¶

func (v *UnitConversion) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type UnitConversionRoundingEnum ¶

type UnitConversionRoundingEnum string

UnitConversionRoundingEnum is one of AllUnitConversionRoundingEnumValues, or a value this SDK version does not know.

const (
	UnitConversionRoundingEnumUp            UnitConversionRoundingEnum = "UP"
	UnitConversionRoundingEnumDown          UnitConversionRoundingEnum = "DOWN"
	UnitConversionRoundingEnumNearest       UnitConversionRoundingEnum = "NEAREST"
	UnitConversionRoundingEnumNearestHalf   UnitConversionRoundingEnum = "NEAREST_HALF"
	UnitConversionRoundingEnumNearestDecile UnitConversionRoundingEnum = "NEAREST_DECILE"
	UnitConversionRoundingEnumNone          UnitConversionRoundingEnum = "NONE"
)

Known values of UnitConversionRoundingEnum.

The API may add new values over time; unknown values round-trip unchanged.

func (UnitConversionRoundingEnum) IsKnown ¶

func (e UnitConversionRoundingEnum) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (UnitConversionRoundingEnum) String ¶

String returns the wire representation of the value.

type UpdateAddOnRequest ¶

type UpdateAddOnRequest struct {
	Description *Nullable[string] `json:"description,omitempty"`

	MaxInstancesPerSubscription *Nullable[int32] `json:"max_instances_per_subscription,omitempty"`

	Name *Nullable[string] `json:"name,omitempty"`

	PriceID *Nullable[PriceID] `json:"price_id,omitempty"`

	SelfServiceable *Nullable[bool] `json:"self_serviceable,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

UpdateAddOnRequest is the UpdateAddOnRequest object of the Meteroid API.

func (UpdateAddOnRequest) MarshalJSON ¶

func (v UpdateAddOnRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*UpdateAddOnRequest) UnmarshalJSON ¶

func (v *UpdateAddOnRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type UpdateCouponRequest ¶

type UpdateCouponRequest struct {
	Description *Nullable[string] `json:"description,omitempty"`

	Discount *Nullable[CouponDiscount] `json:"discount,omitempty"`

	PlanIDs *Nullable[[]PlanID] `json:"plan_ids,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

UpdateCouponRequest is the UpdateCouponRequest object of the Meteroid API.

func (UpdateCouponRequest) MarshalJSON ¶

func (v UpdateCouponRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*UpdateCouponRequest) UnmarshalJSON ¶

func (v *UpdateCouponRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type UpdateEntitlementRequest ¶

type UpdateEntitlementRequest struct {
	Value *Nullable[EntitlementValue] `json:"value,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

UpdateEntitlementRequest is the UpdateEntitlementRequest object of the Meteroid API.

func (UpdateEntitlementRequest) MarshalJSON ¶

func (v UpdateEntitlementRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*UpdateEntitlementRequest) UnmarshalJSON ¶

func (v *UpdateEntitlementRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type UpdateFeatureRequest ¶

type UpdateFeatureRequest struct {
	// Omit to leave unchanged; send `null` to clear.
	Description *Nullable[string] `json:"description,omitempty"`

	Name *Nullable[string] `json:"name,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

UpdateFeatureRequest is the UpdateFeatureRequest object of the Meteroid API.

Partial update. Code, feature type and product are immutable.

func (UpdateFeatureRequest) MarshalJSON ¶

func (v UpdateFeatureRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*UpdateFeatureRequest) UnmarshalJSON ¶

func (v *UpdateFeatureRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type UpdateMetricRequest ¶

type UpdateMetricRequest struct {
	Description *Nullable[string] `json:"description,omitempty"`

	// Absent = leave filters untouched; present (even empty) = replace them.
	Filters *Nullable[[]MetricFilter] `json:"filters,omitempty"`

	Name *Nullable[string] `json:"name,omitempty"`

	SegmentationMatrix *Nullable[MetricSegmentationMatrix] `json:"segmentation_matrix,omitempty"`

	UnitConversion *Nullable[UnitConversion] `json:"unit_conversion,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

UpdateMetricRequest is the UpdateMetricRequest object of the Meteroid API.

func (UpdateMetricRequest) MarshalJSON ¶

func (v UpdateMetricRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*UpdateMetricRequest) UnmarshalJSON ¶

func (v *UpdateMetricRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type UpdateProductRequest ¶

type UpdateProductRequest struct {
	Description *Nullable[string] `json:"description,omitempty"`

	FeeStructure *Nullable[ProductFeeStructure] `json:"fee_structure,omitempty"`

	Name *Nullable[string] `json:"name,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

UpdateProductRequest is the UpdateProductRequest object of the Meteroid API.

func (UpdateProductRequest) MarshalJSON ¶

func (v UpdateProductRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*UpdateProductRequest) UnmarshalJSON ¶

func (v *UpdateProductRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type UpdateWebhookEndpointRequest ¶ added in v0.30.0

type UpdateWebhookEndpointRequest struct {
	// Omit to leave unchanged; send `null` or an empty string to clear.
	Description *Nullable[string] `json:"description,omitempty"`

	// Re-enabling an endpoint also resets its consecutive failure count.
	Disabled *Nullable[bool] `json:"disabled,omitempty"`

	// Replaces the subscription list. An empty array subscribes to every event type.
	EventTypes *Nullable[[]string] `json:"event_types,omitempty"`

	// Replaces the custom header list. An empty array removes every header.
	Headers *Nullable[[]WebhookHeaderInput] `json:"headers,omitempty"`

	// Omit to leave unchanged; send `null` to remove the rate limit.
	RateLimitPerSec *Nullable[int32] `json:"rate_limit_per_sec,omitempty"`

	URL *Nullable[string] `json:"url,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

UpdateWebhookEndpointRequest is the UpdateWebhookEndpointRequest object of the Meteroid API.

func (UpdateWebhookEndpointRequest) MarshalJSON ¶ added in v0.30.0

func (v UpdateWebhookEndpointRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*UpdateWebhookEndpointRequest) UnmarshalJSON ¶ added in v0.30.0

func (v *UpdateWebhookEndpointRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type Upload ¶

type Upload struct {
	Reader      io.Reader
	Filename    string
	ContentType string
}

Upload is a multipart file. Readers implementing io.Seeker are rewound for retries; other readers are sent once.

type Usage ¶

type Usage struct {
	// contains filtered or unexported fields
}

Usage groups the usage operations of the Meteroid API.

func (*Usage) RetrieveCustomer ¶

func (a *Usage) RetrieveCustomer(ctx context.Context, customerID string, startDate Date, endDate Date, options *UsageRetrieveCustomerOptions, opts ...RequestOption) (*UsageResponse, error)

RetrieveCustomer sends GET /api/v1/usage/customer/{customer_id}.

Get customer usage ¶

Retrieve aggregated usage data for a customer over a specified period.

func (*Usage) RetrieveSubscription ¶

func (a *Usage) RetrieveSubscription(ctx context.Context, subscriptionID string, options *UsageRetrieveSubscriptionOptions, opts ...RequestOption) (*UsageResponse, error)

RetrieveSubscription sends GET /api/v1/usage/subscription/{subscription_id}.

Get subscription usage ¶

Retrieve aggregated usage data for a subscription's usage-based components. If start_date/end_date are omitted, defaults to the current billing period.

func (*Usage) RetrieveSummary ¶

func (a *Usage) RetrieveSummary(ctx context.Context, startDate Date, endDate Date, options *UsageRetrieveSummaryOptions, opts ...RequestOption) (*UsageResponse, error)

RetrieveSummary sends GET /api/v1/usage/summary.

Get usage summary ¶

Retrieve aggregated usage data across all customers for the tenant.

type UsageFee ¶

type UsageFee struct {
	MetricID BillableMetricID `json:"metric_id"`

	Model UsagePricingModel `json:"model"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

UsageFee is the UsageFee object of the Meteroid API.

func (UsageFee) MarshalJSON ¶

func (v UsageFee) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*UsageFee) UnmarshalJSON ¶

func (v *UsageFee) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type UsageFeeStructure ¶

type UsageFeeStructure struct {
	MetricID BillableMetricID `json:"metric_id"`

	Model UsageModelEnum `json:"model"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

UsageFeeStructure is the UsageFeeStructure object of the Meteroid API.

func (UsageFeeStructure) MarshalJSON ¶

func (v UsageFeeStructure) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*UsageFeeStructure) UnmarshalJSON ¶

func (v *UsageFeeStructure) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type UsageModelEnum ¶

type UsageModelEnum string

UsageModelEnum is one of AllUsageModelEnumValues, or a value this SDK version does not know.

const (
	UsageModelEnumPerUnit UsageModelEnum = "PER_UNIT"
	UsageModelEnumTiered  UsageModelEnum = "TIERED"
	UsageModelEnumVolume  UsageModelEnum = "VOLUME"
	UsageModelEnumPackage UsageModelEnum = "PACKAGE"
	UsageModelEnumMatrix  UsageModelEnum = "MATRIX"
)

Known values of UsageModelEnum.

The API may add new values over time; unknown values round-trip unchanged.

func (UsageModelEnum) IsKnown ¶

func (e UsageModelEnum) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (UsageModelEnum) String ¶

func (e UsageModelEnum) String() string

String returns the wire representation of the value.

type UsagePlanFee ¶

type UsagePlanFee struct {
	Cadence BillingPeriodEnum `json:"cadence"`

	MetricID BillableMetricID `json:"metric_id"`

	Pricing PlanUsagePricingModel `json:"pricing"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

UsagePlanFee is the UsagePlanFee object of the Meteroid API.

Usage-based fee

func (UsagePlanFee) MarshalJSON ¶

func (v UsagePlanFee) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*UsagePlanFee) UnmarshalJSON ¶

func (v *UsagePlanFee) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type UsagePricing ¶

type UsagePricing struct {
	Model UsagePricingModel `json:"model"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

UsagePricing is the UsagePricing object of the Meteroid API.

func (UsagePricing) MarshalJSON ¶

func (v UsagePricing) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*UsagePricing) UnmarshalJSON ¶

func (v *UsagePricing) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type UsagePricingModel ¶

type UsagePricingModel struct {
	// Type selects the active variant. Compare it against the
	// UsagePricingModel* constants.
	Type UsagePricingModelType `json:"type"`

	// PerUnit is set when Type is UsagePricingModelPerUnit.
	PerUnit *PerUnitPricing `json:"-"`
	// Tiered is set when Type is UsagePricingModelTiered.
	Tiered *TieredPricing `json:"-"`
	// Volume is set when Type is UsagePricingModelVolume.
	Volume *VolumePricing `json:"-"`
	// Package is set when Type is UsagePricingModelPackage.
	Package *PackagePricing `json:"-"`
	// Matrix is set when Type is UsagePricingModelMatrix.
	Matrix *MatrixPricing `json:"-"`
	// contains filtered or unexported fields
}

UsagePricingModel is a tagged union discriminated by the type field.

When UsagePricingModel.IsKnown reports true, exactly one variant pointer is set, matching Type. A variant added to the API after this SDK version was released still decodes without error, but with every variant pointer nil: always give a `switch` on Type a `default:` branch (or check IsKnown first) instead of dereferencing a pointer unconditionally. The unknown variant's JSON is available from UsagePricingModel.Raw.

func NewUsagePricingModelMatrix ¶

func NewUsagePricingModelMatrix(value MatrixPricing) UsagePricingModel

NewUsagePricingModelMatrix builds a UsagePricingModel holding the MATRIX variant.

func NewUsagePricingModelPackage ¶

func NewUsagePricingModelPackage(value PackagePricing) UsagePricingModel

NewUsagePricingModelPackage builds a UsagePricingModel holding the PACKAGE variant.

func NewUsagePricingModelPerUnit ¶

func NewUsagePricingModelPerUnit(value PerUnitPricing) UsagePricingModel

NewUsagePricingModelPerUnit builds a UsagePricingModel holding the PER_UNIT variant.

func NewUsagePricingModelTiered ¶

func NewUsagePricingModelTiered(value TieredPricing) UsagePricingModel

NewUsagePricingModelTiered builds a UsagePricingModel holding the TIERED variant.

func NewUsagePricingModelVolume ¶

func NewUsagePricingModelVolume(value VolumePricing) UsagePricingModel

NewUsagePricingModelVolume builds a UsagePricingModel holding the VOLUME variant.

func (UsagePricingModel) IsKnown ¶

func (u UsagePricingModel) IsKnown() bool

IsKnown reports whether Type is one of the variants this SDK version knows about, i.e. one of the UsagePricingModel* constants. It is false for a variant added to the API later, whose payload is then only available from UsagePricingModel.Raw.

func (UsagePricingModel) MarshalJSON ¶

func (u UsagePricingModel) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (UsagePricingModel) Raw ¶

Raw returns the JSON of a variant this SDK version does not know about, as decoded (see UsagePricingModel.IsKnown). It is nil for a known variant, and for a value that was not decoded from JSON. The returned slice is a copy.

func (*UsagePricingModel) UnmarshalJSON ¶

func (u *UsagePricingModel) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Payloads carrying an unrecognized discriminator are kept rather than rejected, so a newer API version does not break older SDK builds. Re-encoding such a value reproduces the same JSON document, though not necessarily the same bytes: `encoding/json` compacts whitespace and escapes `<`, `>` and `&`.

type UsagePricingModelType ¶

type UsagePricingModelType string

UsagePricingModelType is the type of an UsagePricingModel, one of the UsagePricingModel* constants for a variant this SDK version knows.

const (
	UsagePricingModelPerUnit UsagePricingModelType = "PER_UNIT"
	UsagePricingModelTiered  UsagePricingModelType = "TIERED"
	UsagePricingModelVolume  UsagePricingModelType = "VOLUME"
	UsagePricingModelPackage UsagePricingModelType = "PACKAGE"
	UsagePricingModelMatrix  UsagePricingModelType = "MATRIX"
)

Discriminator values for UsagePricingModel.

type UsageResponse ¶

type UsageResponse struct {
	PeriodEnd Date `json:"period_end"`

	PeriodStart Date `json:"period_start"`

	Usage RequiredSlice[MetricUsage] `json:"usage"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

UsageResponse is the UsageResponse object of the Meteroid API.

func (UsageResponse) MarshalJSON ¶

func (v UsageResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*UsageResponse) UnmarshalJSON ¶

func (v *UsageResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type UsageRetrieveCustomerOptions ¶

type UsageRetrieveCustomerOptions struct {
	MetricID *BillableMetricID
}

UsageRetrieveCustomerOptions carries the optional query and header parameters of Usage.RetrieveCustomer. Leave a field nil to omit it.

type UsageRetrieveSubscriptionOptions ¶

type UsageRetrieveSubscriptionOptions struct {
	StartDate *Date

	EndDate *Date

	MetricID *BillableMetricID
}

UsageRetrieveSubscriptionOptions carries the optional query and header parameters of Usage.RetrieveSubscription. Leave a field nil to omit it.

type UsageRetrieveSummaryOptions ¶

type UsageRetrieveSummaryOptions struct {
	MetricID *BillableMetricID
}

UsageRetrieveSummaryOptions carries the optional query and header parameters of Usage.RetrieveSummary. Leave a field nil to omit it.

type VolumePlanPricing ¶

type VolumePlanPricing struct {
	BlockSize *int64 `json:"block_size,omitempty"`

	Tiers RequiredSlice[TierRow] `json:"tiers"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

VolumePlanPricing is the VolumePlanPricing object of the Meteroid API.

func (VolumePlanPricing) MarshalJSON ¶

func (v VolumePlanPricing) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*VolumePlanPricing) UnmarshalJSON ¶

func (v *VolumePlanPricing) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type VolumePricing ¶

type VolumePricing struct {
	BlockSize *int64 `json:"block_size,omitempty"`

	Tiers RequiredSlice[TierRow] `json:"tiers"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

VolumePricing is the VolumePricing object of the Meteroid API.

func (VolumePricing) MarshalJSON ¶

func (v VolumePricing) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*VolumePricing) UnmarshalJSON ¶

func (v *VolumePricing) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type Webhook ¶ added in v0.27.1

type Webhook struct {
	// contains filtered or unexported fields
}

Webhook verifies and signs webhook payloads following the Standard Webhooks specification (https://www.standardwebhooks.com). The legacy svix-* headers are accepted too; the webhook-* ones win when both are present.

wh, err := meteroid.NewWebhook(os.Getenv("WEBHOOK_SECRET"))
if err != nil {
	return err
}
if err := wh.Verify(body, r.Header); err != nil {
	http.Error(w, "invalid signature", http.StatusBadRequest)
	return
}

func NewWebhook ¶ added in v0.27.1

func NewWebhook(secret string) (*Webhook, error)

NewWebhook builds a verifier from the signing secret: base64, with or without the "whsec_" prefix.

func NewWebhookRaw ¶ added in v0.27.1

func NewWebhookRaw(key []byte) *Webhook

NewWebhookRaw builds a verifier from an already decoded signing key.

func (*Webhook) Sign ¶ added in v0.27.1

func (w *Webhook) Sign(msgID string, timestamp time.Time, payload []byte) string

Sign returns the value of the webhook-signature header for a payload.

func (*Webhook) Verify ¶ added in v0.27.1

func (w *Webhook) Verify(payload []byte, headers http.Header) error

Verify checks a payload's signature and that it was signed within WebhookTolerance. payload must be the exact request body, before any parsing.

type WebhookDelivery ¶ added in v0.30.0

type WebhookDelivery struct {
	AttemptCount int32 `json:"attempt_count"`

	// RFC 3339 timestamp.
	CompletedAt *time.Time `json:"completed_at,omitempty"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	EndpointID WebhookEndpointID `json:"endpoint_id"`

	EventType string `json:"event_type"`

	ID WebhookDeliveryID `json:"id"`

	LastError *string `json:"last_error,omitempty"`

	LastResponseStatus *int32 `json:"last_response_status,omitempty"`

	// True when the delivery was created by a resend or a test event.
	Manual bool `json:"manual"`

	MessageID EventID `json:"message_id"`

	// RFC 3339 timestamp.
	NextAttemptAt *time.Time `json:"next_attempt_at,omitempty"`

	Status WebhookDeliveryStatus `json:"status"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

WebhookDelivery is the WebhookDelivery object of the Meteroid API.

One event queued for one endpoint, with the state of its retry cycle.

func (WebhookDelivery) MarshalJSON ¶ added in v0.30.0

func (v WebhookDelivery) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*WebhookDelivery) UnmarshalJSON ¶ added in v0.30.0

func (v *WebhookDelivery) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type WebhookDeliveryID ¶ added in v0.30.0

type WebhookDeliveryID = string

WebhookDeliveryID is the WebhookDeliveryId string of the Meteroid API.

type WebhookDeliveryListResponse ¶ added in v0.30.0

type WebhookDeliveryListResponse struct {
	Data RequiredSlice[WebhookDelivery] `json:"data"`

	PaginationMeta PaginationResponse `json:"pagination_meta"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

WebhookDeliveryListResponse is the WebhookDeliveryListResponse object of the Meteroid API.

func (WebhookDeliveryListResponse) MarshalJSON ¶ added in v0.30.0

func (v WebhookDeliveryListResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*WebhookDeliveryListResponse) UnmarshalJSON ¶ added in v0.30.0

func (v *WebhookDeliveryListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type WebhookDeliveryStatus ¶ added in v0.30.0

type WebhookDeliveryStatus string

WebhookDeliveryStatus is one of AllWebhookDeliveryStatusValues, or a value this SDK version does not know.

const (
	WebhookDeliveryStatusPending   WebhookDeliveryStatus = "PENDING"
	WebhookDeliveryStatusInFlight  WebhookDeliveryStatus = "IN_FLIGHT"
	WebhookDeliveryStatusSucceeded WebhookDeliveryStatus = "SUCCEEDED"
	WebhookDeliveryStatusFailed    WebhookDeliveryStatus = "FAILED"
	WebhookDeliveryStatusCancelled WebhookDeliveryStatus = "CANCELLED"
)

Known values of WebhookDeliveryStatus.

The API may add new values over time; unknown values round-trip unchanged.

func (WebhookDeliveryStatus) IsKnown ¶ added in v0.30.0

func (e WebhookDeliveryStatus) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (WebhookDeliveryStatus) String ¶ added in v0.30.0

func (e WebhookDeliveryStatus) String() string

String returns the wire representation of the value.

type WebhookEndpoint ¶ added in v0.30.0

type WebhookEndpoint struct {
	// Failures since the last success, reset to 0 on any 2xx.
	ConsecutiveFailures int32 `json:"consecutive_failures"`

	// RFC 3339 timestamp.
	CreatedAt time.Time `json:"created_at"`

	Description *string `json:"description,omitempty"`

	Disabled bool `json:"disabled"`

	DisabledReason *WebhookEndpointDisabledReason `json:"disabled_reason,omitempty"`

	// Subscribed event types. Empty means every event type.
	EventTypes RequiredSlice[string] `json:"event_types"`

	// Custom headers sent with every delivery.
	Headers RequiredSlice[WebhookHeader] `json:"headers"`

	ID WebhookEndpointID `json:"id"`

	// RFC 3339 timestamp.
	LastFailureAt *time.Time `json:"last_failure_at,omitempty"`

	// RFC 3339 timestamp.
	LastSuccessAt *time.Time `json:"last_success_at,omitempty"`

	// How many deliveries this endpoint may have in flight at once. Read-only; it is
	// set from the tenant's environment when the endpoint is created.
	MaxInFlight int32 `json:"max_in_flight"`

	// A sensitive header still waits for its value; the endpoint cannot be enabled
	// until it is set.
	NeedsSetup bool `json:"needs_setup"`

	// The endpoint was unreachable several times in a row: nothing is sent before
	// this time, then it is retried one delivery at a time until it answers again.
	// RFC 3339 timestamp.
	PausedUntil *time.Time `json:"paused_until,omitempty"`

	// Deliveries started per second, at most.
	RateLimitPerSec *int32 `json:"rate_limit_per_sec,omitempty"`

	// RFC 3339 timestamp.
	UpdatedAt *time.Time `json:"updated_at,omitempty"`

	URL string `json:"url"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

WebhookEndpoint is the WebhookEndpoint object of the Meteroid API.

A destination Meteroid POSTs signed event payloads to.

func (WebhookEndpoint) MarshalJSON ¶ added in v0.30.0

func (v WebhookEndpoint) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*WebhookEndpoint) UnmarshalJSON ¶ added in v0.30.0

func (v *WebhookEndpoint) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type WebhookEndpointDisabledReason ¶ added in v0.30.0

type WebhookEndpointDisabledReason string

WebhookEndpointDisabledReason is one of AllWebhookEndpointDisabledReasonValues, or a value this SDK version does not know.

const (
	WebhookEndpointDisabledReasonManual       WebhookEndpointDisabledReason = "MANUAL"
	WebhookEndpointDisabledReasonAutoFailures WebhookEndpointDisabledReason = "AUTO_FAILURES"
	WebhookEndpointDisabledReasonGone         WebhookEndpointDisabledReason = "GONE"
)

Known values of WebhookEndpointDisabledReason.

The API may add new values over time; unknown values round-trip unchanged.

func (WebhookEndpointDisabledReason) IsKnown ¶ added in v0.30.0

func (e WebhookEndpointDisabledReason) IsKnown() bool

IsKnown reports whether the value is one this SDK version knows about.

func (WebhookEndpointDisabledReason) String ¶ added in v0.30.0

String returns the wire representation of the value.

type WebhookEndpointID ¶ added in v0.30.0

type WebhookEndpointID = string

WebhookEndpointID is the WebhookEndpointId string of the Meteroid API.

type WebhookEndpointListResponse ¶ added in v0.30.0

type WebhookEndpointListResponse struct {
	Data RequiredSlice[WebhookEndpoint] `json:"data"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

WebhookEndpointListResponse is the WebhookEndpointListResponse object of the Meteroid API.

func (WebhookEndpointListResponse) MarshalJSON ¶ added in v0.30.0

func (v WebhookEndpointListResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*WebhookEndpointListResponse) UnmarshalJSON ¶ added in v0.30.0

func (v *WebhookEndpointListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type WebhookEndpointSecret ¶ added in v0.30.0

type WebhookEndpointSecret struct {
	Secret string `json:"secret"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

WebhookEndpointSecret is the WebhookEndpointSecret object of the Meteroid API.

func (WebhookEndpointSecret) MarshalJSON ¶ added in v0.30.0

func (v WebhookEndpointSecret) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*WebhookEndpointSecret) UnmarshalJSON ¶ added in v0.30.0

func (v *WebhookEndpointSecret) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type WebhookEndpoints ¶ added in v0.30.0

type WebhookEndpoints struct {
	// contains filtered or unexported fields
}

WebhookEndpoints groups the webhook endpoints operations of the Meteroid API.

func (*WebhookEndpoints) Endpoints ¶ added in v0.30.0

Endpoints returns the endpoints API.

func (*WebhookEndpoints) ResendWebhookDelivery ¶ added in v0.30.0

func (a *WebhookEndpoints) ResendWebhookDelivery(ctx context.Context, deliveryID string, opts ...RequestOption) (*WebhookDelivery, error)

ResendWebhookDelivery sends POST /api/v1/webhooks/deliveries/{delivery_id}/resend.

Resend a webhook delivery ¶

Re-queues the same event for the same endpoint. Fails if the endpoint is disabled.

type WebhookEndpointsEndpoints ¶ added in v0.30.0

type WebhookEndpointsEndpoints struct {
	// contains filtered or unexported fields
}

WebhookEndpointsEndpoints groups the webhook endpoints endpoints operations of the Meteroid API.

func (*WebhookEndpointsEndpoints) Create ¶ added in v0.30.0

func (a *WebhookEndpointsEndpoints) Create(ctx context.Context, createWebhookEndpointRequest CreateWebhookEndpointRequest, opts ...RequestOption) (*CreatedWebhookEndpoint, error)

Create a webhook endpoint

The signing secret is returned once, in this response only.

func (*WebhookEndpointsEndpoints) Delete ¶ added in v0.30.0

func (a *WebhookEndpointsEndpoints) Delete(ctx context.Context, endpointID string, opts ...RequestOption) error

Delete a webhook endpoint

The endpoint is archived and its pending deliveries are cancelled.

func (*WebhookEndpointsEndpoints) List ¶ added in v0.30.0

List webhook endpoints

func (*WebhookEndpointsEndpoints) ListDeliveries ¶ added in v0.30.0

ListDeliveries sends GET /api/v1/webhooks/endpoints/{endpoint_id}/deliveries and returns the first page of results.

List deliveries for a webhook endpoint ¶

WebhookEndpointsEndpoints.ListDeliveriesAutoPaging iterates over every item instead.

func (*WebhookEndpointsEndpoints) ListDeliveriesAutoPaging ¶ added in v0.30.0

ListDeliveriesAutoPaging iterates over every item of WebhookEndpointsEndpoints.ListDeliveries, fetching further pages on demand.

func (*WebhookEndpointsEndpoints) Retrieve ¶ added in v0.30.0

func (a *WebhookEndpointsEndpoints) Retrieve(ctx context.Context, endpointID string, opts ...RequestOption) (*WebhookEndpoint, error)

Retrieve sends GET /api/v1/webhooks/endpoints/{endpoint_id}.

Get a webhook endpoint

func (*WebhookEndpointsEndpoints) RetrieveSecret ¶ added in v0.30.0

func (a *WebhookEndpointsEndpoints) RetrieveSecret(ctx context.Context, endpointID string, opts ...RequestOption) (*WebhookEndpointSecret, error)

RetrieveSecret sends GET /api/v1/webhooks/endpoints/{endpoint_id}/secret.

Reveal a webhook endpoint secret

func (*WebhookEndpointsEndpoints) RotateSecret ¶ added in v0.30.0

func (a *WebhookEndpointsEndpoints) RotateSecret(ctx context.Context, endpointID string, opts ...RequestOption) (*WebhookEndpointSecret, error)

RotateSecret sends POST /api/v1/webhooks/endpoints/{endpoint_id}/rotate-secret.

Rotate a webhook endpoint secret ¶

The previous secret keeps signing alongside the new one for 24 hours, so consumers can roll over without dropping events.

func (*WebhookEndpointsEndpoints) Update ¶ added in v0.30.0

func (a *WebhookEndpointsEndpoints) Update(ctx context.Context, endpointID string, updateWebhookEndpointRequest UpdateWebhookEndpointRequest, opts ...RequestOption) (*WebhookEndpoint, error)

Update a webhook endpoint

Omitted fields are left untouched. Re-enabling a disabled endpoint resets its consecutive failure count.

type WebhookEndpointsEndpointsListDeliveriesOptions ¶ added in v0.30.0

type WebhookEndpointsEndpointsListDeliveriesOptions struct {
	// Only return deliveries in this state.
	Status *WebhookDeliveryStatus

	// Page number (0-indexed)
	Page *int32

	// Number of items per page
	PerPage *int32
}

WebhookEndpointsEndpointsListDeliveriesOptions carries the optional query and header parameters of WebhookEndpointsEndpoints.ListDeliveries. Leave a field nil to omit it.

type WebhookEndpointsEndpointsListDeliveriesPage ¶ added in v0.30.0

type WebhookEndpointsEndpointsListDeliveriesPage struct {
	WebhookDeliveryListResponse

	// Items holds the items of this page.
	Items []WebhookDelivery
	// contains filtered or unexported fields
}

WebhookEndpointsEndpointsListDeliveriesPage is a page of WebhookEndpointsEndpoints.ListDeliveries. It embeds the decoded WebhookDeliveryListResponse, promoting its fields, with the Items of the page; a field named like a page member stays reachable through the embedded WebhookDeliveryListResponse.

func (*WebhookEndpointsEndpointsListDeliveriesPage) HasNextPage ¶ added in v0.30.0

HasNextPage reports whether another page follows this one.

func (WebhookEndpointsEndpointsListDeliveriesPage) MarshalJSON ¶ added in v0.30.0

MarshalJSON encodes the WebhookDeliveryListResponse of the page, as received.

func (*WebhookEndpointsEndpointsListDeliveriesPage) NextPage ¶ added in v0.30.0

NextPage fetches the page after this one. It returns nil and no error after the last page.

type WebhookHeader ¶ added in v0.30.0

type WebhookHeader struct {
	Name string `json:"name"`

	Sensitive bool `json:"sensitive"`

	Set bool `json:"set"`

	Value *string `json:"value,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

WebhookHeader is the WebhookHeader object of the Meteroid API.

A custom header sent with every delivery. A sensitive header never returns its value; `set` says whether it has one.

func (WebhookHeader) MarshalJSON ¶ added in v0.30.0

func (v WebhookHeader) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*WebhookHeader) UnmarshalJSON ¶ added in v0.30.0

func (v *WebhookHeader) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

type WebhookHeaderInput ¶ added in v0.30.0

type WebhookHeaderInput struct {
	Name string `json:"name"`

	Sensitive *bool `json:"sensitive,omitempty"`

	Value *string `json:"value,omitempty"`

	// ExtraFields holds the properties this SDK version does not know, as
	// decoded, and sends them along when encoding.
	ExtraFields map[string]json.RawMessage `json:"-"`
}

WebhookHeaderInput is the WebhookHeaderInput object of the Meteroid API.

A custom header to send with every delivery. A sensitive header is write-only: it is never returned, and on update sending it without a value keeps its value.

func (WebhookHeaderInput) MarshalJSON ¶ added in v0.30.0

func (v WebhookHeaderInput) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, sending ExtraFields along.

func (*WebhookHeaderInput) UnmarshalJSON ¶ added in v0.30.0

func (v *WebhookHeaderInput) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, keeping unknown properties in ExtraFields.

Source Files ¶

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL