@leaflow/sdk 0.127.1 → 0.129.1

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.
Files changed (47) hide show
  1. package/dist/billing/type/order/v1/generated/models.d.ts +53 -20
  2. package/dist/billing/type/order/v1/generated/models.js +13 -8
  3. package/dist/billing/type/order/v1/generated/validators/orderItem.zod.js +8 -2
  4. package/dist/billing/type/order/v1/generated/validators/scheduledChange.zod.d.ts +34 -0
  5. package/dist/billing/type/order/v1/generated/validators/scheduledChange.zod.js +26 -0
  6. package/dist/billing/type/order/v1/generated/validators/subscription.zod.d.ts +24 -0
  7. package/dist/billing/type/order/v1/generated/validators/subscription.zod.js +5 -0
  8. package/dist/billing/type/order/v1/generated/validators/subscriptionList.zod.d.ts +24 -0
  9. package/dist/billing/v1/generated/functions.d.ts +5 -3
  10. package/dist/billing/v1/generated/functions.js +5 -3
  11. package/dist/billing/v1/generated/models.d.ts +57 -20
  12. package/dist/billing/v1/generated/models.js +13 -8
  13. package/dist/billing/v1/generated/schemas.zod.d.ts +6 -3
  14. package/dist/billing/v1/generated/schemas.zod.js +9 -3
  15. package/dist/billing/v1/generated/validators/listInvoicesParams.zod.d.ts +1 -0
  16. package/dist/billing/v1/generated/validators/listInvoicesParams.zod.js +1 -0
  17. package/dist/billing/v1/generated/validators/orderItem.zod.js +8 -2
  18. package/dist/billing/v1/generated/validators/scheduledChange.zod.d.ts +34 -0
  19. package/dist/billing/v1/generated/validators/scheduledChange.zod.js +26 -0
  20. package/dist/billing/v1/generated/validators/subscription.zod.d.ts +24 -0
  21. package/dist/billing/v1/generated/validators/subscription.zod.js +5 -0
  22. package/dist/billing/v1/generated/validators/subscriptionList.zod.d.ts +24 -0
  23. package/dist/canopy/v1/generated/models.d.ts +53 -20
  24. package/dist/canopy/v1/generated/models.js +13 -8
  25. package/dist/canopy/v1/generated/validators/orderItem.zod.js +8 -2
  26. package/dist/canopy/v1/generated/validators/scheduledChange.zod.d.ts +57 -0
  27. package/dist/canopy/v1/generated/validators/scheduledChange.zod.js +49 -0
  28. package/dist/canopy/v1/generated/validators/subscription.zod.d.ts +24 -0
  29. package/dist/canopy/v1/generated/validators/subscription.zod.js +5 -0
  30. package/dist/canopy/v1/generated/validators/subscriptionList.zod.d.ts +24 -0
  31. package/dist/compute/v1/generated/models.d.ts +53 -20
  32. package/dist/compute/v1/generated/models.js +13 -8
  33. package/dist/compute/v1/generated/validators/orderItem.zod.js +8 -2
  34. package/dist/compute/v1/generated/validators/scheduledChange.zod.d.ts +50 -0
  35. package/dist/compute/v1/generated/validators/scheduledChange.zod.js +42 -0
  36. package/dist/compute/v1/generated/validators/subscription.zod.d.ts +24 -0
  37. package/dist/compute/v1/generated/validators/subscription.zod.js +5 -0
  38. package/dist/compute/v1/generated/validators/subscriptionList.zod.d.ts +24 -0
  39. package/dist/membership/v1/generated/models.d.ts +53 -20
  40. package/dist/membership/v1/generated/models.js +13 -8
  41. package/dist/membership/v1/generated/validators/orderItem.zod.js +8 -2
  42. package/dist/membership/v1/generated/validators/scheduledChange.zod.d.ts +34 -0
  43. package/dist/membership/v1/generated/validators/scheduledChange.zod.js +26 -0
  44. package/dist/membership/v1/generated/validators/subscription.zod.d.ts +24 -0
  45. package/dist/membership/v1/generated/validators/subscription.zod.js +5 -0
  46. package/dist/membership/v1/generated/validators/subscriptionList.zod.d.ts +24 -0
  47. package/package.json +1 -1
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Billing API
5
+ * Products, prices, orders, subscriptions and account billing. Financial operations require an account access token and billing-account authorization. Public catalogue operations declare no security requirement.
6
+ * OpenAPI spec version: v1
7
+ */
8
+ import * as zod from "zod";
9
+ import { OrderStatus } from "./orderStatus.zod.js";
10
+ export const ScheduledChange = zod
11
+ .strictObject({
12
+ order_id: zod.uuid(),
13
+ status: OrderStatus,
14
+ effective_at: zod.iso
15
+ .datetime({ offset: true })
16
+ .describe("When the target terms take effect, normally the end of the current paid period."),
17
+ plan_id: zod.uuid(),
18
+ plan_name: zod.string(),
19
+ price_id: zod.uuid(),
20
+ quantity: zod.string(),
21
+ recurring_amount: zod.string().describe("The target prepaid renewal amount before tax."),
22
+ currency: zod.string(),
23
+ interval: zod.enum(["day", "month", "year"]),
24
+ interval_count: zod.int().min(1),
25
+ })
26
+ .describe("The next accepted period-end change for a subscription. It describes the target terms and does not change the current subscription until effective_at.");
@@ -68,6 +68,30 @@ export declare const Subscription: zod.ZodObject<{
68
68
  failure_code: zod.ZodOptional<zod.ZodString>;
69
69
  failure_reason: zod.ZodOptional<zod.ZodString>;
70
70
  }, zod.z.core.$strict>>;
71
+ scheduled_change: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
72
+ order_id: zod.ZodUUID;
73
+ status: zod.ZodEnum<{
74
+ pending: "pending";
75
+ completed: "completed";
76
+ failed: "failed";
77
+ canceled: "canceled";
78
+ accepted: "accepted";
79
+ partially_completed: "partially_completed";
80
+ }>;
81
+ effective_at: zod.z.ZodISODateTime;
82
+ plan_id: zod.ZodUUID;
83
+ plan_name: zod.ZodString;
84
+ price_id: zod.ZodUUID;
85
+ quantity: zod.ZodString;
86
+ recurring_amount: zod.ZodString;
87
+ currency: zod.ZodString;
88
+ interval: zod.ZodEnum<{
89
+ day: "day";
90
+ month: "month";
91
+ year: "year";
92
+ }>;
93
+ interval_count: zod.ZodInt;
94
+ }, zod.z.core.$strict>, zod.ZodNull]>>;
71
95
  default_payment_method_id: zod.ZodOptional<zod.ZodNullable<zod.ZodUUID>>;
72
96
  created_at: zod.ZodOptional<zod.z.ZodISODateTime>;
73
97
  id: zod.ZodUUID;
@@ -12,6 +12,7 @@ import { ObjectIdentity } from "./objectIdentity.zod.js";
12
12
  import { Product } from "./product.zod.js";
13
13
  import { ProductID } from "./productID.zod.js";
14
14
  import { RefundPolicy } from "./refundPolicy.zod.js";
15
+ import { ScheduledChange } from "./scheduledChange.zod.js";
15
16
  import { SubscriptionCancellation } from "./subscriptionCancellation.zod.js";
16
17
  import { TerminationPolicy } from "./terminationPolicy.zod.js";
17
18
  export const subscriptionDiscountedRenewalsRemainingMin = 0;
@@ -41,6 +42,10 @@ export const Subscription = zod
41
42
  suspend_reason: zod.string().optional(),
42
43
  billing_cycle_anchor: zod.iso.datetime({ offset: true }).optional(),
43
44
  cancellation: SubscriptionCancellation.optional(),
45
+ scheduled_change: zod
46
+ .union([ScheduledChange, zod.null()])
47
+ .optional()
48
+ .describe("The accepted period-end change currently scheduled for this subscription. Null when no such change exists."),
44
49
  default_payment_method_id: zod
45
50
  .uuid()
46
51
  .nullish()
@@ -68,6 +68,30 @@ export declare const SubscriptionList: zod.ZodObject<{
68
68
  failure_code: zod.ZodOptional<zod.ZodString>;
69
69
  failure_reason: zod.ZodOptional<zod.ZodString>;
70
70
  }, zod.z.core.$strict>>;
71
+ scheduled_change: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
72
+ order_id: zod.ZodUUID;
73
+ status: zod.ZodEnum<{
74
+ pending: "pending";
75
+ completed: "completed";
76
+ failed: "failed";
77
+ canceled: "canceled";
78
+ accepted: "accepted";
79
+ partially_completed: "partially_completed";
80
+ }>;
81
+ effective_at: zod.z.ZodISODateTime;
82
+ plan_id: zod.ZodUUID;
83
+ plan_name: zod.ZodString;
84
+ price_id: zod.ZodUUID;
85
+ quantity: zod.ZodString;
86
+ recurring_amount: zod.ZodString;
87
+ currency: zod.ZodString;
88
+ interval: zod.ZodEnum<{
89
+ day: "day";
90
+ month: "month";
91
+ year: "year";
92
+ }>;
93
+ interval_count: zod.ZodInt;
94
+ }, zod.z.core.$strict>, zod.ZodNull]>>;
71
95
  default_payment_method_id: zod.ZodOptional<zod.ZodNullable<zod.ZodUUID>>;
72
96
  created_at: zod.ZodOptional<zod.z.ZodISODateTime>;
73
97
  id: zod.ZodUUID;
@@ -2271,6 +2271,49 @@ export declare const SubscriptionInterval: {
2271
2271
  readonly month: "month";
2272
2272
  readonly year: "year";
2273
2273
  };
2274
+ /**
2275
+ * Follows the items. `pending` is not yet accepted and may be unpaid or paid; its invoice shows
2276
+ * whether payment is still needed, and it can expire or be canceled. `accepted` is accepted with items still
2277
+ * being set up. `completed` means every item was set up. `partially_completed` means some items were set up
2278
+ * and the others failed or were canceled and were refunded to their original payment sources. `failed` means
2279
+ * no item was delivered and at least one failed; collected amounts for the undelivered items are refunded.
2280
+ * `canceled` means every item was withdrawn without delivery; collected amounts are returned to their original
2281
+ * payment sources. No status establishes service delivery by itself.
2282
+ */
2283
+ export type OrderStatus = (typeof OrderStatus)[keyof typeof OrderStatus];
2284
+ export declare const OrderStatus: {
2285
+ readonly pending: "pending";
2286
+ readonly accepted: "accepted";
2287
+ readonly completed: "completed";
2288
+ readonly partially_completed: "partially_completed";
2289
+ readonly failed: "failed";
2290
+ readonly canceled: "canceled";
2291
+ };
2292
+ export type ScheduledChangeInterval = (typeof ScheduledChangeInterval)[keyof typeof ScheduledChangeInterval];
2293
+ export declare const ScheduledChangeInterval: {
2294
+ readonly day: "day";
2295
+ readonly month: "month";
2296
+ readonly year: "year";
2297
+ };
2298
+ /**
2299
+ * The next accepted period-end change for a subscription. It describes the target terms and does not change the current subscription until effective_at.
2300
+ */
2301
+ export interface ScheduledChange {
2302
+ order_id: string;
2303
+ status: OrderStatus;
2304
+ /** When the target terms take effect, normally the end of the current paid period. */
2305
+ effective_at: string;
2306
+ plan_id: string;
2307
+ plan_name: string;
2308
+ price_id: string;
2309
+ quantity: string;
2310
+ /** The target prepaid renewal amount before tax. */
2311
+ recurring_amount: string;
2312
+ currency: string;
2313
+ interval: ScheduledChangeInterval;
2314
+ /** @minimum 1 */
2315
+ interval_count: number;
2316
+ }
2274
2317
  /**
2275
2318
  * pending means the purchase relationship exists but its order has not been accepted.
2276
2319
  * provisioning means the service accepted the order and is delivering. For a service-owned
@@ -2335,6 +2378,8 @@ export interface Subscription {
2335
2378
  suspend_reason?: string;
2336
2379
  billing_cycle_anchor?: string;
2337
2380
  cancellation?: SubscriptionCancellation;
2381
+ /** The accepted period-end change currently scheduled for this subscription. Null when no such change exists. */
2382
+ scheduled_change?: ScheduledChange | null;
2338
2383
  /**
2339
2384
  * The saved payment method automatic renewal charges after the account's balance and credits,
2340
2385
  * before the account's default payment method. Set when the purchase, a renewal or a change is paid with a
@@ -2511,24 +2556,6 @@ export interface RenewalOrderRequest {
2511
2556
  export interface AutoRenewSet {
2512
2557
  auto_renew: boolean;
2513
2558
  }
2514
- /**
2515
- * Follows the items. `pending` is not yet accepted and may be unpaid or paid; its invoice shows
2516
- * whether payment is still needed, and it can expire or be canceled. `accepted` is accepted with items still
2517
- * being set up. `completed` means every item was set up. `partially_completed` means some items were set up
2518
- * and the others failed or were canceled and were refunded to their original payment sources. `failed` means
2519
- * no item was delivered and at least one failed; collected amounts for the undelivered items are refunded.
2520
- * `canceled` means every item was withdrawn without delivery; collected amounts are returned to their original
2521
- * payment sources. No status establishes service delivery by itself.
2522
- */
2523
- export type OrderStatus = (typeof OrderStatus)[keyof typeof OrderStatus];
2524
- export declare const OrderStatus: {
2525
- readonly pending: "pending";
2526
- readonly accepted: "accepted";
2527
- readonly completed: "completed";
2528
- readonly partially_completed: "partially_completed";
2529
- readonly failed: "failed";
2530
- readonly canceled: "canceled";
2531
- };
2532
2559
  /**
2533
2560
  * `pending` is waiting to be set up. `completed` was confirmed by the service.
2534
2561
  * `failed` was not set up and its amount was refunded to the original payment sources.
@@ -2688,9 +2715,15 @@ export interface OrderItem {
2688
2715
  /** `gross_amount` less `discount_amount`. */
2689
2716
  amount?: Money;
2690
2717
  currency: string;
2691
- /** @nullable */
2718
+ /**
2719
+ * The start of the service period this line paid for. Frozen at placement for renewals and period-end changes; for a prepaid line of a new purchase, fixed from the second its invoice is paid and kept when delivery is confirmed. Absent for postpaid and one-time lines.
2720
+ * @nullable
2721
+ */
2692
2722
  period_start?: string | null;
2693
- /** @nullable */
2723
+ /**
2724
+ * The end of that service period, exclusive.
2725
+ * @nullable
2726
+ */
2694
2727
  period_end?: string | null;
2695
2728
  status: OrderItemStatus;
2696
2729
  }
@@ -259,6 +259,19 @@ export const SubscriptionInterval = {
259
259
  month: "month",
260
260
  year: "year",
261
261
  };
262
+ export const OrderStatus = {
263
+ pending: "pending",
264
+ accepted: "accepted",
265
+ completed: "completed",
266
+ partially_completed: "partially_completed",
267
+ failed: "failed",
268
+ canceled: "canceled",
269
+ };
270
+ export const ScheduledChangeInterval = {
271
+ day: "day",
272
+ month: "month",
273
+ year: "year",
274
+ };
262
275
  export const SubscriptionStatus = {
263
276
  pending: "pending",
264
277
  provisioning: "provisioning",
@@ -282,14 +295,6 @@ export const RenewalOrderRequestInterval = {
282
295
  month: "month",
283
296
  year: "year",
284
297
  };
285
- export const OrderStatus = {
286
- pending: "pending",
287
- accepted: "accepted",
288
- completed: "completed",
289
- partially_completed: "partially_completed",
290
- failed: "failed",
291
- canceled: "canceled",
292
- };
293
298
  export const OrderItemStatus = {
294
299
  pending: "pending",
295
300
  completed: "completed",
@@ -88,8 +88,14 @@ export const OrderItem = zod
88
88
  discount_amount: Money.optional().describe("The reduction on this line: from the coupon the order uses and, for a renewal at the agreed terms,\nfrom the discount the subscription carries.\n\nA carried discount is part of the agreed amount. It is listed here, and `gross_amount` is then\n`unit_amount` times `quantity`, except in two cases where `gross_amount` is the agreed amount and\nthe carried discount is already reflected in it: the renewal order also uses a coupon the account\nholds, or the account's tax rate is inclusive."),
89
89
  amount: Money.optional().describe("`gross_amount` less `discount_amount`."),
90
90
  currency: zod.string(),
91
- period_start: zod.iso.datetime({ offset: true }).nullish(),
92
- period_end: zod.iso.datetime({ offset: true }).nullish(),
91
+ period_start: zod.iso
92
+ .datetime({ offset: true })
93
+ .nullish()
94
+ .describe("The start of the service period this line paid for. Frozen at placement for renewals and period-end changes; for a prepaid line of a new purchase, fixed from the second its invoice is paid and kept when delivery is confirmed. Absent for postpaid and one-time lines."),
95
+ period_end: zod.iso
96
+ .datetime({ offset: true })
97
+ .nullish()
98
+ .describe("The end of that service period, exclusive."),
93
99
  status: OrderItemStatus,
94
100
  })
95
101
  .describe("Frozen purchase terms. Monetary fields come from related invoice-line snapshots and are zero\nfor a line with no immediate charge, such as postpaid admission. Later catalog changes do not reprice this line. A new service\npurchase creates its pending subscription when this item is recorded, not when payment succeeds.");
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Canopy API
5
+ * Management of API keys, together with the models available and the usage recorded against them.
6
+ *
7
+ * **These endpoints do not perform inference.** Requests are issued to the forwarding address, which accepts the OpenAI, Anthropic and Gemini request formats:
8
+ *
9
+ * ```
10
+ * POST /v1/chat/completions OpenAI
11
+ * POST /v1/messages Anthropic
12
+ * POST /v1beta/models/{model}:generateContent Gemini
13
+ * ```
14
+ *
15
+ * ## Authentication
16
+ *
17
+ * Every request carries a scoped token; see the `bearerAuth` security scheme.
18
+ *
19
+ * These endpoints do not accept an API key, and the forwarding endpoints do not accept a scoped token.
20
+ *
21
+ * ## Conventions
22
+ *
23
+ * - **The plaintext of an API key is returned once.** The `secret` appears in the response that issues it and is returned by no other endpoint. A key that has been lost has to be revoked and reissued.
24
+ * - **Disabling and revoking are distinct.** A disabled key may be enabled again at any time, while a revocation is irreversible and is intended for a key that has been exposed. Neither removes the record, and the usage the key accrued remains readable.
25
+ * - **A usage query must carry a time range**, spanning no more than 31 days. `from` and `to` carry a timezone offset, which the server does not infer.
26
+ * - **The request and response bodies do not appear in the ledger.** They are not recorded. Quote the `upstream_request_id` from the response when reporting a problem.
27
+ * - **Usage may be estimated.** The upstream provider does not report usage on every request. Where it does not, `usage_source` is `estimated` and the figures are derived from the character classes of the payload, to within roughly fifteen per cent.
28
+ * - **The service is enabled before use.** A project enables the model platform once, through `create-service`; the forwarding endpoints refuse its requests until the service is `active`. Requests are then billed under the service's subscription by the tokens they use, at the rates stated in each model's `pricing`.
29
+ * OpenAPI spec version: 1.0.0
30
+ */
31
+ import * as zod from "zod";
32
+ export declare const ScheduledChange: zod.ZodObject<{
33
+ order_id: zod.ZodUUID;
34
+ status: zod.ZodEnum<{
35
+ pending: "pending";
36
+ completed: "completed";
37
+ failed: "failed";
38
+ canceled: "canceled";
39
+ accepted: "accepted";
40
+ partially_completed: "partially_completed";
41
+ }>;
42
+ effective_at: zod.z.ZodISODateTime;
43
+ plan_id: zod.ZodUUID;
44
+ plan_name: zod.ZodString;
45
+ price_id: zod.ZodUUID;
46
+ quantity: zod.ZodString;
47
+ recurring_amount: zod.ZodString;
48
+ currency: zod.ZodString;
49
+ interval: zod.ZodEnum<{
50
+ day: "day";
51
+ month: "month";
52
+ year: "year";
53
+ }>;
54
+ interval_count: zod.ZodInt;
55
+ }, zod.z.core.$strict>;
56
+ export type ScheduledChange = zod.input<typeof ScheduledChange>;
57
+ export type ScheduledChangeOutput = zod.output<typeof ScheduledChange>;
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Canopy API
5
+ * Management of API keys, together with the models available and the usage recorded against them.
6
+ *
7
+ * **These endpoints do not perform inference.** Requests are issued to the forwarding address, which accepts the OpenAI, Anthropic and Gemini request formats:
8
+ *
9
+ * ```
10
+ * POST /v1/chat/completions OpenAI
11
+ * POST /v1/messages Anthropic
12
+ * POST /v1beta/models/{model}:generateContent Gemini
13
+ * ```
14
+ *
15
+ * ## Authentication
16
+ *
17
+ * Every request carries a scoped token; see the `bearerAuth` security scheme.
18
+ *
19
+ * These endpoints do not accept an API key, and the forwarding endpoints do not accept a scoped token.
20
+ *
21
+ * ## Conventions
22
+ *
23
+ * - **The plaintext of an API key is returned once.** The `secret` appears in the response that issues it and is returned by no other endpoint. A key that has been lost has to be revoked and reissued.
24
+ * - **Disabling and revoking are distinct.** A disabled key may be enabled again at any time, while a revocation is irreversible and is intended for a key that has been exposed. Neither removes the record, and the usage the key accrued remains readable.
25
+ * - **A usage query must carry a time range**, spanning no more than 31 days. `from` and `to` carry a timezone offset, which the server does not infer.
26
+ * - **The request and response bodies do not appear in the ledger.** They are not recorded. Quote the `upstream_request_id` from the response when reporting a problem.
27
+ * - **Usage may be estimated.** The upstream provider does not report usage on every request. Where it does not, `usage_source` is `estimated` and the figures are derived from the character classes of the payload, to within roughly fifteen per cent.
28
+ * - **The service is enabled before use.** A project enables the model platform once, through `create-service`; the forwarding endpoints refuse its requests until the service is `active`. Requests are then billed under the service's subscription by the tokens they use, at the rates stated in each model's `pricing`.
29
+ * OpenAPI spec version: 1.0.0
30
+ */
31
+ import * as zod from "zod";
32
+ import { OrderStatus } from "./orderStatus.zod.js";
33
+ export const ScheduledChange = zod
34
+ .strictObject({
35
+ order_id: zod.uuid(),
36
+ status: OrderStatus,
37
+ effective_at: zod.iso
38
+ .datetime({ offset: true })
39
+ .describe("When the target terms take effect, normally the end of the current paid period."),
40
+ plan_id: zod.uuid(),
41
+ plan_name: zod.string(),
42
+ price_id: zod.uuid(),
43
+ quantity: zod.string(),
44
+ recurring_amount: zod.string().describe("The target prepaid renewal amount before tax."),
45
+ currency: zod.string(),
46
+ interval: zod.enum(["day", "month", "year"]),
47
+ interval_count: zod.int().min(1),
48
+ })
49
+ .describe("The next accepted period-end change for a subscription. It describes the target terms and does not change the current subscription until effective_at.");
@@ -91,6 +91,30 @@ export declare const Subscription: zod.ZodObject<{
91
91
  failure_code: zod.ZodOptional<zod.ZodString>;
92
92
  failure_reason: zod.ZodOptional<zod.ZodString>;
93
93
  }, zod.z.core.$strict>>;
94
+ scheduled_change: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
95
+ order_id: zod.ZodUUID;
96
+ status: zod.ZodEnum<{
97
+ pending: "pending";
98
+ completed: "completed";
99
+ failed: "failed";
100
+ canceled: "canceled";
101
+ accepted: "accepted";
102
+ partially_completed: "partially_completed";
103
+ }>;
104
+ effective_at: zod.z.ZodISODateTime;
105
+ plan_id: zod.ZodUUID;
106
+ plan_name: zod.ZodString;
107
+ price_id: zod.ZodUUID;
108
+ quantity: zod.ZodString;
109
+ recurring_amount: zod.ZodString;
110
+ currency: zod.ZodString;
111
+ interval: zod.ZodEnum<{
112
+ day: "day";
113
+ month: "month";
114
+ year: "year";
115
+ }>;
116
+ interval_count: zod.ZodInt;
117
+ }, zod.z.core.$strict>, zod.ZodNull]>>;
94
118
  default_payment_method_id: zod.ZodOptional<zod.ZodNullable<zod.ZodUUID>>;
95
119
  created_at: zod.ZodOptional<zod.z.ZodISODateTime>;
96
120
  id: zod.ZodUUID;
@@ -35,6 +35,7 @@ import { ObjectIdentity } from "./objectIdentity.zod.js";
35
35
  import { Product } from "./product.zod.js";
36
36
  import { ProductID } from "./productID.zod.js";
37
37
  import { RefundPolicy } from "./refundPolicy.zod.js";
38
+ import { ScheduledChange } from "./scheduledChange.zod.js";
38
39
  import { SubscriptionCancellation } from "./subscriptionCancellation.zod.js";
39
40
  import { TerminationPolicy } from "./terminationPolicy.zod.js";
40
41
  export const subscriptionDiscountedRenewalsRemainingMin = 0;
@@ -64,6 +65,10 @@ export const Subscription = zod
64
65
  suspend_reason: zod.string().optional(),
65
66
  billing_cycle_anchor: zod.iso.datetime({ offset: true }).optional(),
66
67
  cancellation: SubscriptionCancellation.optional(),
68
+ scheduled_change: zod
69
+ .union([ScheduledChange, zod.null()])
70
+ .optional()
71
+ .describe("The accepted period-end change currently scheduled for this subscription. Null when no such change exists."),
67
72
  default_payment_method_id: zod
68
73
  .uuid()
69
74
  .nullish()
@@ -91,6 +91,30 @@ export declare const SubscriptionList: zod.ZodObject<{
91
91
  failure_code: zod.ZodOptional<zod.ZodString>;
92
92
  failure_reason: zod.ZodOptional<zod.ZodString>;
93
93
  }, zod.z.core.$strict>>;
94
+ scheduled_change: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
95
+ order_id: zod.ZodUUID;
96
+ status: zod.ZodEnum<{
97
+ pending: "pending";
98
+ completed: "completed";
99
+ failed: "failed";
100
+ canceled: "canceled";
101
+ accepted: "accepted";
102
+ partially_completed: "partially_completed";
103
+ }>;
104
+ effective_at: zod.z.ZodISODateTime;
105
+ plan_id: zod.ZodUUID;
106
+ plan_name: zod.ZodString;
107
+ price_id: zod.ZodUUID;
108
+ quantity: zod.ZodString;
109
+ recurring_amount: zod.ZodString;
110
+ currency: zod.ZodString;
111
+ interval: zod.ZodEnum<{
112
+ day: "day";
113
+ month: "month";
114
+ year: "year";
115
+ }>;
116
+ interval_count: zod.ZodInt;
117
+ }, zod.z.core.$strict>, zod.ZodNull]>>;
94
118
  default_payment_method_id: zod.ZodOptional<zod.ZodNullable<zod.ZodUUID>>;
95
119
  created_at: zod.ZodOptional<zod.z.ZodISODateTime>;
96
120
  id: zod.ZodUUID;
@@ -4217,6 +4217,49 @@ export declare const SubscriptionInterval: {
4217
4217
  readonly month: "month";
4218
4218
  readonly year: "year";
4219
4219
  };
4220
+ /**
4221
+ * Follows the items. `pending` is not yet accepted and may be unpaid or paid; its invoice shows
4222
+ * whether payment is still needed, and it can expire or be canceled. `accepted` is accepted with items still
4223
+ * being set up. `completed` means every item was set up. `partially_completed` means some items were set up
4224
+ * and the others failed or were canceled and were refunded to their original payment sources. `failed` means
4225
+ * no item was delivered and at least one failed; collected amounts for the undelivered items are refunded.
4226
+ * `canceled` means every item was withdrawn without delivery; collected amounts are returned to their original
4227
+ * payment sources. No status establishes service delivery by itself.
4228
+ */
4229
+ export type OrderStatus = (typeof OrderStatus)[keyof typeof OrderStatus];
4230
+ export declare const OrderStatus: {
4231
+ readonly pending: "pending";
4232
+ readonly accepted: "accepted";
4233
+ readonly completed: "completed";
4234
+ readonly partially_completed: "partially_completed";
4235
+ readonly failed: "failed";
4236
+ readonly canceled: "canceled";
4237
+ };
4238
+ export type ScheduledChangeInterval = (typeof ScheduledChangeInterval)[keyof typeof ScheduledChangeInterval];
4239
+ export declare const ScheduledChangeInterval: {
4240
+ readonly day: "day";
4241
+ readonly month: "month";
4242
+ readonly year: "year";
4243
+ };
4244
+ /**
4245
+ * The next accepted period-end change for a subscription. It describes the target terms and does not change the current subscription until effective_at.
4246
+ */
4247
+ export interface ScheduledChange {
4248
+ order_id: string;
4249
+ status: OrderStatus;
4250
+ /** When the target terms take effect, normally the end of the current paid period. */
4251
+ effective_at: string;
4252
+ plan_id: string;
4253
+ plan_name: string;
4254
+ price_id: string;
4255
+ quantity: string;
4256
+ /** The target prepaid renewal amount before tax. */
4257
+ recurring_amount: string;
4258
+ currency: string;
4259
+ interval: ScheduledChangeInterval;
4260
+ /** @minimum 1 */
4261
+ interval_count: number;
4262
+ }
4220
4263
  /**
4221
4264
  * pending means the purchase relationship exists but its order has not been accepted.
4222
4265
  * provisioning means the service accepted the order and is delivering. For a service-owned
@@ -4281,6 +4324,8 @@ export interface Subscription {
4281
4324
  suspend_reason?: string;
4282
4325
  billing_cycle_anchor?: string;
4283
4326
  cancellation?: SubscriptionCancellation;
4327
+ /** The accepted period-end change currently scheduled for this subscription. Null when no such change exists. */
4328
+ scheduled_change?: ScheduledChange | null;
4284
4329
  /**
4285
4330
  * The saved payment method automatic renewal charges after the account's balance and credits,
4286
4331
  * before the account's default payment method. Set when the purchase, a renewal or a change is paid with a
@@ -4457,24 +4502,6 @@ export interface RenewalOrderRequest {
4457
4502
  export interface AutoRenewSet {
4458
4503
  auto_renew: boolean;
4459
4504
  }
4460
- /**
4461
- * Follows the items. `pending` is not yet accepted and may be unpaid or paid; its invoice shows
4462
- * whether payment is still needed, and it can expire or be canceled. `accepted` is accepted with items still
4463
- * being set up. `completed` means every item was set up. `partially_completed` means some items were set up
4464
- * and the others failed or were canceled and were refunded to their original payment sources. `failed` means
4465
- * no item was delivered and at least one failed; collected amounts for the undelivered items are refunded.
4466
- * `canceled` means every item was withdrawn without delivery; collected amounts are returned to their original
4467
- * payment sources. No status establishes service delivery by itself.
4468
- */
4469
- export type OrderStatus = (typeof OrderStatus)[keyof typeof OrderStatus];
4470
- export declare const OrderStatus: {
4471
- readonly pending: "pending";
4472
- readonly accepted: "accepted";
4473
- readonly completed: "completed";
4474
- readonly partially_completed: "partially_completed";
4475
- readonly failed: "failed";
4476
- readonly canceled: "canceled";
4477
- };
4478
4505
  /**
4479
4506
  * `pending` is waiting to be set up. `completed` was confirmed by the service.
4480
4507
  * `failed` was not set up and its amount was refunded to the original payment sources.
@@ -4634,9 +4661,15 @@ export interface OrderItem {
4634
4661
  /** `gross_amount` less `discount_amount`. */
4635
4662
  amount?: Money;
4636
4663
  currency: string;
4637
- /** @nullable */
4664
+ /**
4665
+ * The start of the service period this line paid for. Frozen at placement for renewals and period-end changes; for a prepaid line of a new purchase, fixed from the second its invoice is paid and kept when delivery is confirmed. Absent for postpaid and one-time lines.
4666
+ * @nullable
4667
+ */
4638
4668
  period_start?: string | null;
4639
- /** @nullable */
4669
+ /**
4670
+ * The end of that service period, exclusive.
4671
+ * @nullable
4672
+ */
4640
4673
  period_end?: string | null;
4641
4674
  status: OrderItemStatus;
4642
4675
  }
@@ -557,6 +557,19 @@ export const SubscriptionInterval = {
557
557
  month: "month",
558
558
  year: "year",
559
559
  };
560
+ export const OrderStatus = {
561
+ pending: "pending",
562
+ accepted: "accepted",
563
+ completed: "completed",
564
+ partially_completed: "partially_completed",
565
+ failed: "failed",
566
+ canceled: "canceled",
567
+ };
568
+ export const ScheduledChangeInterval = {
569
+ day: "day",
570
+ month: "month",
571
+ year: "year",
572
+ };
560
573
  export const SubscriptionStatus = {
561
574
  pending: "pending",
562
575
  provisioning: "provisioning",
@@ -580,14 +593,6 @@ export const RenewalOrderRequestInterval = {
580
593
  month: "month",
581
594
  year: "year",
582
595
  };
583
- export const OrderStatus = {
584
- pending: "pending",
585
- accepted: "accepted",
586
- completed: "completed",
587
- partially_completed: "partially_completed",
588
- failed: "failed",
589
- canceled: "canceled",
590
- };
591
596
  export const OrderItemStatus = {
592
597
  pending: "pending",
593
598
  completed: "completed",
@@ -81,8 +81,14 @@ export const OrderItem = zod
81
81
  discount_amount: Money.optional().describe("The reduction on this line: from the coupon the order uses and, for a renewal at the agreed terms,\nfrom the discount the subscription carries.\n\nA carried discount is part of the agreed amount. It is listed here, and `gross_amount` is then\n`unit_amount` times `quantity`, except in two cases where `gross_amount` is the agreed amount and\nthe carried discount is already reflected in it: the renewal order also uses a coupon the account\nholds, or the account's tax rate is inclusive."),
82
82
  amount: Money.optional().describe("`gross_amount` less `discount_amount`."),
83
83
  currency: zod.string(),
84
- period_start: zod.iso.datetime({ offset: true }).nullish(),
85
- period_end: zod.iso.datetime({ offset: true }).nullish(),
84
+ period_start: zod.iso
85
+ .datetime({ offset: true })
86
+ .nullish()
87
+ .describe("The start of the service period this line paid for. Frozen at placement for renewals and period-end changes; for a prepaid line of a new purchase, fixed from the second its invoice is paid and kept when delivery is confirmed. Absent for postpaid and one-time lines."),
88
+ period_end: zod.iso
89
+ .datetime({ offset: true })
90
+ .nullish()
91
+ .describe("The end of that service period, exclusive."),
86
92
  status: OrderItemStatus,
87
93
  })
88
94
  .describe("Frozen purchase terms. Monetary fields come from related invoice-line snapshots and are zero\nfor a line with no immediate charge, such as postpaid admission. Later catalog changes do not reprice this line. A new service\npurchase creates its pending subscription when this item is recorded, not when payment succeeds.");