@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,85 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { PolarError } from "./polarerror.js";
7
+
8
+ export type CustomerNotReadyData = {
9
+ error: "CustomerNotReady";
10
+ detail: string;
11
+ };
12
+
13
+ export class CustomerNotReady extends PolarError {
14
+ error: "CustomerNotReady";
15
+ detail: string;
16
+
17
+ /** The original data that was passed to this error instance. */
18
+ data$: CustomerNotReadyData;
19
+
20
+ constructor(
21
+ err: CustomerNotReadyData,
22
+ httpMeta: { response: Response; request: Request; body: string },
23
+ ) {
24
+ const message = "message" in err && typeof err.message === "string"
25
+ ? err.message
26
+ : `API error occurred: ${JSON.stringify(err)}`;
27
+ super(message, httpMeta);
28
+ this.data$ = err;
29
+ this.error = err.error;
30
+ this.detail = err.detail;
31
+
32
+ this.name = "CustomerNotReady";
33
+ }
34
+ }
35
+
36
+ /** @internal */
37
+ export const CustomerNotReady$inboundSchema: z.ZodType<
38
+ CustomerNotReady,
39
+ z.ZodTypeDef,
40
+ unknown
41
+ > = z.object({
42
+ error: z.literal("CustomerNotReady"),
43
+ detail: z.string(),
44
+ request$: z.instanceof(Request),
45
+ response$: z.instanceof(Response),
46
+ body$: z.string(),
47
+ })
48
+ .transform((v) => {
49
+ return new CustomerNotReady(v, {
50
+ request: v.request$,
51
+ response: v.response$,
52
+ body: v.body$,
53
+ });
54
+ });
55
+
56
+ /** @internal */
57
+ export type CustomerNotReady$Outbound = {
58
+ error: "CustomerNotReady";
59
+ detail: string;
60
+ };
61
+
62
+ /** @internal */
63
+ export const CustomerNotReady$outboundSchema: z.ZodType<
64
+ CustomerNotReady$Outbound,
65
+ z.ZodTypeDef,
66
+ CustomerNotReady
67
+ > = z.instanceof(CustomerNotReady)
68
+ .transform(v => v.data$)
69
+ .pipe(z.object({
70
+ error: z.literal("CustomerNotReady"),
71
+ detail: z.string(),
72
+ }));
73
+
74
+ /**
75
+ * @internal
76
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
77
+ */
78
+ export namespace CustomerNotReady$ {
79
+ /** @deprecated use `CustomerNotReady$inboundSchema` instead. */
80
+ export const inboundSchema = CustomerNotReady$inboundSchema;
81
+ /** @deprecated use `CustomerNotReady$outboundSchema` instead. */
82
+ export const outboundSchema = CustomerNotReady$outboundSchema;
83
+ /** @deprecated use `CustomerNotReady$Outbound` instead. */
84
+ export type Outbound = CustomerNotReady$Outbound;
85
+ }
@@ -0,0 +1,89 @@
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 CustomerPortalCustomersConfirmPaymentMethodSecurity = {
12
+ customerSession: string;
13
+ };
14
+
15
+ /** @internal */
16
+ export const CustomerPortalCustomersConfirmPaymentMethodSecurity$inboundSchema:
17
+ z.ZodType<
18
+ CustomerPortalCustomersConfirmPaymentMethodSecurity,
19
+ z.ZodTypeDef,
20
+ unknown
21
+ > = z.object({
22
+ customer_session: z.string(),
23
+ }).transform((v) => {
24
+ return remap$(v, {
25
+ "customer_session": "customerSession",
26
+ });
27
+ });
28
+
29
+ /** @internal */
30
+ export type CustomerPortalCustomersConfirmPaymentMethodSecurity$Outbound = {
31
+ customer_session: string;
32
+ };
33
+
34
+ /** @internal */
35
+ export const CustomerPortalCustomersConfirmPaymentMethodSecurity$outboundSchema:
36
+ z.ZodType<
37
+ CustomerPortalCustomersConfirmPaymentMethodSecurity$Outbound,
38
+ z.ZodTypeDef,
39
+ CustomerPortalCustomersConfirmPaymentMethodSecurity
40
+ > = z.object({
41
+ customerSession: z.string(),
42
+ }).transform((v) => {
43
+ return remap$(v, {
44
+ customerSession: "customer_session",
45
+ });
46
+ });
47
+
48
+ /**
49
+ * @internal
50
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
51
+ */
52
+ export namespace CustomerPortalCustomersConfirmPaymentMethodSecurity$ {
53
+ /** @deprecated use `CustomerPortalCustomersConfirmPaymentMethodSecurity$inboundSchema` instead. */
54
+ export const inboundSchema =
55
+ CustomerPortalCustomersConfirmPaymentMethodSecurity$inboundSchema;
56
+ /** @deprecated use `CustomerPortalCustomersConfirmPaymentMethodSecurity$outboundSchema` instead. */
57
+ export const outboundSchema =
58
+ CustomerPortalCustomersConfirmPaymentMethodSecurity$outboundSchema;
59
+ /** @deprecated use `CustomerPortalCustomersConfirmPaymentMethodSecurity$Outbound` instead. */
60
+ export type Outbound =
61
+ CustomerPortalCustomersConfirmPaymentMethodSecurity$Outbound;
62
+ }
63
+
64
+ export function customerPortalCustomersConfirmPaymentMethodSecurityToJSON(
65
+ customerPortalCustomersConfirmPaymentMethodSecurity:
66
+ CustomerPortalCustomersConfirmPaymentMethodSecurity,
67
+ ): string {
68
+ return JSON.stringify(
69
+ CustomerPortalCustomersConfirmPaymentMethodSecurity$outboundSchema.parse(
70
+ customerPortalCustomersConfirmPaymentMethodSecurity,
71
+ ),
72
+ );
73
+ }
74
+
75
+ export function customerPortalCustomersConfirmPaymentMethodSecurityFromJSON(
76
+ jsonString: string,
77
+ ): SafeParseResult<
78
+ CustomerPortalCustomersConfirmPaymentMethodSecurity,
79
+ SDKValidationError
80
+ > {
81
+ return safeParse(
82
+ jsonString,
83
+ (x) =>
84
+ CustomerPortalCustomersConfirmPaymentMethodSecurity$inboundSchema.parse(
85
+ JSON.parse(x),
86
+ ),
87
+ `Failed to parse 'CustomerPortalCustomersConfirmPaymentMethodSecurity' from JSON`,
88
+ );
89
+ }
@@ -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 CustomersGetBalanceRequest = {
11
+ /**
12
+ * The customer ID.
13
+ */
14
+ id: string;
15
+ };
16
+
17
+ /** @internal */
18
+ export const CustomersGetBalanceRequest$inboundSchema: z.ZodType<
19
+ CustomersGetBalanceRequest,
20
+ z.ZodTypeDef,
21
+ unknown
22
+ > = z.object({
23
+ id: z.string(),
24
+ });
25
+
26
+ /** @internal */
27
+ export type CustomersGetBalanceRequest$Outbound = {
28
+ id: string;
29
+ };
30
+
31
+ /** @internal */
32
+ export const CustomersGetBalanceRequest$outboundSchema: z.ZodType<
33
+ CustomersGetBalanceRequest$Outbound,
34
+ z.ZodTypeDef,
35
+ CustomersGetBalanceRequest
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 CustomersGetBalanceRequest$ {
45
+ /** @deprecated use `CustomersGetBalanceRequest$inboundSchema` instead. */
46
+ export const inboundSchema = CustomersGetBalanceRequest$inboundSchema;
47
+ /** @deprecated use `CustomersGetBalanceRequest$outboundSchema` instead. */
48
+ export const outboundSchema = CustomersGetBalanceRequest$outboundSchema;
49
+ /** @deprecated use `CustomersGetBalanceRequest$Outbound` instead. */
50
+ export type Outbound = CustomersGetBalanceRequest$Outbound;
51
+ }
52
+
53
+ export function customersGetBalanceRequestToJSON(
54
+ customersGetBalanceRequest: CustomersGetBalanceRequest,
55
+ ): string {
56
+ return JSON.stringify(
57
+ CustomersGetBalanceRequest$outboundSchema.parse(customersGetBalanceRequest),
58
+ );
59
+ }
60
+
61
+ export function customersGetBalanceRequestFromJSON(
62
+ jsonString: string,
63
+ ): SafeParseResult<CustomersGetBalanceRequest, SDKValidationError> {
64
+ return safeParse(
65
+ jsonString,
66
+ (x) => CustomersGetBalanceRequest$inboundSchema.parse(JSON.parse(x)),
67
+ `Failed to parse 'CustomersGetBalanceRequest' from JSON`,
68
+ );
69
+ }
@@ -6,6 +6,11 @@ import * as z from "zod";
6
6
  import { remap as remap$ } from "../../lib/primitives.js";
7
7
  import { safeParse } from "../../lib/schemas.js";
8
8
  import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import {
10
+ AggregationFunction,
11
+ AggregationFunction$inboundSchema,
12
+ AggregationFunction$outboundSchema,
13
+ } from "../components/aggregationfunction.js";
9
14
  import {
10
15
  MetadataQuery,
11
16
  MetadataQuery$inboundSchema,
@@ -56,6 +61,10 @@ export type MetersQuantitiesRequest = {
56
61
  * Filter by external customer ID.
57
62
  */
58
63
  externalCustomerId?: string | Array<string> | null | undefined;
64
+ /**
65
+ * If set, will first compute the quantities per customer before aggregating them using the given function. If not set, the quantities will be aggregated across all events.
66
+ */
67
+ customerAggregationFunction?: AggregationFunction | null | undefined;
59
68
  /**
60
69
  * Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`.
61
70
  */
@@ -204,6 +213,8 @@ export const MetersQuantitiesRequest$inboundSchema: z.ZodType<
204
213
  .optional(),
205
214
  external_customer_id: z.nullable(z.union([z.string(), z.array(z.string())]))
206
215
  .optional(),
216
+ customer_aggregation_function: z.nullable(AggregationFunction$inboundSchema)
217
+ .optional(),
207
218
  metadata: z.nullable(z.record(MetadataQuery$inboundSchema)).optional(),
208
219
  }).transform((v) => {
209
220
  return remap$(v, {
@@ -211,6 +222,7 @@ export const MetersQuantitiesRequest$inboundSchema: z.ZodType<
211
222
  "end_timestamp": "endTimestamp",
212
223
  "customer_id": "customerId",
213
224
  "external_customer_id": "externalCustomerId",
225
+ "customer_aggregation_function": "customerAggregationFunction",
214
226
  });
215
227
  });
216
228
 
@@ -222,6 +234,7 @@ export type MetersQuantitiesRequest$Outbound = {
222
234
  interval: string;
223
235
  customer_id?: string | Array<string> | null | undefined;
224
236
  external_customer_id?: string | Array<string> | null | undefined;
237
+ customer_aggregation_function?: string | null | undefined;
225
238
  metadata?: { [k: string]: MetadataQuery$Outbound } | null | undefined;
226
239
  };
227
240
 
@@ -238,6 +251,8 @@ export const MetersQuantitiesRequest$outboundSchema: z.ZodType<
238
251
  customerId: z.nullable(z.union([z.string(), z.array(z.string())])).optional(),
239
252
  externalCustomerId: z.nullable(z.union([z.string(), z.array(z.string())]))
240
253
  .optional(),
254
+ customerAggregationFunction: z.nullable(AggregationFunction$outboundSchema)
255
+ .optional(),
241
256
  metadata: z.nullable(z.record(MetadataQuery$outboundSchema)).optional(),
242
257
  }).transform((v) => {
243
258
  return remap$(v, {
@@ -245,6 +260,7 @@ export const MetersQuantitiesRequest$outboundSchema: z.ZodType<
245
260
  endTimestamp: "end_timestamp",
246
261
  customerId: "customer_id",
247
262
  externalCustomerId: "external_customer_id",
263
+ customerAggregationFunction: "customer_aggregation_function",
248
264
  });
249
265
  });
250
266
 
@@ -7,6 +7,7 @@ import { customersDelete } from "../funcs/customersDelete.js";
7
7
  import { customersDeleteExternal } from "../funcs/customersDeleteExternal.js";
8
8
  import { customersExport } from "../funcs/customersExport.js";
9
9
  import { customersGet } from "../funcs/customersGet.js";
10
+ import { customersGetBalance } from "../funcs/customersGetBalance.js";
10
11
  import { customersGetExternal } from "../funcs/customersGetExternal.js";
11
12
  import { customersGetState } from "../funcs/customersGetState.js";
12
13
  import { customersGetStateExternal } from "../funcs/customersGetStateExternal.js";
@@ -15,12 +16,14 @@ import { customersUpdate } from "../funcs/customersUpdate.js";
15
16
  import { customersUpdateExternal } from "../funcs/customersUpdateExternal.js";
16
17
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
17
18
  import { Customer } from "../models/components/customer.js";
19
+ import { CustomerBalance } from "../models/components/customerbalance.js";
18
20
  import { CustomerCreate } from "../models/components/customercreate.js";
19
21
  import { CustomerState } from "../models/components/customerstate.js";
20
22
  import { CustomersDeleteRequest } from "../models/operations/customersdelete.js";
21
23
  import { CustomersDeleteExternalRequest } from "../models/operations/customersdeleteexternal.js";
22
24
  import { CustomersExportRequest } from "../models/operations/customersexport.js";
23
25
  import { CustomersGetRequest } from "../models/operations/customersget.js";
26
+ import { CustomersGetBalanceRequest } from "../models/operations/customersgetbalance.js";
24
27
  import { CustomersGetExternalRequest } from "../models/operations/customersgetexternal.js";
25
28
  import { CustomersGetStateRequest } from "../models/operations/customersgetstate.js";
26
29
  import { CustomersGetStateExternalRequest } from "../models/operations/customersgetstateexternal.js";
@@ -268,4 +271,23 @@ export class Customers extends ClientSDK {
268
271
  options,
269
272
  ));
270
273
  }
274
+
275
+ /**
276
+ * Get Customer Balance
277
+ *
278
+ * @remarks
279
+ * Get customer balance information.
280
+ *
281
+ * **Scopes**: `customers:read` `customers:write`
282
+ */
283
+ async getBalance(
284
+ request: CustomersGetBalanceRequest,
285
+ options?: RequestOptions,
286
+ ): Promise<CustomerBalance> {
287
+ return unwrapAsync(customersGetBalance(
288
+ this,
289
+ request,
290
+ options,
291
+ ));
292
+ }
271
293
  }
@@ -3,16 +3,19 @@
3
3
  */
4
4
 
5
5
  import { customerPortalCustomersAddPaymentMethod } from "../funcs/customerPortalCustomersAddPaymentMethod.js";
6
+ import { customerPortalCustomersConfirmPaymentMethod } from "../funcs/customerPortalCustomersConfirmPaymentMethod.js";
6
7
  import { customerPortalCustomersDeletePaymentMethod } from "../funcs/customerPortalCustomersDeletePaymentMethod.js";
7
8
  import { customerPortalCustomersGet } from "../funcs/customerPortalCustomersGet.js";
8
9
  import { customerPortalCustomersListPaymentMethods } from "../funcs/customerPortalCustomersListPaymentMethods.js";
9
10
  import { customerPortalCustomersUpdate } from "../funcs/customerPortalCustomersUpdate.js";
10
11
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
11
- import { CustomerPaymentMethod } from "../models/components/customerpaymentmethod.js";
12
+ import { CustomerPaymentMethodConfirm } from "../models/components/customerpaymentmethodconfirm.js";
12
13
  import { CustomerPaymentMethodCreate } from "../models/components/customerpaymentmethodcreate.js";
14
+ import { CustomerPaymentMethodCreateResponse } from "../models/components/customerpaymentmethodcreateresponse.js";
13
15
  import { CustomerPortalCustomer } from "../models/components/customerportalcustomer.js";
14
16
  import { CustomerPortalCustomerUpdate } from "../models/components/customerportalcustomerupdate.js";
15
17
  import { CustomerPortalCustomersAddPaymentMethodSecurity } from "../models/operations/customerportalcustomersaddpaymentmethod.js";
18
+ import { CustomerPortalCustomersConfirmPaymentMethodSecurity } from "../models/operations/customerportalcustomersconfirmpaymentmethod.js";
16
19
  import {
17
20
  CustomerPortalCustomersDeletePaymentMethodRequest,
18
21
  CustomerPortalCustomersDeletePaymentMethodSecurity,
@@ -106,7 +109,7 @@ export class PolarCustomers extends ClientSDK {
106
109
  security: CustomerPortalCustomersAddPaymentMethodSecurity,
107
110
  request: CustomerPaymentMethodCreate,
108
111
  options?: RequestOptions,
109
- ): Promise<CustomerPaymentMethod> {
112
+ ): Promise<CustomerPaymentMethodCreateResponse> {
110
113
  return unwrapAsync(customerPortalCustomersAddPaymentMethod(
111
114
  this,
112
115
  security,
@@ -115,6 +118,27 @@ export class PolarCustomers extends ClientSDK {
115
118
  ));
116
119
  }
117
120
 
121
+ /**
122
+ * Confirm Customer Payment Method
123
+ *
124
+ * @remarks
125
+ * Confirm a payment method for the authenticated customer.
126
+ *
127
+ * **Scopes**: `customer_portal:read` `customer_portal:write`
128
+ */
129
+ async confirmPaymentMethod(
130
+ security: CustomerPortalCustomersConfirmPaymentMethodSecurity,
131
+ request: CustomerPaymentMethodConfirm,
132
+ options?: RequestOptions,
133
+ ): Promise<CustomerPaymentMethodCreateResponse> {
134
+ return unwrapAsync(customerPortalCustomersConfirmPaymentMethod(
135
+ this,
136
+ security,
137
+ request,
138
+ options,
139
+ ));
140
+ }
141
+
118
142
  /**
119
143
  * Delete Customer Payment Method
120
144
  *