@polar-sh/sdk 0.1.1 → 0.2.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/README.md CHANGED
@@ -1,12 +1,11 @@
1
1
  # Polar SDK
2
2
 
3
- The Polar SDK is a JavaScript library with capabilities to interact with the Polar API.
3
+ The Polar SDK is a JavaScript library with capabilities to interact with the Polar API.
4
4
 
5
5
  The SDK is compatible with both browser & server-side runtimes. It is automatically generated from our OpenAPI implementation, making it up-to-date with the server-side API at any time.
6
6
 
7
7
  [Read more about our OpenAPI Schema & documentation](https://docs.polar.sh/api)
8
8
 
9
-
10
9
  ## Usage
11
10
 
12
11
  The SDK is available from NPM.
@@ -16,15 +15,15 @@ The SDK is available from NPM.
16
15
  Once installed, you may import the SDK like you usually would:
17
16
 
18
17
  ```typescript
19
- import { Configuration, PolarAPI } from '@polar-sh/sdk';
18
+ import { Configuration, PolarAPI } from '@polar-sh/sdk'
20
19
 
21
- const api = new PolarAPI();
20
+ const api = new PolarAPI()
22
21
 
23
22
  const authedApi = new PolarAPI(
24
- new Configuration({
25
- accessToken: '<MY_ACCESS_TOKEN>'
26
- })
27
- );
23
+ new Configuration({
24
+ accessToken: '<MY_ACCESS_TOKEN>',
25
+ }),
26
+ )
28
27
  ```
29
28
 
30
29
  ### Access Tokens
@@ -38,25 +37,27 @@ You can acquire an access token through your [Settings page](https://polar.sh/se
38
37
  You can easily retrieve issues looking for funding using the Funding-service.
39
38
 
40
39
  ```typescript
41
- import { Configuration, PolarAPI, Platforms, ListFundingSortBy } from '@polar-sh/sdk';
42
-
43
- const api = new PolarAPI(new Configuration());
44
-
45
- const issuesFunding = await api.funding.search(
46
- {
47
- platform: Platforms.GITHUB,
48
- organizationName: '<MY_GITHUB_ORGANIZATION_NAME>',
49
- badged: true,
50
- closed: false,
51
- sorting: [
52
- ListFundingSortBy.MOST_FUNDED,
53
- ListFundingSortBy.MOST_ENGAGEMENT,
54
- ListFundingSortBy.NEWEST,
55
- ],
56
- limit: 20,
57
- }
58
- );
59
-
40
+ import {
41
+ Configuration,
42
+ ListFundingSortBy,
43
+ Platforms,
44
+ PolarAPI,
45
+ } from '@polar-sh/sdk'
46
+
47
+ const api = new PolarAPI(new Configuration())
48
+
49
+ const issuesFunding = await api.funding.search({
50
+ platform: Platforms.GITHUB,
51
+ organizationName: '<MY_GITHUB_ORGANIZATION_NAME>',
52
+ badged: true,
53
+ closed: false,
54
+ sorting: [
55
+ ListFundingSortBy.MOST_FUNDED,
56
+ ListFundingSortBy.MOST_ENGAGEMENT,
57
+ ListFundingSortBy.NEWEST,
58
+ ],
59
+ limit: 20,
60
+ })
60
61
  ```
61
62
 
62
63
  ### Issue data from GitHub Issue
@@ -64,21 +65,19 @@ const issuesFunding = await api.funding.search(
64
65
  Retrieve Polar data about a given GitHub issue.
65
66
 
66
67
  ```typescript
67
- import { Configuration, PolarAPI } from '@polar-sh/sdk';
68
+ import { Configuration, PolarAPI } from '@polar-sh/sdk'
68
69
 
69
- const api = new PolarAPI(new Configuration());
70
+ const api = new PolarAPI(new Configuration())
70
71
 
71
72
  const params = {
72
- organization: 'polarsource',
73
- repo: 'polar',
74
- number: 900
73
+ organization: 'polarsource',
74
+ repo: 'polar',
75
+ number: 900,
75
76
  }
76
77
 
77
- const issue = await api.issues.lookup(
78
- {
79
- externalUrl: `https://github.com/${params.organization}/${params.repo}/issues/${params.number}`,
80
- }
81
- );
78
+ const issue = await api.issues.lookup({
79
+ externalUrl: `https://github.com/${params.organization}/${params.repo}/issues/${params.number}`,
80
+ })
82
81
  ```
83
82
 
84
83
  ### Add Polar badge to a GitHub issue
@@ -86,15 +85,15 @@ const issue = await api.issues.lookup(
86
85
  Adds a Polar badge to a given GitHub issue.
87
86
 
88
87
  ```typescript
89
- import { Configuration, PolarAPI } from '@polar-sh/sdk';
88
+ import { Configuration, PolarAPI } from '@polar-sh/sdk'
90
89
 
91
90
  const api = new PolarAPI(
92
- new Configuration({
93
- accessToken: '<MY_ACCESS_TOKEN>'
94
- })
95
- );
91
+ new Configuration({
92
+ accessToken: '<MY_ACCESS_TOKEN>',
93
+ }),
94
+ )
96
95
 
97
96
  await api.issues.addPolarBadge({
98
- id: '<ISSUE_ID>'
99
- });
100
- ```
97
+ id: '<ISSUE_ID>',
98
+ })
99
+ ```