@polar-sh/sdk 0.17.3 → 0.18.0

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 (316) hide show
  1. package/FUNCTIONS.md +106 -0
  2. package/README.md +181 -30
  3. package/RUNTIMES.md +22 -0
  4. package/docs/sdks/checkouts/README.md +1 -1
  5. package/docs/sdks/files/README.md +5 -1
  6. package/funcs/filesCreate.js +1 -1
  7. package/funcs/filesDelete.d.ts +1 -1
  8. package/funcs/filesDelete.d.ts.map +1 -1
  9. package/funcs/filesDelete.js +1 -1
  10. package/funcs/filesDelete.js.map +1 -1
  11. package/funcs/filesUpdate.d.ts +1 -1
  12. package/funcs/filesUpdate.d.ts.map +1 -1
  13. package/funcs/filesUpdate.js +2 -2
  14. package/funcs/filesUpdate.js.map +1 -1
  15. package/funcs/filesUploaded.d.ts +1 -1
  16. package/funcs/filesUploaded.d.ts.map +1 -1
  17. package/funcs/filesUploaded.js +2 -2
  18. package/funcs/filesUploaded.js.map +1 -1
  19. package/hooks/hooks.d.ts.map +1 -1
  20. package/hooks/hooks.js +18 -0
  21. package/hooks/hooks.js.map +1 -1
  22. package/hooks/types.d.ts +3 -0
  23. package/hooks/types.d.ts.map +1 -1
  24. package/lib/config.d.ts +3 -3
  25. package/lib/config.js +3 -3
  26. package/lib/config.js.map +1 -1
  27. package/models/components/benefit.d.ts +2 -3
  28. package/models/components/benefit.d.ts.map +1 -1
  29. package/models/components/benefit.js +0 -3
  30. package/models/components/benefit.js.map +1 -1
  31. package/models/components/benefitadssubscriber.d.ts +7 -7
  32. package/models/components/benefitadssubscriber.d.ts.map +1 -1
  33. package/models/components/benefitadssubscriber.js +11 -11
  34. package/models/components/benefitadssubscriber.js.map +1 -1
  35. package/models/components/benefitgrant.d.ts +4 -5
  36. package/models/components/benefitgrant.d.ts.map +1 -1
  37. package/models/components/benefitgrant.js +0 -5
  38. package/models/components/benefitgrant.js.map +1 -1
  39. package/models/components/benefitgrantwebhook.d.ts +8 -9
  40. package/models/components/benefitgrantwebhook.d.ts.map +1 -1
  41. package/models/components/benefitgrantwebhook.js +0 -9
  42. package/models/components/benefitgrantwebhook.js.map +1 -1
  43. package/models/components/benefittype.d.ts +0 -3
  44. package/models/components/benefittype.d.ts.map +1 -1
  45. package/models/components/benefittype.js +0 -1
  46. package/models/components/benefittype.js.map +1 -1
  47. package/models/components/checkoutlinkproduct.d.ts +2 -24
  48. package/models/components/checkoutlinkproduct.d.ts.map +1 -1
  49. package/models/components/checkoutlinkproduct.js +3 -27
  50. package/models/components/checkoutlinkproduct.js.map +1 -1
  51. package/models/components/checkoutproduct.d.ts +2 -24
  52. package/models/components/checkoutproduct.d.ts.map +1 -1
  53. package/models/components/checkoutproduct.js +3 -27
  54. package/models/components/checkoutproduct.js.map +1 -1
  55. package/models/components/index.d.ts +0 -15
  56. package/models/components/index.d.ts.map +1 -1
  57. package/models/components/index.js +0 -15
  58. package/models/components/index.js.map +1 -1
  59. package/models/components/listresourceuserbenefit.d.ts +0 -9
  60. package/models/components/listresourceuserbenefit.d.ts.map +1 -1
  61. package/models/components/listresourceuserbenefit.js +0 -13
  62. package/models/components/listresourceuserbenefit.js.map +1 -1
  63. package/models/components/oauth2client.js +2 -2
  64. package/models/components/oauth2client.js.map +1 -1
  65. package/models/components/oauth2clientconfiguration.js +2 -2
  66. package/models/components/oauth2clientconfiguration.js.map +1 -1
  67. package/models/components/oauth2clientconfigurationupdate.js +2 -2
  68. package/models/components/oauth2clientconfigurationupdate.js.map +1 -1
  69. package/models/components/organizationfeaturesettings.d.ts +0 -5
  70. package/models/components/organizationfeaturesettings.d.ts.map +1 -1
  71. package/models/components/organizationfeaturesettings.js +0 -4
  72. package/models/components/organizationfeaturesettings.js.map +1 -1
  73. package/models/components/scope.d.ts +0 -6
  74. package/models/components/scope.d.ts.map +1 -1
  75. package/models/components/scope.js +0 -2
  76. package/models/components/scope.js.map +1 -1
  77. package/models/components/userorderproduct.d.ts +2 -24
  78. package/models/components/userorderproduct.d.ts.map +1 -1
  79. package/models/components/userorderproduct.js +3 -27
  80. package/models/components/userorderproduct.js.map +1 -1
  81. package/models/components/usersubscriptionproduct.d.ts +2 -24
  82. package/models/components/usersubscriptionproduct.d.ts.map +1 -1
  83. package/models/components/usersubscriptionproduct.js +3 -27
  84. package/models/components/usersubscriptionproduct.js.map +1 -1
  85. package/models/errors/index.d.ts +0 -1
  86. package/models/errors/index.d.ts.map +1 -1
  87. package/models/errors/index.js +0 -1
  88. package/models/errors/index.js.map +1 -1
  89. package/models/operations/benefitsupdate.d.ts +4 -4
  90. package/models/operations/benefitsupdate.d.ts.map +1 -1
  91. package/models/operations/benefitsupdate.js +0 -4
  92. package/models/operations/benefitsupdate.js.map +1 -1
  93. package/models/operations/filesupdate.d.ts +1 -1
  94. package/models/operations/filesuploaded.d.ts +1 -1
  95. package/models/operations/index.d.ts +0 -8
  96. package/models/operations/index.d.ts.map +1 -1
  97. package/models/operations/index.js +0 -8
  98. package/models/operations/index.js.map +1 -1
  99. package/models/operations/usersbenefitsget.d.ts +2 -6
  100. package/models/operations/usersbenefitsget.d.ts.map +1 -1
  101. package/models/operations/usersbenefitsget.js +0 -6
  102. package/models/operations/usersbenefitsget.js.map +1 -1
  103. package/package.json +1 -3
  104. package/sdk/sdk.d.ts +0 -3
  105. package/sdk/sdk.d.ts.map +1 -1
  106. package/sdk/sdk.js +0 -5
  107. package/sdk/sdk.js.map +1 -1
  108. package/src/funcs/filesCreate.ts +1 -1
  109. package/src/funcs/filesDelete.ts +3 -3
  110. package/src/funcs/filesUpdate.ts +7 -1
  111. package/src/funcs/filesUploaded.ts +7 -1
  112. package/src/hooks/hooks.ts +20 -0
  113. package/src/hooks/types.ts +9 -0
  114. package/src/lib/config.ts +3 -3
  115. package/src/models/components/benefit.ts +0 -10
  116. package/src/models/components/benefitadssubscriber.ts +12 -15
  117. package/src/models/components/benefitgrant.ts +0 -14
  118. package/src/models/components/benefitgrantwebhook.ts +0 -22
  119. package/src/models/components/benefittype.ts +0 -1
  120. package/src/models/components/checkoutlinkproduct.ts +4 -68
  121. package/src/models/components/checkoutproduct.ts +4 -66
  122. package/src/models/components/index.ts +0 -15
  123. package/src/models/components/listresourceuserbenefit.ts +0 -30
  124. package/src/models/components/oauth2client.ts +2 -2
  125. package/src/models/components/oauth2clientconfiguration.ts +2 -2
  126. package/src/models/components/oauth2clientconfigurationupdate.ts +2 -2
  127. package/src/models/components/organizationfeaturesettings.ts +0 -9
  128. package/src/models/components/scope.ts +0 -2
  129. package/src/models/components/userorderproduct.ts +4 -60
  130. package/src/models/components/usersubscriptionproduct.ts +4 -68
  131. package/src/models/errors/index.ts +0 -1
  132. package/src/models/operations/benefitsupdate.ts +0 -8
  133. package/src/models/operations/filesupdate.ts +1 -1
  134. package/src/models/operations/filesuploaded.ts +1 -1
  135. package/src/models/operations/index.ts +0 -8
  136. package/src/models/operations/usersbenefitsget.ts +0 -12
  137. package/src/sdk/sdk.ts +0 -6
  138. package/src/types/index.ts +1 -0
  139. package/src/types/webhooks.ts +7 -0
  140. package/types/index.d.ts +1 -0
  141. package/types/index.d.ts.map +1 -1
  142. package/types/webhooks.d.ts +4 -0
  143. package/types/webhooks.d.ts.map +1 -0
  144. package/types/webhooks.js +6 -0
  145. package/types/webhooks.js.map +1 -0
  146. package/docs/sdks/articles/README.md +0 -724
  147. package/funcs/articlesCreate.d.ts +0 -16
  148. package/funcs/articlesCreate.d.ts.map +0 -1
  149. package/funcs/articlesCreate.js +0 -99
  150. package/funcs/articlesCreate.js.map +0 -1
  151. package/funcs/articlesDelete.d.ts +0 -16
  152. package/funcs/articlesDelete.d.ts.map +0 -1
  153. package/funcs/articlesDelete.js +0 -105
  154. package/funcs/articlesDelete.js.map +0 -1
  155. package/funcs/articlesExport.d.ts +0 -16
  156. package/funcs/articlesExport.d.ts.map +0 -1
  157. package/funcs/articlesExport.js +0 -103
  158. package/funcs/articlesExport.js.map +0 -1
  159. package/funcs/articlesGet.d.ts +0 -17
  160. package/funcs/articlesGet.d.ts.map +0 -1
  161. package/funcs/articlesGet.js +0 -105
  162. package/funcs/articlesGet.js.map +0 -1
  163. package/funcs/articlesList.d.ts +0 -19
  164. package/funcs/articlesList.d.ts.map +0 -1
  165. package/funcs/articlesList.js +0 -138
  166. package/funcs/articlesList.js.map +0 -1
  167. package/funcs/articlesPreview.d.ts +0 -16
  168. package/funcs/articlesPreview.d.ts.map +0 -1
  169. package/funcs/articlesPreview.js +0 -106
  170. package/funcs/articlesPreview.js.map +0 -1
  171. package/funcs/articlesReceivers.d.ts +0 -17
  172. package/funcs/articlesReceivers.d.ts.map +0 -1
  173. package/funcs/articlesReceivers.js +0 -105
  174. package/funcs/articlesReceivers.js.map +0 -1
  175. package/funcs/articlesSend.d.ts +0 -16
  176. package/funcs/articlesSend.d.ts.map +0 -1
  177. package/funcs/articlesSend.js +0 -105
  178. package/funcs/articlesSend.js.map +0 -1
  179. package/funcs/articlesUpdate.d.ts +0 -17
  180. package/funcs/articlesUpdate.d.ts.map +0 -1
  181. package/funcs/articlesUpdate.js +0 -106
  182. package/funcs/articlesUpdate.js.map +0 -1
  183. package/models/components/article.d.ts +0 -68
  184. package/models/components/article.d.ts.map +0 -1
  185. package/models/components/article.js +0 -129
  186. package/models/components/article.js.map +0 -1
  187. package/models/components/articlebyline.d.ts +0 -28
  188. package/models/components/articlebyline.d.ts.map +0 -1
  189. package/models/components/articlebyline.js +0 -50
  190. package/models/components/articlebyline.js.map +0 -1
  191. package/models/components/articlecreate.d.ts +0 -93
  192. package/models/components/articlecreate.d.ts.map +0 -1
  193. package/models/components/articlecreate.js +0 -112
  194. package/models/components/articlecreate.js.map +0 -1
  195. package/models/components/articlepreview.d.ts +0 -32
  196. package/models/components/articlepreview.d.ts.map +0 -1
  197. package/models/components/articlepreview.js +0 -59
  198. package/models/components/articlepreview.js.map +0 -1
  199. package/models/components/articlereceivers.d.ts +0 -33
  200. package/models/components/articlereceivers.d.ts.map +0 -1
  201. package/models/components/articlereceivers.js +0 -76
  202. package/models/components/articlereceivers.js.map +0 -1
  203. package/models/components/articleupdate.d.ts +0 -85
  204. package/models/components/articleupdate.d.ts.map +0 -1
  205. package/models/components/articleupdate.js +0 -108
  206. package/models/components/articleupdate.js.map +0 -1
  207. package/models/components/articlevisibility.d.ts +0 -31
  208. package/models/components/articlevisibility.d.ts.map +0 -1
  209. package/models/components/articlevisibility.js +0 -51
  210. package/models/components/articlevisibility.js.map +0 -1
  211. package/models/components/benefitarticles.d.ts +0 -100
  212. package/models/components/benefitarticles.d.ts.map +0 -1
  213. package/models/components/benefitarticles.js +0 -107
  214. package/models/components/benefitarticles.js.map +0 -1
  215. package/models/components/benefitarticlesproperties.d.ts +0 -35
  216. package/models/components/benefitarticlesproperties.d.ts.map +0 -1
  217. package/models/components/benefitarticlesproperties.js +0 -68
  218. package/models/components/benefitarticlesproperties.js.map +0 -1
  219. package/models/components/benefitarticlessubscriber.d.ts +0 -99
  220. package/models/components/benefitarticlessubscriber.d.ts.map +0 -1
  221. package/models/components/benefitarticlessubscriber.js +0 -113
  222. package/models/components/benefitarticlessubscriber.js.map +0 -1
  223. package/models/components/benefitarticlessubscriberproperties.d.ts +0 -35
  224. package/models/components/benefitarticlessubscriberproperties.d.ts.map +0 -1
  225. package/models/components/benefitarticlessubscriberproperties.js +0 -68
  226. package/models/components/benefitarticlessubscriberproperties.js.map +0 -1
  227. package/models/components/benefitarticlesupdate.d.ts +0 -57
  228. package/models/components/benefitarticlesupdate.d.ts.map +0 -1
  229. package/models/components/benefitarticlesupdate.js +0 -79
  230. package/models/components/benefitarticlesupdate.js.map +0 -1
  231. package/models/components/benefitgrantarticlesproperties.d.ts +0 -25
  232. package/models/components/benefitgrantarticlesproperties.d.ts.map +0 -1
  233. package/models/components/benefitgrantarticlesproperties.js +0 -55
  234. package/models/components/benefitgrantarticlesproperties.js.map +0 -1
  235. package/models/components/bylineprofile.d.ts +0 -31
  236. package/models/components/bylineprofile.d.ts.map +0 -1
  237. package/models/components/bylineprofile.js +0 -70
  238. package/models/components/bylineprofile.js.map +0 -1
  239. package/models/components/listresourcearticle.d.ts +0 -33
  240. package/models/components/listresourcearticle.d.ts.map +0 -1
  241. package/models/components/listresourcearticle.js +0 -63
  242. package/models/components/listresourcearticle.js.map +0 -1
  243. package/models/errors/filenotfound.d.ts +0 -57
  244. package/models/errors/filenotfound.d.ts.map +0 -1
  245. package/models/errors/filenotfound.js +0 -88
  246. package/models/errors/filenotfound.js.map +0 -1
  247. package/models/operations/articlesdelete.d.ts +0 -29
  248. package/models/operations/articlesdelete.d.ts.map +0 -1
  249. package/models/operations/articlesdelete.js +0 -59
  250. package/models/operations/articlesdelete.js.map +0 -1
  251. package/models/operations/articlesexport.d.ts +0 -29
  252. package/models/operations/articlesexport.d.ts.map +0 -1
  253. package/models/operations/articlesexport.js +0 -68
  254. package/models/operations/articlesexport.js.map +0 -1
  255. package/models/operations/articlesget.d.ts +0 -29
  256. package/models/operations/articlesget.d.ts.map +0 -1
  257. package/models/operations/articlesget.js +0 -59
  258. package/models/operations/articlesget.js.map +0 -1
  259. package/models/operations/articleslist.d.ts +0 -141
  260. package/models/operations/articleslist.d.ts.map +0 -1
  261. package/models/operations/articleslist.js +0 -184
  262. package/models/operations/articleslist.js.map +0 -1
  263. package/models/operations/articlespreview.d.ts +0 -32
  264. package/models/operations/articlespreview.d.ts.map +0 -1
  265. package/models/operations/articlespreview.js +0 -71
  266. package/models/operations/articlespreview.js.map +0 -1
  267. package/models/operations/articlesreceivers.d.ts +0 -29
  268. package/models/operations/articlesreceivers.d.ts.map +0 -1
  269. package/models/operations/articlesreceivers.js +0 -59
  270. package/models/operations/articlesreceivers.js.map +0 -1
  271. package/models/operations/articlessend.d.ts +0 -29
  272. package/models/operations/articlessend.d.ts.map +0 -1
  273. package/models/operations/articlessend.js +0 -59
  274. package/models/operations/articlessend.js.map +0 -1
  275. package/models/operations/articlesupdate.d.ts +0 -32
  276. package/models/operations/articlesupdate.d.ts.map +0 -1
  277. package/models/operations/articlesupdate.js +0 -71
  278. package/models/operations/articlesupdate.js.map +0 -1
  279. package/sdk/articles.d.ts +0 -72
  280. package/sdk/articles.d.ts.map +0 -1
  281. package/sdk/articles.js +0 -103
  282. package/sdk/articles.js.map +0 -1
  283. package/src/funcs/articlesCreate.ts +0 -131
  284. package/src/funcs/articlesDelete.ts +0 -144
  285. package/src/funcs/articlesExport.ts +0 -136
  286. package/src/funcs/articlesGet.ts +0 -141
  287. package/src/funcs/articlesList.ts +0 -205
  288. package/src/funcs/articlesPreview.ts +0 -145
  289. package/src/funcs/articlesReceivers.ts +0 -138
  290. package/src/funcs/articlesSend.ts +0 -144
  291. package/src/funcs/articlesUpdate.ts +0 -145
  292. package/src/models/components/article.ts +0 -187
  293. package/src/models/components/articlebyline.ts +0 -33
  294. package/src/models/components/articlecreate.ts +0 -191
  295. package/src/models/components/articlepreview.ts +0 -65
  296. package/src/models/components/articlereceivers.ts +0 -87
  297. package/src/models/components/articleupdate.ts +0 -179
  298. package/src/models/components/articlevisibility.ts +0 -34
  299. package/src/models/components/benefitarticles.ts +0 -175
  300. package/src/models/components/benefitarticlesproperties.ts +0 -81
  301. package/src/models/components/benefitarticlessubscriber.ts +0 -189
  302. package/src/models/components/benefitarticlessubscriberproperties.ts +0 -86
  303. package/src/models/components/benefitarticlesupdate.ts +0 -102
  304. package/src/models/components/benefitgrantarticlesproperties.ts +0 -60
  305. package/src/models/components/bylineprofile.ts +0 -75
  306. package/src/models/components/listresourcearticle.ts +0 -82
  307. package/src/models/errors/filenotfound.ts +0 -102
  308. package/src/models/operations/articlesdelete.ts +0 -66
  309. package/src/models/operations/articlesexport.ts +0 -75
  310. package/src/models/operations/articlesget.ts +0 -66
  311. package/src/models/operations/articleslist.ts +0 -342
  312. package/src/models/operations/articlespreview.ts +0 -80
  313. package/src/models/operations/articlesreceivers.ts +0 -66
  314. package/src/models/operations/articlessend.ts +0 -66
  315. package/src/models/operations/articlesupdate.ts +0 -80
  316. package/src/sdk/articles.ts +0 -173
@@ -1,724 +0,0 @@
1
- # Articles
2
- (*articles*)
3
-
4
- ## Overview
5
-
6
- ### Available Operations
7
-
8
- * [list](#list) - List Articles
9
- * [create](#create) - Create Article
10
- * [export](#export) - Export Articles
11
- * [get](#get) - Get Article
12
- * [update](#update) - Update Article
13
- * [delete](#delete) - Delete Article
14
- * [receivers](#receivers) - Get Article Receivers Count
15
- * [preview](#preview) - Send Article Preview
16
- * [send](#send) - Send Article
17
-
18
- ## list
19
-
20
- List articles.
21
-
22
- ### Example Usage
23
-
24
- ```typescript
25
- import { Polar } from "@polar-sh/sdk";
26
-
27
- const polar = new Polar({
28
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
29
- });
30
-
31
- async function run() {
32
- const result = await polar.articles.list({});
33
-
34
- for await (const page of result) {
35
- // Handle the page
36
- console.log(page);
37
- }
38
- }
39
-
40
- run();
41
- ```
42
-
43
- ### Standalone function
44
-
45
- The standalone function version of this method:
46
-
47
- ```typescript
48
- import { PolarCore } from "@polar-sh/sdk/core.js";
49
- import { articlesList } from "@polar-sh/sdk/funcs/articlesList.js";
50
-
51
- // Use `PolarCore` for best tree-shaking performance.
52
- // You can create one instance of it to use across an application.
53
- const polar = new PolarCore({
54
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
55
- });
56
-
57
- async function run() {
58
- const res = await articlesList(polar, {});
59
-
60
- if (!res.ok) {
61
- throw res.error;
62
- }
63
-
64
- const { value: result } = res;
65
-
66
- for await (const page of result) {
67
- // Handle the page
68
- console.log(page);
69
- }
70
- }
71
-
72
- run();
73
- ```
74
-
75
- ### Parameters
76
-
77
- | Parameter | Type | Required | Description |
78
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
79
- | `request` | [operations.ArticlesListRequest](../../models/operations/articleslistrequest.md) | :heavy_check_mark: | The request object to use for the request. |
80
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
81
- | `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. |
82
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
83
-
84
- ### Response
85
-
86
- **Promise\<[operations.ArticlesListResponse](../../models/operations/articleslistresponse.md)\>**
87
-
88
- ### Errors
89
-
90
- | Error Type | Status Code | Content Type |
91
- | -------------------------- | -------------------------- | -------------------------- |
92
- | errors.HTTPValidationError | 422 | application/json |
93
- | errors.SDKError | 4XX, 5XX | \*/\* |
94
-
95
- ## create
96
-
97
- Create an article.
98
-
99
- ### Example Usage
100
-
101
- ```typescript
102
- import { Polar } from "@polar-sh/sdk";
103
-
104
- const polar = new Polar({
105
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
106
- });
107
-
108
- async function run() {
109
- const result = await polar.articles.create({
110
- title: "<value>",
111
- });
112
-
113
- // Handle the result
114
- console.log(result);
115
- }
116
-
117
- run();
118
- ```
119
-
120
- ### Standalone function
121
-
122
- The standalone function version of this method:
123
-
124
- ```typescript
125
- import { PolarCore } from "@polar-sh/sdk/core.js";
126
- import { articlesCreate } from "@polar-sh/sdk/funcs/articlesCreate.js";
127
-
128
- // Use `PolarCore` for best tree-shaking performance.
129
- // You can create one instance of it to use across an application.
130
- const polar = new PolarCore({
131
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
132
- });
133
-
134
- async function run() {
135
- const res = await articlesCreate(polar, {
136
- title: "<value>",
137
- });
138
-
139
- if (!res.ok) {
140
- throw res.error;
141
- }
142
-
143
- const { value: result } = res;
144
-
145
- // Handle the result
146
- console.log(result);
147
- }
148
-
149
- run();
150
- ```
151
-
152
- ### Parameters
153
-
154
- | Parameter | Type | Required | Description |
155
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
156
- | `request` | [components.ArticleCreate](../../models/components/articlecreate.md) | :heavy_check_mark: | The request object to use for the request. |
157
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
158
- | `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. |
159
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
160
-
161
- ### Response
162
-
163
- **Promise\<[components.Article](../../models/components/article.md)\>**
164
-
165
- ### Errors
166
-
167
- | Error Type | Status Code | Content Type |
168
- | -------------------------- | -------------------------- | -------------------------- |
169
- | errors.HTTPValidationError | 422 | application/json |
170
- | errors.SDKError | 4XX, 5XX | \*/\* |
171
-
172
- ## export
173
-
174
- Export organization articles.
175
-
176
- ### Example Usage
177
-
178
- ```typescript
179
- import { Polar } from "@polar-sh/sdk";
180
-
181
- const polar = new Polar({
182
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
183
- });
184
-
185
- async function run() {
186
- const result = await polar.articles.export({
187
- organizationId: "cf4e3d5e-2b50-4470-a85b-8d021391fabb",
188
- });
189
-
190
- // Handle the result
191
- console.log(result);
192
- }
193
-
194
- run();
195
- ```
196
-
197
- ### Standalone function
198
-
199
- The standalone function version of this method:
200
-
201
- ```typescript
202
- import { PolarCore } from "@polar-sh/sdk/core.js";
203
- import { articlesExport } from "@polar-sh/sdk/funcs/articlesExport.js";
204
-
205
- // Use `PolarCore` for best tree-shaking performance.
206
- // You can create one instance of it to use across an application.
207
- const polar = new PolarCore({
208
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
209
- });
210
-
211
- async function run() {
212
- const res = await articlesExport(polar, {
213
- organizationId: "cf4e3d5e-2b50-4470-a85b-8d021391fabb",
214
- });
215
-
216
- if (!res.ok) {
217
- throw res.error;
218
- }
219
-
220
- const { value: result } = res;
221
-
222
- // Handle the result
223
- console.log(result);
224
- }
225
-
226
- run();
227
- ```
228
-
229
- ### Parameters
230
-
231
- | Parameter | Type | Required | Description |
232
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
233
- | `request` | [operations.ArticlesExportRequest](../../models/operations/articlesexportrequest.md) | :heavy_check_mark: | The request object to use for the request. |
234
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
235
- | `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. |
236
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
237
-
238
- ### Response
239
-
240
- **Promise\<[any](../../models/.md)\>**
241
-
242
- ### Errors
243
-
244
- | Error Type | Status Code | Content Type |
245
- | -------------------------- | -------------------------- | -------------------------- |
246
- | errors.HTTPValidationError | 422 | application/json |
247
- | errors.SDKError | 4XX, 5XX | \*/\* |
248
-
249
- ## get
250
-
251
- Get an article by ID.
252
-
253
- ### Example Usage
254
-
255
- ```typescript
256
- import { Polar } from "@polar-sh/sdk";
257
-
258
- const polar = new Polar({
259
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
260
- });
261
-
262
- async function run() {
263
- const result = await polar.articles.get({
264
- id: "<value>",
265
- });
266
-
267
- // Handle the result
268
- console.log(result);
269
- }
270
-
271
- run();
272
- ```
273
-
274
- ### Standalone function
275
-
276
- The standalone function version of this method:
277
-
278
- ```typescript
279
- import { PolarCore } from "@polar-sh/sdk/core.js";
280
- import { articlesGet } from "@polar-sh/sdk/funcs/articlesGet.js";
281
-
282
- // Use `PolarCore` for best tree-shaking performance.
283
- // You can create one instance of it to use across an application.
284
- const polar = new PolarCore({
285
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
286
- });
287
-
288
- async function run() {
289
- const res = await articlesGet(polar, {
290
- id: "<value>",
291
- });
292
-
293
- if (!res.ok) {
294
- throw res.error;
295
- }
296
-
297
- const { value: result } = res;
298
-
299
- // Handle the result
300
- console.log(result);
301
- }
302
-
303
- run();
304
- ```
305
-
306
- ### Parameters
307
-
308
- | Parameter | Type | Required | Description |
309
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
310
- | `request` | [operations.ArticlesGetRequest](../../models/operations/articlesgetrequest.md) | :heavy_check_mark: | The request object to use for the request. |
311
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
312
- | `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. |
313
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
314
-
315
- ### Response
316
-
317
- **Promise\<[components.Article](../../models/components/article.md)\>**
318
-
319
- ### Errors
320
-
321
- | Error Type | Status Code | Content Type |
322
- | -------------------------- | -------------------------- | -------------------------- |
323
- | errors.ResourceNotFound | 404 | application/json |
324
- | errors.HTTPValidationError | 422 | application/json |
325
- | errors.SDKError | 4XX, 5XX | \*/\* |
326
-
327
- ## update
328
-
329
- Update an article.
330
-
331
- ### Example Usage
332
-
333
- ```typescript
334
- import { Polar } from "@polar-sh/sdk";
335
-
336
- const polar = new Polar({
337
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
338
- });
339
-
340
- async function run() {
341
- const result = await polar.articles.update({
342
- id: "<value>",
343
- articleUpdate: {},
344
- });
345
-
346
- // Handle the result
347
- console.log(result);
348
- }
349
-
350
- run();
351
- ```
352
-
353
- ### Standalone function
354
-
355
- The standalone function version of this method:
356
-
357
- ```typescript
358
- import { PolarCore } from "@polar-sh/sdk/core.js";
359
- import { articlesUpdate } from "@polar-sh/sdk/funcs/articlesUpdate.js";
360
-
361
- // Use `PolarCore` for best tree-shaking performance.
362
- // You can create one instance of it to use across an application.
363
- const polar = new PolarCore({
364
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
365
- });
366
-
367
- async function run() {
368
- const res = await articlesUpdate(polar, {
369
- id: "<value>",
370
- articleUpdate: {},
371
- });
372
-
373
- if (!res.ok) {
374
- throw res.error;
375
- }
376
-
377
- const { value: result } = res;
378
-
379
- // Handle the result
380
- console.log(result);
381
- }
382
-
383
- run();
384
- ```
385
-
386
- ### Parameters
387
-
388
- | Parameter | Type | Required | Description |
389
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
390
- | `request` | [operations.ArticlesUpdateRequest](../../models/operations/articlesupdaterequest.md) | :heavy_check_mark: | The request object to use for the request. |
391
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
392
- | `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. |
393
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
394
-
395
- ### Response
396
-
397
- **Promise\<[components.Article](../../models/components/article.md)\>**
398
-
399
- ### Errors
400
-
401
- | Error Type | Status Code | Content Type |
402
- | -------------------------- | -------------------------- | -------------------------- |
403
- | errors.NotPermitted | 403 | application/json |
404
- | errors.ResourceNotFound | 404 | application/json |
405
- | errors.HTTPValidationError | 422 | application/json |
406
- | errors.SDKError | 4XX, 5XX | \*/\* |
407
-
408
- ## delete
409
-
410
- Delete an article.
411
-
412
- ### Example Usage
413
-
414
- ```typescript
415
- import { Polar } from "@polar-sh/sdk";
416
-
417
- const polar = new Polar({
418
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
419
- });
420
-
421
- async function run() {
422
- await polar.articles.delete({
423
- id: "<value>",
424
- });
425
-
426
-
427
- }
428
-
429
- run();
430
- ```
431
-
432
- ### Standalone function
433
-
434
- The standalone function version of this method:
435
-
436
- ```typescript
437
- import { PolarCore } from "@polar-sh/sdk/core.js";
438
- import { articlesDelete } from "@polar-sh/sdk/funcs/articlesDelete.js";
439
-
440
- // Use `PolarCore` for best tree-shaking performance.
441
- // You can create one instance of it to use across an application.
442
- const polar = new PolarCore({
443
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
444
- });
445
-
446
- async function run() {
447
- const res = await articlesDelete(polar, {
448
- id: "<value>",
449
- });
450
-
451
- if (!res.ok) {
452
- throw res.error;
453
- }
454
-
455
- const { value: result } = res;
456
-
457
-
458
- }
459
-
460
- run();
461
- ```
462
-
463
- ### Parameters
464
-
465
- | Parameter | Type | Required | Description |
466
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
467
- | `request` | [operations.ArticlesDeleteRequest](../../models/operations/articlesdeleterequest.md) | :heavy_check_mark: | The request object to use for the request. |
468
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
469
- | `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. |
470
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
471
-
472
- ### Response
473
-
474
- **Promise\<void\>**
475
-
476
- ### Errors
477
-
478
- | Error Type | Status Code | Content Type |
479
- | -------------------------- | -------------------------- | -------------------------- |
480
- | errors.NotPermitted | 403 | application/json |
481
- | errors.ResourceNotFound | 404 | application/json |
482
- | errors.HTTPValidationError | 422 | application/json |
483
- | errors.SDKError | 4XX, 5XX | \*/\* |
484
-
485
- ## receivers
486
-
487
- Get number of potential receivers for an article.
488
-
489
- ### Example Usage
490
-
491
- ```typescript
492
- import { Polar } from "@polar-sh/sdk";
493
-
494
- const polar = new Polar({
495
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
496
- });
497
-
498
- async function run() {
499
- const result = await polar.articles.receivers({
500
- id: "<value>",
501
- });
502
-
503
- // Handle the result
504
- console.log(result);
505
- }
506
-
507
- run();
508
- ```
509
-
510
- ### Standalone function
511
-
512
- The standalone function version of this method:
513
-
514
- ```typescript
515
- import { PolarCore } from "@polar-sh/sdk/core.js";
516
- import { articlesReceivers } from "@polar-sh/sdk/funcs/articlesReceivers.js";
517
-
518
- // Use `PolarCore` for best tree-shaking performance.
519
- // You can create one instance of it to use across an application.
520
- const polar = new PolarCore({
521
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
522
- });
523
-
524
- async function run() {
525
- const res = await articlesReceivers(polar, {
526
- id: "<value>",
527
- });
528
-
529
- if (!res.ok) {
530
- throw res.error;
531
- }
532
-
533
- const { value: result } = res;
534
-
535
- // Handle the result
536
- console.log(result);
537
- }
538
-
539
- run();
540
- ```
541
-
542
- ### Parameters
543
-
544
- | Parameter | Type | Required | Description |
545
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
546
- | `request` | [operations.ArticlesReceiversRequest](../../models/operations/articlesreceiversrequest.md) | :heavy_check_mark: | The request object to use for the request. |
547
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
548
- | `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. |
549
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
550
-
551
- ### Response
552
-
553
- **Promise\<[components.ArticleReceivers](../../models/components/articlereceivers.md)\>**
554
-
555
- ### Errors
556
-
557
- | Error Type | Status Code | Content Type |
558
- | -------------------------- | -------------------------- | -------------------------- |
559
- | errors.HTTPValidationError | 422 | application/json |
560
- | errors.SDKError | 4XX, 5XX | \*/\* |
561
-
562
- ## preview
563
-
564
- Send an article preview by email.
565
-
566
- ### Example Usage
567
-
568
- ```typescript
569
- import { Polar } from "@polar-sh/sdk";
570
-
571
- const polar = new Polar({
572
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
573
- });
574
-
575
- async function run() {
576
- const result = await polar.articles.preview({
577
- id: "<value>",
578
- articlePreview: {
579
- email: "Eileen56@yahoo.com",
580
- },
581
- });
582
-
583
- // Handle the result
584
- console.log(result);
585
- }
586
-
587
- run();
588
- ```
589
-
590
- ### Standalone function
591
-
592
- The standalone function version of this method:
593
-
594
- ```typescript
595
- import { PolarCore } from "@polar-sh/sdk/core.js";
596
- import { articlesPreview } from "@polar-sh/sdk/funcs/articlesPreview.js";
597
-
598
- // Use `PolarCore` for best tree-shaking performance.
599
- // You can create one instance of it to use across an application.
600
- const polar = new PolarCore({
601
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
602
- });
603
-
604
- async function run() {
605
- const res = await articlesPreview(polar, {
606
- id: "<value>",
607
- articlePreview: {
608
- email: "Eileen56@yahoo.com",
609
- },
610
- });
611
-
612
- if (!res.ok) {
613
- throw res.error;
614
- }
615
-
616
- const { value: result } = res;
617
-
618
- // Handle the result
619
- console.log(result);
620
- }
621
-
622
- run();
623
- ```
624
-
625
- ### Parameters
626
-
627
- | Parameter | Type | Required | Description |
628
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
629
- | `request` | [operations.ArticlesPreviewRequest](../../models/operations/articlespreviewrequest.md) | :heavy_check_mark: | The request object to use for the request. |
630
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
631
- | `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. |
632
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
633
-
634
- ### Response
635
-
636
- **Promise\<[any](../../models/.md)\>**
637
-
638
- ### Errors
639
-
640
- | Error Type | Status Code | Content Type |
641
- | -------------------------- | -------------------------- | -------------------------- |
642
- | errors.NotPermitted | 403 | application/json |
643
- | errors.ResourceNotFound | 404 | application/json |
644
- | errors.HTTPValidationError | 422 | application/json |
645
- | errors.SDKError | 4XX, 5XX | \*/\* |
646
-
647
- ## send
648
-
649
- Send an article by email to all subscribers.
650
-
651
- ### Example Usage
652
-
653
- ```typescript
654
- import { Polar } from "@polar-sh/sdk";
655
-
656
- const polar = new Polar({
657
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
658
- });
659
-
660
- async function run() {
661
- const result = await polar.articles.send({
662
- id: "<value>",
663
- });
664
-
665
- // Handle the result
666
- console.log(result);
667
- }
668
-
669
- run();
670
- ```
671
-
672
- ### Standalone function
673
-
674
- The standalone function version of this method:
675
-
676
- ```typescript
677
- import { PolarCore } from "@polar-sh/sdk/core.js";
678
- import { articlesSend } from "@polar-sh/sdk/funcs/articlesSend.js";
679
-
680
- // Use `PolarCore` for best tree-shaking performance.
681
- // You can create one instance of it to use across an application.
682
- const polar = new PolarCore({
683
- accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
684
- });
685
-
686
- async function run() {
687
- const res = await articlesSend(polar, {
688
- id: "<value>",
689
- });
690
-
691
- if (!res.ok) {
692
- throw res.error;
693
- }
694
-
695
- const { value: result } = res;
696
-
697
- // Handle the result
698
- console.log(result);
699
- }
700
-
701
- run();
702
- ```
703
-
704
- ### Parameters
705
-
706
- | Parameter | Type | Required | Description |
707
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
708
- | `request` | [operations.ArticlesSendRequest](../../models/operations/articlessendrequest.md) | :heavy_check_mark: | The request object to use for the request. |
709
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
710
- | `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. |
711
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
712
-
713
- ### Response
714
-
715
- **Promise\<[any](../../models/.md)\>**
716
-
717
- ### Errors
718
-
719
- | Error Type | Status Code | Content Type |
720
- | -------------------------- | -------------------------- | -------------------------- |
721
- | errors.NotPermitted | 403 | application/json |
722
- | errors.ResourceNotFound | 404 | application/json |
723
- | errors.HTTPValidationError | 422 | application/json |
724
- | errors.SDKError | 4XX, 5XX | \*/\* |