@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
package/README.md CHANGED
@@ -134,6 +134,14 @@ run();
134
134
  * [delete](docs/sdks/benefits/README.md#delete) - Delete Benefit
135
135
  * [grants](docs/sdks/benefits/README.md#grants) - List Benefit Grants
136
136
 
137
+ ### [checkoutLinks](docs/sdks/checkoutlinks/README.md)
138
+
139
+ * [list](docs/sdks/checkoutlinks/README.md#list) - List Checkout Links
140
+ * [create](docs/sdks/checkoutlinks/README.md#create) - Create Checkout Link
141
+ * [get](docs/sdks/checkoutlinks/README.md#get) - Get Checkout Link
142
+ * [update](docs/sdks/checkoutlinks/README.md#update) - Update Checkout Link
143
+ * [delete](docs/sdks/checkoutlinks/README.md#delete) - Delete Checkout Link
144
+
137
145
  ### [checkouts](docs/sdks/checkouts/README.md)
138
146
 
139
147
  * [~~create~~](docs/sdks/checkouts/README.md#create) - Create Checkout :warning: **Deprecated** Use `create` instead.
@@ -299,6 +307,11 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
299
307
  - [`benefitsGrants`](docs/sdks/benefits/README.md#grants) - List Benefit Grants
300
308
  - [`benefitsList`](docs/sdks/benefits/README.md#list) - List Benefits
301
309
  - [`benefitsUpdate`](docs/sdks/benefits/README.md#update) - Update Benefit
310
+ - [`checkoutLinksCreate`](docs/sdks/checkoutlinks/README.md#create) - Create Checkout Link
311
+ - [`checkoutLinksDelete`](docs/sdks/checkoutlinks/README.md#delete) - Delete Checkout Link
312
+ - [`checkoutLinksGet`](docs/sdks/checkoutlinks/README.md#get) - Get Checkout Link
313
+ - [`checkoutLinksList`](docs/sdks/checkoutlinks/README.md#list) - List Checkout Links
314
+ - [`checkoutLinksUpdate`](docs/sdks/checkoutlinks/README.md#update) - Update Checkout Link
302
315
  - [`checkoutsCustomClientConfirm`](docs/sdks/custom/README.md#clientconfirm) - Confirm Checkout Session from Client
303
316
  - [`checkoutsCustomClientGet`](docs/sdks/custom/README.md#clientget) - Get Checkout Session from Client
304
317
  - [`checkoutsCustomClientUpdate`](docs/sdks/custom/README.md#clientupdate) - Update Checkout Session from Client
@@ -0,0 +1,400 @@
1
+ # CheckoutLinks
2
+ (*checkoutLinks*)
3
+
4
+ ## Overview
5
+
6
+ ### Available Operations
7
+
8
+ * [list](#list) - List Checkout Links
9
+ * [create](#create) - Create Checkout Link
10
+ * [get](#get) - Get Checkout Link
11
+ * [update](#update) - Update Checkout Link
12
+ * [delete](#delete) - Delete Checkout Link
13
+
14
+ ## list
15
+
16
+ List checkout links.
17
+
18
+ ### Example Usage
19
+
20
+ ```typescript
21
+ import { Polar } from "@polar-sh/sdk";
22
+
23
+ const polar = new Polar({
24
+ accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
25
+ });
26
+
27
+ async function run() {
28
+ const result = await polar.checkoutLinks.list({});
29
+
30
+ for await (const page of result) {
31
+ // Handle the page
32
+ console.log(page);
33
+ }
34
+ }
35
+
36
+ run();
37
+ ```
38
+
39
+ ### Standalone function
40
+
41
+ The standalone function version of this method:
42
+
43
+ ```typescript
44
+ import { PolarCore } from "@polar-sh/sdk/core.js";
45
+ import { checkoutLinksList } from "@polar-sh/sdk/funcs/checkoutLinksList.js";
46
+
47
+ // Use `PolarCore` for best tree-shaking performance.
48
+ // You can create one instance of it to use across an application.
49
+ const polar = new PolarCore({
50
+ accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
51
+ });
52
+
53
+ async function run() {
54
+ const res = await checkoutLinksList(polar, {});
55
+
56
+ if (!res.ok) {
57
+ throw res.error;
58
+ }
59
+
60
+ const { value: result } = res;
61
+
62
+ for await (const page of result) {
63
+ // Handle the page
64
+ console.log(page);
65
+ }
66
+ }
67
+
68
+ run();
69
+ ```
70
+
71
+ ### Parameters
72
+
73
+ | Parameter | Type | Required | Description |
74
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
75
+ | `request` | [operations.CheckoutLinksListRequest](../../models/operations/checkoutlinkslistrequest.md) | :heavy_check_mark: | The request object to use for the request. |
76
+ | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
77
+ | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
78
+ | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
79
+
80
+ ### Response
81
+
82
+ **Promise\<[operations.CheckoutLinksListResponse](../../models/operations/checkoutlinkslistresponse.md)\>**
83
+
84
+ ### Errors
85
+
86
+ | Error Type | Status Code | Content Type |
87
+ | -------------------------- | -------------------------- | -------------------------- |
88
+ | errors.HTTPValidationError | 422 | application/json |
89
+ | errors.SDKError | 4XX, 5XX | \*/\* |
90
+
91
+ ## create
92
+
93
+ Create a checkout link.
94
+
95
+ ### Example Usage
96
+
97
+ ```typescript
98
+ import { Polar } from "@polar-sh/sdk";
99
+
100
+ const polar = new Polar({
101
+ accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
102
+ });
103
+
104
+ async function run() {
105
+ const result = await polar.checkoutLinks.create({
106
+ productPriceId: "<value>",
107
+ });
108
+
109
+ // Handle the result
110
+ console.log(result);
111
+ }
112
+
113
+ run();
114
+ ```
115
+
116
+ ### Standalone function
117
+
118
+ The standalone function version of this method:
119
+
120
+ ```typescript
121
+ import { PolarCore } from "@polar-sh/sdk/core.js";
122
+ import { checkoutLinksCreate } from "@polar-sh/sdk/funcs/checkoutLinksCreate.js";
123
+
124
+ // Use `PolarCore` for best tree-shaking performance.
125
+ // You can create one instance of it to use across an application.
126
+ const polar = new PolarCore({
127
+ accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
128
+ });
129
+
130
+ async function run() {
131
+ const res = await checkoutLinksCreate(polar, {
132
+ productPriceId: "<value>",
133
+ });
134
+
135
+ if (!res.ok) {
136
+ throw res.error;
137
+ }
138
+
139
+ const { value: result } = res;
140
+
141
+ // Handle the result
142
+ console.log(result);
143
+ }
144
+
145
+ run();
146
+ ```
147
+
148
+ ### Parameters
149
+
150
+ | Parameter | Type | Required | Description |
151
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
152
+ | `request` | [components.CheckoutLinkCreate](../../models/components/checkoutlinkcreate.md) | :heavy_check_mark: | The request object to use for the request. |
153
+ | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
154
+ | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
155
+ | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
156
+
157
+ ### Response
158
+
159
+ **Promise\<[components.CheckoutLink](../../models/components/checkoutlink.md)\>**
160
+
161
+ ### Errors
162
+
163
+ | Error Type | Status Code | Content Type |
164
+ | -------------------------- | -------------------------- | -------------------------- |
165
+ | errors.HTTPValidationError | 422 | application/json |
166
+ | errors.SDKError | 4XX, 5XX | \*/\* |
167
+
168
+ ## get
169
+
170
+ Get a checkout link by ID.
171
+
172
+ ### Example Usage
173
+
174
+ ```typescript
175
+ import { Polar } from "@polar-sh/sdk";
176
+
177
+ const polar = new Polar({
178
+ accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
179
+ });
180
+
181
+ async function run() {
182
+ const result = await polar.checkoutLinks.get({
183
+ id: "<value>",
184
+ });
185
+
186
+ // Handle the result
187
+ console.log(result);
188
+ }
189
+
190
+ run();
191
+ ```
192
+
193
+ ### Standalone function
194
+
195
+ The standalone function version of this method:
196
+
197
+ ```typescript
198
+ import { PolarCore } from "@polar-sh/sdk/core.js";
199
+ import { checkoutLinksGet } from "@polar-sh/sdk/funcs/checkoutLinksGet.js";
200
+
201
+ // Use `PolarCore` for best tree-shaking performance.
202
+ // You can create one instance of it to use across an application.
203
+ const polar = new PolarCore({
204
+ accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
205
+ });
206
+
207
+ async function run() {
208
+ const res = await checkoutLinksGet(polar, {
209
+ id: "<value>",
210
+ });
211
+
212
+ if (!res.ok) {
213
+ throw res.error;
214
+ }
215
+
216
+ const { value: result } = res;
217
+
218
+ // Handle the result
219
+ console.log(result);
220
+ }
221
+
222
+ run();
223
+ ```
224
+
225
+ ### Parameters
226
+
227
+ | Parameter | Type | Required | Description |
228
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
229
+ | `request` | [operations.CheckoutLinksGetRequest](../../models/operations/checkoutlinksgetrequest.md) | :heavy_check_mark: | The request object to use for the request. |
230
+ | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
231
+ | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
232
+ | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
233
+
234
+ ### Response
235
+
236
+ **Promise\<[components.CheckoutLink](../../models/components/checkoutlink.md)\>**
237
+
238
+ ### Errors
239
+
240
+ | Error Type | Status Code | Content Type |
241
+ | -------------------------- | -------------------------- | -------------------------- |
242
+ | errors.ResourceNotFound | 404 | application/json |
243
+ | errors.HTTPValidationError | 422 | application/json |
244
+ | errors.SDKError | 4XX, 5XX | \*/\* |
245
+
246
+ ## update
247
+
248
+ Update a checkout link.
249
+
250
+ ### Example Usage
251
+
252
+ ```typescript
253
+ import { Polar } from "@polar-sh/sdk";
254
+
255
+ const polar = new Polar({
256
+ accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
257
+ });
258
+
259
+ async function run() {
260
+ const result = await polar.checkoutLinks.update({
261
+ id: "<value>",
262
+ checkoutLinkUpdate: {},
263
+ });
264
+
265
+ // Handle the result
266
+ console.log(result);
267
+ }
268
+
269
+ run();
270
+ ```
271
+
272
+ ### Standalone function
273
+
274
+ The standalone function version of this method:
275
+
276
+ ```typescript
277
+ import { PolarCore } from "@polar-sh/sdk/core.js";
278
+ import { checkoutLinksUpdate } from "@polar-sh/sdk/funcs/checkoutLinksUpdate.js";
279
+
280
+ // Use `PolarCore` for best tree-shaking performance.
281
+ // You can create one instance of it to use across an application.
282
+ const polar = new PolarCore({
283
+ accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
284
+ });
285
+
286
+ async function run() {
287
+ const res = await checkoutLinksUpdate(polar, {
288
+ id: "<value>",
289
+ checkoutLinkUpdate: {},
290
+ });
291
+
292
+ if (!res.ok) {
293
+ throw res.error;
294
+ }
295
+
296
+ const { value: result } = res;
297
+
298
+ // Handle the result
299
+ console.log(result);
300
+ }
301
+
302
+ run();
303
+ ```
304
+
305
+ ### Parameters
306
+
307
+ | Parameter | Type | Required | Description |
308
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
309
+ | `request` | [operations.CheckoutLinksUpdateRequest](../../models/operations/checkoutlinksupdaterequest.md) | :heavy_check_mark: | The request object to use for the request. |
310
+ | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
311
+ | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
312
+ | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
313
+
314
+ ### Response
315
+
316
+ **Promise\<[components.CheckoutLink](../../models/components/checkoutlink.md)\>**
317
+
318
+ ### Errors
319
+
320
+ | Error Type | Status Code | Content Type |
321
+ | -------------------------- | -------------------------- | -------------------------- |
322
+ | errors.ResourceNotFound | 404 | application/json |
323
+ | errors.HTTPValidationError | 422 | application/json |
324
+ | errors.SDKError | 4XX, 5XX | \*/\* |
325
+
326
+ ## delete
327
+
328
+ Delete a checkout link.
329
+
330
+ ### Example Usage
331
+
332
+ ```typescript
333
+ import { Polar } from "@polar-sh/sdk";
334
+
335
+ const polar = new Polar({
336
+ accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
337
+ });
338
+
339
+ async function run() {
340
+ await polar.checkoutLinks.delete({
341
+ id: "<value>",
342
+ });
343
+
344
+
345
+ }
346
+
347
+ run();
348
+ ```
349
+
350
+ ### Standalone function
351
+
352
+ The standalone function version of this method:
353
+
354
+ ```typescript
355
+ import { PolarCore } from "@polar-sh/sdk/core.js";
356
+ import { checkoutLinksDelete } from "@polar-sh/sdk/funcs/checkoutLinksDelete.js";
357
+
358
+ // Use `PolarCore` for best tree-shaking performance.
359
+ // You can create one instance of it to use across an application.
360
+ const polar = new PolarCore({
361
+ accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
362
+ });
363
+
364
+ async function run() {
365
+ const res = await checkoutLinksDelete(polar, {
366
+ id: "<value>",
367
+ });
368
+
369
+ if (!res.ok) {
370
+ throw res.error;
371
+ }
372
+
373
+ const { value: result } = res;
374
+
375
+
376
+ }
377
+
378
+ run();
379
+ ```
380
+
381
+ ### Parameters
382
+
383
+ | Parameter | Type | Required | Description |
384
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
385
+ | `request` | [operations.CheckoutLinksDeleteRequest](../../models/operations/checkoutlinksdeleterequest.md) | :heavy_check_mark: | The request object to use for the request. |
386
+ | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
387
+ | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
388
+ | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
389
+
390
+ ### Response
391
+
392
+ **Promise\<void\>**
393
+
394
+ ### Errors
395
+
396
+ | Error Type | Status Code | Content Type |
397
+ | -------------------------- | -------------------------- | -------------------------- |
398
+ | errors.ResourceNotFound | 404 | application/json |
399
+ | errors.HTTPValidationError | 422 | application/json |
400
+ | errors.SDKError | 4XX, 5XX | \*/\* |
@@ -0,0 +1,16 @@
1
+ import { PolarCore } from "../core.js";
2
+ import { RequestOptions } from "../lib/sdks.js";
3
+ import * as components from "../models/components/index.js";
4
+ import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
5
+ import * as errors from "../models/errors/index.js";
6
+ import { SDKError } from "../models/errors/sdkerror.js";
7
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
8
+ import { Result } from "../types/fp.js";
9
+ /**
10
+ * Create Checkout Link
11
+ *
12
+ * @remarks
13
+ * Create a checkout link.
14
+ */
15
+ export declare function checkoutLinksCreate(client: PolarCore, request: components.CheckoutLinkCreate, options?: RequestOptions): Promise<Result<components.CheckoutLink, errors.HTTPValidationError | SDKError | SDKValidationError | UnexpectedClientError | InvalidRequestError | RequestAbortedError | RequestTimeoutError | ConnectionError>>;
16
+ //# sourceMappingURL=checkoutLinksCreate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkoutLinksCreate.d.ts","sourceRoot":"","sources":["../src/funcs/checkoutLinksCreate.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,UAAU,CAAC,kBAAkB,EACtC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CACR,MAAM,CACJ,UAAU,CAAC,YAAY,EACrB,MAAM,CAAC,mBAAmB,GAC1B,QAAQ,GACR,kBAAkB,GAClB,qBAAqB,GACrB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,eAAe,CAClB,CACF,CA6EA"}
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ /*
3
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.checkoutLinksCreate = checkoutLinksCreate;
30
+ const encodings_js_1 = require("../lib/encodings.js");
31
+ const M = __importStar(require("../lib/matchers.js"));
32
+ const schemas_js_1 = require("../lib/schemas.js");
33
+ const security_js_1 = require("../lib/security.js");
34
+ const url_js_1 = require("../lib/url.js");
35
+ const components = __importStar(require("../models/components/index.js"));
36
+ const errors = __importStar(require("../models/errors/index.js"));
37
+ /**
38
+ * Create Checkout Link
39
+ *
40
+ * @remarks
41
+ * Create a checkout link.
42
+ */
43
+ async function checkoutLinksCreate(client, request, options) {
44
+ const parsed = (0, schemas_js_1.safeParse)(request, (value) => components.CheckoutLinkCreate$outboundSchema.parse(value), "Input validation failed");
45
+ if (!parsed.ok) {
46
+ return parsed;
47
+ }
48
+ const payload = parsed.value;
49
+ const body = (0, encodings_js_1.encodeJSON)("body", payload, { explode: true });
50
+ const path = (0, url_js_1.pathToFunc)("/v1/checkout-links/")();
51
+ const headers = new Headers({
52
+ "Content-Type": "application/json",
53
+ Accept: "application/json",
54
+ });
55
+ const secConfig = await (0, security_js_1.extractSecurity)(client._options.accessToken);
56
+ const securityInput = secConfig == null ? {} : { accessToken: secConfig };
57
+ const context = {
58
+ operationID: "checkout-links:create",
59
+ oAuth2Scopes: [],
60
+ securitySource: client._options.accessToken,
61
+ };
62
+ const requestSecurity = (0, security_js_1.resolveGlobalSecurity)(securityInput);
63
+ const requestRes = client._createRequest(context, {
64
+ security: requestSecurity,
65
+ method: "POST",
66
+ path: path,
67
+ headers: headers,
68
+ body: body,
69
+ timeoutMs: (options === null || options === void 0 ? void 0 : options.timeoutMs) || client._options.timeoutMs || -1,
70
+ }, options);
71
+ if (!requestRes.ok) {
72
+ return requestRes;
73
+ }
74
+ const req = requestRes.value;
75
+ const doResult = await client._do(req, {
76
+ context,
77
+ errorCodes: ["422", "4XX", "5XX"],
78
+ retryConfig: (options === null || options === void 0 ? void 0 : options.retries)
79
+ || client._options.retryConfig,
80
+ retryCodes: (options === null || options === void 0 ? void 0 : options.retryCodes) || ["429", "500", "502", "503", "504"],
81
+ });
82
+ if (!doResult.ok) {
83
+ return doResult;
84
+ }
85
+ const response = doResult.value;
86
+ const responseFields = {
87
+ HttpMeta: { Response: response, Request: req },
88
+ };
89
+ const [result] = await M.match(M.json(201, components.CheckoutLink$inboundSchema), M.jsonErr(422, errors.HTTPValidationError$inboundSchema), M.fail(["4XX", "5XX"]))(response, { extraFields: responseFields });
90
+ if (!result.ok) {
91
+ return result;
92
+ }
93
+ return result;
94
+ }
95
+ //# sourceMappingURL=checkoutLinksCreate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkoutLinksCreate.js","sourceRoot":"","sources":["../src/funcs/checkoutLinksCreate.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AA4BH,kDA6FC;AAtHD,sDAAiD;AACjD,sDAAwC;AACxC,kDAA8C;AAE9C,oDAA4E;AAC5E,0CAA2C;AAC3C,0EAA4D;AAQ5D,kEAAoD;AAKpD;;;;;GAKG;AACI,KAAK,UAAU,mBAAmB,CACvC,MAAiB,EACjB,OAAsC,EACtC,OAAwB;IAcxB,MAAM,MAAM,GAAG,IAAA,sBAAS,EACtB,OAAO,EACP,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,iCAAiC,CAAC,KAAK,CAAC,KAAK,CAAC,EACpE,yBAAyB,CAC1B,CAAC;IACF,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC;IAC7B,MAAM,IAAI,GAAG,IAAA,yBAAU,EAAC,MAAM,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAE5D,MAAM,IAAI,GAAG,IAAA,mBAAU,EAAC,qBAAqB,CAAC,EAAE,CAAC;IAEjD,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC;QAC1B,cAAc,EAAE,kBAAkB;QAClC,MAAM,EAAE,kBAAkB;KAC3B,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,MAAM,IAAA,6BAAe,EAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACrE,MAAM,aAAa,GAAG,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;IAC1E,MAAM,OAAO,GAAG;QACd,WAAW,EAAE,uBAAuB;QACpC,YAAY,EAAE,EAAE;QAChB,cAAc,EAAE,MAAM,CAAC,QAAQ,CAAC,WAAW;KAC5C,CAAC;IACF,MAAM,eAAe,GAAG,IAAA,mCAAqB,EAAC,aAAa,CAAC,CAAC;IAE7D,MAAM,UAAU,GAAG,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE;QAChD,QAAQ,EAAE,eAAe;QACzB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,IAAI;QACV,SAAS,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,KAAI,MAAM,CAAC,QAAQ,CAAC,SAAS,IAAI,CAAC,CAAC;KACjE,EAAE,OAAO,CAAC,CAAC;IACZ,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC;QACnB,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,MAAM,GAAG,GAAG,UAAU,CAAC,KAAK,CAAC;IAE7B,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE;QACrC,OAAO;QACP,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;QACjC,WAAW,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO;eACxB,MAAM,CAAC,QAAQ,CAAC,WAAW;QAChC,UAAU,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,KAAI,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;KACvE,CAAC,CAAC;IACH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC;IAEhC,MAAM,cAAc,GAAG;QACrB,QAAQ,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE;KAC/C,CAAC;IAEF,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,KAAK,CAW5B,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,0BAA0B,CAAC,EAClD,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,iCAAiC,CAAC,EACxD,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CACvB,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,CAAC;IAC7C,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { PolarCore } from "../core.js";
2
+ import { RequestOptions } from "../lib/sdks.js";
3
+ import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
4
+ import * as errors from "../models/errors/index.js";
5
+ import { SDKError } from "../models/errors/sdkerror.js";
6
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
7
+ import * as operations from "../models/operations/index.js";
8
+ import { Result } from "../types/fp.js";
9
+ /**
10
+ * Delete Checkout Link
11
+ *
12
+ * @remarks
13
+ * Delete a checkout link.
14
+ */
15
+ export declare function checkoutLinksDelete(client: PolarCore, request: operations.CheckoutLinksDeleteRequest, options?: RequestOptions): Promise<Result<void, errors.ResourceNotFound | errors.HTTPValidationError | SDKError | SDKValidationError | UnexpectedClientError | InvalidRequestError | RequestAbortedError | RequestTimeoutError | ConnectionError>>;
16
+ //# sourceMappingURL=checkoutLinksDelete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkoutLinksDelete.d.ts","sourceRoot":"","sources":["../src/funcs/checkoutLinksDelete.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,UAAU,CAAC,0BAA0B,EAC9C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CACR,MAAM,CACJ,IAAI,EACF,MAAM,CAAC,gBAAgB,GACvB,MAAM,CAAC,mBAAmB,GAC1B,QAAQ,GACR,kBAAkB,GAClB,qBAAqB,GACrB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,eAAe,CAClB,CACF,CAsFA"}