@polar-sh/sdk 0.36.1 → 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.
- package/README.md +24 -19
- package/bin/mcp-server.js +224 -66
- package/bin/mcp-server.js.map +8 -8
- package/dist/commonjs/funcs/customerPortalCustomerSessionIntrospect.d.ts +20 -0
- package/dist/commonjs/funcs/customerPortalCustomerSessionIntrospect.d.ts.map +1 -0
- package/dist/commonjs/funcs/customerPortalCustomerSessionIntrospect.js +110 -0
- package/dist/commonjs/funcs/customerPortalCustomerSessionIntrospect.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/mcp-server/mcp-server.js +1 -1
- package/dist/commonjs/mcp-server/server.js +1 -1
- package/dist/commonjs/models/components/checkout.d.ts +5 -0
- package/dist/commonjs/models/components/checkout.d.ts.map +1 -1
- package/dist/commonjs/models/components/checkout.js +4 -0
- package/dist/commonjs/models/components/checkout.js.map +1 -1
- package/dist/commonjs/models/components/checkoutcreate.d.ts +5 -0
- package/dist/commonjs/models/components/checkoutcreate.d.ts.map +1 -1
- package/dist/commonjs/models/components/checkoutcreate.js +4 -0
- package/dist/commonjs/models/components/checkoutcreate.js.map +1 -1
- package/dist/commonjs/models/components/checkoutpublic.d.ts +5 -0
- package/dist/commonjs/models/components/checkoutpublic.d.ts.map +1 -1
- package/dist/commonjs/models/components/checkoutpublic.js +4 -0
- package/dist/commonjs/models/components/checkoutpublic.js.map +1 -1
- package/dist/commonjs/models/components/checkoutpublicconfirmed.d.ts +5 -0
- package/dist/commonjs/models/components/checkoutpublicconfirmed.d.ts.map +1 -1
- package/dist/commonjs/models/components/checkoutpublicconfirmed.js +4 -0
- package/dist/commonjs/models/components/checkoutpublicconfirmed.js.map +1 -1
- package/dist/commonjs/models/components/checkoutupdate.d.ts +5 -0
- package/dist/commonjs/models/components/checkoutupdate.d.ts.map +1 -1
- package/dist/commonjs/models/components/checkoutupdate.js +4 -0
- package/dist/commonjs/models/components/checkoutupdate.js.map +1 -1
- package/dist/commonjs/models/components/customercustomersession.d.ts +31 -0
- package/dist/commonjs/models/components/customercustomersession.d.ts.map +1 -0
- package/dist/commonjs/models/components/customercustomersession.js +82 -0
- package/dist/commonjs/models/components/customercustomersession.js.map +1 -0
- package/dist/commonjs/models/components/customersession.d.ts +2 -0
- package/dist/commonjs/models/components/customersession.d.ts.map +1 -1
- package/dist/commonjs/models/components/customersession.js +4 -0
- package/dist/commonjs/models/components/customersession.js.map +1 -1
- package/dist/commonjs/models/components/customersessioncustomerexternalidcreate.d.ts +5 -0
- package/dist/commonjs/models/components/customersessioncustomerexternalidcreate.d.ts.map +1 -1
- package/dist/commonjs/models/components/customersessioncustomerexternalidcreate.js +4 -0
- package/dist/commonjs/models/components/customersessioncustomerexternalidcreate.js.map +1 -1
- package/dist/commonjs/models/components/customersessioncustomeridcreate.d.ts +5 -0
- package/dist/commonjs/models/components/customersessioncustomeridcreate.d.ts.map +1 -1
- package/dist/commonjs/models/components/customersessioncustomeridcreate.js +4 -0
- package/dist/commonjs/models/components/customersessioncustomeridcreate.js.map +1 -1
- package/dist/commonjs/models/components/productcreateonetime.d.ts +44 -4
- package/dist/commonjs/models/components/productcreateonetime.d.ts.map +1 -1
- package/dist/commonjs/models/components/productcreateonetime.js +60 -20
- package/dist/commonjs/models/components/productcreateonetime.js.map +1 -1
- package/dist/commonjs/models/components/productcreaterecurring.d.ts +44 -4
- package/dist/commonjs/models/components/productcreaterecurring.d.ts.map +1 -1
- package/dist/commonjs/models/components/productcreaterecurring.js +60 -20
- package/dist/commonjs/models/components/productcreaterecurring.js.map +1 -1
- package/dist/commonjs/models/components/productupdate.d.ts +85 -4
- package/dist/commonjs/models/components/productupdate.d.ts.map +1 -1
- package/dist/commonjs/models/components/productupdate.js +117 -21
- package/dist/commonjs/models/components/productupdate.js.map +1 -1
- package/dist/commonjs/models/components/webtokenrequest.d.ts +67 -0
- package/dist/commonjs/models/components/webtokenrequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/webtokenrequest.js +117 -0
- package/dist/commonjs/models/components/webtokenrequest.js.map +1 -0
- package/dist/commonjs/models/operations/customerportalcustomersessionintrospect.d.ts +29 -0
- package/dist/commonjs/models/operations/customerportalcustomersessionintrospect.d.ts.map +1 -0
- package/dist/commonjs/models/operations/customerportalcustomersessionintrospect.js +78 -0
- package/dist/commonjs/models/operations/customerportalcustomersessionintrospect.js.map +1 -0
- package/dist/commonjs/models/operations/oauth2requesttoken.d.ts +3 -2
- package/dist/commonjs/models/operations/oauth2requesttoken.d.ts.map +1 -1
- package/dist/commonjs/models/operations/oauth2requesttoken.js +3 -0
- package/dist/commonjs/models/operations/oauth2requesttoken.js.map +1 -1
- package/dist/commonjs/sdk/customerportal.d.ts +3 -0
- package/dist/commonjs/sdk/customerportal.d.ts.map +1 -1
- package/dist/commonjs/sdk/customerportal.js +4 -0
- package/dist/commonjs/sdk/customerportal.js.map +1 -1
- package/dist/commonjs/sdk/customersession.d.ts +15 -0
- package/dist/commonjs/sdk/customersession.d.ts.map +1 -0
- package/dist/commonjs/sdk/customersession.js +24 -0
- package/dist/commonjs/sdk/customersession.js.map +1 -0
- package/dist/esm/funcs/customerPortalCustomerSessionIntrospect.d.ts +20 -0
- package/dist/esm/funcs/customerPortalCustomerSessionIntrospect.d.ts.map +1 -0
- package/dist/esm/funcs/customerPortalCustomerSessionIntrospect.js +74 -0
- package/dist/esm/funcs/customerPortalCustomerSessionIntrospect.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/mcp-server/mcp-server.js +1 -1
- package/dist/esm/mcp-server/server.js +1 -1
- package/dist/esm/models/components/checkout.d.ts +5 -0
- package/dist/esm/models/components/checkout.d.ts.map +1 -1
- package/dist/esm/models/components/checkout.js +4 -0
- package/dist/esm/models/components/checkout.js.map +1 -1
- package/dist/esm/models/components/checkoutcreate.d.ts +5 -0
- package/dist/esm/models/components/checkoutcreate.d.ts.map +1 -1
- package/dist/esm/models/components/checkoutcreate.js +4 -0
- package/dist/esm/models/components/checkoutcreate.js.map +1 -1
- package/dist/esm/models/components/checkoutpublic.d.ts +5 -0
- package/dist/esm/models/components/checkoutpublic.d.ts.map +1 -1
- package/dist/esm/models/components/checkoutpublic.js +4 -0
- package/dist/esm/models/components/checkoutpublic.js.map +1 -1
- package/dist/esm/models/components/checkoutpublicconfirmed.d.ts +5 -0
- package/dist/esm/models/components/checkoutpublicconfirmed.d.ts.map +1 -1
- package/dist/esm/models/components/checkoutpublicconfirmed.js +4 -0
- package/dist/esm/models/components/checkoutpublicconfirmed.js.map +1 -1
- package/dist/esm/models/components/checkoutupdate.d.ts +5 -0
- package/dist/esm/models/components/checkoutupdate.d.ts.map +1 -1
- package/dist/esm/models/components/checkoutupdate.js +4 -0
- package/dist/esm/models/components/checkoutupdate.js.map +1 -1
- package/dist/esm/models/components/customercustomersession.d.ts +31 -0
- package/dist/esm/models/components/customercustomersession.d.ts.map +1 -0
- package/dist/esm/models/components/customercustomersession.js +44 -0
- package/dist/esm/models/components/customercustomersession.js.map +1 -0
- package/dist/esm/models/components/customersession.d.ts +2 -0
- package/dist/esm/models/components/customersession.d.ts.map +1 -1
- package/dist/esm/models/components/customersession.js +4 -0
- package/dist/esm/models/components/customersession.js.map +1 -1
- package/dist/esm/models/components/customersessioncustomerexternalidcreate.d.ts +5 -0
- package/dist/esm/models/components/customersessioncustomerexternalidcreate.d.ts.map +1 -1
- package/dist/esm/models/components/customersessioncustomerexternalidcreate.js +4 -0
- package/dist/esm/models/components/customersessioncustomerexternalidcreate.js.map +1 -1
- package/dist/esm/models/components/customersessioncustomeridcreate.d.ts +5 -0
- package/dist/esm/models/components/customersessioncustomeridcreate.d.ts.map +1 -1
- package/dist/esm/models/components/customersessioncustomeridcreate.js +4 -0
- package/dist/esm/models/components/customersessioncustomeridcreate.js.map +1 -1
- package/dist/esm/models/components/productcreateonetime.d.ts +44 -4
- package/dist/esm/models/components/productcreateonetime.d.ts.map +1 -1
- package/dist/esm/models/components/productcreateonetime.js +60 -20
- package/dist/esm/models/components/productcreateonetime.js.map +1 -1
- package/dist/esm/models/components/productcreaterecurring.d.ts +44 -4
- package/dist/esm/models/components/productcreaterecurring.d.ts.map +1 -1
- package/dist/esm/models/components/productcreaterecurring.js +60 -20
- package/dist/esm/models/components/productcreaterecurring.js.map +1 -1
- package/dist/esm/models/components/productupdate.d.ts +85 -4
- package/dist/esm/models/components/productupdate.d.ts.map +1 -1
- package/dist/esm/models/components/productupdate.js +114 -20
- package/dist/esm/models/components/productupdate.js.map +1 -1
- package/dist/esm/models/components/webtokenrequest.d.ts +67 -0
- package/dist/esm/models/components/webtokenrequest.d.ts.map +1 -0
- package/dist/esm/models/components/webtokenrequest.js +79 -0
- package/dist/esm/models/components/webtokenrequest.js.map +1 -0
- package/dist/esm/models/operations/customerportalcustomersessionintrospect.d.ts +29 -0
- package/dist/esm/models/operations/customerportalcustomersessionintrospect.d.ts.map +1 -0
- package/dist/esm/models/operations/customerportalcustomersessionintrospect.js +40 -0
- package/dist/esm/models/operations/customerportalcustomersessionintrospect.js.map +1 -0
- package/dist/esm/models/operations/oauth2requesttoken.d.ts +3 -2
- package/dist/esm/models/operations/oauth2requesttoken.d.ts.map +1 -1
- package/dist/esm/models/operations/oauth2requesttoken.js +3 -0
- package/dist/esm/models/operations/oauth2requesttoken.js.map +1 -1
- package/dist/esm/sdk/customerportal.d.ts +3 -0
- package/dist/esm/sdk/customerportal.d.ts.map +1 -1
- package/dist/esm/sdk/customerportal.js +4 -0
- package/dist/esm/sdk/customerportal.js.map +1 -1
- package/dist/esm/sdk/customersession.d.ts +15 -0
- package/dist/esm/sdk/customersession.d.ts.map +1 -0
- package/dist/esm/sdk/customersession.js +20 -0
- package/dist/esm/sdk/customersession.js.map +1 -0
- package/docs/sdks/customersession/README.md +79 -0
- package/examples/package-lock.json +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/customerPortalCustomerSessionIntrospect.ts +157 -0
- package/src/lib/config.ts +2 -2
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +1 -1
- package/src/models/components/checkout.ts +9 -0
- package/src/models/components/checkoutcreate.ts +9 -0
- package/src/models/components/checkoutpublic.ts +9 -0
- package/src/models/components/checkoutpublicconfirmed.ts +9 -0
- package/src/models/components/checkoutupdate.ts +9 -0
- package/src/models/components/customercustomersession.ts +81 -0
- package/src/models/components/customersession.ts +6 -0
- package/src/models/components/customersessioncustomerexternalidcreate.ts +9 -0
- package/src/models/components/customersessioncustomeridcreate.ts +9 -0
- package/src/models/components/productcreateonetime.ts +120 -40
- package/src/models/components/productcreaterecurring.ts +120 -40
- package/src/models/components/productupdate.ts +233 -40
- package/src/models/components/webtokenrequest.ts +133 -0
- package/src/models/operations/customerportalcustomersessionintrospect.ts +89 -0
- package/src/models/operations/oauth2requesttoken.ts +12 -2
- package/src/sdk/customerportal.ts +6 -0
- package/src/sdk/customersession.ts +30 -0
|
@@ -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
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
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
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
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
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
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
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
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(),
|
|
@@ -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
|
-
|
|
|
71
|
-
|
|
|
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
|
-
|
|
|
124
|
-
|
|
|
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
|
-
|
|
194
|
-
|
|
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
|
-
|
|
|
204
|
-
|
|
|
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
|
-
|
|
217
|
-
|
|
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
|
-
|
|
275
|
-
|
|
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
|
-
|
|
|
309
|
-
|
|
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
|
-
|
|
344
|
-
|
|
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
|
+
}
|