@openmeter/client 1.0.0-beta-5ecf67135706 → 1.0.0-beta-c817ba7663ad
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/funcs/subscriptions.d.ts +2 -1
- package/dist/funcs/subscriptions.js +8 -0
- package/dist/index.d.ts +1 -1
- package/dist/models/operations/subscriptions.d.ts +6 -1
- package/dist/models/schemas.d.ts +1349 -706
- package/dist/models/schemas.js +202 -159
- package/dist/models/types.d.ts +415 -323
- package/dist/sdk/subscriptions.d.ts +2 -1
- package/dist/sdk/subscriptions.js +4 -1
- package/package.json +1 -1
package/dist/models/schemas.js
CHANGED
|
@@ -469,6 +469,27 @@ export const subscriptionStatus = z
|
|
|
469
469
|
export const subscriptionEditTimingEnum = z
|
|
470
470
|
.enum(['immediate', 'next_billing_cycle'])
|
|
471
471
|
.describe('Subscription edit timing. When immediate, the requested changes take effect immediately. When next_billing_cycle, the requested changes take effect at the next billing cycle.');
|
|
472
|
+
export const unitConfigOperation = z
|
|
473
|
+
.enum(['divide', 'multiply'])
|
|
474
|
+
.describe('The arithmetic operation used to convert raw metered units into billing units. - `divide`: Divide the metered quantity by the conversion factor (e.g., bytes ÷ 1e9 = GB). - `multiply`: Multiply the metered quantity by the conversion factor (e.g., cost × 1.2 = cost + 20% margin).');
|
|
475
|
+
export const unitConfigRoundingMode = z
|
|
476
|
+
.enum(['ceiling', 'floor', 'half_up', 'none'])
|
|
477
|
+
.describe('The rounding mode applied to the converted quantity for invoicing. Rounding is applied only to the invoiced quantity. Entitlement balance checks use the precise decimal value after conversion. - `ceiling`: Round up to the next integer (typical for package-style billing). - `floor`: Round down to the previous integer. - `half_up`: Round to the nearest integer, with 0.5 rounding up. - `none`: No rounding; the converted value is used as-is.');
|
|
478
|
+
export const rateCardStaticEntitlement = z
|
|
479
|
+
.object({
|
|
480
|
+
type: z.literal('static').describe('The type of the entitlement template.'),
|
|
481
|
+
config: z
|
|
482
|
+
.unknown()
|
|
483
|
+
.describe('The entitlement config as a JSON object. Returned when checking entitlement access; useful for configuring fine-grained access settings implemented in your own system.'),
|
|
484
|
+
})
|
|
485
|
+
.describe('The entitlement template of a static entitlement.');
|
|
486
|
+
export const rateCardBooleanEntitlement = z
|
|
487
|
+
.object({
|
|
488
|
+
type: z
|
|
489
|
+
.literal('boolean')
|
|
490
|
+
.describe('The type of the entitlement template.'),
|
|
491
|
+
})
|
|
492
|
+
.describe('The entitlement template of a boolean entitlement.');
|
|
472
493
|
export const appType = z
|
|
473
494
|
.enum(['sandbox', 'stripe', 'external_invoicing'])
|
|
474
495
|
.describe('The type of the app.');
|
|
@@ -619,27 +640,6 @@ export const llmCostPriceSource = z
|
|
|
619
640
|
export const planStatus = z
|
|
620
641
|
.enum(['draft', 'active', 'archived', 'scheduled'])
|
|
621
642
|
.describe('The status of a plan. - `draft`: The plan has not yet been published and can be edited. - `active`: The plan is published and can be used in subscriptions. - `archived`: The plan is no longer available for use. - `scheduled`: The plan is scheduled to be published at a future date.');
|
|
622
|
-
export const unitConfigOperation = z
|
|
623
|
-
.enum(['divide', 'multiply'])
|
|
624
|
-
.describe('The arithmetic operation used to convert raw metered units into billing units. - `divide`: Divide the metered quantity by the conversion factor (e.g., bytes ÷ 1e9 = GB). - `multiply`: Multiply the metered quantity by the conversion factor (e.g., cost × 1.2 = cost + 20% margin).');
|
|
625
|
-
export const unitConfigRoundingMode = z
|
|
626
|
-
.enum(['ceiling', 'floor', 'half_up', 'none'])
|
|
627
|
-
.describe('The rounding mode applied to the converted quantity for invoicing. Rounding is applied only to the invoiced quantity. Entitlement balance checks use the precise decimal value after conversion. - `ceiling`: Round up to the next integer (typical for package-style billing). - `floor`: Round down to the previous integer. - `half_up`: Round to the nearest integer, with 0.5 rounding up. - `none`: No rounding; the converted value is used as-is.');
|
|
628
|
-
export const rateCardStaticEntitlement = z
|
|
629
|
-
.object({
|
|
630
|
-
type: z.literal('static').describe('The type of the entitlement template.'),
|
|
631
|
-
config: z
|
|
632
|
-
.unknown()
|
|
633
|
-
.describe('The entitlement config as a JSON object. Returned when checking entitlement access; useful for configuring fine-grained access settings implemented in your own system.'),
|
|
634
|
-
})
|
|
635
|
-
.describe('The entitlement template of a static entitlement.');
|
|
636
|
-
export const rateCardBooleanEntitlement = z
|
|
637
|
-
.object({
|
|
638
|
-
type: z
|
|
639
|
-
.literal('boolean')
|
|
640
|
-
.describe('The type of the entitlement template.'),
|
|
641
|
-
})
|
|
642
|
-
.describe('The entitlement template of a boolean entitlement.');
|
|
643
643
|
export const productCatalogValidationError = z
|
|
644
644
|
.object({
|
|
645
645
|
code: z.string().describe('Machine-readable error code.'),
|
|
@@ -982,6 +982,12 @@ export const totals = z
|
|
|
982
982
|
total: numeric,
|
|
983
983
|
})
|
|
984
984
|
.describe('Totals contains the summaries of all calculations for a billing resource.');
|
|
985
|
+
export const spendCommitments = z
|
|
986
|
+
.object({
|
|
987
|
+
minimum_amount: numeric.optional(),
|
|
988
|
+
maximum_amount: numeric.optional(),
|
|
989
|
+
})
|
|
990
|
+
.describe('Spend commitments for a rate card. The customer is committed to spend at least the minimum amount and at most the maximum amount.');
|
|
985
991
|
export const invoiceLineCreditsApplied = z
|
|
986
992
|
.object({
|
|
987
993
|
amount: numeric,
|
|
@@ -1017,12 +1023,6 @@ export const llmCostModelPricing = z
|
|
|
1017
1023
|
reasoning_per_token: numeric.optional(),
|
|
1018
1024
|
})
|
|
1019
1025
|
.describe('Token pricing for an LLM model, denominated per token.');
|
|
1020
|
-
export const spendCommitments = z
|
|
1021
|
-
.object({
|
|
1022
|
-
minimum_amount: numeric.optional(),
|
|
1023
|
-
maximum_amount: numeric.optional(),
|
|
1024
|
-
})
|
|
1025
|
-
.describe('Spend commitments for a rate card. The customer is committed to spend at least the minimum amount and at most the maximum amount.');
|
|
1026
1026
|
export const queryFilterNumeric = z
|
|
1027
1027
|
.object({
|
|
1028
1028
|
gt: numeric.optional(),
|
|
@@ -1139,6 +1139,11 @@ export const addonReference = z
|
|
|
1139
1139
|
id: ulid,
|
|
1140
1140
|
})
|
|
1141
1141
|
.describe('Addon reference.');
|
|
1142
|
+
export const featureReference = z
|
|
1143
|
+
.object({
|
|
1144
|
+
id: ulid,
|
|
1145
|
+
})
|
|
1146
|
+
.describe('Feature reference.');
|
|
1142
1147
|
export const appReference = z
|
|
1143
1148
|
.object({
|
|
1144
1149
|
id: ulid,
|
|
@@ -1172,11 +1177,6 @@ export const currencyFiat = z
|
|
|
1172
1177
|
code: currencyCode,
|
|
1173
1178
|
})
|
|
1174
1179
|
.describe('Currency describes a currency supported by the billing system.');
|
|
1175
|
-
export const featureReference = z
|
|
1176
|
-
.object({
|
|
1177
|
-
id: ulid,
|
|
1178
|
-
})
|
|
1179
|
-
.describe('Feature reference.');
|
|
1180
1180
|
export const dateTimeFieldFilter = z
|
|
1181
1181
|
.union([
|
|
1182
1182
|
dateTime,
|
|
@@ -1267,6 +1267,17 @@ export const closedPeriod = z
|
|
|
1267
1267
|
to: dateTime,
|
|
1268
1268
|
})
|
|
1269
1269
|
.describe('A period with defined start and end dates. The period is always inclusive at the start and exclusive at the end.');
|
|
1270
|
+
export const subscriptionAddonTimelineSegment = z
|
|
1271
|
+
.object({
|
|
1272
|
+
active_from: dateTime,
|
|
1273
|
+
active_to: dateTime.optional(),
|
|
1274
|
+
quantity: z
|
|
1275
|
+
.number()
|
|
1276
|
+
.int()
|
|
1277
|
+
.nonnegative()
|
|
1278
|
+
.describe('The quantity of the add-on for the given period.'),
|
|
1279
|
+
})
|
|
1280
|
+
.describe('A subscription add-on event.');
|
|
1270
1281
|
export const costBasis = z
|
|
1271
1282
|
.object({
|
|
1272
1283
|
id: ulid,
|
|
@@ -1762,12 +1773,6 @@ export const createCreditGrantPurchase = z
|
|
|
1762
1773
|
.default('on_creation'),
|
|
1763
1774
|
})
|
|
1764
1775
|
.describe('Purchase and payment terms of the grant.');
|
|
1765
|
-
export const recurringPeriod = z
|
|
1766
|
-
.object({
|
|
1767
|
-
anchor: dateTime,
|
|
1768
|
-
interval: iso8601Duration,
|
|
1769
|
-
})
|
|
1770
|
-
.describe('Recurring period with an anchor and an interval.');
|
|
1771
1776
|
export const rateCardMeteredEntitlement = z
|
|
1772
1777
|
.object({
|
|
1773
1778
|
type: z
|
|
@@ -1786,6 +1791,12 @@ export const rateCardMeteredEntitlement = z
|
|
|
1786
1791
|
usage_period: iso8601Duration.optional(),
|
|
1787
1792
|
})
|
|
1788
1793
|
.describe('The entitlement template of a metered entitlement.');
|
|
1794
|
+
export const recurringPeriod = z
|
|
1795
|
+
.object({
|
|
1796
|
+
anchor: dateTime,
|
|
1797
|
+
interval: iso8601Duration,
|
|
1798
|
+
})
|
|
1799
|
+
.describe('Recurring period with an anchor and an interval.');
|
|
1789
1800
|
export const creditGrantPurchase = z
|
|
1790
1801
|
.object({
|
|
1791
1802
|
currency: currencyCode,
|
|
@@ -1873,6 +1884,23 @@ export const subscription = z
|
|
|
1873
1884
|
export const subscriptionEditTiming = z
|
|
1874
1885
|
.union([subscriptionEditTimingEnum, dateTime])
|
|
1875
1886
|
.describe('Subscription edit timing defined when the changes should take effect. If the provided configuration is not supported by the subscription, an error will be returned.');
|
|
1887
|
+
export const unitConfig = z
|
|
1888
|
+
.object({
|
|
1889
|
+
operation: unitConfigOperation,
|
|
1890
|
+
conversion_factor: numeric,
|
|
1891
|
+
rounding: unitConfigRoundingMode.optional().default('none'),
|
|
1892
|
+
precision: z
|
|
1893
|
+
.number()
|
|
1894
|
+
.int()
|
|
1895
|
+
.optional()
|
|
1896
|
+
.default(0)
|
|
1897
|
+
.describe('The number of decimal places to retain after rounding. Only meaningful when rounding is not "none". Defaults to 0 (round to whole numbers).'),
|
|
1898
|
+
display_unit: z
|
|
1899
|
+
.string()
|
|
1900
|
+
.optional()
|
|
1901
|
+
.describe('A human-readable label for the converted unit shown on invoices and in the customer portal (e.g., "GB", "hours", "M tokens"). Optional. When omitted, no unit label is rendered.'),
|
|
1902
|
+
})
|
|
1903
|
+
.describe('Unit conversion configuration. Transforms raw metered quantities into billing-ready units before pricing and entitlement evaluation. Applied at the rate card level so the same feature can be billed in different units across plans. Examples: - Meter bytes, bill GB: operation=divide, conversionFactor=1e9, rounding=ceiling, displayUnit="GB" - Meter seconds, bill hours: operation=divide, conversionFactor=3600, rounding=ceiling, displayUnit="hours" - Cost + 20% margin: operation=multiply, conversionFactor=1.2 - Bill per million tokens: operation=divide, conversionFactor=1e6, rounding=ceiling, displayUnit="M" v1 equivalents: - DynamicPrice(multiplier): operation=multiply, conversionFactor=multiplier + UnitPrice(amount=1) - PackagePrice(amount, quantityPerPkg): operation=divide, conversionFactor=quantityPerPkg, rounding=ceiling + UnitPrice(amount)');
|
|
1876
1904
|
export const appCatalogItem = z
|
|
1877
1905
|
.object({
|
|
1878
1906
|
type: appType,
|
|
@@ -2029,23 +2057,6 @@ export const createCurrencyCustomRequest = z
|
|
|
2029
2057
|
code: currencyCodeCustom,
|
|
2030
2058
|
})
|
|
2031
2059
|
.describe('CurrencyCustom create request.');
|
|
2032
|
-
export const unitConfig = z
|
|
2033
|
-
.object({
|
|
2034
|
-
operation: unitConfigOperation,
|
|
2035
|
-
conversion_factor: numeric,
|
|
2036
|
-
rounding: unitConfigRoundingMode.optional().default('none'),
|
|
2037
|
-
precision: z
|
|
2038
|
-
.number()
|
|
2039
|
-
.int()
|
|
2040
|
-
.optional()
|
|
2041
|
-
.default(0)
|
|
2042
|
-
.describe('The number of decimal places to retain after rounding. Only meaningful when rounding is not "none". Defaults to 0 (round to whole numbers).'),
|
|
2043
|
-
display_unit: z
|
|
2044
|
-
.string()
|
|
2045
|
-
.optional()
|
|
2046
|
-
.describe('A human-readable label for the converted unit shown on invoices and in the customer portal (e.g., "GB", "hours", "M tokens"). Optional. When omitted, no unit label is rendered.'),
|
|
2047
|
-
})
|
|
2048
|
-
.describe('Unit conversion configuration. Transforms raw metered quantities into billing-ready units before pricing and entitlement evaluation. Applied at the rate card level so the same feature can be billed in different units across plans. Examples: - Meter bytes, bill GB: operation=divide, conversionFactor=1e9, rounding=ceiling, displayUnit="GB" - Meter seconds, bill hours: operation=divide, conversionFactor=3600, rounding=ceiling, displayUnit="hours" - Cost + 20% margin: operation=multiply, conversionFactor=1.2 - Bill per million tokens: operation=divide, conversionFactor=1e6, rounding=ceiling, displayUnit="M" v1 equivalents: - DynamicPrice(multiplier): operation=multiply, conversionFactor=multiplier + UnitPrice(amount=1) - PackagePrice(amount, quantityPerPkg): operation=divide, conversionFactor=quantityPerPkg, rounding=ceiling + UnitPrice(amount)');
|
|
2049
2060
|
export const governanceQueryRequest = z
|
|
2050
2061
|
.object({
|
|
2051
2062
|
include_credits: z
|
|
@@ -2311,34 +2322,6 @@ export const updateOrganizationDefaultTaxCodesRequest = z
|
|
|
2311
2322
|
credit_grant_tax_code: taxCodeReference.optional(),
|
|
2312
2323
|
})
|
|
2313
2324
|
.describe('OrganizationDefaultTaxCodes update request.');
|
|
2314
|
-
export const subscriptionAddon = z
|
|
2315
|
-
.object({
|
|
2316
|
-
id: ulid,
|
|
2317
|
-
name: z
|
|
2318
|
-
.string()
|
|
2319
|
-
.min(1)
|
|
2320
|
-
.max(256)
|
|
2321
|
-
.describe('Display name of the resource. Between 1 and 256 characters.'),
|
|
2322
|
-
description: z
|
|
2323
|
-
.string()
|
|
2324
|
-
.max(1024)
|
|
2325
|
-
.optional()
|
|
2326
|
-
.describe('Optional description of the resource. Maximum 1024 characters.'),
|
|
2327
|
-
labels: labels.optional(),
|
|
2328
|
-
created_at: dateTime,
|
|
2329
|
-
updated_at: dateTime,
|
|
2330
|
-
deleted_at: dateTime.optional(),
|
|
2331
|
-
addon: addonReference,
|
|
2332
|
-
quantity: z
|
|
2333
|
-
.number()
|
|
2334
|
-
.int()
|
|
2335
|
-
.gte(1)
|
|
2336
|
-
.describe('The quantity of the add-on. Always 1 for single instance add-ons.'),
|
|
2337
|
-
quantity_at: dateTime,
|
|
2338
|
-
active_from: dateTime,
|
|
2339
|
-
active_to: dateTime.optional(),
|
|
2340
|
-
})
|
|
2341
|
-
.describe('Addon purchased with a subscription.');
|
|
2342
2325
|
export const planAddon = z
|
|
2343
2326
|
.object({
|
|
2344
2327
|
id: ulid,
|
|
@@ -2610,12 +2593,6 @@ export const listCustomerEntitlementAccessResponseData = z
|
|
|
2610
2593
|
.describe('The list of entitlement access results.'),
|
|
2611
2594
|
})
|
|
2612
2595
|
.describe('List customer entitlement access response data.');
|
|
2613
|
-
export const workflowCollectionAlignmentAnchored = z
|
|
2614
|
-
.object({
|
|
2615
|
-
type: z.literal('anchored').describe('The type of alignment.'),
|
|
2616
|
-
recurring_period: recurringPeriod,
|
|
2617
|
-
})
|
|
2618
|
-
.describe('BillingWorkflowCollectionAlignmentAnchored specifies the alignment for collecting the pending line items into an invoice.');
|
|
2619
2596
|
export const rateCardEntitlement = z
|
|
2620
2597
|
.discriminatedUnion('type', [
|
|
2621
2598
|
rateCardMeteredEntitlement,
|
|
@@ -2623,6 +2600,12 @@ export const rateCardEntitlement = z
|
|
|
2623
2600
|
rateCardBooleanEntitlement,
|
|
2624
2601
|
])
|
|
2625
2602
|
.describe('Entitlement template configured on a rate card. The feature is taken from the rate card itself, so it is omitted here.');
|
|
2603
|
+
export const workflowCollectionAlignmentAnchored = z
|
|
2604
|
+
.object({
|
|
2605
|
+
type: z.literal('anchored').describe('The type of alignment.'),
|
|
2606
|
+
recurring_period: recurringPeriod,
|
|
2607
|
+
})
|
|
2608
|
+
.describe('BillingWorkflowCollectionAlignmentAnchored specifies the alignment for collecting the pending line items into an invoice.');
|
|
2626
2609
|
export const subscriptionPagePaginatedResponse = z
|
|
2627
2610
|
.object({
|
|
2628
2611
|
data: z.array(subscription),
|
|
@@ -2665,6 +2648,30 @@ export const subscriptionChange = z
|
|
|
2665
2648
|
timing: subscriptionEditTiming,
|
|
2666
2649
|
})
|
|
2667
2650
|
.describe('Request for changing a subscription.');
|
|
2651
|
+
export const createSubscriptionAddonRequest = z
|
|
2652
|
+
.object({
|
|
2653
|
+
labels: labels.optional(),
|
|
2654
|
+
addon: addonReference,
|
|
2655
|
+
quantity: z
|
|
2656
|
+
.number()
|
|
2657
|
+
.int()
|
|
2658
|
+
.gte(1)
|
|
2659
|
+
.describe('The quantity of the add-on. Always 1 for single instance add-ons.'),
|
|
2660
|
+
timing: subscriptionEditTiming,
|
|
2661
|
+
})
|
|
2662
|
+
.describe('SubscriptionAddon create request.');
|
|
2663
|
+
export const invoiceUsageQuantityDetail = z
|
|
2664
|
+
.object({
|
|
2665
|
+
raw_quantity: numeric,
|
|
2666
|
+
converted_quantity: numeric,
|
|
2667
|
+
invoiced_quantity: numeric,
|
|
2668
|
+
display_unit: z
|
|
2669
|
+
.string()
|
|
2670
|
+
.optional()
|
|
2671
|
+
.describe('The display unit label (e.g., "GB", "hours", "M tokens").'),
|
|
2672
|
+
applied_unit_config: unitConfig,
|
|
2673
|
+
})
|
|
2674
|
+
.describe('Usage quantity details on an invoice line item when UnitConfig is in effect. Provides the full audit trail from raw meter output to the invoiced amount.');
|
|
2668
2675
|
export const appStripe = z
|
|
2669
2676
|
.object({
|
|
2670
2677
|
id: ulid,
|
|
@@ -2843,18 +2850,6 @@ export const invoiceLineDiscounts = z
|
|
|
2843
2850
|
export const currency = z
|
|
2844
2851
|
.discriminatedUnion('type', [currencyFiat, currencyCustom])
|
|
2845
2852
|
.describe('Fiat or custom currency.');
|
|
2846
|
-
export const invoiceUsageQuantityDetail = z
|
|
2847
|
-
.object({
|
|
2848
|
-
raw_quantity: numeric,
|
|
2849
|
-
converted_quantity: numeric,
|
|
2850
|
-
invoiced_quantity: numeric,
|
|
2851
|
-
display_unit: z
|
|
2852
|
-
.string()
|
|
2853
|
-
.optional()
|
|
2854
|
-
.describe('The display unit label (e.g., "GB", "hours", "M tokens").'),
|
|
2855
|
-
applied_unit_config: unitConfig,
|
|
2856
|
-
})
|
|
2857
|
-
.describe('Usage quantity details on an invoice line item when UnitConfig is in effect. Provides the full audit trail from raw meter output to the invoiced amount.');
|
|
2858
2853
|
export const governanceFeatureAccess = z
|
|
2859
2854
|
.object({
|
|
2860
2855
|
has_access: z
|
|
@@ -3032,12 +3027,6 @@ export const workflowTaxSettings = z
|
|
|
3032
3027
|
default_tax_config: taxConfig.optional(),
|
|
3033
3028
|
})
|
|
3034
3029
|
.describe('Tax settings for a billing workflow.');
|
|
3035
|
-
export const subscriptionAddonPagePaginatedResponse = z
|
|
3036
|
-
.object({
|
|
3037
|
-
data: z.array(subscriptionAddon),
|
|
3038
|
-
meta: paginatedMeta,
|
|
3039
|
-
})
|
|
3040
|
-
.describe('Page paginated response.');
|
|
3041
3030
|
export const planAddonPagePaginatedResponse = z
|
|
3042
3031
|
.object({
|
|
3043
3032
|
data: z.array(planAddon),
|
|
@@ -3472,14 +3461,6 @@ export const createChargeUsageBasedRequest = z
|
|
|
3472
3461
|
billing_period: closedPeriod.optional(),
|
|
3473
3462
|
})
|
|
3474
3463
|
.describe('Usage-based charge create request.');
|
|
3475
|
-
export const invoiceLineRateCard = z
|
|
3476
|
-
.object({
|
|
3477
|
-
price: price,
|
|
3478
|
-
tax_config: rateCardTaxConfig.optional(),
|
|
3479
|
-
feature_key: resourceKey.optional(),
|
|
3480
|
-
discounts: rateCardDiscounts.optional(),
|
|
3481
|
-
})
|
|
3482
|
-
.describe('Rate card configuration snapshot for a usage-based invoice line.');
|
|
3483
3464
|
export const rateCard = z
|
|
3484
3465
|
.object({
|
|
3485
3466
|
name: z
|
|
@@ -3505,6 +3486,14 @@ export const rateCard = z
|
|
|
3505
3486
|
entitlement: rateCardEntitlement.optional(),
|
|
3506
3487
|
})
|
|
3507
3488
|
.describe('A rate card defines the pricing and entitlement of a feature or service.');
|
|
3489
|
+
export const invoiceLineRateCard = z
|
|
3490
|
+
.object({
|
|
3491
|
+
price: price,
|
|
3492
|
+
tax_config: rateCardTaxConfig.optional(),
|
|
3493
|
+
feature_key: resourceKey.optional(),
|
|
3494
|
+
discounts: rateCardDiscounts.optional(),
|
|
3495
|
+
})
|
|
3496
|
+
.describe('Rate card configuration snapshot for a usage-based invoice line.');
|
|
3508
3497
|
export const featurePagePaginatedResponse = z
|
|
3509
3498
|
.object({
|
|
3510
3499
|
data: z.array(feature),
|
|
@@ -3528,43 +3517,14 @@ export const createChargeRequest = z
|
|
|
3528
3517
|
createChargeUsageBasedRequest,
|
|
3529
3518
|
])
|
|
3530
3519
|
.describe('Customer charge.');
|
|
3531
|
-
export const
|
|
3520
|
+
export const subscriptionAddonRateCard = z
|
|
3532
3521
|
.object({
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
.
|
|
3536
|
-
.
|
|
3537
|
-
.max(256)
|
|
3538
|
-
.describe('Display name of the resource. Between 1 and 256 characters.'),
|
|
3539
|
-
description: z
|
|
3540
|
-
.string()
|
|
3541
|
-
.max(1024)
|
|
3542
|
-
.optional()
|
|
3543
|
-
.describe('Optional description of the resource. Maximum 1024 characters.'),
|
|
3544
|
-
labels: labels.optional(),
|
|
3545
|
-
created_at: dateTime,
|
|
3546
|
-
updated_at: dateTime,
|
|
3547
|
-
deleted_at: dateTime.optional(),
|
|
3548
|
-
type: z
|
|
3549
|
-
.literal('standard_line')
|
|
3550
|
-
.describe('The type of charge this line item represents.'),
|
|
3551
|
-
lifecycle_controller: lifecycleController,
|
|
3552
|
-
service_period: closedPeriod,
|
|
3553
|
-
totals: totals,
|
|
3554
|
-
discounts: invoiceLineDiscounts.optional(),
|
|
3555
|
-
credits_applied: z
|
|
3556
|
-
.array(invoiceLineCreditsApplied)
|
|
3557
|
-
.optional()
|
|
3558
|
-
.describe('Credit applied to this line item.'),
|
|
3559
|
-
external_references: invoiceLineExternalReferences.optional(),
|
|
3560
|
-
subscription: subscriptionReference.optional(),
|
|
3561
|
-
rate_card: invoiceLineRateCard,
|
|
3562
|
-
detailed_lines: z
|
|
3563
|
-
.array(invoiceDetailedLine)
|
|
3564
|
-
.describe('Detailed sub-lines that this line has been broken down into. Present when line has individual details.'),
|
|
3565
|
-
charge: chargeReference.optional(),
|
|
3522
|
+
rate_card: rateCard,
|
|
3523
|
+
affected_subscription_item_ids: z
|
|
3524
|
+
.array(ulid)
|
|
3525
|
+
.describe('The IDs of the subscription items that this rate card belongs to.'),
|
|
3566
3526
|
})
|
|
3567
|
-
.describe('A
|
|
3527
|
+
.describe('A rate card for a subscription add-on.');
|
|
3568
3528
|
export const planPhase = z
|
|
3569
3529
|
.object({
|
|
3570
3530
|
name: z
|
|
@@ -3655,6 +3615,43 @@ export const upsertAddonRequest = z
|
|
|
3655
3615
|
rate_cards: z.array(rateCard).describe('The rate cards of the add-on.'),
|
|
3656
3616
|
})
|
|
3657
3617
|
.describe('Addon upsert request.');
|
|
3618
|
+
export const invoiceStandardLine = z
|
|
3619
|
+
.object({
|
|
3620
|
+
id: ulid,
|
|
3621
|
+
name: z
|
|
3622
|
+
.string()
|
|
3623
|
+
.min(1)
|
|
3624
|
+
.max(256)
|
|
3625
|
+
.describe('Display name of the resource. Between 1 and 256 characters.'),
|
|
3626
|
+
description: z
|
|
3627
|
+
.string()
|
|
3628
|
+
.max(1024)
|
|
3629
|
+
.optional()
|
|
3630
|
+
.describe('Optional description of the resource. Maximum 1024 characters.'),
|
|
3631
|
+
labels: labels.optional(),
|
|
3632
|
+
created_at: dateTime,
|
|
3633
|
+
updated_at: dateTime,
|
|
3634
|
+
deleted_at: dateTime.optional(),
|
|
3635
|
+
type: z
|
|
3636
|
+
.literal('standard_line')
|
|
3637
|
+
.describe('The type of charge this line item represents.'),
|
|
3638
|
+
lifecycle_controller: lifecycleController,
|
|
3639
|
+
service_period: closedPeriod,
|
|
3640
|
+
totals: totals,
|
|
3641
|
+
discounts: invoiceLineDiscounts.optional(),
|
|
3642
|
+
credits_applied: z
|
|
3643
|
+
.array(invoiceLineCreditsApplied)
|
|
3644
|
+
.optional()
|
|
3645
|
+
.describe('Credit applied to this line item.'),
|
|
3646
|
+
external_references: invoiceLineExternalReferences.optional(),
|
|
3647
|
+
subscription: subscriptionReference.optional(),
|
|
3648
|
+
rate_card: invoiceLineRateCard,
|
|
3649
|
+
detailed_lines: z
|
|
3650
|
+
.array(invoiceDetailedLine)
|
|
3651
|
+
.describe('Detailed sub-lines that this line has been broken down into. Present when line has individual details.'),
|
|
3652
|
+
charge: chargeReference.optional(),
|
|
3653
|
+
})
|
|
3654
|
+
.describe('A top-level line item on an invoice. Each line represents a single charge, typically associated with a rate card from a subscription. Detailed (child) lines are nested under `detailed_lines` when present.');
|
|
3658
3655
|
export const profile = z
|
|
3659
3656
|
.object({
|
|
3660
3657
|
id: ulid,
|
|
@@ -3721,9 +3718,41 @@ export const chargePagePaginatedResponse = z
|
|
|
3721
3718
|
meta: paginatedMeta,
|
|
3722
3719
|
})
|
|
3723
3720
|
.describe('Page paginated response.');
|
|
3724
|
-
export const
|
|
3725
|
-
.
|
|
3726
|
-
|
|
3721
|
+
export const subscriptionAddon = z
|
|
3722
|
+
.object({
|
|
3723
|
+
id: ulid,
|
|
3724
|
+
labels: labels.optional(),
|
|
3725
|
+
created_at: dateTime,
|
|
3726
|
+
updated_at: dateTime,
|
|
3727
|
+
deleted_at: dateTime.optional(),
|
|
3728
|
+
name: z
|
|
3729
|
+
.string()
|
|
3730
|
+
.min(1)
|
|
3731
|
+
.max(256)
|
|
3732
|
+
.describe('Display name of the resource. Between 1 and 256 characters.'),
|
|
3733
|
+
description: z
|
|
3734
|
+
.string()
|
|
3735
|
+
.max(1024)
|
|
3736
|
+
.optional()
|
|
3737
|
+
.describe('Optional description of the resource. Maximum 1024 characters.'),
|
|
3738
|
+
addon: addonReference,
|
|
3739
|
+
quantity: z
|
|
3740
|
+
.number()
|
|
3741
|
+
.int()
|
|
3742
|
+
.gte(1)
|
|
3743
|
+
.describe('The quantity of the add-on. Always 1 for single instance add-ons.'),
|
|
3744
|
+
quantity_at: dateTime,
|
|
3745
|
+
active_from: dateTime,
|
|
3746
|
+
active_to: dateTime.optional(),
|
|
3747
|
+
timing: subscriptionEditTiming,
|
|
3748
|
+
timeline: z
|
|
3749
|
+
.array(subscriptionAddonTimelineSegment)
|
|
3750
|
+
.describe('The timeline of the add-on. The returned periods are sorted and continuous.'),
|
|
3751
|
+
rate_cards: z
|
|
3752
|
+
.array(subscriptionAddonRateCard)
|
|
3753
|
+
.describe('The rate cards of the add-on.'),
|
|
3754
|
+
})
|
|
3755
|
+
.describe('Addon purchased with a subscription.');
|
|
3727
3756
|
export const plan = z
|
|
3728
3757
|
.object({
|
|
3729
3758
|
id: ulid,
|
|
@@ -3826,12 +3855,27 @@ export const addonPagePaginatedResponse = z
|
|
|
3826
3855
|
meta: paginatedMeta,
|
|
3827
3856
|
})
|
|
3828
3857
|
.describe('Page paginated response.');
|
|
3858
|
+
export const invoiceLine = z
|
|
3859
|
+
.discriminatedUnion('type', [invoiceStandardLine])
|
|
3860
|
+
.describe('A top-level line item on an invoice. Each line represents a single charge, typically associated with a rate card from a subscription. Detailed (child) lines are nested under `detailed_lines` when present.');
|
|
3829
3861
|
export const profilePagePaginatedResponse = z
|
|
3830
3862
|
.object({
|
|
3831
3863
|
data: z.array(profile),
|
|
3832
3864
|
meta: paginatedMeta,
|
|
3833
3865
|
})
|
|
3834
3866
|
.describe('Page paginated response.');
|
|
3867
|
+
export const subscriptionAddonPagePaginatedResponse = z
|
|
3868
|
+
.object({
|
|
3869
|
+
data: z.array(subscriptionAddon),
|
|
3870
|
+
meta: paginatedMeta,
|
|
3871
|
+
})
|
|
3872
|
+
.describe('Page paginated response.');
|
|
3873
|
+
export const planPagePaginatedResponse = z
|
|
3874
|
+
.object({
|
|
3875
|
+
data: z.array(plan),
|
|
3876
|
+
meta: paginatedMeta,
|
|
3877
|
+
})
|
|
3878
|
+
.describe('Page paginated response.');
|
|
3835
3879
|
export const invoiceStandard = z
|
|
3836
3880
|
.object({
|
|
3837
3881
|
id: ulid,
|
|
@@ -3873,12 +3917,6 @@ export const invoiceStandard = z
|
|
|
3873
3917
|
.describe('Line items on this invoice. Always returned on single-resource GET; omitted on list endpoints unless explicitly expanded.'),
|
|
3874
3918
|
})
|
|
3875
3919
|
.describe('A standard invoice for charges owed by the customer.');
|
|
3876
|
-
export const planPagePaginatedResponse = z
|
|
3877
|
-
.object({
|
|
3878
|
-
data: z.array(plan),
|
|
3879
|
-
meta: paginatedMeta,
|
|
3880
|
-
})
|
|
3881
|
-
.describe('Page paginated response.');
|
|
3882
3920
|
export const invoice = z
|
|
3883
3921
|
.discriminatedUnion('type', [invoiceStandard])
|
|
3884
3922
|
.describe('An invoice issued to a customer. The `type` field determines the concrete variant: - `standard`: a standard invoice for charges owed.');
|
|
@@ -4126,6 +4164,11 @@ export const changeSubscriptionPathParams = z.object({
|
|
|
4126
4164
|
});
|
|
4127
4165
|
export const changeSubscriptionBody = subscriptionChange;
|
|
4128
4166
|
export const changeSubscriptionResponse = subscriptionChangeResponse;
|
|
4167
|
+
export const createSubscriptionAddonPathParams = z.object({
|
|
4168
|
+
subscriptionId: ulid,
|
|
4169
|
+
});
|
|
4170
|
+
export const createSubscriptionAddonBody = createSubscriptionAddonRequest;
|
|
4171
|
+
export const createSubscriptionAddonResponse = subscriptionAddon;
|
|
4129
4172
|
export const listSubscriptionAddonsPathParams = z.object({
|
|
4130
4173
|
subscriptionId: ulid,
|
|
4131
4174
|
});
|