@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.
- package/FUNCTIONS.md +106 -0
- package/README.md +181 -30
- package/RUNTIMES.md +22 -0
- package/docs/sdks/checkouts/README.md +1 -1
- package/hooks/hooks.d.ts.map +1 -1
- package/hooks/hooks.js +18 -0
- package/hooks/hooks.js.map +1 -1
- package/hooks/types.d.ts +3 -0
- package/hooks/types.d.ts.map +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/lib/config.js.map +1 -1
- package/models/components/benefit.d.ts +2 -3
- package/models/components/benefit.d.ts.map +1 -1
- package/models/components/benefit.js +0 -3
- package/models/components/benefit.js.map +1 -1
- package/models/components/benefitadssubscriber.d.ts +7 -7
- package/models/components/benefitadssubscriber.d.ts.map +1 -1
- package/models/components/benefitadssubscriber.js +11 -11
- package/models/components/benefitadssubscriber.js.map +1 -1
- package/models/components/benefitgrant.d.ts +4 -5
- package/models/components/benefitgrant.d.ts.map +1 -1
- package/models/components/benefitgrant.js +0 -5
- package/models/components/benefitgrant.js.map +1 -1
- package/models/components/benefitgrantwebhook.d.ts +8 -9
- package/models/components/benefitgrantwebhook.d.ts.map +1 -1
- package/models/components/benefitgrantwebhook.js +0 -9
- package/models/components/benefitgrantwebhook.js.map +1 -1
- package/models/components/benefittype.d.ts +0 -3
- package/models/components/benefittype.d.ts.map +1 -1
- package/models/components/benefittype.js +0 -1
- package/models/components/benefittype.js.map +1 -1
- package/models/components/checkoutlinkproduct.d.ts +2 -24
- package/models/components/checkoutlinkproduct.d.ts.map +1 -1
- package/models/components/checkoutlinkproduct.js +3 -27
- package/models/components/checkoutlinkproduct.js.map +1 -1
- package/models/components/checkoutproduct.d.ts +2 -24
- package/models/components/checkoutproduct.d.ts.map +1 -1
- package/models/components/checkoutproduct.js +3 -27
- package/models/components/checkoutproduct.js.map +1 -1
- package/models/components/index.d.ts +0 -15
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +0 -15
- package/models/components/index.js.map +1 -1
- package/models/components/listresourceuserbenefit.d.ts +0 -9
- package/models/components/listresourceuserbenefit.d.ts.map +1 -1
- package/models/components/listresourceuserbenefit.js +0 -13
- package/models/components/listresourceuserbenefit.js.map +1 -1
- package/models/components/oauth2client.js +2 -2
- package/models/components/oauth2client.js.map +1 -1
- package/models/components/oauth2clientconfiguration.js +2 -2
- package/models/components/oauth2clientconfiguration.js.map +1 -1
- package/models/components/oauth2clientconfigurationupdate.js +2 -2
- package/models/components/oauth2clientconfigurationupdate.js.map +1 -1
- package/models/components/organizationfeaturesettings.d.ts +0 -5
- package/models/components/organizationfeaturesettings.d.ts.map +1 -1
- package/models/components/organizationfeaturesettings.js +0 -4
- package/models/components/organizationfeaturesettings.js.map +1 -1
- package/models/components/scope.d.ts +0 -6
- package/models/components/scope.d.ts.map +1 -1
- package/models/components/scope.js +0 -2
- package/models/components/scope.js.map +1 -1
- package/models/components/userorderproduct.d.ts +2 -24
- package/models/components/userorderproduct.d.ts.map +1 -1
- package/models/components/userorderproduct.js +3 -27
- package/models/components/userorderproduct.js.map +1 -1
- package/models/components/usersubscriptionproduct.d.ts +2 -24
- package/models/components/usersubscriptionproduct.d.ts.map +1 -1
- package/models/components/usersubscriptionproduct.js +3 -27
- package/models/components/usersubscriptionproduct.js.map +1 -1
- package/models/operations/benefitsupdate.d.ts +4 -4
- package/models/operations/benefitsupdate.d.ts.map +1 -1
- package/models/operations/benefitsupdate.js +0 -4
- package/models/operations/benefitsupdate.js.map +1 -1
- package/models/operations/index.d.ts +0 -8
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +0 -8
- package/models/operations/index.js.map +1 -1
- package/models/operations/usersbenefitsget.d.ts +2 -6
- package/models/operations/usersbenefitsget.d.ts.map +1 -1
- package/models/operations/usersbenefitsget.js +0 -6
- package/models/operations/usersbenefitsget.js.map +1 -1
- package/package.json +1 -3
- package/sdk/sdk.d.ts +0 -3
- package/sdk/sdk.d.ts.map +1 -1
- package/sdk/sdk.js +0 -5
- package/sdk/sdk.js.map +1 -1
- package/src/hooks/hooks.ts +20 -0
- package/src/hooks/types.ts +9 -0
- package/src/lib/config.ts +3 -3
- package/src/models/components/benefit.ts +0 -10
- package/src/models/components/benefitadssubscriber.ts +12 -15
- package/src/models/components/benefitgrant.ts +0 -14
- package/src/models/components/benefitgrantwebhook.ts +0 -22
- package/src/models/components/benefittype.ts +0 -1
- package/src/models/components/checkoutlinkproduct.ts +4 -68
- package/src/models/components/checkoutproduct.ts +4 -66
- package/src/models/components/index.ts +0 -15
- package/src/models/components/listresourceuserbenefit.ts +0 -30
- package/src/models/components/oauth2client.ts +2 -2
- package/src/models/components/oauth2clientconfiguration.ts +2 -2
- package/src/models/components/oauth2clientconfigurationupdate.ts +2 -2
- package/src/models/components/organizationfeaturesettings.ts +0 -9
- package/src/models/components/scope.ts +0 -2
- package/src/models/components/userorderproduct.ts +4 -60
- package/src/models/components/usersubscriptionproduct.ts +4 -68
- package/src/models/operations/benefitsupdate.ts +0 -8
- package/src/models/operations/index.ts +0 -8
- package/src/models/operations/usersbenefitsget.ts +0 -12
- package/src/sdk/sdk.ts +0 -6
- package/src/types/index.ts +1 -0
- package/src/types/webhooks.ts +7 -0
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/webhooks.d.ts +4 -0
- package/types/webhooks.d.ts.map +1 -0
- package/types/webhooks.js +6 -0
- package/types/webhooks.js.map +1 -0
- package/docs/sdks/articles/README.md +0 -724
- package/funcs/articlesCreate.d.ts +0 -16
- package/funcs/articlesCreate.d.ts.map +0 -1
- package/funcs/articlesCreate.js +0 -99
- package/funcs/articlesCreate.js.map +0 -1
- package/funcs/articlesDelete.d.ts +0 -16
- package/funcs/articlesDelete.d.ts.map +0 -1
- package/funcs/articlesDelete.js +0 -105
- package/funcs/articlesDelete.js.map +0 -1
- package/funcs/articlesExport.d.ts +0 -16
- package/funcs/articlesExport.d.ts.map +0 -1
- package/funcs/articlesExport.js +0 -103
- package/funcs/articlesExport.js.map +0 -1
- package/funcs/articlesGet.d.ts +0 -17
- package/funcs/articlesGet.d.ts.map +0 -1
- package/funcs/articlesGet.js +0 -105
- package/funcs/articlesGet.js.map +0 -1
- package/funcs/articlesList.d.ts +0 -19
- package/funcs/articlesList.d.ts.map +0 -1
- package/funcs/articlesList.js +0 -138
- package/funcs/articlesList.js.map +0 -1
- package/funcs/articlesPreview.d.ts +0 -16
- package/funcs/articlesPreview.d.ts.map +0 -1
- package/funcs/articlesPreview.js +0 -106
- package/funcs/articlesPreview.js.map +0 -1
- package/funcs/articlesReceivers.d.ts +0 -17
- package/funcs/articlesReceivers.d.ts.map +0 -1
- package/funcs/articlesReceivers.js +0 -105
- package/funcs/articlesReceivers.js.map +0 -1
- package/funcs/articlesSend.d.ts +0 -16
- package/funcs/articlesSend.d.ts.map +0 -1
- package/funcs/articlesSend.js +0 -105
- package/funcs/articlesSend.js.map +0 -1
- package/funcs/articlesUpdate.d.ts +0 -17
- package/funcs/articlesUpdate.d.ts.map +0 -1
- package/funcs/articlesUpdate.js +0 -106
- package/funcs/articlesUpdate.js.map +0 -1
- package/models/components/article.d.ts +0 -68
- package/models/components/article.d.ts.map +0 -1
- package/models/components/article.js +0 -129
- package/models/components/article.js.map +0 -1
- package/models/components/articlebyline.d.ts +0 -28
- package/models/components/articlebyline.d.ts.map +0 -1
- package/models/components/articlebyline.js +0 -50
- package/models/components/articlebyline.js.map +0 -1
- package/models/components/articlecreate.d.ts +0 -93
- package/models/components/articlecreate.d.ts.map +0 -1
- package/models/components/articlecreate.js +0 -112
- package/models/components/articlecreate.js.map +0 -1
- package/models/components/articlepreview.d.ts +0 -32
- package/models/components/articlepreview.d.ts.map +0 -1
- package/models/components/articlepreview.js +0 -59
- package/models/components/articlepreview.js.map +0 -1
- package/models/components/articlereceivers.d.ts +0 -33
- package/models/components/articlereceivers.d.ts.map +0 -1
- package/models/components/articlereceivers.js +0 -76
- package/models/components/articlereceivers.js.map +0 -1
- package/models/components/articleupdate.d.ts +0 -85
- package/models/components/articleupdate.d.ts.map +0 -1
- package/models/components/articleupdate.js +0 -108
- package/models/components/articleupdate.js.map +0 -1
- package/models/components/articlevisibility.d.ts +0 -31
- package/models/components/articlevisibility.d.ts.map +0 -1
- package/models/components/articlevisibility.js +0 -51
- package/models/components/articlevisibility.js.map +0 -1
- package/models/components/benefitarticles.d.ts +0 -100
- package/models/components/benefitarticles.d.ts.map +0 -1
- package/models/components/benefitarticles.js +0 -107
- package/models/components/benefitarticles.js.map +0 -1
- package/models/components/benefitarticlesproperties.d.ts +0 -35
- package/models/components/benefitarticlesproperties.d.ts.map +0 -1
- package/models/components/benefitarticlesproperties.js +0 -68
- package/models/components/benefitarticlesproperties.js.map +0 -1
- package/models/components/benefitarticlessubscriber.d.ts +0 -99
- package/models/components/benefitarticlessubscriber.d.ts.map +0 -1
- package/models/components/benefitarticlessubscriber.js +0 -113
- package/models/components/benefitarticlessubscriber.js.map +0 -1
- package/models/components/benefitarticlessubscriberproperties.d.ts +0 -35
- package/models/components/benefitarticlessubscriberproperties.d.ts.map +0 -1
- package/models/components/benefitarticlessubscriberproperties.js +0 -68
- package/models/components/benefitarticlessubscriberproperties.js.map +0 -1
- package/models/components/benefitarticlesupdate.d.ts +0 -57
- package/models/components/benefitarticlesupdate.d.ts.map +0 -1
- package/models/components/benefitarticlesupdate.js +0 -79
- package/models/components/benefitarticlesupdate.js.map +0 -1
- package/models/components/benefitgrantarticlesproperties.d.ts +0 -25
- package/models/components/benefitgrantarticlesproperties.d.ts.map +0 -1
- package/models/components/benefitgrantarticlesproperties.js +0 -55
- package/models/components/benefitgrantarticlesproperties.js.map +0 -1
- package/models/components/bylineprofile.d.ts +0 -31
- package/models/components/bylineprofile.d.ts.map +0 -1
- package/models/components/bylineprofile.js +0 -70
- package/models/components/bylineprofile.js.map +0 -1
- package/models/components/listresourcearticle.d.ts +0 -33
- package/models/components/listresourcearticle.d.ts.map +0 -1
- package/models/components/listresourcearticle.js +0 -63
- package/models/components/listresourcearticle.js.map +0 -1
- package/models/operations/articlesdelete.d.ts +0 -29
- package/models/operations/articlesdelete.d.ts.map +0 -1
- package/models/operations/articlesdelete.js +0 -59
- package/models/operations/articlesdelete.js.map +0 -1
- package/models/operations/articlesexport.d.ts +0 -29
- package/models/operations/articlesexport.d.ts.map +0 -1
- package/models/operations/articlesexport.js +0 -68
- package/models/operations/articlesexport.js.map +0 -1
- package/models/operations/articlesget.d.ts +0 -29
- package/models/operations/articlesget.d.ts.map +0 -1
- package/models/operations/articlesget.js +0 -59
- package/models/operations/articlesget.js.map +0 -1
- package/models/operations/articleslist.d.ts +0 -141
- package/models/operations/articleslist.d.ts.map +0 -1
- package/models/operations/articleslist.js +0 -184
- package/models/operations/articleslist.js.map +0 -1
- package/models/operations/articlespreview.d.ts +0 -32
- package/models/operations/articlespreview.d.ts.map +0 -1
- package/models/operations/articlespreview.js +0 -71
- package/models/operations/articlespreview.js.map +0 -1
- package/models/operations/articlesreceivers.d.ts +0 -29
- package/models/operations/articlesreceivers.d.ts.map +0 -1
- package/models/operations/articlesreceivers.js +0 -59
- package/models/operations/articlesreceivers.js.map +0 -1
- package/models/operations/articlessend.d.ts +0 -29
- package/models/operations/articlessend.d.ts.map +0 -1
- package/models/operations/articlessend.js +0 -59
- package/models/operations/articlessend.js.map +0 -1
- package/models/operations/articlesupdate.d.ts +0 -32
- package/models/operations/articlesupdate.d.ts.map +0 -1
- package/models/operations/articlesupdate.js +0 -71
- package/models/operations/articlesupdate.js.map +0 -1
- package/sdk/articles.d.ts +0 -72
- package/sdk/articles.d.ts.map +0 -1
- package/sdk/articles.js +0 -103
- package/sdk/articles.js.map +0 -1
- package/src/funcs/articlesCreate.ts +0 -131
- package/src/funcs/articlesDelete.ts +0 -144
- package/src/funcs/articlesExport.ts +0 -136
- package/src/funcs/articlesGet.ts +0 -141
- package/src/funcs/articlesList.ts +0 -205
- package/src/funcs/articlesPreview.ts +0 -145
- package/src/funcs/articlesReceivers.ts +0 -138
- package/src/funcs/articlesSend.ts +0 -144
- package/src/funcs/articlesUpdate.ts +0 -145
- package/src/models/components/article.ts +0 -187
- package/src/models/components/articlebyline.ts +0 -33
- package/src/models/components/articlecreate.ts +0 -191
- package/src/models/components/articlepreview.ts +0 -65
- package/src/models/components/articlereceivers.ts +0 -87
- package/src/models/components/articleupdate.ts +0 -179
- package/src/models/components/articlevisibility.ts +0 -34
- package/src/models/components/benefitarticles.ts +0 -175
- package/src/models/components/benefitarticlesproperties.ts +0 -81
- package/src/models/components/benefitarticlessubscriber.ts +0 -189
- package/src/models/components/benefitarticlessubscriberproperties.ts +0 -86
- package/src/models/components/benefitarticlesupdate.ts +0 -102
- package/src/models/components/benefitgrantarticlesproperties.ts +0 -60
- package/src/models/components/bylineprofile.ts +0 -75
- package/src/models/components/listresourcearticle.ts +0 -82
- package/src/models/operations/articlesdelete.ts +0 -66
- package/src/models/operations/articlesexport.ts +0 -75
- package/src/models/operations/articlesget.ts +0 -66
- package/src/models/operations/articleslist.ts +0 -342
- package/src/models/operations/articlespreview.ts +0 -80
- package/src/models/operations/articlesreceivers.ts +0 -66
- package/src/models/operations/articlessend.ts +0 -66
- package/src/models/operations/articlesupdate.ts +0 -80
- 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 | \*/\* |
|