@polar-sh/sdk 0.32.0 → 0.32.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 (178) hide show
  1. package/README.md +41 -34
  2. package/bin/mcp-server.js +107 -12
  3. package/bin/mcp-server.js.map +11 -9
  4. package/dist/commonjs/lib/config.d.ts +3 -3
  5. package/dist/commonjs/lib/config.js +3 -3
  6. package/dist/commonjs/mcp-server/mcp-server.js +1 -1
  7. package/dist/commonjs/mcp-server/server.js +1 -1
  8. package/dist/commonjs/models/components/checkout.d.ts +19 -9
  9. package/dist/commonjs/models/components/checkout.d.ts.map +1 -1
  10. package/dist/commonjs/models/components/checkout.js +14 -6
  11. package/dist/commonjs/models/components/checkout.js.map +1 -1
  12. package/dist/commonjs/models/components/checkoutlinkupdate.d.ts +16 -2
  13. package/dist/commonjs/models/components/checkoutlinkupdate.d.ts.map +1 -1
  14. package/dist/commonjs/models/components/checkoutlinkupdate.js +4 -2
  15. package/dist/commonjs/models/components/checkoutlinkupdate.js.map +1 -1
  16. package/dist/commonjs/models/components/checkoutpublic.d.ts +19 -9
  17. package/dist/commonjs/models/components/checkoutpublic.d.ts.map +1 -1
  18. package/dist/commonjs/models/components/checkoutpublic.js +14 -6
  19. package/dist/commonjs/models/components/checkoutpublic.js.map +1 -1
  20. package/dist/commonjs/models/components/checkoutpublicconfirmed.d.ts +19 -9
  21. package/dist/commonjs/models/components/checkoutpublicconfirmed.d.ts.map +1 -1
  22. package/dist/commonjs/models/components/checkoutpublicconfirmed.js +14 -6
  23. package/dist/commonjs/models/components/checkoutpublicconfirmed.js.map +1 -1
  24. package/dist/commonjs/models/components/checkoutupdate.d.ts +18 -4
  25. package/dist/commonjs/models/components/checkoutupdate.d.ts.map +1 -1
  26. package/dist/commonjs/models/components/checkoutupdate.js +8 -6
  27. package/dist/commonjs/models/components/checkoutupdate.js.map +1 -1
  28. package/dist/commonjs/models/components/checkoutupdatepublic.d.ts +2 -2
  29. package/dist/commonjs/models/components/checkoutupdatepublic.d.ts.map +1 -1
  30. package/dist/commonjs/models/components/checkoutupdatepublic.js +4 -4
  31. package/dist/commonjs/models/components/checkoutupdatepublic.js.map +1 -1
  32. package/dist/commonjs/models/components/customerupdate.d.ts +16 -2
  33. package/dist/commonjs/models/components/customerupdate.d.ts.map +1 -1
  34. package/dist/commonjs/models/components/customerupdate.js +4 -2
  35. package/dist/commonjs/models/components/customerupdate.js.map +1 -1
  36. package/dist/commonjs/models/components/customfieldupdatecheckbox.d.ts +16 -2
  37. package/dist/commonjs/models/components/customfieldupdatecheckbox.d.ts.map +1 -1
  38. package/dist/commonjs/models/components/customfieldupdatecheckbox.js +4 -2
  39. package/dist/commonjs/models/components/customfieldupdatecheckbox.js.map +1 -1
  40. package/dist/commonjs/models/components/customfieldupdatedate.d.ts +16 -2
  41. package/dist/commonjs/models/components/customfieldupdatedate.d.ts.map +1 -1
  42. package/dist/commonjs/models/components/customfieldupdatedate.js +4 -2
  43. package/dist/commonjs/models/components/customfieldupdatedate.js.map +1 -1
  44. package/dist/commonjs/models/components/customfieldupdatenumber.d.ts +16 -2
  45. package/dist/commonjs/models/components/customfieldupdatenumber.d.ts.map +1 -1
  46. package/dist/commonjs/models/components/customfieldupdatenumber.js +4 -2
  47. package/dist/commonjs/models/components/customfieldupdatenumber.js.map +1 -1
  48. package/dist/commonjs/models/components/customfieldupdateselect.d.ts +16 -2
  49. package/dist/commonjs/models/components/customfieldupdateselect.d.ts.map +1 -1
  50. package/dist/commonjs/models/components/customfieldupdateselect.js +4 -2
  51. package/dist/commonjs/models/components/customfieldupdateselect.js.map +1 -1
  52. package/dist/commonjs/models/components/customfieldupdatetext.d.ts +16 -2
  53. package/dist/commonjs/models/components/customfieldupdatetext.d.ts.map +1 -1
  54. package/dist/commonjs/models/components/customfieldupdatetext.js +4 -2
  55. package/dist/commonjs/models/components/customfieldupdatetext.js.map +1 -1
  56. package/dist/commonjs/models/components/discountupdate.d.ts +16 -2
  57. package/dist/commonjs/models/components/discountupdate.d.ts.map +1 -1
  58. package/dist/commonjs/models/components/discountupdate.js +4 -2
  59. package/dist/commonjs/models/components/discountupdate.js.map +1 -1
  60. package/dist/commonjs/models/components/meterupdate.d.ts +16 -2
  61. package/dist/commonjs/models/components/meterupdate.d.ts.map +1 -1
  62. package/dist/commonjs/models/components/meterupdate.js +4 -2
  63. package/dist/commonjs/models/components/meterupdate.js.map +1 -1
  64. package/dist/commonjs/models/components/productprice.d.ts +3 -2
  65. package/dist/commonjs/models/components/productprice.d.ts.map +1 -1
  66. package/dist/commonjs/models/components/productprice.js +3 -0
  67. package/dist/commonjs/models/components/productprice.js.map +1 -1
  68. package/dist/commonjs/models/components/productpricemeter.d.ts +40 -0
  69. package/dist/commonjs/models/components/productpricemeter.d.ts.map +1 -0
  70. package/dist/commonjs/models/components/productpricemeter.js +61 -0
  71. package/dist/commonjs/models/components/productpricemeter.js.map +1 -0
  72. package/dist/commonjs/models/components/productpricemeteredunit.d.ts +97 -0
  73. package/dist/commonjs/models/components/productpricemeteredunit.d.ts.map +1 -0
  74. package/dist/commonjs/models/components/productpricemeteredunit.js +117 -0
  75. package/dist/commonjs/models/components/productpricemeteredunit.js.map +1 -0
  76. package/dist/commonjs/models/components/productupdate.d.ts +16 -2
  77. package/dist/commonjs/models/components/productupdate.d.ts.map +1 -1
  78. package/dist/commonjs/models/components/productupdate.js +4 -2
  79. package/dist/commonjs/models/components/productupdate.js.map +1 -1
  80. package/dist/esm/lib/config.d.ts +3 -3
  81. package/dist/esm/lib/config.js +3 -3
  82. package/dist/esm/mcp-server/mcp-server.js +1 -1
  83. package/dist/esm/mcp-server/server.js +1 -1
  84. package/dist/esm/models/components/checkout.d.ts +19 -9
  85. package/dist/esm/models/components/checkout.d.ts.map +1 -1
  86. package/dist/esm/models/components/checkout.js +14 -6
  87. package/dist/esm/models/components/checkout.js.map +1 -1
  88. package/dist/esm/models/components/checkoutlinkupdate.d.ts +16 -2
  89. package/dist/esm/models/components/checkoutlinkupdate.d.ts.map +1 -1
  90. package/dist/esm/models/components/checkoutlinkupdate.js +4 -2
  91. package/dist/esm/models/components/checkoutlinkupdate.js.map +1 -1
  92. package/dist/esm/models/components/checkoutpublic.d.ts +19 -9
  93. package/dist/esm/models/components/checkoutpublic.d.ts.map +1 -1
  94. package/dist/esm/models/components/checkoutpublic.js +14 -6
  95. package/dist/esm/models/components/checkoutpublic.js.map +1 -1
  96. package/dist/esm/models/components/checkoutpublicconfirmed.d.ts +19 -9
  97. package/dist/esm/models/components/checkoutpublicconfirmed.d.ts.map +1 -1
  98. package/dist/esm/models/components/checkoutpublicconfirmed.js +14 -6
  99. package/dist/esm/models/components/checkoutpublicconfirmed.js.map +1 -1
  100. package/dist/esm/models/components/checkoutupdate.d.ts +18 -4
  101. package/dist/esm/models/components/checkoutupdate.d.ts.map +1 -1
  102. package/dist/esm/models/components/checkoutupdate.js +8 -6
  103. package/dist/esm/models/components/checkoutupdate.js.map +1 -1
  104. package/dist/esm/models/components/checkoutupdatepublic.d.ts +2 -2
  105. package/dist/esm/models/components/checkoutupdatepublic.d.ts.map +1 -1
  106. package/dist/esm/models/components/checkoutupdatepublic.js +4 -4
  107. package/dist/esm/models/components/checkoutupdatepublic.js.map +1 -1
  108. package/dist/esm/models/components/customerupdate.d.ts +16 -2
  109. package/dist/esm/models/components/customerupdate.d.ts.map +1 -1
  110. package/dist/esm/models/components/customerupdate.js +4 -2
  111. package/dist/esm/models/components/customerupdate.js.map +1 -1
  112. package/dist/esm/models/components/customfieldupdatecheckbox.d.ts +16 -2
  113. package/dist/esm/models/components/customfieldupdatecheckbox.d.ts.map +1 -1
  114. package/dist/esm/models/components/customfieldupdatecheckbox.js +4 -2
  115. package/dist/esm/models/components/customfieldupdatecheckbox.js.map +1 -1
  116. package/dist/esm/models/components/customfieldupdatedate.d.ts +16 -2
  117. package/dist/esm/models/components/customfieldupdatedate.d.ts.map +1 -1
  118. package/dist/esm/models/components/customfieldupdatedate.js +4 -2
  119. package/dist/esm/models/components/customfieldupdatedate.js.map +1 -1
  120. package/dist/esm/models/components/customfieldupdatenumber.d.ts +16 -2
  121. package/dist/esm/models/components/customfieldupdatenumber.d.ts.map +1 -1
  122. package/dist/esm/models/components/customfieldupdatenumber.js +4 -2
  123. package/dist/esm/models/components/customfieldupdatenumber.js.map +1 -1
  124. package/dist/esm/models/components/customfieldupdateselect.d.ts +16 -2
  125. package/dist/esm/models/components/customfieldupdateselect.d.ts.map +1 -1
  126. package/dist/esm/models/components/customfieldupdateselect.js +4 -2
  127. package/dist/esm/models/components/customfieldupdateselect.js.map +1 -1
  128. package/dist/esm/models/components/customfieldupdatetext.d.ts +16 -2
  129. package/dist/esm/models/components/customfieldupdatetext.d.ts.map +1 -1
  130. package/dist/esm/models/components/customfieldupdatetext.js +4 -2
  131. package/dist/esm/models/components/customfieldupdatetext.js.map +1 -1
  132. package/dist/esm/models/components/discountupdate.d.ts +16 -2
  133. package/dist/esm/models/components/discountupdate.d.ts.map +1 -1
  134. package/dist/esm/models/components/discountupdate.js +4 -2
  135. package/dist/esm/models/components/discountupdate.js.map +1 -1
  136. package/dist/esm/models/components/meterupdate.d.ts +16 -2
  137. package/dist/esm/models/components/meterupdate.d.ts.map +1 -1
  138. package/dist/esm/models/components/meterupdate.js +4 -2
  139. package/dist/esm/models/components/meterupdate.js.map +1 -1
  140. package/dist/esm/models/components/productprice.d.ts +3 -2
  141. package/dist/esm/models/components/productprice.d.ts.map +1 -1
  142. package/dist/esm/models/components/productprice.js +3 -0
  143. package/dist/esm/models/components/productprice.js.map +1 -1
  144. package/dist/esm/models/components/productpricemeter.d.ts +40 -0
  145. package/dist/esm/models/components/productpricemeter.d.ts.map +1 -0
  146. package/dist/esm/models/components/productpricemeter.js +33 -0
  147. package/dist/esm/models/components/productpricemeter.js.map +1 -0
  148. package/dist/esm/models/components/productpricemeteredunit.d.ts +97 -0
  149. package/dist/esm/models/components/productpricemeteredunit.d.ts.map +1 -0
  150. package/dist/esm/models/components/productpricemeteredunit.js +89 -0
  151. package/dist/esm/models/components/productpricemeteredunit.js.map +1 -0
  152. package/dist/esm/models/components/productupdate.d.ts +16 -2
  153. package/dist/esm/models/components/productupdate.d.ts.map +1 -1
  154. package/dist/esm/models/components/productupdate.js +4 -2
  155. package/dist/esm/models/components/productupdate.js.map +1 -1
  156. package/jsr.json +1 -1
  157. package/package.json +1 -1
  158. package/src/lib/config.ts +3 -3
  159. package/src/mcp-server/mcp-server.ts +1 -1
  160. package/src/mcp-server/server.ts +1 -1
  161. package/src/models/components/checkout.ts +33 -15
  162. package/src/models/components/checkoutlinkupdate.ts +20 -8
  163. package/src/models/components/checkoutpublic.ts +33 -15
  164. package/src/models/components/checkoutpublicconfirmed.ts +33 -15
  165. package/src/models/components/checkoutupdate.ts +36 -30
  166. package/src/models/components/checkoutupdatepublic.ts +16 -22
  167. package/src/models/components/customerupdate.ts +20 -8
  168. package/src/models/components/customfieldupdatecheckbox.ts +20 -8
  169. package/src/models/components/customfieldupdatedate.ts +20 -8
  170. package/src/models/components/customfieldupdatenumber.ts +20 -8
  171. package/src/models/components/customfieldupdateselect.ts +20 -8
  172. package/src/models/components/customfieldupdatetext.ts +20 -8
  173. package/src/models/components/discountupdate.ts +20 -8
  174. package/src/models/components/meterupdate.ts +20 -8
  175. package/src/models/components/productprice.ts +12 -2
  176. package/src/models/components/productpricemeter.ts +79 -0
  177. package/src/models/components/productpricemeteredunit.ts +204 -0
  178. package/src/models/components/productupdate.ts +20 -8
@@ -19,7 +19,21 @@ export type CustomFieldUpdateNumberMetadata = string | number | boolean;
19
19
  * Schema to update a custom field of type number.
20
20
  */
21
21
  export type CustomFieldUpdateNumber = {
22
- metadata?: { [k: string]: string | number | boolean } | null | undefined;
22
+ /**
23
+ * Key-value object allowing you to store additional information.
24
+ *
25
+ * @remarks
26
+ *
27
+ * The key must be a string with a maximum length of **40 characters**.
28
+ * The value must be either:
29
+ *
30
+ * * A string with a maximum length of **500 characters**
31
+ * * An integer
32
+ * * A boolean
33
+ *
34
+ * You can store up to **50 key-value pairs**.
35
+ */
36
+ metadata?: { [k: string]: string | number | boolean } | undefined;
23
37
  name?: string | null | undefined;
24
38
  slug?: string | null | undefined;
25
39
  type?: "number" | undefined;
@@ -85,9 +99,8 @@ export const CustomFieldUpdateNumber$inboundSchema: z.ZodType<
85
99
  z.ZodTypeDef,
86
100
  unknown
87
101
  > = z.object({
88
- metadata: z.nullable(
89
- z.record(z.union([z.string(), z.number().int(), z.boolean()])),
90
- ).optional(),
102
+ metadata: z.record(z.union([z.string(), z.number().int(), z.boolean()]))
103
+ .optional(),
91
104
  name: z.nullable(z.string()).optional(),
92
105
  slug: z.nullable(z.string()).optional(),
93
106
  type: z.literal("number").optional(),
@@ -96,7 +109,7 @@ export const CustomFieldUpdateNumber$inboundSchema: z.ZodType<
96
109
 
97
110
  /** @internal */
98
111
  export type CustomFieldUpdateNumber$Outbound = {
99
- metadata?: { [k: string]: string | number | boolean } | null | undefined;
112
+ metadata?: { [k: string]: string | number | boolean } | undefined;
100
113
  name?: string | null | undefined;
101
114
  slug?: string | null | undefined;
102
115
  type: "number";
@@ -109,9 +122,8 @@ export const CustomFieldUpdateNumber$outboundSchema: z.ZodType<
109
122
  z.ZodTypeDef,
110
123
  CustomFieldUpdateNumber
111
124
  > = z.object({
112
- metadata: z.nullable(
113
- z.record(z.union([z.string(), z.number().int(), z.boolean()])),
114
- ).optional(),
125
+ metadata: z.record(z.union([z.string(), z.number().int(), z.boolean()]))
126
+ .optional(),
115
127
  name: z.nullable(z.string()).optional(),
116
128
  slug: z.nullable(z.string()).optional(),
117
129
  type: z.literal("number").default("number" as const),
@@ -19,7 +19,21 @@ export type CustomFieldUpdateSelectMetadata = string | number | boolean;
19
19
  * Schema to update a custom field of type select.
20
20
  */
21
21
  export type CustomFieldUpdateSelect = {
22
- metadata?: { [k: string]: string | number | boolean } | null | undefined;
22
+ /**
23
+ * Key-value object allowing you to store additional information.
24
+ *
25
+ * @remarks
26
+ *
27
+ * The key must be a string with a maximum length of **40 characters**.
28
+ * The value must be either:
29
+ *
30
+ * * A string with a maximum length of **500 characters**
31
+ * * An integer
32
+ * * A boolean
33
+ *
34
+ * You can store up to **50 key-value pairs**.
35
+ */
36
+ metadata?: { [k: string]: string | number | boolean } | undefined;
23
37
  name?: string | null | undefined;
24
38
  slug?: string | null | undefined;
25
39
  type?: "select" | undefined;
@@ -85,9 +99,8 @@ export const CustomFieldUpdateSelect$inboundSchema: z.ZodType<
85
99
  z.ZodTypeDef,
86
100
  unknown
87
101
  > = z.object({
88
- metadata: z.nullable(
89
- z.record(z.union([z.string(), z.number().int(), z.boolean()])),
90
- ).optional(),
102
+ metadata: z.record(z.union([z.string(), z.number().int(), z.boolean()]))
103
+ .optional(),
91
104
  name: z.nullable(z.string()).optional(),
92
105
  slug: z.nullable(z.string()).optional(),
93
106
  type: z.literal("select").optional(),
@@ -96,7 +109,7 @@ export const CustomFieldUpdateSelect$inboundSchema: z.ZodType<
96
109
 
97
110
  /** @internal */
98
111
  export type CustomFieldUpdateSelect$Outbound = {
99
- metadata?: { [k: string]: string | number | boolean } | null | undefined;
112
+ metadata?: { [k: string]: string | number | boolean } | undefined;
100
113
  name?: string | null | undefined;
101
114
  slug?: string | null | undefined;
102
115
  type: "select";
@@ -109,9 +122,8 @@ export const CustomFieldUpdateSelect$outboundSchema: z.ZodType<
109
122
  z.ZodTypeDef,
110
123
  CustomFieldUpdateSelect
111
124
  > = z.object({
112
- metadata: z.nullable(
113
- z.record(z.union([z.string(), z.number().int(), z.boolean()])),
114
- ).optional(),
125
+ metadata: z.record(z.union([z.string(), z.number().int(), z.boolean()]))
126
+ .optional(),
115
127
  name: z.nullable(z.string()).optional(),
116
128
  slug: z.nullable(z.string()).optional(),
117
129
  type: z.literal("select").default("select" as const),
@@ -19,7 +19,21 @@ export type CustomFieldUpdateTextMetadata = string | number | boolean;
19
19
  * Schema to update a custom field of type text.
20
20
  */
21
21
  export type CustomFieldUpdateText = {
22
- metadata?: { [k: string]: string | number | boolean } | null | undefined;
22
+ /**
23
+ * Key-value object allowing you to store additional information.
24
+ *
25
+ * @remarks
26
+ *
27
+ * The key must be a string with a maximum length of **40 characters**.
28
+ * The value must be either:
29
+ *
30
+ * * A string with a maximum length of **500 characters**
31
+ * * An integer
32
+ * * A boolean
33
+ *
34
+ * You can store up to **50 key-value pairs**.
35
+ */
36
+ metadata?: { [k: string]: string | number | boolean } | undefined;
23
37
  name?: string | null | undefined;
24
38
  slug?: string | null | undefined;
25
39
  type?: "text" | undefined;
@@ -82,9 +96,8 @@ export const CustomFieldUpdateText$inboundSchema: z.ZodType<
82
96
  z.ZodTypeDef,
83
97
  unknown
84
98
  > = z.object({
85
- metadata: z.nullable(
86
- z.record(z.union([z.string(), z.number().int(), z.boolean()])),
87
- ).optional(),
99
+ metadata: z.record(z.union([z.string(), z.number().int(), z.boolean()]))
100
+ .optional(),
88
101
  name: z.nullable(z.string()).optional(),
89
102
  slug: z.nullable(z.string()).optional(),
90
103
  type: z.literal("text").optional(),
@@ -93,7 +106,7 @@ export const CustomFieldUpdateText$inboundSchema: z.ZodType<
93
106
 
94
107
  /** @internal */
95
108
  export type CustomFieldUpdateText$Outbound = {
96
- metadata?: { [k: string]: string | number | boolean } | null | undefined;
109
+ metadata?: { [k: string]: string | number | boolean } | undefined;
97
110
  name?: string | null | undefined;
98
111
  slug?: string | null | undefined;
99
112
  type: "text";
@@ -106,9 +119,8 @@ export const CustomFieldUpdateText$outboundSchema: z.ZodType<
106
119
  z.ZodTypeDef,
107
120
  CustomFieldUpdateText
108
121
  > = z.object({
109
- metadata: z.nullable(
110
- z.record(z.union([z.string(), z.number().int(), z.boolean()])),
111
- ).optional(),
122
+ metadata: z.record(z.union([z.string(), z.number().int(), z.boolean()]))
123
+ .optional(),
112
124
  name: z.nullable(z.string()).optional(),
113
125
  slug: z.nullable(z.string()).optional(),
114
126
  type: z.literal("text").default("text" as const),
@@ -24,7 +24,21 @@ export type DiscountUpdateMetadata = string | number | boolean;
24
24
  * Schema to update a discount.
25
25
  */
26
26
  export type DiscountUpdate = {
27
- metadata?: { [k: string]: string | number | boolean } | null | undefined;
27
+ /**
28
+ * Key-value object allowing you to store additional information.
29
+ *
30
+ * @remarks
31
+ *
32
+ * The key must be a string with a maximum length of **40 characters**.
33
+ * The value must be either:
34
+ *
35
+ * * A string with a maximum length of **500 characters**
36
+ * * An integer
37
+ * * A boolean
38
+ *
39
+ * You can store up to **50 key-value pairs**.
40
+ */
41
+ metadata?: { [k: string]: string | number | boolean } | undefined;
28
42
  name?: string | null | undefined;
29
43
  code?: string | null | undefined;
30
44
  startsAt?: Date | null | undefined;
@@ -93,9 +107,8 @@ export const DiscountUpdate$inboundSchema: z.ZodType<
93
107
  z.ZodTypeDef,
94
108
  unknown
95
109
  > = z.object({
96
- metadata: z.nullable(
97
- z.record(z.union([z.string(), z.number().int(), z.boolean()])),
98
- ).optional(),
110
+ metadata: z.record(z.union([z.string(), z.number().int(), z.boolean()]))
111
+ .optional(),
99
112
  name: z.nullable(z.string()).optional(),
100
113
  code: z.nullable(z.string()).optional(),
101
114
  starts_at: z.nullable(
@@ -124,7 +137,7 @@ export const DiscountUpdate$inboundSchema: z.ZodType<
124
137
 
125
138
  /** @internal */
126
139
  export type DiscountUpdate$Outbound = {
127
- metadata?: { [k: string]: string | number | boolean } | null | undefined;
140
+ metadata?: { [k: string]: string | number | boolean } | undefined;
128
141
  name?: string | null | undefined;
129
142
  code?: string | null | undefined;
130
143
  starts_at?: string | null | undefined;
@@ -145,9 +158,8 @@ export const DiscountUpdate$outboundSchema: z.ZodType<
145
158
  z.ZodTypeDef,
146
159
  DiscountUpdate
147
160
  > = z.object({
148
- metadata: z.nullable(
149
- z.record(z.union([z.string(), z.number().int(), z.boolean()])),
150
- ).optional(),
161
+ metadata: z.record(z.union([z.string(), z.number().int(), z.boolean()]))
162
+ .optional(),
151
163
  name: z.nullable(z.string()).optional(),
152
164
  code: z.nullable(z.string()).optional(),
153
165
  startsAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
@@ -35,7 +35,21 @@ export type Aggregation =
35
35
  | (PropertyAggregation & { func: "sum" });
36
36
 
37
37
  export type MeterUpdate = {
38
- metadata?: { [k: string]: string | number | boolean } | null | undefined;
38
+ /**
39
+ * Key-value object allowing you to store additional information.
40
+ *
41
+ * @remarks
42
+ *
43
+ * The key must be a string with a maximum length of **40 characters**.
44
+ * The value must be either:
45
+ *
46
+ * * A string with a maximum length of **500 characters**
47
+ * * An integer
48
+ * * A boolean
49
+ *
50
+ * You can store up to **50 key-value pairs**.
51
+ */
52
+ metadata?: { [k: string]: string | number | boolean } | undefined;
39
53
  /**
40
54
  * The name of the meter. Will be shown on customer's invoices and usage.
41
55
  */
@@ -192,9 +206,8 @@ export const MeterUpdate$inboundSchema: z.ZodType<
192
206
  z.ZodTypeDef,
193
207
  unknown
194
208
  > = z.object({
195
- metadata: z.nullable(
196
- z.record(z.union([z.string(), z.number().int(), z.boolean()])),
197
- ).optional(),
209
+ metadata: z.record(z.union([z.string(), z.number().int(), z.boolean()]))
210
+ .optional(),
198
211
  name: z.nullable(z.string()).optional(),
199
212
  filter: z.nullable(Filter$inboundSchema).optional(),
200
213
  aggregation: z.nullable(
@@ -230,7 +243,7 @@ export const MeterUpdate$inboundSchema: z.ZodType<
230
243
 
231
244
  /** @internal */
232
245
  export type MeterUpdate$Outbound = {
233
- metadata?: { [k: string]: string | number | boolean } | null | undefined;
246
+ metadata?: { [k: string]: string | number | boolean } | undefined;
234
247
  name?: string | null | undefined;
235
248
  filter?: Filter$Outbound | null | undefined;
236
249
  aggregation?:
@@ -249,9 +262,8 @@ export const MeterUpdate$outboundSchema: z.ZodType<
249
262
  z.ZodTypeDef,
250
263
  MeterUpdate
251
264
  > = z.object({
252
- metadata: z.nullable(
253
- z.record(z.union([z.string(), z.number().int(), z.boolean()])),
254
- ).optional(),
265
+ metadata: z.record(z.union([z.string(), z.number().int(), z.boolean()]))
266
+ .optional(),
255
267
  name: z.nullable(z.string()).optional(),
256
268
  filter: z.nullable(Filter$outboundSchema).optional(),
257
269
  aggregation: z.nullable(
@@ -24,11 +24,18 @@ import {
24
24
  ProductPriceFree$Outbound,
25
25
  ProductPriceFree$outboundSchema,
26
26
  } from "./productpricefree.js";
27
+ import {
28
+ ProductPriceMeteredUnit,
29
+ ProductPriceMeteredUnit$inboundSchema,
30
+ ProductPriceMeteredUnit$Outbound,
31
+ ProductPriceMeteredUnit$outboundSchema,
32
+ } from "./productpricemeteredunit.js";
27
33
 
28
34
  export type ProductPrice =
29
35
  | ProductPriceFree
30
36
  | ProductPriceFixed
31
- | ProductPriceCustom;
37
+ | ProductPriceCustom
38
+ | ProductPriceMeteredUnit;
32
39
 
33
40
  /** @internal */
34
41
  export const ProductPrice$inboundSchema: z.ZodType<
@@ -39,13 +46,15 @@ export const ProductPrice$inboundSchema: z.ZodType<
39
46
  ProductPriceFree$inboundSchema,
40
47
  ProductPriceFixed$inboundSchema,
41
48
  ProductPriceCustom$inboundSchema,
49
+ ProductPriceMeteredUnit$inboundSchema,
42
50
  ]);
43
51
 
44
52
  /** @internal */
45
53
  export type ProductPrice$Outbound =
46
54
  | ProductPriceFree$Outbound
47
55
  | ProductPriceFixed$Outbound
48
- | ProductPriceCustom$Outbound;
56
+ | ProductPriceCustom$Outbound
57
+ | ProductPriceMeteredUnit$Outbound;
49
58
 
50
59
  /** @internal */
51
60
  export const ProductPrice$outboundSchema: z.ZodType<
@@ -56,6 +65,7 @@ export const ProductPrice$outboundSchema: z.ZodType<
56
65
  ProductPriceFree$outboundSchema,
57
66
  ProductPriceFixed$outboundSchema,
58
67
  ProductPriceCustom$outboundSchema,
68
+ ProductPriceMeteredUnit$outboundSchema,
59
69
  ]);
60
70
 
61
71
  /**
@@ -0,0 +1,79 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../../types/fp.js";
8
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
9
+
10
+ /**
11
+ * A meter associated to a metered price.
12
+ */
13
+ export type ProductPriceMeter = {
14
+ /**
15
+ * The ID of the object.
16
+ */
17
+ id: string;
18
+ /**
19
+ * The name of the meter.
20
+ */
21
+ name: string;
22
+ };
23
+
24
+ /** @internal */
25
+ export const ProductPriceMeter$inboundSchema: z.ZodType<
26
+ ProductPriceMeter,
27
+ z.ZodTypeDef,
28
+ unknown
29
+ > = z.object({
30
+ id: z.string(),
31
+ name: z.string(),
32
+ });
33
+
34
+ /** @internal */
35
+ export type ProductPriceMeter$Outbound = {
36
+ id: string;
37
+ name: string;
38
+ };
39
+
40
+ /** @internal */
41
+ export const ProductPriceMeter$outboundSchema: z.ZodType<
42
+ ProductPriceMeter$Outbound,
43
+ z.ZodTypeDef,
44
+ ProductPriceMeter
45
+ > = z.object({
46
+ id: z.string(),
47
+ name: z.string(),
48
+ });
49
+
50
+ /**
51
+ * @internal
52
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
53
+ */
54
+ export namespace ProductPriceMeter$ {
55
+ /** @deprecated use `ProductPriceMeter$inboundSchema` instead. */
56
+ export const inboundSchema = ProductPriceMeter$inboundSchema;
57
+ /** @deprecated use `ProductPriceMeter$outboundSchema` instead. */
58
+ export const outboundSchema = ProductPriceMeter$outboundSchema;
59
+ /** @deprecated use `ProductPriceMeter$Outbound` instead. */
60
+ export type Outbound = ProductPriceMeter$Outbound;
61
+ }
62
+
63
+ export function productPriceMeterToJSON(
64
+ productPriceMeter: ProductPriceMeter,
65
+ ): string {
66
+ return JSON.stringify(
67
+ ProductPriceMeter$outboundSchema.parse(productPriceMeter),
68
+ );
69
+ }
70
+
71
+ export function productPriceMeterFromJSON(
72
+ jsonString: string,
73
+ ): SafeParseResult<ProductPriceMeter, SDKValidationError> {
74
+ return safeParse(
75
+ jsonString,
76
+ (x) => ProductPriceMeter$inboundSchema.parse(JSON.parse(x)),
77
+ `Failed to parse 'ProductPriceMeter' from JSON`,
78
+ );
79
+ }
@@ -0,0 +1,204 @@
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
+ ProductPriceMeter,
12
+ ProductPriceMeter$inboundSchema,
13
+ ProductPriceMeter$Outbound,
14
+ ProductPriceMeter$outboundSchema,
15
+ } from "./productpricemeter.js";
16
+ import {
17
+ ProductPriceType,
18
+ ProductPriceType$inboundSchema,
19
+ ProductPriceType$outboundSchema,
20
+ } from "./productpricetype.js";
21
+ import {
22
+ SubscriptionRecurringInterval,
23
+ SubscriptionRecurringInterval$inboundSchema,
24
+ SubscriptionRecurringInterval$outboundSchema,
25
+ } from "./subscriptionrecurringinterval.js";
26
+
27
+ /**
28
+ * A metered, usage-based, price for a product, with a fixed unit price.
29
+ */
30
+ export type ProductPriceMeteredUnit = {
31
+ /**
32
+ * Creation timestamp of the object.
33
+ */
34
+ createdAt: Date;
35
+ /**
36
+ * Last modification timestamp of the object.
37
+ */
38
+ modifiedAt: Date | null;
39
+ /**
40
+ * The ID of the price.
41
+ */
42
+ id: string;
43
+ amountType?: "metered_unit" | undefined;
44
+ /**
45
+ * Whether the price is archived and no longer available.
46
+ */
47
+ isArchived: boolean;
48
+ /**
49
+ * The ID of the product owning the price.
50
+ */
51
+ productId: string;
52
+ type: ProductPriceType;
53
+ /**
54
+ * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
55
+ */
56
+ recurringInterval: SubscriptionRecurringInterval | null;
57
+ /**
58
+ * The currency.
59
+ */
60
+ priceCurrency: string;
61
+ /**
62
+ * The price per unit in cents.
63
+ */
64
+ unitAmount: number;
65
+ /**
66
+ * The number of units included in the price. They will be deducted from the total.
67
+ */
68
+ includedUnits: number;
69
+ /**
70
+ * The maximum amount in cents that can be charged, regardless of the number of units consumed.
71
+ */
72
+ capAmount: number | null;
73
+ /**
74
+ * The ID of the meter associated to the price.
75
+ */
76
+ meterId: string;
77
+ /**
78
+ * A meter associated to a metered price.
79
+ */
80
+ meter: ProductPriceMeter;
81
+ };
82
+
83
+ /** @internal */
84
+ export const ProductPriceMeteredUnit$inboundSchema: z.ZodType<
85
+ ProductPriceMeteredUnit,
86
+ z.ZodTypeDef,
87
+ unknown
88
+ > = z.object({
89
+ created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
90
+ modified_at: z.nullable(
91
+ z.string().datetime({ offset: true }).transform(v => new Date(v)),
92
+ ),
93
+ id: z.string(),
94
+ amount_type: z.literal("metered_unit").optional(),
95
+ is_archived: z.boolean(),
96
+ product_id: z.string(),
97
+ type: ProductPriceType$inboundSchema,
98
+ recurring_interval: z.nullable(SubscriptionRecurringInterval$inboundSchema),
99
+ price_currency: z.string(),
100
+ unit_amount: z.number().int(),
101
+ included_units: z.number().int(),
102
+ cap_amount: z.nullable(z.number().int()),
103
+ meter_id: z.string(),
104
+ meter: ProductPriceMeter$inboundSchema,
105
+ }).transform((v) => {
106
+ return remap$(v, {
107
+ "created_at": "createdAt",
108
+ "modified_at": "modifiedAt",
109
+ "amount_type": "amountType",
110
+ "is_archived": "isArchived",
111
+ "product_id": "productId",
112
+ "recurring_interval": "recurringInterval",
113
+ "price_currency": "priceCurrency",
114
+ "unit_amount": "unitAmount",
115
+ "included_units": "includedUnits",
116
+ "cap_amount": "capAmount",
117
+ "meter_id": "meterId",
118
+ });
119
+ });
120
+
121
+ /** @internal */
122
+ export type ProductPriceMeteredUnit$Outbound = {
123
+ created_at: string;
124
+ modified_at: string | null;
125
+ id: string;
126
+ amount_type: "metered_unit";
127
+ is_archived: boolean;
128
+ product_id: string;
129
+ type: string;
130
+ recurring_interval: string | null;
131
+ price_currency: string;
132
+ unit_amount: number;
133
+ included_units: number;
134
+ cap_amount: number | null;
135
+ meter_id: string;
136
+ meter: ProductPriceMeter$Outbound;
137
+ };
138
+
139
+ /** @internal */
140
+ export const ProductPriceMeteredUnit$outboundSchema: z.ZodType<
141
+ ProductPriceMeteredUnit$Outbound,
142
+ z.ZodTypeDef,
143
+ ProductPriceMeteredUnit
144
+ > = z.object({
145
+ createdAt: z.date().transform(v => v.toISOString()),
146
+ modifiedAt: z.nullable(z.date().transform(v => v.toISOString())),
147
+ id: z.string(),
148
+ amountType: z.literal("metered_unit").default("metered_unit" as const),
149
+ isArchived: z.boolean(),
150
+ productId: z.string(),
151
+ type: ProductPriceType$outboundSchema,
152
+ recurringInterval: z.nullable(SubscriptionRecurringInterval$outboundSchema),
153
+ priceCurrency: z.string(),
154
+ unitAmount: z.number().int(),
155
+ includedUnits: z.number().int(),
156
+ capAmount: z.nullable(z.number().int()),
157
+ meterId: z.string(),
158
+ meter: ProductPriceMeter$outboundSchema,
159
+ }).transform((v) => {
160
+ return remap$(v, {
161
+ createdAt: "created_at",
162
+ modifiedAt: "modified_at",
163
+ amountType: "amount_type",
164
+ isArchived: "is_archived",
165
+ productId: "product_id",
166
+ recurringInterval: "recurring_interval",
167
+ priceCurrency: "price_currency",
168
+ unitAmount: "unit_amount",
169
+ includedUnits: "included_units",
170
+ capAmount: "cap_amount",
171
+ meterId: "meter_id",
172
+ });
173
+ });
174
+
175
+ /**
176
+ * @internal
177
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
178
+ */
179
+ export namespace ProductPriceMeteredUnit$ {
180
+ /** @deprecated use `ProductPriceMeteredUnit$inboundSchema` instead. */
181
+ export const inboundSchema = ProductPriceMeteredUnit$inboundSchema;
182
+ /** @deprecated use `ProductPriceMeteredUnit$outboundSchema` instead. */
183
+ export const outboundSchema = ProductPriceMeteredUnit$outboundSchema;
184
+ /** @deprecated use `ProductPriceMeteredUnit$Outbound` instead. */
185
+ export type Outbound = ProductPriceMeteredUnit$Outbound;
186
+ }
187
+
188
+ export function productPriceMeteredUnitToJSON(
189
+ productPriceMeteredUnit: ProductPriceMeteredUnit,
190
+ ): string {
191
+ return JSON.stringify(
192
+ ProductPriceMeteredUnit$outboundSchema.parse(productPriceMeteredUnit),
193
+ );
194
+ }
195
+
196
+ export function productPriceMeteredUnitFromJSON(
197
+ jsonString: string,
198
+ ): SafeParseResult<ProductPriceMeteredUnit, SDKValidationError> {
199
+ return safeParse(
200
+ jsonString,
201
+ (x) => ProductPriceMeteredUnit$inboundSchema.parse(JSON.parse(x)),
202
+ `Failed to parse 'ProductPriceMeteredUnit' from JSON`,
203
+ );
204
+ }
@@ -55,7 +55,21 @@ export type ProductUpdatePrices =
55
55
  * Schema to update a product.
56
56
  */
57
57
  export type ProductUpdate = {
58
- metadata?: { [k: string]: string | number | boolean } | null | undefined;
58
+ /**
59
+ * Key-value object allowing you to store additional information.
60
+ *
61
+ * @remarks
62
+ *
63
+ * The key must be a string with a maximum length of **40 characters**.
64
+ * The value must be either:
65
+ *
66
+ * * A string with a maximum length of **500 characters**
67
+ * * An integer
68
+ * * A boolean
69
+ *
70
+ * You can store up to **50 key-value pairs**.
71
+ */
72
+ metadata?: { [k: string]: string | number | boolean } | undefined;
59
73
  name?: string | null | undefined;
60
74
  /**
61
75
  * The description of the product.
@@ -204,9 +218,8 @@ export const ProductUpdate$inboundSchema: z.ZodType<
204
218
  z.ZodTypeDef,
205
219
  unknown
206
220
  > = z.object({
207
- metadata: z.nullable(
208
- z.record(z.union([z.string(), z.number().int(), z.boolean()])),
209
- ).optional(),
221
+ metadata: z.record(z.union([z.string(), z.number().int(), z.boolean()]))
222
+ .optional(),
210
223
  name: z.nullable(z.string()).optional(),
211
224
  description: z.nullable(z.string()).optional(),
212
225
  recurring_interval: z.nullable(SubscriptionRecurringInterval$inboundSchema)
@@ -236,7 +249,7 @@ export const ProductUpdate$inboundSchema: z.ZodType<
236
249
 
237
250
  /** @internal */
238
251
  export type ProductUpdate$Outbound = {
239
- metadata?: { [k: string]: string | number | boolean } | null | undefined;
252
+ metadata?: { [k: string]: string | number | boolean } | undefined;
240
253
  name?: string | null | undefined;
241
254
  description?: string | null | undefined;
242
255
  recurring_interval?: string | null | undefined;
@@ -263,9 +276,8 @@ export const ProductUpdate$outboundSchema: z.ZodType<
263
276
  z.ZodTypeDef,
264
277
  ProductUpdate
265
278
  > = z.object({
266
- metadata: z.nullable(
267
- z.record(z.union([z.string(), z.number().int(), z.boolean()])),
268
- ).optional(),
279
+ metadata: z.record(z.union([z.string(), z.number().int(), z.boolean()]))
280
+ .optional(),
269
281
  name: z.nullable(z.string()).optional(),
270
282
  description: z.nullable(z.string()).optional(),
271
283
  recurringInterval: z.nullable(SubscriptionRecurringInterval$outboundSchema)