@polar-sh/sdk 0.36.0 → 0.36.2

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 (180) hide show
  1. package/README.md +24 -19
  2. package/bin/mcp-server.js +224 -66
  3. package/bin/mcp-server.js.map +8 -8
  4. package/dist/commonjs/funcs/customerPortalCustomerSessionIntrospect.d.ts +20 -0
  5. package/dist/commonjs/funcs/customerPortalCustomerSessionIntrospect.d.ts.map +1 -0
  6. package/dist/commonjs/funcs/customerPortalCustomerSessionIntrospect.js +110 -0
  7. package/dist/commonjs/funcs/customerPortalCustomerSessionIntrospect.js.map +1 -0
  8. package/dist/commonjs/lib/config.d.ts +2 -2
  9. package/dist/commonjs/lib/config.js +2 -2
  10. package/dist/commonjs/mcp-server/mcp-server.js +1 -1
  11. package/dist/commonjs/mcp-server/server.js +1 -1
  12. package/dist/commonjs/models/components/checkout.d.ts +10 -0
  13. package/dist/commonjs/models/components/checkout.d.ts.map +1 -1
  14. package/dist/commonjs/models/components/checkout.js +8 -0
  15. package/dist/commonjs/models/components/checkout.js.map +1 -1
  16. package/dist/commonjs/models/components/checkoutcreate.d.ts +5 -0
  17. package/dist/commonjs/models/components/checkoutcreate.d.ts.map +1 -1
  18. package/dist/commonjs/models/components/checkoutcreate.js +4 -0
  19. package/dist/commonjs/models/components/checkoutcreate.js.map +1 -1
  20. package/dist/commonjs/models/components/checkoutpublic.d.ts +10 -0
  21. package/dist/commonjs/models/components/checkoutpublic.d.ts.map +1 -1
  22. package/dist/commonjs/models/components/checkoutpublic.js +8 -0
  23. package/dist/commonjs/models/components/checkoutpublic.js.map +1 -1
  24. package/dist/commonjs/models/components/checkoutpublicconfirmed.d.ts +10 -0
  25. package/dist/commonjs/models/components/checkoutpublicconfirmed.d.ts.map +1 -1
  26. package/dist/commonjs/models/components/checkoutpublicconfirmed.js +8 -0
  27. package/dist/commonjs/models/components/checkoutpublicconfirmed.js.map +1 -1
  28. package/dist/commonjs/models/components/checkoutupdate.d.ts +5 -0
  29. package/dist/commonjs/models/components/checkoutupdate.d.ts.map +1 -1
  30. package/dist/commonjs/models/components/checkoutupdate.js +4 -0
  31. package/dist/commonjs/models/components/checkoutupdate.js.map +1 -1
  32. package/dist/commonjs/models/components/customercustomersession.d.ts +31 -0
  33. package/dist/commonjs/models/components/customercustomersession.d.ts.map +1 -0
  34. package/dist/commonjs/models/components/customercustomersession.js +82 -0
  35. package/dist/commonjs/models/components/customercustomersession.js.map +1 -0
  36. package/dist/commonjs/models/components/customersession.d.ts +2 -0
  37. package/dist/commonjs/models/components/customersession.d.ts.map +1 -1
  38. package/dist/commonjs/models/components/customersession.js +4 -0
  39. package/dist/commonjs/models/components/customersession.js.map +1 -1
  40. package/dist/commonjs/models/components/customersessioncustomerexternalidcreate.d.ts +5 -0
  41. package/dist/commonjs/models/components/customersessioncustomerexternalidcreate.d.ts.map +1 -1
  42. package/dist/commonjs/models/components/customersessioncustomerexternalidcreate.js +4 -0
  43. package/dist/commonjs/models/components/customersessioncustomerexternalidcreate.js.map +1 -1
  44. package/dist/commonjs/models/components/customersessioncustomeridcreate.d.ts +5 -0
  45. package/dist/commonjs/models/components/customersessioncustomeridcreate.d.ts.map +1 -1
  46. package/dist/commonjs/models/components/customersessioncustomeridcreate.js +4 -0
  47. package/dist/commonjs/models/components/customersessioncustomeridcreate.js.map +1 -1
  48. package/dist/commonjs/models/components/productcreateonetime.d.ts +44 -4
  49. package/dist/commonjs/models/components/productcreateonetime.d.ts.map +1 -1
  50. package/dist/commonjs/models/components/productcreateonetime.js +60 -20
  51. package/dist/commonjs/models/components/productcreateonetime.js.map +1 -1
  52. package/dist/commonjs/models/components/productcreaterecurring.d.ts +44 -4
  53. package/dist/commonjs/models/components/productcreaterecurring.d.ts.map +1 -1
  54. package/dist/commonjs/models/components/productcreaterecurring.js +60 -20
  55. package/dist/commonjs/models/components/productcreaterecurring.js.map +1 -1
  56. package/dist/commonjs/models/components/productupdate.d.ts +85 -4
  57. package/dist/commonjs/models/components/productupdate.d.ts.map +1 -1
  58. package/dist/commonjs/models/components/productupdate.js +117 -21
  59. package/dist/commonjs/models/components/productupdate.js.map +1 -1
  60. package/dist/commonjs/models/components/webtokenrequest.d.ts +67 -0
  61. package/dist/commonjs/models/components/webtokenrequest.d.ts.map +1 -0
  62. package/dist/commonjs/models/components/webtokenrequest.js +117 -0
  63. package/dist/commonjs/models/components/webtokenrequest.js.map +1 -0
  64. package/dist/commonjs/models/operations/customerportalcustomersessionintrospect.d.ts +29 -0
  65. package/dist/commonjs/models/operations/customerportalcustomersessionintrospect.d.ts.map +1 -0
  66. package/dist/commonjs/models/operations/customerportalcustomersessionintrospect.js +78 -0
  67. package/dist/commonjs/models/operations/customerportalcustomersessionintrospect.js.map +1 -0
  68. package/dist/commonjs/models/operations/oauth2requesttoken.d.ts +3 -2
  69. package/dist/commonjs/models/operations/oauth2requesttoken.d.ts.map +1 -1
  70. package/dist/commonjs/models/operations/oauth2requesttoken.js +3 -0
  71. package/dist/commonjs/models/operations/oauth2requesttoken.js.map +1 -1
  72. package/dist/commonjs/sdk/customerportal.d.ts +3 -0
  73. package/dist/commonjs/sdk/customerportal.d.ts.map +1 -1
  74. package/dist/commonjs/sdk/customerportal.js +4 -0
  75. package/dist/commonjs/sdk/customerportal.js.map +1 -1
  76. package/dist/commonjs/sdk/customersession.d.ts +15 -0
  77. package/dist/commonjs/sdk/customersession.d.ts.map +1 -0
  78. package/dist/commonjs/sdk/customersession.js +24 -0
  79. package/dist/commonjs/sdk/customersession.js.map +1 -0
  80. package/dist/esm/funcs/customerPortalCustomerSessionIntrospect.d.ts +20 -0
  81. package/dist/esm/funcs/customerPortalCustomerSessionIntrospect.d.ts.map +1 -0
  82. package/dist/esm/funcs/customerPortalCustomerSessionIntrospect.js +74 -0
  83. package/dist/esm/funcs/customerPortalCustomerSessionIntrospect.js.map +1 -0
  84. package/dist/esm/lib/config.d.ts +2 -2
  85. package/dist/esm/lib/config.js +2 -2
  86. package/dist/esm/mcp-server/mcp-server.js +1 -1
  87. package/dist/esm/mcp-server/server.js +1 -1
  88. package/dist/esm/models/components/checkout.d.ts +10 -0
  89. package/dist/esm/models/components/checkout.d.ts.map +1 -1
  90. package/dist/esm/models/components/checkout.js +8 -0
  91. package/dist/esm/models/components/checkout.js.map +1 -1
  92. package/dist/esm/models/components/checkoutcreate.d.ts +5 -0
  93. package/dist/esm/models/components/checkoutcreate.d.ts.map +1 -1
  94. package/dist/esm/models/components/checkoutcreate.js +4 -0
  95. package/dist/esm/models/components/checkoutcreate.js.map +1 -1
  96. package/dist/esm/models/components/checkoutpublic.d.ts +10 -0
  97. package/dist/esm/models/components/checkoutpublic.d.ts.map +1 -1
  98. package/dist/esm/models/components/checkoutpublic.js +8 -0
  99. package/dist/esm/models/components/checkoutpublic.js.map +1 -1
  100. package/dist/esm/models/components/checkoutpublicconfirmed.d.ts +10 -0
  101. package/dist/esm/models/components/checkoutpublicconfirmed.d.ts.map +1 -1
  102. package/dist/esm/models/components/checkoutpublicconfirmed.js +8 -0
  103. package/dist/esm/models/components/checkoutpublicconfirmed.js.map +1 -1
  104. package/dist/esm/models/components/checkoutupdate.d.ts +5 -0
  105. package/dist/esm/models/components/checkoutupdate.d.ts.map +1 -1
  106. package/dist/esm/models/components/checkoutupdate.js +4 -0
  107. package/dist/esm/models/components/checkoutupdate.js.map +1 -1
  108. package/dist/esm/models/components/customercustomersession.d.ts +31 -0
  109. package/dist/esm/models/components/customercustomersession.d.ts.map +1 -0
  110. package/dist/esm/models/components/customercustomersession.js +44 -0
  111. package/dist/esm/models/components/customercustomersession.js.map +1 -0
  112. package/dist/esm/models/components/customersession.d.ts +2 -0
  113. package/dist/esm/models/components/customersession.d.ts.map +1 -1
  114. package/dist/esm/models/components/customersession.js +4 -0
  115. package/dist/esm/models/components/customersession.js.map +1 -1
  116. package/dist/esm/models/components/customersessioncustomerexternalidcreate.d.ts +5 -0
  117. package/dist/esm/models/components/customersessioncustomerexternalidcreate.d.ts.map +1 -1
  118. package/dist/esm/models/components/customersessioncustomerexternalidcreate.js +4 -0
  119. package/dist/esm/models/components/customersessioncustomerexternalidcreate.js.map +1 -1
  120. package/dist/esm/models/components/customersessioncustomeridcreate.d.ts +5 -0
  121. package/dist/esm/models/components/customersessioncustomeridcreate.d.ts.map +1 -1
  122. package/dist/esm/models/components/customersessioncustomeridcreate.js +4 -0
  123. package/dist/esm/models/components/customersessioncustomeridcreate.js.map +1 -1
  124. package/dist/esm/models/components/productcreateonetime.d.ts +44 -4
  125. package/dist/esm/models/components/productcreateonetime.d.ts.map +1 -1
  126. package/dist/esm/models/components/productcreateonetime.js +60 -20
  127. package/dist/esm/models/components/productcreateonetime.js.map +1 -1
  128. package/dist/esm/models/components/productcreaterecurring.d.ts +44 -4
  129. package/dist/esm/models/components/productcreaterecurring.d.ts.map +1 -1
  130. package/dist/esm/models/components/productcreaterecurring.js +60 -20
  131. package/dist/esm/models/components/productcreaterecurring.js.map +1 -1
  132. package/dist/esm/models/components/productupdate.d.ts +85 -4
  133. package/dist/esm/models/components/productupdate.d.ts.map +1 -1
  134. package/dist/esm/models/components/productupdate.js +114 -20
  135. package/dist/esm/models/components/productupdate.js.map +1 -1
  136. package/dist/esm/models/components/webtokenrequest.d.ts +67 -0
  137. package/dist/esm/models/components/webtokenrequest.d.ts.map +1 -0
  138. package/dist/esm/models/components/webtokenrequest.js +79 -0
  139. package/dist/esm/models/components/webtokenrequest.js.map +1 -0
  140. package/dist/esm/models/operations/customerportalcustomersessionintrospect.d.ts +29 -0
  141. package/dist/esm/models/operations/customerportalcustomersessionintrospect.d.ts.map +1 -0
  142. package/dist/esm/models/operations/customerportalcustomersessionintrospect.js +40 -0
  143. package/dist/esm/models/operations/customerportalcustomersessionintrospect.js.map +1 -0
  144. package/dist/esm/models/operations/oauth2requesttoken.d.ts +3 -2
  145. package/dist/esm/models/operations/oauth2requesttoken.d.ts.map +1 -1
  146. package/dist/esm/models/operations/oauth2requesttoken.js +3 -0
  147. package/dist/esm/models/operations/oauth2requesttoken.js.map +1 -1
  148. package/dist/esm/sdk/customerportal.d.ts +3 -0
  149. package/dist/esm/sdk/customerportal.d.ts.map +1 -1
  150. package/dist/esm/sdk/customerportal.js +4 -0
  151. package/dist/esm/sdk/customerportal.js.map +1 -1
  152. package/dist/esm/sdk/customersession.d.ts +15 -0
  153. package/dist/esm/sdk/customersession.d.ts.map +1 -0
  154. package/dist/esm/sdk/customersession.js +20 -0
  155. package/dist/esm/sdk/customersession.js.map +1 -0
  156. package/docs/sdks/customersession/README.md +79 -0
  157. package/examples/package-lock.json +1 -1
  158. package/jsr.json +1 -1
  159. package/package.json +1 -1
  160. package/src/funcs/customerPortalCustomerSessionIntrospect.ts +157 -0
  161. package/src/lib/config.ts +2 -2
  162. package/src/mcp-server/mcp-server.ts +1 -1
  163. package/src/mcp-server/server.ts +1 -1
  164. package/src/models/components/checkout.ts +18 -0
  165. package/src/models/components/checkoutcreate.ts +9 -0
  166. package/src/models/components/checkoutpublic.ts +18 -0
  167. package/src/models/components/checkoutpublicconfirmed.ts +18 -0
  168. package/src/models/components/checkoutupdate.ts +9 -0
  169. package/src/models/components/customercustomersession.ts +81 -0
  170. package/src/models/components/customersession.ts +6 -0
  171. package/src/models/components/customersessioncustomerexternalidcreate.ts +9 -0
  172. package/src/models/components/customersessioncustomeridcreate.ts +9 -0
  173. package/src/models/components/productcreateonetime.ts +120 -40
  174. package/src/models/components/productcreaterecurring.ts +120 -40
  175. package/src/models/components/productupdate.ts +233 -40
  176. package/src/models/components/webtokenrequest.ts +133 -0
  177. package/src/models/operations/customerportalcustomersessionintrospect.ts +89 -0
  178. package/src/models/operations/oauth2requesttoken.ts +12 -2
  179. package/src/sdk/customerportal.ts +6 -0
  180. package/src/sdk/customersession.ts +30 -0
@@ -47,11 +47,11 @@ import {
47
47
  export type ProductCreateOneTimeMetadata = string | number | number | boolean;
48
48
 
49
49
  export type ProductCreateOneTimePrices =
50
- | ProductPriceMeteredUnitCreate
51
- | ProductPriceFixedCreate
52
- | ProductPriceSeatBasedCreate
53
- | ProductPriceCustomCreate
54
- | ProductPriceFreeCreate;
50
+ | (ProductPriceMeteredUnitCreate & { amountType: "metered_unit" })
51
+ | (ProductPriceFixedCreate & { amountType: "fixed" })
52
+ | (ProductPriceSeatBasedCreate & { amountType: "seat_based" })
53
+ | (ProductPriceCustomCreate & { amountType: "custom" })
54
+ | (ProductPriceFreeCreate & { amountType: "free" });
55
55
 
56
56
  export type ProductCreateOneTime = {
57
57
  /**
@@ -82,11 +82,11 @@ export type ProductCreateOneTime = {
82
82
  * List of available prices for this product. It should contain at most one static price (fixed, custom or free), and any number of metered prices. Metered prices are not supported on one-time purchase products.
83
83
  */
84
84
  prices: Array<
85
- | ProductPriceMeteredUnitCreate
86
- | ProductPriceFixedCreate
87
- | ProductPriceSeatBasedCreate
88
- | ProductPriceCustomCreate
89
- | ProductPriceFreeCreate
85
+ | (ProductPriceMeteredUnitCreate & { amountType: "metered_unit" })
86
+ | (ProductPriceFixedCreate & { amountType: "fixed" })
87
+ | (ProductPriceSeatBasedCreate & { amountType: "seat_based" })
88
+ | (ProductPriceCustomCreate & { amountType: "custom" })
89
+ | (ProductPriceFreeCreate & { amountType: "free" })
90
90
  >;
91
91
  /**
92
92
  * List of file IDs. Each one must be on the same organization as the product, of type `product_media` and correctly uploaded.
@@ -166,20 +166,40 @@ export const ProductCreateOneTimePrices$inboundSchema: z.ZodType<
166
166
  z.ZodTypeDef,
167
167
  unknown
168
168
  > = z.union([
169
- ProductPriceMeteredUnitCreate$inboundSchema,
170
- ProductPriceFixedCreate$inboundSchema,
171
- ProductPriceSeatBasedCreate$inboundSchema,
172
- ProductPriceCustomCreate$inboundSchema,
173
- ProductPriceFreeCreate$inboundSchema,
169
+ ProductPriceMeteredUnitCreate$inboundSchema.and(
170
+ z.object({ amount_type: z.literal("metered_unit") }).transform((v) => ({
171
+ amountType: v.amount_type,
172
+ })),
173
+ ),
174
+ ProductPriceFixedCreate$inboundSchema.and(
175
+ z.object({ amount_type: z.literal("fixed") }).transform((v) => ({
176
+ amountType: v.amount_type,
177
+ })),
178
+ ),
179
+ ProductPriceSeatBasedCreate$inboundSchema.and(
180
+ z.object({ amount_type: z.literal("seat_based") }).transform((v) => ({
181
+ amountType: v.amount_type,
182
+ })),
183
+ ),
184
+ ProductPriceCustomCreate$inboundSchema.and(
185
+ z.object({ amount_type: z.literal("custom") }).transform((v) => ({
186
+ amountType: v.amount_type,
187
+ })),
188
+ ),
189
+ ProductPriceFreeCreate$inboundSchema.and(
190
+ z.object({ amount_type: z.literal("free") }).transform((v) => ({
191
+ amountType: v.amount_type,
192
+ })),
193
+ ),
174
194
  ]);
175
195
 
176
196
  /** @internal */
177
197
  export type ProductCreateOneTimePrices$Outbound =
178
- | ProductPriceMeteredUnitCreate$Outbound
179
- | ProductPriceFixedCreate$Outbound
180
- | ProductPriceSeatBasedCreate$Outbound
181
- | ProductPriceCustomCreate$Outbound
182
- | ProductPriceFreeCreate$Outbound;
198
+ | (ProductPriceMeteredUnitCreate$Outbound & { amount_type: "metered_unit" })
199
+ | (ProductPriceFixedCreate$Outbound & { amount_type: "fixed" })
200
+ | (ProductPriceSeatBasedCreate$Outbound & { amount_type: "seat_based" })
201
+ | (ProductPriceCustomCreate$Outbound & { amount_type: "custom" })
202
+ | (ProductPriceFreeCreate$Outbound & { amount_type: "free" });
183
203
 
184
204
  /** @internal */
185
205
  export const ProductCreateOneTimePrices$outboundSchema: z.ZodType<
@@ -187,11 +207,31 @@ export const ProductCreateOneTimePrices$outboundSchema: z.ZodType<
187
207
  z.ZodTypeDef,
188
208
  ProductCreateOneTimePrices
189
209
  > = z.union([
190
- ProductPriceMeteredUnitCreate$outboundSchema,
191
- ProductPriceFixedCreate$outboundSchema,
192
- ProductPriceSeatBasedCreate$outboundSchema,
193
- ProductPriceCustomCreate$outboundSchema,
194
- ProductPriceFreeCreate$outboundSchema,
210
+ ProductPriceMeteredUnitCreate$outboundSchema.and(
211
+ z.object({ amountType: z.literal("metered_unit") }).transform((v) => ({
212
+ amount_type: v.amountType,
213
+ })),
214
+ ),
215
+ ProductPriceFixedCreate$outboundSchema.and(
216
+ z.object({ amountType: z.literal("fixed") }).transform((v) => ({
217
+ amount_type: v.amountType,
218
+ })),
219
+ ),
220
+ ProductPriceSeatBasedCreate$outboundSchema.and(
221
+ z.object({ amountType: z.literal("seat_based") }).transform((v) => ({
222
+ amount_type: v.amountType,
223
+ })),
224
+ ),
225
+ ProductPriceCustomCreate$outboundSchema.and(
226
+ z.object({ amountType: z.literal("custom") }).transform((v) => ({
227
+ amount_type: v.amountType,
228
+ })),
229
+ ),
230
+ ProductPriceFreeCreate$outboundSchema.and(
231
+ z.object({ amountType: z.literal("free") }).transform((v) => ({
232
+ amount_type: v.amountType,
233
+ })),
234
+ ),
195
235
  ]);
196
236
 
197
237
  /**
@@ -238,11 +278,31 @@ export const ProductCreateOneTime$inboundSchema: z.ZodType<
238
278
  description: z.nullable(z.string()).optional(),
239
279
  prices: z.array(
240
280
  z.union([
241
- ProductPriceMeteredUnitCreate$inboundSchema,
242
- ProductPriceFixedCreate$inboundSchema,
243
- ProductPriceSeatBasedCreate$inboundSchema,
244
- ProductPriceCustomCreate$inboundSchema,
245
- ProductPriceFreeCreate$inboundSchema,
281
+ ProductPriceMeteredUnitCreate$inboundSchema.and(
282
+ z.object({ amount_type: z.literal("metered_unit") }).transform((v) => ({
283
+ amountType: v.amount_type,
284
+ })),
285
+ ),
286
+ ProductPriceFixedCreate$inboundSchema.and(
287
+ z.object({ amount_type: z.literal("fixed") }).transform((v) => ({
288
+ amountType: v.amount_type,
289
+ })),
290
+ ),
291
+ ProductPriceSeatBasedCreate$inboundSchema.and(
292
+ z.object({ amount_type: z.literal("seat_based") }).transform((v) => ({
293
+ amountType: v.amount_type,
294
+ })),
295
+ ),
296
+ ProductPriceCustomCreate$inboundSchema.and(
297
+ z.object({ amount_type: z.literal("custom") }).transform((v) => ({
298
+ amountType: v.amount_type,
299
+ })),
300
+ ),
301
+ ProductPriceFreeCreate$inboundSchema.and(
302
+ z.object({ amount_type: z.literal("free") }).transform((v) => ({
303
+ amountType: v.amount_type,
304
+ })),
305
+ ),
246
306
  ]),
247
307
  ),
248
308
  medias: z.nullable(z.array(z.string())).optional(),
@@ -264,11 +324,11 @@ export type ProductCreateOneTime$Outbound = {
264
324
  name: string;
265
325
  description?: string | null | undefined;
266
326
  prices: Array<
267
- | ProductPriceMeteredUnitCreate$Outbound
268
- | ProductPriceFixedCreate$Outbound
269
- | ProductPriceSeatBasedCreate$Outbound
270
- | ProductPriceCustomCreate$Outbound
271
- | ProductPriceFreeCreate$Outbound
327
+ | (ProductPriceMeteredUnitCreate$Outbound & { amount_type: "metered_unit" })
328
+ | (ProductPriceFixedCreate$Outbound & { amount_type: "fixed" })
329
+ | (ProductPriceSeatBasedCreate$Outbound & { amount_type: "seat_based" })
330
+ | (ProductPriceCustomCreate$Outbound & { amount_type: "custom" })
331
+ | (ProductPriceFreeCreate$Outbound & { amount_type: "free" })
272
332
  >;
273
333
  medias?: Array<string> | null | undefined;
274
334
  attached_custom_fields?:
@@ -291,11 +351,31 @@ export const ProductCreateOneTime$outboundSchema: z.ZodType<
291
351
  description: z.nullable(z.string()).optional(),
292
352
  prices: z.array(
293
353
  z.union([
294
- ProductPriceMeteredUnitCreate$outboundSchema,
295
- ProductPriceFixedCreate$outboundSchema,
296
- ProductPriceSeatBasedCreate$outboundSchema,
297
- ProductPriceCustomCreate$outboundSchema,
298
- ProductPriceFreeCreate$outboundSchema,
354
+ ProductPriceMeteredUnitCreate$outboundSchema.and(
355
+ z.object({ amountType: z.literal("metered_unit") }).transform((v) => ({
356
+ amount_type: v.amountType,
357
+ })),
358
+ ),
359
+ ProductPriceFixedCreate$outboundSchema.and(
360
+ z.object({ amountType: z.literal("fixed") }).transform((v) => ({
361
+ amount_type: v.amountType,
362
+ })),
363
+ ),
364
+ ProductPriceSeatBasedCreate$outboundSchema.and(
365
+ z.object({ amountType: z.literal("seat_based") }).transform((v) => ({
366
+ amount_type: v.amountType,
367
+ })),
368
+ ),
369
+ ProductPriceCustomCreate$outboundSchema.and(
370
+ z.object({ amountType: z.literal("custom") }).transform((v) => ({
371
+ amount_type: v.amountType,
372
+ })),
373
+ ),
374
+ ProductPriceFreeCreate$outboundSchema.and(
375
+ z.object({ amountType: z.literal("free") }).transform((v) => ({
376
+ amount_type: v.amountType,
377
+ })),
378
+ ),
299
379
  ]),
300
380
  ),
301
381
  medias: z.nullable(z.array(z.string())).optional(),
@@ -57,11 +57,11 @@ import {
57
57
  export type ProductCreateRecurringMetadata = string | number | number | boolean;
58
58
 
59
59
  export type ProductCreateRecurringPrices =
60
- | ProductPriceMeteredUnitCreate
61
- | ProductPriceFixedCreate
62
- | ProductPriceSeatBasedCreate
63
- | ProductPriceCustomCreate
64
- | ProductPriceFreeCreate;
60
+ | (ProductPriceMeteredUnitCreate & { amountType: "metered_unit" })
61
+ | (ProductPriceFixedCreate & { amountType: "fixed" })
62
+ | (ProductPriceSeatBasedCreate & { amountType: "seat_based" })
63
+ | (ProductPriceCustomCreate & { amountType: "custom" })
64
+ | (ProductPriceFreeCreate & { amountType: "free" });
65
65
 
66
66
  export type ProductCreateRecurring = {
67
67
  /**
@@ -92,11 +92,11 @@ export type ProductCreateRecurring = {
92
92
  * List of available prices for this product. It should contain at most one static price (fixed, custom or free), and any number of metered prices. Metered prices are not supported on one-time purchase products.
93
93
  */
94
94
  prices: Array<
95
- | ProductPriceMeteredUnitCreate
96
- | ProductPriceFixedCreate
97
- | ProductPriceSeatBasedCreate
98
- | ProductPriceCustomCreate
99
- | ProductPriceFreeCreate
95
+ | (ProductPriceMeteredUnitCreate & { amountType: "metered_unit" })
96
+ | (ProductPriceFixedCreate & { amountType: "fixed" })
97
+ | (ProductPriceSeatBasedCreate & { amountType: "seat_based" })
98
+ | (ProductPriceCustomCreate & { amountType: "custom" })
99
+ | (ProductPriceFreeCreate & { amountType: "free" })
100
100
  >;
101
101
  /**
102
102
  * List of file IDs. Each one must be on the same organization as the product, of type `product_media` and correctly uploaded.
@@ -181,20 +181,40 @@ export const ProductCreateRecurringPrices$inboundSchema: z.ZodType<
181
181
  z.ZodTypeDef,
182
182
  unknown
183
183
  > = z.union([
184
- ProductPriceMeteredUnitCreate$inboundSchema,
185
- ProductPriceFixedCreate$inboundSchema,
186
- ProductPriceSeatBasedCreate$inboundSchema,
187
- ProductPriceCustomCreate$inboundSchema,
188
- ProductPriceFreeCreate$inboundSchema,
184
+ ProductPriceMeteredUnitCreate$inboundSchema.and(
185
+ z.object({ amount_type: z.literal("metered_unit") }).transform((v) => ({
186
+ amountType: v.amount_type,
187
+ })),
188
+ ),
189
+ ProductPriceFixedCreate$inboundSchema.and(
190
+ z.object({ amount_type: z.literal("fixed") }).transform((v) => ({
191
+ amountType: v.amount_type,
192
+ })),
193
+ ),
194
+ ProductPriceSeatBasedCreate$inboundSchema.and(
195
+ z.object({ amount_type: z.literal("seat_based") }).transform((v) => ({
196
+ amountType: v.amount_type,
197
+ })),
198
+ ),
199
+ ProductPriceCustomCreate$inboundSchema.and(
200
+ z.object({ amount_type: z.literal("custom") }).transform((v) => ({
201
+ amountType: v.amount_type,
202
+ })),
203
+ ),
204
+ ProductPriceFreeCreate$inboundSchema.and(
205
+ z.object({ amount_type: z.literal("free") }).transform((v) => ({
206
+ amountType: v.amount_type,
207
+ })),
208
+ ),
189
209
  ]);
190
210
 
191
211
  /** @internal */
192
212
  export type ProductCreateRecurringPrices$Outbound =
193
- | ProductPriceMeteredUnitCreate$Outbound
194
- | ProductPriceFixedCreate$Outbound
195
- | ProductPriceSeatBasedCreate$Outbound
196
- | ProductPriceCustomCreate$Outbound
197
- | ProductPriceFreeCreate$Outbound;
213
+ | (ProductPriceMeteredUnitCreate$Outbound & { amount_type: "metered_unit" })
214
+ | (ProductPriceFixedCreate$Outbound & { amount_type: "fixed" })
215
+ | (ProductPriceSeatBasedCreate$Outbound & { amount_type: "seat_based" })
216
+ | (ProductPriceCustomCreate$Outbound & { amount_type: "custom" })
217
+ | (ProductPriceFreeCreate$Outbound & { amount_type: "free" });
198
218
 
199
219
  /** @internal */
200
220
  export const ProductCreateRecurringPrices$outboundSchema: z.ZodType<
@@ -202,11 +222,31 @@ export const ProductCreateRecurringPrices$outboundSchema: z.ZodType<
202
222
  z.ZodTypeDef,
203
223
  ProductCreateRecurringPrices
204
224
  > = z.union([
205
- ProductPriceMeteredUnitCreate$outboundSchema,
206
- ProductPriceFixedCreate$outboundSchema,
207
- ProductPriceSeatBasedCreate$outboundSchema,
208
- ProductPriceCustomCreate$outboundSchema,
209
- ProductPriceFreeCreate$outboundSchema,
225
+ ProductPriceMeteredUnitCreate$outboundSchema.and(
226
+ z.object({ amountType: z.literal("metered_unit") }).transform((v) => ({
227
+ amount_type: v.amountType,
228
+ })),
229
+ ),
230
+ ProductPriceFixedCreate$outboundSchema.and(
231
+ z.object({ amountType: z.literal("fixed") }).transform((v) => ({
232
+ amount_type: v.amountType,
233
+ })),
234
+ ),
235
+ ProductPriceSeatBasedCreate$outboundSchema.and(
236
+ z.object({ amountType: z.literal("seat_based") }).transform((v) => ({
237
+ amount_type: v.amountType,
238
+ })),
239
+ ),
240
+ ProductPriceCustomCreate$outboundSchema.and(
241
+ z.object({ amountType: z.literal("custom") }).transform((v) => ({
242
+ amount_type: v.amountType,
243
+ })),
244
+ ),
245
+ ProductPriceFreeCreate$outboundSchema.and(
246
+ z.object({ amountType: z.literal("free") }).transform((v) => ({
247
+ amount_type: v.amountType,
248
+ })),
249
+ ),
210
250
  ]);
211
251
 
212
252
  /**
@@ -255,11 +295,31 @@ export const ProductCreateRecurring$inboundSchema: z.ZodType<
255
295
  description: z.nullable(z.string()).optional(),
256
296
  prices: z.array(
257
297
  z.union([
258
- ProductPriceMeteredUnitCreate$inboundSchema,
259
- ProductPriceFixedCreate$inboundSchema,
260
- ProductPriceSeatBasedCreate$inboundSchema,
261
- ProductPriceCustomCreate$inboundSchema,
262
- ProductPriceFreeCreate$inboundSchema,
298
+ ProductPriceMeteredUnitCreate$inboundSchema.and(
299
+ z.object({ amount_type: z.literal("metered_unit") }).transform((v) => ({
300
+ amountType: v.amount_type,
301
+ })),
302
+ ),
303
+ ProductPriceFixedCreate$inboundSchema.and(
304
+ z.object({ amount_type: z.literal("fixed") }).transform((v) => ({
305
+ amountType: v.amount_type,
306
+ })),
307
+ ),
308
+ ProductPriceSeatBasedCreate$inboundSchema.and(
309
+ z.object({ amount_type: z.literal("seat_based") }).transform((v) => ({
310
+ amountType: v.amount_type,
311
+ })),
312
+ ),
313
+ ProductPriceCustomCreate$inboundSchema.and(
314
+ z.object({ amount_type: z.literal("custom") }).transform((v) => ({
315
+ amountType: v.amount_type,
316
+ })),
317
+ ),
318
+ ProductPriceFreeCreate$inboundSchema.and(
319
+ z.object({ amount_type: z.literal("free") }).transform((v) => ({
320
+ amountType: v.amount_type,
321
+ })),
322
+ ),
263
323
  ]),
264
324
  ),
265
325
  medias: z.nullable(z.array(z.string())).optional(),
@@ -285,11 +345,11 @@ export type ProductCreateRecurring$Outbound = {
285
345
  name: string;
286
346
  description?: string | null | undefined;
287
347
  prices: Array<
288
- | ProductPriceMeteredUnitCreate$Outbound
289
- | ProductPriceFixedCreate$Outbound
290
- | ProductPriceSeatBasedCreate$Outbound
291
- | ProductPriceCustomCreate$Outbound
292
- | ProductPriceFreeCreate$Outbound
348
+ | (ProductPriceMeteredUnitCreate$Outbound & { amount_type: "metered_unit" })
349
+ | (ProductPriceFixedCreate$Outbound & { amount_type: "fixed" })
350
+ | (ProductPriceSeatBasedCreate$Outbound & { amount_type: "seat_based" })
351
+ | (ProductPriceCustomCreate$Outbound & { amount_type: "custom" })
352
+ | (ProductPriceFreeCreate$Outbound & { amount_type: "free" })
293
353
  >;
294
354
  medias?: Array<string> | null | undefined;
295
355
  attached_custom_fields?:
@@ -314,11 +374,31 @@ export const ProductCreateRecurring$outboundSchema: z.ZodType<
314
374
  description: z.nullable(z.string()).optional(),
315
375
  prices: z.array(
316
376
  z.union([
317
- ProductPriceMeteredUnitCreate$outboundSchema,
318
- ProductPriceFixedCreate$outboundSchema,
319
- ProductPriceSeatBasedCreate$outboundSchema,
320
- ProductPriceCustomCreate$outboundSchema,
321
- ProductPriceFreeCreate$outboundSchema,
377
+ ProductPriceMeteredUnitCreate$outboundSchema.and(
378
+ z.object({ amountType: z.literal("metered_unit") }).transform((v) => ({
379
+ amount_type: v.amountType,
380
+ })),
381
+ ),
382
+ ProductPriceFixedCreate$outboundSchema.and(
383
+ z.object({ amountType: z.literal("fixed") }).transform((v) => ({
384
+ amount_type: v.amountType,
385
+ })),
386
+ ),
387
+ ProductPriceSeatBasedCreate$outboundSchema.and(
388
+ z.object({ amountType: z.literal("seat_based") }).transform((v) => ({
389
+ amount_type: v.amountType,
390
+ })),
391
+ ),
392
+ ProductPriceCustomCreate$outboundSchema.and(
393
+ z.object({ amountType: z.literal("custom") }).transform((v) => ({
394
+ amount_type: v.amountType,
395
+ })),
396
+ ),
397
+ ProductPriceFreeCreate$outboundSchema.and(
398
+ z.object({ amountType: z.literal("free") }).transform((v) => ({
399
+ amount_type: v.amountType,
400
+ })),
401
+ ),
322
402
  ]),
323
403
  ),
324
404
  medias: z.nullable(z.array(z.string())).optional(),