@polar-sh/sdk 0.13.1 → 0.13.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 (155) hide show
  1. package/README.md +13 -0
  2. package/docs/sdks/checkoutlinks/README.md +400 -0
  3. package/funcs/checkoutLinksCreate.d.ts +16 -0
  4. package/funcs/checkoutLinksCreate.d.ts.map +1 -0
  5. package/funcs/checkoutLinksCreate.js +95 -0
  6. package/funcs/checkoutLinksCreate.js.map +1 -0
  7. package/funcs/checkoutLinksDelete.d.ts +16 -0
  8. package/funcs/checkoutLinksDelete.d.ts.map +1 -0
  9. package/funcs/checkoutLinksDelete.js +101 -0
  10. package/funcs/checkoutLinksDelete.js.map +1 -0
  11. package/funcs/checkoutLinksGet.d.ts +17 -0
  12. package/funcs/checkoutLinksGet.d.ts.map +1 -0
  13. package/funcs/checkoutLinksGet.js +101 -0
  14. package/funcs/checkoutLinksGet.js.map +1 -0
  15. package/funcs/checkoutLinksList.d.ts +17 -0
  16. package/funcs/checkoutLinksList.d.ts.map +1 -0
  17. package/funcs/checkoutLinksList.js +130 -0
  18. package/funcs/checkoutLinksList.js.map +1 -0
  19. package/funcs/checkoutLinksUpdate.d.ts +17 -0
  20. package/funcs/checkoutLinksUpdate.d.ts.map +1 -0
  21. package/funcs/checkoutLinksUpdate.js +104 -0
  22. package/funcs/checkoutLinksUpdate.js.map +1 -0
  23. package/lib/config.d.ts +2 -2
  24. package/lib/config.js +2 -2
  25. package/models/components/checkoutlink.d.ts +69 -0
  26. package/models/components/checkoutlink.d.ts.map +1 -0
  27. package/models/components/checkoutlink.js +90 -0
  28. package/models/components/checkoutlink.js.map +1 -0
  29. package/models/components/checkoutlinkcreate.d.ts +85 -0
  30. package/models/components/checkoutlinkcreate.d.ts.map +1 -0
  31. package/models/components/checkoutlinkcreate.js +90 -0
  32. package/models/components/checkoutlinkcreate.js.map +1 -0
  33. package/models/components/checkoutlinksortproperty.d.ts +28 -0
  34. package/models/components/checkoutlinksortproperty.d.ts.map +1 -0
  35. package/models/components/checkoutlinksortproperty.js +50 -0
  36. package/models/components/checkoutlinksortproperty.js.map +1 -0
  37. package/models/components/checkoutlinkupdate.d.ts +46 -0
  38. package/models/components/checkoutlinkupdate.d.ts.map +1 -0
  39. package/models/components/checkoutlinkupdate.js +61 -0
  40. package/models/components/checkoutlinkupdate.js.map +1 -0
  41. package/models/components/checkoutpublic.d.ts +5 -2
  42. package/models/components/checkoutpublic.d.ts.map +1 -1
  43. package/models/components/checkoutpublic.js +2 -2
  44. package/models/components/checkoutpublic.js.map +1 -1
  45. package/models/components/index.d.ts +5 -0
  46. package/models/components/index.d.ts.map +1 -1
  47. package/models/components/index.js +5 -0
  48. package/models/components/index.js.map +1 -1
  49. package/models/components/listresourcecheckoutlink.d.ts +29 -0
  50. package/models/components/listresourcecheckoutlink.d.ts.map +1 -0
  51. package/models/components/listresourcecheckoutlink.js +54 -0
  52. package/models/components/listresourcecheckoutlink.js.map +1 -0
  53. package/models/components/oauth2client.js +2 -2
  54. package/models/components/oauth2client.js.map +1 -1
  55. package/models/components/oauth2clientconfiguration.js +2 -2
  56. package/models/components/oauth2clientconfiguration.js.map +1 -1
  57. package/models/components/oauth2clientconfigurationupdate.js +2 -2
  58. package/models/components/oauth2clientconfigurationupdate.js.map +1 -1
  59. package/models/components/polarcheckoutschemascheckout.d.ts +2 -109
  60. package/models/components/polarcheckoutschemascheckout.d.ts.map +1 -1
  61. package/models/components/polarcheckoutschemascheckout.js +3 -108
  62. package/models/components/polarcheckoutschemascheckout.js.map +1 -1
  63. package/models/components/productpriceonetimecustom.d.ts +5 -0
  64. package/models/components/productpriceonetimecustom.d.ts.map +1 -1
  65. package/models/components/productpriceonetimecustom.js +4 -0
  66. package/models/components/productpriceonetimecustom.js.map +1 -1
  67. package/models/components/productpriceonetimefixed.d.ts +5 -0
  68. package/models/components/productpriceonetimefixed.d.ts.map +1 -1
  69. package/models/components/productpriceonetimefixed.js +4 -0
  70. package/models/components/productpriceonetimefixed.js.map +1 -1
  71. package/models/components/productpriceonetimefree.d.ts +5 -0
  72. package/models/components/productpriceonetimefree.d.ts.map +1 -1
  73. package/models/components/productpriceonetimefree.js +4 -0
  74. package/models/components/productpriceonetimefree.js.map +1 -1
  75. package/models/components/productpricerecurringcustom.d.ts +5 -0
  76. package/models/components/productpricerecurringcustom.d.ts.map +1 -1
  77. package/models/components/productpricerecurringcustom.js +4 -0
  78. package/models/components/productpricerecurringcustom.js.map +1 -1
  79. package/models/components/productpricerecurringfixed.d.ts +5 -0
  80. package/models/components/productpricerecurringfixed.d.ts.map +1 -1
  81. package/models/components/productpricerecurringfixed.js +4 -0
  82. package/models/components/productpricerecurringfixed.js.map +1 -1
  83. package/models/components/productpricerecurringfree.d.ts +5 -0
  84. package/models/components/productpricerecurringfree.d.ts.map +1 -1
  85. package/models/components/productpricerecurringfree.js +4 -0
  86. package/models/components/productpricerecurringfree.js.map +1 -1
  87. package/models/components/webhookcheckoutcreatedpayload.d.ts +3 -3
  88. package/models/components/webhookcheckoutcreatedpayload.d.ts.map +1 -1
  89. package/models/components/webhookcheckoutcreatedpayload.js +2 -2
  90. package/models/components/webhookcheckoutcreatedpayload.js.map +1 -1
  91. package/models/components/webhookcheckoutupdatedpayload.d.ts +3 -3
  92. package/models/components/webhookcheckoutupdatedpayload.d.ts.map +1 -1
  93. package/models/components/webhookcheckoutupdatedpayload.js +2 -2
  94. package/models/components/webhookcheckoutupdatedpayload.js.map +1 -1
  95. package/models/operations/checkoutlinksdelete.d.ts +28 -0
  96. package/models/operations/checkoutlinksdelete.d.ts.map +1 -0
  97. package/models/operations/checkoutlinksdelete.js +50 -0
  98. package/models/operations/checkoutlinksdelete.js.map +1 -0
  99. package/models/operations/checkoutlinksget.d.ts +28 -0
  100. package/models/operations/checkoutlinksget.d.ts.map +1 -0
  101. package/models/operations/checkoutlinksget.js +50 -0
  102. package/models/operations/checkoutlinksget.js.map +1 -0
  103. package/models/operations/checkoutlinkslist.d.ts +116 -0
  104. package/models/operations/checkoutlinkslist.d.ts.map +1 -0
  105. package/models/operations/checkoutlinkslist.js +129 -0
  106. package/models/operations/checkoutlinkslist.js.map +1 -0
  107. package/models/operations/checkoutlinksupdate.d.ts +31 -0
  108. package/models/operations/checkoutlinksupdate.d.ts.map +1 -0
  109. package/models/operations/checkoutlinksupdate.js +62 -0
  110. package/models/operations/checkoutlinksupdate.js.map +1 -0
  111. package/models/operations/index.d.ts +4 -0
  112. package/models/operations/index.d.ts.map +1 -1
  113. package/models/operations/index.js +4 -0
  114. package/models/operations/index.js.map +1 -1
  115. package/package.json +1 -1
  116. package/sdk/checkoutlinks.d.ts +42 -0
  117. package/sdk/checkoutlinks.d.ts.map +1 -0
  118. package/sdk/checkoutlinks.js +63 -0
  119. package/sdk/checkoutlinks.js.map +1 -0
  120. package/sdk/sdk.d.ts +3 -0
  121. package/sdk/sdk.d.ts.map +1 -1
  122. package/sdk/sdk.js +5 -0
  123. package/sdk/sdk.js.map +1 -1
  124. package/src/funcs/checkoutLinksCreate.ts +124 -0
  125. package/src/funcs/checkoutLinksDelete.ts +135 -0
  126. package/src/funcs/checkoutLinksGet.ts +134 -0
  127. package/src/funcs/checkoutLinksList.ts +189 -0
  128. package/src/funcs/checkoutLinksUpdate.ts +138 -0
  129. package/src/lib/config.ts +2 -2
  130. package/src/models/components/checkoutlink.ts +131 -0
  131. package/src/models/components/checkoutlinkcreate.ts +127 -0
  132. package/src/models/components/checkoutlinksortproperty.ts +35 -0
  133. package/src/models/components/checkoutlinkupdate.ts +73 -0
  134. package/src/models/components/checkoutpublic.ts +7 -4
  135. package/src/models/components/index.ts +5 -0
  136. package/src/models/components/listresourcecheckoutlink.ts +61 -0
  137. package/src/models/components/oauth2client.ts +2 -2
  138. package/src/models/components/oauth2clientconfiguration.ts +2 -2
  139. package/src/models/components/oauth2clientconfigurationupdate.ts +2 -2
  140. package/src/models/components/polarcheckoutschemascheckout.ts +4 -217
  141. package/src/models/components/productpriceonetimecustom.ts +9 -0
  142. package/src/models/components/productpriceonetimefixed.ts +9 -0
  143. package/src/models/components/productpriceonetimefree.ts +9 -0
  144. package/src/models/components/productpricerecurringcustom.ts +9 -0
  145. package/src/models/components/productpricerecurringfixed.ts +9 -0
  146. package/src/models/components/productpricerecurringfree.ts +9 -0
  147. package/src/models/components/webhookcheckoutcreatedpayload.ts +8 -8
  148. package/src/models/components/webhookcheckoutupdatedpayload.ts +8 -8
  149. package/src/models/operations/checkoutlinksdelete.ts +48 -0
  150. package/src/models/operations/checkoutlinksget.ts +48 -0
  151. package/src/models/operations/checkoutlinkslist.ts +224 -0
  152. package/src/models/operations/checkoutlinksupdate.ts +62 -0
  153. package/src/models/operations/index.ts +4 -0
  154. package/src/sdk/checkoutlinks.ts +101 -0
  155. package/src/sdk/sdk.ts +6 -0
@@ -0,0 +1,189 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { PolarCore } from "../core.js";
6
+ import { dlv } from "../lib/dlv.js";
7
+ import { encodeFormQuery } from "../lib/encodings.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../models/errors/httpclienterrors.js";
20
+ import * as errors from "../models/errors/index.js";
21
+ import { SDKError } from "../models/errors/sdkerror.js";
22
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
23
+ import * as operations from "../models/operations/index.js";
24
+ import { Result } from "../types/fp.js";
25
+ import {
26
+ createPageIterator,
27
+ haltIterator,
28
+ PageIterator,
29
+ Paginator,
30
+ } from "../types/operations.js";
31
+
32
+ /**
33
+ * List Checkout Links
34
+ *
35
+ * @remarks
36
+ * List checkout links.
37
+ */
38
+ export async function checkoutLinksList(
39
+ client: PolarCore,
40
+ request: operations.CheckoutLinksListRequest,
41
+ options?: RequestOptions,
42
+ ): Promise<
43
+ PageIterator<
44
+ Result<
45
+ operations.CheckoutLinksListResponse,
46
+ | errors.HTTPValidationError
47
+ | SDKError
48
+ | SDKValidationError
49
+ | UnexpectedClientError
50
+ | InvalidRequestError
51
+ | RequestAbortedError
52
+ | RequestTimeoutError
53
+ | ConnectionError
54
+ >
55
+ >
56
+ > {
57
+ const parsed = safeParse(
58
+ request,
59
+ (value) => operations.CheckoutLinksListRequest$outboundSchema.parse(value),
60
+ "Input validation failed",
61
+ );
62
+ if (!parsed.ok) {
63
+ return haltIterator(parsed);
64
+ }
65
+ const payload = parsed.value;
66
+ const body = null;
67
+
68
+ const path = pathToFunc("/v1/checkout-links/")();
69
+
70
+ const query = encodeFormQuery({
71
+ "limit": payload.limit,
72
+ "organization_id": payload.organization_id,
73
+ "page": payload.page,
74
+ "product_id": payload.product_id,
75
+ "sorting": payload.sorting,
76
+ });
77
+
78
+ const headers = new Headers({
79
+ Accept: "application/json",
80
+ });
81
+
82
+ const secConfig = await extractSecurity(client._options.accessToken);
83
+ const securityInput = secConfig == null ? {} : { accessToken: secConfig };
84
+ const context = {
85
+ operationID: "checkout-links:list",
86
+ oAuth2Scopes: [],
87
+ securitySource: client._options.accessToken,
88
+ };
89
+ const requestSecurity = resolveGlobalSecurity(securityInput);
90
+
91
+ const requestRes = client._createRequest(context, {
92
+ security: requestSecurity,
93
+ method: "GET",
94
+ path: path,
95
+ headers: headers,
96
+ query: query,
97
+ body: body,
98
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
99
+ }, options);
100
+ if (!requestRes.ok) {
101
+ return haltIterator(requestRes);
102
+ }
103
+ const req = requestRes.value;
104
+
105
+ const doResult = await client._do(req, {
106
+ context,
107
+ errorCodes: ["422", "4XX", "5XX"],
108
+ retryConfig: options?.retries
109
+ || client._options.retryConfig,
110
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
111
+ });
112
+ if (!doResult.ok) {
113
+ return haltIterator(doResult);
114
+ }
115
+ const response = doResult.value;
116
+
117
+ const responseFields = {
118
+ HttpMeta: { Response: response, Request: req },
119
+ };
120
+
121
+ const [result, raw] = await M.match<
122
+ operations.CheckoutLinksListResponse,
123
+ | errors.HTTPValidationError
124
+ | SDKError
125
+ | SDKValidationError
126
+ | UnexpectedClientError
127
+ | InvalidRequestError
128
+ | RequestAbortedError
129
+ | RequestTimeoutError
130
+ | ConnectionError
131
+ >(
132
+ M.json(200, operations.CheckoutLinksListResponse$inboundSchema, {
133
+ key: "Result",
134
+ }),
135
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
136
+ M.fail(["4XX", "5XX"]),
137
+ )(response, { extraFields: responseFields });
138
+ if (!result.ok) {
139
+ return haltIterator(result);
140
+ }
141
+
142
+ const nextFunc = (
143
+ responseData: unknown,
144
+ ): Paginator<
145
+ Result<
146
+ operations.CheckoutLinksListResponse,
147
+ | errors.HTTPValidationError
148
+ | SDKError
149
+ | SDKValidationError
150
+ | UnexpectedClientError
151
+ | InvalidRequestError
152
+ | RequestAbortedError
153
+ | RequestTimeoutError
154
+ | ConnectionError
155
+ >
156
+ > => {
157
+ const page = request?.page || 0;
158
+ const nextPage = page + 1;
159
+ const numPages = dlv(responseData, "pagination.max_page");
160
+ if (numPages == null || numPages <= page) {
161
+ return () => null;
162
+ }
163
+
164
+ if (!responseData) {
165
+ return () => null;
166
+ }
167
+ const results = dlv(responseData, "items");
168
+ if (!Array.isArray(results) || !results.length) {
169
+ return () => null;
170
+ }
171
+ const limit = request?.limit || 0;
172
+ if (results.length < limit) {
173
+ return () => null;
174
+ }
175
+
176
+ return () =>
177
+ checkoutLinksList(
178
+ client,
179
+ {
180
+ ...request,
181
+ page: nextPage,
182
+ },
183
+ options,
184
+ );
185
+ };
186
+
187
+ const page = { ...result, next: nextFunc(raw) };
188
+ return { ...page, ...createPageIterator(page, (v) => !v.ok) };
189
+ }
@@ -0,0 +1,138 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { PolarCore } from "../core.js";
6
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { safeParse } from "../lib/schemas.js";
9
+ import { RequestOptions } from "../lib/sdks.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
+ import { pathToFunc } from "../lib/url.js";
12
+ import * as components from "../models/components/index.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../models/errors/httpclienterrors.js";
20
+ import * as errors from "../models/errors/index.js";
21
+ import { SDKError } from "../models/errors/sdkerror.js";
22
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
23
+ import * as operations from "../models/operations/index.js";
24
+ import { Result } from "../types/fp.js";
25
+
26
+ /**
27
+ * Update Checkout Link
28
+ *
29
+ * @remarks
30
+ * Update a checkout link.
31
+ */
32
+ export async function checkoutLinksUpdate(
33
+ client: PolarCore,
34
+ request: operations.CheckoutLinksUpdateRequest,
35
+ options?: RequestOptions,
36
+ ): Promise<
37
+ Result<
38
+ components.CheckoutLink,
39
+ | errors.ResourceNotFound
40
+ | errors.HTTPValidationError
41
+ | SDKError
42
+ | SDKValidationError
43
+ | UnexpectedClientError
44
+ | InvalidRequestError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | ConnectionError
48
+ >
49
+ > {
50
+ const parsed = safeParse(
51
+ request,
52
+ (value) =>
53
+ operations.CheckoutLinksUpdateRequest$outboundSchema.parse(value),
54
+ "Input validation failed",
55
+ );
56
+ if (!parsed.ok) {
57
+ return parsed;
58
+ }
59
+ const payload = parsed.value;
60
+ const body = encodeJSON("body", payload.CheckoutLinkUpdate, {
61
+ explode: true,
62
+ });
63
+
64
+ const pathParams = {
65
+ id: encodeSimple("id", payload.id, {
66
+ explode: false,
67
+ charEncoding: "percent",
68
+ }),
69
+ };
70
+
71
+ const path = pathToFunc("/v1/checkout-links/{id}")(pathParams);
72
+
73
+ const headers = new Headers({
74
+ "Content-Type": "application/json",
75
+ Accept: "application/json",
76
+ });
77
+
78
+ const secConfig = await extractSecurity(client._options.accessToken);
79
+ const securityInput = secConfig == null ? {} : { accessToken: secConfig };
80
+ const context = {
81
+ operationID: "checkout-links:update",
82
+ oAuth2Scopes: [],
83
+ securitySource: client._options.accessToken,
84
+ };
85
+ const requestSecurity = resolveGlobalSecurity(securityInput);
86
+
87
+ const requestRes = client._createRequest(context, {
88
+ security: requestSecurity,
89
+ method: "PATCH",
90
+ path: path,
91
+ headers: headers,
92
+ body: body,
93
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
94
+ }, options);
95
+ if (!requestRes.ok) {
96
+ return requestRes;
97
+ }
98
+ const req = requestRes.value;
99
+
100
+ const doResult = await client._do(req, {
101
+ context,
102
+ errorCodes: ["404", "422", "4XX", "5XX"],
103
+ retryConfig: options?.retries
104
+ || client._options.retryConfig,
105
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
106
+ });
107
+ if (!doResult.ok) {
108
+ return doResult;
109
+ }
110
+ const response = doResult.value;
111
+
112
+ const responseFields = {
113
+ HttpMeta: { Response: response, Request: req },
114
+ };
115
+
116
+ const [result] = await M.match<
117
+ components.CheckoutLink,
118
+ | errors.ResourceNotFound
119
+ | errors.HTTPValidationError
120
+ | SDKError
121
+ | SDKValidationError
122
+ | UnexpectedClientError
123
+ | InvalidRequestError
124
+ | RequestAbortedError
125
+ | RequestTimeoutError
126
+ | ConnectionError
127
+ >(
128
+ M.json(200, components.CheckoutLink$inboundSchema),
129
+ M.jsonErr(404, errors.ResourceNotFound$inboundSchema),
130
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
131
+ M.fail(["4XX", "5XX"]),
132
+ )(response, { extraFields: responseFields });
133
+ if (!result.ok) {
134
+ return result;
135
+ }
136
+
137
+ return result;
138
+ }
package/src/lib/config.ts CHANGED
@@ -60,7 +60,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
60
60
  export const SDK_METADATA = {
61
61
  language: "typescript",
62
62
  openapiDocVersion: "0.1.0",
63
- sdkVersion: "0.13.1",
63
+ sdkVersion: "0.13.2",
64
64
  genVersion: "2.438.3",
65
- userAgent: "speakeasy-sdk/typescript 0.13.1 2.438.3 0.1.0 @polar-sh/sdk",
65
+ userAgent: "speakeasy-sdk/typescript 0.13.2 2.438.3 0.1.0 @polar-sh/sdk",
66
66
  } as const;
@@ -0,0 +1,131 @@
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 {
8
+ ProductPrice,
9
+ ProductPrice$inboundSchema,
10
+ ProductPrice$Outbound,
11
+ ProductPrice$outboundSchema,
12
+ } from "./productprice.js";
13
+
14
+ /**
15
+ * Checkout link data.
16
+ */
17
+ export type CheckoutLink = {
18
+ /**
19
+ * Creation timestamp of the object.
20
+ */
21
+ createdAt: Date;
22
+ /**
23
+ * Last modification timestamp of the object.
24
+ */
25
+ modifiedAt: Date | null;
26
+ /**
27
+ * The ID of the object.
28
+ */
29
+ id: string;
30
+ metadata: { [k: string]: string };
31
+ paymentProcessor?: "stripe" | undefined;
32
+ /**
33
+ * Client secret used to access the checkout link.
34
+ */
35
+ clientSecret: string;
36
+ /**
37
+ * URL where the customer will be redirected after a successful payment.
38
+ */
39
+ successUrl: string | null;
40
+ /**
41
+ * ID of the product price to checkout.
42
+ */
43
+ productPriceId: string;
44
+ productPrice: ProductPrice;
45
+ url: string;
46
+ };
47
+
48
+ /** @internal */
49
+ export const CheckoutLink$inboundSchema: z.ZodType<
50
+ CheckoutLink,
51
+ z.ZodTypeDef,
52
+ unknown
53
+ > = z.object({
54
+ created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
55
+ modified_at: z.nullable(
56
+ z.string().datetime({ offset: true }).transform(v => new Date(v)),
57
+ ),
58
+ id: z.string(),
59
+ metadata: z.record(z.string()),
60
+ payment_processor: z.literal("stripe").optional(),
61
+ client_secret: z.string(),
62
+ success_url: z.nullable(z.string()),
63
+ product_price_id: z.string(),
64
+ product_price: ProductPrice$inboundSchema,
65
+ url: z.string(),
66
+ }).transform((v) => {
67
+ return remap$(v, {
68
+ "created_at": "createdAt",
69
+ "modified_at": "modifiedAt",
70
+ "payment_processor": "paymentProcessor",
71
+ "client_secret": "clientSecret",
72
+ "success_url": "successUrl",
73
+ "product_price_id": "productPriceId",
74
+ "product_price": "productPrice",
75
+ });
76
+ });
77
+
78
+ /** @internal */
79
+ export type CheckoutLink$Outbound = {
80
+ created_at: string;
81
+ modified_at: string | null;
82
+ id: string;
83
+ metadata: { [k: string]: string };
84
+ payment_processor: "stripe";
85
+ client_secret: string;
86
+ success_url: string | null;
87
+ product_price_id: string;
88
+ product_price: ProductPrice$Outbound;
89
+ url: string;
90
+ };
91
+
92
+ /** @internal */
93
+ export const CheckoutLink$outboundSchema: z.ZodType<
94
+ CheckoutLink$Outbound,
95
+ z.ZodTypeDef,
96
+ CheckoutLink
97
+ > = z.object({
98
+ createdAt: z.date().transform(v => v.toISOString()),
99
+ modifiedAt: z.nullable(z.date().transform(v => v.toISOString())),
100
+ id: z.string(),
101
+ metadata: z.record(z.string()),
102
+ paymentProcessor: z.literal("stripe").default("stripe"),
103
+ clientSecret: z.string(),
104
+ successUrl: z.nullable(z.string()),
105
+ productPriceId: z.string(),
106
+ productPrice: ProductPrice$outboundSchema,
107
+ url: z.string(),
108
+ }).transform((v) => {
109
+ return remap$(v, {
110
+ createdAt: "created_at",
111
+ modifiedAt: "modified_at",
112
+ paymentProcessor: "payment_processor",
113
+ clientSecret: "client_secret",
114
+ successUrl: "success_url",
115
+ productPriceId: "product_price_id",
116
+ productPrice: "product_price",
117
+ });
118
+ });
119
+
120
+ /**
121
+ * @internal
122
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
123
+ */
124
+ export namespace CheckoutLink$ {
125
+ /** @deprecated use `CheckoutLink$inboundSchema` instead. */
126
+ export const inboundSchema = CheckoutLink$inboundSchema;
127
+ /** @deprecated use `CheckoutLink$outboundSchema` instead. */
128
+ export const outboundSchema = CheckoutLink$outboundSchema;
129
+ /** @deprecated use `CheckoutLink$Outbound` instead. */
130
+ export type Outbound = CheckoutLink$Outbound;
131
+ }
@@ -0,0 +1,127 @@
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 { ClosedEnum } from "../../types/enums.js";
8
+
9
+ /**
10
+ * Payment processor to use. Currently only Stripe is supported.
11
+ */
12
+ export const CheckoutLinkCreatePaymentProcessor = {
13
+ Stripe: "stripe",
14
+ } as const;
15
+ /**
16
+ * Payment processor to use. Currently only Stripe is supported.
17
+ */
18
+ export type CheckoutLinkCreatePaymentProcessor = ClosedEnum<
19
+ typeof CheckoutLinkCreatePaymentProcessor
20
+ >;
21
+
22
+ /**
23
+ * Schema to create a new checkout link.
24
+ */
25
+ export type CheckoutLinkCreate = {
26
+ /**
27
+ * Key-value object allowing you to store additional information.
28
+ *
29
+ * @remarks
30
+ *
31
+ * The key must be a string with a maximum length of **40 characters**.
32
+ * The value must be a string with a maximum length of **500 characters**.
33
+ * You can store up to **50 key-value pairs**.
34
+ */
35
+ metadata?: { [k: string]: string } | undefined;
36
+ /**
37
+ * Payment processor to use. Currently only Stripe is supported.
38
+ */
39
+ paymentProcessor?: "stripe" | undefined;
40
+ /**
41
+ * ID of the product price to checkout.
42
+ */
43
+ productPriceId: string;
44
+ /**
45
+ * URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id.
46
+ */
47
+ successUrl?: string | null | undefined;
48
+ };
49
+
50
+ /** @internal */
51
+ export const CheckoutLinkCreatePaymentProcessor$inboundSchema: z.ZodNativeEnum<
52
+ typeof CheckoutLinkCreatePaymentProcessor
53
+ > = z.nativeEnum(CheckoutLinkCreatePaymentProcessor);
54
+
55
+ /** @internal */
56
+ export const CheckoutLinkCreatePaymentProcessor$outboundSchema: z.ZodNativeEnum<
57
+ typeof CheckoutLinkCreatePaymentProcessor
58
+ > = CheckoutLinkCreatePaymentProcessor$inboundSchema;
59
+
60
+ /**
61
+ * @internal
62
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
63
+ */
64
+ export namespace CheckoutLinkCreatePaymentProcessor$ {
65
+ /** @deprecated use `CheckoutLinkCreatePaymentProcessor$inboundSchema` instead. */
66
+ export const inboundSchema = CheckoutLinkCreatePaymentProcessor$inboundSchema;
67
+ /** @deprecated use `CheckoutLinkCreatePaymentProcessor$outboundSchema` instead. */
68
+ export const outboundSchema =
69
+ CheckoutLinkCreatePaymentProcessor$outboundSchema;
70
+ }
71
+
72
+ /** @internal */
73
+ export const CheckoutLinkCreate$inboundSchema: z.ZodType<
74
+ CheckoutLinkCreate,
75
+ z.ZodTypeDef,
76
+ unknown
77
+ > = z.object({
78
+ metadata: z.record(z.string()).optional(),
79
+ payment_processor: z.literal("stripe").optional(),
80
+ product_price_id: z.string(),
81
+ success_url: z.nullable(z.string()).optional(),
82
+ }).transform((v) => {
83
+ return remap$(v, {
84
+ "payment_processor": "paymentProcessor",
85
+ "product_price_id": "productPriceId",
86
+ "success_url": "successUrl",
87
+ });
88
+ });
89
+
90
+ /** @internal */
91
+ export type CheckoutLinkCreate$Outbound = {
92
+ metadata?: { [k: string]: string } | undefined;
93
+ payment_processor: "stripe";
94
+ product_price_id: string;
95
+ success_url?: string | null | undefined;
96
+ };
97
+
98
+ /** @internal */
99
+ export const CheckoutLinkCreate$outboundSchema: z.ZodType<
100
+ CheckoutLinkCreate$Outbound,
101
+ z.ZodTypeDef,
102
+ CheckoutLinkCreate
103
+ > = z.object({
104
+ metadata: z.record(z.string()).optional(),
105
+ paymentProcessor: z.literal("stripe").default("stripe"),
106
+ productPriceId: z.string(),
107
+ successUrl: z.nullable(z.string()).optional(),
108
+ }).transform((v) => {
109
+ return remap$(v, {
110
+ paymentProcessor: "payment_processor",
111
+ productPriceId: "product_price_id",
112
+ successUrl: "success_url",
113
+ });
114
+ });
115
+
116
+ /**
117
+ * @internal
118
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
119
+ */
120
+ export namespace CheckoutLinkCreate$ {
121
+ /** @deprecated use `CheckoutLinkCreate$inboundSchema` instead. */
122
+ export const inboundSchema = CheckoutLinkCreate$inboundSchema;
123
+ /** @deprecated use `CheckoutLinkCreate$outboundSchema` instead. */
124
+ export const outboundSchema = CheckoutLinkCreate$outboundSchema;
125
+ /** @deprecated use `CheckoutLinkCreate$Outbound` instead. */
126
+ export type Outbound = CheckoutLinkCreate$Outbound;
127
+ }
@@ -0,0 +1,35 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { ClosedEnum } from "../../types/enums.js";
7
+
8
+ export const CheckoutLinkSortProperty = {
9
+ CreatedAt: "created_at",
10
+ MinusCreatedAt: "-created_at",
11
+ } as const;
12
+ export type CheckoutLinkSortProperty = ClosedEnum<
13
+ typeof CheckoutLinkSortProperty
14
+ >;
15
+
16
+ /** @internal */
17
+ export const CheckoutLinkSortProperty$inboundSchema: z.ZodNativeEnum<
18
+ typeof CheckoutLinkSortProperty
19
+ > = z.nativeEnum(CheckoutLinkSortProperty);
20
+
21
+ /** @internal */
22
+ export const CheckoutLinkSortProperty$outboundSchema: z.ZodNativeEnum<
23
+ typeof CheckoutLinkSortProperty
24
+ > = CheckoutLinkSortProperty$inboundSchema;
25
+
26
+ /**
27
+ * @internal
28
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
29
+ */
30
+ export namespace CheckoutLinkSortProperty$ {
31
+ /** @deprecated use `CheckoutLinkSortProperty$inboundSchema` instead. */
32
+ export const inboundSchema = CheckoutLinkSortProperty$inboundSchema;
33
+ /** @deprecated use `CheckoutLinkSortProperty$outboundSchema` instead. */
34
+ export const outboundSchema = CheckoutLinkSortProperty$outboundSchema;
35
+ }
@@ -0,0 +1,73 @@
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
+
8
+ /**
9
+ * Schema to update an existing checkout link.
10
+ */
11
+ export type CheckoutLinkUpdate = {
12
+ /**
13
+ * Key-value object allowing you to store additional information.
14
+ *
15
+ * @remarks
16
+ *
17
+ * The key must be a string with a maximum length of **40 characters**.
18
+ * The value must be a string with a maximum length of **500 characters**.
19
+ * You can store up to **50 key-value pairs**.
20
+ */
21
+ metadata?: { [k: string]: string } | null | undefined;
22
+ /**
23
+ * URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id.
24
+ */
25
+ successUrl?: string | null | undefined;
26
+ };
27
+
28
+ /** @internal */
29
+ export const CheckoutLinkUpdate$inboundSchema: z.ZodType<
30
+ CheckoutLinkUpdate,
31
+ z.ZodTypeDef,
32
+ unknown
33
+ > = z.object({
34
+ metadata: z.nullable(z.record(z.string())).optional(),
35
+ success_url: z.nullable(z.string()).optional(),
36
+ }).transform((v) => {
37
+ return remap$(v, {
38
+ "success_url": "successUrl",
39
+ });
40
+ });
41
+
42
+ /** @internal */
43
+ export type CheckoutLinkUpdate$Outbound = {
44
+ metadata?: { [k: string]: string } | null | undefined;
45
+ success_url?: string | null | undefined;
46
+ };
47
+
48
+ /** @internal */
49
+ export const CheckoutLinkUpdate$outboundSchema: z.ZodType<
50
+ CheckoutLinkUpdate$Outbound,
51
+ z.ZodTypeDef,
52
+ CheckoutLinkUpdate
53
+ > = z.object({
54
+ metadata: z.nullable(z.record(z.string())).optional(),
55
+ successUrl: z.nullable(z.string()).optional(),
56
+ }).transform((v) => {
57
+ return remap$(v, {
58
+ successUrl: "success_url",
59
+ });
60
+ });
61
+
62
+ /**
63
+ * @internal
64
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
65
+ */
66
+ export namespace CheckoutLinkUpdate$ {
67
+ /** @deprecated use `CheckoutLinkUpdate$inboundSchema` instead. */
68
+ export const inboundSchema = CheckoutLinkUpdate$inboundSchema;
69
+ /** @deprecated use `CheckoutLinkUpdate$outboundSchema` instead. */
70
+ export const outboundSchema = CheckoutLinkUpdate$outboundSchema;
71
+ /** @deprecated use `CheckoutLinkUpdate$Outbound` instead. */
72
+ export type Outbound = CheckoutLinkUpdate$Outbound;
73
+ }