@polar-sh/sdk 0.35.2 → 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 (216) hide show
  1. package/README.md +25 -23
  2. package/bin/mcp-server.js +771 -618
  3. package/bin/mcp-server.js.map +14 -10
  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 +669 -669
  32. package/dist/commonjs/models/components/address.js +223 -223
  33. package/dist/commonjs/models/components/addressinput.d.ts +652 -652
  34. package/dist/commonjs/models/components/addressinput.js +218 -218
  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/customersubscription.d.ts +5 -0
  64. package/dist/commonjs/models/components/customersubscription.d.ts.map +1 -1
  65. package/dist/commonjs/models/components/customersubscription.js +4 -0
  66. package/dist/commonjs/models/components/customersubscription.js.map +1 -1
  67. package/dist/commonjs/models/components/order.d.ts +5 -0
  68. package/dist/commonjs/models/components/order.d.ts.map +1 -1
  69. package/dist/commonjs/models/components/order.js +4 -0
  70. package/dist/commonjs/models/components/order.js.map +1 -1
  71. package/dist/commonjs/models/errors/customernotready.d.ts +39 -0
  72. package/dist/commonjs/models/errors/customernotready.d.ts.map +1 -0
  73. package/dist/commonjs/models/errors/customernotready.js +88 -0
  74. package/dist/commonjs/models/errors/customernotready.js.map +1 -0
  75. package/dist/commonjs/models/operations/customerportalcustomersconfirmpaymentmethod.d.ts +29 -0
  76. package/dist/commonjs/models/operations/customerportalcustomersconfirmpaymentmethod.d.ts.map +1 -0
  77. package/dist/commonjs/models/operations/customerportalcustomersconfirmpaymentmethod.js +78 -0
  78. package/dist/commonjs/models/operations/customerportalcustomersconfirmpaymentmethod.js.map +1 -0
  79. package/dist/commonjs/models/operations/customersgetbalance.d.ts +32 -0
  80. package/dist/commonjs/models/operations/customersgetbalance.d.ts.map +1 -0
  81. package/dist/commonjs/models/operations/customersgetbalance.js +69 -0
  82. package/dist/commonjs/models/operations/customersgetbalance.js.map +1 -0
  83. package/dist/commonjs/models/operations/metersquantities.d.ts +6 -0
  84. package/dist/commonjs/models/operations/metersquantities.d.ts.map +1 -1
  85. package/dist/commonjs/models/operations/metersquantities.js +7 -0
  86. package/dist/commonjs/models/operations/metersquantities.js.map +1 -1
  87. package/dist/commonjs/sdk/customers.d.ts +11 -0
  88. package/dist/commonjs/sdk/customers.d.ts.map +1 -1
  89. package/dist/commonjs/sdk/customers.js +12 -0
  90. package/dist/commonjs/sdk/customers.js.map +1 -1
  91. package/dist/commonjs/sdk/polarcustomers.d.ts +13 -2
  92. package/dist/commonjs/sdk/polarcustomers.d.ts.map +1 -1
  93. package/dist/commonjs/sdk/polarcustomers.js +12 -0
  94. package/dist/commonjs/sdk/polarcustomers.js.map +1 -1
  95. package/dist/esm/funcs/customerPortalCustomersAddPaymentMethod.d.ts +2 -2
  96. package/dist/esm/funcs/customerPortalCustomersAddPaymentMethod.d.ts.map +1 -1
  97. package/dist/esm/funcs/customerPortalCustomersAddPaymentMethod.js +2 -2
  98. package/dist/esm/funcs/customerPortalCustomersAddPaymentMethod.js.map +1 -1
  99. package/dist/esm/funcs/customerPortalCustomersConfirmPaymentMethod.d.ts +23 -0
  100. package/dist/esm/funcs/customerPortalCustomersConfirmPaymentMethod.d.ts.map +1 -0
  101. package/dist/esm/funcs/customerPortalCustomersConfirmPaymentMethod.js +90 -0
  102. package/dist/esm/funcs/customerPortalCustomersConfirmPaymentMethod.js.map +1 -0
  103. package/dist/esm/funcs/customersGetBalance.d.ts +22 -0
  104. package/dist/esm/funcs/customersGetBalance.d.ts.map +1 -0
  105. package/dist/esm/funcs/customersGetBalance.js +91 -0
  106. package/dist/esm/funcs/customersGetBalance.js.map +1 -0
  107. package/dist/esm/funcs/metersQuantities.js +1 -0
  108. package/dist/esm/funcs/metersQuantities.js.map +1 -1
  109. package/dist/esm/lib/config.d.ts +3 -3
  110. package/dist/esm/lib/config.js +3 -3
  111. package/dist/esm/lib/config.js.map +1 -1
  112. package/dist/esm/lib/url.js +1 -1
  113. package/dist/esm/lib/url.js.map +1 -1
  114. package/dist/esm/mcp-server/mcp-server.js +1 -1
  115. package/dist/esm/mcp-server/server.d.ts.map +1 -1
  116. package/dist/esm/mcp-server/server.js +3 -1
  117. package/dist/esm/mcp-server/server.js.map +1 -1
  118. package/dist/esm/mcp-server/tools/customersGetBalance.d.ts +7 -0
  119. package/dist/esm/mcp-server/tools/customersGetBalance.d.ts.map +1 -0
  120. package/dist/esm/mcp-server/tools/customersGetBalance.js +31 -0
  121. package/dist/esm/mcp-server/tools/customersGetBalance.js.map +1 -0
  122. package/dist/esm/models/components/address.d.ts +669 -669
  123. package/dist/esm/models/components/address.js +223 -223
  124. package/dist/esm/models/components/addressinput.d.ts +652 -652
  125. package/dist/esm/models/components/addressinput.js +218 -218
  126. package/dist/esm/models/components/aggregationfunction.d.ts +40 -0
  127. package/dist/esm/models/components/aggregationfunction.d.ts.map +1 -0
  128. package/dist/esm/models/components/aggregationfunction.js +28 -0
  129. package/dist/esm/models/components/aggregationfunction.js.map +1 -0
  130. package/dist/esm/models/components/customerbalance.d.ts +40 -0
  131. package/dist/esm/models/components/customerbalance.d.ts.map +1 -0
  132. package/dist/esm/models/components/customerbalance.js +33 -0
  133. package/dist/esm/models/components/customerbalance.js.map +1 -0
  134. package/dist/esm/models/components/customerorder.d.ts +5 -0
  135. package/dist/esm/models/components/customerorder.d.ts.map +1 -1
  136. package/dist/esm/models/components/customerorder.js +4 -0
  137. package/dist/esm/models/components/customerorder.js.map +1 -1
  138. package/dist/esm/models/components/customerpaymentmethodconfirm.d.ts +31 -0
  139. package/dist/esm/models/components/customerpaymentmethodconfirm.d.ts.map +1 -0
  140. package/dist/esm/models/components/customerpaymentmethodconfirm.js +44 -0
  141. package/dist/esm/models/components/customerpaymentmethodconfirm.js.map +1 -0
  142. package/dist/esm/models/components/customerpaymentmethodcreaterequiresactionresponse.d.ts +31 -0
  143. package/dist/esm/models/components/customerpaymentmethodcreaterequiresactionresponse.d.ts.map +1 -0
  144. package/dist/esm/models/components/customerpaymentmethodcreaterequiresactionresponse.js +42 -0
  145. package/dist/esm/models/components/customerpaymentmethodcreaterequiresactionresponse.js.map +1 -0
  146. package/dist/esm/models/components/customerpaymentmethodcreateresponse.d.ts +35 -0
  147. package/dist/esm/models/components/customerpaymentmethodcreateresponse.d.ts.map +1 -0
  148. package/dist/esm/models/components/customerpaymentmethodcreateresponse.js +43 -0
  149. package/dist/esm/models/components/customerpaymentmethodcreateresponse.js.map +1 -0
  150. package/dist/esm/models/components/customerpaymentmethodcreatesucceededresponse.d.ts +32 -0
  151. package/dist/esm/models/components/customerpaymentmethodcreatesucceededresponse.d.ts.map +1 -0
  152. package/dist/esm/models/components/customerpaymentmethodcreatesucceededresponse.js +43 -0
  153. package/dist/esm/models/components/customerpaymentmethodcreatesucceededresponse.js.map +1 -0
  154. package/dist/esm/models/components/customersubscription.d.ts +5 -0
  155. package/dist/esm/models/components/customersubscription.d.ts.map +1 -1
  156. package/dist/esm/models/components/customersubscription.js +4 -0
  157. package/dist/esm/models/components/customersubscription.js.map +1 -1
  158. package/dist/esm/models/components/order.d.ts +5 -0
  159. package/dist/esm/models/components/order.d.ts.map +1 -1
  160. package/dist/esm/models/components/order.js +4 -0
  161. package/dist/esm/models/components/order.js.map +1 -1
  162. package/dist/esm/models/errors/customernotready.d.ts +39 -0
  163. package/dist/esm/models/errors/customernotready.d.ts.map +1 -0
  164. package/dist/esm/models/errors/customernotready.js +51 -0
  165. package/dist/esm/models/errors/customernotready.js.map +1 -0
  166. package/dist/esm/models/operations/customerportalcustomersconfirmpaymentmethod.d.ts +29 -0
  167. package/dist/esm/models/operations/customerportalcustomersconfirmpaymentmethod.d.ts.map +1 -0
  168. package/dist/esm/models/operations/customerportalcustomersconfirmpaymentmethod.js +40 -0
  169. package/dist/esm/models/operations/customerportalcustomersconfirmpaymentmethod.js.map +1 -0
  170. package/dist/esm/models/operations/customersgetbalance.d.ts +32 -0
  171. package/dist/esm/models/operations/customersgetbalance.d.ts.map +1 -0
  172. package/dist/esm/models/operations/customersgetbalance.js +31 -0
  173. package/dist/esm/models/operations/customersgetbalance.js.map +1 -0
  174. package/dist/esm/models/operations/metersquantities.d.ts +6 -0
  175. package/dist/esm/models/operations/metersquantities.d.ts.map +1 -1
  176. package/dist/esm/models/operations/metersquantities.js +7 -0
  177. package/dist/esm/models/operations/metersquantities.js.map +1 -1
  178. package/dist/esm/sdk/customers.d.ts +11 -0
  179. package/dist/esm/sdk/customers.d.ts.map +1 -1
  180. package/dist/esm/sdk/customers.js +12 -0
  181. package/dist/esm/sdk/customers.js.map +1 -1
  182. package/dist/esm/sdk/polarcustomers.d.ts +13 -2
  183. package/dist/esm/sdk/polarcustomers.d.ts.map +1 -1
  184. package/dist/esm/sdk/polarcustomers.js +12 -0
  185. package/dist/esm/sdk/polarcustomers.js.map +1 -1
  186. package/docs/sdks/customers/README.md +78 -0
  187. package/docs/sdks/polarcustomers/README.md +82 -1
  188. package/examples/package-lock.json +1 -1
  189. package/jsr.json +1 -1
  190. package/package.json +1 -1
  191. package/src/funcs/customerPortalCustomersAddPaymentMethod.ts +8 -8
  192. package/src/funcs/customerPortalCustomersConfirmPaymentMethod.ts +201 -0
  193. package/src/funcs/customersGetBalance.ts +195 -0
  194. package/src/funcs/metersQuantities.ts +1 -0
  195. package/src/lib/config.ts +3 -3
  196. package/src/lib/url.ts +1 -1
  197. package/src/mcp-server/mcp-server.ts +1 -1
  198. package/src/mcp-server/server.ts +3 -1
  199. package/src/mcp-server/tools/customersGetBalance.ts +40 -0
  200. package/src/models/components/address.ts +223 -223
  201. package/src/models/components/addressinput.ts +218 -218
  202. package/src/models/components/aggregationfunction.ts +37 -0
  203. package/src/models/components/customerbalance.ts +77 -0
  204. package/src/models/components/customerorder.ts +9 -0
  205. package/src/models/components/customerpaymentmethodconfirm.ts +83 -0
  206. package/src/models/components/customerpaymentmethodcreaterequiresactionresponse.ts +93 -0
  207. package/src/models/components/customerpaymentmethodcreateresponse.ts +107 -0
  208. package/src/models/components/customerpaymentmethodcreatesucceededresponse.ts +98 -0
  209. package/src/models/components/customersubscription.ts +9 -0
  210. package/src/models/components/order.ts +9 -0
  211. package/src/models/errors/customernotready.ts +85 -0
  212. package/src/models/operations/customerportalcustomersconfirmpaymentmethod.ts +89 -0
  213. package/src/models/operations/customersgetbalance.ts +69 -0
  214. package/src/models/operations/metersquantities.ts +16 -0
  215. package/src/sdk/customers.ts +22 -0
  216. 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
+ }
@@ -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",
@@ -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
+ }