@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
@@ -62,13 +62,20 @@ import {
62
62
 
63
63
  export type ProductUpdateMetadata = string | number | number | boolean;
64
64
 
65
+ export type Two =
66
+ | (ProductPriceMeteredUnitCreate & { amountType: "metered_unit" })
67
+ | (ProductPriceFixedCreate & { amountType: "fixed" })
68
+ | (ProductPriceSeatBasedCreate & { amountType: "seat_based" })
69
+ | (ProductPriceCustomCreate & { amountType: "custom" })
70
+ | (ProductPriceFreeCreate & { amountType: "free" });
71
+
65
72
  export type ProductUpdatePrices =
66
- | ProductPriceMeteredUnitCreate
67
- | ProductPriceFixedCreate
68
- | ProductPriceSeatBasedCreate
69
73
  | ExistingProductPrice
70
- | ProductPriceCustomCreate
71
- | ProductPriceFreeCreate;
74
+ | (ProductPriceMeteredUnitCreate & { amountType: "metered_unit" })
75
+ | (ProductPriceFixedCreate & { amountType: "fixed" })
76
+ | (ProductPriceSeatBasedCreate & { amountType: "seat_based" })
77
+ | (ProductPriceCustomCreate & { amountType: "custom" })
78
+ | (ProductPriceFreeCreate & { amountType: "free" });
72
79
 
73
80
  /**
74
81
  * Schema to update a product.
@@ -116,12 +123,12 @@ export type ProductUpdate = {
116
123
  */
117
124
  prices?:
118
125
  | Array<
119
- | ProductPriceMeteredUnitCreate
120
- | ProductPriceFixedCreate
121
- | ProductPriceSeatBasedCreate
122
126
  | ExistingProductPrice
123
- | ProductPriceCustomCreate
124
- | ProductPriceFreeCreate
127
+ | (ProductPriceMeteredUnitCreate & { amountType: "metered_unit" })
128
+ | (ProductPriceFixedCreate & { amountType: "fixed" })
129
+ | (ProductPriceSeatBasedCreate & { amountType: "seat_based" })
130
+ | (ProductPriceCustomCreate & { amountType: "custom" })
131
+ | (ProductPriceFreeCreate & { amountType: "free" })
125
132
  >
126
133
  | null
127
134
  | undefined;
@@ -180,28 +187,146 @@ export function productUpdateMetadataFromJSON(
180
187
  );
181
188
  }
182
189
 
190
+ /** @internal */
191
+ export const Two$inboundSchema: z.ZodType<Two, z.ZodTypeDef, unknown> = z.union(
192
+ [
193
+ ProductPriceMeteredUnitCreate$inboundSchema.and(
194
+ z.object({ amount_type: z.literal("metered_unit") }).transform((v) => ({
195
+ amountType: v.amount_type,
196
+ })),
197
+ ),
198
+ ProductPriceFixedCreate$inboundSchema.and(
199
+ z.object({ amount_type: z.literal("fixed") }).transform((v) => ({
200
+ amountType: v.amount_type,
201
+ })),
202
+ ),
203
+ ProductPriceSeatBasedCreate$inboundSchema.and(
204
+ z.object({ amount_type: z.literal("seat_based") }).transform((v) => ({
205
+ amountType: v.amount_type,
206
+ })),
207
+ ),
208
+ ProductPriceCustomCreate$inboundSchema.and(
209
+ z.object({ amount_type: z.literal("custom") }).transform((v) => ({
210
+ amountType: v.amount_type,
211
+ })),
212
+ ),
213
+ ProductPriceFreeCreate$inboundSchema.and(
214
+ z.object({ amount_type: z.literal("free") }).transform((v) => ({
215
+ amountType: v.amount_type,
216
+ })),
217
+ ),
218
+ ],
219
+ );
220
+
221
+ /** @internal */
222
+ export type Two$Outbound =
223
+ | (ProductPriceMeteredUnitCreate$Outbound & { amount_type: "metered_unit" })
224
+ | (ProductPriceFixedCreate$Outbound & { amount_type: "fixed" })
225
+ | (ProductPriceSeatBasedCreate$Outbound & { amount_type: "seat_based" })
226
+ | (ProductPriceCustomCreate$Outbound & { amount_type: "custom" })
227
+ | (ProductPriceFreeCreate$Outbound & { amount_type: "free" });
228
+
229
+ /** @internal */
230
+ export const Two$outboundSchema: z.ZodType<Two$Outbound, z.ZodTypeDef, Two> = z
231
+ .union([
232
+ ProductPriceMeteredUnitCreate$outboundSchema.and(
233
+ z.object({ amountType: z.literal("metered_unit") }).transform((v) => ({
234
+ amount_type: v.amountType,
235
+ })),
236
+ ),
237
+ ProductPriceFixedCreate$outboundSchema.and(
238
+ z.object({ amountType: z.literal("fixed") }).transform((v) => ({
239
+ amount_type: v.amountType,
240
+ })),
241
+ ),
242
+ ProductPriceSeatBasedCreate$outboundSchema.and(
243
+ z.object({ amountType: z.literal("seat_based") }).transform((v) => ({
244
+ amount_type: v.amountType,
245
+ })),
246
+ ),
247
+ ProductPriceCustomCreate$outboundSchema.and(
248
+ z.object({ amountType: z.literal("custom") }).transform((v) => ({
249
+ amount_type: v.amountType,
250
+ })),
251
+ ),
252
+ ProductPriceFreeCreate$outboundSchema.and(
253
+ z.object({ amountType: z.literal("free") }).transform((v) => ({
254
+ amount_type: v.amountType,
255
+ })),
256
+ ),
257
+ ]);
258
+
259
+ /**
260
+ * @internal
261
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
262
+ */
263
+ export namespace Two$ {
264
+ /** @deprecated use `Two$inboundSchema` instead. */
265
+ export const inboundSchema = Two$inboundSchema;
266
+ /** @deprecated use `Two$outboundSchema` instead. */
267
+ export const outboundSchema = Two$outboundSchema;
268
+ /** @deprecated use `Two$Outbound` instead. */
269
+ export type Outbound = Two$Outbound;
270
+ }
271
+
272
+ export function twoToJSON(two: Two): string {
273
+ return JSON.stringify(Two$outboundSchema.parse(two));
274
+ }
275
+
276
+ export function twoFromJSON(
277
+ jsonString: string,
278
+ ): SafeParseResult<Two, SDKValidationError> {
279
+ return safeParse(
280
+ jsonString,
281
+ (x) => Two$inboundSchema.parse(JSON.parse(x)),
282
+ `Failed to parse 'Two' from JSON`,
283
+ );
284
+ }
285
+
183
286
  /** @internal */
184
287
  export const ProductUpdatePrices$inboundSchema: z.ZodType<
185
288
  ProductUpdatePrices,
186
289
  z.ZodTypeDef,
187
290
  unknown
188
291
  > = z.union([
189
- ProductPriceMeteredUnitCreate$inboundSchema,
190
- ProductPriceFixedCreate$inboundSchema,
191
- ProductPriceSeatBasedCreate$inboundSchema,
192
292
  ExistingProductPrice$inboundSchema,
193
- ProductPriceCustomCreate$inboundSchema,
194
- ProductPriceFreeCreate$inboundSchema,
293
+ z.union([
294
+ ProductPriceMeteredUnitCreate$inboundSchema.and(
295
+ z.object({ amount_type: z.literal("metered_unit") }).transform((v) => ({
296
+ amountType: v.amount_type,
297
+ })),
298
+ ),
299
+ ProductPriceFixedCreate$inboundSchema.and(
300
+ z.object({ amount_type: z.literal("fixed") }).transform((v) => ({
301
+ amountType: v.amount_type,
302
+ })),
303
+ ),
304
+ ProductPriceSeatBasedCreate$inboundSchema.and(
305
+ z.object({ amount_type: z.literal("seat_based") }).transform((v) => ({
306
+ amountType: v.amount_type,
307
+ })),
308
+ ),
309
+ ProductPriceCustomCreate$inboundSchema.and(
310
+ z.object({ amount_type: z.literal("custom") }).transform((v) => ({
311
+ amountType: v.amount_type,
312
+ })),
313
+ ),
314
+ ProductPriceFreeCreate$inboundSchema.and(
315
+ z.object({ amount_type: z.literal("free") }).transform((v) => ({
316
+ amountType: v.amount_type,
317
+ })),
318
+ ),
319
+ ]),
195
320
  ]);
196
321
 
197
322
  /** @internal */
198
323
  export type ProductUpdatePrices$Outbound =
199
- | ProductPriceMeteredUnitCreate$Outbound
200
- | ProductPriceFixedCreate$Outbound
201
- | ProductPriceSeatBasedCreate$Outbound
202
324
  | ExistingProductPrice$Outbound
203
- | ProductPriceCustomCreate$Outbound
204
- | ProductPriceFreeCreate$Outbound;
325
+ | (ProductPriceMeteredUnitCreate$Outbound & { amount_type: "metered_unit" })
326
+ | (ProductPriceFixedCreate$Outbound & { amount_type: "fixed" })
327
+ | (ProductPriceSeatBasedCreate$Outbound & { amount_type: "seat_based" })
328
+ | (ProductPriceCustomCreate$Outbound & { amount_type: "custom" })
329
+ | (ProductPriceFreeCreate$Outbound & { amount_type: "free" });
205
330
 
206
331
  /** @internal */
207
332
  export const ProductUpdatePrices$outboundSchema: z.ZodType<
@@ -209,12 +334,34 @@ export const ProductUpdatePrices$outboundSchema: z.ZodType<
209
334
  z.ZodTypeDef,
210
335
  ProductUpdatePrices
211
336
  > = z.union([
212
- ProductPriceMeteredUnitCreate$outboundSchema,
213
- ProductPriceFixedCreate$outboundSchema,
214
- ProductPriceSeatBasedCreate$outboundSchema,
215
337
  ExistingProductPrice$outboundSchema,
216
- ProductPriceCustomCreate$outboundSchema,
217
- ProductPriceFreeCreate$outboundSchema,
338
+ z.union([
339
+ ProductPriceMeteredUnitCreate$outboundSchema.and(
340
+ z.object({ amountType: z.literal("metered_unit") }).transform((v) => ({
341
+ amount_type: v.amountType,
342
+ })),
343
+ ),
344
+ ProductPriceFixedCreate$outboundSchema.and(
345
+ z.object({ amountType: z.literal("fixed") }).transform((v) => ({
346
+ amount_type: v.amountType,
347
+ })),
348
+ ),
349
+ ProductPriceSeatBasedCreate$outboundSchema.and(
350
+ z.object({ amountType: z.literal("seat_based") }).transform((v) => ({
351
+ amount_type: v.amountType,
352
+ })),
353
+ ),
354
+ ProductPriceCustomCreate$outboundSchema.and(
355
+ z.object({ amountType: z.literal("custom") }).transform((v) => ({
356
+ amount_type: v.amountType,
357
+ })),
358
+ ),
359
+ ProductPriceFreeCreate$outboundSchema.and(
360
+ z.object({ amountType: z.literal("free") }).transform((v) => ({
361
+ amount_type: v.amountType,
362
+ })),
363
+ ),
364
+ ]),
218
365
  ]);
219
366
 
220
367
  /**
@@ -267,12 +414,34 @@ export const ProductUpdate$inboundSchema: z.ZodType<
267
414
  prices: z.nullable(
268
415
  z.array(
269
416
  z.union([
270
- ProductPriceMeteredUnitCreate$inboundSchema,
271
- ProductPriceFixedCreate$inboundSchema,
272
- ProductPriceSeatBasedCreate$inboundSchema,
273
417
  ExistingProductPrice$inboundSchema,
274
- ProductPriceCustomCreate$inboundSchema,
275
- ProductPriceFreeCreate$inboundSchema,
418
+ z.union([
419
+ ProductPriceMeteredUnitCreate$inboundSchema.and(
420
+ z.object({ amount_type: z.literal("metered_unit") }).transform((
421
+ v,
422
+ ) => ({ amountType: v.amount_type })),
423
+ ),
424
+ ProductPriceFixedCreate$inboundSchema.and(
425
+ z.object({ amount_type: z.literal("fixed") }).transform((v) => ({
426
+ amountType: v.amount_type,
427
+ })),
428
+ ),
429
+ ProductPriceSeatBasedCreate$inboundSchema.and(
430
+ z.object({ amount_type: z.literal("seat_based") }).transform((
431
+ v,
432
+ ) => ({ amountType: v.amount_type })),
433
+ ),
434
+ ProductPriceCustomCreate$inboundSchema.and(
435
+ z.object({ amount_type: z.literal("custom") }).transform((v) => ({
436
+ amountType: v.amount_type,
437
+ })),
438
+ ),
439
+ ProductPriceFreeCreate$inboundSchema.and(
440
+ z.object({ amount_type: z.literal("free") }).transform((v) => ({
441
+ amountType: v.amount_type,
442
+ })),
443
+ ),
444
+ ]),
276
445
  ]),
277
446
  ),
278
447
  ).optional(),
@@ -301,12 +470,14 @@ export type ProductUpdate$Outbound = {
301
470
  is_archived?: boolean | null | undefined;
302
471
  prices?:
303
472
  | Array<
304
- | ProductPriceMeteredUnitCreate$Outbound
305
- | ProductPriceFixedCreate$Outbound
306
- | ProductPriceSeatBasedCreate$Outbound
307
473
  | ExistingProductPrice$Outbound
308
- | ProductPriceCustomCreate$Outbound
309
- | ProductPriceFreeCreate$Outbound
474
+ | (ProductPriceMeteredUnitCreate$Outbound & {
475
+ amount_type: "metered_unit";
476
+ })
477
+ | (ProductPriceFixedCreate$Outbound & { amount_type: "fixed" })
478
+ | (ProductPriceSeatBasedCreate$Outbound & { amount_type: "seat_based" })
479
+ | (ProductPriceCustomCreate$Outbound & { amount_type: "custom" })
480
+ | (ProductPriceFreeCreate$Outbound & { amount_type: "free" })
310
481
  >
311
482
  | null
312
483
  | undefined;
@@ -336,12 +507,34 @@ export const ProductUpdate$outboundSchema: z.ZodType<
336
507
  prices: z.nullable(
337
508
  z.array(
338
509
  z.union([
339
- ProductPriceMeteredUnitCreate$outboundSchema,
340
- ProductPriceFixedCreate$outboundSchema,
341
- ProductPriceSeatBasedCreate$outboundSchema,
342
510
  ExistingProductPrice$outboundSchema,
343
- ProductPriceCustomCreate$outboundSchema,
344
- ProductPriceFreeCreate$outboundSchema,
511
+ z.union([
512
+ ProductPriceMeteredUnitCreate$outboundSchema.and(
513
+ z.object({ amountType: z.literal("metered_unit") }).transform((
514
+ v,
515
+ ) => ({ amount_type: v.amountType })),
516
+ ),
517
+ ProductPriceFixedCreate$outboundSchema.and(
518
+ z.object({ amountType: z.literal("fixed") }).transform((v) => ({
519
+ amount_type: v.amountType,
520
+ })),
521
+ ),
522
+ ProductPriceSeatBasedCreate$outboundSchema.and(
523
+ z.object({ amountType: z.literal("seat_based") }).transform((
524
+ v,
525
+ ) => ({ amount_type: v.amountType })),
526
+ ),
527
+ ProductPriceCustomCreate$outboundSchema.and(
528
+ z.object({ amountType: z.literal("custom") }).transform((v) => ({
529
+ amount_type: v.amountType,
530
+ })),
531
+ ),
532
+ ProductPriceFreeCreate$outboundSchema.and(
533
+ z.object({ amountType: z.literal("free") }).transform((v) => ({
534
+ amount_type: v.amountType,
535
+ })),
536
+ ),
537
+ ]),
345
538
  ]),
346
539
  ),
347
540
  ).optional(),
@@ -0,0 +1,133 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { ClosedEnum } from "../../types/enums.js";
9
+ import { Result as SafeParseResult } from "../../types/fp.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+
12
+ export const WebTokenRequestSubType = {
13
+ User: "user",
14
+ Organization: "organization",
15
+ } as const;
16
+ export type WebTokenRequestSubType = ClosedEnum<typeof WebTokenRequestSubType>;
17
+
18
+ export type WebTokenRequest = {
19
+ grantType: "web";
20
+ clientId: string;
21
+ clientSecret: string;
22
+ sessionToken: string;
23
+ subType?: WebTokenRequestSubType | undefined;
24
+ sub?: string | null | undefined;
25
+ scope?: string | null | undefined;
26
+ };
27
+
28
+ /** @internal */
29
+ export const WebTokenRequestSubType$inboundSchema: z.ZodNativeEnum<
30
+ typeof WebTokenRequestSubType
31
+ > = z.nativeEnum(WebTokenRequestSubType);
32
+
33
+ /** @internal */
34
+ export const WebTokenRequestSubType$outboundSchema: z.ZodNativeEnum<
35
+ typeof WebTokenRequestSubType
36
+ > = WebTokenRequestSubType$inboundSchema;
37
+
38
+ /**
39
+ * @internal
40
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
41
+ */
42
+ export namespace WebTokenRequestSubType$ {
43
+ /** @deprecated use `WebTokenRequestSubType$inboundSchema` instead. */
44
+ export const inboundSchema = WebTokenRequestSubType$inboundSchema;
45
+ /** @deprecated use `WebTokenRequestSubType$outboundSchema` instead. */
46
+ export const outboundSchema = WebTokenRequestSubType$outboundSchema;
47
+ }
48
+
49
+ /** @internal */
50
+ export const WebTokenRequest$inboundSchema: z.ZodType<
51
+ WebTokenRequest,
52
+ z.ZodTypeDef,
53
+ unknown
54
+ > = z.object({
55
+ grant_type: z.literal("web"),
56
+ client_id: z.string(),
57
+ client_secret: z.string(),
58
+ session_token: z.string(),
59
+ sub_type: WebTokenRequestSubType$inboundSchema.default("user"),
60
+ sub: z.nullable(z.string()).optional(),
61
+ scope: z.nullable(z.string()).optional(),
62
+ }).transform((v) => {
63
+ return remap$(v, {
64
+ "grant_type": "grantType",
65
+ "client_id": "clientId",
66
+ "client_secret": "clientSecret",
67
+ "session_token": "sessionToken",
68
+ "sub_type": "subType",
69
+ });
70
+ });
71
+
72
+ /** @internal */
73
+ export type WebTokenRequest$Outbound = {
74
+ grant_type: "web";
75
+ client_id: string;
76
+ client_secret: string;
77
+ session_token: string;
78
+ sub_type: string;
79
+ sub?: string | null | undefined;
80
+ scope?: string | null | undefined;
81
+ };
82
+
83
+ /** @internal */
84
+ export const WebTokenRequest$outboundSchema: z.ZodType<
85
+ WebTokenRequest$Outbound,
86
+ z.ZodTypeDef,
87
+ WebTokenRequest
88
+ > = z.object({
89
+ grantType: z.literal("web"),
90
+ clientId: z.string(),
91
+ clientSecret: z.string(),
92
+ sessionToken: z.string(),
93
+ subType: WebTokenRequestSubType$outboundSchema.default("user"),
94
+ sub: z.nullable(z.string()).optional(),
95
+ scope: z.nullable(z.string()).optional(),
96
+ }).transform((v) => {
97
+ return remap$(v, {
98
+ grantType: "grant_type",
99
+ clientId: "client_id",
100
+ clientSecret: "client_secret",
101
+ sessionToken: "session_token",
102
+ subType: "sub_type",
103
+ });
104
+ });
105
+
106
+ /**
107
+ * @internal
108
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
109
+ */
110
+ export namespace WebTokenRequest$ {
111
+ /** @deprecated use `WebTokenRequest$inboundSchema` instead. */
112
+ export const inboundSchema = WebTokenRequest$inboundSchema;
113
+ /** @deprecated use `WebTokenRequest$outboundSchema` instead. */
114
+ export const outboundSchema = WebTokenRequest$outboundSchema;
115
+ /** @deprecated use `WebTokenRequest$Outbound` instead. */
116
+ export type Outbound = WebTokenRequest$Outbound;
117
+ }
118
+
119
+ export function webTokenRequestToJSON(
120
+ webTokenRequest: WebTokenRequest,
121
+ ): string {
122
+ return JSON.stringify(WebTokenRequest$outboundSchema.parse(webTokenRequest));
123
+ }
124
+
125
+ export function webTokenRequestFromJSON(
126
+ jsonString: string,
127
+ ): SafeParseResult<WebTokenRequest, SDKValidationError> {
128
+ return safeParse(
129
+ jsonString,
130
+ (x) => WebTokenRequest$inboundSchema.parse(JSON.parse(x)),
131
+ `Failed to parse 'WebTokenRequest' from JSON`,
132
+ );
133
+ }
@@ -0,0 +1,89 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+
11
+ export type CustomerPortalCustomerSessionIntrospectSecurity = {
12
+ customerSession: string;
13
+ };
14
+
15
+ /** @internal */
16
+ export const CustomerPortalCustomerSessionIntrospectSecurity$inboundSchema:
17
+ z.ZodType<
18
+ CustomerPortalCustomerSessionIntrospectSecurity,
19
+ z.ZodTypeDef,
20
+ unknown
21
+ > = z.object({
22
+ customer_session: z.string(),
23
+ }).transform((v) => {
24
+ return remap$(v, {
25
+ "customer_session": "customerSession",
26
+ });
27
+ });
28
+
29
+ /** @internal */
30
+ export type CustomerPortalCustomerSessionIntrospectSecurity$Outbound = {
31
+ customer_session: string;
32
+ };
33
+
34
+ /** @internal */
35
+ export const CustomerPortalCustomerSessionIntrospectSecurity$outboundSchema:
36
+ z.ZodType<
37
+ CustomerPortalCustomerSessionIntrospectSecurity$Outbound,
38
+ z.ZodTypeDef,
39
+ CustomerPortalCustomerSessionIntrospectSecurity
40
+ > = z.object({
41
+ customerSession: z.string(),
42
+ }).transform((v) => {
43
+ return remap$(v, {
44
+ customerSession: "customer_session",
45
+ });
46
+ });
47
+
48
+ /**
49
+ * @internal
50
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
51
+ */
52
+ export namespace CustomerPortalCustomerSessionIntrospectSecurity$ {
53
+ /** @deprecated use `CustomerPortalCustomerSessionIntrospectSecurity$inboundSchema` instead. */
54
+ export const inboundSchema =
55
+ CustomerPortalCustomerSessionIntrospectSecurity$inboundSchema;
56
+ /** @deprecated use `CustomerPortalCustomerSessionIntrospectSecurity$outboundSchema` instead. */
57
+ export const outboundSchema =
58
+ CustomerPortalCustomerSessionIntrospectSecurity$outboundSchema;
59
+ /** @deprecated use `CustomerPortalCustomerSessionIntrospectSecurity$Outbound` instead. */
60
+ export type Outbound =
61
+ CustomerPortalCustomerSessionIntrospectSecurity$Outbound;
62
+ }
63
+
64
+ export function customerPortalCustomerSessionIntrospectSecurityToJSON(
65
+ customerPortalCustomerSessionIntrospectSecurity:
66
+ CustomerPortalCustomerSessionIntrospectSecurity,
67
+ ): string {
68
+ return JSON.stringify(
69
+ CustomerPortalCustomerSessionIntrospectSecurity$outboundSchema.parse(
70
+ customerPortalCustomerSessionIntrospectSecurity,
71
+ ),
72
+ );
73
+ }
74
+
75
+ export function customerPortalCustomerSessionIntrospectSecurityFromJSON(
76
+ jsonString: string,
77
+ ): SafeParseResult<
78
+ CustomerPortalCustomerSessionIntrospectSecurity,
79
+ SDKValidationError
80
+ > {
81
+ return safeParse(
82
+ jsonString,
83
+ (x) =>
84
+ CustomerPortalCustomerSessionIntrospectSecurity$inboundSchema.parse(
85
+ JSON.parse(x),
86
+ ),
87
+ `Failed to parse 'CustomerPortalCustomerSessionIntrospectSecurity' from JSON`,
88
+ );
89
+ }
@@ -17,11 +17,18 @@ import {
17
17
  RefreshTokenRequest$Outbound,
18
18
  RefreshTokenRequest$outboundSchema,
19
19
  } from "../components/refreshtokenrequest.js";
20
+ import {
21
+ WebTokenRequest,
22
+ WebTokenRequest$inboundSchema,
23
+ WebTokenRequest$Outbound,
24
+ WebTokenRequest$outboundSchema,
25
+ } from "../components/webtokenrequest.js";
20
26
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
21
27
 
22
28
  export type Oauth2RequestTokenRequestBody =
23
29
  | AuthorizationCodeTokenRequest
24
- | RefreshTokenRequest;
30
+ | RefreshTokenRequest
31
+ | WebTokenRequest;
25
32
 
26
33
  /** @internal */
27
34
  export const Oauth2RequestTokenRequestBody$inboundSchema: z.ZodType<
@@ -31,12 +38,14 @@ export const Oauth2RequestTokenRequestBody$inboundSchema: z.ZodType<
31
38
  > = z.union([
32
39
  AuthorizationCodeTokenRequest$inboundSchema,
33
40
  RefreshTokenRequest$inboundSchema,
41
+ WebTokenRequest$inboundSchema,
34
42
  ]);
35
43
 
36
44
  /** @internal */
37
45
  export type Oauth2RequestTokenRequestBody$Outbound =
38
46
  | AuthorizationCodeTokenRequest$Outbound
39
- | RefreshTokenRequest$Outbound;
47
+ | RefreshTokenRequest$Outbound
48
+ | WebTokenRequest$Outbound;
40
49
 
41
50
  /** @internal */
42
51
  export const Oauth2RequestTokenRequestBody$outboundSchema: z.ZodType<
@@ -46,6 +55,7 @@ export const Oauth2RequestTokenRequestBody$outboundSchema: z.ZodType<
46
55
  > = z.union([
47
56
  AuthorizationCodeTokenRequest$outboundSchema,
48
57
  RefreshTokenRequest$outboundSchema,
58
+ WebTokenRequest$outboundSchema,
49
59
  ]);
50
60
 
51
61
  /**
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  import { ClientSDK } from "../lib/sdks.js";
6
+ import { CustomerSession } from "./customersession.js";
6
7
  import { Downloadables } from "./downloadables.js";
7
8
  import { PolarBenefitGrants } from "./polarbenefitgrants.js";
8
9
  import { PolarCustomerMeters } from "./polarcustomermeters.js";
@@ -34,6 +35,11 @@ export class CustomerPortal extends ClientSDK {
34
35
  return (this._seats ??= new Seats(this._options));
35
36
  }
36
37
 
38
+ private _customerSession?: CustomerSession;
39
+ get customerSession(): CustomerSession {
40
+ return (this._customerSession ??= new CustomerSession(this._options));
41
+ }
42
+
37
43
  private _downloadables?: Downloadables;
38
44
  get downloadables(): Downloadables {
39
45
  return (this._downloadables ??= new Downloadables(this._options));
@@ -0,0 +1,30 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { customerPortalCustomerSessionIntrospect } from "../funcs/customerPortalCustomerSessionIntrospect.js";
6
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
7
+ import { CustomerCustomerSession } from "../models/components/customercustomersession.js";
8
+ import { CustomerPortalCustomerSessionIntrospectSecurity } from "../models/operations/customerportalcustomersessionintrospect.js";
9
+ import { unwrapAsync } from "../types/fp.js";
10
+
11
+ export class CustomerSession extends ClientSDK {
12
+ /**
13
+ * Introspect Customer Session
14
+ *
15
+ * @remarks
16
+ * Introspect the current session and return its information.
17
+ *
18
+ * **Scopes**: `customer_portal:read` `customer_portal:write`
19
+ */
20
+ async introspect(
21
+ security: CustomerPortalCustomerSessionIntrospectSecurity,
22
+ options?: RequestOptions,
23
+ ): Promise<CustomerCustomerSession> {
24
+ return unwrapAsync(customerPortalCustomerSessionIntrospect(
25
+ this,
26
+ security,
27
+ options,
28
+ ));
29
+ }
30
+ }