@openmeter/client 1.0.0-beta-75dd3b9ccc98 → 1.0.0-beta-a175676db126
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/dist/index.d.ts +1 -1
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/models/schemas.d.ts +2212 -1162
- package/dist/models/schemas.js +299 -220
- package/dist/models/types.d.ts +447 -311
- package/package.json +1 -1
package/dist/models/schemas.js
CHANGED
|
@@ -2229,31 +2229,6 @@ export const rateCardProrationConfiguration = z
|
|
|
2229
2229
|
mode: rateCardProrationMode,
|
|
2230
2230
|
})
|
|
2231
2231
|
.describe('The proration configuration of the rate card.');
|
|
2232
|
-
export const subscriptionCreate = z
|
|
2233
|
-
.object({
|
|
2234
|
-
labels: labels.optional(),
|
|
2235
|
-
settlementMode: settlementMode.optional(),
|
|
2236
|
-
customer: z
|
|
2237
|
-
.object({
|
|
2238
|
-
id: ulid.optional(),
|
|
2239
|
-
key: externalResourceKey.optional(),
|
|
2240
|
-
})
|
|
2241
|
-
.describe('The customer to create the subscription for.'),
|
|
2242
|
-
plan: z
|
|
2243
|
-
.object({
|
|
2244
|
-
id: ulid.optional(),
|
|
2245
|
-
key: resourceKey.optional(),
|
|
2246
|
-
version: z
|
|
2247
|
-
.number()
|
|
2248
|
-
.int()
|
|
2249
|
-
.optional()
|
|
2250
|
-
.describe('The plan version of the subscription, if any. If not provided, the latest version of the plan will be used.'),
|
|
2251
|
-
})
|
|
2252
|
-
.describe('The plan reference of the subscription.'),
|
|
2253
|
-
billingAnchor: dateTime.optional(),
|
|
2254
|
-
costBasisMode: subscriptionCostBasisMode.optional().default('dynamic'),
|
|
2255
|
-
})
|
|
2256
|
-
.describe('Subscription create request.');
|
|
2257
2232
|
export const unitConfig = z
|
|
2258
2233
|
.object({
|
|
2259
2234
|
operation: unitConfigOperation,
|
|
@@ -2513,14 +2488,26 @@ export const entitlementAccessQueryError = z
|
|
|
2513
2488
|
.describe('Query error within a partially successful entitlement access query response.');
|
|
2514
2489
|
export const appCustomerData = z
|
|
2515
2490
|
.object({
|
|
2516
|
-
stripe: appCustomerDataStripe
|
|
2517
|
-
|
|
2491
|
+
stripe: appCustomerDataStripe
|
|
2492
|
+
.nullable()
|
|
2493
|
+
.optional()
|
|
2494
|
+
.describe('Used if the customer has a linked Stripe app. Set to `null` to remove the Stripe data of the customer; omit to leave it unchanged.'),
|
|
2495
|
+
externalInvoicing: appCustomerDataExternalInvoicing
|
|
2496
|
+
.nullable()
|
|
2497
|
+
.optional()
|
|
2498
|
+
.describe('Used if the customer has a linked external invoicing app. Set to `null` to remove the external invoicing data of the customer; omit to leave it unchanged.'),
|
|
2518
2499
|
})
|
|
2519
2500
|
.describe('App customer data.');
|
|
2520
2501
|
export const upsertAppCustomerDataRequest = z
|
|
2521
2502
|
.object({
|
|
2522
|
-
stripe: appCustomerDataStripe
|
|
2523
|
-
|
|
2503
|
+
stripe: appCustomerDataStripe
|
|
2504
|
+
.nullable()
|
|
2505
|
+
.optional()
|
|
2506
|
+
.describe('Used if the customer has a linked Stripe app. Set to `null` to remove the Stripe data of the customer; omit to leave it unchanged.'),
|
|
2507
|
+
externalInvoicing: appCustomerDataExternalInvoicing
|
|
2508
|
+
.nullable()
|
|
2509
|
+
.optional()
|
|
2510
|
+
.describe('Used if the customer has a linked external invoicing app. Set to `null` to remove the external invoicing data of the customer; omit to leave it unchanged.'),
|
|
2524
2511
|
})
|
|
2525
2512
|
.describe('AppCustomerData upsert request.');
|
|
2526
2513
|
export const creditAdjustment = z
|
|
@@ -3214,32 +3201,6 @@ export const subscriptionCancel = z
|
|
|
3214
3201
|
timing: subscriptionEditTiming.optional().default('immediate'),
|
|
3215
3202
|
})
|
|
3216
3203
|
.describe('Request for canceling a subscription.');
|
|
3217
|
-
export const subscriptionChange = z
|
|
3218
|
-
.object({
|
|
3219
|
-
labels: labels.optional(),
|
|
3220
|
-
settlementMode: settlementMode.optional(),
|
|
3221
|
-
customer: z
|
|
3222
|
-
.object({
|
|
3223
|
-
id: ulid.optional(),
|
|
3224
|
-
key: externalResourceKey.optional(),
|
|
3225
|
-
})
|
|
3226
|
-
.describe('The customer to create the subscription for.'),
|
|
3227
|
-
plan: z
|
|
3228
|
-
.object({
|
|
3229
|
-
id: ulid.optional(),
|
|
3230
|
-
key: resourceKey.optional(),
|
|
3231
|
-
version: z
|
|
3232
|
-
.number()
|
|
3233
|
-
.int()
|
|
3234
|
-
.optional()
|
|
3235
|
-
.describe('The plan version of the subscription, if any. If not provided, the latest version of the plan will be used.'),
|
|
3236
|
-
})
|
|
3237
|
-
.describe('The plan reference of the subscription.'),
|
|
3238
|
-
billingAnchor: dateTime.optional(),
|
|
3239
|
-
costBasisMode: subscriptionCostBasisMode.optional().default('dynamic'),
|
|
3240
|
-
timing: subscriptionEditTiming,
|
|
3241
|
-
})
|
|
3242
|
-
.describe('Request for changing a subscription.');
|
|
3243
3204
|
export const createSubscriptionAddonRequest = z
|
|
3244
3205
|
.object({
|
|
3245
3206
|
labels: labels.optional(),
|
|
@@ -4271,23 +4232,6 @@ export const subscriptionItem = z
|
|
|
4271
4232
|
rateCard: rateCard,
|
|
4272
4233
|
})
|
|
4273
4234
|
.describe('A subscription item pins a rate card to a cadence within a subscription phase.');
|
|
4274
|
-
export const subscriptionEditAddItem = z
|
|
4275
|
-
.object({
|
|
4276
|
-
type: z
|
|
4277
|
-
.literal('add_item')
|
|
4278
|
-
.describe('Discriminator for the add-item operation.'),
|
|
4279
|
-
phaseKey: z.string().describe('The key of the phase to add the item to.'),
|
|
4280
|
-
rateCard: rateCard,
|
|
4281
|
-
})
|
|
4282
|
-
.describe('Add a new rate card to a phase. Adding an item to the current phase closes the active version of the same item key and appends a new version.');
|
|
4283
|
-
export const subscriptionAddonRateCard = z
|
|
4284
|
-
.object({
|
|
4285
|
-
rateCard: rateCard,
|
|
4286
|
-
affectedSubscriptionItemIds: z
|
|
4287
|
-
.array(ulid)
|
|
4288
|
-
.describe('The IDs of the subscription items that this rate card belongs to.'),
|
|
4289
|
-
})
|
|
4290
|
-
.describe('A rate card for a subscription add-on.');
|
|
4291
4235
|
export const planPhase = z
|
|
4292
4236
|
.object({
|
|
4293
4237
|
name: z
|
|
@@ -4306,6 +4250,23 @@ export const planPhase = z
|
|
|
4306
4250
|
rateCards: z.array(rateCard).describe('The rate cards of the plan.'),
|
|
4307
4251
|
})
|
|
4308
4252
|
.describe("The plan phase or pricing ramp allows changing a plan's rate cards over time as a subscription progresses.");
|
|
4253
|
+
export const subscriptionEditAddItem = z
|
|
4254
|
+
.object({
|
|
4255
|
+
type: z
|
|
4256
|
+
.literal('add_item')
|
|
4257
|
+
.describe('Discriminator for the add-item operation.'),
|
|
4258
|
+
phaseKey: z.string().describe('The key of the phase to add the item to.'),
|
|
4259
|
+
rateCard: rateCard,
|
|
4260
|
+
})
|
|
4261
|
+
.describe('Add a new rate card to a phase. Adding an item to the current phase closes the active version of the same item key and appends a new version.');
|
|
4262
|
+
export const subscriptionAddonRateCard = z
|
|
4263
|
+
.object({
|
|
4264
|
+
rateCard: rateCard,
|
|
4265
|
+
affectedSubscriptionItemIds: z
|
|
4266
|
+
.array(ulid)
|
|
4267
|
+
.describe('The IDs of the subscription items that this rate card belongs to.'),
|
|
4268
|
+
})
|
|
4269
|
+
.describe('A rate card for a subscription add-on.');
|
|
4309
4270
|
export const addon = z
|
|
4310
4271
|
.object({
|
|
4311
4272
|
id: ulid,
|
|
@@ -4550,23 +4511,8 @@ export const subscriptionPhase = z
|
|
|
4550
4511
|
.describe('The rate cards in effect for this phase, resolved to the version active at the queried time (the currently active version for the current phase, the first version for future phases, and the last version for past phases).'),
|
|
4551
4512
|
})
|
|
4552
4513
|
.describe("A subscription phase groups the rate cards in effect for a segment of the subscription's lifetime. Analogous to plan phases.");
|
|
4553
|
-
export const
|
|
4554
|
-
.discriminatedUnion('type', [
|
|
4555
|
-
subscriptionEditAddItem,
|
|
4556
|
-
subscriptionEditRemoveItem,
|
|
4557
|
-
subscriptionEditAddPhase,
|
|
4558
|
-
subscriptionEditRemovePhase,
|
|
4559
|
-
subscriptionEditStretchPhase,
|
|
4560
|
-
subscriptionEditUnscheduleEdit,
|
|
4561
|
-
])
|
|
4562
|
-
.describe('A single customization to apply to a running subscription. The `type` field discriminates which operation is performed.');
|
|
4563
|
-
export const subscriptionAddon = z
|
|
4514
|
+
export const subscriptionCustomPlan = z
|
|
4564
4515
|
.object({
|
|
4565
|
-
id: ulid,
|
|
4566
|
-
labels: labels.optional(),
|
|
4567
|
-
createdAt: dateTime,
|
|
4568
|
-
updatedAt: dateTime,
|
|
4569
|
-
deletedAt: dateTime.optional(),
|
|
4570
4516
|
name: z
|
|
4571
4517
|
.string()
|
|
4572
4518
|
.min(1)
|
|
@@ -4577,23 +4523,20 @@ export const subscriptionAddon = z
|
|
|
4577
4523
|
.max(1024)
|
|
4578
4524
|
.optional()
|
|
4579
4525
|
.describe('Optional description of the resource. Maximum 1024 characters.'),
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
.
|
|
4585
|
-
.
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
.
|
|
4591
|
-
.describe('The
|
|
4592
|
-
rateCards: z
|
|
4593
|
-
.array(subscriptionAddonRateCard)
|
|
4594
|
-
.describe('The rate cards of the add-on.'),
|
|
4526
|
+
labels: labels.optional(),
|
|
4527
|
+
currency: billingCurrencyCode,
|
|
4528
|
+
billingCadence: iso8601Duration,
|
|
4529
|
+
proRatingEnabled: z
|
|
4530
|
+
.boolean()
|
|
4531
|
+
.optional()
|
|
4532
|
+
.default(true)
|
|
4533
|
+
.describe('Whether pro-rating is enabled for this plan.'),
|
|
4534
|
+
phases: z
|
|
4535
|
+
.array(planPhase)
|
|
4536
|
+
.min(1)
|
|
4537
|
+
.describe('The plan phases define the pricing ramp for a subscription. A phase switch occurs only at the end of a billing period. At least one phase is required.'),
|
|
4595
4538
|
})
|
|
4596
|
-
.describe('
|
|
4539
|
+
.describe('An inline (custom) plan definition used to create or change a subscription without referencing a published plan. Mirrors the plan create shape without a key or version, since a custom plan is not persisted or versioned on its own.');
|
|
4597
4540
|
export const plan = z
|
|
4598
4541
|
.object({
|
|
4599
4542
|
id: ulid,
|
|
@@ -4690,6 +4633,50 @@ export const upsertPlanRequest = z
|
|
|
4690
4633
|
.describe('The plan phases define the pricing ramp for a subscription. A phase switch occurs only at the end of a billing period. At least one phase is required.'),
|
|
4691
4634
|
})
|
|
4692
4635
|
.describe('Plan upsert request.');
|
|
4636
|
+
export const subscriptionEditOperation = z
|
|
4637
|
+
.discriminatedUnion('type', [
|
|
4638
|
+
subscriptionEditAddItem,
|
|
4639
|
+
subscriptionEditRemoveItem,
|
|
4640
|
+
subscriptionEditAddPhase,
|
|
4641
|
+
subscriptionEditRemovePhase,
|
|
4642
|
+
subscriptionEditStretchPhase,
|
|
4643
|
+
subscriptionEditUnscheduleEdit,
|
|
4644
|
+
])
|
|
4645
|
+
.describe('A single customization to apply to a running subscription. The `type` field discriminates which operation is performed.');
|
|
4646
|
+
export const subscriptionAddon = z
|
|
4647
|
+
.object({
|
|
4648
|
+
id: ulid,
|
|
4649
|
+
labels: labels.optional(),
|
|
4650
|
+
createdAt: dateTime,
|
|
4651
|
+
updatedAt: dateTime,
|
|
4652
|
+
deletedAt: dateTime.optional(),
|
|
4653
|
+
name: z
|
|
4654
|
+
.string()
|
|
4655
|
+
.min(1)
|
|
4656
|
+
.max(256)
|
|
4657
|
+
.describe('Display name of the resource. Between 1 and 256 characters.'),
|
|
4658
|
+
description: z
|
|
4659
|
+
.string()
|
|
4660
|
+
.max(1024)
|
|
4661
|
+
.optional()
|
|
4662
|
+
.describe('Optional description of the resource. Maximum 1024 characters.'),
|
|
4663
|
+
addon: addonReference,
|
|
4664
|
+
quantity: z
|
|
4665
|
+
.number()
|
|
4666
|
+
.int()
|
|
4667
|
+
.gte(1)
|
|
4668
|
+
.describe('The quantity of the add-on. Always 1 for single instance add-ons.'),
|
|
4669
|
+
quantityAt: dateTime,
|
|
4670
|
+
activeFrom: dateTime,
|
|
4671
|
+
activeTo: dateTime.optional(),
|
|
4672
|
+
timeline: z
|
|
4673
|
+
.array(subscriptionAddonTimelineSegment)
|
|
4674
|
+
.describe('The timeline of the add-on. The returned periods are sorted and continuous.'),
|
|
4675
|
+
rateCards: z
|
|
4676
|
+
.array(subscriptionAddonRateCard)
|
|
4677
|
+
.describe('The rate cards of the add-on.'),
|
|
4678
|
+
})
|
|
4679
|
+
.describe('Addon purchased with a subscription.');
|
|
4693
4680
|
export const addonPagePaginatedResponse = z
|
|
4694
4681
|
.object({
|
|
4695
4682
|
data: z.array(addon),
|
|
@@ -4746,6 +4733,65 @@ export const subscription = z
|
|
|
4746
4733
|
.describe("The phases of the subscription in chronological order. A phase groups the rate cards that are in effect for a segment of the subscription's lifetime."),
|
|
4747
4734
|
})
|
|
4748
4735
|
.describe('Subscription.');
|
|
4736
|
+
export const subscriptionCreate = z.object({
|
|
4737
|
+
labels: labels.optional(),
|
|
4738
|
+
settlementMode: settlementMode.optional(),
|
|
4739
|
+
customer: z
|
|
4740
|
+
.object({
|
|
4741
|
+
id: ulid.optional(),
|
|
4742
|
+
key: externalResourceKey.optional(),
|
|
4743
|
+
})
|
|
4744
|
+
.describe('The customer to create the subscription for.'),
|
|
4745
|
+
plan: z
|
|
4746
|
+
.object({
|
|
4747
|
+
id: ulid.optional(),
|
|
4748
|
+
key: resourceKey.optional(),
|
|
4749
|
+
version: z
|
|
4750
|
+
.number()
|
|
4751
|
+
.int()
|
|
4752
|
+
.optional()
|
|
4753
|
+
.describe('The plan version of the subscription, if any. If not provided, the latest version of the plan will be used.'),
|
|
4754
|
+
})
|
|
4755
|
+
.optional()
|
|
4756
|
+
.describe('A reference to a published plan the subscription is created from. Exactly one of `plan` or `custom_plan` must be provided. Use `plan` to base the subscription on an existing published plan; use `custom_plan` to define the plan inline.'),
|
|
4757
|
+
customPlan: subscriptionCustomPlan.optional(),
|
|
4758
|
+
billingAnchor: dateTime.optional(),
|
|
4759
|
+
costBasisMode: subscriptionCostBasisMode.optional().default('dynamic'),
|
|
4760
|
+
});
|
|
4761
|
+
export const subscriptionChange = z
|
|
4762
|
+
.object({
|
|
4763
|
+
labels: labels.optional(),
|
|
4764
|
+
settlementMode: settlementMode.optional(),
|
|
4765
|
+
customer: z
|
|
4766
|
+
.object({
|
|
4767
|
+
id: ulid.optional(),
|
|
4768
|
+
key: externalResourceKey.optional(),
|
|
4769
|
+
})
|
|
4770
|
+
.describe('The customer to create the subscription for.'),
|
|
4771
|
+
plan: z
|
|
4772
|
+
.object({
|
|
4773
|
+
id: ulid.optional(),
|
|
4774
|
+
key: resourceKey.optional(),
|
|
4775
|
+
version: z
|
|
4776
|
+
.number()
|
|
4777
|
+
.int()
|
|
4778
|
+
.optional()
|
|
4779
|
+
.describe('The plan version of the subscription, if any. If not provided, the latest version of the plan will be used.'),
|
|
4780
|
+
})
|
|
4781
|
+
.optional()
|
|
4782
|
+
.describe('A reference to a published plan the subscription is created from. Exactly one of `plan` or `custom_plan` must be provided. Use `plan` to base the subscription on an existing published plan; use `custom_plan` to define the plan inline.'),
|
|
4783
|
+
customPlan: subscriptionCustomPlan.optional(),
|
|
4784
|
+
billingAnchor: dateTime.optional(),
|
|
4785
|
+
costBasisMode: subscriptionCostBasisMode.optional().default('dynamic'),
|
|
4786
|
+
timing: subscriptionEditTiming,
|
|
4787
|
+
})
|
|
4788
|
+
.describe('Request for changing a subscription.');
|
|
4789
|
+
export const planPagePaginatedResponse = z
|
|
4790
|
+
.object({
|
|
4791
|
+
data: z.array(plan),
|
|
4792
|
+
meta: paginatedMeta,
|
|
4793
|
+
})
|
|
4794
|
+
.describe('Page paginated response.');
|
|
4749
4795
|
export const subscriptionEdit = z
|
|
4750
4796
|
.object({
|
|
4751
4797
|
customizations: z
|
|
@@ -4761,12 +4807,6 @@ export const subscriptionAddonPagePaginatedResponse = z
|
|
|
4761
4807
|
meta: paginatedMeta,
|
|
4762
4808
|
})
|
|
4763
4809
|
.describe('Page paginated response.');
|
|
4764
|
-
export const planPagePaginatedResponse = z
|
|
4765
|
-
.object({
|
|
4766
|
-
data: z.array(plan),
|
|
4767
|
-
meta: paginatedMeta,
|
|
4768
|
-
})
|
|
4769
|
-
.describe('Page paginated response.');
|
|
4770
4810
|
export const invoiceStandard = z
|
|
4771
4811
|
.object({
|
|
4772
4812
|
id: ulid,
|
|
@@ -7887,31 +7927,6 @@ export const rateCardProrationConfigurationWire = z
|
|
|
7887
7927
|
mode: rateCardProrationModeWire,
|
|
7888
7928
|
})
|
|
7889
7929
|
.describe('The proration configuration of the rate card.');
|
|
7890
|
-
export const subscriptionCreateWire = z
|
|
7891
|
-
.strictObject({
|
|
7892
|
-
labels: labelsWire.optional(),
|
|
7893
|
-
settlement_mode: settlementModeWire.optional(),
|
|
7894
|
-
customer: z
|
|
7895
|
-
.strictObject({
|
|
7896
|
-
id: ulidWire.optional(),
|
|
7897
|
-
key: externalResourceKeyWire.optional(),
|
|
7898
|
-
})
|
|
7899
|
-
.describe('The customer to create the subscription for.'),
|
|
7900
|
-
plan: z
|
|
7901
|
-
.strictObject({
|
|
7902
|
-
id: ulidWire.optional(),
|
|
7903
|
-
key: resourceKeyWire.optional(),
|
|
7904
|
-
version: z
|
|
7905
|
-
.number()
|
|
7906
|
-
.int()
|
|
7907
|
-
.optional()
|
|
7908
|
-
.describe('The plan version of the subscription, if any. If not provided, the latest version of the plan will be used.'),
|
|
7909
|
-
})
|
|
7910
|
-
.describe('The plan reference of the subscription.'),
|
|
7911
|
-
billing_anchor: dateTimeWire.optional(),
|
|
7912
|
-
cost_basis_mode: subscriptionCostBasisModeWire.optional(),
|
|
7913
|
-
})
|
|
7914
|
-
.describe('Subscription create request.');
|
|
7915
7930
|
export const unitConfigWire = z
|
|
7916
7931
|
.strictObject({
|
|
7917
7932
|
operation: unitConfigOperationWire,
|
|
@@ -8164,14 +8179,26 @@ export const entitlementAccessQueryErrorWire = z
|
|
|
8164
8179
|
.describe('Query error within a partially successful entitlement access query response.');
|
|
8165
8180
|
export const appCustomerDataWire = z
|
|
8166
8181
|
.strictObject({
|
|
8167
|
-
stripe: appCustomerDataStripeWire
|
|
8168
|
-
|
|
8182
|
+
stripe: appCustomerDataStripeWire
|
|
8183
|
+
.nullable()
|
|
8184
|
+
.optional()
|
|
8185
|
+
.describe('Used if the customer has a linked Stripe app. Set to `null` to remove the Stripe data of the customer; omit to leave it unchanged.'),
|
|
8186
|
+
external_invoicing: appCustomerDataExternalInvoicingWire
|
|
8187
|
+
.nullable()
|
|
8188
|
+
.optional()
|
|
8189
|
+
.describe('Used if the customer has a linked external invoicing app. Set to `null` to remove the external invoicing data of the customer; omit to leave it unchanged.'),
|
|
8169
8190
|
})
|
|
8170
8191
|
.describe('App customer data.');
|
|
8171
8192
|
export const upsertAppCustomerDataRequestWire = z
|
|
8172
8193
|
.strictObject({
|
|
8173
|
-
stripe: appCustomerDataStripeWire
|
|
8174
|
-
|
|
8194
|
+
stripe: appCustomerDataStripeWire
|
|
8195
|
+
.nullable()
|
|
8196
|
+
.optional()
|
|
8197
|
+
.describe('Used if the customer has a linked Stripe app. Set to `null` to remove the Stripe data of the customer; omit to leave it unchanged.'),
|
|
8198
|
+
external_invoicing: appCustomerDataExternalInvoicingWire
|
|
8199
|
+
.nullable()
|
|
8200
|
+
.optional()
|
|
8201
|
+
.describe('Used if the customer has a linked external invoicing app. Set to `null` to remove the external invoicing data of the customer; omit to leave it unchanged.'),
|
|
8175
8202
|
})
|
|
8176
8203
|
.describe('AppCustomerData upsert request.');
|
|
8177
8204
|
export const creditAdjustmentWire = z
|
|
@@ -8865,32 +8892,6 @@ export const subscriptionCancelWire = z
|
|
|
8865
8892
|
timing: subscriptionEditTimingWire.optional(),
|
|
8866
8893
|
})
|
|
8867
8894
|
.describe('Request for canceling a subscription.');
|
|
8868
|
-
export const subscriptionChangeWire = z
|
|
8869
|
-
.strictObject({
|
|
8870
|
-
labels: labelsWire.optional(),
|
|
8871
|
-
settlement_mode: settlementModeWire.optional(),
|
|
8872
|
-
customer: z
|
|
8873
|
-
.strictObject({
|
|
8874
|
-
id: ulidWire.optional(),
|
|
8875
|
-
key: externalResourceKeyWire.optional(),
|
|
8876
|
-
})
|
|
8877
|
-
.describe('The customer to create the subscription for.'),
|
|
8878
|
-
plan: z
|
|
8879
|
-
.strictObject({
|
|
8880
|
-
id: ulidWire.optional(),
|
|
8881
|
-
key: resourceKeyWire.optional(),
|
|
8882
|
-
version: z
|
|
8883
|
-
.number()
|
|
8884
|
-
.int()
|
|
8885
|
-
.optional()
|
|
8886
|
-
.describe('The plan version of the subscription, if any. If not provided, the latest version of the plan will be used.'),
|
|
8887
|
-
})
|
|
8888
|
-
.describe('The plan reference of the subscription.'),
|
|
8889
|
-
billing_anchor: dateTimeWire.optional(),
|
|
8890
|
-
cost_basis_mode: subscriptionCostBasisModeWire.optional(),
|
|
8891
|
-
timing: subscriptionEditTimingWire,
|
|
8892
|
-
})
|
|
8893
|
-
.describe('Request for changing a subscription.');
|
|
8894
8895
|
export const createSubscriptionAddonRequestWire = z
|
|
8895
8896
|
.strictObject({
|
|
8896
8897
|
labels: labelsWire.optional(),
|
|
@@ -9927,23 +9928,6 @@ export const subscriptionItemWire = z
|
|
|
9927
9928
|
rate_card: rateCardWire,
|
|
9928
9929
|
})
|
|
9929
9930
|
.describe('A subscription item pins a rate card to a cadence within a subscription phase.');
|
|
9930
|
-
export const subscriptionEditAddItemWire = z
|
|
9931
|
-
.strictObject({
|
|
9932
|
-
type: z
|
|
9933
|
-
.literal('add_item')
|
|
9934
|
-
.describe('Discriminator for the add-item operation.'),
|
|
9935
|
-
phase_key: z.string().describe('The key of the phase to add the item to.'),
|
|
9936
|
-
rate_card: rateCardWire,
|
|
9937
|
-
})
|
|
9938
|
-
.describe('Add a new rate card to a phase. Adding an item to the current phase closes the active version of the same item key and appends a new version.');
|
|
9939
|
-
export const subscriptionAddonRateCardWire = z
|
|
9940
|
-
.strictObject({
|
|
9941
|
-
rate_card: rateCardWire,
|
|
9942
|
-
affected_subscription_item_ids: z
|
|
9943
|
-
.array(ulidWire)
|
|
9944
|
-
.describe('The IDs of the subscription items that this rate card belongs to.'),
|
|
9945
|
-
})
|
|
9946
|
-
.describe('A rate card for a subscription add-on.');
|
|
9947
9931
|
export const planPhaseWire = z
|
|
9948
9932
|
.strictObject({
|
|
9949
9933
|
name: z
|
|
@@ -9962,6 +9946,23 @@ export const planPhaseWire = z
|
|
|
9962
9946
|
rate_cards: z.array(rateCardWire).describe('The rate cards of the plan.'),
|
|
9963
9947
|
})
|
|
9964
9948
|
.describe("The plan phase or pricing ramp allows changing a plan's rate cards over time as a subscription progresses.");
|
|
9949
|
+
export const subscriptionEditAddItemWire = z
|
|
9950
|
+
.strictObject({
|
|
9951
|
+
type: z
|
|
9952
|
+
.literal('add_item')
|
|
9953
|
+
.describe('Discriminator for the add-item operation.'),
|
|
9954
|
+
phase_key: z.string().describe('The key of the phase to add the item to.'),
|
|
9955
|
+
rate_card: rateCardWire,
|
|
9956
|
+
})
|
|
9957
|
+
.describe('Add a new rate card to a phase. Adding an item to the current phase closes the active version of the same item key and appends a new version.');
|
|
9958
|
+
export const subscriptionAddonRateCardWire = z
|
|
9959
|
+
.strictObject({
|
|
9960
|
+
rate_card: rateCardWire,
|
|
9961
|
+
affected_subscription_item_ids: z
|
|
9962
|
+
.array(ulidWire)
|
|
9963
|
+
.describe('The IDs of the subscription items that this rate card belongs to.'),
|
|
9964
|
+
})
|
|
9965
|
+
.describe('A rate card for a subscription add-on.');
|
|
9965
9966
|
export const addonWire = z
|
|
9966
9967
|
.strictObject({
|
|
9967
9968
|
id: ulidWire,
|
|
@@ -10205,23 +10206,8 @@ export const subscriptionPhaseWire = z
|
|
|
10205
10206
|
.describe('The rate cards in effect for this phase, resolved to the version active at the queried time (the currently active version for the current phase, the first version for future phases, and the last version for past phases).'),
|
|
10206
10207
|
})
|
|
10207
10208
|
.describe("A subscription phase groups the rate cards in effect for a segment of the subscription's lifetime. Analogous to plan phases.");
|
|
10208
|
-
export const
|
|
10209
|
-
.discriminatedUnion('type', [
|
|
10210
|
-
subscriptionEditAddItemWire,
|
|
10211
|
-
subscriptionEditRemoveItemWire,
|
|
10212
|
-
subscriptionEditAddPhaseWire,
|
|
10213
|
-
subscriptionEditRemovePhaseWire,
|
|
10214
|
-
subscriptionEditStretchPhaseWire,
|
|
10215
|
-
subscriptionEditUnscheduleEditWire,
|
|
10216
|
-
])
|
|
10217
|
-
.describe('A single customization to apply to a running subscription. The `type` field discriminates which operation is performed.');
|
|
10218
|
-
export const subscriptionAddonWire = z
|
|
10209
|
+
export const subscriptionCustomPlanWire = z
|
|
10219
10210
|
.strictObject({
|
|
10220
|
-
id: ulidWire,
|
|
10221
|
-
labels: labelsWire.optional(),
|
|
10222
|
-
created_at: dateTimeWire,
|
|
10223
|
-
updated_at: dateTimeWire,
|
|
10224
|
-
deleted_at: dateTimeWire.optional(),
|
|
10225
10211
|
name: z
|
|
10226
10212
|
.string()
|
|
10227
10213
|
.min(1)
|
|
@@ -10232,23 +10218,19 @@ export const subscriptionAddonWire = z
|
|
|
10232
10218
|
.max(1024)
|
|
10233
10219
|
.optional()
|
|
10234
10220
|
.describe('Optional description of the resource. Maximum 1024 characters.'),
|
|
10235
|
-
|
|
10236
|
-
|
|
10237
|
-
|
|
10238
|
-
|
|
10239
|
-
.
|
|
10240
|
-
.
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
|
|
10244
|
-
|
|
10245
|
-
.
|
|
10246
|
-
.describe('The timeline of the add-on. The returned periods are sorted and continuous.'),
|
|
10247
|
-
rate_cards: z
|
|
10248
|
-
.array(subscriptionAddonRateCardWire)
|
|
10249
|
-
.describe('The rate cards of the add-on.'),
|
|
10221
|
+
labels: labelsWire.optional(),
|
|
10222
|
+
currency: billingCurrencyCodeWire,
|
|
10223
|
+
billing_cadence: iso8601DurationWire,
|
|
10224
|
+
pro_rating_enabled: z
|
|
10225
|
+
.boolean()
|
|
10226
|
+
.optional()
|
|
10227
|
+
.describe('Whether pro-rating is enabled for this plan.'),
|
|
10228
|
+
phases: z
|
|
10229
|
+
.array(planPhaseWire)
|
|
10230
|
+
.min(1)
|
|
10231
|
+
.describe('The plan phases define the pricing ramp for a subscription. A phase switch occurs only at the end of a billing period. At least one phase is required.'),
|
|
10250
10232
|
})
|
|
10251
|
-
.describe('
|
|
10233
|
+
.describe('An inline (custom) plan definition used to create or change a subscription without referencing a published plan. Mirrors the plan create shape without a key or version, since a custom plan is not persisted or versioned on its own.');
|
|
10252
10234
|
export const planWire = z
|
|
10253
10235
|
.strictObject({
|
|
10254
10236
|
id: ulidWire,
|
|
@@ -10341,6 +10323,50 @@ export const upsertPlanRequestWire = z
|
|
|
10341
10323
|
.describe('The plan phases define the pricing ramp for a subscription. A phase switch occurs only at the end of a billing period. At least one phase is required.'),
|
|
10342
10324
|
})
|
|
10343
10325
|
.describe('Plan upsert request.');
|
|
10326
|
+
export const subscriptionEditOperationWire = z
|
|
10327
|
+
.discriminatedUnion('type', [
|
|
10328
|
+
subscriptionEditAddItemWire,
|
|
10329
|
+
subscriptionEditRemoveItemWire,
|
|
10330
|
+
subscriptionEditAddPhaseWire,
|
|
10331
|
+
subscriptionEditRemovePhaseWire,
|
|
10332
|
+
subscriptionEditStretchPhaseWire,
|
|
10333
|
+
subscriptionEditUnscheduleEditWire,
|
|
10334
|
+
])
|
|
10335
|
+
.describe('A single customization to apply to a running subscription. The `type` field discriminates which operation is performed.');
|
|
10336
|
+
export const subscriptionAddonWire = z
|
|
10337
|
+
.strictObject({
|
|
10338
|
+
id: ulidWire,
|
|
10339
|
+
labels: labelsWire.optional(),
|
|
10340
|
+
created_at: dateTimeWire,
|
|
10341
|
+
updated_at: dateTimeWire,
|
|
10342
|
+
deleted_at: dateTimeWire.optional(),
|
|
10343
|
+
name: z
|
|
10344
|
+
.string()
|
|
10345
|
+
.min(1)
|
|
10346
|
+
.max(256)
|
|
10347
|
+
.describe('Display name of the resource. Between 1 and 256 characters.'),
|
|
10348
|
+
description: z
|
|
10349
|
+
.string()
|
|
10350
|
+
.max(1024)
|
|
10351
|
+
.optional()
|
|
10352
|
+
.describe('Optional description of the resource. Maximum 1024 characters.'),
|
|
10353
|
+
addon: addonReferenceWire,
|
|
10354
|
+
quantity: z
|
|
10355
|
+
.number()
|
|
10356
|
+
.int()
|
|
10357
|
+
.gte(1)
|
|
10358
|
+
.describe('The quantity of the add-on. Always 1 for single instance add-ons.'),
|
|
10359
|
+
quantity_at: dateTimeWire,
|
|
10360
|
+
active_from: dateTimeWire,
|
|
10361
|
+
active_to: dateTimeWire.optional(),
|
|
10362
|
+
timeline: z
|
|
10363
|
+
.array(subscriptionAddonTimelineSegmentWire)
|
|
10364
|
+
.describe('The timeline of the add-on. The returned periods are sorted and continuous.'),
|
|
10365
|
+
rate_cards: z
|
|
10366
|
+
.array(subscriptionAddonRateCardWire)
|
|
10367
|
+
.describe('The rate cards of the add-on.'),
|
|
10368
|
+
})
|
|
10369
|
+
.describe('Addon purchased with a subscription.');
|
|
10344
10370
|
export const addonPagePaginatedResponseWire = z
|
|
10345
10371
|
.strictObject({
|
|
10346
10372
|
data: z.array(addonWire),
|
|
@@ -10397,6 +10423,65 @@ export const subscriptionWire = z
|
|
|
10397
10423
|
.describe("The phases of the subscription in chronological order. A phase groups the rate cards that are in effect for a segment of the subscription's lifetime."),
|
|
10398
10424
|
})
|
|
10399
10425
|
.describe('Subscription.');
|
|
10426
|
+
export const subscriptionCreateWire = z.strictObject({
|
|
10427
|
+
labels: labelsWire.optional(),
|
|
10428
|
+
settlement_mode: settlementModeWire.optional(),
|
|
10429
|
+
customer: z
|
|
10430
|
+
.strictObject({
|
|
10431
|
+
id: ulidWire.optional(),
|
|
10432
|
+
key: externalResourceKeyWire.optional(),
|
|
10433
|
+
})
|
|
10434
|
+
.describe('The customer to create the subscription for.'),
|
|
10435
|
+
plan: z
|
|
10436
|
+
.strictObject({
|
|
10437
|
+
id: ulidWire.optional(),
|
|
10438
|
+
key: resourceKeyWire.optional(),
|
|
10439
|
+
version: z
|
|
10440
|
+
.number()
|
|
10441
|
+
.int()
|
|
10442
|
+
.optional()
|
|
10443
|
+
.describe('The plan version of the subscription, if any. If not provided, the latest version of the plan will be used.'),
|
|
10444
|
+
})
|
|
10445
|
+
.optional()
|
|
10446
|
+
.describe('A reference to a published plan the subscription is created from. Exactly one of `plan` or `custom_plan` must be provided. Use `plan` to base the subscription on an existing published plan; use `custom_plan` to define the plan inline.'),
|
|
10447
|
+
custom_plan: subscriptionCustomPlanWire.optional(),
|
|
10448
|
+
billing_anchor: dateTimeWire.optional(),
|
|
10449
|
+
cost_basis_mode: subscriptionCostBasisModeWire.optional(),
|
|
10450
|
+
});
|
|
10451
|
+
export const subscriptionChangeWire = z
|
|
10452
|
+
.strictObject({
|
|
10453
|
+
labels: labelsWire.optional(),
|
|
10454
|
+
settlement_mode: settlementModeWire.optional(),
|
|
10455
|
+
customer: z
|
|
10456
|
+
.strictObject({
|
|
10457
|
+
id: ulidWire.optional(),
|
|
10458
|
+
key: externalResourceKeyWire.optional(),
|
|
10459
|
+
})
|
|
10460
|
+
.describe('The customer to create the subscription for.'),
|
|
10461
|
+
plan: z
|
|
10462
|
+
.strictObject({
|
|
10463
|
+
id: ulidWire.optional(),
|
|
10464
|
+
key: resourceKeyWire.optional(),
|
|
10465
|
+
version: z
|
|
10466
|
+
.number()
|
|
10467
|
+
.int()
|
|
10468
|
+
.optional()
|
|
10469
|
+
.describe('The plan version of the subscription, if any. If not provided, the latest version of the plan will be used.'),
|
|
10470
|
+
})
|
|
10471
|
+
.optional()
|
|
10472
|
+
.describe('A reference to a published plan the subscription is created from. Exactly one of `plan` or `custom_plan` must be provided. Use `plan` to base the subscription on an existing published plan; use `custom_plan` to define the plan inline.'),
|
|
10473
|
+
custom_plan: subscriptionCustomPlanWire.optional(),
|
|
10474
|
+
billing_anchor: dateTimeWire.optional(),
|
|
10475
|
+
cost_basis_mode: subscriptionCostBasisModeWire.optional(),
|
|
10476
|
+
timing: subscriptionEditTimingWire,
|
|
10477
|
+
})
|
|
10478
|
+
.describe('Request for changing a subscription.');
|
|
10479
|
+
export const planPagePaginatedResponseWire = z
|
|
10480
|
+
.strictObject({
|
|
10481
|
+
data: z.array(planWire),
|
|
10482
|
+
meta: paginatedMetaWire,
|
|
10483
|
+
})
|
|
10484
|
+
.describe('Page paginated response.');
|
|
10400
10485
|
export const subscriptionEditWire = z
|
|
10401
10486
|
.strictObject({
|
|
10402
10487
|
customizations: z
|
|
@@ -10412,12 +10497,6 @@ export const subscriptionAddonPagePaginatedResponseWire = z
|
|
|
10412
10497
|
meta: paginatedMetaWire,
|
|
10413
10498
|
})
|
|
10414
10499
|
.describe('Page paginated response.');
|
|
10415
|
-
export const planPagePaginatedResponseWire = z
|
|
10416
|
-
.strictObject({
|
|
10417
|
-
data: z.array(planWire),
|
|
10418
|
-
meta: paginatedMetaWire,
|
|
10419
|
-
})
|
|
10420
|
-
.describe('Page paginated response.');
|
|
10421
10500
|
export const invoiceStandardWire = z
|
|
10422
10501
|
.strictObject({
|
|
10423
10502
|
id: ulidWire,
|