@polar-sh/sdk 0.35.1 → 0.35.3

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 (225) hide show
  1. package/README.md +25 -23
  2. package/bin/mcp-server.js +806 -635
  3. package/bin/mcp-server.js.map +15 -11
  4. package/dist/commonjs/funcs/customerPortalCustomersAddPaymentMethod.d.ts +2 -2
  5. package/dist/commonjs/funcs/customerPortalCustomersAddPaymentMethod.d.ts.map +1 -1
  6. package/dist/commonjs/funcs/customerPortalCustomersAddPaymentMethod.js +2 -2
  7. package/dist/commonjs/funcs/customerPortalCustomersAddPaymentMethod.js.map +1 -1
  8. package/dist/commonjs/funcs/customerPortalCustomersConfirmPaymentMethod.d.ts +23 -0
  9. package/dist/commonjs/funcs/customerPortalCustomersConfirmPaymentMethod.d.ts.map +1 -0
  10. package/dist/commonjs/funcs/customerPortalCustomersConfirmPaymentMethod.js +126 -0
  11. package/dist/commonjs/funcs/customerPortalCustomersConfirmPaymentMethod.js.map +1 -0
  12. package/dist/commonjs/funcs/customersGetBalance.d.ts +22 -0
  13. package/dist/commonjs/funcs/customersGetBalance.d.ts.map +1 -0
  14. package/dist/commonjs/funcs/customersGetBalance.js +127 -0
  15. package/dist/commonjs/funcs/customersGetBalance.js.map +1 -0
  16. package/dist/commonjs/funcs/metersQuantities.js +1 -0
  17. package/dist/commonjs/funcs/metersQuantities.js.map +1 -1
  18. package/dist/commonjs/lib/config.d.ts +3 -3
  19. package/dist/commonjs/lib/config.js +3 -3
  20. package/dist/commonjs/lib/config.js.map +1 -1
  21. package/dist/commonjs/lib/url.js +1 -1
  22. package/dist/commonjs/lib/url.js.map +1 -1
  23. package/dist/commonjs/mcp-server/mcp-server.js +1 -1
  24. package/dist/commonjs/mcp-server/server.d.ts.map +1 -1
  25. package/dist/commonjs/mcp-server/server.js +3 -1
  26. package/dist/commonjs/mcp-server/server.js.map +1 -1
  27. package/dist/commonjs/mcp-server/tools/customersGetBalance.d.ts +7 -0
  28. package/dist/commonjs/mcp-server/tools/customersGetBalance.d.ts.map +1 -0
  29. package/dist/commonjs/mcp-server/tools/customersGetBalance.js +34 -0
  30. package/dist/commonjs/mcp-server/tools/customersGetBalance.js.map +1 -0
  31. package/dist/commonjs/models/components/address.d.ts +664 -664
  32. package/dist/commonjs/models/components/address.js +221 -221
  33. package/dist/commonjs/models/components/addressinput.d.ts +650 -650
  34. package/dist/commonjs/models/components/addressinput.js +216 -216
  35. package/dist/commonjs/models/components/aggregationfunction.d.ts +40 -0
  36. package/dist/commonjs/models/components/aggregationfunction.d.ts.map +1 -0
  37. package/dist/commonjs/models/components/aggregationfunction.js +64 -0
  38. package/dist/commonjs/models/components/aggregationfunction.js.map +1 -0
  39. package/dist/commonjs/models/components/customerbalance.d.ts +40 -0
  40. package/dist/commonjs/models/components/customerbalance.d.ts.map +1 -0
  41. package/dist/commonjs/models/components/customerbalance.js +71 -0
  42. package/dist/commonjs/models/components/customerbalance.js.map +1 -0
  43. package/dist/commonjs/models/components/customerorder.d.ts +5 -0
  44. package/dist/commonjs/models/components/customerorder.d.ts.map +1 -1
  45. package/dist/commonjs/models/components/customerorder.js +4 -0
  46. package/dist/commonjs/models/components/customerorder.js.map +1 -1
  47. package/dist/commonjs/models/components/customerpaymentmethodconfirm.d.ts +31 -0
  48. package/dist/commonjs/models/components/customerpaymentmethodconfirm.d.ts.map +1 -0
  49. package/dist/commonjs/models/components/customerpaymentmethodconfirm.js +82 -0
  50. package/dist/commonjs/models/components/customerpaymentmethodconfirm.js.map +1 -0
  51. package/dist/commonjs/models/components/customerpaymentmethodcreaterequiresactionresponse.d.ts +31 -0
  52. package/dist/commonjs/models/components/customerpaymentmethodcreaterequiresactionresponse.d.ts.map +1 -0
  53. package/dist/commonjs/models/components/customerpaymentmethodcreaterequiresactionresponse.js +80 -0
  54. package/dist/commonjs/models/components/customerpaymentmethodcreaterequiresactionresponse.js.map +1 -0
  55. package/dist/commonjs/models/components/customerpaymentmethodcreateresponse.d.ts +35 -0
  56. package/dist/commonjs/models/components/customerpaymentmethodcreateresponse.d.ts.map +1 -0
  57. package/dist/commonjs/models/components/customerpaymentmethodcreateresponse.js +81 -0
  58. package/dist/commonjs/models/components/customerpaymentmethodcreateresponse.js.map +1 -0
  59. package/dist/commonjs/models/components/customerpaymentmethodcreatesucceededresponse.d.ts +32 -0
  60. package/dist/commonjs/models/components/customerpaymentmethodcreatesucceededresponse.d.ts.map +1 -0
  61. package/dist/commonjs/models/components/customerpaymentmethodcreatesucceededresponse.js +81 -0
  62. package/dist/commonjs/models/components/customerpaymentmethodcreatesucceededresponse.js.map +1 -0
  63. package/dist/commonjs/models/components/customerstatesubscription.d.ts +38 -2
  64. package/dist/commonjs/models/components/customerstatesubscription.d.ts.map +1 -1
  65. package/dist/commonjs/models/components/customerstatesubscription.js +30 -3
  66. package/dist/commonjs/models/components/customerstatesubscription.js.map +1 -1
  67. package/dist/commonjs/models/components/customersubscription.d.ts +5 -0
  68. package/dist/commonjs/models/components/customersubscription.d.ts.map +1 -1
  69. package/dist/commonjs/models/components/customersubscription.js +4 -0
  70. package/dist/commonjs/models/components/customersubscription.js.map +1 -1
  71. package/dist/commonjs/models/components/order.d.ts +5 -0
  72. package/dist/commonjs/models/components/order.d.ts.map +1 -1
  73. package/dist/commonjs/models/components/order.js +4 -0
  74. package/dist/commonjs/models/components/order.js.map +1 -1
  75. package/dist/commonjs/models/errors/customernotready.d.ts +39 -0
  76. package/dist/commonjs/models/errors/customernotready.d.ts.map +1 -0
  77. package/dist/commonjs/models/errors/customernotready.js +88 -0
  78. package/dist/commonjs/models/errors/customernotready.js.map +1 -0
  79. package/dist/commonjs/models/operations/customerportalcustomersconfirmpaymentmethod.d.ts +29 -0
  80. package/dist/commonjs/models/operations/customerportalcustomersconfirmpaymentmethod.d.ts.map +1 -0
  81. package/dist/commonjs/models/operations/customerportalcustomersconfirmpaymentmethod.js +78 -0
  82. package/dist/commonjs/models/operations/customerportalcustomersconfirmpaymentmethod.js.map +1 -0
  83. package/dist/commonjs/models/operations/customersgetbalance.d.ts +32 -0
  84. package/dist/commonjs/models/operations/customersgetbalance.d.ts.map +1 -0
  85. package/dist/commonjs/models/operations/customersgetbalance.js +69 -0
  86. package/dist/commonjs/models/operations/customersgetbalance.js.map +1 -0
  87. package/dist/commonjs/models/operations/metersquantities.d.ts +6 -0
  88. package/dist/commonjs/models/operations/metersquantities.d.ts.map +1 -1
  89. package/dist/commonjs/models/operations/metersquantities.js +7 -0
  90. package/dist/commonjs/models/operations/metersquantities.js.map +1 -1
  91. package/dist/commonjs/sdk/customers.d.ts +11 -0
  92. package/dist/commonjs/sdk/customers.d.ts.map +1 -1
  93. package/dist/commonjs/sdk/customers.js +12 -0
  94. package/dist/commonjs/sdk/customers.js.map +1 -1
  95. package/dist/commonjs/sdk/polarcustomers.d.ts +13 -2
  96. package/dist/commonjs/sdk/polarcustomers.d.ts.map +1 -1
  97. package/dist/commonjs/sdk/polarcustomers.js +12 -0
  98. package/dist/commonjs/sdk/polarcustomers.js.map +1 -1
  99. package/dist/esm/funcs/customerPortalCustomersAddPaymentMethod.d.ts +2 -2
  100. package/dist/esm/funcs/customerPortalCustomersAddPaymentMethod.d.ts.map +1 -1
  101. package/dist/esm/funcs/customerPortalCustomersAddPaymentMethod.js +2 -2
  102. package/dist/esm/funcs/customerPortalCustomersAddPaymentMethod.js.map +1 -1
  103. package/dist/esm/funcs/customerPortalCustomersConfirmPaymentMethod.d.ts +23 -0
  104. package/dist/esm/funcs/customerPortalCustomersConfirmPaymentMethod.d.ts.map +1 -0
  105. package/dist/esm/funcs/customerPortalCustomersConfirmPaymentMethod.js +90 -0
  106. package/dist/esm/funcs/customerPortalCustomersConfirmPaymentMethod.js.map +1 -0
  107. package/dist/esm/funcs/customersGetBalance.d.ts +22 -0
  108. package/dist/esm/funcs/customersGetBalance.d.ts.map +1 -0
  109. package/dist/esm/funcs/customersGetBalance.js +91 -0
  110. package/dist/esm/funcs/customersGetBalance.js.map +1 -0
  111. package/dist/esm/funcs/metersQuantities.js +1 -0
  112. package/dist/esm/funcs/metersQuantities.js.map +1 -1
  113. package/dist/esm/lib/config.d.ts +3 -3
  114. package/dist/esm/lib/config.js +3 -3
  115. package/dist/esm/lib/config.js.map +1 -1
  116. package/dist/esm/lib/url.js +1 -1
  117. package/dist/esm/lib/url.js.map +1 -1
  118. package/dist/esm/mcp-server/mcp-server.js +1 -1
  119. package/dist/esm/mcp-server/server.d.ts.map +1 -1
  120. package/dist/esm/mcp-server/server.js +3 -1
  121. package/dist/esm/mcp-server/server.js.map +1 -1
  122. package/dist/esm/mcp-server/tools/customersGetBalance.d.ts +7 -0
  123. package/dist/esm/mcp-server/tools/customersGetBalance.d.ts.map +1 -0
  124. package/dist/esm/mcp-server/tools/customersGetBalance.js +31 -0
  125. package/dist/esm/mcp-server/tools/customersGetBalance.js.map +1 -0
  126. package/dist/esm/models/components/address.d.ts +664 -664
  127. package/dist/esm/models/components/address.js +221 -221
  128. package/dist/esm/models/components/addressinput.d.ts +650 -650
  129. package/dist/esm/models/components/addressinput.js +216 -216
  130. package/dist/esm/models/components/aggregationfunction.d.ts +40 -0
  131. package/dist/esm/models/components/aggregationfunction.d.ts.map +1 -0
  132. package/dist/esm/models/components/aggregationfunction.js +28 -0
  133. package/dist/esm/models/components/aggregationfunction.js.map +1 -0
  134. package/dist/esm/models/components/customerbalance.d.ts +40 -0
  135. package/dist/esm/models/components/customerbalance.d.ts.map +1 -0
  136. package/dist/esm/models/components/customerbalance.js +33 -0
  137. package/dist/esm/models/components/customerbalance.js.map +1 -0
  138. package/dist/esm/models/components/customerorder.d.ts +5 -0
  139. package/dist/esm/models/components/customerorder.d.ts.map +1 -1
  140. package/dist/esm/models/components/customerorder.js +4 -0
  141. package/dist/esm/models/components/customerorder.js.map +1 -1
  142. package/dist/esm/models/components/customerpaymentmethodconfirm.d.ts +31 -0
  143. package/dist/esm/models/components/customerpaymentmethodconfirm.d.ts.map +1 -0
  144. package/dist/esm/models/components/customerpaymentmethodconfirm.js +44 -0
  145. package/dist/esm/models/components/customerpaymentmethodconfirm.js.map +1 -0
  146. package/dist/esm/models/components/customerpaymentmethodcreaterequiresactionresponse.d.ts +31 -0
  147. package/dist/esm/models/components/customerpaymentmethodcreaterequiresactionresponse.d.ts.map +1 -0
  148. package/dist/esm/models/components/customerpaymentmethodcreaterequiresactionresponse.js +42 -0
  149. package/dist/esm/models/components/customerpaymentmethodcreaterequiresactionresponse.js.map +1 -0
  150. package/dist/esm/models/components/customerpaymentmethodcreateresponse.d.ts +35 -0
  151. package/dist/esm/models/components/customerpaymentmethodcreateresponse.d.ts.map +1 -0
  152. package/dist/esm/models/components/customerpaymentmethodcreateresponse.js +43 -0
  153. package/dist/esm/models/components/customerpaymentmethodcreateresponse.js.map +1 -0
  154. package/dist/esm/models/components/customerpaymentmethodcreatesucceededresponse.d.ts +32 -0
  155. package/dist/esm/models/components/customerpaymentmethodcreatesucceededresponse.d.ts.map +1 -0
  156. package/dist/esm/models/components/customerpaymentmethodcreatesucceededresponse.js +43 -0
  157. package/dist/esm/models/components/customerpaymentmethodcreatesucceededresponse.js.map +1 -0
  158. package/dist/esm/models/components/customerstatesubscription.d.ts +38 -2
  159. package/dist/esm/models/components/customerstatesubscription.d.ts.map +1 -1
  160. package/dist/esm/models/components/customerstatesubscription.js +29 -2
  161. package/dist/esm/models/components/customerstatesubscription.js.map +1 -1
  162. package/dist/esm/models/components/customersubscription.d.ts +5 -0
  163. package/dist/esm/models/components/customersubscription.d.ts.map +1 -1
  164. package/dist/esm/models/components/customersubscription.js +4 -0
  165. package/dist/esm/models/components/customersubscription.js.map +1 -1
  166. package/dist/esm/models/components/order.d.ts +5 -0
  167. package/dist/esm/models/components/order.d.ts.map +1 -1
  168. package/dist/esm/models/components/order.js +4 -0
  169. package/dist/esm/models/components/order.js.map +1 -1
  170. package/dist/esm/models/errors/customernotready.d.ts +39 -0
  171. package/dist/esm/models/errors/customernotready.d.ts.map +1 -0
  172. package/dist/esm/models/errors/customernotready.js +51 -0
  173. package/dist/esm/models/errors/customernotready.js.map +1 -0
  174. package/dist/esm/models/operations/customerportalcustomersconfirmpaymentmethod.d.ts +29 -0
  175. package/dist/esm/models/operations/customerportalcustomersconfirmpaymentmethod.d.ts.map +1 -0
  176. package/dist/esm/models/operations/customerportalcustomersconfirmpaymentmethod.js +40 -0
  177. package/dist/esm/models/operations/customerportalcustomersconfirmpaymentmethod.js.map +1 -0
  178. package/dist/esm/models/operations/customersgetbalance.d.ts +32 -0
  179. package/dist/esm/models/operations/customersgetbalance.d.ts.map +1 -0
  180. package/dist/esm/models/operations/customersgetbalance.js +31 -0
  181. package/dist/esm/models/operations/customersgetbalance.js.map +1 -0
  182. package/dist/esm/models/operations/metersquantities.d.ts +6 -0
  183. package/dist/esm/models/operations/metersquantities.d.ts.map +1 -1
  184. package/dist/esm/models/operations/metersquantities.js +7 -0
  185. package/dist/esm/models/operations/metersquantities.js.map +1 -1
  186. package/dist/esm/sdk/customers.d.ts +11 -0
  187. package/dist/esm/sdk/customers.d.ts.map +1 -1
  188. package/dist/esm/sdk/customers.js +12 -0
  189. package/dist/esm/sdk/customers.js.map +1 -1
  190. package/dist/esm/sdk/polarcustomers.d.ts +13 -2
  191. package/dist/esm/sdk/polarcustomers.d.ts.map +1 -1
  192. package/dist/esm/sdk/polarcustomers.js +12 -0
  193. package/dist/esm/sdk/polarcustomers.js.map +1 -1
  194. package/docs/sdks/customers/README.md +78 -0
  195. package/docs/sdks/polarcustomers/README.md +82 -1
  196. package/examples/package-lock.json +1 -1
  197. package/jsr.json +1 -1
  198. package/package.json +1 -1
  199. package/src/funcs/customerPortalCustomersAddPaymentMethod.ts +8 -8
  200. package/src/funcs/customerPortalCustomersConfirmPaymentMethod.ts +201 -0
  201. package/src/funcs/customersGetBalance.ts +195 -0
  202. package/src/funcs/metersQuantities.ts +1 -0
  203. package/src/lib/config.ts +3 -3
  204. package/src/lib/url.ts +1 -1
  205. package/src/mcp-server/mcp-server.ts +1 -1
  206. package/src/mcp-server/server.ts +3 -1
  207. package/src/mcp-server/tools/customersGetBalance.ts +40 -0
  208. package/src/models/components/address.ts +221 -221
  209. package/src/models/components/addressinput.ts +216 -216
  210. package/src/models/components/aggregationfunction.ts +37 -0
  211. package/src/models/components/customerbalance.ts +77 -0
  212. package/src/models/components/customerorder.ts +9 -0
  213. package/src/models/components/customerpaymentmethodconfirm.ts +83 -0
  214. package/src/models/components/customerpaymentmethodcreaterequiresactionresponse.ts +93 -0
  215. package/src/models/components/customerpaymentmethodcreateresponse.ts +107 -0
  216. package/src/models/components/customerpaymentmethodcreatesucceededresponse.ts +98 -0
  217. package/src/models/components/customerstatesubscription.ts +56 -4
  218. package/src/models/components/customersubscription.ts +9 -0
  219. package/src/models/components/order.ts +9 -0
  220. package/src/models/errors/customernotready.ts +85 -0
  221. package/src/models/operations/customerportalcustomersconfirmpaymentmethod.ts +89 -0
  222. package/src/models/operations/customersgetbalance.ts +69 -0
  223. package/src/models/operations/metersquantities.ts +16 -0
  224. package/src/sdk/customers.ts +22 -0
  225. package/src/sdk/polarcustomers.ts +26 -2
@@ -0,0 +1,83 @@
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 CustomerPaymentMethodConfirm = {
12
+ setupIntentId: string;
13
+ setDefault: boolean;
14
+ };
15
+
16
+ /** @internal */
17
+ export const CustomerPaymentMethodConfirm$inboundSchema: z.ZodType<
18
+ CustomerPaymentMethodConfirm,
19
+ z.ZodTypeDef,
20
+ unknown
21
+ > = z.object({
22
+ setup_intent_id: z.string(),
23
+ set_default: z.boolean(),
24
+ }).transform((v) => {
25
+ return remap$(v, {
26
+ "setup_intent_id": "setupIntentId",
27
+ "set_default": "setDefault",
28
+ });
29
+ });
30
+
31
+ /** @internal */
32
+ export type CustomerPaymentMethodConfirm$Outbound = {
33
+ setup_intent_id: string;
34
+ set_default: boolean;
35
+ };
36
+
37
+ /** @internal */
38
+ export const CustomerPaymentMethodConfirm$outboundSchema: z.ZodType<
39
+ CustomerPaymentMethodConfirm$Outbound,
40
+ z.ZodTypeDef,
41
+ CustomerPaymentMethodConfirm
42
+ > = z.object({
43
+ setupIntentId: z.string(),
44
+ setDefault: z.boolean(),
45
+ }).transform((v) => {
46
+ return remap$(v, {
47
+ setupIntentId: "setup_intent_id",
48
+ setDefault: "set_default",
49
+ });
50
+ });
51
+
52
+ /**
53
+ * @internal
54
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
55
+ */
56
+ export namespace CustomerPaymentMethodConfirm$ {
57
+ /** @deprecated use `CustomerPaymentMethodConfirm$inboundSchema` instead. */
58
+ export const inboundSchema = CustomerPaymentMethodConfirm$inboundSchema;
59
+ /** @deprecated use `CustomerPaymentMethodConfirm$outboundSchema` instead. */
60
+ export const outboundSchema = CustomerPaymentMethodConfirm$outboundSchema;
61
+ /** @deprecated use `CustomerPaymentMethodConfirm$Outbound` instead. */
62
+ export type Outbound = CustomerPaymentMethodConfirm$Outbound;
63
+ }
64
+
65
+ export function customerPaymentMethodConfirmToJSON(
66
+ customerPaymentMethodConfirm: CustomerPaymentMethodConfirm,
67
+ ): string {
68
+ return JSON.stringify(
69
+ CustomerPaymentMethodConfirm$outboundSchema.parse(
70
+ customerPaymentMethodConfirm,
71
+ ),
72
+ );
73
+ }
74
+
75
+ export function customerPaymentMethodConfirmFromJSON(
76
+ jsonString: string,
77
+ ): SafeParseResult<CustomerPaymentMethodConfirm, SDKValidationError> {
78
+ return safeParse(
79
+ jsonString,
80
+ (x) => CustomerPaymentMethodConfirm$inboundSchema.parse(JSON.parse(x)),
81
+ `Failed to parse 'CustomerPaymentMethodConfirm' from JSON`,
82
+ );
83
+ }
@@ -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 { 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 CustomerPaymentMethodCreateRequiresActionResponse = {
12
+ status: "requires_action";
13
+ clientSecret: string;
14
+ };
15
+
16
+ /** @internal */
17
+ export const CustomerPaymentMethodCreateRequiresActionResponse$inboundSchema:
18
+ z.ZodType<
19
+ CustomerPaymentMethodCreateRequiresActionResponse,
20
+ z.ZodTypeDef,
21
+ unknown
22
+ > = z.object({
23
+ status: z.literal("requires_action"),
24
+ client_secret: z.string(),
25
+ }).transform((v) => {
26
+ return remap$(v, {
27
+ "client_secret": "clientSecret",
28
+ });
29
+ });
30
+
31
+ /** @internal */
32
+ export type CustomerPaymentMethodCreateRequiresActionResponse$Outbound = {
33
+ status: "requires_action";
34
+ client_secret: string;
35
+ };
36
+
37
+ /** @internal */
38
+ export const CustomerPaymentMethodCreateRequiresActionResponse$outboundSchema:
39
+ z.ZodType<
40
+ CustomerPaymentMethodCreateRequiresActionResponse$Outbound,
41
+ z.ZodTypeDef,
42
+ CustomerPaymentMethodCreateRequiresActionResponse
43
+ > = z.object({
44
+ status: z.literal("requires_action"),
45
+ clientSecret: z.string(),
46
+ }).transform((v) => {
47
+ return remap$(v, {
48
+ clientSecret: "client_secret",
49
+ });
50
+ });
51
+
52
+ /**
53
+ * @internal
54
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
55
+ */
56
+ export namespace CustomerPaymentMethodCreateRequiresActionResponse$ {
57
+ /** @deprecated use `CustomerPaymentMethodCreateRequiresActionResponse$inboundSchema` instead. */
58
+ export const inboundSchema =
59
+ CustomerPaymentMethodCreateRequiresActionResponse$inboundSchema;
60
+ /** @deprecated use `CustomerPaymentMethodCreateRequiresActionResponse$outboundSchema` instead. */
61
+ export const outboundSchema =
62
+ CustomerPaymentMethodCreateRequiresActionResponse$outboundSchema;
63
+ /** @deprecated use `CustomerPaymentMethodCreateRequiresActionResponse$Outbound` instead. */
64
+ export type Outbound =
65
+ CustomerPaymentMethodCreateRequiresActionResponse$Outbound;
66
+ }
67
+
68
+ export function customerPaymentMethodCreateRequiresActionResponseToJSON(
69
+ customerPaymentMethodCreateRequiresActionResponse:
70
+ CustomerPaymentMethodCreateRequiresActionResponse,
71
+ ): string {
72
+ return JSON.stringify(
73
+ CustomerPaymentMethodCreateRequiresActionResponse$outboundSchema.parse(
74
+ customerPaymentMethodCreateRequiresActionResponse,
75
+ ),
76
+ );
77
+ }
78
+
79
+ export function customerPaymentMethodCreateRequiresActionResponseFromJSON(
80
+ jsonString: string,
81
+ ): SafeParseResult<
82
+ CustomerPaymentMethodCreateRequiresActionResponse,
83
+ SDKValidationError
84
+ > {
85
+ return safeParse(
86
+ jsonString,
87
+ (x) =>
88
+ CustomerPaymentMethodCreateRequiresActionResponse$inboundSchema.parse(
89
+ JSON.parse(x),
90
+ ),
91
+ `Failed to parse 'CustomerPaymentMethodCreateRequiresActionResponse' from JSON`,
92
+ );
93
+ }
@@ -0,0 +1,107 @@
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
+ CustomerPaymentMethodCreateRequiresActionResponse,
11
+ CustomerPaymentMethodCreateRequiresActionResponse$inboundSchema,
12
+ CustomerPaymentMethodCreateRequiresActionResponse$Outbound,
13
+ CustomerPaymentMethodCreateRequiresActionResponse$outboundSchema,
14
+ } from "./customerpaymentmethodcreaterequiresactionresponse.js";
15
+ import {
16
+ CustomerPaymentMethodCreateSucceededResponse,
17
+ CustomerPaymentMethodCreateSucceededResponse$inboundSchema,
18
+ CustomerPaymentMethodCreateSucceededResponse$Outbound,
19
+ CustomerPaymentMethodCreateSucceededResponse$outboundSchema,
20
+ } from "./customerpaymentmethodcreatesucceededresponse.js";
21
+
22
+ export type CustomerPaymentMethodCreateResponse =
23
+ | (CustomerPaymentMethodCreateRequiresActionResponse & {
24
+ status: "requires_action";
25
+ })
26
+ | (CustomerPaymentMethodCreateSucceededResponse & { status: "succeeded" });
27
+
28
+ /** @internal */
29
+ export const CustomerPaymentMethodCreateResponse$inboundSchema: z.ZodType<
30
+ CustomerPaymentMethodCreateResponse,
31
+ z.ZodTypeDef,
32
+ unknown
33
+ > = z.union([
34
+ CustomerPaymentMethodCreateRequiresActionResponse$inboundSchema.and(
35
+ z.object({ status: z.literal("requires_action") }).transform((v) => ({
36
+ status: v.status,
37
+ })),
38
+ ),
39
+ CustomerPaymentMethodCreateSucceededResponse$inboundSchema.and(
40
+ z.object({ status: z.literal("succeeded") }).transform((v) => ({
41
+ status: v.status,
42
+ })),
43
+ ),
44
+ ]);
45
+
46
+ /** @internal */
47
+ export type CustomerPaymentMethodCreateResponse$Outbound =
48
+ | (CustomerPaymentMethodCreateRequiresActionResponse$Outbound & {
49
+ status: "requires_action";
50
+ })
51
+ | (CustomerPaymentMethodCreateSucceededResponse$Outbound & {
52
+ status: "succeeded";
53
+ });
54
+
55
+ /** @internal */
56
+ export const CustomerPaymentMethodCreateResponse$outboundSchema: z.ZodType<
57
+ CustomerPaymentMethodCreateResponse$Outbound,
58
+ z.ZodTypeDef,
59
+ CustomerPaymentMethodCreateResponse
60
+ > = z.union([
61
+ CustomerPaymentMethodCreateRequiresActionResponse$outboundSchema.and(
62
+ z.object({ status: z.literal("requires_action") }).transform((v) => ({
63
+ status: v.status,
64
+ })),
65
+ ),
66
+ CustomerPaymentMethodCreateSucceededResponse$outboundSchema.and(
67
+ z.object({ status: z.literal("succeeded") }).transform((v) => ({
68
+ status: v.status,
69
+ })),
70
+ ),
71
+ ]);
72
+
73
+ /**
74
+ * @internal
75
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
76
+ */
77
+ export namespace CustomerPaymentMethodCreateResponse$ {
78
+ /** @deprecated use `CustomerPaymentMethodCreateResponse$inboundSchema` instead. */
79
+ export const inboundSchema =
80
+ CustomerPaymentMethodCreateResponse$inboundSchema;
81
+ /** @deprecated use `CustomerPaymentMethodCreateResponse$outboundSchema` instead. */
82
+ export const outboundSchema =
83
+ CustomerPaymentMethodCreateResponse$outboundSchema;
84
+ /** @deprecated use `CustomerPaymentMethodCreateResponse$Outbound` instead. */
85
+ export type Outbound = CustomerPaymentMethodCreateResponse$Outbound;
86
+ }
87
+
88
+ export function customerPaymentMethodCreateResponseToJSON(
89
+ customerPaymentMethodCreateResponse: CustomerPaymentMethodCreateResponse,
90
+ ): string {
91
+ return JSON.stringify(
92
+ CustomerPaymentMethodCreateResponse$outboundSchema.parse(
93
+ customerPaymentMethodCreateResponse,
94
+ ),
95
+ );
96
+ }
97
+
98
+ export function customerPaymentMethodCreateResponseFromJSON(
99
+ jsonString: string,
100
+ ): SafeParseResult<CustomerPaymentMethodCreateResponse, SDKValidationError> {
101
+ return safeParse(
102
+ jsonString,
103
+ (x) =>
104
+ CustomerPaymentMethodCreateResponse$inboundSchema.parse(JSON.parse(x)),
105
+ `Failed to parse 'CustomerPaymentMethodCreateResponse' from JSON`,
106
+ );
107
+ }
@@ -0,0 +1,98 @@
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
+ CustomerPaymentMethod,
12
+ CustomerPaymentMethod$inboundSchema,
13
+ CustomerPaymentMethod$Outbound,
14
+ CustomerPaymentMethod$outboundSchema,
15
+ } from "./customerpaymentmethod.js";
16
+
17
+ export type CustomerPaymentMethodCreateSucceededResponse = {
18
+ status: "succeeded";
19
+ paymentMethod: CustomerPaymentMethod;
20
+ };
21
+
22
+ /** @internal */
23
+ export const CustomerPaymentMethodCreateSucceededResponse$inboundSchema:
24
+ z.ZodType<
25
+ CustomerPaymentMethodCreateSucceededResponse,
26
+ z.ZodTypeDef,
27
+ unknown
28
+ > = z.object({
29
+ status: z.literal("succeeded"),
30
+ payment_method: CustomerPaymentMethod$inboundSchema,
31
+ }).transform((v) => {
32
+ return remap$(v, {
33
+ "payment_method": "paymentMethod",
34
+ });
35
+ });
36
+
37
+ /** @internal */
38
+ export type CustomerPaymentMethodCreateSucceededResponse$Outbound = {
39
+ status: "succeeded";
40
+ payment_method: CustomerPaymentMethod$Outbound;
41
+ };
42
+
43
+ /** @internal */
44
+ export const CustomerPaymentMethodCreateSucceededResponse$outboundSchema:
45
+ z.ZodType<
46
+ CustomerPaymentMethodCreateSucceededResponse$Outbound,
47
+ z.ZodTypeDef,
48
+ CustomerPaymentMethodCreateSucceededResponse
49
+ > = z.object({
50
+ status: z.literal("succeeded"),
51
+ paymentMethod: CustomerPaymentMethod$outboundSchema,
52
+ }).transform((v) => {
53
+ return remap$(v, {
54
+ paymentMethod: "payment_method",
55
+ });
56
+ });
57
+
58
+ /**
59
+ * @internal
60
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
61
+ */
62
+ export namespace CustomerPaymentMethodCreateSucceededResponse$ {
63
+ /** @deprecated use `CustomerPaymentMethodCreateSucceededResponse$inboundSchema` instead. */
64
+ export const inboundSchema =
65
+ CustomerPaymentMethodCreateSucceededResponse$inboundSchema;
66
+ /** @deprecated use `CustomerPaymentMethodCreateSucceededResponse$outboundSchema` instead. */
67
+ export const outboundSchema =
68
+ CustomerPaymentMethodCreateSucceededResponse$outboundSchema;
69
+ /** @deprecated use `CustomerPaymentMethodCreateSucceededResponse$Outbound` instead. */
70
+ export type Outbound = CustomerPaymentMethodCreateSucceededResponse$Outbound;
71
+ }
72
+
73
+ export function customerPaymentMethodCreateSucceededResponseToJSON(
74
+ customerPaymentMethodCreateSucceededResponse:
75
+ CustomerPaymentMethodCreateSucceededResponse,
76
+ ): string {
77
+ return JSON.stringify(
78
+ CustomerPaymentMethodCreateSucceededResponse$outboundSchema.parse(
79
+ customerPaymentMethodCreateSucceededResponse,
80
+ ),
81
+ );
82
+ }
83
+
84
+ export function customerPaymentMethodCreateSucceededResponseFromJSON(
85
+ jsonString: string,
86
+ ): SafeParseResult<
87
+ CustomerPaymentMethodCreateSucceededResponse,
88
+ SDKValidationError
89
+ > {
90
+ return safeParse(
91
+ jsonString,
92
+ (x) =>
93
+ CustomerPaymentMethodCreateSucceededResponse$inboundSchema.parse(
94
+ JSON.parse(x),
95
+ ),
96
+ `Failed to parse 'CustomerPaymentMethodCreateSucceededResponse' from JSON`,
97
+ );
98
+ }
@@ -5,6 +5,7 @@
5
5
  import * as z from "zod";
6
6
  import { remap as remap$ } from "../../lib/primitives.js";
7
7
  import { safeParse } from "../../lib/schemas.js";
8
+ import { ClosedEnum } from "../../types/enums.js";
8
9
  import { Result as SafeParseResult } from "../../types/fp.js";
9
10
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
11
  import {
@@ -31,6 +32,14 @@ export type CustomerStateSubscriptionMetadata =
31
32
  | number
32
33
  | boolean;
33
34
 
35
+ export const CustomerStateSubscriptionStatus = {
36
+ Active: "active",
37
+ Trialing: "trialing",
38
+ } as const;
39
+ export type CustomerStateSubscriptionStatus = ClosedEnum<
40
+ typeof CustomerStateSubscriptionStatus
41
+ >;
42
+
34
43
  /**
35
44
  * An active customer subscription.
36
45
  */
@@ -54,7 +63,7 @@ export type CustomerStateSubscription = {
54
63
  | { [k: string]: string | number | boolean | Date | null }
55
64
  | undefined;
56
65
  metadata: { [k: string]: string | number | number | boolean };
57
- status: "active";
66
+ status: CustomerStateSubscriptionStatus;
58
67
  /**
59
68
  * The amount of the subscription.
60
69
  */
@@ -72,6 +81,14 @@ export type CustomerStateSubscription = {
72
81
  * The end timestamp of the current billing period.
73
82
  */
74
83
  currentPeriodEnd: Date | null;
84
+ /**
85
+ * The start timestamp of the trial period, if any.
86
+ */
87
+ trialStart: Date | null;
88
+ /**
89
+ * The end timestamp of the trial period, if any.
90
+ */
91
+ trialEnd: Date | null;
75
92
  /**
76
93
  * Whether the subscription will be canceled at the end of the current period.
77
94
  */
@@ -230,6 +247,27 @@ export function customerStateSubscriptionMetadataFromJSON(
230
247
  );
231
248
  }
232
249
 
250
+ /** @internal */
251
+ export const CustomerStateSubscriptionStatus$inboundSchema: z.ZodNativeEnum<
252
+ typeof CustomerStateSubscriptionStatus
253
+ > = z.nativeEnum(CustomerStateSubscriptionStatus);
254
+
255
+ /** @internal */
256
+ export const CustomerStateSubscriptionStatus$outboundSchema: z.ZodNativeEnum<
257
+ typeof CustomerStateSubscriptionStatus
258
+ > = CustomerStateSubscriptionStatus$inboundSchema;
259
+
260
+ /**
261
+ * @internal
262
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
263
+ */
264
+ export namespace CustomerStateSubscriptionStatus$ {
265
+ /** @deprecated use `CustomerStateSubscriptionStatus$inboundSchema` instead. */
266
+ export const inboundSchema = CustomerStateSubscriptionStatus$inboundSchema;
267
+ /** @deprecated use `CustomerStateSubscriptionStatus$outboundSchema` instead. */
268
+ export const outboundSchema = CustomerStateSubscriptionStatus$outboundSchema;
269
+ }
270
+
233
271
  /** @internal */
234
272
  export const CustomerStateSubscription$inboundSchema: z.ZodType<
235
273
  CustomerStateSubscription,
@@ -254,7 +292,7 @@ export const CustomerStateSubscription$inboundSchema: z.ZodType<
254
292
  metadata: z.record(
255
293
  z.union([z.string(), z.number().int(), z.number(), z.boolean()]),
256
294
  ),
257
- status: z.literal("active"),
295
+ status: CustomerStateSubscriptionStatus$inboundSchema,
258
296
  amount: z.number().int(),
259
297
  currency: z.string(),
260
298
  recurring_interval: SubscriptionRecurringInterval$inboundSchema,
@@ -264,6 +302,12 @@ export const CustomerStateSubscription$inboundSchema: z.ZodType<
264
302
  current_period_end: z.nullable(
265
303
  z.string().datetime({ offset: true }).transform(v => new Date(v)),
266
304
  ),
305
+ trial_start: z.nullable(
306
+ z.string().datetime({ offset: true }).transform(v => new Date(v)),
307
+ ),
308
+ trial_end: z.nullable(
309
+ z.string().datetime({ offset: true }).transform(v => new Date(v)),
310
+ ),
267
311
  cancel_at_period_end: z.boolean(),
268
312
  canceled_at: z.nullable(
269
313
  z.string().datetime({ offset: true }).transform(v => new Date(v)),
@@ -285,6 +329,8 @@ export const CustomerStateSubscription$inboundSchema: z.ZodType<
285
329
  "recurring_interval": "recurringInterval",
286
330
  "current_period_start": "currentPeriodStart",
287
331
  "current_period_end": "currentPeriodEnd",
332
+ "trial_start": "trialStart",
333
+ "trial_end": "trialEnd",
288
334
  "cancel_at_period_end": "cancelAtPeriodEnd",
289
335
  "canceled_at": "canceledAt",
290
336
  "started_at": "startedAt",
@@ -303,12 +349,14 @@ export type CustomerStateSubscription$Outbound = {
303
349
  | { [k: string]: string | number | boolean | string | null }
304
350
  | undefined;
305
351
  metadata: { [k: string]: string | number | number | boolean };
306
- status: "active";
352
+ status: string;
307
353
  amount: number;
308
354
  currency: string;
309
355
  recurring_interval: string;
310
356
  current_period_start: string;
311
357
  current_period_end: string | null;
358
+ trial_start: string | null;
359
+ trial_end: string | null;
312
360
  cancel_at_period_end: boolean;
313
361
  canceled_at: string | null;
314
362
  started_at: string | null;
@@ -340,12 +388,14 @@ export const CustomerStateSubscription$outboundSchema: z.ZodType<
340
388
  metadata: z.record(
341
389
  z.union([z.string(), z.number().int(), z.number(), z.boolean()]),
342
390
  ),
343
- status: z.literal("active"),
391
+ status: CustomerStateSubscriptionStatus$outboundSchema,
344
392
  amount: z.number().int(),
345
393
  currency: z.string(),
346
394
  recurringInterval: SubscriptionRecurringInterval$outboundSchema,
347
395
  currentPeriodStart: z.date().transform(v => v.toISOString()),
348
396
  currentPeriodEnd: z.nullable(z.date().transform(v => v.toISOString())),
397
+ trialStart: z.nullable(z.date().transform(v => v.toISOString())),
398
+ trialEnd: z.nullable(z.date().transform(v => v.toISOString())),
349
399
  cancelAtPeriodEnd: z.boolean(),
350
400
  canceledAt: z.nullable(z.date().transform(v => v.toISOString())),
351
401
  startedAt: z.nullable(z.date().transform(v => v.toISOString())),
@@ -361,6 +411,8 @@ export const CustomerStateSubscription$outboundSchema: z.ZodType<
361
411
  recurringInterval: "recurring_interval",
362
412
  currentPeriodStart: "current_period_start",
363
413
  currentPeriodEnd: "current_period_end",
414
+ trialStart: "trial_start",
415
+ trialEnd: "trial_end",
364
416
  cancelAtPeriodEnd: "cancel_at_period_end",
365
417
  canceledAt: "canceled_at",
366
418
  startedAt: "started_at",
@@ -134,6 +134,10 @@ export type CustomerSubscription = {
134
134
  * List of meters associated with the subscription.
135
135
  */
136
136
  meters: Array<CustomerSubscriptionMeter>;
137
+ /**
138
+ * Whether the subscription is managed by Polar.
139
+ */
140
+ isPolarManaged: boolean;
137
141
  };
138
142
 
139
143
  /** @internal */
@@ -248,6 +252,7 @@ export const CustomerSubscription$inboundSchema: z.ZodType<
248
252
  ]),
249
253
  ),
250
254
  meters: z.array(CustomerSubscriptionMeter$inboundSchema),
255
+ is_polar_managed: z.boolean(),
251
256
  }).transform((v) => {
252
257
  return remap$(v, {
253
258
  "created_at": "createdAt",
@@ -268,6 +273,7 @@ export const CustomerSubscription$inboundSchema: z.ZodType<
268
273
  "checkout_id": "checkoutId",
269
274
  "customer_cancellation_reason": "customerCancellationReason",
270
275
  "customer_cancellation_comment": "customerCancellationComment",
276
+ "is_polar_managed": "isPolarManaged",
271
277
  });
272
278
  });
273
279
 
@@ -298,6 +304,7 @@ export type CustomerSubscription$Outbound = {
298
304
  product: CustomerSubscriptionProduct$Outbound;
299
305
  prices: Array<LegacyRecurringProductPrice$Outbound | ProductPrice$Outbound>;
300
306
  meters: Array<CustomerSubscriptionMeter$Outbound>;
307
+ is_polar_managed: boolean;
301
308
  };
302
309
 
303
310
  /** @internal */
@@ -338,6 +345,7 @@ export const CustomerSubscription$outboundSchema: z.ZodType<
338
345
  ]),
339
346
  ),
340
347
  meters: z.array(CustomerSubscriptionMeter$outboundSchema),
348
+ isPolarManaged: z.boolean(),
341
349
  }).transform((v) => {
342
350
  return remap$(v, {
343
351
  createdAt: "created_at",
@@ -358,6 +366,7 @@ export const CustomerSubscription$outboundSchema: z.ZodType<
358
366
  checkoutId: "checkout_id",
359
367
  customerCancellationReason: "customer_cancellation_reason",
360
368
  customerCancellationComment: "customer_cancellation_comment",
369
+ isPolarManaged: "is_polar_managed",
361
370
  });
362
371
  });
363
372
 
@@ -139,6 +139,10 @@ export type Order = {
139
139
  */
140
140
  billingName: string | null;
141
141
  billingAddress: Address | null;
142
+ /**
143
+ * The invoice number associated with this order.
144
+ */
145
+ invoiceNumber: string;
142
146
  /**
143
147
  * Whether an invoice has been generated for this order.
144
148
  */
@@ -358,6 +362,7 @@ export const Order$inboundSchema: z.ZodType<Order, z.ZodTypeDef, unknown> = z
358
362
  billing_reason: OrderBillingReason$inboundSchema,
359
363
  billing_name: z.nullable(z.string()),
360
364
  billing_address: z.nullable(Address$inboundSchema),
365
+ invoice_number: z.string(),
361
366
  is_invoice_generated: z.boolean(),
362
367
  customer_id: z.string(),
363
368
  product_id: z.string(),
@@ -405,6 +410,7 @@ export const Order$inboundSchema: z.ZodType<Order, z.ZodTypeDef, unknown> = z
405
410
  "billing_reason": "billingReason",
406
411
  "billing_name": "billingName",
407
412
  "billing_address": "billingAddress",
413
+ "invoice_number": "invoiceNumber",
408
414
  "is_invoice_generated": "isInvoiceGenerated",
409
415
  "customer_id": "customerId",
410
416
  "product_id": "productId",
@@ -435,6 +441,7 @@ export type Order$Outbound = {
435
441
  billing_reason: string;
436
442
  billing_name: string | null;
437
443
  billing_address: Address$Outbound | null;
444
+ invoice_number: string;
438
445
  is_invoice_generated: boolean;
439
446
  customer_id: string;
440
447
  product_id: string;
@@ -481,6 +488,7 @@ export const Order$outboundSchema: z.ZodType<
481
488
  billingReason: OrderBillingReason$outboundSchema,
482
489
  billingName: z.nullable(z.string()),
483
490
  billingAddress: z.nullable(Address$outboundSchema),
491
+ invoiceNumber: z.string(),
484
492
  isInvoiceGenerated: z.boolean(),
485
493
  customerId: z.string(),
486
494
  productId: z.string(),
@@ -528,6 +536,7 @@ export const Order$outboundSchema: z.ZodType<
528
536
  billingReason: "billing_reason",
529
537
  billingName: "billing_name",
530
538
  billingAddress: "billing_address",
539
+ invoiceNumber: "invoice_number",
531
540
  isInvoiceGenerated: "is_invoice_generated",
532
541
  customerId: "customer_id",
533
542
  productId: "product_id",