@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
  * Membership tiers and account memberships. Catalog queries support any configured currency; purchases use the billing account currency.
6
6
  * OpenAPI spec version: 1.0.0
7
7
  */
8
- import type { ErrorResponse, GetPlanParams, ListMembershipPeriodsParams, ListMembershipsParams, ListPlansParams, Membership, MembershipCreate, MembershipDowngrade, MembershipList, MembershipPurchase, MembershipUpgrade, PeriodList, Plan, PlanList } from "./models.js";
8
+ import type { ErrorResponse, GetPlanParams, ListMembershipPeriodsParams, ListMembershipUpgradeOptionsParams, ListMembershipsParams, ListPlansParams, Membership, MembershipCreate, MembershipDowngrade, MembershipList, MembershipPurchase, MembershipUpgrade, PeriodList, Plan, PlanList, UpgradeOptionList } 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;
@@ -137,6 +137,27 @@ export declare const getListMembershipPeriodsUrl: (membershipId: string, params?
137
137
  * @summary List membership periods
138
138
  */
139
139
  export declare const listMembershipPeriods: (membershipId: string, params?: ListMembershipPeriodsParams, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<listMembershipPeriodsResponse>;
140
+ export type listMembershipUpgradeOptionsResponse200 = {
141
+ data: UpgradeOptionList;
142
+ status: 200;
143
+ };
144
+ export type listMembershipUpgradeOptionsResponseDefault = {
145
+ data: ErrorResponse;
146
+ status: Exclude<HTTPStatusCodes, 200>;
147
+ };
148
+ export type listMembershipUpgradeOptionsResponseSuccess = listMembershipUpgradeOptionsResponse200 & {
149
+ headers: Headers;
150
+ };
151
+ export type listMembershipUpgradeOptionsResponseError = listMembershipUpgradeOptionsResponseDefault & {
152
+ headers: Headers;
153
+ };
154
+ export type listMembershipUpgradeOptionsResponse = listMembershipUpgradeOptionsResponseSuccess | listMembershipUpgradeOptionsResponseError;
155
+ export declare const getListMembershipUpgradeOptionsUrl: (membershipId: string, params?: ListMembershipUpgradeOptionsParams) => string;
156
+ /**
157
+ * Lists the higher tiers on sale that the membership's tier has an upgrade path to, lowest rank first, with the Billing price `upgrade-membership` would order for each. Price an upgrade before making it with Billing's quote, giving that price with a quantity of 1; a promotion code can be checked there as well. Returns 409 MEMBERSHIP_NOT_ACTIVE or MEMBERSHIP_CHANGE_PENDING when the membership cannot be changed.
158
+ * @summary List upgrade options
159
+ */
160
+ export declare const listMembershipUpgradeOptions: (membershipId: string, params?: ListMembershipUpgradeOptionsParams, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<listMembershipUpgradeOptionsResponse>;
140
161
  export type upgradeMembershipResponse201 = {
141
162
  data: MembershipPurchase;
142
163
  status: 201;
@@ -146,6 +146,31 @@ export const listMembershipPeriods = async (membershipId, params, options, fetch
146
146
  const data = body ? JSON.parse(body) : {};
147
147
  return { data, status: res.status, headers: res.headers };
148
148
  };
149
+ export const getListMembershipUpgradeOptionsUrl = (membershipId, params) => {
150
+ const normalizedParams = new URLSearchParams();
151
+ Object.entries(params || {}).forEach(([key, value]) => {
152
+ if (value !== undefined) {
153
+ normalizedParams.append(key, value === null ? "null" : String(value));
154
+ }
155
+ });
156
+ const stringifiedParams = normalizedParams.toString();
157
+ return stringifiedParams.length > 0
158
+ ? `https://membership.leaflow.cloud/api/v1/memberships/${encodeURIComponent(String(membershipId))}/upgrade-options?${stringifiedParams}`
159
+ : `https://membership.leaflow.cloud/api/v1/memberships/${encodeURIComponent(String(membershipId))}/upgrade-options`;
160
+ };
161
+ /**
162
+ * Lists the higher tiers on sale that the membership's tier has an upgrade path to, lowest rank first, with the Billing price `upgrade-membership` would order for each. Price an upgrade before making it with Billing's quote, giving that price with a quantity of 1; a promotion code can be checked there as well. Returns 409 MEMBERSHIP_NOT_ACTIVE or MEMBERSHIP_CHANGE_PENDING when the membership cannot be changed.
163
+ * @summary List upgrade options
164
+ */
165
+ export const listMembershipUpgradeOptions = async (membershipId, params, options, fetchFn) => {
166
+ const res = await (fetchFn ?? fetch)(getListMembershipUpgradeOptionsUrl(membershipId, params), {
167
+ ...options,
168
+ method: "GET",
169
+ });
170
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
171
+ const data = body ? JSON.parse(body) : {};
172
+ return { data, status: res.status, headers: res.headers };
173
+ };
149
174
  export const getUpgradeMembershipUrl = (membershipId) => {
150
175
  return `https://membership.leaflow.cloud/api/v1/memberships/${encodeURIComponent(String(membershipId))}/upgrade`;
151
176
  };
@@ -358,6 +358,21 @@ export interface MembershipCreate {
358
358
  price_id: string;
359
359
  checkout?: CheckoutOptions;
360
360
  }
361
+ /**
362
+ * A tier the membership can be upgraded to.
363
+ */
364
+ export interface UpgradeOption {
365
+ plan: PlanSummary;
366
+ /**
367
+ * The Billing price the upgrade is ordered at, in the membership's currency. Null when the tier cannot be upgraded to now, because it has no price for the membership's currency and billing interval; `upgrade-membership` then returns 422 MEMBERSHIP_UPGRADE_UNAVAILABLE.
368
+ * @nullable
369
+ */
370
+ price_id: string | null;
371
+ }
372
+ export interface UpgradeOptionList {
373
+ items: UpgradeOption[];
374
+ pagination: OffsetPagination;
375
+ }
361
376
  export interface MembershipUpgrade {
362
377
  /** A higher-ranked target tier. */
363
378
  plan_id: string;
@@ -441,3 +456,17 @@ export type ListMembershipPeriodsParams = {
441
456
  */
442
457
  page_size?: number;
443
458
  };
459
+ export type ListMembershipUpgradeOptionsParams = {
460
+ /**
461
+ * 1-based page number. Defaults to 1.
462
+ * @minimum 1
463
+ * @maximum 2147483647
464
+ */
465
+ page?: number;
466
+ /**
467
+ * Items per page. Defaults to 50; at most 200.
468
+ * @minimum 1
469
+ * @maximum 200
470
+ */
471
+ page_size?: number;
472
+ };
@@ -82,6 +82,21 @@ export declare const ListMembershipPeriodsQueryParams: zod.ZodObject<{
82
82
  page: zod.ZodDefault<zod.ZodInt>;
83
83
  page_size: zod.ZodDefault<zod.ZodInt>;
84
84
  }, zod.z.core.$strict>;
85
+ /**
86
+ * Lists the higher tiers on sale that the membership's tier has an upgrade path to, lowest rank first, with the Billing price `upgrade-membership` would order for each. Price an upgrade before making it with Billing's quote, giving that price with a quantity of 1; a promotion code can be checked there as well. Returns 409 MEMBERSHIP_NOT_ACTIVE or MEMBERSHIP_CHANGE_PENDING when the membership cannot be changed.
87
+ * @summary List upgrade options
88
+ */
89
+ export declare const ListMembershipUpgradeOptionsParams: zod.ZodObject<{
90
+ membershipId: zod.ZodUUID;
91
+ }, zod.z.core.$strict>;
92
+ export declare const listMembershipUpgradeOptionsQueryPageDefault = 1;
93
+ export declare const listMembershipUpgradeOptionsQueryPageMax = 2147483647;
94
+ export declare const listMembershipUpgradeOptionsQueryPageSizeDefault = 50;
95
+ export declare const listMembershipUpgradeOptionsQueryPageSizeMax = 200;
96
+ export declare const ListMembershipUpgradeOptionsQueryParams: zod.ZodObject<{
97
+ page: zod.ZodDefault<zod.ZodInt>;
98
+ page_size: zod.ZodDefault<zod.ZodInt>;
99
+ }, zod.z.core.$strict>;
85
100
  /**
86
101
  * Creates a Billing Checkout Session for the full-period price difference. The upgrade takes effect after payment, benefit issuance and delivery confirmation; renewal uses the target tier. Returns 409 MEMBERSHIP_NOT_ACTIVE or MEMBERSHIP_CHANGE_PENDING, or 422 MEMBERSHIP_UPGRADE_UNAVAILABLE. Returns 403 MEMBERSHIP_ACCOUNT_DELETING while the caller's account deletion is pending, or 403 MEMBERSHIP_ACCOUNT_UNUSABLE when the account is deleted, suspended or banned.
87
102
  * @summary Upgrade a membership
@@ -111,6 +111,31 @@ export const ListMembershipPeriodsQueryParams = zod.strictObject({
111
111
  .default(listMembershipPeriodsQueryPageSizeDefault)
112
112
  .describe("Items per page. Defaults to 50; at most 200."),
113
113
  });
114
+ /**
115
+ * Lists the higher tiers on sale that the membership's tier has an upgrade path to, lowest rank first, with the Billing price `upgrade-membership` would order for each. Price an upgrade before making it with Billing's quote, giving that price with a quantity of 1; a promotion code can be checked there as well. Returns 409 MEMBERSHIP_NOT_ACTIVE or MEMBERSHIP_CHANGE_PENDING when the membership cannot be changed.
116
+ * @summary List upgrade options
117
+ */
118
+ export const ListMembershipUpgradeOptionsParams = zod.strictObject({
119
+ membershipId: zod.uuid(),
120
+ });
121
+ export const listMembershipUpgradeOptionsQueryPageDefault = 1;
122
+ export const listMembershipUpgradeOptionsQueryPageMax = 2147483647;
123
+ export const listMembershipUpgradeOptionsQueryPageSizeDefault = 50;
124
+ export const listMembershipUpgradeOptionsQueryPageSizeMax = 200;
125
+ export const ListMembershipUpgradeOptionsQueryParams = zod.strictObject({
126
+ page: zod
127
+ .int()
128
+ .min(1)
129
+ .max(listMembershipUpgradeOptionsQueryPageMax)
130
+ .default(listMembershipUpgradeOptionsQueryPageDefault)
131
+ .describe("1-based page number. Defaults to 1."),
132
+ page_size: zod
133
+ .int()
134
+ .min(1)
135
+ .max(listMembershipUpgradeOptionsQueryPageSizeMax)
136
+ .default(listMembershipUpgradeOptionsQueryPageSizeDefault)
137
+ .describe("Items per page. Defaults to 50; at most 200."),
138
+ });
114
139
  /**
115
140
  * Creates a Billing Checkout Session for the full-period price difference. The upgrade takes effect after payment, benefit issuance and delivery confirmation; renewal uses the target tier. Returns 409 MEMBERSHIP_NOT_ACTIVE or MEMBERSHIP_CHANGE_PENDING, or 422 MEMBERSHIP_UPGRADE_UNAVAILABLE. Returns 403 MEMBERSHIP_ACCOUNT_DELETING while the caller's account deletion is pending, or 403 MEMBERSHIP_ACCOUNT_UNUSABLE when the account is deleted, suspended or banned.
116
141
  * @summary Upgrade a membership
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Membership API
5
+ * Membership tiers and account memberships. Catalog queries support any configured currency; purchases use the billing account currency.
6
+ * OpenAPI spec version: 1.0.0
7
+ */
8
+ import * as zod from "zod";
9
+ export declare const listMembershipUpgradeOptionsParamsPageDefault = 1;
10
+ export declare const listMembershipUpgradeOptionsParamsPageMax = 2147483647;
11
+ export declare const listMembershipUpgradeOptionsParamsPageSizeDefault = 50;
12
+ export declare const listMembershipUpgradeOptionsParamsPageSizeMax = 200;
13
+ export declare const ListMembershipUpgradeOptionsParams: zod.ZodObject<{
14
+ page: zod.ZodDefault<zod.ZodInt>;
15
+ page_size: zod.ZodDefault<zod.ZodInt>;
16
+ }, zod.z.core.$strict>;
17
+ export type ListMembershipUpgradeOptionsParams = zod.input<typeof ListMembershipUpgradeOptionsParams>;
18
+ export type ListMembershipUpgradeOptionsParamsOutput = zod.output<typeof ListMembershipUpgradeOptionsParams>;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Membership API
5
+ * Membership tiers and account memberships. Catalog queries support any configured currency; purchases use the billing account currency.
6
+ * OpenAPI spec version: 1.0.0
7
+ */
8
+ import * as zod from "zod";
9
+ export const listMembershipUpgradeOptionsParamsPageDefault = 1;
10
+ export const listMembershipUpgradeOptionsParamsPageMax = 2147483647;
11
+ export const listMembershipUpgradeOptionsParamsPageSizeDefault = 50;
12
+ export const listMembershipUpgradeOptionsParamsPageSizeMax = 200;
13
+ export const ListMembershipUpgradeOptionsParams = zod.strictObject({
14
+ page: zod
15
+ .int()
16
+ .min(1)
17
+ .max(listMembershipUpgradeOptionsParamsPageMax)
18
+ .default(listMembershipUpgradeOptionsParamsPageDefault),
19
+ page_size: zod
20
+ .int()
21
+ .min(1)
22
+ .max(listMembershipUpgradeOptionsParamsPageSizeMax)
23
+ .default(listMembershipUpgradeOptionsParamsPageSizeDefault),
24
+ });
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Membership API
5
+ * Membership tiers and account memberships. Catalog queries support any configured currency; purchases use the billing account currency.
6
+ * OpenAPI spec version: 1.0.0
7
+ */
8
+ import * as zod from "zod";
9
+ export declare const UpgradeOption: zod.ZodObject<{
10
+ plan: zod.ZodObject<{
11
+ id: zod.ZodUUID;
12
+ lookup_key: zod.ZodString;
13
+ name: zod.ZodString;
14
+ rank: zod.ZodInt;
15
+ }, zod.z.core.$strict>;
16
+ price_id: zod.ZodNullable<zod.ZodUUID>;
17
+ }, zod.z.core.$strict>;
18
+ export type UpgradeOption = zod.input<typeof UpgradeOption>;
19
+ export type UpgradeOptionOutput = zod.output<typeof UpgradeOption>;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Membership API
5
+ * Membership tiers and account memberships. Catalog queries support any configured currency; purchases use the billing account currency.
6
+ * OpenAPI spec version: 1.0.0
7
+ */
8
+ import * as zod from "zod";
9
+ import { PlanSummary } from "./planSummary.zod.js";
10
+ export const UpgradeOption = zod
11
+ .strictObject({
12
+ plan: PlanSummary,
13
+ price_id: zod
14
+ .uuid()
15
+ .nullable()
16
+ .describe("The Billing price the upgrade is ordered at, in the membership's currency. Null when the tier cannot be upgraded to now, because it has no price for the membership's currency and billing interval; `upgrade-membership` then returns 422 MEMBERSHIP_UPGRADE_UNAVAILABLE."),
17
+ })
18
+ .describe("A tier the membership can be upgraded to.");
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Membership API
5
+ * Membership tiers and account memberships. Catalog queries support any configured currency; purchases use the billing account currency.
6
+ * OpenAPI spec version: 1.0.0
7
+ */
8
+ import * as zod from "zod";
9
+ export declare const UpgradeOptionList: zod.ZodObject<{
10
+ items: zod.ZodArray<zod.ZodObject<{
11
+ plan: zod.ZodObject<{
12
+ id: zod.ZodUUID;
13
+ lookup_key: zod.ZodString;
14
+ name: zod.ZodString;
15
+ rank: zod.ZodInt;
16
+ }, zod.z.core.$strict>;
17
+ price_id: zod.ZodNullable<zod.ZodUUID>;
18
+ }, zod.z.core.$strict>>;
19
+ pagination: zod.ZodObject<{
20
+ page: zod.ZodInt;
21
+ page_size: zod.ZodInt;
22
+ total_count: zod.ZodOptional<zod.ZodInt>;
23
+ }, zod.z.core.$strict>;
24
+ }, zod.z.core.$strict>;
25
+ export type UpgradeOptionList = zod.input<typeof UpgradeOptionList>;
26
+ export type UpgradeOptionListOutput = zod.output<typeof UpgradeOptionList>;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Membership API
5
+ * Membership tiers and account memberships. Catalog queries support any configured currency; purchases use the billing account currency.
6
+ * OpenAPI spec version: 1.0.0
7
+ */
8
+ import * as zod from "zod";
9
+ import { OffsetPagination } from "./offsetPagination.zod.js";
10
+ import { UpgradeOption } from "./upgradeOption.zod.js";
11
+ export const UpgradeOptionList = zod.strictObject({
12
+ items: zod.array(UpgradeOption),
13
+ pagination: OffsetPagination,
14
+ });
package/dist/routes.d.ts CHANGED
@@ -1399,6 +1399,14 @@ export declare const routes: readonly [{
1399
1399
  readonly operationId: "list-prices";
1400
1400
  readonly securityScheme: null;
1401
1401
  readonly upstreamUrl: "https://billing.leaflow.cloud";
1402
+ }, {
1403
+ readonly service: "billing";
1404
+ readonly contract: "billing";
1405
+ readonly method: "QUERY";
1406
+ readonly path: "/api/v1/prices";
1407
+ readonly operationId: "search-prices";
1408
+ readonly securityScheme: null;
1409
+ readonly upstreamUrl: "https://billing.leaflow.cloud";
1402
1410
  }, {
1403
1411
  readonly service: "billing";
1404
1412
  readonly contract: "billing";
@@ -1455,6 +1463,14 @@ export declare const routes: readonly [{
1455
1463
  readonly operationId: "list-rates";
1456
1464
  readonly securityScheme: null;
1457
1465
  readonly upstreamUrl: "https://billing.leaflow.cloud";
1466
+ }, {
1467
+ readonly service: "billing";
1468
+ readonly contract: "billing";
1469
+ readonly method: "QUERY";
1470
+ readonly path: "/api/v1/rate-cards/{rateCardId}/rules";
1471
+ readonly operationId: "search-rates";
1472
+ readonly securityScheme: null;
1473
+ readonly upstreamUrl: "https://billing.leaflow.cloud";
1458
1474
  }, {
1459
1475
  readonly service: "billing";
1460
1476
  readonly contract: "billing";
@@ -1687,14 +1703,6 @@ export declare const routes: readonly [{
1687
1703
  readonly operationId: "create-service";
1688
1704
  readonly securityScheme: "ScopedToken";
1689
1705
  readonly upstreamUrl: "https://canopy.leaflow.cloud";
1690
- }, {
1691
- readonly service: "canopy";
1692
- readonly contract: "canopy";
1693
- readonly method: "POST";
1694
- readonly path: "/api/v1/service/quote";
1695
- readonly operationId: "create-service-quote";
1696
- readonly securityScheme: "ScopedToken";
1697
- readonly upstreamUrl: "https://canopy.leaflow.cloud";
1698
1706
  }, {
1699
1707
  readonly service: "canopy";
1700
1708
  readonly contract: "canopy";
@@ -2999,6 +3007,14 @@ export declare const routes: readonly [{
2999
3007
  readonly operationId: "list-membership-periods";
3000
3008
  readonly securityScheme: "AccessToken";
3001
3009
  readonly upstreamUrl: "https://membership.leaflow.cloud";
3010
+ }, {
3011
+ readonly service: "membership";
3012
+ readonly contract: "membership";
3013
+ readonly method: "GET";
3014
+ readonly path: "/api/v1/memberships/{membershipId}/upgrade-options";
3015
+ readonly operationId: "list-membership-upgrade-options";
3016
+ readonly securityScheme: "AccessToken";
3017
+ readonly upstreamUrl: "https://membership.leaflow.cloud";
3002
3018
  }, {
3003
3019
  readonly service: "membership";
3004
3020
  readonly contract: "membership";
package/dist/routes.js CHANGED
@@ -1576,6 +1576,15 @@ export const routes = [
1576
1576
  securityScheme: null,
1577
1577
  upstreamUrl: "https://billing.leaflow.cloud",
1578
1578
  },
1579
+ {
1580
+ service: "billing",
1581
+ contract: "billing",
1582
+ method: "QUERY",
1583
+ path: "/api/v1/prices",
1584
+ operationId: "search-prices",
1585
+ securityScheme: null,
1586
+ upstreamUrl: "https://billing.leaflow.cloud",
1587
+ },
1579
1588
  {
1580
1589
  service: "billing",
1581
1590
  contract: "billing",
@@ -1639,6 +1648,15 @@ export const routes = [
1639
1648
  securityScheme: null,
1640
1649
  upstreamUrl: "https://billing.leaflow.cloud",
1641
1650
  },
1651
+ {
1652
+ service: "billing",
1653
+ contract: "billing",
1654
+ method: "QUERY",
1655
+ path: "/api/v1/rate-cards/{rateCardId}/rules",
1656
+ operationId: "search-rates",
1657
+ securityScheme: null,
1658
+ upstreamUrl: "https://billing.leaflow.cloud",
1659
+ },
1642
1660
  {
1643
1661
  service: "billing",
1644
1662
  contract: "billing",
@@ -1900,15 +1918,6 @@ export const routes = [
1900
1918
  securityScheme: "ScopedToken",
1901
1919
  upstreamUrl: "https://canopy.leaflow.cloud",
1902
1920
  },
1903
- {
1904
- service: "canopy",
1905
- contract: "canopy",
1906
- method: "POST",
1907
- path: "/api/v1/service/quote",
1908
- operationId: "create-service-quote",
1909
- securityScheme: "ScopedToken",
1910
- upstreamUrl: "https://canopy.leaflow.cloud",
1911
- },
1912
1921
  {
1913
1922
  service: "canopy",
1914
1923
  contract: "canopy",
@@ -3376,6 +3385,15 @@ export const routes = [
3376
3385
  securityScheme: "AccessToken",
3377
3386
  upstreamUrl: "https://membership.leaflow.cloud",
3378
3387
  },
3388
+ {
3389
+ service: "membership",
3390
+ contract: "membership",
3391
+ method: "GET",
3392
+ path: "/api/v1/memberships/{membershipId}/upgrade-options",
3393
+ operationId: "list-membership-upgrade-options",
3394
+ securityScheme: "AccessToken",
3395
+ upstreamUrl: "https://membership.leaflow.cloud",
3396
+ },
3379
3397
  {
3380
3398
  service: "membership",
3381
3399
  contract: "membership",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leaflow/sdk",
3
- "version": "0.0.0-dev.387.ga9cbec4",
3
+ "version": "0.0.0-dev.389.g87f5860",
4
4
  "description": "Leaflow 平台 API 的 TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,51 +0,0 @@
1
- /**
2
- * Generated by orval 🍺
3
- * Do not edit manually.
4
- * Leaflow Canopy API
5
- * Canopy model inference, API keys, model catalogue, service enablement and recorded usage.
6
- *
7
- * Project inference is served on this host in each provider's own protocol:
8
- *
9
- * - OpenAI: `/v1/chat/completions`, `/v1/responses` and `/v1/embeddings`; use
10
- * `https://canopy.leaflow.cloud/v1` as the OpenAI SDK base URL.
11
- * - Anthropic: `/v1/messages`; use `https://canopy.leaflow.cloud` as the Anthropic SDK base URL.
12
- * - Gemini: `/v1beta/models/{model}:generateContent` and `:streamGenerateContent`.
13
- *
14
- * Canopy does not convert between protocols. A request is accepted only for a model whose
15
- * `supported_endpoints` lists the endpoint it was sent to, and it is forwarded unchanged except for
16
- * the model name and the credentials. Reasoning settings such as `reasoning_effort` are passed
17
- * through as written; a model's `capabilities` lists the values its upstream accepts.
18
- *
19
- * Management operations use `/api/v1`. The management model catalogue includes pricing;
20
- * `/v1/models` returns the OpenAI model format with Canopy capabilities and parameter limits.
21
- *
22
- * ## Authentication
23
- *
24
- * Every request carries a scoped token; see the `bearerAuth` security scheme.
25
- *
26
- * Management and project inference accept the same verified IAM scoped token. The token is the
27
- * sole billing project authority; `OpenAI-Project` and historical identity headers cannot
28
- * override it. These endpoints do not accept a Canopy API key. The separate API-key gateway
29
- * accepts Canopy API keys and serves the same endpoints.
30
- *
31
- * ## Conventions
32
- *
33
- * - **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.
34
- * - **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.
35
- * - **A usage query must carry a time range**, spanning no more than 31 days, or 400 days for the usage timeline. `from` and `to` carry a timezone offset, which the server does not infer.
36
- * - **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.
37
- * - **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.
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
- * OpenAPI spec version: 1.0.0
40
- */
41
- import * as zod from "zod";
42
- export declare const Funds: zod.ZodObject<{
43
- available_balance_amount: zod.ZodString;
44
- usable_credit_amount: zod.ZodString;
45
- restricted_credit_amount: zod.ZodString;
46
- required_balance_amount: zod.ZodString;
47
- balance_shortfall_amount: zod.ZodString;
48
- required_top_up_amount: zod.ZodString;
49
- }, zod.z.core.$strict>;
50
- export type Funds = zod.input<typeof Funds>;
51
- export type FundsOutput = zod.output<typeof Funds>;
@@ -1,52 +0,0 @@
1
- /**
2
- * Generated by orval 🍺
3
- * Do not edit manually.
4
- * Leaflow Canopy API
5
- * Canopy model inference, API keys, model catalogue, service enablement and recorded usage.
6
- *
7
- * Project inference is served on this host in each provider's own protocol:
8
- *
9
- * - OpenAI: `/v1/chat/completions`, `/v1/responses` and `/v1/embeddings`; use
10
- * `https://canopy.leaflow.cloud/v1` as the OpenAI SDK base URL.
11
- * - Anthropic: `/v1/messages`; use `https://canopy.leaflow.cloud` as the Anthropic SDK base URL.
12
- * - Gemini: `/v1beta/models/{model}:generateContent` and `:streamGenerateContent`.
13
- *
14
- * Canopy does not convert between protocols. A request is accepted only for a model whose
15
- * `supported_endpoints` lists the endpoint it was sent to, and it is forwarded unchanged except for
16
- * the model name and the credentials. Reasoning settings such as `reasoning_effort` are passed
17
- * through as written; a model's `capabilities` lists the values its upstream accepts.
18
- *
19
- * Management operations use `/api/v1`. The management model catalogue includes pricing;
20
- * `/v1/models` returns the OpenAI model format with Canopy capabilities and parameter limits.
21
- *
22
- * ## Authentication
23
- *
24
- * Every request carries a scoped token; see the `bearerAuth` security scheme.
25
- *
26
- * Management and project inference accept the same verified IAM scoped token. The token is the
27
- * sole billing project authority; `OpenAI-Project` and historical identity headers cannot
28
- * override it. These endpoints do not accept a Canopy API key. The separate API-key gateway
29
- * accepts Canopy API keys and serves the same endpoints.
30
- *
31
- * ## Conventions
32
- *
33
- * - **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.
34
- * - **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.
35
- * - **A usage query must carry a time range**, spanning no more than 31 days, or 400 days for the usage timeline. `from` and `to` carry a timezone offset, which the server does not infer.
36
- * - **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.
37
- * - **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.
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
- * OpenAPI spec version: 1.0.0
40
- */
41
- import * as zod from "zod";
42
- import { Money } from "./money.zod.js";
43
- export const Funds = zod
44
- .strictObject({
45
- available_balance_amount: Money.describe("Spendable balance after pending returns."),
46
- usable_credit_amount: Money.describe("Currently effective credits eligible for the quoted purchases or metered usage. Each grant is counted once."),
47
- restricted_credit_amount: Money.describe("Currently effective credits that cannot fund any quoted purchase or metered target. Unused eligible credits are not restricted."),
48
- required_balance_amount: Money.describe("Minimum spendable balance needed after eligible credits, covering immediate charges and every new metered purchase's admission requirement."),
49
- balance_shortfall_amount: Money.describe("Additional balance needed now. Zero means account funds satisfy this quote. No funds are reserved."),
50
- required_top_up_amount: Money.describe("Minimum recharge that covers the shortfall, respecting the currency minimum recharge and currency precision. Zero when no additional balance is needed."),
51
- })
52
- .describe("Account funding for this purchase, calculated by Billing. Amounts use the enclosing response currency.\nCredit eligibility and all purchase requirements are already evaluated. Nothing is charged or reserved.\nA licensed purchase may instead be paid with an online payment method.\n");
@@ -1,98 +0,0 @@
1
- /**
2
- * Generated by orval 🍺
3
- * Do not edit manually.
4
- * Leaflow Canopy API
5
- * Canopy model inference, API keys, model catalogue, service enablement and recorded usage.
6
- *
7
- * Project inference is served on this host in each provider's own protocol:
8
- *
9
- * - OpenAI: `/v1/chat/completions`, `/v1/responses` and `/v1/embeddings`; use
10
- * `https://canopy.leaflow.cloud/v1` as the OpenAI SDK base URL.
11
- * - Anthropic: `/v1/messages`; use `https://canopy.leaflow.cloud` as the Anthropic SDK base URL.
12
- * - Gemini: `/v1beta/models/{model}:generateContent` and `:streamGenerateContent`.
13
- *
14
- * Canopy does not convert between protocols. A request is accepted only for a model whose
15
- * `supported_endpoints` lists the endpoint it was sent to, and it is forwarded unchanged except for
16
- * the model name and the credentials. Reasoning settings such as `reasoning_effort` are passed
17
- * through as written; a model's `capabilities` lists the values its upstream accepts.
18
- *
19
- * Management operations use `/api/v1`. The management model catalogue includes pricing;
20
- * `/v1/models` returns the OpenAI model format with Canopy capabilities and parameter limits.
21
- *
22
- * ## Authentication
23
- *
24
- * Every request carries a scoped token; see the `bearerAuth` security scheme.
25
- *
26
- * Management and project inference accept the same verified IAM scoped token. The token is the
27
- * sole billing project authority; `OpenAI-Project` and historical identity headers cannot
28
- * override it. These endpoints do not accept a Canopy API key. The separate API-key gateway
29
- * accepts Canopy API keys and serves the same endpoints.
30
- *
31
- * ## Conventions
32
- *
33
- * - **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.
34
- * - **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.
35
- * - **A usage query must carry a time range**, spanning no more than 31 days, or 400 days for the usage timeline. `from` and `to` carry a timezone offset, which the server does not infer.
36
- * - **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.
37
- * - **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.
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
- * OpenAPI spec version: 1.0.0
40
- */
41
- import * as zod from "zod";
42
- export declare const Quote: zod.ZodObject<{
43
- funds: zod.ZodUnion<readonly [zod.ZodObject<{
44
- available_balance_amount: zod.ZodString;
45
- usable_credit_amount: zod.ZodString;
46
- restricted_credit_amount: zod.ZodString;
47
- required_balance_amount: zod.ZodString;
48
- balance_shortfall_amount: zod.ZodString;
49
- required_top_up_amount: zod.ZodString;
50
- }, zod.z.core.$strict>, zod.ZodNull]>;
51
- tax_status: zod.ZodEnum<{
52
- complete: "complete";
53
- requires_location_inputs: "requires_location_inputs";
54
- }>;
55
- items: zod.ZodArray<zod.ZodObject<{
56
- product_id: zod.ZodString;
57
- plan_id: zod.ZodUUID;
58
- plan_name: zod.ZodString;
59
- price_id: zod.ZodUUID;
60
- dimensions: zod.ZodRecord<zod.ZodString, zod.ZodString>;
61
- type: zod.ZodEnum<{
62
- one_time: "one_time";
63
- recurring: "recurring";
64
- }>;
65
- usage_type: zod.ZodEnum<{
66
- licensed: "licensed";
67
- metered: "metered";
68
- }>;
69
- interval: zod.ZodEnum<{
70
- none: "none";
71
- day: "day";
72
- month: "month";
73
- year: "year";
74
- }>;
75
- interval_count: zod.ZodNullable<zod.ZodInt>;
76
- setup_amount: zod.ZodUnion<readonly [zod.ZodString, zod.ZodNull]>;
77
- recurring_amount: zod.ZodUnion<readonly [zod.ZodString, zod.ZodNull]>;
78
- unit_amount: zod.ZodUnion<readonly [zod.ZodString, zod.ZodNull]>;
79
- quantity: zod.ZodString;
80
- amount: zod.ZodString;
81
- discount_amount: zod.ZodString;
82
- tax_amount: zod.ZodString;
83
- tax_included_amount: zod.ZodString;
84
- total: zod.ZodString;
85
- estimated_usage_amount: zod.ZodUnion<readonly [zod.ZodString, zod.ZodNull]>;
86
- currency: zod.ZodString;
87
- }, zod.z.core.$strict>>;
88
- subtotal: zod.ZodString;
89
- discount_amount: zod.ZodString;
90
- tax_amount: zod.ZodString;
91
- total: zod.ZodString;
92
- estimated_usage_amount: zod.ZodUnion<readonly [zod.ZodString, zod.ZodNull]>;
93
- currency: zod.ZodString;
94
- proration_date: zod.ZodNullable<zod.z.ZodISODateTime>;
95
- refundable_amount: zod.ZodUnion<readonly [zod.ZodString, zod.ZodNull]>;
96
- }, zod.z.core.$strict>;
97
- export type Quote = zod.input<typeof Quote>;
98
- export type QuoteOutput = zod.output<typeof Quote>;