@polar-sh/sdk 0.19.0 → 0.19.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 (140) hide show
  1. package/README.md +9 -0
  2. package/docs/sdks/benefits/README.md +0 -1
  3. package/docs/sdks/customersessions/README.md +85 -0
  4. package/funcs/customerSessionsCreate.d.ts +16 -0
  5. package/funcs/customerSessionsCreate.d.ts.map +1 -0
  6. package/funcs/customerSessionsCreate.js +100 -0
  7. package/funcs/customerSessionsCreate.js.map +1 -0
  8. package/lib/config.d.ts +3 -3
  9. package/lib/config.js +3 -3
  10. package/models/components/benefitcreate.d.ts +4 -4
  11. package/models/components/benefitcreate.d.ts.map +1 -1
  12. package/models/components/benefitcreate.js +6 -6
  13. package/models/components/benefitcreate.js.map +1 -1
  14. package/models/components/benefitcustom.d.ts +1 -1
  15. package/models/components/benefitcustomcreate.d.ts +0 -5
  16. package/models/components/benefitcustomcreate.d.ts.map +1 -1
  17. package/models/components/benefitcustomcreate.js +0 -4
  18. package/models/components/benefitcustomcreate.js.map +1 -1
  19. package/models/components/benefitgithubrepositoryproperties.d.ts +5 -0
  20. package/models/components/benefitgithubrepositoryproperties.d.ts.map +1 -1
  21. package/models/components/benefitgithubrepositoryproperties.js +4 -0
  22. package/models/components/benefitgithubrepositoryproperties.js.map +1 -1
  23. package/models/components/checkout.d.ts +27 -0
  24. package/models/components/checkout.d.ts.map +1 -1
  25. package/models/components/checkout.js +28 -1
  26. package/models/components/checkout.js.map +1 -1
  27. package/models/components/checkoutlinkupdate.d.ts +0 -14
  28. package/models/components/checkoutlinkupdate.d.ts.map +1 -1
  29. package/models/components/checkoutlinkupdate.js.map +1 -1
  30. package/models/components/checkoutpricecreate.d.ts +41 -0
  31. package/models/components/checkoutpricecreate.d.ts.map +1 -1
  32. package/models/components/checkoutpricecreate.js +28 -1
  33. package/models/components/checkoutpricecreate.js.map +1 -1
  34. package/models/components/checkoutproductcreate.d.ts +41 -0
  35. package/models/components/checkoutproductcreate.d.ts.map +1 -1
  36. package/models/components/checkoutproductcreate.js +28 -1
  37. package/models/components/checkoutproductcreate.js.map +1 -1
  38. package/models/components/checkoutupdate.d.ts +38 -11
  39. package/models/components/checkoutupdate.d.ts.map +1 -1
  40. package/models/components/checkoutupdate.js +28 -1
  41. package/models/components/checkoutupdate.js.map +1 -1
  42. package/models/components/customer.d.ts +13 -13
  43. package/models/components/customer.d.ts.map +1 -1
  44. package/models/components/customer.js +16 -16
  45. package/models/components/customer.js.map +1 -1
  46. package/models/components/customersession.d.ts +57 -0
  47. package/models/components/customersession.d.ts.map +1 -0
  48. package/models/components/customersession.js +87 -0
  49. package/models/components/customersession.js.map +1 -0
  50. package/models/components/customersessioncreate.d.ts +35 -0
  51. package/models/components/customersessioncreate.d.ts.map +1 -0
  52. package/models/components/customersessioncreate.js +68 -0
  53. package/models/components/customersessioncreate.js.map +1 -0
  54. package/models/components/customfieldupdatecheckbox.d.ts +0 -14
  55. package/models/components/customfieldupdatecheckbox.d.ts.map +1 -1
  56. package/models/components/customfieldupdatecheckbox.js.map +1 -1
  57. package/models/components/customfieldupdatedate.d.ts +0 -14
  58. package/models/components/customfieldupdatedate.d.ts.map +1 -1
  59. package/models/components/customfieldupdatedate.js.map +1 -1
  60. package/models/components/customfieldupdatenumber.d.ts +0 -14
  61. package/models/components/customfieldupdatenumber.d.ts.map +1 -1
  62. package/models/components/customfieldupdatenumber.js.map +1 -1
  63. package/models/components/customfieldupdateselect.d.ts +0 -14
  64. package/models/components/customfieldupdateselect.d.ts.map +1 -1
  65. package/models/components/customfieldupdateselect.js.map +1 -1
  66. package/models/components/customfieldupdatetext.d.ts +0 -14
  67. package/models/components/customfieldupdatetext.d.ts.map +1 -1
  68. package/models/components/customfieldupdatetext.js.map +1 -1
  69. package/models/components/discountupdate.d.ts +0 -14
  70. package/models/components/discountupdate.d.ts.map +1 -1
  71. package/models/components/discountupdate.js.map +1 -1
  72. package/models/components/index.d.ts +2 -0
  73. package/models/components/index.d.ts.map +1 -1
  74. package/models/components/index.js +2 -0
  75. package/models/components/index.js.map +1 -1
  76. package/models/components/oauth2client.js +2 -2
  77. package/models/components/oauth2client.js.map +1 -1
  78. package/models/components/oauth2clientconfiguration.js +2 -2
  79. package/models/components/oauth2clientconfiguration.js.map +1 -1
  80. package/models/components/oauth2clientconfigurationupdate.js +2 -2
  81. package/models/components/oauth2clientconfigurationupdate.js.map +1 -1
  82. package/models/components/ordersubscription.d.ts +5 -0
  83. package/models/components/ordersubscription.d.ts.map +1 -1
  84. package/models/components/ordersubscription.js +4 -0
  85. package/models/components/ordersubscription.js.map +1 -1
  86. package/models/components/orderuser.d.ts +2 -0
  87. package/models/components/orderuser.d.ts.map +1 -1
  88. package/models/components/orderuser.js +4 -0
  89. package/models/components/orderuser.js.map +1 -1
  90. package/models/components/productupdate.d.ts +0 -14
  91. package/models/components/productupdate.d.ts.map +1 -1
  92. package/models/components/productupdate.js.map +1 -1
  93. package/models/components/scope.d.ts +3 -0
  94. package/models/components/scope.d.ts.map +1 -1
  95. package/models/components/scope.js +1 -0
  96. package/models/components/scope.js.map +1 -1
  97. package/models/components/subscriptionuser.d.ts +2 -0
  98. package/models/components/subscriptionuser.d.ts.map +1 -1
  99. package/models/components/subscriptionuser.js +4 -0
  100. package/models/components/subscriptionuser.js.map +1 -1
  101. package/package.json +1 -1
  102. package/sdk/customersessions.d.ts +12 -0
  103. package/sdk/customersessions.d.ts.map +1 -0
  104. package/sdk/customersessions.js +22 -0
  105. package/sdk/customersessions.js.map +1 -0
  106. package/sdk/sdk.d.ts +3 -0
  107. package/sdk/sdk.d.ts.map +1 -1
  108. package/sdk/sdk.js +5 -0
  109. package/sdk/sdk.js.map +1 -1
  110. package/src/funcs/customerSessionsCreate.ts +132 -0
  111. package/src/lib/config.ts +3 -3
  112. package/src/models/components/benefitcreate.ts +14 -14
  113. package/src/models/components/benefitcustom.ts +1 -1
  114. package/src/models/components/benefitcustomcreate.ts +0 -9
  115. package/src/models/components/benefitgithubrepositoryproperties.ts +9 -0
  116. package/src/models/components/checkout.ts +60 -0
  117. package/src/models/components/checkoutlinkupdate.ts +0 -14
  118. package/src/models/components/checkoutpricecreate.ts +82 -0
  119. package/src/models/components/checkoutproductcreate.ts +82 -0
  120. package/src/models/components/checkoutupdate.ts +79 -11
  121. package/src/models/components/customer.ts +21 -21
  122. package/src/models/components/customersession.ts +126 -0
  123. package/src/models/components/customersessioncreate.ts +81 -0
  124. package/src/models/components/customfieldupdatecheckbox.ts +0 -14
  125. package/src/models/components/customfieldupdatedate.ts +0 -14
  126. package/src/models/components/customfieldupdatenumber.ts +0 -14
  127. package/src/models/components/customfieldupdateselect.ts +0 -14
  128. package/src/models/components/customfieldupdatetext.ts +0 -14
  129. package/src/models/components/discountupdate.ts +0 -14
  130. package/src/models/components/index.ts +2 -0
  131. package/src/models/components/oauth2client.ts +2 -2
  132. package/src/models/components/oauth2clientconfiguration.ts +2 -2
  133. package/src/models/components/oauth2clientconfigurationupdate.ts +2 -2
  134. package/src/models/components/ordersubscription.ts +9 -0
  135. package/src/models/components/orderuser.ts +6 -0
  136. package/src/models/components/productupdate.ts +0 -14
  137. package/src/models/components/scope.ts +1 -0
  138. package/src/models/components/subscriptionuser.ts +6 -0
  139. package/src/sdk/customersessions.ts +27 -0
  140. package/src/sdk/sdk.ts +6 -0
@@ -35,6 +35,8 @@ export type CheckoutProductCreatePaymentProcessor = ClosedEnum<
35
35
  typeof CheckoutProductCreatePaymentProcessor
36
36
  >;
37
37
 
38
+ export type CheckoutProductCreateCustomerMetadata = string | number | boolean;
39
+
38
40
  /**
39
41
  * Create a new checkout session from a product.
40
42
  *
@@ -85,6 +87,21 @@ export type CheckoutProductCreate = {
85
87
  customerIpAddress?: string | null | undefined;
86
88
  customerBillingAddress?: Address | null | undefined;
87
89
  customerTaxId?: string | null | undefined;
90
+ /**
91
+ * Key-value object allowing you to store additional information that'll be copied to the created customer.
92
+ *
93
+ * @remarks
94
+ *
95
+ * The key must be a string with a maximum length of **40 characters**.
96
+ * The value must be either:
97
+ *
98
+ * * A string with a maximum length of **500 characters**
99
+ * * An integer
100
+ * * A boolean
101
+ *
102
+ * You can store up to **50 key-value pairs**.
103
+ */
104
+ customerMetadata?: { [k: string]: string | number | boolean } | undefined;
88
105
  /**
89
106
  * ID of a subscription to upgrade. It must be on a free pricing. If checkout is successful, metadata set on this checkout will be copied to the subscription, and existing keys will be overwritten.
90
107
  */
@@ -230,6 +247,62 @@ export namespace CheckoutProductCreatePaymentProcessor$ {
230
247
  CheckoutProductCreatePaymentProcessor$outboundSchema;
231
248
  }
232
249
 
250
+ /** @internal */
251
+ export const CheckoutProductCreateCustomerMetadata$inboundSchema: z.ZodType<
252
+ CheckoutProductCreateCustomerMetadata,
253
+ z.ZodTypeDef,
254
+ unknown
255
+ > = z.union([z.string(), z.number().int(), z.boolean()]);
256
+
257
+ /** @internal */
258
+ export type CheckoutProductCreateCustomerMetadata$Outbound =
259
+ | string
260
+ | number
261
+ | boolean;
262
+
263
+ /** @internal */
264
+ export const CheckoutProductCreateCustomerMetadata$outboundSchema: z.ZodType<
265
+ CheckoutProductCreateCustomerMetadata$Outbound,
266
+ z.ZodTypeDef,
267
+ CheckoutProductCreateCustomerMetadata
268
+ > = z.union([z.string(), z.number().int(), z.boolean()]);
269
+
270
+ /**
271
+ * @internal
272
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
273
+ */
274
+ export namespace CheckoutProductCreateCustomerMetadata$ {
275
+ /** @deprecated use `CheckoutProductCreateCustomerMetadata$inboundSchema` instead. */
276
+ export const inboundSchema =
277
+ CheckoutProductCreateCustomerMetadata$inboundSchema;
278
+ /** @deprecated use `CheckoutProductCreateCustomerMetadata$outboundSchema` instead. */
279
+ export const outboundSchema =
280
+ CheckoutProductCreateCustomerMetadata$outboundSchema;
281
+ /** @deprecated use `CheckoutProductCreateCustomerMetadata$Outbound` instead. */
282
+ export type Outbound = CheckoutProductCreateCustomerMetadata$Outbound;
283
+ }
284
+
285
+ export function checkoutProductCreateCustomerMetadataToJSON(
286
+ checkoutProductCreateCustomerMetadata: CheckoutProductCreateCustomerMetadata,
287
+ ): string {
288
+ return JSON.stringify(
289
+ CheckoutProductCreateCustomerMetadata$outboundSchema.parse(
290
+ checkoutProductCreateCustomerMetadata,
291
+ ),
292
+ );
293
+ }
294
+
295
+ export function checkoutProductCreateCustomerMetadataFromJSON(
296
+ jsonString: string,
297
+ ): SafeParseResult<CheckoutProductCreateCustomerMetadata, SDKValidationError> {
298
+ return safeParse(
299
+ jsonString,
300
+ (x) =>
301
+ CheckoutProductCreateCustomerMetadata$inboundSchema.parse(JSON.parse(x)),
302
+ `Failed to parse 'CheckoutProductCreateCustomerMetadata' from JSON`,
303
+ );
304
+ }
305
+
233
306
  /** @internal */
234
307
  export const CheckoutProductCreate$inboundSchema: z.ZodType<
235
308
  CheckoutProductCreate,
@@ -251,6 +324,9 @@ export const CheckoutProductCreate$inboundSchema: z.ZodType<
251
324
  customer_ip_address: z.nullable(z.string()).optional(),
252
325
  customer_billing_address: z.nullable(Address$inboundSchema).optional(),
253
326
  customer_tax_id: z.nullable(z.string()).optional(),
327
+ customer_metadata: z.record(
328
+ z.union([z.string(), z.number().int(), z.boolean()]),
329
+ ).optional(),
254
330
  subscription_id: z.nullable(z.string()).optional(),
255
331
  success_url: z.nullable(z.string()).optional(),
256
332
  embed_origin: z.nullable(z.string()).optional(),
@@ -267,6 +343,7 @@ export const CheckoutProductCreate$inboundSchema: z.ZodType<
267
343
  "customer_ip_address": "customerIpAddress",
268
344
  "customer_billing_address": "customerBillingAddress",
269
345
  "customer_tax_id": "customerTaxId",
346
+ "customer_metadata": "customerMetadata",
270
347
  "subscription_id": "subscriptionId",
271
348
  "success_url": "successUrl",
272
349
  "embed_origin": "embedOrigin",
@@ -288,6 +365,7 @@ export type CheckoutProductCreate$Outbound = {
288
365
  customer_ip_address?: string | null | undefined;
289
366
  customer_billing_address?: Address$Outbound | null | undefined;
290
367
  customer_tax_id?: string | null | undefined;
368
+ customer_metadata?: { [k: string]: string | number | boolean } | undefined;
291
369
  subscription_id?: string | null | undefined;
292
370
  success_url?: string | null | undefined;
293
371
  embed_origin?: string | null | undefined;
@@ -315,6 +393,9 @@ export const CheckoutProductCreate$outboundSchema: z.ZodType<
315
393
  customerIpAddress: z.nullable(z.string()).optional(),
316
394
  customerBillingAddress: z.nullable(Address$outboundSchema).optional(),
317
395
  customerTaxId: z.nullable(z.string()).optional(),
396
+ customerMetadata: z.record(
397
+ z.union([z.string(), z.number().int(), z.boolean()]),
398
+ ).optional(),
318
399
  subscriptionId: z.nullable(z.string()).optional(),
319
400
  successUrl: z.nullable(z.string()).optional(),
320
401
  embedOrigin: z.nullable(z.string()).optional(),
@@ -331,6 +412,7 @@ export const CheckoutProductCreate$outboundSchema: z.ZodType<
331
412
  customerIpAddress: "customer_ip_address",
332
413
  customerBillingAddress: "customer_billing_address",
333
414
  customerTaxId: "customer_tax_id",
415
+ customerMetadata: "customer_metadata",
334
416
  subscriptionId: "subscription_id",
335
417
  successUrl: "success_url",
336
418
  embedOrigin: "embed_origin",
@@ -18,6 +18,8 @@ export type CustomFieldData = {};
18
18
 
19
19
  export type CheckoutUpdateMetadata = string | number | boolean;
20
20
 
21
+ export type CheckoutUpdateCustomerMetadata = string | number | boolean;
22
+
21
23
  /**
22
24
  * Update an existing checkout session using an access token.
23
25
  */
@@ -35,8 +37,18 @@ export type CheckoutUpdate = {
35
37
  customerEmail?: string | null | undefined;
36
38
  customerBillingAddress?: Address | null | undefined;
37
39
  customerTaxId?: string | null | undefined;
40
+ metadata?: { [k: string]: string | number | boolean } | null | undefined;
41
+ /**
42
+ * ID of the discount to apply to the checkout.
43
+ */
44
+ discountId?: string | null | undefined;
45
+ /**
46
+ * Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it.
47
+ */
48
+ allowDiscountCodes?: boolean | null | undefined;
49
+ customerIpAddress?: string | null | undefined;
38
50
  /**
39
- * Key-value object allowing you to store additional information.
51
+ * Key-value object allowing you to store additional information that'll be copied to the created customer.
40
52
  *
41
53
  * @remarks
42
54
  *
@@ -49,16 +61,10 @@ export type CheckoutUpdate = {
49
61
  *
50
62
  * You can store up to **50 key-value pairs**.
51
63
  */
52
- metadata?: { [k: string]: string | number | boolean } | null | undefined;
53
- /**
54
- * ID of the discount to apply to the checkout.
55
- */
56
- discountId?: string | null | undefined;
57
- /**
58
- * Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it.
59
- */
60
- allowDiscountCodes?: boolean | null | undefined;
61
- customerIpAddress?: string | null | undefined;
64
+ customerMetadata?:
65
+ | { [k: string]: string | number | boolean }
66
+ | null
67
+ | undefined;
62
68
  /**
63
69
  * URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id.
64
70
  */
@@ -163,6 +169,56 @@ export function checkoutUpdateMetadataFromJSON(
163
169
  );
164
170
  }
165
171
 
172
+ /** @internal */
173
+ export const CheckoutUpdateCustomerMetadata$inboundSchema: z.ZodType<
174
+ CheckoutUpdateCustomerMetadata,
175
+ z.ZodTypeDef,
176
+ unknown
177
+ > = z.union([z.string(), z.number().int(), z.boolean()]);
178
+
179
+ /** @internal */
180
+ export type CheckoutUpdateCustomerMetadata$Outbound = string | number | boolean;
181
+
182
+ /** @internal */
183
+ export const CheckoutUpdateCustomerMetadata$outboundSchema: z.ZodType<
184
+ CheckoutUpdateCustomerMetadata$Outbound,
185
+ z.ZodTypeDef,
186
+ CheckoutUpdateCustomerMetadata
187
+ > = z.union([z.string(), z.number().int(), z.boolean()]);
188
+
189
+ /**
190
+ * @internal
191
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
192
+ */
193
+ export namespace CheckoutUpdateCustomerMetadata$ {
194
+ /** @deprecated use `CheckoutUpdateCustomerMetadata$inboundSchema` instead. */
195
+ export const inboundSchema = CheckoutUpdateCustomerMetadata$inboundSchema;
196
+ /** @deprecated use `CheckoutUpdateCustomerMetadata$outboundSchema` instead. */
197
+ export const outboundSchema = CheckoutUpdateCustomerMetadata$outboundSchema;
198
+ /** @deprecated use `CheckoutUpdateCustomerMetadata$Outbound` instead. */
199
+ export type Outbound = CheckoutUpdateCustomerMetadata$Outbound;
200
+ }
201
+
202
+ export function checkoutUpdateCustomerMetadataToJSON(
203
+ checkoutUpdateCustomerMetadata: CheckoutUpdateCustomerMetadata,
204
+ ): string {
205
+ return JSON.stringify(
206
+ CheckoutUpdateCustomerMetadata$outboundSchema.parse(
207
+ checkoutUpdateCustomerMetadata,
208
+ ),
209
+ );
210
+ }
211
+
212
+ export function checkoutUpdateCustomerMetadataFromJSON(
213
+ jsonString: string,
214
+ ): SafeParseResult<CheckoutUpdateCustomerMetadata, SDKValidationError> {
215
+ return safeParse(
216
+ jsonString,
217
+ (x) => CheckoutUpdateCustomerMetadata$inboundSchema.parse(JSON.parse(x)),
218
+ `Failed to parse 'CheckoutUpdateCustomerMetadata' from JSON`,
219
+ );
220
+ }
221
+
166
222
  /** @internal */
167
223
  export const CheckoutUpdate$inboundSchema: z.ZodType<
168
224
  CheckoutUpdate,
@@ -183,6 +239,9 @@ export const CheckoutUpdate$inboundSchema: z.ZodType<
183
239
  discount_id: z.nullable(z.string()).optional(),
184
240
  allow_discount_codes: z.nullable(z.boolean()).optional(),
185
241
  customer_ip_address: z.nullable(z.string()).optional(),
242
+ customer_metadata: z.nullable(
243
+ z.record(z.union([z.string(), z.number().int(), z.boolean()])),
244
+ ).optional(),
186
245
  success_url: z.nullable(z.string()).optional(),
187
246
  embed_origin: z.nullable(z.string()).optional(),
188
247
  }).transform((v) => {
@@ -196,6 +255,7 @@ export const CheckoutUpdate$inboundSchema: z.ZodType<
196
255
  "discount_id": "discountId",
197
256
  "allow_discount_codes": "allowDiscountCodes",
198
257
  "customer_ip_address": "customerIpAddress",
258
+ "customer_metadata": "customerMetadata",
199
259
  "success_url": "successUrl",
200
260
  "embed_origin": "embedOrigin",
201
261
  });
@@ -214,6 +274,10 @@ export type CheckoutUpdate$Outbound = {
214
274
  discount_id?: string | null | undefined;
215
275
  allow_discount_codes?: boolean | null | undefined;
216
276
  customer_ip_address?: string | null | undefined;
277
+ customer_metadata?:
278
+ | { [k: string]: string | number | boolean }
279
+ | null
280
+ | undefined;
217
281
  success_url?: string | null | undefined;
218
282
  embed_origin?: string | null | undefined;
219
283
  };
@@ -238,6 +302,9 @@ export const CheckoutUpdate$outboundSchema: z.ZodType<
238
302
  discountId: z.nullable(z.string()).optional(),
239
303
  allowDiscountCodes: z.nullable(z.boolean()).optional(),
240
304
  customerIpAddress: z.nullable(z.string()).optional(),
305
+ customerMetadata: z.nullable(
306
+ z.record(z.union([z.string(), z.number().int(), z.boolean()])),
307
+ ).optional(),
241
308
  successUrl: z.nullable(z.string()).optional(),
242
309
  embedOrigin: z.nullable(z.string()).optional(),
243
310
  }).transform((v) => {
@@ -251,6 +318,7 @@ export const CheckoutUpdate$outboundSchema: z.ZodType<
251
318
  discountId: "discount_id",
252
319
  allowDiscountCodes: "allow_discount_codes",
253
320
  customerIpAddress: "customer_ip_address",
321
+ customerMetadata: "customer_metadata",
254
322
  successUrl: "success_url",
255
323
  embedOrigin: "embed_origin",
256
324
  });
@@ -19,7 +19,7 @@ import {
19
19
  TaxIDFormat$outboundSchema,
20
20
  } from "./taxidformat.js";
21
21
 
22
- export type CustomerMetadata = string | number | boolean;
22
+ export type CustomerMetadata1 = string | number | boolean;
23
23
 
24
24
  export type CustomerTaxId = string | TaxIDFormat;
25
25
 
@@ -50,50 +50,50 @@ export type Customer = {
50
50
  };
51
51
 
52
52
  /** @internal */
53
- export const CustomerMetadata$inboundSchema: z.ZodType<
54
- CustomerMetadata,
53
+ export const CustomerMetadata1$inboundSchema: z.ZodType<
54
+ CustomerMetadata1,
55
55
  z.ZodTypeDef,
56
56
  unknown
57
57
  > = z.union([z.string(), z.number().int(), z.boolean()]);
58
58
 
59
59
  /** @internal */
60
- export type CustomerMetadata$Outbound = string | number | boolean;
60
+ export type CustomerMetadata1$Outbound = string | number | boolean;
61
61
 
62
62
  /** @internal */
63
- export const CustomerMetadata$outboundSchema: z.ZodType<
64
- CustomerMetadata$Outbound,
63
+ export const CustomerMetadata1$outboundSchema: z.ZodType<
64
+ CustomerMetadata1$Outbound,
65
65
  z.ZodTypeDef,
66
- CustomerMetadata
66
+ CustomerMetadata1
67
67
  > = z.union([z.string(), z.number().int(), z.boolean()]);
68
68
 
69
69
  /**
70
70
  * @internal
71
71
  * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
72
72
  */
73
- export namespace CustomerMetadata$ {
74
- /** @deprecated use `CustomerMetadata$inboundSchema` instead. */
75
- export const inboundSchema = CustomerMetadata$inboundSchema;
76
- /** @deprecated use `CustomerMetadata$outboundSchema` instead. */
77
- export const outboundSchema = CustomerMetadata$outboundSchema;
78
- /** @deprecated use `CustomerMetadata$Outbound` instead. */
79
- export type Outbound = CustomerMetadata$Outbound;
73
+ export namespace CustomerMetadata1$ {
74
+ /** @deprecated use `CustomerMetadata1$inboundSchema` instead. */
75
+ export const inboundSchema = CustomerMetadata1$inboundSchema;
76
+ /** @deprecated use `CustomerMetadata1$outboundSchema` instead. */
77
+ export const outboundSchema = CustomerMetadata1$outboundSchema;
78
+ /** @deprecated use `CustomerMetadata1$Outbound` instead. */
79
+ export type Outbound = CustomerMetadata1$Outbound;
80
80
  }
81
81
 
82
- export function customerMetadataToJSON(
83
- customerMetadata: CustomerMetadata,
82
+ export function customerMetadata1ToJSON(
83
+ customerMetadata1: CustomerMetadata1,
84
84
  ): string {
85
85
  return JSON.stringify(
86
- CustomerMetadata$outboundSchema.parse(customerMetadata),
86
+ CustomerMetadata1$outboundSchema.parse(customerMetadata1),
87
87
  );
88
88
  }
89
89
 
90
- export function customerMetadataFromJSON(
90
+ export function customerMetadata1FromJSON(
91
91
  jsonString: string,
92
- ): SafeParseResult<CustomerMetadata, SDKValidationError> {
92
+ ): SafeParseResult<CustomerMetadata1, SDKValidationError> {
93
93
  return safeParse(
94
94
  jsonString,
95
- (x) => CustomerMetadata$inboundSchema.parse(JSON.parse(x)),
96
- `Failed to parse 'CustomerMetadata' from JSON`,
95
+ (x) => CustomerMetadata1$inboundSchema.parse(JSON.parse(x)),
96
+ `Failed to parse 'CustomerMetadata1' from JSON`,
97
97
  );
98
98
  }
99
99
 
@@ -0,0 +1,126 @@
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
+ import {
11
+ Customer,
12
+ Customer$inboundSchema,
13
+ Customer$Outbound,
14
+ Customer$outboundSchema,
15
+ } from "./customer.js";
16
+
17
+ /**
18
+ * A customer session that can be used to authenticate as a customer.
19
+ */
20
+ export type CustomerSession = {
21
+ /**
22
+ * Creation timestamp of the object.
23
+ */
24
+ createdAt: Date;
25
+ /**
26
+ * Last modification timestamp of the object.
27
+ */
28
+ modifiedAt: Date | null;
29
+ /**
30
+ * The ID of the object.
31
+ */
32
+ id: string;
33
+ token: string;
34
+ expiresAt: Date;
35
+ customerId: string;
36
+ /**
37
+ * A customer in an organization.
38
+ */
39
+ customer: Customer;
40
+ };
41
+
42
+ /** @internal */
43
+ export const CustomerSession$inboundSchema: z.ZodType<
44
+ CustomerSession,
45
+ z.ZodTypeDef,
46
+ unknown
47
+ > = z.object({
48
+ created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
49
+ modified_at: z.nullable(
50
+ z.string().datetime({ offset: true }).transform(v => new Date(v)),
51
+ ),
52
+ id: z.string(),
53
+ token: z.string(),
54
+ expires_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
55
+ customer_id: z.string(),
56
+ customer: Customer$inboundSchema,
57
+ }).transform((v) => {
58
+ return remap$(v, {
59
+ "created_at": "createdAt",
60
+ "modified_at": "modifiedAt",
61
+ "expires_at": "expiresAt",
62
+ "customer_id": "customerId",
63
+ });
64
+ });
65
+
66
+ /** @internal */
67
+ export type CustomerSession$Outbound = {
68
+ created_at: string;
69
+ modified_at: string | null;
70
+ id: string;
71
+ token: string;
72
+ expires_at: string;
73
+ customer_id: string;
74
+ customer: Customer$Outbound;
75
+ };
76
+
77
+ /** @internal */
78
+ export const CustomerSession$outboundSchema: z.ZodType<
79
+ CustomerSession$Outbound,
80
+ z.ZodTypeDef,
81
+ CustomerSession
82
+ > = z.object({
83
+ createdAt: z.date().transform(v => v.toISOString()),
84
+ modifiedAt: z.nullable(z.date().transform(v => v.toISOString())),
85
+ id: z.string(),
86
+ token: z.string(),
87
+ expiresAt: z.date().transform(v => v.toISOString()),
88
+ customerId: z.string(),
89
+ customer: Customer$outboundSchema,
90
+ }).transform((v) => {
91
+ return remap$(v, {
92
+ createdAt: "created_at",
93
+ modifiedAt: "modified_at",
94
+ expiresAt: "expires_at",
95
+ customerId: "customer_id",
96
+ });
97
+ });
98
+
99
+ /**
100
+ * @internal
101
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
102
+ */
103
+ export namespace CustomerSession$ {
104
+ /** @deprecated use `CustomerSession$inboundSchema` instead. */
105
+ export const inboundSchema = CustomerSession$inboundSchema;
106
+ /** @deprecated use `CustomerSession$outboundSchema` instead. */
107
+ export const outboundSchema = CustomerSession$outboundSchema;
108
+ /** @deprecated use `CustomerSession$Outbound` instead. */
109
+ export type Outbound = CustomerSession$Outbound;
110
+ }
111
+
112
+ export function customerSessionToJSON(
113
+ customerSession: CustomerSession,
114
+ ): string {
115
+ return JSON.stringify(CustomerSession$outboundSchema.parse(customerSession));
116
+ }
117
+
118
+ export function customerSessionFromJSON(
119
+ jsonString: string,
120
+ ): SafeParseResult<CustomerSession, SDKValidationError> {
121
+ return safeParse(
122
+ jsonString,
123
+ (x) => CustomerSession$inboundSchema.parse(JSON.parse(x)),
124
+ `Failed to parse 'CustomerSession' from JSON`,
125
+ );
126
+ }
@@ -0,0 +1,81 @@
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
+ /**
12
+ * Schema for creating a customer session.
13
+ */
14
+ export type CustomerSessionCreate = {
15
+ /**
16
+ * ID of the customer to create a session for.
17
+ */
18
+ customerId: string;
19
+ };
20
+
21
+ /** @internal */
22
+ export const CustomerSessionCreate$inboundSchema: z.ZodType<
23
+ CustomerSessionCreate,
24
+ z.ZodTypeDef,
25
+ unknown
26
+ > = z.object({
27
+ customer_id: z.string(),
28
+ }).transform((v) => {
29
+ return remap$(v, {
30
+ "customer_id": "customerId",
31
+ });
32
+ });
33
+
34
+ /** @internal */
35
+ export type CustomerSessionCreate$Outbound = {
36
+ customer_id: string;
37
+ };
38
+
39
+ /** @internal */
40
+ export const CustomerSessionCreate$outboundSchema: z.ZodType<
41
+ CustomerSessionCreate$Outbound,
42
+ z.ZodTypeDef,
43
+ CustomerSessionCreate
44
+ > = z.object({
45
+ customerId: z.string(),
46
+ }).transform((v) => {
47
+ return remap$(v, {
48
+ customerId: "customer_id",
49
+ });
50
+ });
51
+
52
+ /**
53
+ * @internal
54
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
55
+ */
56
+ export namespace CustomerSessionCreate$ {
57
+ /** @deprecated use `CustomerSessionCreate$inboundSchema` instead. */
58
+ export const inboundSchema = CustomerSessionCreate$inboundSchema;
59
+ /** @deprecated use `CustomerSessionCreate$outboundSchema` instead. */
60
+ export const outboundSchema = CustomerSessionCreate$outboundSchema;
61
+ /** @deprecated use `CustomerSessionCreate$Outbound` instead. */
62
+ export type Outbound = CustomerSessionCreate$Outbound;
63
+ }
64
+
65
+ export function customerSessionCreateToJSON(
66
+ customerSessionCreate: CustomerSessionCreate,
67
+ ): string {
68
+ return JSON.stringify(
69
+ CustomerSessionCreate$outboundSchema.parse(customerSessionCreate),
70
+ );
71
+ }
72
+
73
+ export function customerSessionCreateFromJSON(
74
+ jsonString: string,
75
+ ): SafeParseResult<CustomerSessionCreate, SDKValidationError> {
76
+ return safeParse(
77
+ jsonString,
78
+ (x) => CustomerSessionCreate$inboundSchema.parse(JSON.parse(x)),
79
+ `Failed to parse 'CustomerSessionCreate' from JSON`,
80
+ );
81
+ }
@@ -27,20 +27,6 @@ export type CustomFieldUpdateCheckboxType = ClosedEnum<
27
27
  * Schema to update a custom field of type checkbox.
28
28
  */
29
29
  export type CustomFieldUpdateCheckbox = {
30
- /**
31
- * Key-value object allowing you to store additional information.
32
- *
33
- * @remarks
34
- *
35
- * The key must be a string with a maximum length of **40 characters**.
36
- * The value must be either:
37
- *
38
- * * A string with a maximum length of **500 characters**
39
- * * An integer
40
- * * A boolean
41
- *
42
- * You can store up to **50 key-value pairs**.
43
- */
44
30
  metadata?: { [k: string]: string | number | boolean } | null | undefined;
45
31
  name?: string | null | undefined;
46
32
  slug?: string | null | undefined;
@@ -27,20 +27,6 @@ export type CustomFieldUpdateDateType = ClosedEnum<
27
27
  * Schema to update a custom field of type date.
28
28
  */
29
29
  export type CustomFieldUpdateDate = {
30
- /**
31
- * Key-value object allowing you to store additional information.
32
- *
33
- * @remarks
34
- *
35
- * The key must be a string with a maximum length of **40 characters**.
36
- * The value must be either:
37
- *
38
- * * A string with a maximum length of **500 characters**
39
- * * An integer
40
- * * A boolean
41
- *
42
- * You can store up to **50 key-value pairs**.
43
- */
44
30
  metadata?: { [k: string]: string | number | boolean } | null | undefined;
45
31
  name?: string | null | undefined;
46
32
  slug?: string | null | undefined;
@@ -27,20 +27,6 @@ export type CustomFieldUpdateNumberType = ClosedEnum<
27
27
  * Schema to update a custom field of type number.
28
28
  */
29
29
  export type CustomFieldUpdateNumber = {
30
- /**
31
- * Key-value object allowing you to store additional information.
32
- *
33
- * @remarks
34
- *
35
- * The key must be a string with a maximum length of **40 characters**.
36
- * The value must be either:
37
- *
38
- * * A string with a maximum length of **500 characters**
39
- * * An integer
40
- * * A boolean
41
- *
42
- * You can store up to **50 key-value pairs**.
43
- */
44
30
  metadata?: { [k: string]: string | number | boolean } | null | undefined;
45
31
  name?: string | null | undefined;
46
32
  slug?: string | null | undefined;
@@ -27,20 +27,6 @@ export type CustomFieldUpdateSelectType = ClosedEnum<
27
27
  * Schema to update a custom field of type select.
28
28
  */
29
29
  export type CustomFieldUpdateSelect = {
30
- /**
31
- * Key-value object allowing you to store additional information.
32
- *
33
- * @remarks
34
- *
35
- * The key must be a string with a maximum length of **40 characters**.
36
- * The value must be either:
37
- *
38
- * * A string with a maximum length of **500 characters**
39
- * * An integer
40
- * * A boolean
41
- *
42
- * You can store up to **50 key-value pairs**.
43
- */
44
30
  metadata?: { [k: string]: string | number | boolean } | null | undefined;
45
31
  name?: string | null | undefined;
46
32
  slug?: string | null | undefined;
@@ -27,20 +27,6 @@ export type CustomFieldUpdateTextType = ClosedEnum<
27
27
  * Schema to update a custom field of type text.
28
28
  */
29
29
  export type CustomFieldUpdateText = {
30
- /**
31
- * Key-value object allowing you to store additional information.
32
- *
33
- * @remarks
34
- *
35
- * The key must be a string with a maximum length of **40 characters**.
36
- * The value must be either:
37
- *
38
- * * A string with a maximum length of **500 characters**
39
- * * An integer
40
- * * A boolean
41
- *
42
- * You can store up to **50 key-value pairs**.
43
- */
44
30
  metadata?: { [k: string]: string | number | boolean } | null | undefined;
45
31
  name?: string | null | undefined;
46
32
  slug?: string | null | undefined;