@leaflow/sdk 0.0.0-dev.385.g78d513c → 0.0.0-dev.389.g87f5860

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 (49) hide show
  1. package/dist/billing/v1/generated/functions.d.ts +59 -8
  2. package/dist/billing/v1/generated/functions.js +82 -7
  3. package/dist/billing/v1/generated/models.d.ts +167 -4
  4. package/dist/billing/v1/generated/models.js +10 -0
  5. package/dist/billing/v1/generated/schemas.zod.d.ts +11 -1
  6. package/dist/billing/v1/generated/schemas.zod.js +11 -1
  7. package/dist/billing/v1/generated/validators/priceSearch.zod.d.ts +30 -0
  8. package/dist/billing/v1/generated/validators/priceSearch.zod.js +46 -0
  9. package/dist/billing/v1/generated/validators/quote.zod.d.ts +7 -0
  10. package/dist/billing/v1/generated/validators/quote.zod.js +1 -1
  11. package/dist/billing/v1/generated/validators/quoteAddress.zod.d.ts +16 -0
  12. package/dist/billing/v1/generated/validators/quoteAddress.zod.js +22 -0
  13. package/dist/billing/v1/generated/validators/quoteChangeInput.zod.d.ts +42 -0
  14. package/dist/billing/v1/generated/validators/quoteChangeInput.zod.js +38 -0
  15. package/dist/billing/v1/generated/validators/quoteDowngradeRefund.zod.d.ts +14 -0
  16. package/dist/billing/v1/generated/validators/quoteDowngradeRefund.zod.js +15 -0
  17. package/dist/billing/v1/generated/validators/quoteItem.zod.d.ts +7 -0
  18. package/dist/billing/v1/generated/validators/quoteItem.zod.js +15 -1
  19. package/dist/billing/v1/generated/validators/quoteRequest.zod.d.ts +38 -0
  20. package/dist/billing/v1/generated/validators/quoteRequest.zod.js +15 -1
  21. package/dist/billing/v1/generated/validators/rateSearch.zod.d.ts +20 -0
  22. package/dist/billing/v1/generated/validators/rateSearch.zod.js +38 -0
  23. package/dist/canopy/v1/generated/functions.d.ts +1 -28
  24. package/dist/canopy/v1/generated/functions.js +0 -18
  25. package/dist/canopy/v1/generated/models.d.ts +5 -171
  26. package/dist/canopy/v1/generated/models.js +0 -18
  27. package/dist/canopy/v1/generated/validators/createServiceResponseBody.zod.d.ts +1 -0
  28. package/dist/canopy/v1/generated/validators/serviceResource.zod.d.ts +1 -0
  29. package/dist/canopy/v1/generated/validators/serviceResource.zod.js +4 -0
  30. package/dist/membership/v1/generated/functions.d.ts +22 -1
  31. package/dist/membership/v1/generated/functions.js +25 -0
  32. package/dist/membership/v1/generated/models.d.ts +29 -0
  33. package/dist/membership/v1/generated/schemas.zod.d.ts +15 -0
  34. package/dist/membership/v1/generated/schemas.zod.js +25 -0
  35. package/dist/membership/v1/generated/validators/listMembershipUpgradeOptionsParams.zod.d.ts +18 -0
  36. package/dist/membership/v1/generated/validators/listMembershipUpgradeOptionsParams.zod.js +24 -0
  37. package/dist/membership/v1/generated/validators/upgradeOption.zod.d.ts +19 -0
  38. package/dist/membership/v1/generated/validators/upgradeOption.zod.js +18 -0
  39. package/dist/membership/v1/generated/validators/upgradeOptionList.zod.d.ts +26 -0
  40. package/dist/membership/v1/generated/validators/upgradeOptionList.zod.js +14 -0
  41. package/dist/routes.d.ts +25 -9
  42. package/dist/routes.js +28 -10
  43. package/package.json +1 -1
  44. package/dist/canopy/v1/generated/validators/funds.zod.d.ts +0 -51
  45. package/dist/canopy/v1/generated/validators/funds.zod.js +0 -52
  46. package/dist/canopy/v1/generated/validators/quote.zod.d.ts +0 -98
  47. package/dist/canopy/v1/generated/validators/quote.zod.js +0 -70
  48. package/dist/canopy/v1/generated/validators/quoteItem.zod.d.ts +0 -76
  49. package/dist/canopy/v1/generated/validators/quoteItem.zod.js +0 -84
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Billing API
5
+ * Products, prices, orders, subscriptions and account billing. Operations on a billing account require an account access token. The account, its balance, payment options and quotes are also readable by members of the projects it currently pays for; changing the account and moving its funds need the owner. Members of a project, as each operation states, can also read the project's billing account, subscriptions and orders, complete and pay for its purchases, and, with project permissions granted in IAM, change its subscriptions (`billing:subscription.write`), change its billing account (`billing:project_assignment.write`) and read its costs (`billing:cost.read`). A member without the permission an operation needs is refused with 403 `PERMISSION_DENIED` and `meta.permission`; a caller who is not a member, with 403 `IAM_NOT_PROJECT_MEMBER`. Public catalogue operations declare no security requirement.
6
+ * OpenAPI spec version: v1
7
+ */
8
+ import * as zod from "zod";
9
+ export declare const quoteAddressCountryRegExp: RegExp;
10
+ export declare const quoteAddressStateMax = 128;
11
+ export declare const QuoteAddress: zod.ZodObject<{
12
+ country: zod.ZodString;
13
+ state: zod.ZodOptional<zod.ZodString>;
14
+ }, zod.z.core.$strict>;
15
+ export type QuoteAddress = zod.input<typeof QuoteAddress>;
16
+ export type QuoteAddressOutput = zod.output<typeof QuoteAddress>;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Billing API
5
+ * Products, prices, orders, subscriptions and account billing. Operations on a billing account require an account access token. The account, its balance, payment options and quotes are also readable by members of the projects it currently pays for; changing the account and moving its funds need the owner. Members of a project, as each operation states, can also read the project's billing account, subscriptions and orders, complete and pay for its purchases, and, with project permissions granted in IAM, change its subscriptions (`billing:subscription.write`), change its billing account (`billing:project_assignment.write`) and read its costs (`billing:cost.read`). A member without the permission an operation needs is refused with 403 `PERMISSION_DENIED` and `meta.permission`; a caller who is not a member, with 403 `IAM_NOT_PROJECT_MEMBER`. Public catalogue operations declare no security requirement.
6
+ * OpenAPI spec version: v1
7
+ */
8
+ import * as zod from "zod";
9
+ export const quoteAddressCountryRegExp = new RegExp("^[A-Z]{2}$");
10
+ export const quoteAddressStateMax = 128;
11
+ export const QuoteAddress = zod.strictObject({
12
+ country: zod
13
+ .string()
14
+ .regex(quoteAddressCountryRegExp)
15
+ .describe("ISO 3166-1 alpha-2, two uppercase letters."),
16
+ state: zod
17
+ .string()
18
+ .min(1)
19
+ .max(quoteAddressStateMax)
20
+ .optional()
21
+ .describe("The state or province, as the tax rates name it."),
22
+ });
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Billing API
5
+ * Products, prices, orders, subscriptions and account billing. Operations on a billing account require an account access token. The account, its balance, payment options and quotes are also readable by members of the projects it currently pays for; changing the account and moving its funds need the owner. Members of a project, as each operation states, can also read the project's billing account, subscriptions and orders, complete and pay for its purchases, and, with project permissions granted in IAM, change its subscriptions (`billing:subscription.write`), change its billing account (`billing:project_assignment.write`) and read its costs (`billing:cost.read`). A member without the permission an operation needs is refused with 403 `PERMISSION_DENIED` and `meta.permission`; a caller who is not a member, with 403 `IAM_NOT_PROJECT_MEMBER`. Public catalogue operations declare no security requirement.
6
+ * OpenAPI spec version: v1
7
+ */
8
+ import * as zod from "zod";
9
+ export declare const quoteChangeInputPriceLookupKeyMax = 128;
10
+ export declare const quoteChangeInputPlanLookupKeyMax = 128;
11
+ export declare const quoteChangeInputQuantityRegExp: RegExp;
12
+ export declare const QuoteChangeInput: zod.ZodObject<{
13
+ subscription_id: zod.ZodUUID;
14
+ price_lookup_key: zod.ZodOptional<zod.ZodString>;
15
+ plan_lookup_key: zod.ZodOptional<zod.ZodString>;
16
+ price_id: zod.ZodOptional<zod.ZodUUID>;
17
+ product_id: zod.ZodOptional<zod.ZodString>;
18
+ plan_id: zod.ZodOptional<zod.ZodUUID>;
19
+ price_type: zod.ZodOptional<zod.ZodEnum<{
20
+ one_time: "one_time";
21
+ recurring: "recurring";
22
+ }>>;
23
+ usage_type: zod.ZodOptional<zod.ZodEnum<{
24
+ licensed: "licensed";
25
+ metered: "metered";
26
+ }>>;
27
+ interval: zod.ZodOptional<zod.ZodEnum<{
28
+ none: "none";
29
+ day: "day";
30
+ month: "month";
31
+ year: "year";
32
+ }>>;
33
+ interval_count: zod.ZodOptional<zod.ZodInt>;
34
+ cancellation_policy: zod.ZodOptional<zod.ZodEnum<{
35
+ immediate: "immediate";
36
+ period_end: "period_end";
37
+ }>>;
38
+ quantity: zod.ZodString;
39
+ dimensions: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodString>>;
40
+ }, zod.z.core.$strict>;
41
+ export type QuoteChangeInput = zod.input<typeof QuoteChangeInput>;
42
+ export type QuoteChangeInputOutput = zod.output<typeof QuoteChangeInput>;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Billing API
5
+ * Products, prices, orders, subscriptions and account billing. Operations on a billing account require an account access token. The account, its balance, payment options and quotes are also readable by members of the projects it currently pays for; changing the account and moving its funds need the owner. Members of a project, as each operation states, can also read the project's billing account, subscriptions and orders, complete and pay for its purchases, and, with project permissions granted in IAM, change its subscriptions (`billing:subscription.write`), change its billing account (`billing:project_assignment.write`) and read its costs (`billing:cost.read`). A member without the permission an operation needs is refused with 403 `PERMISSION_DENIED` and `meta.permission`; a caller who is not a member, with 403 `IAM_NOT_PROJECT_MEMBER`. Public catalogue operations declare no security requirement.
6
+ * OpenAPI spec version: v1
7
+ */
8
+ import * as zod from "zod";
9
+ import { CancellationPolicy } from "./cancellationPolicy.zod.js";
10
+ import { PriceType } from "./priceType.zod.js";
11
+ import { ProductID } from "./productID.zod.js";
12
+ import { UsageType } from "./usageType.zod.js";
13
+ export const quoteChangeInputPriceLookupKeyMax = 128;
14
+ export const quoteChangeInputPlanLookupKeyMax = 128;
15
+ export const quoteChangeInputQuantityRegExp = new RegExp("^(?:(?:[1-9][0-9]{0,27}|0(?:[1-9][0-9]{0,26}|0(?:[1-9][0-9]{0,25}|0(?:[1-9][0-9]{0,24}|0(?:[1-9][0-9]{0,23}|0(?:[1-9][0-9]{0,22}|0(?:[1-9][0-9]{0,21}|0(?:[1-9][0-9]{0,20}|0(?:[1-9][0-9]{0,19}|0(?:[1-9][0-9]{0,18}|0(?:[1-9][0-9]{0,17}|0(?:[1-9][0-9]{0,16}|0(?:[1-9][0-9]{0,15}|0(?:[1-9][0-9]{0,14}|0(?:[1-9][0-9]{0,13}|0(?:[1-9][0-9]{0,12}|0(?:[1-9][0-9]{0,11}|0(?:[1-9][0-9]{0,10}|0(?:[1-9][0-9]{0,9}|0(?:[1-9][0-9]{0,8}|0(?:[1-9][0-9]{0,7}|0(?:[1-9][0-9]{0,6}|0(?:[1-9][0-9]{0,5}|0(?:[1-9][0-9]{0,4}|0(?:[1-9][0-9]{0,3}|0(?:[1-9][0-9]{0,2}|0(?:[1-9][0-9]{0,1}|0[1-9])))))))))))))))))))))))))))([.][0-9]{1,10})?|0{1,28}[.](?:[1-9][0-9]{0,9}|0(?:[1-9][0-9]{0,8}|0(?:[1-9][0-9]{0,7}|0(?:[1-9][0-9]{0,6}|0(?:[1-9][0-9]{0,5}|0(?:[1-9][0-9]{0,4}|0(?:[1-9][0-9]{0,3}|0(?:[1-9][0-9]{0,2}|0(?:[1-9][0-9]{0,1}|0[1-9]))))))))))$");
16
+ export const QuoteChangeInput = zod
17
+ .strictObject({
18
+ subscription_id: zod.uuid(),
19
+ price_lookup_key: zod.string().min(1).max(quoteChangeInputPriceLookupKeyMax).optional(),
20
+ plan_lookup_key: zod.string().min(1).max(quoteChangeInputPlanLookupKeyMax).optional(),
21
+ price_id: zod.uuid().optional(),
22
+ product_id: ProductID.optional(),
23
+ plan_id: zod.uuid().optional(),
24
+ price_type: PriceType.optional().describe("Selects the price type instead of keeping the subscription's."),
25
+ usage_type: UsageType.optional().describe("Selects the usage type instead of keeping the subscription's."),
26
+ interval: zod.enum(["none", "day", "month", "year"]).optional(),
27
+ interval_count: zod.int().min(1).optional(),
28
+ cancellation_policy: CancellationPolicy.optional().describe("Selects among licensed prices with otherwise identical billing terms."),
29
+ quantity: zod
30
+ .string()
31
+ .regex(quoteChangeInputQuantityRegExp)
32
+ .describe("The quantity after the change."),
33
+ dimensions: zod
34
+ .record(zod.string(), zod.string())
35
+ .optional()
36
+ .describe("The dimension values after the change, given in full; omit to keep the subscription's."),
37
+ })
38
+ .describe("The new terms of one subscription. Identify the price, or the plan to select one from, as for a proposed item. Without a price or billing terms, the plan's price with the subscription's price type, usage type, interval, interval count and cancellation policy is selected. Omitted dimensions keep the subscription's.");
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Billing API
5
+ * Products, prices, orders, subscriptions and account billing. Operations on a billing account require an account access token. The account, its balance, payment options and quotes are also readable by members of the projects it currently pays for; changing the account and moving its funds need the owner. Members of a project, as each operation states, can also read the project's billing account, subscriptions and orders, complete and pay for its purchases, and, with project permissions granted in IAM, change its subscriptions (`billing:subscription.write`), change its billing account (`billing:project_assignment.write`) and read its costs (`billing:cost.read`). A member without the permission an operation needs is refused with 403 `PERMISSION_DENIED` and `meta.permission`; a caller who is not a member, with 403 `IAM_NOT_PROJECT_MEMBER`. Public catalogue operations declare no security requirement.
6
+ * OpenAPI spec version: v1
7
+ */
8
+ import * as zod from "zod";
9
+ export declare const QuoteDowngradeRefund: zod.ZodObject<{
10
+ refundable_amount: zod.ZodString;
11
+ forfeited_amount: zod.ZodString;
12
+ }, zod.z.core.$strict>;
13
+ export type QuoteDowngradeRefund = zod.input<typeof QuoteDowngradeRefund>;
14
+ export type QuoteDowngradeRefundOutput = zod.output<typeof QuoteDowngradeRefund>;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Billing API
5
+ * Products, prices, orders, subscriptions and account billing. Operations on a billing account require an account access token. The account, its balance, payment options and quotes are also readable by members of the projects it currently pays for; changing the account and moving its funds need the owner. Members of a project, as each operation states, can also read the project's billing account, subscriptions and orders, complete and pay for its purchases, and, with project permissions granted in IAM, change its subscriptions (`billing:subscription.write`), change its billing account (`billing:project_assignment.write`) and read its costs (`billing:cost.read`). A member without the permission an operation needs is refused with 403 `PERMISSION_DENIED` and `meta.permission`; a caller who is not a member, with 403 `IAM_NOT_PROJECT_MEMBER`. Public catalogue operations declare no security requirement.
6
+ * OpenAPI spec version: v1
7
+ */
8
+ import * as zod from "zod";
9
+ import { Money } from "./money.zod.js";
10
+ export const QuoteDowngradeRefund = zod
11
+ .strictObject({
12
+ refundable_amount: Money.describe("Returned to the original payment sources, tax paid on it included."),
13
+ forfeited_amount: Money.describe("Before tax, the part of the excess that the subscription's refund terms do not return."),
14
+ })
15
+ .describe("What an immediate downgrade would refund, estimated as of `proration_date`. The refund itself is determined when the change takes effect.");
@@ -11,6 +11,7 @@ export declare const QuoteItem: zod.ZodObject<{
11
11
  tax_amount: zod.ZodString;
12
12
  tax_included_amount: zod.ZodString;
13
13
  index: zod.ZodInt;
14
+ subscription_id: zod.ZodNullable<zod.ZodUUID>;
14
15
  product_id: zod.ZodString;
15
16
  plan_id: zod.ZodUUID;
16
17
  price_id: zod.ZodUUID;
@@ -37,6 +38,12 @@ export declare const QuoteItem: zod.ZodObject<{
37
38
  quantity: zod.ZodString;
38
39
  amount: zod.ZodString;
39
40
  discount_amount: zod.ZodString;
41
+ remaining_amount: zod.ZodUnion<readonly [zod.ZodString, zod.ZodNull]>;
42
+ unused_amount: zod.ZodUnion<readonly [zod.ZodString, zod.ZodNull]>;
43
+ downgrade_refund: zod.ZodUnion<readonly [zod.ZodObject<{
44
+ refundable_amount: zod.ZodString;
45
+ forfeited_amount: zod.ZodString;
46
+ }, zod.z.core.$strict>, zod.ZodNull]>;
40
47
  total: zod.ZodString;
41
48
  currency: zod.ZodString;
42
49
  }, zod.z.core.$strict>;
@@ -9,6 +9,7 @@ import * as zod from "zod";
9
9
  import { Money } from "./money.zod.js";
10
10
  import { PriceType } from "./priceType.zod.js";
11
11
  import { ProductID } from "./productID.zod.js";
12
+ import { QuoteDowngradeRefund } from "./quoteDowngradeRefund.zod.js";
12
13
  import { UsageType } from "./usageType.zod.js";
13
14
  export const quoteItemIndexMin = 0;
14
15
  export const QuoteItem = zod
@@ -18,7 +19,11 @@ export const QuoteItem = zod
18
19
  index: zod
19
20
  .int()
20
21
  .min(quoteItemIndexMin)
21
- .describe("The zero-based request line index, or the item's position for a Checkout Session quote."),
22
+ .describe("The zero-based index of the item or change in the request, or the item's position for a Checkout Session quote."),
23
+ subscription_id: zod
24
+ .uuid()
25
+ .nullable()
26
+ .describe("The subscription changed; null for a new purchase."),
22
27
  product_id: ProductID,
23
28
  plan_id: zod.uuid(),
24
29
  price_id: zod
@@ -50,6 +55,15 @@ export const QuoteItem = zod
50
55
  quantity: zod.string().describe("The quantity priced."),
51
56
  amount: Money.describe("Amount before discounts and including any setup charge."),
52
57
  discount_amount: Money,
58
+ remaining_amount: zod
59
+ .union([Money, zod.null()])
60
+ .describe("Immediate changes only; null otherwise. Before tax, the new terms for the time from `proration_date` to the end of the paid period. An upgrade invoices `remaining_amount` minus `unused_amount`."),
61
+ unused_amount: zod
62
+ .union([Money, zod.null()])
63
+ .describe("Immediate changes only; null otherwise. Before tax, for an upgrade or an unchanged period price, the amount paid for that time, up to the new terms' value for the same time; for a downgrade, the remaining value of what was paid, under the refund terms of each paid period."),
64
+ downgrade_refund: zod
65
+ .union([QuoteDowngradeRefund, zod.null()])
66
+ .describe("Immediate downgrades only, when `unused_amount` exceeds `remaining_amount`; null otherwise."),
53
67
  total: Money,
54
68
  currency: zod.string(),
55
69
  })
@@ -10,6 +10,7 @@ export declare const quoteRequestCurrencyMin = 3;
10
10
  export declare const quoteRequestCurrencyMax = 3;
11
11
  export declare const quoteRequestItemsMax = 100;
12
12
  export declare const quoteRequestRenewalsMax = 100;
13
+ export declare const quoteRequestChangesMax = 100;
13
14
  export declare const quoteRequestPromotionCodeMax = 64;
14
15
  export declare const QuoteRequest: zod.ZodObject<{
15
16
  billing_account_id: zod.ZodOptional<zod.ZodInt>;
@@ -57,6 +58,43 @@ export declare const QuoteRequest: zod.ZodObject<{
57
58
  }>>;
58
59
  periods: zod.ZodDefault<zod.ZodInt>;
59
60
  }, zod.z.core.$strict>>>;
61
+ changes: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
62
+ subscription_id: zod.ZodUUID;
63
+ price_lookup_key: zod.ZodOptional<zod.ZodString>;
64
+ plan_lookup_key: zod.ZodOptional<zod.ZodString>;
65
+ price_id: zod.ZodOptional<zod.ZodUUID>;
66
+ product_id: zod.ZodOptional<zod.ZodString>;
67
+ plan_id: zod.ZodOptional<zod.ZodUUID>;
68
+ price_type: zod.ZodOptional<zod.ZodEnum<{
69
+ one_time: "one_time";
70
+ recurring: "recurring";
71
+ }>>;
72
+ usage_type: zod.ZodOptional<zod.ZodEnum<{
73
+ licensed: "licensed";
74
+ metered: "metered";
75
+ }>>;
76
+ interval: zod.ZodOptional<zod.ZodEnum<{
77
+ none: "none";
78
+ day: "day";
79
+ month: "month";
80
+ year: "year";
81
+ }>>;
82
+ interval_count: zod.ZodOptional<zod.ZodInt>;
83
+ cancellation_policy: zod.ZodOptional<zod.ZodEnum<{
84
+ immediate: "immediate";
85
+ period_end: "period_end";
86
+ }>>;
87
+ quantity: zod.ZodString;
88
+ dimensions: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodString>>;
89
+ }, zod.z.core.$strict>>>;
90
+ change_effective: zod.ZodOptional<zod.ZodEnum<{
91
+ immediate: "immediate";
92
+ period_end: "period_end";
93
+ }>>;
94
+ address: zod.ZodOptional<zod.ZodObject<{
95
+ country: zod.ZodString;
96
+ state: zod.ZodOptional<zod.ZodString>;
97
+ }, zod.z.core.$strict>>;
60
98
  promotion_code: zod.ZodOptional<zod.ZodString>;
61
99
  }, zod.z.core.$strict>;
62
100
  export type QuoteRequest = zod.input<typeof QuoteRequest>;
@@ -6,12 +6,15 @@
6
6
  * OpenAPI spec version: v1
7
7
  */
8
8
  import * as zod from "zod";
9
+ import { QuoteAddress } from "./quoteAddress.zod.js";
10
+ import { QuoteChangeInput } from "./quoteChangeInput.zod.js";
9
11
  import { QuoteItemInput } from "./quoteItemInput.zod.js";
10
12
  import { QuoteRenewal } from "./quoteRenewal.zod.js";
11
13
  export const quoteRequestCurrencyMin = 3;
12
14
  export const quoteRequestCurrencyMax = 3;
13
15
  export const quoteRequestItemsMax = 100;
14
16
  export const quoteRequestRenewalsMax = 100;
17
+ export const quoteRequestChangesMax = 100;
15
18
  export const quoteRequestPromotionCodeMax = 64;
16
19
  export const QuoteRequest = zod
17
20
  .strictObject({
@@ -38,6 +41,17 @@ export const QuoteRequest = zod
38
41
  .max(quoteRequestRenewalsMax)
39
42
  .optional()
40
43
  .describe("Preview renewing these subscriptions, each at most once; each entry is a separate renewal order. To apply a promotion code, create a renewal Checkout Session and quote it."),
44
+ changes: zod
45
+ .array(QuoteChangeInput)
46
+ .min(1)
47
+ .max(quoteRequestChangesMax)
48
+ .optional()
49
+ .describe("Preview changing these subscriptions in one order, each at most once. Each must currently be paid by `billing_account_id` and be yours to read, as the owner of that account or a member of the subscription's project; all must belong to the same project, or all to no project."),
50
+ change_effective: zod
51
+ .enum(["immediate", "period_end"])
52
+ .optional()
53
+ .describe("When the changes take effect; defaults to `immediate`. `immediate` prices the rest of the paid period from `proration_date`, charging an upgrade the difference and showing what a downgrade refunds. `period_end` prices the first period at the new terms, which replaces the renewal when the paid period ends."),
54
+ address: QuoteAddress.optional().describe("Only with `currency`. Where the customer is, to include the tax that would be added there for a customer who is not tax exempt; `tax_status` is then `complete`. Refused with `billing_account_id`, whose invoice contact decides tax."),
41
55
  promotion_code: zod.string().min(1).max(quoteRequestPromotionCodeMax).optional(),
42
56
  })
43
- .describe("Quote proposed items or renewals, not both. Give exactly one of `billing_account_id` and `currency`; renewals need the account. Promotion codes apply only to proposed items. An invalid combination fails with `BILLING_PURCHASE_INVALID` and the field.");
57
+ .describe("Quote proposed items, changes or renewals: exactly one of them. Give exactly one of `billing_account_id` and `currency`; changes and renewals need the account. Promotion codes apply to proposed items and changes. An invalid combination fails with `BILLING_PURCHASE_INVALID` and the field.");
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Billing API
5
+ * Products, prices, orders, subscriptions and account billing. Operations on a billing account require an account access token. The account, its balance, payment options and quotes are also readable by members of the projects it currently pays for; changing the account and moving its funds need the owner. Members of a project, as each operation states, can also read the project's billing account, subscriptions and orders, complete and pay for its purchases, and, with project permissions granted in IAM, change its subscriptions (`billing:subscription.write`), change its billing account (`billing:project_assignment.write`) and read its costs (`billing:cost.read`). A member without the permission an operation needs is refused with 403 `PERMISSION_DENIED` and `meta.permission`; a caller who is not a member, with 403 `IAM_NOT_PROJECT_MEMBER`. Public catalogue operations declare no security requirement.
6
+ * OpenAPI spec version: v1
7
+ */
8
+ import * as zod from "zod";
9
+ export declare const rateSearchDimensionsMax = 200;
10
+ export declare const rateSearchPageMax = 2147483647;
11
+ export declare const rateSearchPageSizeMax = 200;
12
+ export declare const RateSearch: zod.ZodObject<{
13
+ meter_id: zod.ZodOptional<zod.ZodUUID>;
14
+ at: zod.ZodOptional<zod.z.ZodISODateTime>;
15
+ dimensions: zod.ZodOptional<zod.ZodArray<zod.ZodRecord<zod.ZodString, zod.ZodString>>>;
16
+ page: zod.ZodOptional<zod.ZodInt>;
17
+ page_size: zod.ZodOptional<zod.ZodInt>;
18
+ }, zod.z.core.$strict>;
19
+ export type RateSearch = zod.input<typeof RateSearch>;
20
+ export type RateSearchOutput = zod.output<typeof RateSearch>;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Billing API
5
+ * Products, prices, orders, subscriptions and account billing. Operations on a billing account require an account access token. The account, its balance, payment options and quotes are also readable by members of the projects it currently pays for; changing the account and moving its funds need the owner. Members of a project, as each operation states, can also read the project's billing account, subscriptions and orders, complete and pay for its purchases, and, with project permissions granted in IAM, change its subscriptions (`billing:subscription.write`), change its billing account (`billing:project_assignment.write`) and read its costs (`billing:cost.read`). A member without the permission an operation needs is refused with 403 `PERMISSION_DENIED` and `meta.permission`; a caller who is not a member, with 403 `IAM_NOT_PROJECT_MEMBER`. Public catalogue operations declare no security requirement.
6
+ * OpenAPI spec version: v1
7
+ */
8
+ import * as zod from "zod";
9
+ export const rateSearchDimensionsMax = 200;
10
+ export const rateSearchPageMax = 2147483647;
11
+ export const rateSearchPageSizeMax = 200;
12
+ export const RateSearch = zod
13
+ .strictObject({
14
+ meter_id: zod.uuid().optional().describe("Only rates on this meter."),
15
+ at: zod.iso
16
+ .datetime({ offset: true })
17
+ .optional()
18
+ .describe("Rates in effect at this moment; defaults to now."),
19
+ dimensions: zod
20
+ .array(zod.record(zod.string(), zod.string().min(1)))
21
+ .min(1)
22
+ .max(rateSearchDimensionsMax)
23
+ .optional()
24
+ .describe("Only rates whose dimension values are exactly one of these sets, given as on order lines and usage. A set no rate has matches nothing."),
25
+ page: zod
26
+ .int()
27
+ .min(1)
28
+ .max(rateSearchPageMax)
29
+ .optional()
30
+ .describe("1-based page number. Defaults to 1."),
31
+ page_size: zod
32
+ .int()
33
+ .min(1)
34
+ .max(rateSearchPageSizeMax)
35
+ .optional()
36
+ .describe("Items per page. Defaults to 50; at most 200."),
37
+ })
38
+ .describe("Conditions combined with AND.");
@@ -38,7 +38,7 @@
38
38
  * - **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`.
39
39
  * OpenAPI spec version: 1.0.0
40
40
  */
41
- import type { APIKeyResource, APIKeyUsageListResponseBody, ChatCompletion, ChatCompletionRequest, ConflictResponse, CreateAPIKeyRequestBody, CreateServiceRequestBody, CreateServiceResponseBody, CursorPageRequestResource, EmbeddingRequest, EmbeddingResponse, Error, GetUsageSummaryParams, GetUsageTimelineParams, InferenceError, IssuedAPIKeyResource, LengthAwarePageAPIKeyResource, ListApiKeysParams, ListRequestsParams, ListUsageByApiKeyParams, ListUsageByModelParams, Model, ModelList, ModelListResponseBody, ModelResource, ModelUsageListResponseBody, NativeRequest, NativeResponse, Quote, RequestResource, ResponseCreate, ResponseDeleted, ResponseResource, ServiceResource, StreamGenerateContentParams, TotalsResource, UpdateAPIKeyRequestBody, UsageTimelineResponseBody } from "./models.js";
41
+ import type { APIKeyResource, APIKeyUsageListResponseBody, ChatCompletion, ChatCompletionRequest, ConflictResponse, CreateAPIKeyRequestBody, CreateServiceRequestBody, CreateServiceResponseBody, CursorPageRequestResource, EmbeddingRequest, EmbeddingResponse, Error, GetUsageSummaryParams, GetUsageTimelineParams, InferenceError, IssuedAPIKeyResource, LengthAwarePageAPIKeyResource, ListApiKeysParams, ListRequestsParams, ListUsageByApiKeyParams, ListUsageByModelParams, Model, ModelList, ModelListResponseBody, ModelResource, ModelUsageListResponseBody, NativeRequest, NativeResponse, RequestResource, ResponseCreate, ResponseDeleted, ResponseResource, ServiceResource, StreamGenerateContentParams, TotalsResource, UpdateAPIKeyRequestBody, UsageTimelineResponseBody } from "./models.js";
42
42
  export type HTTPStatusCode1xx = 100 | 101 | 102 | 103;
43
43
  export type HTTPStatusCode2xx = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207;
44
44
  export type HTTPStatusCode3xx = 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308;
@@ -561,33 +561,6 @@ export declare const getCreateServiceUrl: () => string;
561
561
  * @summary Enable the model platform service
562
562
  */
563
563
  export declare const createService: (createServiceRequestBody: CreateServiceRequestBody, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<createServiceResponse>;
564
- export type createServiceQuoteResponse200 = {
565
- data: Quote;
566
- status: 200;
567
- };
568
- export type createServiceQuoteResponse409 = {
569
- data: ConflictResponse;
570
- status: 409;
571
- };
572
- export type createServiceQuoteResponseDefault = {
573
- data: Error;
574
- status: Exclude<HTTPStatusCodes, 200 | 409>;
575
- };
576
- export type createServiceQuoteResponseSuccess = createServiceQuoteResponse200 & {
577
- headers: Headers;
578
- };
579
- export type createServiceQuoteResponseError = (createServiceQuoteResponse409 | createServiceQuoteResponseDefault) & {
580
- headers: Headers;
581
- };
582
- export type createServiceQuoteResponse = createServiceQuoteResponseSuccess | createServiceQuoteResponseError;
583
- export declare const getCreateServiceQuoteUrl: () => string;
584
- /**
585
- * Prices what `create-service` would order, without ordering or creating anything; nothing is reserved or recorded. Billing evaluates applicable account discounts and tax as for automatic checkout. `total` is what automatic checkout would collect before credit grants and balance; give it as `checkout.expected_amount` to be refused rather than charged a different amount.
586
- *
587
- * Token usage is priced per model, as each model's `pricing` states, and is neither part of `total` nor projected: `estimated_usage_amount` is null. A request the purchase would refuse is refused the same way.
588
- * @summary Quote enabling the model platform service
589
- */
590
- export declare const createServiceQuote: (options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<createServiceQuoteResponse>;
591
564
  export type listUsageByApiKeyResponse200 = {
592
565
  data: APIKeyUsageListResponseBody;
593
566
  status: 200;
@@ -567,24 +567,6 @@ export const createService = async (createServiceRequestBody, options, fetchFn)
567
567
  const data = body ? JSON.parse(body) : {};
568
568
  return { data, status: res.status, headers: res.headers };
569
569
  };
570
- export const getCreateServiceQuoteUrl = () => {
571
- return `https://canopy.leaflow.cloud/api/v1/service/quote`;
572
- };
573
- /**
574
- * Prices what `create-service` would order, without ordering or creating anything; nothing is reserved or recorded. Billing evaluates applicable account discounts and tax as for automatic checkout. `total` is what automatic checkout would collect before credit grants and balance; give it as `checkout.expected_amount` to be refused rather than charged a different amount.
575
- *
576
- * Token usage is priced per model, as each model's `pricing` states, and is neither part of `total` nor projected: `estimated_usage_amount` is null. A request the purchase would refuse is refused the same way.
577
- * @summary Quote enabling the model platform service
578
- */
579
- export const createServiceQuote = async (options, fetchFn) => {
580
- const res = await (fetchFn ?? fetch)(getCreateServiceQuoteUrl(), {
581
- ...options,
582
- method: "POST",
583
- });
584
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
585
- const data = body ? JSON.parse(body) : {};
586
- return { data, status: res.status, headers: res.headers };
587
- };
588
570
  export const getListUsageByApiKeyUrl = (params) => {
589
571
  const normalizedParams = new URLSearchParams();
590
572
  Object.entries(params || {}).forEach(([key, value]) => {
@@ -549,6 +549,11 @@ export interface ServiceResource {
549
549
  * @nullable
550
550
  */
551
551
  order_id: string | null;
552
+ /**
553
+ * The Billing plan the service is sold under; null where the service is not sold. Price enabling it with Billing's quote, giving this plan with the `recurring` price type, the `metered` usage type and a quantity of 1; token usage is priced per model, as each model's `pricing` states.
554
+ * @nullable
555
+ */
556
+ plan_id: string | null;
552
557
  /**
553
558
  * The Billing subscription that requests are billed under; null until an enablement's checkout completes.
554
559
  * @nullable
@@ -619,177 +624,6 @@ export interface CreateServiceResponseBody {
619
624
  */
620
625
  order_id: string | null;
621
626
  }
622
- /**
623
- * `complete`: tax is calculated for the billing account's invoice contact. `requires_location_inputs`: a quote without a billing account, which leaves out tax that would be added; tax already contained in a price is included.
624
- */
625
- export type QuoteTaxStatus = (typeof QuoteTaxStatus)[keyof typeof QuoteTaxStatus];
626
- export declare const QuoteTaxStatus: {
627
- readonly complete: "complete";
628
- readonly requires_location_inputs: "requires_location_inputs";
629
- };
630
- /**
631
- * Account funding for this purchase, calculated by Billing. Amounts use the enclosing response currency.
632
- * Credit eligibility and all purchase requirements are already evaluated. Nothing is charged or reserved.
633
- * A licensed purchase may instead be paid with an online payment method.
634
- */
635
- export interface Funds {
636
- /** Spendable balance after pending returns. */
637
- available_balance_amount: Money;
638
- /** Currently effective credits eligible for the quoted purchases or metered usage. Each grant is counted once. */
639
- usable_credit_amount: Money;
640
- /** Currently effective credits that cannot fund any quoted purchase or metered target. Unused eligible credits are not restricted. */
641
- restricted_credit_amount: Money;
642
- /** Minimum spendable balance needed after eligible credits, covering immediate charges and every new metered purchase's admission requirement. */
643
- required_balance_amount: Money;
644
- /** Additional balance needed now. Zero means account funds satisfy this quote. No funds are reserved. */
645
- balance_shortfall_amount: Money;
646
- /** Minimum recharge that covers the shortfall, respecting the currency minimum recharge and currency precision. Zero when no additional balance is needed. */
647
- required_top_up_amount: Money;
648
- }
649
- /**
650
- * one_time or recurring.
651
- */
652
- export type QuoteItemType = (typeof QuoteItemType)[keyof typeof QuoteItemType];
653
- export declare const QuoteItemType: {
654
- readonly one_time: "one_time";
655
- readonly recurring: "recurring";
656
- };
657
- /**
658
- * licensed or metered.
659
- */
660
- export type QuoteItemUsageType = (typeof QuoteItemUsageType)[keyof typeof QuoteItemUsageType];
661
- export declare const QuoteItemUsageType: {
662
- readonly licensed: "licensed";
663
- readonly metered: "metered";
664
- };
665
- /**
666
- * The billing period of a recurring licensed line; `none` otherwise.
667
- */
668
- export type QuoteItemInterval = (typeof QuoteItemInterval)[keyof typeof QuoteItemInterval];
669
- export declare const QuoteItemInterval: {
670
- readonly none: "none";
671
- readonly day: "day";
672
- readonly month: "month";
673
- readonly year: "year";
674
- };
675
- /**
676
- * The dimension values the line is priced at, such as region and instance type.
677
- */
678
- export type QuoteItemDimensions = {
679
- [key: string]: string;
680
- };
681
- /**
682
- * One calculated purchase line. Fixed purchase amounts are rounded as checkout rounds them.
683
- * A line without an immediate charge has zero checkout amounts. unit_amount remains null when
684
- * no single unit price applies; an unrequested usage estimate remains null.
685
- */
686
- export interface QuoteItem {
687
- product_id: string;
688
- plan_id: string;
689
- plan_name: string;
690
- /**
691
- * The price the line is priced at, including one Billing selected. With quantity and dimensions it
692
- * prices the same line in Billing's own quote, for example with a promotion code.
693
- */
694
- price_id: string;
695
- /** The dimension values the line is priced at, such as region and instance type. */
696
- dimensions: QuoteItemDimensions;
697
- /** one_time or recurring. */
698
- type: QuoteItemType;
699
- /** licensed or metered. */
700
- usage_type: QuoteItemUsageType;
701
- /** The billing period of a recurring licensed line; `none` otherwise. */
702
- interval: QuoteItemInterval;
703
- /**
704
- * Periods per billing cycle of a recurring licensed line; null otherwise.
705
- * @minimum 1
706
- * @nullable
707
- */
708
- interval_count: number | null;
709
- /** The setup charge already included in amount; null when none applies. */
710
- setup_amount: Money | null;
711
- /**
712
- * Recurring licensed lines only; null otherwise. What each later period renews at, before discounts
713
- * and tax, which differs from amount when the first period is priced differently.
714
- */
715
- recurring_amount: Money | null;
716
- /**
717
- * Unit price before discounts, with tax included only where the price includes it. Null when
718
- * no single unit price applies, such as tiered or multiple-rate pricing or an immediate change.
719
- */
720
- unit_amount: Money | null;
721
- /** The quantity priced. */
722
- quantity: string;
723
- /**
724
- * Before discounts, including any setup charges. Contains tax only where the price includes it.
725
- * Zero for an item with no immediate charge.
726
- */
727
- amount: Money;
728
- /** Total reduction on this line, including any committed recurring discount. */
729
- discount_amount: Money;
730
- /** Tax on the discounted amount, including any tax already contained in that amount. */
731
- tax_amount: Money;
732
- /** The part of tax_amount already contained in amount minus discount_amount. */
733
- tax_included_amount: Money;
734
- /** amount minus discount_amount plus tax_amount minus tax_included_amount. */
735
- total: Money;
736
- /**
737
- * Projected charge for this line's future usage over the period stated by the quoting operation,
738
- * at current rates, before discounts and tax and not rounded. Not part of amount or total and
739
- * not collected at checkout. Null when no usage estimate is requested for this line.
740
- */
741
- estimated_usage_amount: Money | null;
742
- currency: string;
743
- }
744
- /**
745
- * A price preview for the purchase described by a service, calculated by Billing. Nothing is saved,
746
- * charged or reserved, and no discount redemption is consumed. Account discounts and tax are
747
- * evaluated as for automatic checkout. Promotion codes are evaluated by Billing at checkout, not here.
748
- * All amounts use currency. This preview does not lock prices or guarantee discount availability.
749
- * Success includes complete checkout amounts and every requested usage estimate. If any item or
750
- * requested usage estimate cannot be calculated, the operation returns its existing structured
751
- * error response; it never returns a partial quote with HTTP 200. A quote without a billing account
752
- * has no funds and no account discount, and leaves out tax that would be added.
753
- */
754
- export interface Quote {
755
- /** Null for a quote without a billing account. */
756
- funds: Funds | null;
757
- /** `complete`: tax is calculated for the billing account's invoice contact. `requires_location_inputs`: a quote without a billing account, which leaves out tax that would be added; tax already contained in a price is included. */
758
- tax_status: QuoteTaxStatus;
759
- /** One line for each item the purchase would order, in the order it would order them. */
760
- items: QuoteItem[];
761
- /**
762
- * Sum of line amounts before discounts, less tax already included in the discounted line
763
- * amounts, as on an invoice.
764
- */
765
- subtotal: Money;
766
- /** Sum of line discounts. */
767
- discount_amount: Money;
768
- /** Sum of tax on the discounted line amounts. */
769
- tax_amount: Money;
770
- /**
771
- * subtotal minus discount_amount plus tax_amount: what checkout collects, before applying
772
- * credit grants or balance. Equals the sum of line totals and excludes estimated_usage_amount.
773
- */
774
- total: Money;
775
- /**
776
- * Sum of the lines' estimated_usage_amount. A projection, not part of total and not collected at
777
- * checkout. Null when no usage estimate is requested.
778
- */
779
- estimated_usage_amount: Money | null;
780
- currency: string;
781
- /**
782
- * Changes only; null otherwise. The instant the change is priced from. Pass it with the change so the
783
- * order is priced from the same instant.
784
- * @nullable
785
- */
786
- proration_date: string | null;
787
- /**
788
- * Changes that lower the price only; null otherwise. What the change would return to the original
789
- * payment sources, including the tax paid on it. total is zero for such a change.
790
- */
791
- refundable_amount: Money | null;
792
- }
793
627
  export type ResponseCreateReasoning = {
794
628
  [key: string]: unknown;
795
629
  };