@polar-sh/sdk 0.17.4 → 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 (284) 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/hooks/hooks.d.ts.map +1 -1
  6. package/hooks/hooks.js +18 -0
  7. package/hooks/hooks.js.map +1 -1
  8. package/hooks/types.d.ts +3 -0
  9. package/hooks/types.d.ts.map +1 -1
  10. package/lib/config.d.ts +3 -3
  11. package/lib/config.js +3 -3
  12. package/lib/config.js.map +1 -1
  13. package/models/components/benefit.d.ts +2 -3
  14. package/models/components/benefit.d.ts.map +1 -1
  15. package/models/components/benefit.js +0 -3
  16. package/models/components/benefit.js.map +1 -1
  17. package/models/components/benefitadssubscriber.d.ts +7 -7
  18. package/models/components/benefitadssubscriber.d.ts.map +1 -1
  19. package/models/components/benefitadssubscriber.js +11 -11
  20. package/models/components/benefitadssubscriber.js.map +1 -1
  21. package/models/components/benefitgrant.d.ts +4 -5
  22. package/models/components/benefitgrant.d.ts.map +1 -1
  23. package/models/components/benefitgrant.js +0 -5
  24. package/models/components/benefitgrant.js.map +1 -1
  25. package/models/components/benefitgrantwebhook.d.ts +8 -9
  26. package/models/components/benefitgrantwebhook.d.ts.map +1 -1
  27. package/models/components/benefitgrantwebhook.js +0 -9
  28. package/models/components/benefitgrantwebhook.js.map +1 -1
  29. package/models/components/benefittype.d.ts +0 -3
  30. package/models/components/benefittype.d.ts.map +1 -1
  31. package/models/components/benefittype.js +0 -1
  32. package/models/components/benefittype.js.map +1 -1
  33. package/models/components/checkoutlinkproduct.d.ts +2 -24
  34. package/models/components/checkoutlinkproduct.d.ts.map +1 -1
  35. package/models/components/checkoutlinkproduct.js +3 -27
  36. package/models/components/checkoutlinkproduct.js.map +1 -1
  37. package/models/components/checkoutproduct.d.ts +2 -24
  38. package/models/components/checkoutproduct.d.ts.map +1 -1
  39. package/models/components/checkoutproduct.js +3 -27
  40. package/models/components/checkoutproduct.js.map +1 -1
  41. package/models/components/index.d.ts +0 -15
  42. package/models/components/index.d.ts.map +1 -1
  43. package/models/components/index.js +0 -15
  44. package/models/components/index.js.map +1 -1
  45. package/models/components/listresourceuserbenefit.d.ts +0 -9
  46. package/models/components/listresourceuserbenefit.d.ts.map +1 -1
  47. package/models/components/listresourceuserbenefit.js +0 -13
  48. package/models/components/listresourceuserbenefit.js.map +1 -1
  49. package/models/components/oauth2client.js +2 -2
  50. package/models/components/oauth2client.js.map +1 -1
  51. package/models/components/oauth2clientconfiguration.js +2 -2
  52. package/models/components/oauth2clientconfiguration.js.map +1 -1
  53. package/models/components/oauth2clientconfigurationupdate.js +2 -2
  54. package/models/components/oauth2clientconfigurationupdate.js.map +1 -1
  55. package/models/components/organizationfeaturesettings.d.ts +0 -5
  56. package/models/components/organizationfeaturesettings.d.ts.map +1 -1
  57. package/models/components/organizationfeaturesettings.js +0 -4
  58. package/models/components/organizationfeaturesettings.js.map +1 -1
  59. package/models/components/scope.d.ts +0 -6
  60. package/models/components/scope.d.ts.map +1 -1
  61. package/models/components/scope.js +0 -2
  62. package/models/components/scope.js.map +1 -1
  63. package/models/components/userorderproduct.d.ts +2 -24
  64. package/models/components/userorderproduct.d.ts.map +1 -1
  65. package/models/components/userorderproduct.js +3 -27
  66. package/models/components/userorderproduct.js.map +1 -1
  67. package/models/components/usersubscriptionproduct.d.ts +2 -24
  68. package/models/components/usersubscriptionproduct.d.ts.map +1 -1
  69. package/models/components/usersubscriptionproduct.js +3 -27
  70. package/models/components/usersubscriptionproduct.js.map +1 -1
  71. package/models/operations/benefitsupdate.d.ts +4 -4
  72. package/models/operations/benefitsupdate.d.ts.map +1 -1
  73. package/models/operations/benefitsupdate.js +0 -4
  74. package/models/operations/benefitsupdate.js.map +1 -1
  75. package/models/operations/index.d.ts +0 -8
  76. package/models/operations/index.d.ts.map +1 -1
  77. package/models/operations/index.js +0 -8
  78. package/models/operations/index.js.map +1 -1
  79. package/models/operations/usersbenefitsget.d.ts +2 -6
  80. package/models/operations/usersbenefitsget.d.ts.map +1 -1
  81. package/models/operations/usersbenefitsget.js +0 -6
  82. package/models/operations/usersbenefitsget.js.map +1 -1
  83. package/package.json +1 -3
  84. package/sdk/sdk.d.ts +0 -3
  85. package/sdk/sdk.d.ts.map +1 -1
  86. package/sdk/sdk.js +0 -5
  87. package/sdk/sdk.js.map +1 -1
  88. package/src/hooks/hooks.ts +20 -0
  89. package/src/hooks/types.ts +9 -0
  90. package/src/lib/config.ts +3 -3
  91. package/src/models/components/benefit.ts +0 -10
  92. package/src/models/components/benefitadssubscriber.ts +12 -15
  93. package/src/models/components/benefitgrant.ts +0 -14
  94. package/src/models/components/benefitgrantwebhook.ts +0 -22
  95. package/src/models/components/benefittype.ts +0 -1
  96. package/src/models/components/checkoutlinkproduct.ts +4 -68
  97. package/src/models/components/checkoutproduct.ts +4 -66
  98. package/src/models/components/index.ts +0 -15
  99. package/src/models/components/listresourceuserbenefit.ts +0 -30
  100. package/src/models/components/oauth2client.ts +2 -2
  101. package/src/models/components/oauth2clientconfiguration.ts +2 -2
  102. package/src/models/components/oauth2clientconfigurationupdate.ts +2 -2
  103. package/src/models/components/organizationfeaturesettings.ts +0 -9
  104. package/src/models/components/scope.ts +0 -2
  105. package/src/models/components/userorderproduct.ts +4 -60
  106. package/src/models/components/usersubscriptionproduct.ts +4 -68
  107. package/src/models/operations/benefitsupdate.ts +0 -8
  108. package/src/models/operations/index.ts +0 -8
  109. package/src/models/operations/usersbenefitsget.ts +0 -12
  110. package/src/sdk/sdk.ts +0 -6
  111. package/src/types/index.ts +1 -0
  112. package/src/types/webhooks.ts +7 -0
  113. package/types/index.d.ts +1 -0
  114. package/types/index.d.ts.map +1 -1
  115. package/types/webhooks.d.ts +4 -0
  116. package/types/webhooks.d.ts.map +1 -0
  117. package/types/webhooks.js +6 -0
  118. package/types/webhooks.js.map +1 -0
  119. package/docs/sdks/articles/README.md +0 -724
  120. package/funcs/articlesCreate.d.ts +0 -16
  121. package/funcs/articlesCreate.d.ts.map +0 -1
  122. package/funcs/articlesCreate.js +0 -99
  123. package/funcs/articlesCreate.js.map +0 -1
  124. package/funcs/articlesDelete.d.ts +0 -16
  125. package/funcs/articlesDelete.d.ts.map +0 -1
  126. package/funcs/articlesDelete.js +0 -105
  127. package/funcs/articlesDelete.js.map +0 -1
  128. package/funcs/articlesExport.d.ts +0 -16
  129. package/funcs/articlesExport.d.ts.map +0 -1
  130. package/funcs/articlesExport.js +0 -103
  131. package/funcs/articlesExport.js.map +0 -1
  132. package/funcs/articlesGet.d.ts +0 -17
  133. package/funcs/articlesGet.d.ts.map +0 -1
  134. package/funcs/articlesGet.js +0 -105
  135. package/funcs/articlesGet.js.map +0 -1
  136. package/funcs/articlesList.d.ts +0 -19
  137. package/funcs/articlesList.d.ts.map +0 -1
  138. package/funcs/articlesList.js +0 -138
  139. package/funcs/articlesList.js.map +0 -1
  140. package/funcs/articlesPreview.d.ts +0 -16
  141. package/funcs/articlesPreview.d.ts.map +0 -1
  142. package/funcs/articlesPreview.js +0 -106
  143. package/funcs/articlesPreview.js.map +0 -1
  144. package/funcs/articlesReceivers.d.ts +0 -17
  145. package/funcs/articlesReceivers.d.ts.map +0 -1
  146. package/funcs/articlesReceivers.js +0 -105
  147. package/funcs/articlesReceivers.js.map +0 -1
  148. package/funcs/articlesSend.d.ts +0 -16
  149. package/funcs/articlesSend.d.ts.map +0 -1
  150. package/funcs/articlesSend.js +0 -105
  151. package/funcs/articlesSend.js.map +0 -1
  152. package/funcs/articlesUpdate.d.ts +0 -17
  153. package/funcs/articlesUpdate.d.ts.map +0 -1
  154. package/funcs/articlesUpdate.js +0 -106
  155. package/funcs/articlesUpdate.js.map +0 -1
  156. package/models/components/article.d.ts +0 -68
  157. package/models/components/article.d.ts.map +0 -1
  158. package/models/components/article.js +0 -129
  159. package/models/components/article.js.map +0 -1
  160. package/models/components/articlebyline.d.ts +0 -28
  161. package/models/components/articlebyline.d.ts.map +0 -1
  162. package/models/components/articlebyline.js +0 -50
  163. package/models/components/articlebyline.js.map +0 -1
  164. package/models/components/articlecreate.d.ts +0 -93
  165. package/models/components/articlecreate.d.ts.map +0 -1
  166. package/models/components/articlecreate.js +0 -112
  167. package/models/components/articlecreate.js.map +0 -1
  168. package/models/components/articlepreview.d.ts +0 -32
  169. package/models/components/articlepreview.d.ts.map +0 -1
  170. package/models/components/articlepreview.js +0 -59
  171. package/models/components/articlepreview.js.map +0 -1
  172. package/models/components/articlereceivers.d.ts +0 -33
  173. package/models/components/articlereceivers.d.ts.map +0 -1
  174. package/models/components/articlereceivers.js +0 -76
  175. package/models/components/articlereceivers.js.map +0 -1
  176. package/models/components/articleupdate.d.ts +0 -85
  177. package/models/components/articleupdate.d.ts.map +0 -1
  178. package/models/components/articleupdate.js +0 -108
  179. package/models/components/articleupdate.js.map +0 -1
  180. package/models/components/articlevisibility.d.ts +0 -31
  181. package/models/components/articlevisibility.d.ts.map +0 -1
  182. package/models/components/articlevisibility.js +0 -51
  183. package/models/components/articlevisibility.js.map +0 -1
  184. package/models/components/benefitarticles.d.ts +0 -100
  185. package/models/components/benefitarticles.d.ts.map +0 -1
  186. package/models/components/benefitarticles.js +0 -107
  187. package/models/components/benefitarticles.js.map +0 -1
  188. package/models/components/benefitarticlesproperties.d.ts +0 -35
  189. package/models/components/benefitarticlesproperties.d.ts.map +0 -1
  190. package/models/components/benefitarticlesproperties.js +0 -68
  191. package/models/components/benefitarticlesproperties.js.map +0 -1
  192. package/models/components/benefitarticlessubscriber.d.ts +0 -99
  193. package/models/components/benefitarticlessubscriber.d.ts.map +0 -1
  194. package/models/components/benefitarticlessubscriber.js +0 -113
  195. package/models/components/benefitarticlessubscriber.js.map +0 -1
  196. package/models/components/benefitarticlessubscriberproperties.d.ts +0 -35
  197. package/models/components/benefitarticlessubscriberproperties.d.ts.map +0 -1
  198. package/models/components/benefitarticlessubscriberproperties.js +0 -68
  199. package/models/components/benefitarticlessubscriberproperties.js.map +0 -1
  200. package/models/components/benefitarticlesupdate.d.ts +0 -57
  201. package/models/components/benefitarticlesupdate.d.ts.map +0 -1
  202. package/models/components/benefitarticlesupdate.js +0 -79
  203. package/models/components/benefitarticlesupdate.js.map +0 -1
  204. package/models/components/benefitgrantarticlesproperties.d.ts +0 -25
  205. package/models/components/benefitgrantarticlesproperties.d.ts.map +0 -1
  206. package/models/components/benefitgrantarticlesproperties.js +0 -55
  207. package/models/components/benefitgrantarticlesproperties.js.map +0 -1
  208. package/models/components/bylineprofile.d.ts +0 -31
  209. package/models/components/bylineprofile.d.ts.map +0 -1
  210. package/models/components/bylineprofile.js +0 -70
  211. package/models/components/bylineprofile.js.map +0 -1
  212. package/models/components/listresourcearticle.d.ts +0 -33
  213. package/models/components/listresourcearticle.d.ts.map +0 -1
  214. package/models/components/listresourcearticle.js +0 -63
  215. package/models/components/listresourcearticle.js.map +0 -1
  216. package/models/operations/articlesdelete.d.ts +0 -29
  217. package/models/operations/articlesdelete.d.ts.map +0 -1
  218. package/models/operations/articlesdelete.js +0 -59
  219. package/models/operations/articlesdelete.js.map +0 -1
  220. package/models/operations/articlesexport.d.ts +0 -29
  221. package/models/operations/articlesexport.d.ts.map +0 -1
  222. package/models/operations/articlesexport.js +0 -68
  223. package/models/operations/articlesexport.js.map +0 -1
  224. package/models/operations/articlesget.d.ts +0 -29
  225. package/models/operations/articlesget.d.ts.map +0 -1
  226. package/models/operations/articlesget.js +0 -59
  227. package/models/operations/articlesget.js.map +0 -1
  228. package/models/operations/articleslist.d.ts +0 -141
  229. package/models/operations/articleslist.d.ts.map +0 -1
  230. package/models/operations/articleslist.js +0 -184
  231. package/models/operations/articleslist.js.map +0 -1
  232. package/models/operations/articlespreview.d.ts +0 -32
  233. package/models/operations/articlespreview.d.ts.map +0 -1
  234. package/models/operations/articlespreview.js +0 -71
  235. package/models/operations/articlespreview.js.map +0 -1
  236. package/models/operations/articlesreceivers.d.ts +0 -29
  237. package/models/operations/articlesreceivers.d.ts.map +0 -1
  238. package/models/operations/articlesreceivers.js +0 -59
  239. package/models/operations/articlesreceivers.js.map +0 -1
  240. package/models/operations/articlessend.d.ts +0 -29
  241. package/models/operations/articlessend.d.ts.map +0 -1
  242. package/models/operations/articlessend.js +0 -59
  243. package/models/operations/articlessend.js.map +0 -1
  244. package/models/operations/articlesupdate.d.ts +0 -32
  245. package/models/operations/articlesupdate.d.ts.map +0 -1
  246. package/models/operations/articlesupdate.js +0 -71
  247. package/models/operations/articlesupdate.js.map +0 -1
  248. package/sdk/articles.d.ts +0 -72
  249. package/sdk/articles.d.ts.map +0 -1
  250. package/sdk/articles.js +0 -103
  251. package/sdk/articles.js.map +0 -1
  252. package/src/funcs/articlesCreate.ts +0 -131
  253. package/src/funcs/articlesDelete.ts +0 -144
  254. package/src/funcs/articlesExport.ts +0 -136
  255. package/src/funcs/articlesGet.ts +0 -141
  256. package/src/funcs/articlesList.ts +0 -205
  257. package/src/funcs/articlesPreview.ts +0 -145
  258. package/src/funcs/articlesReceivers.ts +0 -138
  259. package/src/funcs/articlesSend.ts +0 -144
  260. package/src/funcs/articlesUpdate.ts +0 -145
  261. package/src/models/components/article.ts +0 -187
  262. package/src/models/components/articlebyline.ts +0 -33
  263. package/src/models/components/articlecreate.ts +0 -191
  264. package/src/models/components/articlepreview.ts +0 -65
  265. package/src/models/components/articlereceivers.ts +0 -87
  266. package/src/models/components/articleupdate.ts +0 -179
  267. package/src/models/components/articlevisibility.ts +0 -34
  268. package/src/models/components/benefitarticles.ts +0 -175
  269. package/src/models/components/benefitarticlesproperties.ts +0 -81
  270. package/src/models/components/benefitarticlessubscriber.ts +0 -189
  271. package/src/models/components/benefitarticlessubscriberproperties.ts +0 -86
  272. package/src/models/components/benefitarticlesupdate.ts +0 -102
  273. package/src/models/components/benefitgrantarticlesproperties.ts +0 -60
  274. package/src/models/components/bylineprofile.ts +0 -75
  275. package/src/models/components/listresourcearticle.ts +0 -82
  276. package/src/models/operations/articlesdelete.ts +0 -66
  277. package/src/models/operations/articlesexport.ts +0 -75
  278. package/src/models/operations/articlesget.ts +0 -66
  279. package/src/models/operations/articleslist.ts +0 -342
  280. package/src/models/operations/articlespreview.ts +0 -80
  281. package/src/models/operations/articlesreceivers.ts +0 -66
  282. package/src/models/operations/articlessend.ts +0 -66
  283. package/src/models/operations/articlesupdate.ts +0 -80
  284. 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 | \*/\* |