@paygentic/sdk 0.8.4 → 0.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +11 -3
- package/dist/commonjs/funcs/invoicesV2Get.d.ts +1 -1
- package/dist/commonjs/funcs/invoicesV2Get.d.ts.map +1 -1
- package/dist/commonjs/funcs/invoicesV2Get.js +2 -2
- package/dist/commonjs/funcs/invoicesV2Get.js.map +1 -1
- package/dist/commonjs/funcs/invoicesV2GetLineItems.d.ts +1 -1
- package/dist/commonjs/funcs/invoicesV2GetLineItems.d.ts.map +1 -1
- package/dist/commonjs/funcs/invoicesV2GetLineItems.js +2 -2
- package/dist/commonjs/funcs/invoicesV2GetLineItems.js.map +1 -1
- package/dist/commonjs/funcs/plansGetPlanVersion.d.ts +19 -0
- package/dist/commonjs/funcs/plansGetPlanVersion.d.ts.map +1 -0
- package/dist/commonjs/funcs/plansGetPlanVersion.js +128 -0
- package/dist/commonjs/funcs/plansGetPlanVersion.js.map +1 -0
- package/dist/commonjs/funcs/plansListPlanVersions.d.ts +18 -0
- package/dist/commonjs/funcs/plansListPlanVersions.d.ts.map +1 -0
- package/dist/commonjs/funcs/plansListPlanVersions.js +128 -0
- package/dist/commonjs/funcs/plansListPlanVersions.js.map +1 -0
- package/dist/commonjs/funcs/plansMintPlanVersion.d.ts +19 -0
- package/dist/commonjs/funcs/plansMintPlanVersion.d.ts.map +1 -0
- package/dist/commonjs/funcs/plansMintPlanVersion.js +127 -0
- package/dist/commonjs/funcs/plansMintPlanVersion.js.map +1 -0
- package/dist/commonjs/funcs/plansTransitionPlanVersion.d.ts +19 -0
- package/dist/commonjs/funcs/plansTransitionPlanVersion.d.ts.map +1 -0
- package/dist/commonjs/funcs/plansTransitionPlanVersion.js +131 -0
- package/dist/commonjs/funcs/plansTransitionPlanVersion.js.map +1 -0
- package/dist/commonjs/funcs/plansUpdate.js +2 -2
- package/dist/commonjs/funcs/plansUpdate.js.map +1 -1
- package/dist/commonjs/funcs/subscriptionsCreate.js +2 -2
- package/dist/commonjs/funcs/subscriptionsCreate.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/index.d.ts +5 -0
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +5 -0
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/mintplanversionrequest.d.ts +46 -0
- package/dist/commonjs/models/mintplanversionrequest.d.ts.map +1 -0
- package/dist/commonjs/models/mintplanversionrequest.js +60 -0
- package/dist/commonjs/models/mintplanversionrequest.js.map +1 -0
- package/dist/commonjs/models/operations/createplan.d.ts +5 -0
- package/dist/commonjs/models/operations/createplan.d.ts.map +1 -1
- package/dist/commonjs/models/operations/createplan.js +1 -0
- package/dist/commonjs/models/operations/createplan.js.map +1 -1
- package/dist/commonjs/models/operations/getinvoice.d.ts +1 -1
- package/dist/commonjs/models/operations/getinvoicelineitems.d.ts +1 -1
- package/dist/commonjs/models/operations/getplanversion.d.ts +17 -0
- package/dist/commonjs/models/operations/getplanversion.d.ts.map +1 -0
- package/dist/commonjs/models/operations/getplanversion.js +50 -0
- package/dist/commonjs/models/operations/getplanversion.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +4 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +4 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/listplanversions.d.ts +46 -0
- package/dist/commonjs/models/operations/listplanversions.d.ts.map +1 -0
- package/dist/commonjs/models/operations/listplanversions.js +68 -0
- package/dist/commonjs/models/operations/listplanversions.js.map +1 -0
- package/dist/commonjs/models/operations/mintplanversion.d.ts +15 -0
- package/dist/commonjs/models/operations/mintplanversion.d.ts.map +1 -0
- package/dist/commonjs/models/operations/mintplanversion.js +56 -0
- package/dist/commonjs/models/operations/mintplanversion.js.map +1 -0
- package/dist/commonjs/models/operations/transitionplanversion.d.ts +20 -0
- package/dist/commonjs/models/operations/transitionplanversion.d.ts.map +1 -0
- package/dist/commonjs/models/operations/transitionplanversion.js +57 -0
- package/dist/commonjs/models/operations/transitionplanversion.js.map +1 -0
- package/dist/commonjs/models/operations/updateplan.d.ts +5 -0
- package/dist/commonjs/models/operations/updateplan.d.ts.map +1 -1
- package/dist/commonjs/models/operations/updateplan.js +1 -0
- package/dist/commonjs/models/operations/updateplan.js.map +1 -1
- package/dist/commonjs/models/plan.d.ts +8 -0
- package/dist/commonjs/models/plan.d.ts.map +1 -1
- package/dist/commonjs/models/plan.js +2 -0
- package/dist/commonjs/models/plan.js.map +1 -1
- package/dist/commonjs/models/planversion.d.ts +71 -0
- package/dist/commonjs/models/planversion.d.ts.map +1 -0
- package/dist/commonjs/models/planversion.js +76 -0
- package/dist/commonjs/models/planversion.js.map +1 -0
- package/dist/commonjs/models/planversionpriceslot.d.ts +81 -0
- package/dist/commonjs/models/planversionpriceslot.d.ts.map +1 -0
- package/dist/commonjs/models/planversionpriceslot.js +88 -0
- package/dist/commonjs/models/planversionpriceslot.js.map +1 -0
- package/dist/commonjs/models/planversionsummary.d.ts +55 -0
- package/dist/commonjs/models/planversionsummary.d.ts.map +1 -0
- package/dist/commonjs/models/planversionsummary.js +72 -0
- package/dist/commonjs/models/planversionsummary.js.map +1 -0
- package/dist/commonjs/models/price.d.ts +4 -4
- package/dist/commonjs/models/price.d.ts.map +1 -1
- package/dist/commonjs/models/price.js +5 -4
- package/dist/commonjs/models/price.js.map +1 -1
- package/dist/commonjs/models/pricepropertiesunion.d.ts +1 -1
- package/dist/commonjs/models/revenuesummaryresponse.d.ts +8 -0
- package/dist/commonjs/models/revenuesummaryresponse.d.ts.map +1 -1
- package/dist/commonjs/models/revenuesummaryresponse.js +2 -0
- package/dist/commonjs/models/revenuesummaryresponse.js.map +1 -1
- package/dist/commonjs/models/revenuetrendbucket.d.ts +4 -0
- package/dist/commonjs/models/revenuetrendbucket.d.ts.map +1 -1
- package/dist/commonjs/models/revenuetrendbucket.js +1 -0
- package/dist/commonjs/models/revenuetrendbucket.js.map +1 -1
- package/dist/commonjs/models/scheduleinterval.d.ts +4 -1
- package/dist/commonjs/models/scheduleinterval.d.ts.map +1 -1
- package/dist/commonjs/models/scheduleinterval.js +1 -1
- package/dist/commonjs/models/scheduleinterval.js.map +1 -1
- package/dist/commonjs/models/schemasbillingschedule.d.ts +4 -1
- package/dist/commonjs/models/schemasbillingschedule.d.ts.map +1 -1
- package/dist/commonjs/models/schemasbillingschedule.js +1 -1
- package/dist/commonjs/models/schemasbillingschedule.js.map +1 -1
- package/dist/commonjs/models/subscription.d.ts +8 -0
- package/dist/commonjs/models/subscription.d.ts.map +1 -1
- package/dist/commonjs/models/subscription.js +2 -0
- package/dist/commonjs/models/subscription.js.map +1 -1
- package/dist/commonjs/models/transitionplanversionrequest.d.ts +18 -0
- package/dist/commonjs/models/transitionplanversionrequest.d.ts.map +1 -0
- package/dist/commonjs/models/transitionplanversionrequest.js +49 -0
- package/dist/commonjs/models/transitionplanversionrequest.js.map +1 -0
- package/dist/commonjs/sdk/plans.d.ts +28 -0
- package/dist/commonjs/sdk/plans.d.ts.map +1 -1
- package/dist/commonjs/sdk/plans.js +40 -0
- package/dist/commonjs/sdk/plans.js.map +1 -1
- package/dist/esm/funcs/invoicesV2Get.d.ts +1 -1
- package/dist/esm/funcs/invoicesV2Get.d.ts.map +1 -1
- package/dist/esm/funcs/invoicesV2Get.js +2 -2
- package/dist/esm/funcs/invoicesV2Get.js.map +1 -1
- package/dist/esm/funcs/invoicesV2GetLineItems.d.ts +1 -1
- package/dist/esm/funcs/invoicesV2GetLineItems.d.ts.map +1 -1
- package/dist/esm/funcs/invoicesV2GetLineItems.js +2 -2
- package/dist/esm/funcs/invoicesV2GetLineItems.js.map +1 -1
- package/dist/esm/funcs/plansGetPlanVersion.d.ts +19 -0
- package/dist/esm/funcs/plansGetPlanVersion.d.ts.map +1 -0
- package/dist/esm/funcs/plansGetPlanVersion.js +92 -0
- package/dist/esm/funcs/plansGetPlanVersion.js.map +1 -0
- package/dist/esm/funcs/plansListPlanVersions.d.ts +18 -0
- package/dist/esm/funcs/plansListPlanVersions.d.ts.map +1 -0
- package/dist/esm/funcs/plansListPlanVersions.js +92 -0
- package/dist/esm/funcs/plansListPlanVersions.js.map +1 -0
- package/dist/esm/funcs/plansMintPlanVersion.d.ts +19 -0
- package/dist/esm/funcs/plansMintPlanVersion.d.ts.map +1 -0
- package/dist/esm/funcs/plansMintPlanVersion.js +91 -0
- package/dist/esm/funcs/plansMintPlanVersion.js.map +1 -0
- package/dist/esm/funcs/plansTransitionPlanVersion.d.ts +19 -0
- package/dist/esm/funcs/plansTransitionPlanVersion.d.ts.map +1 -0
- package/dist/esm/funcs/plansTransitionPlanVersion.js +95 -0
- package/dist/esm/funcs/plansTransitionPlanVersion.js.map +1 -0
- package/dist/esm/funcs/plansUpdate.js +2 -2
- package/dist/esm/funcs/plansUpdate.js.map +1 -1
- package/dist/esm/funcs/subscriptionsCreate.js +2 -2
- package/dist/esm/funcs/subscriptionsCreate.js.map +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/index.d.ts +5 -0
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +5 -0
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/mintplanversionrequest.d.ts +46 -0
- package/dist/esm/models/mintplanversionrequest.d.ts.map +1 -0
- package/dist/esm/models/mintplanversionrequest.js +22 -0
- package/dist/esm/models/mintplanversionrequest.js.map +1 -0
- package/dist/esm/models/operations/createplan.d.ts +5 -0
- package/dist/esm/models/operations/createplan.d.ts.map +1 -1
- package/dist/esm/models/operations/createplan.js +1 -0
- package/dist/esm/models/operations/createplan.js.map +1 -1
- package/dist/esm/models/operations/getinvoice.d.ts +1 -1
- package/dist/esm/models/operations/getinvoicelineitems.d.ts +1 -1
- package/dist/esm/models/operations/getplanversion.d.ts +17 -0
- package/dist/esm/models/operations/getplanversion.d.ts.map +1 -0
- package/dist/esm/models/operations/getplanversion.js +13 -0
- package/dist/esm/models/operations/getplanversion.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +4 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +4 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/listplanversions.d.ts +46 -0
- package/dist/esm/models/operations/listplanversions.d.ts.map +1 -0
- package/dist/esm/models/operations/listplanversions.js +30 -0
- package/dist/esm/models/operations/listplanversions.js.map +1 -0
- package/dist/esm/models/operations/mintplanversion.d.ts +15 -0
- package/dist/esm/models/operations/mintplanversion.d.ts.map +1 -0
- package/dist/esm/models/operations/mintplanversion.js +19 -0
- package/dist/esm/models/operations/mintplanversion.js.map +1 -0
- package/dist/esm/models/operations/transitionplanversion.d.ts +20 -0
- package/dist/esm/models/operations/transitionplanversion.d.ts.map +1 -0
- package/dist/esm/models/operations/transitionplanversion.js +20 -0
- package/dist/esm/models/operations/transitionplanversion.js.map +1 -0
- package/dist/esm/models/operations/updateplan.d.ts +5 -0
- package/dist/esm/models/operations/updateplan.d.ts.map +1 -1
- package/dist/esm/models/operations/updateplan.js +1 -0
- package/dist/esm/models/operations/updateplan.js.map +1 -1
- package/dist/esm/models/plan.d.ts +8 -0
- package/dist/esm/models/plan.d.ts.map +1 -1
- package/dist/esm/models/plan.js +2 -0
- package/dist/esm/models/plan.js.map +1 -1
- package/dist/esm/models/planversion.d.ts +71 -0
- package/dist/esm/models/planversion.d.ts.map +1 -0
- package/dist/esm/models/planversion.js +39 -0
- package/dist/esm/models/planversion.js.map +1 -0
- package/dist/esm/models/planversionpriceslot.d.ts +81 -0
- package/dist/esm/models/planversionpriceslot.d.ts.map +1 -0
- package/dist/esm/models/planversionpriceslot.js +51 -0
- package/dist/esm/models/planversionpriceslot.js.map +1 -0
- package/dist/esm/models/planversionsummary.d.ts +55 -0
- package/dist/esm/models/planversionsummary.d.ts.map +1 -0
- package/dist/esm/models/planversionsummary.js +35 -0
- package/dist/esm/models/planversionsummary.js.map +1 -0
- package/dist/esm/models/price.d.ts +4 -4
- package/dist/esm/models/price.d.ts.map +1 -1
- package/dist/esm/models/price.js +4 -3
- package/dist/esm/models/price.js.map +1 -1
- package/dist/esm/models/pricepropertiesunion.d.ts +1 -1
- package/dist/esm/models/revenuesummaryresponse.d.ts +8 -0
- package/dist/esm/models/revenuesummaryresponse.d.ts.map +1 -1
- package/dist/esm/models/revenuesummaryresponse.js +2 -0
- package/dist/esm/models/revenuesummaryresponse.js.map +1 -1
- package/dist/esm/models/revenuetrendbucket.d.ts +4 -0
- package/dist/esm/models/revenuetrendbucket.d.ts.map +1 -1
- package/dist/esm/models/revenuetrendbucket.js +1 -0
- package/dist/esm/models/revenuetrendbucket.js.map +1 -1
- package/dist/esm/models/scheduleinterval.d.ts +4 -1
- package/dist/esm/models/scheduleinterval.d.ts.map +1 -1
- package/dist/esm/models/scheduleinterval.js +1 -1
- package/dist/esm/models/scheduleinterval.js.map +1 -1
- package/dist/esm/models/schemasbillingschedule.d.ts +4 -1
- package/dist/esm/models/schemasbillingschedule.d.ts.map +1 -1
- package/dist/esm/models/schemasbillingschedule.js +1 -1
- package/dist/esm/models/schemasbillingschedule.js.map +1 -1
- package/dist/esm/models/subscription.d.ts +8 -0
- package/dist/esm/models/subscription.d.ts.map +1 -1
- package/dist/esm/models/subscription.js +2 -0
- package/dist/esm/models/subscription.js.map +1 -1
- package/dist/esm/models/transitionplanversionrequest.d.ts +18 -0
- package/dist/esm/models/transitionplanversionrequest.d.ts.map +1 -0
- package/dist/esm/models/transitionplanversionrequest.js +12 -0
- package/dist/esm/models/transitionplanversionrequest.js.map +1 -0
- package/dist/esm/sdk/plans.d.ts +28 -0
- package/dist/esm/sdk/plans.d.ts.map +1 -1
- package/dist/esm/sdk/plans.js +40 -0
- package/dist/esm/sdk/plans.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +2 -1
- package/src/funcs/invoicesV2Get.ts +5 -1
- package/src/funcs/invoicesV2GetLineItems.ts +5 -1
- package/src/funcs/plansGetPlanVersion.ts +186 -0
- package/src/funcs/plansListPlanVersions.ts +185 -0
- package/src/funcs/plansMintPlanVersion.ts +183 -0
- package/src/funcs/plansTransitionPlanVersion.ts +190 -0
- package/src/funcs/plansUpdate.ts +2 -2
- package/src/funcs/subscriptionsCreate.ts +2 -2
- package/src/lib/config.ts +2 -2
- package/src/models/index.ts +5 -0
- package/src/models/mintplanversionrequest.ts +80 -0
- package/src/models/operations/createplan.ts +6 -0
- package/src/models/operations/getinvoice.ts +1 -1
- package/src/models/operations/getinvoicelineitems.ts +1 -1
- package/src/models/operations/getplanversion.ts +37 -0
- package/src/models/operations/index.ts +4 -0
- package/src/models/operations/listplanversions.ts +91 -0
- package/src/models/operations/mintplanversion.ts +40 -0
- package/src/models/operations/transitionplanversion.ts +49 -0
- package/src/models/operations/updateplan.ts +6 -0
- package/src/models/plan.ts +10 -0
- package/src/models/planversion.ts +113 -0
- package/src/models/planversionpriceslot.ts +136 -0
- package/src/models/planversionsummary.ts +95 -0
- package/src/models/price.ts +6 -7
- package/src/models/pricepropertiesunion.ts +1 -1
- package/src/models/revenuesummaryresponse.ts +10 -0
- package/src/models/revenuetrendbucket.ts +5 -0
- package/src/models/scheduleinterval.ts +7 -2
- package/src/models/schemasbillingschedule.ts +7 -2
- package/src/models/subscription.ts +10 -0
- package/src/models/transitionplanversionrequest.ts +39 -0
- package/src/sdk/plans.ts +72 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
|
|
7
|
+
export type ReplacePrice = {
|
|
8
|
+
/**
|
|
9
|
+
* Unique identifier for a price
|
|
10
|
+
*/
|
|
11
|
+
replacesPriceId: string;
|
|
12
|
+
/**
|
|
13
|
+
* Unique identifier for a price
|
|
14
|
+
*/
|
|
15
|
+
withPriceId: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A reference-by-id price diff applied to the prices of the plan's current version. Every id references an existing price created via POST /prices; inline price definitions are not accepted. An empty body copies the current prices into the new version unchanged. A version must carry at least one price, so a diff that would leave none is rejected.
|
|
20
|
+
*/
|
|
21
|
+
export type MintPlanVersionRequest = {
|
|
22
|
+
/**
|
|
23
|
+
* Prices to add to the version. Each must not already be on the plan's current version.
|
|
24
|
+
*/
|
|
25
|
+
addPrices?: Array<string> | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Prices to remove. Each must be on the plan's current version.
|
|
28
|
+
*/
|
|
29
|
+
removePrices?: Array<string> | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Prices to swap in place, preserving the slot's lineage so the price keeps its identity where the plan is configured for stable price ids. replacesPriceId must be on the plan's current version; withPriceId is the new price.
|
|
32
|
+
*/
|
|
33
|
+
replacePrices?: Array<ReplacePrice> | undefined;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** @internal */
|
|
37
|
+
export type ReplacePrice$Outbound = {
|
|
38
|
+
replacesPriceId: string;
|
|
39
|
+
withPriceId: string;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** @internal */
|
|
43
|
+
export const ReplacePrice$outboundSchema: z.ZodType<
|
|
44
|
+
ReplacePrice$Outbound,
|
|
45
|
+
z.ZodTypeDef,
|
|
46
|
+
ReplacePrice
|
|
47
|
+
> = z.object({
|
|
48
|
+
replacesPriceId: z.string(),
|
|
49
|
+
withPriceId: z.string(),
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export function replacePriceToJSON(replacePrice: ReplacePrice): string {
|
|
53
|
+
return JSON.stringify(ReplacePrice$outboundSchema.parse(replacePrice));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** @internal */
|
|
57
|
+
export type MintPlanVersionRequest$Outbound = {
|
|
58
|
+
addPrices?: Array<string> | undefined;
|
|
59
|
+
removePrices?: Array<string> | undefined;
|
|
60
|
+
replacePrices?: Array<ReplacePrice$Outbound> | undefined;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/** @internal */
|
|
64
|
+
export const MintPlanVersionRequest$outboundSchema: z.ZodType<
|
|
65
|
+
MintPlanVersionRequest$Outbound,
|
|
66
|
+
z.ZodTypeDef,
|
|
67
|
+
MintPlanVersionRequest
|
|
68
|
+
> = z.object({
|
|
69
|
+
addPrices: z.array(z.string()).optional(),
|
|
70
|
+
removePrices: z.array(z.string()).optional(),
|
|
71
|
+
replacePrices: z.array(z.lazy(() => ReplacePrice$outboundSchema)).optional(),
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export function mintPlanVersionRequestToJSON(
|
|
75
|
+
mintPlanVersionRequest: MintPlanVersionRequest,
|
|
76
|
+
): string {
|
|
77
|
+
return JSON.stringify(
|
|
78
|
+
MintPlanVersionRequest$outboundSchema.parse(mintPlanVersionRequest),
|
|
79
|
+
);
|
|
80
|
+
}
|
|
@@ -130,6 +130,10 @@ export type CreatePlanRequest = {
|
|
|
130
130
|
* Credit-pool funding declarations for this plan. Each entry funds a distinct pricing unit's credit pool when a subscription to this plan activates: the allocated amount is minted as a credit grant on the customer's pool for that pricing unit, once at activation, or on a recurring basis only when that allocation explicitly sets recurrencePeriod. A plan may declare zero or more allocations; no two allocations on the same plan may target the same pricingUnitId.
|
|
131
131
|
*/
|
|
132
132
|
creditAllocations?: Array<models.PlanCreditAllocation> | undefined;
|
|
133
|
+
/**
|
|
134
|
+
* Governs price identity when a price on this plan's default version is replaced. When true (default), replacing a price at make-default keeps the original price id live (its value changes) and the superseded value is preserved under a new id. When false, the replacement price's id goes live instead and the superseded value stays under the original id.
|
|
135
|
+
*/
|
|
136
|
+
stablePriceIds?: boolean | undefined;
|
|
133
137
|
};
|
|
134
138
|
|
|
135
139
|
/** @internal */
|
|
@@ -171,6 +175,7 @@ export type CreatePlanRequest$Outbound = {
|
|
|
171
175
|
billingVersion: number;
|
|
172
176
|
billingAnchor?: string | null | undefined;
|
|
173
177
|
creditAllocations?: Array<models.PlanCreditAllocation$Outbound> | undefined;
|
|
178
|
+
stablePriceIds: boolean;
|
|
174
179
|
};
|
|
175
180
|
|
|
176
181
|
/** @internal */
|
|
@@ -198,6 +203,7 @@ export const CreatePlanRequest$outboundSchema: z.ZodType<
|
|
|
198
203
|
.optional(),
|
|
199
204
|
creditAllocations: z.array(models.PlanCreditAllocation$outboundSchema)
|
|
200
205
|
.optional(),
|
|
206
|
+
stablePriceIds: z.boolean().default(true),
|
|
201
207
|
});
|
|
202
208
|
|
|
203
209
|
export function createPlanRequestToJSON(
|
|
@@ -18,7 +18,7 @@ export type GetInvoiceRequest = {
|
|
|
18
18
|
*/
|
|
19
19
|
lineItemsLimit?: number | undefined;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Opaque pagination token for line items when expand=lineItems, taken from a previous response's nextPageToken. Do not construct or parse this value.
|
|
22
22
|
*/
|
|
23
23
|
lineItemsPageToken?: string | undefined;
|
|
24
24
|
};
|
|
@@ -14,7 +14,7 @@ export type GetInvoiceLineItemsRequest = {
|
|
|
14
14
|
*/
|
|
15
15
|
limit?: number | undefined;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Opaque pagination token to fetch the next page of results, taken from a previous response's nextPageToken. Do not construct or parse this value.
|
|
18
18
|
*/
|
|
19
19
|
pageToken?: string | undefined;
|
|
20
20
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
|
|
7
|
+
export type GetPlanVersionRequest = {
|
|
8
|
+
id: string;
|
|
9
|
+
/**
|
|
10
|
+
* The version number within the plan (1-based).
|
|
11
|
+
*/
|
|
12
|
+
versionNumber: number;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** @internal */
|
|
16
|
+
export type GetPlanVersionRequest$Outbound = {
|
|
17
|
+
id: string;
|
|
18
|
+
versionNumber: number;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const GetPlanVersionRequest$outboundSchema: z.ZodType<
|
|
23
|
+
GetPlanVersionRequest$Outbound,
|
|
24
|
+
z.ZodTypeDef,
|
|
25
|
+
GetPlanVersionRequest
|
|
26
|
+
> = z.object({
|
|
27
|
+
id: z.string(),
|
|
28
|
+
versionNumber: z.number().int(),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export function getPlanVersionRequestToJSON(
|
|
32
|
+
getPlanVersionRequest: GetPlanVersionRequest,
|
|
33
|
+
): string {
|
|
34
|
+
return JSON.stringify(
|
|
35
|
+
GetPlanVersionRequest$outboundSchema.parse(getPlanVersionRequest),
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -61,6 +61,7 @@ export * from "./getmerchantintegration.js";
|
|
|
61
61
|
export * from "./getorder.js";
|
|
62
62
|
export * from "./getpayment.js";
|
|
63
63
|
export * from "./getplan.js";
|
|
64
|
+
export * from "./getplanversion.js";
|
|
64
65
|
export * from "./getprice.js";
|
|
65
66
|
export * from "./getproduct.js";
|
|
66
67
|
export * from "./getprofitability.js";
|
|
@@ -93,6 +94,7 @@ export * from "./listorders.js";
|
|
|
93
94
|
export * from "./listpayments.js";
|
|
94
95
|
export * from "./listpaymentsessions.js";
|
|
95
96
|
export * from "./listplans.js";
|
|
97
|
+
export * from "./listplanversions.js";
|
|
96
98
|
export * from "./listprices.js";
|
|
97
99
|
export * from "./listproducts.js";
|
|
98
100
|
export * from "./listsalesforceaccounts.js";
|
|
@@ -103,11 +105,13 @@ export * from "./listsourcerules.js";
|
|
|
103
105
|
export * from "./listsources.js";
|
|
104
106
|
export * from "./listsubscriptions.js";
|
|
105
107
|
export * from "./listtestclocks.js";
|
|
108
|
+
export * from "./mintplanversion.js";
|
|
106
109
|
export * from "./purchaseentitlementgrant.js";
|
|
107
110
|
export * from "./reconcilesubscriptionfeatures.js";
|
|
108
111
|
export * from "./rejectsourceevent.js";
|
|
109
112
|
export * from "./replacescheduleintervals.js";
|
|
110
113
|
export * from "./terminatesubscription.js";
|
|
114
|
+
export * from "./transitionplanversion.js";
|
|
111
115
|
export * from "./updateapproval.js";
|
|
112
116
|
export * from "./updatebillablemetric.js";
|
|
113
117
|
export * from "./updatebillingschedule.js";
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import * as models from "../index.js";
|
|
11
|
+
|
|
12
|
+
export type ListPlanVersionsRequest = {
|
|
13
|
+
id: string;
|
|
14
|
+
/**
|
|
15
|
+
* Maximum number of versions to return
|
|
16
|
+
*/
|
|
17
|
+
limit?: number | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Number of versions to skip
|
|
20
|
+
*/
|
|
21
|
+
offset?: number | undefined;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const ListPlanVersionsObject = {
|
|
25
|
+
List: "list",
|
|
26
|
+
} as const;
|
|
27
|
+
export type ListPlanVersionsObject = ClosedEnum<typeof ListPlanVersionsObject>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* List of plan versions
|
|
31
|
+
*/
|
|
32
|
+
export type ListPlanVersionsResponse = {
|
|
33
|
+
object: ListPlanVersionsObject;
|
|
34
|
+
data: Array<models.PlanVersionSummary>;
|
|
35
|
+
/**
|
|
36
|
+
* Offset-based pagination response.
|
|
37
|
+
*/
|
|
38
|
+
pagination: models.OffsetPagination;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/** @internal */
|
|
42
|
+
export type ListPlanVersionsRequest$Outbound = {
|
|
43
|
+
id: string;
|
|
44
|
+
limit: number;
|
|
45
|
+
offset: number;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** @internal */
|
|
49
|
+
export const ListPlanVersionsRequest$outboundSchema: z.ZodType<
|
|
50
|
+
ListPlanVersionsRequest$Outbound,
|
|
51
|
+
z.ZodTypeDef,
|
|
52
|
+
ListPlanVersionsRequest
|
|
53
|
+
> = z.object({
|
|
54
|
+
id: z.string(),
|
|
55
|
+
limit: z.number().int().default(10),
|
|
56
|
+
offset: z.number().int().default(0),
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export function listPlanVersionsRequestToJSON(
|
|
60
|
+
listPlanVersionsRequest: ListPlanVersionsRequest,
|
|
61
|
+
): string {
|
|
62
|
+
return JSON.stringify(
|
|
63
|
+
ListPlanVersionsRequest$outboundSchema.parse(listPlanVersionsRequest),
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** @internal */
|
|
68
|
+
export const ListPlanVersionsObject$inboundSchema: z.ZodNativeEnum<
|
|
69
|
+
typeof ListPlanVersionsObject
|
|
70
|
+
> = z.nativeEnum(ListPlanVersionsObject);
|
|
71
|
+
|
|
72
|
+
/** @internal */
|
|
73
|
+
export const ListPlanVersionsResponse$inboundSchema: z.ZodType<
|
|
74
|
+
ListPlanVersionsResponse,
|
|
75
|
+
z.ZodTypeDef,
|
|
76
|
+
unknown
|
|
77
|
+
> = z.object({
|
|
78
|
+
object: ListPlanVersionsObject$inboundSchema,
|
|
79
|
+
data: z.array(models.PlanVersionSummary$inboundSchema),
|
|
80
|
+
pagination: models.OffsetPagination$inboundSchema,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export function listPlanVersionsResponseFromJSON(
|
|
84
|
+
jsonString: string,
|
|
85
|
+
): SafeParseResult<ListPlanVersionsResponse, SDKValidationError> {
|
|
86
|
+
return safeParse(
|
|
87
|
+
jsonString,
|
|
88
|
+
(x) => ListPlanVersionsResponse$inboundSchema.parse(JSON.parse(x)),
|
|
89
|
+
`Failed to parse 'ListPlanVersionsResponse' from JSON`,
|
|
90
|
+
);
|
|
91
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import * as models from "../index.js";
|
|
8
|
+
|
|
9
|
+
export type MintPlanVersionRequest = {
|
|
10
|
+
id: string;
|
|
11
|
+
mintPlanVersionRequest: models.MintPlanVersionRequest;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** @internal */
|
|
15
|
+
export type MintPlanVersionRequest$Outbound = {
|
|
16
|
+
id: string;
|
|
17
|
+
MintPlanVersionRequest: models.MintPlanVersionRequest$Outbound;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** @internal */
|
|
21
|
+
export const MintPlanVersionRequest$outboundSchema: z.ZodType<
|
|
22
|
+
MintPlanVersionRequest$Outbound,
|
|
23
|
+
z.ZodTypeDef,
|
|
24
|
+
MintPlanVersionRequest
|
|
25
|
+
> = z.object({
|
|
26
|
+
id: z.string(),
|
|
27
|
+
mintPlanVersionRequest: models.MintPlanVersionRequest$outboundSchema,
|
|
28
|
+
}).transform((v) => {
|
|
29
|
+
return remap$(v, {
|
|
30
|
+
mintPlanVersionRequest: "MintPlanVersionRequest",
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export function mintPlanVersionRequestToJSON(
|
|
35
|
+
mintPlanVersionRequest: MintPlanVersionRequest,
|
|
36
|
+
): string {
|
|
37
|
+
return JSON.stringify(
|
|
38
|
+
MintPlanVersionRequest$outboundSchema.parse(mintPlanVersionRequest),
|
|
39
|
+
);
|
|
40
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import * as models from "../index.js";
|
|
8
|
+
|
|
9
|
+
export type TransitionPlanVersionRequest = {
|
|
10
|
+
id: string;
|
|
11
|
+
/**
|
|
12
|
+
* The version number within the plan (1-based).
|
|
13
|
+
*/
|
|
14
|
+
versionNumber: number;
|
|
15
|
+
transitionPlanVersionRequest: models.TransitionPlanVersionRequest;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
export type TransitionPlanVersionRequest$Outbound = {
|
|
20
|
+
id: string;
|
|
21
|
+
versionNumber: number;
|
|
22
|
+
TransitionPlanVersionRequest: models.TransitionPlanVersionRequest$Outbound;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** @internal */
|
|
26
|
+
export const TransitionPlanVersionRequest$outboundSchema: z.ZodType<
|
|
27
|
+
TransitionPlanVersionRequest$Outbound,
|
|
28
|
+
z.ZodTypeDef,
|
|
29
|
+
TransitionPlanVersionRequest
|
|
30
|
+
> = z.object({
|
|
31
|
+
id: z.string(),
|
|
32
|
+
versionNumber: z.number().int(),
|
|
33
|
+
transitionPlanVersionRequest:
|
|
34
|
+
models.TransitionPlanVersionRequest$outboundSchema,
|
|
35
|
+
}).transform((v) => {
|
|
36
|
+
return remap$(v, {
|
|
37
|
+
transitionPlanVersionRequest: "TransitionPlanVersionRequest",
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export function transitionPlanVersionRequestToJSON(
|
|
42
|
+
transitionPlanVersionRequest: TransitionPlanVersionRequest,
|
|
43
|
+
): string {
|
|
44
|
+
return JSON.stringify(
|
|
45
|
+
TransitionPlanVersionRequest$outboundSchema.parse(
|
|
46
|
+
transitionPlanVersionRequest,
|
|
47
|
+
),
|
|
48
|
+
);
|
|
49
|
+
}
|
|
@@ -103,6 +103,10 @@ export type UpdatePlanRequestBody = {
|
|
|
103
103
|
* Credit-pool funding declarations for this plan. Each entry funds a distinct pricing unit's credit pool when a subscription to this plan activates: the allocated amount is minted as a credit grant on the customer's pool for that pricing unit, once at activation, or on a recurring basis only when that allocation explicitly sets recurrencePeriod. A plan may declare zero or more allocations; no two allocations on the same plan may target the same pricingUnitId.
|
|
104
104
|
*/
|
|
105
105
|
creditAllocations?: Array<models.PlanCreditAllocation> | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Governs price identity when a price is replaced by minting a new plan version and making it default. When true (default), replacing a price at make-default keeps the original price id live (its value changes) and the superseded value is preserved under a new id. When false, the replacement price's id goes live instead and the superseded value stays under the original id. Has no effect on this request's own prices field: prices carried over keep their ids, but swapping one price for another there moves the plan to the new price's id rather than keeping the original live.
|
|
108
|
+
*/
|
|
109
|
+
stablePriceIds?: boolean | undefined;
|
|
106
110
|
};
|
|
107
111
|
|
|
108
112
|
export type UpdatePlanRequest = {
|
|
@@ -143,6 +147,7 @@ export type UpdatePlanRequestBody$Outbound = {
|
|
|
143
147
|
renewalReminderDays?: number | undefined;
|
|
144
148
|
billingAnchor?: string | null | undefined;
|
|
145
149
|
creditAllocations?: Array<models.PlanCreditAllocation$Outbound> | undefined;
|
|
150
|
+
stablePriceIds?: boolean | undefined;
|
|
146
151
|
};
|
|
147
152
|
|
|
148
153
|
/** @internal */
|
|
@@ -166,6 +171,7 @@ export const UpdatePlanRequestBody$outboundSchema: z.ZodType<
|
|
|
166
171
|
.optional(),
|
|
167
172
|
creditAllocations: z.array(models.PlanCreditAllocation$outboundSchema)
|
|
168
173
|
.optional(),
|
|
174
|
+
stablePriceIds: z.boolean().optional(),
|
|
169
175
|
});
|
|
170
176
|
|
|
171
177
|
export function updatePlanRequestBodyToJSON(
|
package/src/models/plan.ts
CHANGED
|
@@ -118,6 +118,14 @@ export type Plan = {
|
|
|
118
118
|
* Credit-pool funding declarations for this plan. Each entry funds a distinct pricing unit's credit pool when a subscription to this plan activates: the allocated amount is minted as a credit grant on the customer's pool for that pricing unit, once at activation, or on a recurring basis only when that allocation explicitly sets recurrencePeriod. A plan may declare zero or more allocations; no two allocations on the same plan target the same pricingUnitId.
|
|
119
119
|
*/
|
|
120
120
|
creditAllocations?: Array<PlanCreditAllocation> | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* Unique identifier for a plan version
|
|
123
|
+
*/
|
|
124
|
+
defaultVersionId?: string | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Governs price identity when a price on this plan's default version is replaced. When true (default), replacing a price at make-default keeps the original price id live (its value changes) and the superseded value is preserved under a new id. When false, the replacement price's id goes live instead and the superseded value stays under the original id.
|
|
127
|
+
*/
|
|
128
|
+
stablePriceIds: boolean;
|
|
121
129
|
};
|
|
122
130
|
|
|
123
131
|
/** @internal */
|
|
@@ -192,6 +200,8 @@ export const Plan$inboundSchema: z.ZodType<Plan, z.ZodTypeDef, unknown> = z
|
|
|
192
200
|
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
193
201
|
).optional(),
|
|
194
202
|
creditAllocations: z.array(PlanCreditAllocation$inboundSchema).optional(),
|
|
203
|
+
defaultVersionId: z.string().optional(),
|
|
204
|
+
stablePriceIds: z.boolean().default(true),
|
|
195
205
|
});
|
|
196
206
|
|
|
197
207
|
export function planFromJSON(
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
PlanVersionPriceSlot,
|
|
12
|
+
PlanVersionPriceSlot$inboundSchema,
|
|
13
|
+
} from "./planversionpriceslot.js";
|
|
14
|
+
|
|
15
|
+
export const PlanVersionObject = {
|
|
16
|
+
PlanVersion: "plan_version",
|
|
17
|
+
} as const;
|
|
18
|
+
export type PlanVersionObject = ClosedEnum<typeof PlanVersionObject>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Lifecycle status of the version.
|
|
22
|
+
*/
|
|
23
|
+
export const PlanVersionStatus = {
|
|
24
|
+
Draft: "draft",
|
|
25
|
+
Published: "published",
|
|
26
|
+
Archived: "archived",
|
|
27
|
+
} as const;
|
|
28
|
+
/**
|
|
29
|
+
* Lifecycle status of the version.
|
|
30
|
+
*/
|
|
31
|
+
export type PlanVersionStatus = ClosedEnum<typeof PlanVersionStatus>;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A single plan version, including its price slots. Extends the list summary with the version's prices for draft review.
|
|
35
|
+
*/
|
|
36
|
+
export type PlanVersion = {
|
|
37
|
+
/**
|
|
38
|
+
* Unique identifier for a plan version
|
|
39
|
+
*/
|
|
40
|
+
id: string;
|
|
41
|
+
object: PlanVersionObject;
|
|
42
|
+
/**
|
|
43
|
+
* Monotonic version number within the plan, starting at 1.
|
|
44
|
+
*/
|
|
45
|
+
versionNumber: number;
|
|
46
|
+
/**
|
|
47
|
+
* Lifecycle status of the version.
|
|
48
|
+
*/
|
|
49
|
+
status: PlanVersionStatus;
|
|
50
|
+
/**
|
|
51
|
+
* When this version was published. Absent for draft versions.
|
|
52
|
+
*/
|
|
53
|
+
publishedAt?: Date | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Whether this version is the plan's current default (live) version.
|
|
56
|
+
*/
|
|
57
|
+
isDefault: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Number of committed-status subscriptions pinned to this version at creation time. Not a live-billing cohort.
|
|
60
|
+
*/
|
|
61
|
+
subscriptionCount: number;
|
|
62
|
+
/**
|
|
63
|
+
* Unique identifier for a plan version
|
|
64
|
+
*/
|
|
65
|
+
basedOnVersionId?: string | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* When this version was last modified. Optimistic-concurrency token: read this value and echo it back as an `If-Match` header on a draft-price-mutation request to reject the write (412) if the draft changed since this read.
|
|
68
|
+
*/
|
|
69
|
+
updatedAt: Date;
|
|
70
|
+
/**
|
|
71
|
+
* The price slots that make up this version.
|
|
72
|
+
*/
|
|
73
|
+
prices: Array<PlanVersionPriceSlot>;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/** @internal */
|
|
77
|
+
export const PlanVersionObject$inboundSchema: z.ZodNativeEnum<
|
|
78
|
+
typeof PlanVersionObject
|
|
79
|
+
> = z.nativeEnum(PlanVersionObject);
|
|
80
|
+
|
|
81
|
+
/** @internal */
|
|
82
|
+
export const PlanVersionStatus$inboundSchema: z.ZodNativeEnum<
|
|
83
|
+
typeof PlanVersionStatus
|
|
84
|
+
> = z.nativeEnum(PlanVersionStatus);
|
|
85
|
+
|
|
86
|
+
/** @internal */
|
|
87
|
+
export const PlanVersion$inboundSchema: z.ZodType<
|
|
88
|
+
PlanVersion,
|
|
89
|
+
z.ZodTypeDef,
|
|
90
|
+
unknown
|
|
91
|
+
> = z.object({
|
|
92
|
+
id: z.string(),
|
|
93
|
+
object: PlanVersionObject$inboundSchema,
|
|
94
|
+
versionNumber: z.number().int(),
|
|
95
|
+
status: PlanVersionStatus$inboundSchema,
|
|
96
|
+
publishedAt: z.string().datetime({ offset: true }).transform(v => new Date(v))
|
|
97
|
+
.optional(),
|
|
98
|
+
isDefault: z.boolean(),
|
|
99
|
+
subscriptionCount: z.number().int(),
|
|
100
|
+
basedOnVersionId: z.string().optional(),
|
|
101
|
+
updatedAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
102
|
+
prices: z.array(PlanVersionPriceSlot$inboundSchema),
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
export function planVersionFromJSON(
|
|
106
|
+
jsonString: string,
|
|
107
|
+
): SafeParseResult<PlanVersion, SDKValidationError> {
|
|
108
|
+
return safeParse(
|
|
109
|
+
jsonString,
|
|
110
|
+
(x) => PlanVersion$inboundSchema.parse(JSON.parse(x)),
|
|
111
|
+
`Failed to parse 'PlanVersion' from JSON`,
|
|
112
|
+
);
|
|
113
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
|
+
import { PriceFeature, PriceFeature$inboundSchema } from "./pricefeature.js";
|
|
11
|
+
|
|
12
|
+
export const PlanVersionPriceSlotObject = {
|
|
13
|
+
Price: "price",
|
|
14
|
+
} as const;
|
|
15
|
+
export type PlanVersionPriceSlotObject = ClosedEnum<
|
|
16
|
+
typeof PlanVersionPriceSlotObject
|
|
17
|
+
>;
|
|
18
|
+
|
|
19
|
+
export const PlanVersionPriceSlotModel = {
|
|
20
|
+
Standard: "standard",
|
|
21
|
+
Dynamic: "dynamic",
|
|
22
|
+
Volume: "volume",
|
|
23
|
+
Percentage: "percentage",
|
|
24
|
+
} as const;
|
|
25
|
+
export type PlanVersionPriceSlotModel = ClosedEnum<
|
|
26
|
+
typeof PlanVersionPriceSlotModel
|
|
27
|
+
>;
|
|
28
|
+
|
|
29
|
+
export const PlanVersionPriceSlotPaymentTerm = {
|
|
30
|
+
InArrears: "in_arrears",
|
|
31
|
+
InAdvance: "in_advance",
|
|
32
|
+
} as const;
|
|
33
|
+
export type PlanVersionPriceSlotPaymentTerm = ClosedEnum<
|
|
34
|
+
typeof PlanVersionPriceSlotPaymentTerm
|
|
35
|
+
>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* One price slot on a plan version. Every `Price` field is present, plus `priceDeleted` layered on top.
|
|
39
|
+
*/
|
|
40
|
+
export type PlanVersionPriceSlot = {
|
|
41
|
+
/**
|
|
42
|
+
* Unique identifier for a price
|
|
43
|
+
*/
|
|
44
|
+
id: string;
|
|
45
|
+
object: PlanVersionPriceSlotObject;
|
|
46
|
+
/**
|
|
47
|
+
* Unique identifier for an organization
|
|
48
|
+
*/
|
|
49
|
+
merchantId: string;
|
|
50
|
+
billableMetricId?: string | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* The unique identifier for the fee referred to by this price
|
|
53
|
+
*/
|
|
54
|
+
feeId?: string | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* ISO 8601 duration for billing frequency (e.g., P1M for monthly)
|
|
57
|
+
*/
|
|
58
|
+
billingCadence?: string | null | undefined;
|
|
59
|
+
createdAt: Date;
|
|
60
|
+
currency?: string | undefined;
|
|
61
|
+
description?: string | undefined;
|
|
62
|
+
invoiceDisplayName: string;
|
|
63
|
+
model: PlanVersionPriceSlotModel;
|
|
64
|
+
paymentTerm: PlanVersionPriceSlotPaymentTerm;
|
|
65
|
+
properties: { [k: string]: any };
|
|
66
|
+
unitAmount?: string | undefined;
|
|
67
|
+
updatedAt: Date;
|
|
68
|
+
/**
|
|
69
|
+
* Features associated with this price
|
|
70
|
+
*/
|
|
71
|
+
features?: Array<PriceFeature> | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* When true, grants applied to a subscription will discount usage charged by this price. Only supported for standard metered prices.
|
|
74
|
+
*/
|
|
75
|
+
grantDiscountEnabled: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Quantity used when generating invoice line items for this price. Total per period = quantity × unitPrice. Only supported for fee prices; metered prices derive quantity from usage. Defaults to 1.
|
|
78
|
+
*/
|
|
79
|
+
quantity: number;
|
|
80
|
+
/**
|
|
81
|
+
* True when the underlying price this slot references has been soft-deleted. The slot can still be removed or replaced to repair the draft; it cannot be published while any slot remains dead.
|
|
82
|
+
*/
|
|
83
|
+
priceDeleted: boolean;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/** @internal */
|
|
87
|
+
export const PlanVersionPriceSlotObject$inboundSchema: z.ZodNativeEnum<
|
|
88
|
+
typeof PlanVersionPriceSlotObject
|
|
89
|
+
> = z.nativeEnum(PlanVersionPriceSlotObject);
|
|
90
|
+
|
|
91
|
+
/** @internal */
|
|
92
|
+
export const PlanVersionPriceSlotModel$inboundSchema: z.ZodNativeEnum<
|
|
93
|
+
typeof PlanVersionPriceSlotModel
|
|
94
|
+
> = z.nativeEnum(PlanVersionPriceSlotModel);
|
|
95
|
+
|
|
96
|
+
/** @internal */
|
|
97
|
+
export const PlanVersionPriceSlotPaymentTerm$inboundSchema: z.ZodNativeEnum<
|
|
98
|
+
typeof PlanVersionPriceSlotPaymentTerm
|
|
99
|
+
> = z.nativeEnum(PlanVersionPriceSlotPaymentTerm);
|
|
100
|
+
|
|
101
|
+
/** @internal */
|
|
102
|
+
export const PlanVersionPriceSlot$inboundSchema: z.ZodType<
|
|
103
|
+
PlanVersionPriceSlot,
|
|
104
|
+
z.ZodTypeDef,
|
|
105
|
+
unknown
|
|
106
|
+
> = z.object({
|
|
107
|
+
id: z.string(),
|
|
108
|
+
object: PlanVersionPriceSlotObject$inboundSchema.default("price"),
|
|
109
|
+
merchantId: z.string(),
|
|
110
|
+
billableMetricId: z.string().optional(),
|
|
111
|
+
feeId: z.string().optional(),
|
|
112
|
+
billingCadence: z.nullable(z.string()).optional(),
|
|
113
|
+
createdAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
114
|
+
currency: z.string().optional(),
|
|
115
|
+
description: z.string().optional(),
|
|
116
|
+
invoiceDisplayName: z.string(),
|
|
117
|
+
model: PlanVersionPriceSlotModel$inboundSchema,
|
|
118
|
+
paymentTerm: PlanVersionPriceSlotPaymentTerm$inboundSchema,
|
|
119
|
+
properties: z.record(z.any()),
|
|
120
|
+
unitAmount: z.string().optional(),
|
|
121
|
+
updatedAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
122
|
+
features: z.array(PriceFeature$inboundSchema).optional(),
|
|
123
|
+
grantDiscountEnabled: z.boolean().default(false),
|
|
124
|
+
quantity: z.number().int().default(1),
|
|
125
|
+
priceDeleted: z.boolean(),
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
export function planVersionPriceSlotFromJSON(
|
|
129
|
+
jsonString: string,
|
|
130
|
+
): SafeParseResult<PlanVersionPriceSlot, SDKValidationError> {
|
|
131
|
+
return safeParse(
|
|
132
|
+
jsonString,
|
|
133
|
+
(x) => PlanVersionPriceSlot$inboundSchema.parse(JSON.parse(x)),
|
|
134
|
+
`Failed to parse 'PlanVersionPriceSlot' from JSON`,
|
|
135
|
+
);
|
|
136
|
+
}
|