@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
@@ -24,6 +24,10 @@ export type SubscriptionCustomerMetadata = string | number | boolean;
24
24
  export type SubscriptionCustomerTaxId = string | TaxIDFormat;
25
25
 
26
26
  export type SubscriptionCustomer = {
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 SubscriptionCustomer = {
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 SubscriptionCustomer = {
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
  };
@@ -160,11 +166,11 @@ export const SubscriptionCustomer$inboundSchema: z.ZodType<
160
166
  z.ZodTypeDef,
161
167
  unknown
162
168
  > = z.object({
169
+ id: z.string(),
163
170
  created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
164
171
  modified_at: z.nullable(
165
172
  z.string().datetime({ offset: true }).transform(v => new Date(v)),
166
173
  ),
167
- id: z.string(),
168
174
  metadata: z.record(z.union([z.string(), z.number().int(), z.boolean()])),
169
175
  external_id: z.nullable(z.string()),
170
176
  email: z.string(),
@@ -191,9 +197,9 @@ export const SubscriptionCustomer$inboundSchema: z.ZodType<
191
197
 
192
198
  /** @internal */
193
199
  export type SubscriptionCustomer$Outbound = {
200
+ id: string;
194
201
  created_at: string;
195
202
  modified_at: string | null;
196
- id: string;
197
203
  metadata: { [k: string]: string | number | boolean };
198
204
  external_id: string | null;
199
205
  email: string;
@@ -211,9 +217,9 @@ export const SubscriptionCustomer$outboundSchema: z.ZodType<
211
217
  z.ZodTypeDef,
212
218
  SubscriptionCustomer
213
219
  > = z.object({
220
+ id: z.string(),
214
221
  createdAt: z.date().transform(v => v.toISOString()),
215
222
  modifiedAt: z.nullable(z.date().transform(v => v.toISOString())),
216
- id: z.string(),
217
223
  metadata: z.record(z.union([z.string(), z.number().int(), z.boolean()])),
218
224
  externalId: z.nullable(z.string()),
219
225
  email: z.string(),
@@ -0,0 +1,93 @@
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
+ import {
10
+ Customer,
11
+ Customer$inboundSchema,
12
+ Customer$Outbound,
13
+ Customer$outboundSchema,
14
+ } from "./customer.js";
15
+
16
+ /**
17
+ * Sent when a new customer is created.
18
+ *
19
+ * @remarks
20
+ *
21
+ * A customer can be created:
22
+ *
23
+ * * After a successful checkout.
24
+ * * Programmatically via the API.
25
+ *
26
+ * **Discord & Slack support:** Basic
27
+ */
28
+ export type WebhookCustomerCreatedPayload = {
29
+ type?: "customer.created" | undefined;
30
+ /**
31
+ * A customer in an organization.
32
+ */
33
+ data: Customer;
34
+ };
35
+
36
+ /** @internal */
37
+ export const WebhookCustomerCreatedPayload$inboundSchema: z.ZodType<
38
+ WebhookCustomerCreatedPayload,
39
+ z.ZodTypeDef,
40
+ unknown
41
+ > = z.object({
42
+ type: z.literal("customer.created").optional(),
43
+ data: Customer$inboundSchema,
44
+ });
45
+
46
+ /** @internal */
47
+ export type WebhookCustomerCreatedPayload$Outbound = {
48
+ type: "customer.created";
49
+ data: Customer$Outbound;
50
+ };
51
+
52
+ /** @internal */
53
+ export const WebhookCustomerCreatedPayload$outboundSchema: z.ZodType<
54
+ WebhookCustomerCreatedPayload$Outbound,
55
+ z.ZodTypeDef,
56
+ WebhookCustomerCreatedPayload
57
+ > = z.object({
58
+ type: z.literal("customer.created").default("customer.created" as const),
59
+ data: Customer$outboundSchema,
60
+ });
61
+
62
+ /**
63
+ * @internal
64
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
65
+ */
66
+ export namespace WebhookCustomerCreatedPayload$ {
67
+ /** @deprecated use `WebhookCustomerCreatedPayload$inboundSchema` instead. */
68
+ export const inboundSchema = WebhookCustomerCreatedPayload$inboundSchema;
69
+ /** @deprecated use `WebhookCustomerCreatedPayload$outboundSchema` instead. */
70
+ export const outboundSchema = WebhookCustomerCreatedPayload$outboundSchema;
71
+ /** @deprecated use `WebhookCustomerCreatedPayload$Outbound` instead. */
72
+ export type Outbound = WebhookCustomerCreatedPayload$Outbound;
73
+ }
74
+
75
+ export function webhookCustomerCreatedPayloadToJSON(
76
+ webhookCustomerCreatedPayload: WebhookCustomerCreatedPayload,
77
+ ): string {
78
+ return JSON.stringify(
79
+ WebhookCustomerCreatedPayload$outboundSchema.parse(
80
+ webhookCustomerCreatedPayload,
81
+ ),
82
+ );
83
+ }
84
+
85
+ export function webhookCustomerCreatedPayloadFromJSON(
86
+ jsonString: string,
87
+ ): SafeParseResult<WebhookCustomerCreatedPayload, SDKValidationError> {
88
+ return safeParse(
89
+ jsonString,
90
+ (x) => WebhookCustomerCreatedPayload$inboundSchema.parse(JSON.parse(x)),
91
+ `Failed to parse 'WebhookCustomerCreatedPayload' from JSON`,
92
+ );
93
+ }
@@ -0,0 +1,88 @@
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
+ import {
10
+ Customer,
11
+ Customer$inboundSchema,
12
+ Customer$Outbound,
13
+ Customer$outboundSchema,
14
+ } from "./customer.js";
15
+
16
+ /**
17
+ * Sent when a customer is deleted.
18
+ *
19
+ * @remarks
20
+ *
21
+ * **Discord & Slack support:** Basic
22
+ */
23
+ export type WebhookCustomerDeletedPayload = {
24
+ type?: "customer.deleted" | undefined;
25
+ /**
26
+ * A customer in an organization.
27
+ */
28
+ data: Customer;
29
+ };
30
+
31
+ /** @internal */
32
+ export const WebhookCustomerDeletedPayload$inboundSchema: z.ZodType<
33
+ WebhookCustomerDeletedPayload,
34
+ z.ZodTypeDef,
35
+ unknown
36
+ > = z.object({
37
+ type: z.literal("customer.deleted").optional(),
38
+ data: Customer$inboundSchema,
39
+ });
40
+
41
+ /** @internal */
42
+ export type WebhookCustomerDeletedPayload$Outbound = {
43
+ type: "customer.deleted";
44
+ data: Customer$Outbound;
45
+ };
46
+
47
+ /** @internal */
48
+ export const WebhookCustomerDeletedPayload$outboundSchema: z.ZodType<
49
+ WebhookCustomerDeletedPayload$Outbound,
50
+ z.ZodTypeDef,
51
+ WebhookCustomerDeletedPayload
52
+ > = z.object({
53
+ type: z.literal("customer.deleted").default("customer.deleted" as const),
54
+ data: Customer$outboundSchema,
55
+ });
56
+
57
+ /**
58
+ * @internal
59
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
60
+ */
61
+ export namespace WebhookCustomerDeletedPayload$ {
62
+ /** @deprecated use `WebhookCustomerDeletedPayload$inboundSchema` instead. */
63
+ export const inboundSchema = WebhookCustomerDeletedPayload$inboundSchema;
64
+ /** @deprecated use `WebhookCustomerDeletedPayload$outboundSchema` instead. */
65
+ export const outboundSchema = WebhookCustomerDeletedPayload$outboundSchema;
66
+ /** @deprecated use `WebhookCustomerDeletedPayload$Outbound` instead. */
67
+ export type Outbound = WebhookCustomerDeletedPayload$Outbound;
68
+ }
69
+
70
+ export function webhookCustomerDeletedPayloadToJSON(
71
+ webhookCustomerDeletedPayload: WebhookCustomerDeletedPayload,
72
+ ): string {
73
+ return JSON.stringify(
74
+ WebhookCustomerDeletedPayload$outboundSchema.parse(
75
+ webhookCustomerDeletedPayload,
76
+ ),
77
+ );
78
+ }
79
+
80
+ export function webhookCustomerDeletedPayloadFromJSON(
81
+ jsonString: string,
82
+ ): SafeParseResult<WebhookCustomerDeletedPayload, SDKValidationError> {
83
+ return safeParse(
84
+ jsonString,
85
+ (x) => WebhookCustomerDeletedPayload$inboundSchema.parse(JSON.parse(x)),
86
+ `Failed to parse 'WebhookCustomerDeletedPayload' from JSON`,
87
+ );
88
+ }
@@ -0,0 +1,103 @@
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
+ import {
10
+ CustomerState,
11
+ CustomerState$inboundSchema,
12
+ CustomerState$Outbound,
13
+ CustomerState$outboundSchema,
14
+ } from "./customerstate.js";
15
+
16
+ /**
17
+ * Sent when a customer state has changed.
18
+ *
19
+ * @remarks
20
+ *
21
+ * It's triggered when:
22
+ *
23
+ * * Customer is created, updated or deleted.
24
+ * * A subscription is created or updated.
25
+ * * A benefit is granted or revoked.
26
+ *
27
+ * **Discord & Slack support:** Basic
28
+ */
29
+ export type WebhookCustomerStateChangedPayload = {
30
+ type?: "customer.state_changed" | undefined;
31
+ /**
32
+ * A customer along with additional state information:
33
+ *
34
+ * @remarks
35
+ *
36
+ * * Active subscriptions
37
+ * * Active benefits
38
+ */
39
+ data: CustomerState;
40
+ };
41
+
42
+ /** @internal */
43
+ export const WebhookCustomerStateChangedPayload$inboundSchema: z.ZodType<
44
+ WebhookCustomerStateChangedPayload,
45
+ z.ZodTypeDef,
46
+ unknown
47
+ > = z.object({
48
+ type: z.literal("customer.state_changed").optional(),
49
+ data: CustomerState$inboundSchema,
50
+ });
51
+
52
+ /** @internal */
53
+ export type WebhookCustomerStateChangedPayload$Outbound = {
54
+ type: "customer.state_changed";
55
+ data: CustomerState$Outbound;
56
+ };
57
+
58
+ /** @internal */
59
+ export const WebhookCustomerStateChangedPayload$outboundSchema: z.ZodType<
60
+ WebhookCustomerStateChangedPayload$Outbound,
61
+ z.ZodTypeDef,
62
+ WebhookCustomerStateChangedPayload
63
+ > = z.object({
64
+ type: z.literal("customer.state_changed").default(
65
+ "customer.state_changed" as const,
66
+ ),
67
+ data: CustomerState$outboundSchema,
68
+ });
69
+
70
+ /**
71
+ * @internal
72
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
73
+ */
74
+ export namespace WebhookCustomerStateChangedPayload$ {
75
+ /** @deprecated use `WebhookCustomerStateChangedPayload$inboundSchema` instead. */
76
+ export const inboundSchema = WebhookCustomerStateChangedPayload$inboundSchema;
77
+ /** @deprecated use `WebhookCustomerStateChangedPayload$outboundSchema` instead. */
78
+ export const outboundSchema =
79
+ WebhookCustomerStateChangedPayload$outboundSchema;
80
+ /** @deprecated use `WebhookCustomerStateChangedPayload$Outbound` instead. */
81
+ export type Outbound = WebhookCustomerStateChangedPayload$Outbound;
82
+ }
83
+
84
+ export function webhookCustomerStateChangedPayloadToJSON(
85
+ webhookCustomerStateChangedPayload: WebhookCustomerStateChangedPayload,
86
+ ): string {
87
+ return JSON.stringify(
88
+ WebhookCustomerStateChangedPayload$outboundSchema.parse(
89
+ webhookCustomerStateChangedPayload,
90
+ ),
91
+ );
92
+ }
93
+
94
+ export function webhookCustomerStateChangedPayloadFromJSON(
95
+ jsonString: string,
96
+ ): SafeParseResult<WebhookCustomerStateChangedPayload, SDKValidationError> {
97
+ return safeParse(
98
+ jsonString,
99
+ (x) =>
100
+ WebhookCustomerStateChangedPayload$inboundSchema.parse(JSON.parse(x)),
101
+ `Failed to parse 'WebhookCustomerStateChangedPayload' from JSON`,
102
+ );
103
+ }
@@ -0,0 +1,92 @@
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
+ import {
10
+ Customer,
11
+ Customer$inboundSchema,
12
+ Customer$Outbound,
13
+ Customer$outboundSchema,
14
+ } from "./customer.js";
15
+
16
+ /**
17
+ * Sent when a customer is updated.
18
+ *
19
+ * @remarks
20
+ *
21
+ * This event is fired when the customer details are updated.
22
+ *
23
+ * If you want to be notified when a customer subscription or benefit state changes, you should listen to the `customer_state_changed` event.
24
+ *
25
+ * **Discord & Slack support:** Basic
26
+ */
27
+ export type WebhookCustomerUpdatedPayload = {
28
+ type?: "customer.updated" | undefined;
29
+ /**
30
+ * A customer in an organization.
31
+ */
32
+ data: Customer;
33
+ };
34
+
35
+ /** @internal */
36
+ export const WebhookCustomerUpdatedPayload$inboundSchema: z.ZodType<
37
+ WebhookCustomerUpdatedPayload,
38
+ z.ZodTypeDef,
39
+ unknown
40
+ > = z.object({
41
+ type: z.literal("customer.updated").optional(),
42
+ data: Customer$inboundSchema,
43
+ });
44
+
45
+ /** @internal */
46
+ export type WebhookCustomerUpdatedPayload$Outbound = {
47
+ type: "customer.updated";
48
+ data: Customer$Outbound;
49
+ };
50
+
51
+ /** @internal */
52
+ export const WebhookCustomerUpdatedPayload$outboundSchema: z.ZodType<
53
+ WebhookCustomerUpdatedPayload$Outbound,
54
+ z.ZodTypeDef,
55
+ WebhookCustomerUpdatedPayload
56
+ > = z.object({
57
+ type: z.literal("customer.updated").default("customer.updated" as const),
58
+ data: Customer$outboundSchema,
59
+ });
60
+
61
+ /**
62
+ * @internal
63
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
64
+ */
65
+ export namespace WebhookCustomerUpdatedPayload$ {
66
+ /** @deprecated use `WebhookCustomerUpdatedPayload$inboundSchema` instead. */
67
+ export const inboundSchema = WebhookCustomerUpdatedPayload$inboundSchema;
68
+ /** @deprecated use `WebhookCustomerUpdatedPayload$outboundSchema` instead. */
69
+ export const outboundSchema = WebhookCustomerUpdatedPayload$outboundSchema;
70
+ /** @deprecated use `WebhookCustomerUpdatedPayload$Outbound` instead. */
71
+ export type Outbound = WebhookCustomerUpdatedPayload$Outbound;
72
+ }
73
+
74
+ export function webhookCustomerUpdatedPayloadToJSON(
75
+ webhookCustomerUpdatedPayload: WebhookCustomerUpdatedPayload,
76
+ ): string {
77
+ return JSON.stringify(
78
+ WebhookCustomerUpdatedPayload$outboundSchema.parse(
79
+ webhookCustomerUpdatedPayload,
80
+ ),
81
+ );
82
+ }
83
+
84
+ export function webhookCustomerUpdatedPayloadFromJSON(
85
+ jsonString: string,
86
+ ): SafeParseResult<WebhookCustomerUpdatedPayload, SDKValidationError> {
87
+ return safeParse(
88
+ jsonString,
89
+ (x) => WebhookCustomerUpdatedPayload$inboundSchema.parse(JSON.parse(x)),
90
+ `Failed to parse 'WebhookCustomerUpdatedPayload' from JSON`,
91
+ );
92
+ }
@@ -18,6 +18,13 @@ import {
18
18
  *
19
19
  * @remarks
20
20
  *
21
+ * A new order is created when:
22
+ *
23
+ * * A customer purchases a one-time product. In this case, `billing_reason` is set to `purchase`.
24
+ * * A customer starts a subscription. In this case, `billing_reason` is set to `subscription_create`.
25
+ * * A subscription is renewed. In this case, `billing_reason` is set to `subscription_cycle`.
26
+ * * A subscription is upgraded, downgraded or revoked with an immediate proration invoice. In this case, `billing_reason` is set to `subscription_update`.
27
+ *
21
28
  * **Discord & Slack support:** Full
22
29
  */
23
30
  export type WebhookOrderCreatedPayload = {
@@ -18,6 +18,8 @@ import {
18
18
  *
19
19
  * @remarks
20
20
  *
21
+ * When this event occurs, the subscription `status` might not be `active` yet, as we can still have to wait for the first payment to be processed.
22
+ *
21
23
  * **Discord & Slack support:** Full
22
24
  */
23
25
  export type WebhookSubscriptionCreatedPayload = {
@@ -0,0 +1,69 @@
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
+ export type CustomersGetStateRequest = {
11
+ /**
12
+ * The customer ID.
13
+ */
14
+ id: string;
15
+ };
16
+
17
+ /** @internal */
18
+ export const CustomersGetStateRequest$inboundSchema: z.ZodType<
19
+ CustomersGetStateRequest,
20
+ z.ZodTypeDef,
21
+ unknown
22
+ > = z.object({
23
+ id: z.string(),
24
+ });
25
+
26
+ /** @internal */
27
+ export type CustomersGetStateRequest$Outbound = {
28
+ id: string;
29
+ };
30
+
31
+ /** @internal */
32
+ export const CustomersGetStateRequest$outboundSchema: z.ZodType<
33
+ CustomersGetStateRequest$Outbound,
34
+ z.ZodTypeDef,
35
+ CustomersGetStateRequest
36
+ > = z.object({
37
+ id: z.string(),
38
+ });
39
+
40
+ /**
41
+ * @internal
42
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
43
+ */
44
+ export namespace CustomersGetStateRequest$ {
45
+ /** @deprecated use `CustomersGetStateRequest$inboundSchema` instead. */
46
+ export const inboundSchema = CustomersGetStateRequest$inboundSchema;
47
+ /** @deprecated use `CustomersGetStateRequest$outboundSchema` instead. */
48
+ export const outboundSchema = CustomersGetStateRequest$outboundSchema;
49
+ /** @deprecated use `CustomersGetStateRequest$Outbound` instead. */
50
+ export type Outbound = CustomersGetStateRequest$Outbound;
51
+ }
52
+
53
+ export function customersGetStateRequestToJSON(
54
+ customersGetStateRequest: CustomersGetStateRequest,
55
+ ): string {
56
+ return JSON.stringify(
57
+ CustomersGetStateRequest$outboundSchema.parse(customersGetStateRequest),
58
+ );
59
+ }
60
+
61
+ export function customersGetStateRequestFromJSON(
62
+ jsonString: string,
63
+ ): SafeParseResult<CustomersGetStateRequest, SDKValidationError> {
64
+ return safeParse(
65
+ jsonString,
66
+ (x) => CustomersGetStateRequest$inboundSchema.parse(JSON.parse(x)),
67
+ `Failed to parse 'CustomersGetStateRequest' from JSON`,
68
+ );
69
+ }
@@ -0,0 +1,80 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+
11
+ export type CustomersGetStateExternalRequest = {
12
+ /**
13
+ * The customer external ID.
14
+ */
15
+ externalId: string;
16
+ };
17
+
18
+ /** @internal */
19
+ export const CustomersGetStateExternalRequest$inboundSchema: z.ZodType<
20
+ CustomersGetStateExternalRequest,
21
+ z.ZodTypeDef,
22
+ unknown
23
+ > = z.object({
24
+ external_id: z.string(),
25
+ }).transform((v) => {
26
+ return remap$(v, {
27
+ "external_id": "externalId",
28
+ });
29
+ });
30
+
31
+ /** @internal */
32
+ export type CustomersGetStateExternalRequest$Outbound = {
33
+ external_id: string;
34
+ };
35
+
36
+ /** @internal */
37
+ export const CustomersGetStateExternalRequest$outboundSchema: z.ZodType<
38
+ CustomersGetStateExternalRequest$Outbound,
39
+ z.ZodTypeDef,
40
+ CustomersGetStateExternalRequest
41
+ > = z.object({
42
+ externalId: z.string(),
43
+ }).transform((v) => {
44
+ return remap$(v, {
45
+ externalId: "external_id",
46
+ });
47
+ });
48
+
49
+ /**
50
+ * @internal
51
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
52
+ */
53
+ export namespace CustomersGetStateExternalRequest$ {
54
+ /** @deprecated use `CustomersGetStateExternalRequest$inboundSchema` instead. */
55
+ export const inboundSchema = CustomersGetStateExternalRequest$inboundSchema;
56
+ /** @deprecated use `CustomersGetStateExternalRequest$outboundSchema` instead. */
57
+ export const outboundSchema = CustomersGetStateExternalRequest$outboundSchema;
58
+ /** @deprecated use `CustomersGetStateExternalRequest$Outbound` instead. */
59
+ export type Outbound = CustomersGetStateExternalRequest$Outbound;
60
+ }
61
+
62
+ export function customersGetStateExternalRequestToJSON(
63
+ customersGetStateExternalRequest: CustomersGetStateExternalRequest,
64
+ ): string {
65
+ return JSON.stringify(
66
+ CustomersGetStateExternalRequest$outboundSchema.parse(
67
+ customersGetStateExternalRequest,
68
+ ),
69
+ );
70
+ }
71
+
72
+ export function customersGetStateExternalRequestFromJSON(
73
+ jsonString: string,
74
+ ): SafeParseResult<CustomersGetStateExternalRequest, SDKValidationError> {
75
+ return safeParse(
76
+ jsonString,
77
+ (x) => CustomersGetStateExternalRequest$inboundSchema.parse(JSON.parse(x)),
78
+ `Failed to parse 'CustomersGetStateExternalRequest' from JSON`,
79
+ );
80
+ }
@@ -7,16 +7,21 @@ import { customersDelete } from "../funcs/customersDelete.js";
7
7
  import { customersDeleteExternal } from "../funcs/customersDeleteExternal.js";
8
8
  import { customersGet } from "../funcs/customersGet.js";
9
9
  import { customersGetExternal } from "../funcs/customersGetExternal.js";
10
+ import { customersGetState } from "../funcs/customersGetState.js";
11
+ import { customersGetStateExternal } from "../funcs/customersGetStateExternal.js";
10
12
  import { customersList } from "../funcs/customersList.js";
11
13
  import { customersUpdate } from "../funcs/customersUpdate.js";
12
14
  import { customersUpdateExternal } from "../funcs/customersUpdateExternal.js";
13
15
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
14
16
  import { Customer } from "../models/components/customer.js";
15
17
  import { CustomerCreate } from "../models/components/customercreate.js";
18
+ import { CustomerState } from "../models/components/customerstate.js";
16
19
  import { CustomersDeleteRequest } from "../models/operations/customersdelete.js";
17
20
  import { CustomersDeleteExternalRequest } from "../models/operations/customersdeleteexternal.js";
18
21
  import { CustomersGetRequest } from "../models/operations/customersget.js";
19
22
  import { CustomersGetExternalRequest } from "../models/operations/customersgetexternal.js";
23
+ import { CustomersGetStateRequest } from "../models/operations/customersgetstate.js";
24
+ import { CustomersGetStateExternalRequest } from "../models/operations/customersgetstateexternal.js";
20
25
  import {
21
26
  CustomersListRequest,
22
27
  CustomersListResponse,
@@ -182,4 +187,54 @@ export class Customers extends ClientSDK {
182
187
  options,
183
188
  ));
184
189
  }
190
+
191
+ /**
192
+ * Get Customer State
193
+ *
194
+ * @remarks
195
+ * Get a customer state by ID.
196
+ *
197
+ * The customer state includes information about
198
+ * the customer's active subscriptions and benefits.
199
+ *
200
+ * It's the ideal endpoint to use when you need to get a full overview
201
+ * of a customer's status.
202
+ *
203
+ * **Scopes**: `customers:read` `customers:write`
204
+ */
205
+ async getState(
206
+ request: CustomersGetStateRequest,
207
+ options?: RequestOptions,
208
+ ): Promise<CustomerState> {
209
+ return unwrapAsync(customersGetState(
210
+ this,
211
+ request,
212
+ options,
213
+ ));
214
+ }
215
+
216
+ /**
217
+ * Get Customer State by External ID
218
+ *
219
+ * @remarks
220
+ * Get a customer state by external ID.
221
+ *
222
+ * The customer state includes information about
223
+ * the customer's active subscriptions and benefits.
224
+ *
225
+ * It's the ideal endpoint to use when you need to get a full overview
226
+ * of a customer's status.
227
+ *
228
+ * **Scopes**: `customers:read` `customers:write`
229
+ */
230
+ async getStateExternal(
231
+ request: CustomersGetStateExternalRequest,
232
+ options?: RequestOptions,
233
+ ): Promise<CustomerState> {
234
+ return unwrapAsync(customersGetStateExternal(
235
+ this,
236
+ request,
237
+ options,
238
+ ));
239
+ }
185
240
  }