@leaflow/sdk 0.0.0-dev.387.ga9cbec4 → 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 +58 -7
  2. package/dist/billing/v1/generated/functions.js +81 -6
  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 +10 -0
  6. package/dist/billing/v1/generated/schemas.zod.js +10 -0
  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 +24 -8
  42. package/dist/routes.js +27 -9
  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
@@ -5,7 +5,7 @@
5
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
6
  * OpenAPI spec version: v1
7
7
  */
8
- import type { AccountBalance, AccountDeletionReadiness, ActiveResourceList, AllowanceList, AutoRenewSet, BillingAccount, BillingAccountCreate, BillingAccountList, BillingAccountUpdate, CancelSubscriptionRequest, Cancellation, CancellationCreate, CancellationList, CancellationPreviewRequest, CancellationRefundPreview, CheckoutSession, CheckoutSessionConfirm, CheckoutSessionCreate, CheckoutSessionItemList, CheckoutSessionList, CheckoutSessionResult, Contact, ContactCreate, ContactList, ContactUpdate, CreditGrantList, CreditNote, CreditNoteItemList, CreditNoteList, CurrencyList, DiscountList, EntitlementList, Error, ErrorResponse, FeatureGrantList, GetCheckoutSessionQuoteParams, GetPlanHeaders, GetPriceHeaders, GetProductHeaders, GetStatementUsageParams, Invoice, InvoiceItemList, InvoiceList, ListAccountDiscountsParams, ListActiveResourcesParams, ListAllowancesParams, ListBillingAccountsParams, ListCancellationsParams, ListCheckoutSessionItemsParams, ListCheckoutSessionsParams, ListContactsParams, ListCreditGrantsParams, ListCreditNoteItemsParams, ListCreditNotesParams, ListCurrenciesParams, ListEntitlementsParams, ListFeatureGrantsParams, ListInvoiceItemsParams, ListInvoicesParams, ListMonthlyStatementsParams, ListOrderItemsParams, ListOrdersParams, ListPaymentMethodsParams, ListPaymentOptionsParams, ListPlansHeaders, ListPlansParams, ListPricesByPlanHeaders, ListPricesByPlanParams, ListPricesHeaders, ListPricesParams, ListProductsHeaders, ListProductsParams, ListProjectAssignmentsParams, ListRatesHeaders, ListRatesParams, ListRefundsParams, ListRenewalPricesParams, ListSpendParams, ListStatementsParams, ListSubscriptionsParams, ListTopUpsParams, ListTransactionsParams, ListUsageChargesParams, ListWithdrawalItemsParams, ListWithdrawalsParams, MonthlyStatementList, NotModifiedResponse, Order, OrderCancel, OrderItemList, OrderList, OrderRefundPreview, PayInvoiceRequest, PayTogetherRequest, PaymentMethod, PaymentMethodList, PaymentMethodSetup, PaymentMethodSetupResult, PaymentOptionList, PaymentPreview, PaymentResult, Plan, PlanList, PreviewInvoicePaymentParams, PreviewOrderRefundParams, Price, PriceList, Product, ProductID, ProductList, ProjectAssignment, ProjectAssignmentList, Quote, QuoteRequest, RateList, RefundList, RenewRequest, RenewalPriceList, SetProjectAssignmentRequest, SpendRowList, Statement, StatementList, StatementSummary, Subscription, SubscriptionList, TopUp, TopUpCreate, TopUpList, TransactionList, UsageChargeList, UsageEstimate, UsageEstimateRequest, Withdrawal, WithdrawalCreate, WithdrawalItemList, WithdrawalList, WithdrawalPreview, WithdrawalPreviewRequest } from "./models.js";
8
+ import type { AccountBalance, AccountDeletionReadiness, ActiveResourceList, AllowanceList, AutoRenewSet, BillingAccount, BillingAccountCreate, BillingAccountList, BillingAccountUpdate, CancelSubscriptionRequest, Cancellation, CancellationCreate, CancellationList, CancellationPreviewRequest, CancellationRefundPreview, CheckoutSession, CheckoutSessionConfirm, CheckoutSessionCreate, CheckoutSessionItemList, CheckoutSessionList, CheckoutSessionResult, Contact, ContactCreate, ContactList, ContactUpdate, CreditGrantList, CreditNote, CreditNoteItemList, CreditNoteList, CurrencyList, DiscountList, EntitlementList, Error, ErrorResponse, FeatureGrantList, GetCheckoutSessionQuoteParams, GetPlanHeaders, GetPriceHeaders, GetProductHeaders, GetStatementUsageParams, Invoice, InvoiceItemList, InvoiceList, ListAccountDiscountsParams, ListActiveResourcesParams, ListAllowancesParams, ListBillingAccountsParams, ListCancellationsParams, ListCheckoutSessionItemsParams, ListCheckoutSessionsParams, ListContactsParams, ListCreditGrantsParams, ListCreditNoteItemsParams, ListCreditNotesParams, ListCurrenciesParams, ListEntitlementsParams, ListFeatureGrantsParams, ListInvoiceItemsParams, ListInvoicesParams, ListMonthlyStatementsParams, ListOrderItemsParams, ListOrdersParams, ListPaymentMethodsParams, ListPaymentOptionsParams, ListPlansHeaders, ListPlansParams, ListPricesByPlanHeaders, ListPricesByPlanParams, ListPricesHeaders, ListPricesParams, ListProductsHeaders, ListProductsParams, ListProjectAssignmentsParams, ListRatesHeaders, ListRatesParams, ListRefundsParams, ListRenewalPricesParams, ListSpendParams, ListStatementsParams, ListSubscriptionsParams, ListTopUpsParams, ListTransactionsParams, ListUsageChargesParams, ListWithdrawalItemsParams, ListWithdrawalsParams, MonthlyStatementList, NotModifiedResponse, Order, OrderCancel, OrderItemList, OrderList, OrderRefundPreview, PayInvoiceRequest, PayTogetherRequest, PaymentMethod, PaymentMethodList, PaymentMethodSetup, PaymentMethodSetupResult, PaymentOptionList, PaymentPreview, PaymentResult, Plan, PlanList, PreviewInvoicePaymentParams, PreviewOrderRefundParams, Price, PriceList, PriceSearch, Product, ProductID, ProductList, ProjectAssignment, ProjectAssignmentList, Quote, QuoteRequest, RateList, RateSearch, RefundList, RenewRequest, RenewalPriceList, SetProjectAssignmentRequest, SpendRowList, Statement, StatementList, StatementSummary, Subscription, SubscriptionList, TopUp, TopUpCreate, TopUpList, TransactionList, UsageChargeList, UsageEstimate, UsageEstimateRequest, Withdrawal, WithdrawalCreate, WithdrawalItemList, WithdrawalList, WithdrawalPreview, WithdrawalPreviewRequest } from "./models.js";
9
9
  export type HTTPStatusCode1xx = 100 | 101 | 102 | 103;
10
10
  export type HTTPStatusCode2xx = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207;
11
11
  export type HTTPStatusCode3xx = 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308;
@@ -1174,14 +1174,17 @@ export type getQuoteResponseError = getQuoteResponseDefault & {
1174
1174
  export type getQuoteResponse = getQuoteResponseSuccess | getQuoteResponseError;
1175
1175
  export declare const getGetQuoteUrl: () => string;
1176
1176
  /**
1177
- * Calculates what a proposed purchase, or the renewal of your subscriptions, would invoice now, and what each
1178
- * purchased line renews at. Nothing is saved, reserved or redeemed.
1177
+ * Calculates what a proposed purchase, a change of your subscriptions or their renewal would invoice now, and
1178
+ * what each purchased or changed line renews at. Nothing is saved, reserved or redeemed.
1179
1179
  *
1180
1180
  * With `billing_account_id`, the quote is for that billing account: its currency, account discounts,
1181
- * tax and funds apply, renewals use the account currently paying for each subscription, and an access token
1182
- * is required. The account must be yours or currently pay for a project you are a member of. Without it,
1183
- * proposed items are priced in `currency` for anyone, signed in or not: no account discount or funds apply, and
1184
- * `tax_status` is `requires_location_inputs`.
1181
+ * tax and funds apply, changes and renewals use the account currently paying for each subscription, and an
1182
+ * access token is required. The account must be yours or currently pay for a project you are a member of.
1183
+ * Without it, proposed items are priced in `currency` for anyone, signed in or not: no account discount or funds
1184
+ * apply, and tax that would be added is included only for the customer's `address`.
1185
+ *
1186
+ * A change is priced as the service that owns the subscription would order it: pass the returned `total` as the
1187
+ * expected amount and, for an immediate change, `proration_date` to that service when making the change.
1185
1188
  *
1186
1189
  * A promotion code is evaluated without being applied. It is applied only when a Checkout Session is completed
1187
1190
  * with it; conditions that depend on the account, such as a first purchase, are checked only with an account
@@ -1825,6 +1828,30 @@ export declare const getListPricesUrl: (params: ListPricesParams) => string;
1825
1828
  * @summary List what is on sale, with prices
1826
1829
  */
1827
1830
  export declare const listPrices: (params: ListPricesParams, headers?: ListPricesHeaders, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<listPricesResponse>;
1831
+ export type searchPricesResponse200 = {
1832
+ data: PriceList;
1833
+ status: 200;
1834
+ };
1835
+ export type searchPricesResponseDefault = {
1836
+ data: ErrorResponse;
1837
+ status: Exclude<HTTPStatusCodes, 200>;
1838
+ };
1839
+ export type searchPricesResponseSuccess = searchPricesResponse200 & {
1840
+ headers: Headers;
1841
+ };
1842
+ export type searchPricesResponseError = searchPricesResponseDefault & {
1843
+ headers: Headers;
1844
+ };
1845
+ export type searchPricesResponse = searchPricesResponseSuccess | searchPricesResponseError;
1846
+ export declare const getSearchPricesUrl: () => string;
1847
+ /**
1848
+ * Lists the active prices in `currency` that meet every condition in the body, as `list-prices` lists them, for
1849
+ * anyone, signed in or not. Use it for conditions a query string cannot hold, such as the plans of a whole
1850
+ * catalog page. A price that delegates to a rate card has no amount of its own; read its rates with
1851
+ * `search-rates`.
1852
+ * @summary Search what is on sale, with prices
1853
+ */
1854
+ export declare const searchPrices: (priceSearch: PriceSearch, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<searchPricesResponse>;
1828
1855
  export type listProductsResponse200 = {
1829
1856
  data: ProductList;
1830
1857
  status: 200;
@@ -2000,6 +2027,30 @@ export declare const getListRatesUrl: (rateCardId: string, params?: ListRatesPar
2000
2027
  * @summary List catalog rates
2001
2028
  */
2002
2029
  export declare const listRates: (rateCardId: string, params?: ListRatesParams, headers?: ListRatesHeaders, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<listRatesResponse>;
2030
+ export type searchRatesResponse200 = {
2031
+ data: RateList;
2032
+ status: 200;
2033
+ };
2034
+ export type searchRatesResponseDefault = {
2035
+ data: ErrorResponse;
2036
+ status: Exclude<HTTPStatusCodes, 200>;
2037
+ };
2038
+ export type searchRatesResponseSuccess = searchRatesResponse200 & {
2039
+ headers: Headers;
2040
+ };
2041
+ export type searchRatesResponseError = searchRatesResponseDefault & {
2042
+ headers: Headers;
2043
+ };
2044
+ export type searchRatesResponse = searchRatesResponseSuccess | searchRatesResponseError;
2045
+ export declare const getSearchRatesUrl: (rateCardId: string) => string;
2046
+ /**
2047
+ * Rules of a public rate card that meet every condition in the body, as `list-rates` lists them, for anyone,
2048
+ * signed in or not; contract cards are not readable here. Use it to read the rates at the dimension values of the
2049
+ * items on a page, such as each region and machine type offered, and match each rate to its price by meter,
2050
+ * usage type, interval and dimensions.
2051
+ * @summary Search catalog rates
2052
+ */
2053
+ export declare const searchRates: (rateCardId: string, rateSearch: RateSearch, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<searchRatesResponse>;
2003
2054
  export type listActiveResourcesResponse200 = {
2004
2055
  data: ActiveResourceList;
2005
2056
  status: 200;
@@ -1289,14 +1289,17 @@ export const getGetQuoteUrl = () => {
1289
1289
  return `https://billing.leaflow.cloud/api/v1/quotes`;
1290
1290
  };
1291
1291
  /**
1292
- * Calculates what a proposed purchase, or the renewal of your subscriptions, would invoice now, and what each
1293
- * purchased line renews at. Nothing is saved, reserved or redeemed.
1292
+ * Calculates what a proposed purchase, a change of your subscriptions or their renewal would invoice now, and
1293
+ * what each purchased or changed line renews at. Nothing is saved, reserved or redeemed.
1294
1294
  *
1295
1295
  * With `billing_account_id`, the quote is for that billing account: its currency, account discounts,
1296
- * tax and funds apply, renewals use the account currently paying for each subscription, and an access token
1297
- * is required. The account must be yours or currently pay for a project you are a member of. Without it,
1298
- * proposed items are priced in `currency` for anyone, signed in or not: no account discount or funds apply, and
1299
- * `tax_status` is `requires_location_inputs`.
1296
+ * tax and funds apply, changes and renewals use the account currently paying for each subscription, and an
1297
+ * access token is required. The account must be yours or currently pay for a project you are a member of.
1298
+ * Without it, proposed items are priced in `currency` for anyone, signed in or not: no account discount or funds
1299
+ * apply, and tax that would be added is included only for the customer's `address`.
1300
+ *
1301
+ * A change is priced as the service that owns the subscription would order it: pass the returned `total` as the
1302
+ * expected amount and, for an immediate change, `proration_date` to that service when making the change.
1300
1303
  *
1301
1304
  * A promotion code is evaluated without being applied. It is applied only when a Checkout Session is completed
1302
1305
  * with it; conditions that depend on the account, such as a first purchase, are checked only with an account
@@ -2072,6 +2075,42 @@ export const listPrices = async (params, headers, options, fetchFn) => {
2072
2075
  const data = body ? JSON.parse(body) : {};
2073
2076
  return { data, status: res.status, headers: res.headers };
2074
2077
  };
2078
+ export const getSearchPricesUrl = () => {
2079
+ return `https://billing.leaflow.cloud/api/v1/prices`;
2080
+ };
2081
+ /**
2082
+ * Lists the active prices in `currency` that meet every condition in the body, as `list-prices` lists them, for
2083
+ * anyone, signed in or not. Use it for conditions a query string cannot hold, such as the plans of a whole
2084
+ * catalog page. A price that delegates to a rate card has no amount of its own; read its rates with
2085
+ * `search-rates`.
2086
+ * @summary Search what is on sale, with prices
2087
+ */
2088
+ export const searchPrices = async (priceSearch, options, fetchFn) => {
2089
+ const getHeaders = (h) => {
2090
+ if (!h)
2091
+ return {};
2092
+ if (h instanceof Headers)
2093
+ return Object.fromEntries(h.entries());
2094
+ if (Symbol.iterator in h) {
2095
+ return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
2096
+ }
2097
+ const headers = {};
2098
+ for (const [name, value] of Object.entries(h)) {
2099
+ if (value !== undefined)
2100
+ headers[name] = value;
2101
+ }
2102
+ return headers;
2103
+ };
2104
+ const res = await (fetchFn ?? fetch)(getSearchPricesUrl(), {
2105
+ ...options,
2106
+ method: "QUERY",
2107
+ headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
2108
+ body: JSON.stringify(priceSearch),
2109
+ });
2110
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
2111
+ const data = body ? JSON.parse(body) : {};
2112
+ return { data, status: res.status, headers: res.headers };
2113
+ };
2075
2114
  export const getListProductsUrl = (params) => {
2076
2115
  const normalizedParams = new URLSearchParams();
2077
2116
  Object.entries(params || {}).forEach(([key, value]) => {
@@ -2332,6 +2371,42 @@ export const listRates = async (rateCardId, params, headers, options, fetchFn) =
2332
2371
  const data = body ? JSON.parse(body) : {};
2333
2372
  return { data, status: res.status, headers: res.headers };
2334
2373
  };
2374
+ export const getSearchRatesUrl = (rateCardId) => {
2375
+ return `https://billing.leaflow.cloud/api/v1/rate-cards/${encodeURIComponent(String(rateCardId))}/rules`;
2376
+ };
2377
+ /**
2378
+ * Rules of a public rate card that meet every condition in the body, as `list-rates` lists them, for anyone,
2379
+ * signed in or not; contract cards are not readable here. Use it to read the rates at the dimension values of the
2380
+ * items on a page, such as each region and machine type offered, and match each rate to its price by meter,
2381
+ * usage type, interval and dimensions.
2382
+ * @summary Search catalog rates
2383
+ */
2384
+ export const searchRates = async (rateCardId, rateSearch, options, fetchFn) => {
2385
+ const getHeaders = (h) => {
2386
+ if (!h)
2387
+ return {};
2388
+ if (h instanceof Headers)
2389
+ return Object.fromEntries(h.entries());
2390
+ if (Symbol.iterator in h) {
2391
+ return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
2392
+ }
2393
+ const headers = {};
2394
+ for (const [name, value] of Object.entries(h)) {
2395
+ if (value !== undefined)
2396
+ headers[name] = value;
2397
+ }
2398
+ return headers;
2399
+ };
2400
+ const res = await (fetchFn ?? fetch)(getSearchRatesUrl(rateCardId), {
2401
+ ...options,
2402
+ method: "QUERY",
2403
+ headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
2404
+ body: JSON.stringify(rateSearch),
2405
+ });
2406
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
2407
+ const data = body ? JSON.parse(body) : {};
2408
+ return { data, status: res.status, headers: res.headers };
2409
+ };
2335
2410
  export const getListActiveResourcesUrl = (params) => {
2336
2411
  const normalizedParams = new URLSearchParams();
2337
2412
  Object.entries(params || {}).forEach(([key, value]) => {
@@ -155,6 +155,15 @@ export declare const UsageType: {
155
155
  readonly licensed: "licensed";
156
156
  readonly metered: "metered";
157
157
  };
158
+ /**
159
+ * What an immediate downgrade would refund, estimated as of `proration_date`. The refund itself is determined when the change takes effect.
160
+ */
161
+ export interface QuoteDowngradeRefund {
162
+ /** Returned to the original payment sources, tax paid on it included. */
163
+ refundable_amount: Money;
164
+ /** Before tax, the part of the excess that the subscription's refund terms do not return. */
165
+ forfeited_amount: Money;
166
+ }
158
167
  /**
159
168
  * One fully calculated purchase line. An item with no immediate charge, such as a metered purchase, has zero checkout amounts.
160
169
  */
@@ -162,10 +171,15 @@ export interface QuoteItem {
162
171
  tax_amount: Money;
163
172
  tax_included_amount: Money;
164
173
  /**
165
- * The zero-based request line index, or the item's position for a Checkout Session quote.
174
+ * The zero-based index of the item or change in the request, or the item's position for a Checkout Session quote.
166
175
  * @minimum 0
167
176
  */
168
177
  index: number;
178
+ /**
179
+ * The subscription changed; null for a new purchase.
180
+ * @nullable
181
+ */
182
+ subscription_id: string | null;
169
183
  product_id: ProductID;
170
184
  plan_id: string;
171
185
  /** The selected price, also when the request identified it indirectly. */
@@ -194,11 +208,17 @@ export interface QuoteItem {
194
208
  /** Amount before discounts and including any setup charge. */
195
209
  amount: Money;
196
210
  discount_amount: Money;
211
+ /** 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`. */
212
+ remaining_amount: Money | null;
213
+ /** 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. */
214
+ unused_amount: Money | null;
215
+ /** Immediate downgrades only, when `unused_amount` exceeds `remaining_amount`; null otherwise. */
216
+ downgrade_refund: QuoteDowngradeRefund | null;
197
217
  total: Money;
198
218
  currency: string;
199
219
  }
200
220
  /**
201
- * `complete`: tax is calculated for the billing account's invoice contact. `requires_location_inputs`: a quote without an account, which leaves out tax that would be added; tax already contained in a price is included.
221
+ * `complete`: tax is calculated for the billing account's invoice contact, or for `address` without an account. `requires_location_inputs`: a quote without an account or `address`, which leaves out tax that would be added; tax already contained in a price is included.
202
222
  */
203
223
  export type QuoteTaxStatus = (typeof QuoteTaxStatus)[keyof typeof QuoteTaxStatus];
204
224
  export declare const QuoteTaxStatus: {
@@ -290,7 +310,7 @@ export interface Quote {
290
310
  * @nullable
291
311
  */
292
312
  proration_date: string | null;
293
- /** `complete`: tax is calculated for the billing account's invoice contact. `requires_location_inputs`: a quote without an account, which leaves out tax that would be added; tax already contained in a price is included. */
313
+ /** `complete`: tax is calculated for the billing account's invoice contact, or for `address` without an account. `requires_location_inputs`: a quote without an account or `address`, which leaves out tax that would be added; tax already contained in a price is included. */
294
314
  tax_status: QuoteTaxStatus;
295
315
  }
296
316
  /**
@@ -2754,7 +2774,76 @@ export interface UsageEstimate {
2754
2774
  items: UsageEstimateItem[];
2755
2775
  }
2756
2776
  /**
2757
- * 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.
2777
+ * 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.
2778
+ */
2779
+ export type QuoteRequestChangeEffective = (typeof QuoteRequestChangeEffective)[keyof typeof QuoteRequestChangeEffective];
2780
+ export declare const QuoteRequestChangeEffective: {
2781
+ readonly immediate: "immediate";
2782
+ readonly period_end: "period_end";
2783
+ };
2784
+ export type QuoteChangeInputInterval = (typeof QuoteChangeInputInterval)[keyof typeof QuoteChangeInputInterval];
2785
+ export declare const QuoteChangeInputInterval: {
2786
+ readonly none: "none";
2787
+ readonly day: "day";
2788
+ readonly month: "month";
2789
+ readonly year: "year";
2790
+ };
2791
+ /**
2792
+ * The dimension values after the change, given in full; omit to keep the subscription's.
2793
+ */
2794
+ export type QuoteChangeInputDimensions = {
2795
+ [key: string]: string;
2796
+ };
2797
+ /**
2798
+ * 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.
2799
+ */
2800
+ export interface QuoteChangeInput {
2801
+ subscription_id: string;
2802
+ /**
2803
+ * @minLength 1
2804
+ * @maxLength 128
2805
+ */
2806
+ price_lookup_key?: string;
2807
+ /**
2808
+ * @minLength 1
2809
+ * @maxLength 128
2810
+ */
2811
+ plan_lookup_key?: string;
2812
+ price_id?: string;
2813
+ product_id?: ProductID;
2814
+ plan_id?: string;
2815
+ /** Selects the price type instead of keeping the subscription's. */
2816
+ price_type?: PriceType;
2817
+ /** Selects the usage type instead of keeping the subscription's. */
2818
+ usage_type?: UsageType;
2819
+ interval?: QuoteChangeInputInterval;
2820
+ /** @minimum 1 */
2821
+ interval_count?: number;
2822
+ /** Selects among licensed prices with otherwise identical billing terms. */
2823
+ cancellation_policy?: CancellationPolicy;
2824
+ /**
2825
+ * The quantity after the change.
2826
+ * @pattern ^(?:(?:[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]))))))))))$
2827
+ */
2828
+ quantity: string;
2829
+ /** The dimension values after the change, given in full; omit to keep the subscription's. */
2830
+ dimensions?: QuoteChangeInputDimensions;
2831
+ }
2832
+ export interface QuoteAddress {
2833
+ /**
2834
+ * ISO 3166-1 alpha-2, two uppercase letters.
2835
+ * @pattern ^[A-Z]{2}$
2836
+ */
2837
+ country: string;
2838
+ /**
2839
+ * The state or province, as the tax rates name it.
2840
+ * @minLength 1
2841
+ * @maxLength 128
2842
+ */
2843
+ state?: string;
2844
+ }
2845
+ /**
2846
+ * 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.
2758
2847
  */
2759
2848
  export interface QuoteRequest {
2760
2849
  /**
@@ -2780,6 +2869,16 @@ export interface QuoteRequest {
2780
2869
  * @maxItems 100
2781
2870
  */
2782
2871
  renewals?: QuoteRenewal[];
2872
+ /**
2873
+ * 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.
2874
+ * @minItems 1
2875
+ * @maxItems 100
2876
+ */
2877
+ changes?: QuoteChangeInput[];
2878
+ /** 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. */
2879
+ change_effective?: QuoteRequestChangeEffective;
2880
+ /** 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. */
2881
+ address?: QuoteAddress;
2783
2882
  /**
2784
2883
  * @minLength 1
2785
2884
  * @maxLength 64
@@ -3048,6 +3147,70 @@ export interface ContactList {
3048
3147
  items: Contact[];
3049
3148
  pagination: OffsetPagination;
3050
3149
  }
3150
+ /**
3151
+ * Conditions combined with AND.
3152
+ */
3153
+ export interface PriceSearch {
3154
+ /**
3155
+ * ISO 4217, three uppercase letters.
3156
+ * @minLength 3
3157
+ * @maxLength 3
3158
+ */
3159
+ currency: string;
3160
+ /**
3161
+ * Only prices of these plans.
3162
+ * @minItems 1
3163
+ * @maxItems 200
3164
+ */
3165
+ plan_ids?: string[];
3166
+ product_id?: ProductID;
3167
+ /** Narrows to one price type. */
3168
+ type?: PriceType;
3169
+ /** Narrows to one usage type. */
3170
+ usage_type?: UsageType;
3171
+ /**
3172
+ * 1-based page number. Defaults to 1.
3173
+ * @minimum 1
3174
+ * @maximum 2147483647
3175
+ */
3176
+ page?: number;
3177
+ /**
3178
+ * Items per page. Defaults to 50; at most 200.
3179
+ * @minimum 1
3180
+ * @maximum 200
3181
+ */
3182
+ page_size?: number;
3183
+ }
3184
+ export type RateSearchDimensionsItem = {
3185
+ [key: string]: string;
3186
+ };
3187
+ /**
3188
+ * Conditions combined with AND.
3189
+ */
3190
+ export interface RateSearch {
3191
+ /** Only rates on this meter. */
3192
+ meter_id?: string;
3193
+ /** Rates in effect at this moment; defaults to now. */
3194
+ at?: string;
3195
+ /**
3196
+ * 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.
3197
+ * @minItems 1
3198
+ * @maxItems 200
3199
+ */
3200
+ dimensions?: RateSearchDimensionsItem[];
3201
+ /**
3202
+ * 1-based page number. Defaults to 1.
3203
+ * @minimum 1
3204
+ * @maximum 2147483647
3205
+ */
3206
+ page?: number;
3207
+ /**
3208
+ * Items per page. Defaults to 50; at most 200.
3209
+ * @minimum 1
3210
+ * @maximum 200
3211
+ */
3212
+ page_size?: number;
3213
+ }
3051
3214
  export interface CancelSubscriptionRequest {
3052
3215
  mode: CancellationPolicy;
3053
3216
  /** For immediate cancellation, the quoted whole-second refund basis. Now when omitted. */
@@ -369,6 +369,16 @@ export const ActiveResourceStatus = {
369
369
  closing: "closing",
370
370
  closed: "closed",
371
371
  };
372
+ export const QuoteRequestChangeEffective = {
373
+ immediate: "immediate",
374
+ period_end: "period_end",
375
+ };
376
+ export const QuoteChangeInputInterval = {
377
+ none: "none",
378
+ day: "day",
379
+ month: "month",
380
+ year: "year",
381
+ };
372
382
  export const WithdrawalItemStatus = {
373
383
  pending: "pending",
374
384
  succeeded: "succeeded",
@@ -1181,6 +1181,16 @@ export declare const ListRatesQueryParams: zod.ZodObject<{
1181
1181
  export declare const ListRatesHeader: zod.ZodObject<{
1182
1182
  "If-None-Match": zod.ZodOptional<zod.ZodString>;
1183
1183
  }, zod.z.core.$strict>;
1184
+ /**
1185
+ * Rules of a public rate card that meet every condition in the body, as `list-rates` lists them, for anyone,
1186
+ * signed in or not; contract cards are not readable here. Use it to read the rates at the dimension values of the
1187
+ * items on a page, such as each region and machine type offered, and match each rate to its price by meter,
1188
+ * usage type, interval and dimensions.
1189
+ * @summary Search catalog rates
1190
+ */
1191
+ export declare const SearchRatesParams: zod.ZodObject<{
1192
+ rateCardId: zod.ZodUUID;
1193
+ }, zod.z.core.$strict>;
1184
1194
  /**
1185
1195
  * Continuous metering registrations paid for by your billing accounts; members of a project list its registrations with `project_ids`. Their state does not describe the resource's runtime.
1186
1196
  * @summary List active resources
@@ -1561,6 +1561,16 @@ export const ListRatesHeader = zod.strictObject({
1561
1561
  .optional()
1562
1562
  .describe("The `ETag` of an earlier response. When the catalogue has not changed since, the response is `304` with no body."),
1563
1563
  });
1564
+ /**
1565
+ * Rules of a public rate card that meet every condition in the body, as `list-rates` lists them, for anyone,
1566
+ * signed in or not; contract cards are not readable here. Use it to read the rates at the dimension values of the
1567
+ * items on a page, such as each region and machine type offered, and match each rate to its price by meter,
1568
+ * usage type, interval and dimensions.
1569
+ * @summary Search catalog rates
1570
+ */
1571
+ export const SearchRatesParams = zod.strictObject({
1572
+ rateCardId: zod.uuid(),
1573
+ });
1564
1574
  /**
1565
1575
  * Continuous metering registrations paid for by your billing accounts; members of a project list its registrations with `project_ids`. Their state does not describe the resource's runtime.
1566
1576
  * @summary List active resources
@@ -0,0 +1,30 @@
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 priceSearchCurrencyMin = 3;
10
+ export declare const priceSearchCurrencyMax = 3;
11
+ export declare const priceSearchPlanIdsMax = 200;
12
+ export declare const priceSearchPageMax = 2147483647;
13
+ export declare const priceSearchPageSizeMax = 200;
14
+ export declare const PriceSearch: zod.ZodObject<{
15
+ currency: zod.ZodString;
16
+ plan_ids: zod.ZodOptional<zod.ZodArray<zod.ZodUUID>>;
17
+ product_id: zod.ZodOptional<zod.ZodString>;
18
+ type: zod.ZodOptional<zod.ZodEnum<{
19
+ one_time: "one_time";
20
+ recurring: "recurring";
21
+ }>>;
22
+ usage_type: zod.ZodOptional<zod.ZodEnum<{
23
+ licensed: "licensed";
24
+ metered: "metered";
25
+ }>>;
26
+ page: zod.ZodOptional<zod.ZodInt>;
27
+ page_size: zod.ZodOptional<zod.ZodInt>;
28
+ }, zod.z.core.$strict>;
29
+ export type PriceSearch = zod.input<typeof PriceSearch>;
30
+ export type PriceSearchOutput = zod.output<typeof PriceSearch>;
@@ -0,0 +1,46 @@
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 { PriceType } from "./priceType.zod.js";
10
+ import { ProductID } from "./productID.zod.js";
11
+ import { UsageType } from "./usageType.zod.js";
12
+ export const priceSearchCurrencyMin = 3;
13
+ export const priceSearchCurrencyMax = 3;
14
+ export const priceSearchPlanIdsMax = 200;
15
+ export const priceSearchPageMax = 2147483647;
16
+ export const priceSearchPageSizeMax = 200;
17
+ export const PriceSearch = zod
18
+ .strictObject({
19
+ currency: zod
20
+ .string()
21
+ .min(priceSearchCurrencyMin)
22
+ .max(priceSearchCurrencyMax)
23
+ .describe("ISO 4217, three uppercase letters."),
24
+ plan_ids: zod
25
+ .array(zod.uuid())
26
+ .min(1)
27
+ .max(priceSearchPlanIdsMax)
28
+ .optional()
29
+ .describe("Only prices of these plans."),
30
+ product_id: ProductID.optional(),
31
+ type: PriceType.optional().describe("Narrows to one price type."),
32
+ usage_type: UsageType.optional().describe("Narrows to one usage type."),
33
+ page: zod
34
+ .int()
35
+ .min(1)
36
+ .max(priceSearchPageMax)
37
+ .optional()
38
+ .describe("1-based page number. Defaults to 1."),
39
+ page_size: zod
40
+ .int()
41
+ .min(1)
42
+ .max(priceSearchPageSizeMax)
43
+ .optional()
44
+ .describe("Items per page. Defaults to 50; at most 200."),
45
+ })
46
+ .describe("Conditions combined with AND.");
@@ -40,6 +40,7 @@ export declare const Quote: zod.ZodObject<{
40
40
  tax_amount: zod.ZodString;
41
41
  tax_included_amount: zod.ZodString;
42
42
  index: zod.ZodInt;
43
+ subscription_id: zod.ZodNullable<zod.ZodUUID>;
43
44
  product_id: zod.ZodString;
44
45
  plan_id: zod.ZodUUID;
45
46
  price_id: zod.ZodUUID;
@@ -66,6 +67,12 @@ export declare const Quote: zod.ZodObject<{
66
67
  quantity: zod.ZodString;
67
68
  amount: zod.ZodString;
68
69
  discount_amount: zod.ZodString;
70
+ remaining_amount: zod.ZodUnion<readonly [zod.ZodString, zod.ZodNull]>;
71
+ unused_amount: zod.ZodUnion<readonly [zod.ZodString, zod.ZodNull]>;
72
+ downgrade_refund: zod.ZodUnion<readonly [zod.ZodObject<{
73
+ refundable_amount: zod.ZodString;
74
+ forfeited_amount: zod.ZodString;
75
+ }, zod.z.core.$strict>, zod.ZodNull]>;
69
76
  total: zod.ZodString;
70
77
  currency: zod.ZodString;
71
78
  }, zod.z.core.$strict>>;
@@ -32,6 +32,6 @@ export const Quote = zod
32
32
  .describe("Immediate changes only; null otherwise. The instant the change is priced from; pass it when confirming the Checkout Session so it is priced from the same instant."),
33
33
  tax_status: zod
34
34
  .enum(["complete", "requires_location_inputs"])
35
- .describe("`complete`: tax is calculated for the billing account's invoice contact. `requires_location_inputs`: a quote without an account, which leaves out tax that would be added; tax already contained in a price is included."),
35
+ .describe("`complete`: tax is calculated for the billing account's invoice contact, or for `address` without an account. `requires_location_inputs`: a quote without an account or `address`, which leaves out tax that would be added; tax already contained in a price is included."),
36
36
  })
37
37
  .describe("A complete calculation in `currency`; nothing is saved or reserved. The request fails if any item cannot be priced. A Checkout Session quote gives what completing the session would invoice.");
@@ -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
+ });