@polar-sh/sdk 0.29.0 → 0.29.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 (271) hide show
  1. package/FUNCTIONS.md +5 -1
  2. package/README.md +48 -12
  3. package/bin/mcp-server.js +866 -148
  4. package/bin/mcp-server.js.map +29 -14
  5. package/dist/commonjs/funcs/customersGetState.d.ts +27 -0
  6. package/dist/commonjs/funcs/customersGetState.d.ts.map +1 -0
  7. package/dist/commonjs/funcs/customersGetState.js +121 -0
  8. package/dist/commonjs/funcs/customersGetState.js.map +1 -0
  9. package/dist/commonjs/funcs/customersGetStateExternal.d.ts +27 -0
  10. package/dist/commonjs/funcs/customersGetStateExternal.d.ts.map +1 -0
  11. package/dist/commonjs/funcs/customersGetStateExternal.js +121 -0
  12. package/dist/commonjs/funcs/customersGetStateExternal.js.map +1 -0
  13. package/dist/commonjs/lib/config.d.ts +2 -2
  14. package/dist/commonjs/lib/config.js +2 -2
  15. package/dist/commonjs/mcp-server/mcp-server.js +1 -1
  16. package/dist/commonjs/mcp-server/server.d.ts.map +1 -1
  17. package/dist/commonjs/mcp-server/server.js +5 -1
  18. package/dist/commonjs/mcp-server/server.js.map +1 -1
  19. package/dist/commonjs/mcp-server/tools/customersGetState.d.ts +7 -0
  20. package/dist/commonjs/mcp-server/tools/customersGetState.d.ts.map +1 -0
  21. package/dist/commonjs/mcp-server/tools/customersGetState.js +40 -0
  22. package/dist/commonjs/mcp-server/tools/customersGetState.js.map +1 -0
  23. package/dist/commonjs/mcp-server/tools/customersGetStateExternal.d.ts +7 -0
  24. package/dist/commonjs/mcp-server/tools/customersGetStateExternal.d.ts.map +1 -0
  25. package/dist/commonjs/mcp-server/tools/customersGetStateExternal.js +40 -0
  26. package/dist/commonjs/mcp-server/tools/customersGetStateExternal.js.map +1 -0
  27. package/dist/commonjs/models/components/customer.d.ts +11 -5
  28. package/dist/commonjs/models/components/customer.d.ts.map +1 -1
  29. package/dist/commonjs/models/components/customer.js +2 -2
  30. package/dist/commonjs/models/components/customer.js.map +1 -1
  31. package/dist/commonjs/models/components/customercreate.d.ts +3 -0
  32. package/dist/commonjs/models/components/customercreate.d.ts.map +1 -1
  33. package/dist/commonjs/models/components/customercreate.js.map +1 -1
  34. package/dist/commonjs/models/components/customerordersubscription.d.ts +39 -0
  35. package/dist/commonjs/models/components/customerordersubscription.d.ts.map +1 -1
  36. package/dist/commonjs/models/components/customerordersubscription.js.map +1 -1
  37. package/dist/commonjs/models/components/customerstate.d.ts +143 -0
  38. package/dist/commonjs/models/components/customerstate.d.ts.map +1 -0
  39. package/dist/commonjs/models/components/customerstate.js +162 -0
  40. package/dist/commonjs/models/components/customerstate.js.map +1 -0
  41. package/dist/commonjs/models/components/customerstatebenefitgrant.d.ts +86 -0
  42. package/dist/commonjs/models/components/customerstatebenefitgrant.d.ts.map +1 -0
  43. package/dist/commonjs/models/components/customerstatebenefitgrant.js +141 -0
  44. package/dist/commonjs/models/components/customerstatebenefitgrant.js.map +1 -0
  45. package/dist/commonjs/models/components/customerstatesubscription.d.ts +162 -0
  46. package/dist/commonjs/models/components/customerstatesubscription.d.ts.map +1 -0
  47. package/dist/commonjs/models/components/customerstatesubscription.js +193 -0
  48. package/dist/commonjs/models/components/customerstatesubscription.js.map +1 -0
  49. package/dist/commonjs/models/components/customersubscription.d.ts +9 -0
  50. package/dist/commonjs/models/components/customersubscription.d.ts.map +1 -1
  51. package/dist/commonjs/models/components/customersubscription.js.map +1 -1
  52. package/dist/commonjs/models/components/customerupdate.d.ts +3 -0
  53. package/dist/commonjs/models/components/customerupdate.d.ts.map +1 -1
  54. package/dist/commonjs/models/components/customerupdate.js.map +1 -1
  55. package/dist/commonjs/models/components/licensekeycustomer.d.ts +11 -5
  56. package/dist/commonjs/models/components/licensekeycustomer.d.ts.map +1 -1
  57. package/dist/commonjs/models/components/licensekeycustomer.js +2 -2
  58. package/dist/commonjs/models/components/licensekeycustomer.js.map +1 -1
  59. package/dist/commonjs/models/components/ordercustomer.d.ts +11 -5
  60. package/dist/commonjs/models/components/ordercustomer.d.ts.map +1 -1
  61. package/dist/commonjs/models/components/ordercustomer.js +2 -2
  62. package/dist/commonjs/models/components/ordercustomer.js.map +1 -1
  63. package/dist/commonjs/models/components/ordersubscription.d.ts +39 -0
  64. package/dist/commonjs/models/components/ordersubscription.d.ts.map +1 -1
  65. package/dist/commonjs/models/components/ordersubscription.js.map +1 -1
  66. package/dist/commonjs/models/components/subscription.d.ts +39 -0
  67. package/dist/commonjs/models/components/subscription.d.ts.map +1 -1
  68. package/dist/commonjs/models/components/subscription.js.map +1 -1
  69. package/dist/commonjs/models/components/subscriptioncustomer.d.ts +11 -5
  70. package/dist/commonjs/models/components/subscriptioncustomer.d.ts.map +1 -1
  71. package/dist/commonjs/models/components/subscriptioncustomer.js +2 -2
  72. package/dist/commonjs/models/components/subscriptioncustomer.js.map +1 -1
  73. package/dist/commonjs/models/components/webhookcustomercreatedpayload.d.ts +47 -0
  74. package/dist/commonjs/models/components/webhookcustomercreatedpayload.d.ts.map +1 -0
  75. package/dist/commonjs/models/components/webhookcustomercreatedpayload.js +62 -0
  76. package/dist/commonjs/models/components/webhookcustomercreatedpayload.js.map +1 -0
  77. package/dist/commonjs/models/components/webhookcustomerdeletedpayload.d.ts +42 -0
  78. package/dist/commonjs/models/components/webhookcustomerdeletedpayload.d.ts.map +1 -0
  79. package/dist/commonjs/models/components/webhookcustomerdeletedpayload.js +62 -0
  80. package/dist/commonjs/models/components/webhookcustomerdeletedpayload.js.map +1 -0
  81. package/dist/commonjs/models/components/webhookcustomerstatechangedpayload.d.ts +53 -0
  82. package/dist/commonjs/models/components/webhookcustomerstatechangedpayload.d.ts.map +1 -0
  83. package/dist/commonjs/models/components/webhookcustomerstatechangedpayload.js +62 -0
  84. package/dist/commonjs/models/components/webhookcustomerstatechangedpayload.js.map +1 -0
  85. package/dist/commonjs/models/components/webhookcustomerupdatedpayload.d.ts +46 -0
  86. package/dist/commonjs/models/components/webhookcustomerupdatedpayload.d.ts.map +1 -0
  87. package/dist/commonjs/models/components/webhookcustomerupdatedpayload.js +62 -0
  88. package/dist/commonjs/models/components/webhookcustomerupdatedpayload.js.map +1 -0
  89. package/dist/commonjs/models/components/webhookordercreatedpayload.d.ts +7 -0
  90. package/dist/commonjs/models/components/webhookordercreatedpayload.d.ts.map +1 -1
  91. package/dist/commonjs/models/components/webhookordercreatedpayload.js.map +1 -1
  92. package/dist/commonjs/models/components/webhooksubscriptioncreatedpayload.d.ts +2 -0
  93. package/dist/commonjs/models/components/webhooksubscriptioncreatedpayload.d.ts.map +1 -1
  94. package/dist/commonjs/models/components/webhooksubscriptioncreatedpayload.js.map +1 -1
  95. package/dist/commonjs/models/operations/customersgetstate.d.ts +32 -0
  96. package/dist/commonjs/models/operations/customersgetstate.d.ts.map +1 -0
  97. package/dist/commonjs/models/operations/customersgetstate.js +59 -0
  98. package/dist/commonjs/models/operations/customersgetstate.js.map +1 -0
  99. package/dist/commonjs/models/operations/customersgetstateexternal.d.ts +32 -0
  100. package/dist/commonjs/models/operations/customersgetstateexternal.d.ts.map +1 -0
  101. package/dist/commonjs/models/operations/customersgetstateexternal.js +68 -0
  102. package/dist/commonjs/models/operations/customersgetstateexternal.js.map +1 -0
  103. package/dist/commonjs/sdk/customers.d.ts +33 -0
  104. package/dist/commonjs/sdk/customers.d.ts.map +1 -1
  105. package/dist/commonjs/sdk/customers.js +36 -0
  106. package/dist/commonjs/sdk/customers.js.map +1 -1
  107. package/dist/commonjs/webhooks.d.ts +2 -2
  108. package/dist/commonjs/webhooks.d.ts.map +1 -1
  109. package/dist/commonjs/webhooks.js +36 -24
  110. package/dist/commonjs/webhooks.js.map +1 -1
  111. package/dist/esm/funcs/customersGetState.d.ts +27 -0
  112. package/dist/esm/funcs/customersGetState.d.ts.map +1 -0
  113. package/dist/esm/funcs/customersGetState.js +95 -0
  114. package/dist/esm/funcs/customersGetState.js.map +1 -0
  115. package/dist/esm/funcs/customersGetStateExternal.d.ts +27 -0
  116. package/dist/esm/funcs/customersGetStateExternal.d.ts.map +1 -0
  117. package/dist/esm/funcs/customersGetStateExternal.js +95 -0
  118. package/dist/esm/funcs/customersGetStateExternal.js.map +1 -0
  119. package/dist/esm/lib/config.d.ts +2 -2
  120. package/dist/esm/lib/config.js +2 -2
  121. package/dist/esm/mcp-server/mcp-server.js +1 -1
  122. package/dist/esm/mcp-server/server.d.ts.map +1 -1
  123. package/dist/esm/mcp-server/server.js +5 -1
  124. package/dist/esm/mcp-server/server.js.map +1 -1
  125. package/dist/esm/mcp-server/tools/customersGetState.d.ts +7 -0
  126. package/dist/esm/mcp-server/tools/customersGetState.d.ts.map +1 -0
  127. package/dist/esm/mcp-server/tools/customersGetState.js +37 -0
  128. package/dist/esm/mcp-server/tools/customersGetState.js.map +1 -0
  129. package/dist/esm/mcp-server/tools/customersGetStateExternal.d.ts +7 -0
  130. package/dist/esm/mcp-server/tools/customersGetStateExternal.d.ts.map +1 -0
  131. package/dist/esm/mcp-server/tools/customersGetStateExternal.js +37 -0
  132. package/dist/esm/mcp-server/tools/customersGetStateExternal.js.map +1 -0
  133. package/dist/esm/models/components/customer.d.ts +11 -5
  134. package/dist/esm/models/components/customer.d.ts.map +1 -1
  135. package/dist/esm/models/components/customer.js +2 -2
  136. package/dist/esm/models/components/customer.js.map +1 -1
  137. package/dist/esm/models/components/customercreate.d.ts +3 -0
  138. package/dist/esm/models/components/customercreate.d.ts.map +1 -1
  139. package/dist/esm/models/components/customercreate.js.map +1 -1
  140. package/dist/esm/models/components/customerordersubscription.d.ts +39 -0
  141. package/dist/esm/models/components/customerordersubscription.d.ts.map +1 -1
  142. package/dist/esm/models/components/customerordersubscription.js.map +1 -1
  143. package/dist/esm/models/components/customerstate.d.ts +143 -0
  144. package/dist/esm/models/components/customerstate.d.ts.map +1 -0
  145. package/dist/esm/models/components/customerstate.js +130 -0
  146. package/dist/esm/models/components/customerstate.js.map +1 -0
  147. package/dist/esm/models/components/customerstatebenefitgrant.d.ts +86 -0
  148. package/dist/esm/models/components/customerstatebenefitgrant.d.ts.map +1 -0
  149. package/dist/esm/models/components/customerstatebenefitgrant.js +111 -0
  150. package/dist/esm/models/components/customerstatebenefitgrant.js.map +1 -0
  151. package/dist/esm/models/components/customerstatesubscription.d.ts +162 -0
  152. package/dist/esm/models/components/customerstatesubscription.d.ts.map +1 -0
  153. package/dist/esm/models/components/customerstatesubscription.js +161 -0
  154. package/dist/esm/models/components/customerstatesubscription.js.map +1 -0
  155. package/dist/esm/models/components/customersubscription.d.ts +9 -0
  156. package/dist/esm/models/components/customersubscription.d.ts.map +1 -1
  157. package/dist/esm/models/components/customersubscription.js.map +1 -1
  158. package/dist/esm/models/components/customerupdate.d.ts +3 -0
  159. package/dist/esm/models/components/customerupdate.d.ts.map +1 -1
  160. package/dist/esm/models/components/customerupdate.js.map +1 -1
  161. package/dist/esm/models/components/licensekeycustomer.d.ts +11 -5
  162. package/dist/esm/models/components/licensekeycustomer.d.ts.map +1 -1
  163. package/dist/esm/models/components/licensekeycustomer.js +2 -2
  164. package/dist/esm/models/components/licensekeycustomer.js.map +1 -1
  165. package/dist/esm/models/components/ordercustomer.d.ts +11 -5
  166. package/dist/esm/models/components/ordercustomer.d.ts.map +1 -1
  167. package/dist/esm/models/components/ordercustomer.js +2 -2
  168. package/dist/esm/models/components/ordercustomer.js.map +1 -1
  169. package/dist/esm/models/components/ordersubscription.d.ts +39 -0
  170. package/dist/esm/models/components/ordersubscription.d.ts.map +1 -1
  171. package/dist/esm/models/components/ordersubscription.js.map +1 -1
  172. package/dist/esm/models/components/subscription.d.ts +39 -0
  173. package/dist/esm/models/components/subscription.d.ts.map +1 -1
  174. package/dist/esm/models/components/subscription.js.map +1 -1
  175. package/dist/esm/models/components/subscriptioncustomer.d.ts +11 -5
  176. package/dist/esm/models/components/subscriptioncustomer.d.ts.map +1 -1
  177. package/dist/esm/models/components/subscriptioncustomer.js +2 -2
  178. package/dist/esm/models/components/subscriptioncustomer.js.map +1 -1
  179. package/dist/esm/models/components/webhookcustomercreatedpayload.d.ts +47 -0
  180. package/dist/esm/models/components/webhookcustomercreatedpayload.d.ts.map +1 -0
  181. package/dist/esm/models/components/webhookcustomercreatedpayload.js +34 -0
  182. package/dist/esm/models/components/webhookcustomercreatedpayload.js.map +1 -0
  183. package/dist/esm/models/components/webhookcustomerdeletedpayload.d.ts +42 -0
  184. package/dist/esm/models/components/webhookcustomerdeletedpayload.d.ts.map +1 -0
  185. package/dist/esm/models/components/webhookcustomerdeletedpayload.js +34 -0
  186. package/dist/esm/models/components/webhookcustomerdeletedpayload.js.map +1 -0
  187. package/dist/esm/models/components/webhookcustomerstatechangedpayload.d.ts +53 -0
  188. package/dist/esm/models/components/webhookcustomerstatechangedpayload.d.ts.map +1 -0
  189. package/dist/esm/models/components/webhookcustomerstatechangedpayload.js +34 -0
  190. package/dist/esm/models/components/webhookcustomerstatechangedpayload.js.map +1 -0
  191. package/dist/esm/models/components/webhookcustomerupdatedpayload.d.ts +46 -0
  192. package/dist/esm/models/components/webhookcustomerupdatedpayload.d.ts.map +1 -0
  193. package/dist/esm/models/components/webhookcustomerupdatedpayload.js +34 -0
  194. package/dist/esm/models/components/webhookcustomerupdatedpayload.js.map +1 -0
  195. package/dist/esm/models/components/webhookordercreatedpayload.d.ts +7 -0
  196. package/dist/esm/models/components/webhookordercreatedpayload.d.ts.map +1 -1
  197. package/dist/esm/models/components/webhookordercreatedpayload.js.map +1 -1
  198. package/dist/esm/models/components/webhooksubscriptioncreatedpayload.d.ts +2 -0
  199. package/dist/esm/models/components/webhooksubscriptioncreatedpayload.d.ts.map +1 -1
  200. package/dist/esm/models/components/webhooksubscriptioncreatedpayload.js.map +1 -1
  201. package/dist/esm/models/operations/customersgetstate.d.ts +32 -0
  202. package/dist/esm/models/operations/customersgetstate.d.ts.map +1 -0
  203. package/dist/esm/models/operations/customersgetstate.js +31 -0
  204. package/dist/esm/models/operations/customersgetstate.js.map +1 -0
  205. package/dist/esm/models/operations/customersgetstateexternal.d.ts +32 -0
  206. package/dist/esm/models/operations/customersgetstateexternal.d.ts.map +1 -0
  207. package/dist/esm/models/operations/customersgetstateexternal.js +40 -0
  208. package/dist/esm/models/operations/customersgetstateexternal.js.map +1 -0
  209. package/dist/esm/sdk/customers.d.ts +33 -0
  210. package/dist/esm/sdk/customers.d.ts.map +1 -1
  211. package/dist/esm/sdk/customers.js +36 -0
  212. package/dist/esm/sdk/customers.js.map +1 -1
  213. package/dist/esm/webhooks.d.ts +2 -2
  214. package/dist/esm/webhooks.d.ts.map +1 -1
  215. package/dist/esm/webhooks.js +39 -27
  216. package/dist/esm/webhooks.js.map +1 -1
  217. package/docs/sdks/benefitgrants/README.md +10 -2
  218. package/docs/sdks/benefits/README.md +12 -2
  219. package/docs/sdks/checkoutlinks/README.md +10 -2
  220. package/docs/sdks/checkouts/README.md +16 -2
  221. package/docs/sdks/customers/README.md +206 -4
  222. package/docs/sdks/customfields/README.md +12 -2
  223. package/docs/sdks/discounts/README.md +12 -2
  224. package/docs/sdks/downloadables/README.md +10 -2
  225. package/docs/sdks/events/README.md +14 -2
  226. package/docs/sdks/externalorganizations/README.md +10 -2
  227. package/docs/sdks/files/README.md +8 -2
  228. package/docs/sdks/licensekeys/README.md +10 -2
  229. package/docs/sdks/meters/README.md +12 -2
  230. package/docs/sdks/metrics/README.md +6 -0
  231. package/docs/sdks/orders/README.md +10 -2
  232. package/docs/sdks/organizations/README.md +4 -4
  233. package/docs/sdks/polarlicensekeys/README.md +10 -2
  234. package/docs/sdks/polarorders/README.md +10 -2
  235. package/docs/sdks/polarsubscriptions/README.md +10 -2
  236. package/docs/sdks/products/README.md +12 -2
  237. package/docs/sdks/refunds/README.md +10 -2
  238. package/docs/sdks/repositories/README.md +10 -2
  239. package/docs/sdks/subscriptions/README.md +20 -4
  240. package/jsr.json +1 -1
  241. package/package.json +1 -1
  242. package/src/funcs/customersGetState.ts +195 -0
  243. package/src/funcs/customersGetStateExternal.ts +197 -0
  244. package/src/lib/config.ts +2 -2
  245. package/src/mcp-server/mcp-server.ts +1 -1
  246. package/src/mcp-server/server.ts +5 -1
  247. package/src/mcp-server/tools/customersGetState.ts +46 -0
  248. package/src/mcp-server/tools/customersGetStateExternal.ts +46 -0
  249. package/src/models/components/customer.ts +13 -7
  250. package/src/models/components/customercreate.ts +3 -0
  251. package/src/models/components/customerordersubscription.ts +39 -0
  252. package/src/models/components/customerstate.ts +308 -0
  253. package/src/models/components/customerstatebenefitgrant.ts +261 -0
  254. package/src/models/components/customerstatesubscription.ts +389 -0
  255. package/src/models/components/customersubscription.ts +9 -0
  256. package/src/models/components/customerupdate.ts +3 -0
  257. package/src/models/components/licensekeycustomer.ts +13 -7
  258. package/src/models/components/ordercustomer.ts +13 -7
  259. package/src/models/components/ordersubscription.ts +39 -0
  260. package/src/models/components/subscription.ts +39 -0
  261. package/src/models/components/subscriptioncustomer.ts +13 -7
  262. package/src/models/components/webhookcustomercreatedpayload.ts +93 -0
  263. package/src/models/components/webhookcustomerdeletedpayload.ts +88 -0
  264. package/src/models/components/webhookcustomerstatechangedpayload.ts +103 -0
  265. package/src/models/components/webhookcustomerupdatedpayload.ts +92 -0
  266. package/src/models/components/webhookordercreatedpayload.ts +7 -0
  267. package/src/models/components/webhooksubscriptioncreatedpayload.ts +2 -0
  268. package/src/models/operations/customersgetstate.ts +69 -0
  269. package/src/models/operations/customersgetstateexternal.ts +80 -0
  270. package/src/sdk/customers.ts +55 -0
  271. package/src/webhooks.ts +95 -78
@@ -0,0 +1,389 @@
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
+ SubscriptionRecurringInterval,
12
+ SubscriptionRecurringInterval$inboundSchema,
13
+ SubscriptionRecurringInterval$outboundSchema,
14
+ } from "./subscriptionrecurringinterval.js";
15
+
16
+ export type CustomerStateSubscriptionCustomFieldData =
17
+ | string
18
+ | number
19
+ | boolean
20
+ | Date;
21
+
22
+ export type CustomerStateSubscriptionMetadata = string | number | boolean;
23
+
24
+ /**
25
+ * An active customer subscription.
26
+ */
27
+ export type CustomerStateSubscription = {
28
+ /**
29
+ * The ID of the subscription.
30
+ */
31
+ id: string;
32
+ /**
33
+ * Creation timestamp of the object.
34
+ */
35
+ createdAt: Date;
36
+ /**
37
+ * Last modification timestamp of the object.
38
+ */
39
+ modifiedAt: Date | null;
40
+ /**
41
+ * Key-value object storing custom field values.
42
+ */
43
+ customFieldData?:
44
+ | { [k: string]: string | number | boolean | Date | null }
45
+ | undefined;
46
+ metadata: { [k: string]: string | number | boolean };
47
+ status?: "active" | undefined;
48
+ /**
49
+ * The amount of the subscription.
50
+ */
51
+ amount: number | null;
52
+ /**
53
+ * The currency of the subscription.
54
+ */
55
+ currency: string | null;
56
+ recurringInterval: SubscriptionRecurringInterval;
57
+ /**
58
+ * The start timestamp of the current billing period.
59
+ */
60
+ currentPeriodStart: Date;
61
+ /**
62
+ * The end timestamp of the current billing period.
63
+ */
64
+ currentPeriodEnd: Date | null;
65
+ /**
66
+ * Whether the subscription will be canceled at the end of the current period.
67
+ */
68
+ cancelAtPeriodEnd: boolean;
69
+ /**
70
+ * The timestamp when the subscription was canceled. The subscription might still be active if `cancel_at_period_end` is `true`.
71
+ */
72
+ canceledAt: Date | null;
73
+ /**
74
+ * The timestamp when the subscription started.
75
+ */
76
+ startedAt: Date | null;
77
+ /**
78
+ * The timestamp when the subscription will end.
79
+ */
80
+ endsAt: Date | null;
81
+ /**
82
+ * The ID of the subscribed product.
83
+ */
84
+ productId: string;
85
+ /**
86
+ * The ID of the subscribed price.
87
+ */
88
+ priceId: string;
89
+ /**
90
+ * The ID of the applied discount, if any.
91
+ */
92
+ discountId: string | null;
93
+ };
94
+
95
+ /** @internal */
96
+ export const CustomerStateSubscriptionCustomFieldData$inboundSchema: z.ZodType<
97
+ CustomerStateSubscriptionCustomFieldData,
98
+ z.ZodTypeDef,
99
+ unknown
100
+ > = z.union([
101
+ z.string(),
102
+ z.number().int(),
103
+ z.boolean(),
104
+ z.string().datetime({ offset: true }).transform(v => new Date(v)),
105
+ ]);
106
+
107
+ /** @internal */
108
+ export type CustomerStateSubscriptionCustomFieldData$Outbound =
109
+ | string
110
+ | number
111
+ | boolean
112
+ | string;
113
+
114
+ /** @internal */
115
+ export const CustomerStateSubscriptionCustomFieldData$outboundSchema: z.ZodType<
116
+ CustomerStateSubscriptionCustomFieldData$Outbound,
117
+ z.ZodTypeDef,
118
+ CustomerStateSubscriptionCustomFieldData
119
+ > = z.union([
120
+ z.string(),
121
+ z.number().int(),
122
+ z.boolean(),
123
+ z.date().transform(v => v.toISOString()),
124
+ ]);
125
+
126
+ /**
127
+ * @internal
128
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
129
+ */
130
+ export namespace CustomerStateSubscriptionCustomFieldData$ {
131
+ /** @deprecated use `CustomerStateSubscriptionCustomFieldData$inboundSchema` instead. */
132
+ export const inboundSchema =
133
+ CustomerStateSubscriptionCustomFieldData$inboundSchema;
134
+ /** @deprecated use `CustomerStateSubscriptionCustomFieldData$outboundSchema` instead. */
135
+ export const outboundSchema =
136
+ CustomerStateSubscriptionCustomFieldData$outboundSchema;
137
+ /** @deprecated use `CustomerStateSubscriptionCustomFieldData$Outbound` instead. */
138
+ export type Outbound = CustomerStateSubscriptionCustomFieldData$Outbound;
139
+ }
140
+
141
+ export function customerStateSubscriptionCustomFieldDataToJSON(
142
+ customerStateSubscriptionCustomFieldData:
143
+ CustomerStateSubscriptionCustomFieldData,
144
+ ): string {
145
+ return JSON.stringify(
146
+ CustomerStateSubscriptionCustomFieldData$outboundSchema.parse(
147
+ customerStateSubscriptionCustomFieldData,
148
+ ),
149
+ );
150
+ }
151
+
152
+ export function customerStateSubscriptionCustomFieldDataFromJSON(
153
+ jsonString: string,
154
+ ): SafeParseResult<
155
+ CustomerStateSubscriptionCustomFieldData,
156
+ SDKValidationError
157
+ > {
158
+ return safeParse(
159
+ jsonString,
160
+ (x) =>
161
+ CustomerStateSubscriptionCustomFieldData$inboundSchema.parse(
162
+ JSON.parse(x),
163
+ ),
164
+ `Failed to parse 'CustomerStateSubscriptionCustomFieldData' from JSON`,
165
+ );
166
+ }
167
+
168
+ /** @internal */
169
+ export const CustomerStateSubscriptionMetadata$inboundSchema: z.ZodType<
170
+ CustomerStateSubscriptionMetadata,
171
+ z.ZodTypeDef,
172
+ unknown
173
+ > = z.union([z.string(), z.number().int(), z.boolean()]);
174
+
175
+ /** @internal */
176
+ export type CustomerStateSubscriptionMetadata$Outbound =
177
+ | string
178
+ | number
179
+ | boolean;
180
+
181
+ /** @internal */
182
+ export const CustomerStateSubscriptionMetadata$outboundSchema: z.ZodType<
183
+ CustomerStateSubscriptionMetadata$Outbound,
184
+ z.ZodTypeDef,
185
+ CustomerStateSubscriptionMetadata
186
+ > = z.union([z.string(), z.number().int(), z.boolean()]);
187
+
188
+ /**
189
+ * @internal
190
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
191
+ */
192
+ export namespace CustomerStateSubscriptionMetadata$ {
193
+ /** @deprecated use `CustomerStateSubscriptionMetadata$inboundSchema` instead. */
194
+ export const inboundSchema = CustomerStateSubscriptionMetadata$inboundSchema;
195
+ /** @deprecated use `CustomerStateSubscriptionMetadata$outboundSchema` instead. */
196
+ export const outboundSchema =
197
+ CustomerStateSubscriptionMetadata$outboundSchema;
198
+ /** @deprecated use `CustomerStateSubscriptionMetadata$Outbound` instead. */
199
+ export type Outbound = CustomerStateSubscriptionMetadata$Outbound;
200
+ }
201
+
202
+ export function customerStateSubscriptionMetadataToJSON(
203
+ customerStateSubscriptionMetadata: CustomerStateSubscriptionMetadata,
204
+ ): string {
205
+ return JSON.stringify(
206
+ CustomerStateSubscriptionMetadata$outboundSchema.parse(
207
+ customerStateSubscriptionMetadata,
208
+ ),
209
+ );
210
+ }
211
+
212
+ export function customerStateSubscriptionMetadataFromJSON(
213
+ jsonString: string,
214
+ ): SafeParseResult<CustomerStateSubscriptionMetadata, SDKValidationError> {
215
+ return safeParse(
216
+ jsonString,
217
+ (x) => CustomerStateSubscriptionMetadata$inboundSchema.parse(JSON.parse(x)),
218
+ `Failed to parse 'CustomerStateSubscriptionMetadata' from JSON`,
219
+ );
220
+ }
221
+
222
+ /** @internal */
223
+ export const CustomerStateSubscription$inboundSchema: z.ZodType<
224
+ CustomerStateSubscription,
225
+ z.ZodTypeDef,
226
+ unknown
227
+ > = z.object({
228
+ id: z.string(),
229
+ created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
230
+ modified_at: z.nullable(
231
+ z.string().datetime({ offset: true }).transform(v => new Date(v)),
232
+ ),
233
+ custom_field_data: z.record(
234
+ z.nullable(
235
+ z.union([
236
+ z.string(),
237
+ z.number().int(),
238
+ z.boolean(),
239
+ z.string().datetime({ offset: true }).transform(v => new Date(v)),
240
+ ]),
241
+ ),
242
+ ).optional(),
243
+ metadata: z.record(z.union([z.string(), z.number().int(), z.boolean()])),
244
+ status: z.literal("active").optional(),
245
+ amount: z.nullable(z.number().int()),
246
+ currency: z.nullable(z.string()),
247
+ recurring_interval: SubscriptionRecurringInterval$inboundSchema,
248
+ current_period_start: z.string().datetime({ offset: true }).transform(v =>
249
+ new Date(v)
250
+ ),
251
+ current_period_end: z.nullable(
252
+ z.string().datetime({ offset: true }).transform(v => new Date(v)),
253
+ ),
254
+ cancel_at_period_end: z.boolean(),
255
+ canceled_at: z.nullable(
256
+ z.string().datetime({ offset: true }).transform(v => new Date(v)),
257
+ ),
258
+ started_at: z.nullable(
259
+ z.string().datetime({ offset: true }).transform(v => new Date(v)),
260
+ ),
261
+ ends_at: z.nullable(
262
+ z.string().datetime({ offset: true }).transform(v => new Date(v)),
263
+ ),
264
+ product_id: z.string(),
265
+ price_id: z.string(),
266
+ discount_id: z.nullable(z.string()),
267
+ }).transform((v) => {
268
+ return remap$(v, {
269
+ "created_at": "createdAt",
270
+ "modified_at": "modifiedAt",
271
+ "custom_field_data": "customFieldData",
272
+ "recurring_interval": "recurringInterval",
273
+ "current_period_start": "currentPeriodStart",
274
+ "current_period_end": "currentPeriodEnd",
275
+ "cancel_at_period_end": "cancelAtPeriodEnd",
276
+ "canceled_at": "canceledAt",
277
+ "started_at": "startedAt",
278
+ "ends_at": "endsAt",
279
+ "product_id": "productId",
280
+ "price_id": "priceId",
281
+ "discount_id": "discountId",
282
+ });
283
+ });
284
+
285
+ /** @internal */
286
+ export type CustomerStateSubscription$Outbound = {
287
+ id: string;
288
+ created_at: string;
289
+ modified_at: string | null;
290
+ custom_field_data?:
291
+ | { [k: string]: string | number | boolean | string | null }
292
+ | undefined;
293
+ metadata: { [k: string]: string | number | boolean };
294
+ status: "active";
295
+ amount: number | null;
296
+ currency: string | null;
297
+ recurring_interval: string;
298
+ current_period_start: string;
299
+ current_period_end: string | null;
300
+ cancel_at_period_end: boolean;
301
+ canceled_at: string | null;
302
+ started_at: string | null;
303
+ ends_at: string | null;
304
+ product_id: string;
305
+ price_id: string;
306
+ discount_id: string | null;
307
+ };
308
+
309
+ /** @internal */
310
+ export const CustomerStateSubscription$outboundSchema: z.ZodType<
311
+ CustomerStateSubscription$Outbound,
312
+ z.ZodTypeDef,
313
+ CustomerStateSubscription
314
+ > = z.object({
315
+ id: z.string(),
316
+ createdAt: z.date().transform(v => v.toISOString()),
317
+ modifiedAt: z.nullable(z.date().transform(v => v.toISOString())),
318
+ customFieldData: z.record(
319
+ z.nullable(
320
+ z.union([
321
+ z.string(),
322
+ z.number().int(),
323
+ z.boolean(),
324
+ z.date().transform(v => v.toISOString()),
325
+ ]),
326
+ ),
327
+ ).optional(),
328
+ metadata: z.record(z.union([z.string(), z.number().int(), z.boolean()])),
329
+ status: z.literal("active").default("active" as const),
330
+ amount: z.nullable(z.number().int()),
331
+ currency: z.nullable(z.string()),
332
+ recurringInterval: SubscriptionRecurringInterval$outboundSchema,
333
+ currentPeriodStart: z.date().transform(v => v.toISOString()),
334
+ currentPeriodEnd: z.nullable(z.date().transform(v => v.toISOString())),
335
+ cancelAtPeriodEnd: z.boolean(),
336
+ canceledAt: z.nullable(z.date().transform(v => v.toISOString())),
337
+ startedAt: z.nullable(z.date().transform(v => v.toISOString())),
338
+ endsAt: z.nullable(z.date().transform(v => v.toISOString())),
339
+ productId: z.string(),
340
+ priceId: z.string(),
341
+ discountId: z.nullable(z.string()),
342
+ }).transform((v) => {
343
+ return remap$(v, {
344
+ createdAt: "created_at",
345
+ modifiedAt: "modified_at",
346
+ customFieldData: "custom_field_data",
347
+ recurringInterval: "recurring_interval",
348
+ currentPeriodStart: "current_period_start",
349
+ currentPeriodEnd: "current_period_end",
350
+ cancelAtPeriodEnd: "cancel_at_period_end",
351
+ canceledAt: "canceled_at",
352
+ startedAt: "started_at",
353
+ endsAt: "ends_at",
354
+ productId: "product_id",
355
+ priceId: "price_id",
356
+ discountId: "discount_id",
357
+ });
358
+ });
359
+
360
+ /**
361
+ * @internal
362
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
363
+ */
364
+ export namespace CustomerStateSubscription$ {
365
+ /** @deprecated use `CustomerStateSubscription$inboundSchema` instead. */
366
+ export const inboundSchema = CustomerStateSubscription$inboundSchema;
367
+ /** @deprecated use `CustomerStateSubscription$outboundSchema` instead. */
368
+ export const outboundSchema = CustomerStateSubscription$outboundSchema;
369
+ /** @deprecated use `CustomerStateSubscription$Outbound` instead. */
370
+ export type Outbound = CustomerStateSubscription$Outbound;
371
+ }
372
+
373
+ export function customerStateSubscriptionToJSON(
374
+ customerStateSubscription: CustomerStateSubscription,
375
+ ): string {
376
+ return JSON.stringify(
377
+ CustomerStateSubscription$outboundSchema.parse(customerStateSubscription),
378
+ );
379
+ }
380
+
381
+ export function customerStateSubscriptionFromJSON(
382
+ jsonString: string,
383
+ ): SafeParseResult<CustomerStateSubscription, SDKValidationError> {
384
+ return safeParse(
385
+ jsonString,
386
+ (x) => CustomerStateSubscription$inboundSchema.parse(JSON.parse(x)),
387
+ `Failed to parse 'CustomerStateSubscription' from JSON`,
388
+ );
389
+ }
@@ -56,7 +56,13 @@ export type CustomerSubscription = {
56
56
  * The ID of the object.
57
57
  */
58
58
  id: string;
59
+ /**
60
+ * The amount of the subscription.
61
+ */
59
62
  amount: number | null;
63
+ /**
64
+ * The currency of the subscription.
65
+ */
60
66
  currency: string | null;
61
67
  recurringInterval: SubscriptionRecurringInterval;
62
68
  status: SubscriptionStatus;
@@ -70,6 +76,9 @@ export type CustomerSubscription = {
70
76
  customerId: string;
71
77
  productId: string;
72
78
  priceId: string;
79
+ /**
80
+ * The ID of the applied discount, if any.
81
+ */
73
82
  discountId: string | null;
74
83
  checkoutId: string | null;
75
84
  customerCancellationReason: CustomerCancellationReason | null;
@@ -33,6 +33,9 @@ export type CustomerUpdate = {
33
33
  * The email address of the customer. This must be unique within the organization.
34
34
  */
35
35
  email?: string | null | undefined;
36
+ /**
37
+ * The name of the customer.
38
+ */
36
39
  name?: string | null | undefined;
37
40
  billingAddress?: Address | null | undefined;
38
41
  taxId?: Array<string | TaxIDFormat | null> | null | undefined;
@@ -24,6 +24,10 @@ export type LicenseKeyCustomerMetadata = string | number | boolean;
24
24
  export type TaxId = string | TaxIDFormat;
25
25
 
26
26
  export type LicenseKeyCustomer = {
27
+ /**
28
+ * The ID of the customer.
29
+ */
30
+ id: string;
27
31
  /**
28
32
  * Creation timestamp of the object.
29
33
  */
@@ -32,10 +36,6 @@ export type LicenseKeyCustomer = {
32
36
  * Last modification timestamp of the object.
33
37
  */
34
38
  modifiedAt: Date | null;
35
- /**
36
- * The ID of the object.
37
- */
38
- id: string;
39
39
  metadata: { [k: string]: string | number | boolean };
40
40
  /**
41
41
  * The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated.
@@ -49,9 +49,15 @@ export type LicenseKeyCustomer = {
49
49
  * Whether the customer email address is verified. The address is automatically verified when the customer accesses the customer portal using their email address.
50
50
  */
51
51
  emailVerified: boolean;
52
+ /**
53
+ * The name of the customer.
54
+ */
52
55
  name: string | null;
53
56
  billingAddress: Address | null;
54
57
  taxId: Array<string | TaxIDFormat | null> | null;
58
+ /**
59
+ * The ID of the organization owning the customer.
60
+ */
55
61
  organizationId: string;
56
62
  avatarUrl: string;
57
63
  };
@@ -151,11 +157,11 @@ export const LicenseKeyCustomer$inboundSchema: z.ZodType<
151
157
  z.ZodTypeDef,
152
158
  unknown
153
159
  > = z.object({
160
+ id: z.string(),
154
161
  created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
155
162
  modified_at: z.nullable(
156
163
  z.string().datetime({ offset: true }).transform(v => new Date(v)),
157
164
  ),
158
- id: z.string(),
159
165
  metadata: z.record(z.union([z.string(), z.number().int(), z.boolean()])),
160
166
  external_id: z.nullable(z.string()),
161
167
  email: z.string(),
@@ -182,9 +188,9 @@ export const LicenseKeyCustomer$inboundSchema: z.ZodType<
182
188
 
183
189
  /** @internal */
184
190
  export type LicenseKeyCustomer$Outbound = {
191
+ id: string;
185
192
  created_at: string;
186
193
  modified_at: string | null;
187
- id: string;
188
194
  metadata: { [k: string]: string | number | boolean };
189
195
  external_id: string | null;
190
196
  email: string;
@@ -202,9 +208,9 @@ export const LicenseKeyCustomer$outboundSchema: z.ZodType<
202
208
  z.ZodTypeDef,
203
209
  LicenseKeyCustomer
204
210
  > = z.object({
211
+ id: z.string(),
205
212
  createdAt: z.date().transform(v => v.toISOString()),
206
213
  modifiedAt: z.nullable(z.date().transform(v => v.toISOString())),
207
- id: z.string(),
208
214
  metadata: z.record(z.union([z.string(), z.number().int(), z.boolean()])),
209
215
  externalId: z.nullable(z.string()),
210
216
  email: z.string(),
@@ -24,6 +24,10 @@ export type OrderCustomerMetadata = string | number | boolean;
24
24
  export type OrderCustomerTaxId = string | TaxIDFormat;
25
25
 
26
26
  export type OrderCustomer = {
27
+ /**
28
+ * The ID of the customer.
29
+ */
30
+ id: string;
27
31
  /**
28
32
  * Creation timestamp of the object.
29
33
  */
@@ -32,10 +36,6 @@ export type OrderCustomer = {
32
36
  * Last modification timestamp of the object.
33
37
  */
34
38
  modifiedAt: Date | null;
35
- /**
36
- * The ID of the object.
37
- */
38
- id: string;
39
39
  metadata: { [k: string]: string | number | boolean };
40
40
  /**
41
41
  * The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated.
@@ -49,9 +49,15 @@ export type OrderCustomer = {
49
49
  * Whether the customer email address is verified. The address is automatically verified when the customer accesses the customer portal using their email address.
50
50
  */
51
51
  emailVerified: boolean;
52
+ /**
53
+ * The name of the customer.
54
+ */
52
55
  name: string | null;
53
56
  billingAddress: Address | null;
54
57
  taxId: Array<string | TaxIDFormat | null> | null;
58
+ /**
59
+ * The ID of the organization owning the customer.
60
+ */
55
61
  organizationId: string;
56
62
  avatarUrl: string;
57
63
  };
@@ -158,11 +164,11 @@ export const OrderCustomer$inboundSchema: z.ZodType<
158
164
  z.ZodTypeDef,
159
165
  unknown
160
166
  > = z.object({
167
+ id: z.string(),
161
168
  created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
162
169
  modified_at: z.nullable(
163
170
  z.string().datetime({ offset: true }).transform(v => new Date(v)),
164
171
  ),
165
- id: z.string(),
166
172
  metadata: z.record(z.union([z.string(), z.number().int(), z.boolean()])),
167
173
  external_id: z.nullable(z.string()),
168
174
  email: z.string(),
@@ -189,9 +195,9 @@ export const OrderCustomer$inboundSchema: z.ZodType<
189
195
 
190
196
  /** @internal */
191
197
  export type OrderCustomer$Outbound = {
198
+ id: string;
192
199
  created_at: string;
193
200
  modified_at: string | null;
194
- id: string;
195
201
  metadata: { [k: string]: string | number | boolean };
196
202
  external_id: string | null;
197
203
  email: string;
@@ -209,9 +215,9 @@ export const OrderCustomer$outboundSchema: z.ZodType<
209
215
  z.ZodTypeDef,
210
216
  OrderCustomer
211
217
  > = z.object({
218
+ id: z.string(),
212
219
  createdAt: z.date().transform(v => v.toISOString()),
213
220
  modifiedAt: z.nullable(z.date().transform(v => v.toISOString())),
214
- id: z.string(),
215
221
  metadata: z.record(z.union([z.string(), z.number().int(), z.boolean()])),
216
222
  externalId: z.nullable(z.string()),
217
223
  email: z.string(),
@@ -39,20 +39,59 @@ export type OrderSubscription = {
39
39
  * The ID of the object.
40
40
  */
41
41
  id: string;
42
+ /**
43
+ * The amount of the subscription.
44
+ */
42
45
  amount: number | null;
46
+ /**
47
+ * The currency of the subscription.
48
+ */
43
49
  currency: string | null;
44
50
  recurringInterval: SubscriptionRecurringInterval;
45
51
  status: SubscriptionStatus;
52
+ /**
53
+ * The start timestamp of the current billing period.
54
+ */
46
55
  currentPeriodStart: Date;
56
+ /**
57
+ * The end timestamp of the current billing period.
58
+ */
47
59
  currentPeriodEnd: Date | null;
60
+ /**
61
+ * Whether the subscription will be canceled at the end of the current period.
62
+ */
48
63
  cancelAtPeriodEnd: boolean;
64
+ /**
65
+ * The timestamp when the subscription was canceled. The subscription might still be active if `cancel_at_period_end` is `true`.
66
+ */
49
67
  canceledAt: Date | null;
68
+ /**
69
+ * The timestamp when the subscription started.
70
+ */
50
71
  startedAt: Date | null;
72
+ /**
73
+ * The timestamp when the subscription will end.
74
+ */
51
75
  endsAt: Date | null;
76
+ /**
77
+ * The timestamp when the subscription ended.
78
+ */
52
79
  endedAt: Date | null;
80
+ /**
81
+ * The ID of the subscribed customer.
82
+ */
53
83
  customerId: string;
84
+ /**
85
+ * The ID of the subscribed product.
86
+ */
54
87
  productId: string;
88
+ /**
89
+ * The ID of the subscribed price.
90
+ */
55
91
  priceId: string;
92
+ /**
93
+ * The ID of the applied discount, if any.
94
+ */
56
95
  discountId: string | null;
57
96
  checkoutId: string | null;
58
97
  customerCancellationReason: CustomerCancellationReason | null;
@@ -102,20 +102,59 @@ export type Subscription = {
102
102
  * The ID of the object.
103
103
  */
104
104
  id: string;
105
+ /**
106
+ * The amount of the subscription.
107
+ */
105
108
  amount: number | null;
109
+ /**
110
+ * The currency of the subscription.
111
+ */
106
112
  currency: string | null;
107
113
  recurringInterval: SubscriptionRecurringInterval;
108
114
  status: SubscriptionStatus;
115
+ /**
116
+ * The start timestamp of the current billing period.
117
+ */
109
118
  currentPeriodStart: Date;
119
+ /**
120
+ * The end timestamp of the current billing period.
121
+ */
110
122
  currentPeriodEnd: Date | null;
123
+ /**
124
+ * Whether the subscription will be canceled at the end of the current period.
125
+ */
111
126
  cancelAtPeriodEnd: boolean;
127
+ /**
128
+ * The timestamp when the subscription was canceled. The subscription might still be active if `cancel_at_period_end` is `true`.
129
+ */
112
130
  canceledAt: Date | null;
131
+ /**
132
+ * The timestamp when the subscription started.
133
+ */
113
134
  startedAt: Date | null;
135
+ /**
136
+ * The timestamp when the subscription will end.
137
+ */
114
138
  endsAt: Date | null;
139
+ /**
140
+ * The timestamp when the subscription ended.
141
+ */
115
142
  endedAt: Date | null;
143
+ /**
144
+ * The ID of the subscribed customer.
145
+ */
116
146
  customerId: string;
147
+ /**
148
+ * The ID of the subscribed product.
149
+ */
117
150
  productId: string;
151
+ /**
152
+ * The ID of the subscribed price.
153
+ */
118
154
  priceId: string;
155
+ /**
156
+ * The ID of the applied discount, if any.
157
+ */
119
158
  discountId: string | null;
120
159
  checkoutId: string | null;
121
160
  customerCancellationReason: CustomerCancellationReason | null;