@polar-sh/sdk 0.36.1 → 0.36.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/README.md +24 -19
  2. package/bin/mcp-server.js +224 -66
  3. package/bin/mcp-server.js.map +8 -8
  4. package/dist/commonjs/funcs/customerPortalCustomerSessionIntrospect.d.ts +20 -0
  5. package/dist/commonjs/funcs/customerPortalCustomerSessionIntrospect.d.ts.map +1 -0
  6. package/dist/commonjs/funcs/customerPortalCustomerSessionIntrospect.js +110 -0
  7. package/dist/commonjs/funcs/customerPortalCustomerSessionIntrospect.js.map +1 -0
  8. package/dist/commonjs/lib/config.d.ts +2 -2
  9. package/dist/commonjs/lib/config.js +2 -2
  10. package/dist/commonjs/mcp-server/mcp-server.js +1 -1
  11. package/dist/commonjs/mcp-server/server.js +1 -1
  12. package/dist/commonjs/models/components/checkout.d.ts +5 -0
  13. package/dist/commonjs/models/components/checkout.d.ts.map +1 -1
  14. package/dist/commonjs/models/components/checkout.js +4 -0
  15. package/dist/commonjs/models/components/checkout.js.map +1 -1
  16. package/dist/commonjs/models/components/checkoutcreate.d.ts +5 -0
  17. package/dist/commonjs/models/components/checkoutcreate.d.ts.map +1 -1
  18. package/dist/commonjs/models/components/checkoutcreate.js +4 -0
  19. package/dist/commonjs/models/components/checkoutcreate.js.map +1 -1
  20. package/dist/commonjs/models/components/checkoutpublic.d.ts +5 -0
  21. package/dist/commonjs/models/components/checkoutpublic.d.ts.map +1 -1
  22. package/dist/commonjs/models/components/checkoutpublic.js +4 -0
  23. package/dist/commonjs/models/components/checkoutpublic.js.map +1 -1
  24. package/dist/commonjs/models/components/checkoutpublicconfirmed.d.ts +5 -0
  25. package/dist/commonjs/models/components/checkoutpublicconfirmed.d.ts.map +1 -1
  26. package/dist/commonjs/models/components/checkoutpublicconfirmed.js +4 -0
  27. package/dist/commonjs/models/components/checkoutpublicconfirmed.js.map +1 -1
  28. package/dist/commonjs/models/components/checkoutupdate.d.ts +5 -0
  29. package/dist/commonjs/models/components/checkoutupdate.d.ts.map +1 -1
  30. package/dist/commonjs/models/components/checkoutupdate.js +4 -0
  31. package/dist/commonjs/models/components/checkoutupdate.js.map +1 -1
  32. package/dist/commonjs/models/components/customercustomersession.d.ts +31 -0
  33. package/dist/commonjs/models/components/customercustomersession.d.ts.map +1 -0
  34. package/dist/commonjs/models/components/customercustomersession.js +82 -0
  35. package/dist/commonjs/models/components/customercustomersession.js.map +1 -0
  36. package/dist/commonjs/models/components/customersession.d.ts +2 -0
  37. package/dist/commonjs/models/components/customersession.d.ts.map +1 -1
  38. package/dist/commonjs/models/components/customersession.js +4 -0
  39. package/dist/commonjs/models/components/customersession.js.map +1 -1
  40. package/dist/commonjs/models/components/customersessioncustomerexternalidcreate.d.ts +5 -0
  41. package/dist/commonjs/models/components/customersessioncustomerexternalidcreate.d.ts.map +1 -1
  42. package/dist/commonjs/models/components/customersessioncustomerexternalidcreate.js +4 -0
  43. package/dist/commonjs/models/components/customersessioncustomerexternalidcreate.js.map +1 -1
  44. package/dist/commonjs/models/components/customersessioncustomeridcreate.d.ts +5 -0
  45. package/dist/commonjs/models/components/customersessioncustomeridcreate.d.ts.map +1 -1
  46. package/dist/commonjs/models/components/customersessioncustomeridcreate.js +4 -0
  47. package/dist/commonjs/models/components/customersessioncustomeridcreate.js.map +1 -1
  48. package/dist/commonjs/models/components/productcreateonetime.d.ts +44 -4
  49. package/dist/commonjs/models/components/productcreateonetime.d.ts.map +1 -1
  50. package/dist/commonjs/models/components/productcreateonetime.js +60 -20
  51. package/dist/commonjs/models/components/productcreateonetime.js.map +1 -1
  52. package/dist/commonjs/models/components/productcreaterecurring.d.ts +44 -4
  53. package/dist/commonjs/models/components/productcreaterecurring.d.ts.map +1 -1
  54. package/dist/commonjs/models/components/productcreaterecurring.js +60 -20
  55. package/dist/commonjs/models/components/productcreaterecurring.js.map +1 -1
  56. package/dist/commonjs/models/components/productupdate.d.ts +85 -4
  57. package/dist/commonjs/models/components/productupdate.d.ts.map +1 -1
  58. package/dist/commonjs/models/components/productupdate.js +117 -21
  59. package/dist/commonjs/models/components/productupdate.js.map +1 -1
  60. package/dist/commonjs/models/components/webtokenrequest.d.ts +67 -0
  61. package/dist/commonjs/models/components/webtokenrequest.d.ts.map +1 -0
  62. package/dist/commonjs/models/components/webtokenrequest.js +117 -0
  63. package/dist/commonjs/models/components/webtokenrequest.js.map +1 -0
  64. package/dist/commonjs/models/operations/customerportalcustomersessionintrospect.d.ts +29 -0
  65. package/dist/commonjs/models/operations/customerportalcustomersessionintrospect.d.ts.map +1 -0
  66. package/dist/commonjs/models/operations/customerportalcustomersessionintrospect.js +78 -0
  67. package/dist/commonjs/models/operations/customerportalcustomersessionintrospect.js.map +1 -0
  68. package/dist/commonjs/models/operations/oauth2requesttoken.d.ts +3 -2
  69. package/dist/commonjs/models/operations/oauth2requesttoken.d.ts.map +1 -1
  70. package/dist/commonjs/models/operations/oauth2requesttoken.js +3 -0
  71. package/dist/commonjs/models/operations/oauth2requesttoken.js.map +1 -1
  72. package/dist/commonjs/sdk/customerportal.d.ts +3 -0
  73. package/dist/commonjs/sdk/customerportal.d.ts.map +1 -1
  74. package/dist/commonjs/sdk/customerportal.js +4 -0
  75. package/dist/commonjs/sdk/customerportal.js.map +1 -1
  76. package/dist/commonjs/sdk/customersession.d.ts +15 -0
  77. package/dist/commonjs/sdk/customersession.d.ts.map +1 -0
  78. package/dist/commonjs/sdk/customersession.js +24 -0
  79. package/dist/commonjs/sdk/customersession.js.map +1 -0
  80. package/dist/esm/funcs/customerPortalCustomerSessionIntrospect.d.ts +20 -0
  81. package/dist/esm/funcs/customerPortalCustomerSessionIntrospect.d.ts.map +1 -0
  82. package/dist/esm/funcs/customerPortalCustomerSessionIntrospect.js +74 -0
  83. package/dist/esm/funcs/customerPortalCustomerSessionIntrospect.js.map +1 -0
  84. package/dist/esm/lib/config.d.ts +2 -2
  85. package/dist/esm/lib/config.js +2 -2
  86. package/dist/esm/mcp-server/mcp-server.js +1 -1
  87. package/dist/esm/mcp-server/server.js +1 -1
  88. package/dist/esm/models/components/checkout.d.ts +5 -0
  89. package/dist/esm/models/components/checkout.d.ts.map +1 -1
  90. package/dist/esm/models/components/checkout.js +4 -0
  91. package/dist/esm/models/components/checkout.js.map +1 -1
  92. package/dist/esm/models/components/checkoutcreate.d.ts +5 -0
  93. package/dist/esm/models/components/checkoutcreate.d.ts.map +1 -1
  94. package/dist/esm/models/components/checkoutcreate.js +4 -0
  95. package/dist/esm/models/components/checkoutcreate.js.map +1 -1
  96. package/dist/esm/models/components/checkoutpublic.d.ts +5 -0
  97. package/dist/esm/models/components/checkoutpublic.d.ts.map +1 -1
  98. package/dist/esm/models/components/checkoutpublic.js +4 -0
  99. package/dist/esm/models/components/checkoutpublic.js.map +1 -1
  100. package/dist/esm/models/components/checkoutpublicconfirmed.d.ts +5 -0
  101. package/dist/esm/models/components/checkoutpublicconfirmed.d.ts.map +1 -1
  102. package/dist/esm/models/components/checkoutpublicconfirmed.js +4 -0
  103. package/dist/esm/models/components/checkoutpublicconfirmed.js.map +1 -1
  104. package/dist/esm/models/components/checkoutupdate.d.ts +5 -0
  105. package/dist/esm/models/components/checkoutupdate.d.ts.map +1 -1
  106. package/dist/esm/models/components/checkoutupdate.js +4 -0
  107. package/dist/esm/models/components/checkoutupdate.js.map +1 -1
  108. package/dist/esm/models/components/customercustomersession.d.ts +31 -0
  109. package/dist/esm/models/components/customercustomersession.d.ts.map +1 -0
  110. package/dist/esm/models/components/customercustomersession.js +44 -0
  111. package/dist/esm/models/components/customercustomersession.js.map +1 -0
  112. package/dist/esm/models/components/customersession.d.ts +2 -0
  113. package/dist/esm/models/components/customersession.d.ts.map +1 -1
  114. package/dist/esm/models/components/customersession.js +4 -0
  115. package/dist/esm/models/components/customersession.js.map +1 -1
  116. package/dist/esm/models/components/customersessioncustomerexternalidcreate.d.ts +5 -0
  117. package/dist/esm/models/components/customersessioncustomerexternalidcreate.d.ts.map +1 -1
  118. package/dist/esm/models/components/customersessioncustomerexternalidcreate.js +4 -0
  119. package/dist/esm/models/components/customersessioncustomerexternalidcreate.js.map +1 -1
  120. package/dist/esm/models/components/customersessioncustomeridcreate.d.ts +5 -0
  121. package/dist/esm/models/components/customersessioncustomeridcreate.d.ts.map +1 -1
  122. package/dist/esm/models/components/customersessioncustomeridcreate.js +4 -0
  123. package/dist/esm/models/components/customersessioncustomeridcreate.js.map +1 -1
  124. package/dist/esm/models/components/productcreateonetime.d.ts +44 -4
  125. package/dist/esm/models/components/productcreateonetime.d.ts.map +1 -1
  126. package/dist/esm/models/components/productcreateonetime.js +60 -20
  127. package/dist/esm/models/components/productcreateonetime.js.map +1 -1
  128. package/dist/esm/models/components/productcreaterecurring.d.ts +44 -4
  129. package/dist/esm/models/components/productcreaterecurring.d.ts.map +1 -1
  130. package/dist/esm/models/components/productcreaterecurring.js +60 -20
  131. package/dist/esm/models/components/productcreaterecurring.js.map +1 -1
  132. package/dist/esm/models/components/productupdate.d.ts +85 -4
  133. package/dist/esm/models/components/productupdate.d.ts.map +1 -1
  134. package/dist/esm/models/components/productupdate.js +114 -20
  135. package/dist/esm/models/components/productupdate.js.map +1 -1
  136. package/dist/esm/models/components/webtokenrequest.d.ts +67 -0
  137. package/dist/esm/models/components/webtokenrequest.d.ts.map +1 -0
  138. package/dist/esm/models/components/webtokenrequest.js +79 -0
  139. package/dist/esm/models/components/webtokenrequest.js.map +1 -0
  140. package/dist/esm/models/operations/customerportalcustomersessionintrospect.d.ts +29 -0
  141. package/dist/esm/models/operations/customerportalcustomersessionintrospect.d.ts.map +1 -0
  142. package/dist/esm/models/operations/customerportalcustomersessionintrospect.js +40 -0
  143. package/dist/esm/models/operations/customerportalcustomersessionintrospect.js.map +1 -0
  144. package/dist/esm/models/operations/oauth2requesttoken.d.ts +3 -2
  145. package/dist/esm/models/operations/oauth2requesttoken.d.ts.map +1 -1
  146. package/dist/esm/models/operations/oauth2requesttoken.js +3 -0
  147. package/dist/esm/models/operations/oauth2requesttoken.js.map +1 -1
  148. package/dist/esm/sdk/customerportal.d.ts +3 -0
  149. package/dist/esm/sdk/customerportal.d.ts.map +1 -1
  150. package/dist/esm/sdk/customerportal.js +4 -0
  151. package/dist/esm/sdk/customerportal.js.map +1 -1
  152. package/dist/esm/sdk/customersession.d.ts +15 -0
  153. package/dist/esm/sdk/customersession.d.ts.map +1 -0
  154. package/dist/esm/sdk/customersession.js +20 -0
  155. package/dist/esm/sdk/customersession.js.map +1 -0
  156. package/docs/sdks/customersession/README.md +79 -0
  157. package/examples/package-lock.json +1 -1
  158. package/jsr.json +1 -1
  159. package/package.json +1 -1
  160. package/src/funcs/customerPortalCustomerSessionIntrospect.ts +157 -0
  161. package/src/lib/config.ts +2 -2
  162. package/src/mcp-server/mcp-server.ts +1 -1
  163. package/src/mcp-server/server.ts +1 -1
  164. package/src/models/components/checkout.ts +9 -0
  165. package/src/models/components/checkoutcreate.ts +9 -0
  166. package/src/models/components/checkoutpublic.ts +9 -0
  167. package/src/models/components/checkoutpublicconfirmed.ts +9 -0
  168. package/src/models/components/checkoutupdate.ts +9 -0
  169. package/src/models/components/customercustomersession.ts +81 -0
  170. package/src/models/components/customersession.ts +6 -0
  171. package/src/models/components/customersessioncustomerexternalidcreate.ts +9 -0
  172. package/src/models/components/customersessioncustomeridcreate.ts +9 -0
  173. package/src/models/components/productcreateonetime.ts +120 -40
  174. package/src/models/components/productcreaterecurring.ts +120 -40
  175. package/src/models/components/productupdate.ts +233 -40
  176. package/src/models/components/webtokenrequest.ts +133 -0
  177. package/src/models/operations/customerportalcustomersessionintrospect.ts +89 -0
  178. package/src/models/operations/oauth2requesttoken.ts +12 -2
  179. package/src/sdk/customerportal.ts +6 -0
  180. package/src/sdk/customersession.ts +30 -0
@@ -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 CustomerPortalCustomerSessionIntrospectSecurity = {
12
+ customerSession: string;
13
+ };
14
+
15
+ /** @internal */
16
+ export const CustomerPortalCustomerSessionIntrospectSecurity$inboundSchema:
17
+ z.ZodType<
18
+ CustomerPortalCustomerSessionIntrospectSecurity,
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 CustomerPortalCustomerSessionIntrospectSecurity$Outbound = {
31
+ customer_session: string;
32
+ };
33
+
34
+ /** @internal */
35
+ export const CustomerPortalCustomerSessionIntrospectSecurity$outboundSchema:
36
+ z.ZodType<
37
+ CustomerPortalCustomerSessionIntrospectSecurity$Outbound,
38
+ z.ZodTypeDef,
39
+ CustomerPortalCustomerSessionIntrospectSecurity
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 CustomerPortalCustomerSessionIntrospectSecurity$ {
53
+ /** @deprecated use `CustomerPortalCustomerSessionIntrospectSecurity$inboundSchema` instead. */
54
+ export const inboundSchema =
55
+ CustomerPortalCustomerSessionIntrospectSecurity$inboundSchema;
56
+ /** @deprecated use `CustomerPortalCustomerSessionIntrospectSecurity$outboundSchema` instead. */
57
+ export const outboundSchema =
58
+ CustomerPortalCustomerSessionIntrospectSecurity$outboundSchema;
59
+ /** @deprecated use `CustomerPortalCustomerSessionIntrospectSecurity$Outbound` instead. */
60
+ export type Outbound =
61
+ CustomerPortalCustomerSessionIntrospectSecurity$Outbound;
62
+ }
63
+
64
+ export function customerPortalCustomerSessionIntrospectSecurityToJSON(
65
+ customerPortalCustomerSessionIntrospectSecurity:
66
+ CustomerPortalCustomerSessionIntrospectSecurity,
67
+ ): string {
68
+ return JSON.stringify(
69
+ CustomerPortalCustomerSessionIntrospectSecurity$outboundSchema.parse(
70
+ customerPortalCustomerSessionIntrospectSecurity,
71
+ ),
72
+ );
73
+ }
74
+
75
+ export function customerPortalCustomerSessionIntrospectSecurityFromJSON(
76
+ jsonString: string,
77
+ ): SafeParseResult<
78
+ CustomerPortalCustomerSessionIntrospectSecurity,
79
+ SDKValidationError
80
+ > {
81
+ return safeParse(
82
+ jsonString,
83
+ (x) =>
84
+ CustomerPortalCustomerSessionIntrospectSecurity$inboundSchema.parse(
85
+ JSON.parse(x),
86
+ ),
87
+ `Failed to parse 'CustomerPortalCustomerSessionIntrospectSecurity' from JSON`,
88
+ );
89
+ }
@@ -17,11 +17,18 @@ import {
17
17
  RefreshTokenRequest$Outbound,
18
18
  RefreshTokenRequest$outboundSchema,
19
19
  } from "../components/refreshtokenrequest.js";
20
+ import {
21
+ WebTokenRequest,
22
+ WebTokenRequest$inboundSchema,
23
+ WebTokenRequest$Outbound,
24
+ WebTokenRequest$outboundSchema,
25
+ } from "../components/webtokenrequest.js";
20
26
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
21
27
 
22
28
  export type Oauth2RequestTokenRequestBody =
23
29
  | AuthorizationCodeTokenRequest
24
- | RefreshTokenRequest;
30
+ | RefreshTokenRequest
31
+ | WebTokenRequest;
25
32
 
26
33
  /** @internal */
27
34
  export const Oauth2RequestTokenRequestBody$inboundSchema: z.ZodType<
@@ -31,12 +38,14 @@ export const Oauth2RequestTokenRequestBody$inboundSchema: z.ZodType<
31
38
  > = z.union([
32
39
  AuthorizationCodeTokenRequest$inboundSchema,
33
40
  RefreshTokenRequest$inboundSchema,
41
+ WebTokenRequest$inboundSchema,
34
42
  ]);
35
43
 
36
44
  /** @internal */
37
45
  export type Oauth2RequestTokenRequestBody$Outbound =
38
46
  | AuthorizationCodeTokenRequest$Outbound
39
- | RefreshTokenRequest$Outbound;
47
+ | RefreshTokenRequest$Outbound
48
+ | WebTokenRequest$Outbound;
40
49
 
41
50
  /** @internal */
42
51
  export const Oauth2RequestTokenRequestBody$outboundSchema: z.ZodType<
@@ -46,6 +55,7 @@ export const Oauth2RequestTokenRequestBody$outboundSchema: z.ZodType<
46
55
  > = z.union([
47
56
  AuthorizationCodeTokenRequest$outboundSchema,
48
57
  RefreshTokenRequest$outboundSchema,
58
+ WebTokenRequest$outboundSchema,
49
59
  ]);
50
60
 
51
61
  /**
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  import { ClientSDK } from "../lib/sdks.js";
6
+ import { CustomerSession } from "./customersession.js";
6
7
  import { Downloadables } from "./downloadables.js";
7
8
  import { PolarBenefitGrants } from "./polarbenefitgrants.js";
8
9
  import { PolarCustomerMeters } from "./polarcustomermeters.js";
@@ -34,6 +35,11 @@ export class CustomerPortal extends ClientSDK {
34
35
  return (this._seats ??= new Seats(this._options));
35
36
  }
36
37
 
38
+ private _customerSession?: CustomerSession;
39
+ get customerSession(): CustomerSession {
40
+ return (this._customerSession ??= new CustomerSession(this._options));
41
+ }
42
+
37
43
  private _downloadables?: Downloadables;
38
44
  get downloadables(): Downloadables {
39
45
  return (this._downloadables ??= new Downloadables(this._options));
@@ -0,0 +1,30 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { customerPortalCustomerSessionIntrospect } from "../funcs/customerPortalCustomerSessionIntrospect.js";
6
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
7
+ import { CustomerCustomerSession } from "../models/components/customercustomersession.js";
8
+ import { CustomerPortalCustomerSessionIntrospectSecurity } from "../models/operations/customerportalcustomersessionintrospect.js";
9
+ import { unwrapAsync } from "../types/fp.js";
10
+
11
+ export class CustomerSession extends ClientSDK {
12
+ /**
13
+ * Introspect Customer Session
14
+ *
15
+ * @remarks
16
+ * Introspect the current session and return its information.
17
+ *
18
+ * **Scopes**: `customer_portal:read` `customer_portal:write`
19
+ */
20
+ async introspect(
21
+ security: CustomerPortalCustomerSessionIntrospectSecurity,
22
+ options?: RequestOptions,
23
+ ): Promise<CustomerCustomerSession> {
24
+ return unwrapAsync(customerPortalCustomerSessionIntrospect(
25
+ this,
26
+ security,
27
+ options,
28
+ ));
29
+ }
30
+ }