@polar-sh/sdk
Advanced tools
Comparing version 0.1.1 to 0.2.0
{ | ||
"name": "@polar-sh/sdk", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"main": "./dist/index.js", | ||
@@ -15,3 +15,3 @@ "module": "./dist/index.mjs", | ||
"tsup": "^7.2.0", | ||
"typescript": "5.0.4", | ||
"typescript": "5.3.3", | ||
"tsconfig": "0.0.0" | ||
@@ -18,0 +18,0 @@ }, |
# Polar SDK | ||
The Polar SDK is a JavaScript library with capabilities to interact with the Polar API. | ||
The Polar SDK is a JavaScript library with capabilities to interact with the Polar API. | ||
@@ -9,3 +9,2 @@ 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. | ||
## Usage | ||
@@ -20,11 +19,11 @@ | ||
```typescript | ||
import { Configuration, PolarAPI } from '@polar-sh/sdk'; | ||
import { Configuration, PolarAPI } from '@polar-sh/sdk' | ||
const api = new PolarAPI(); | ||
const api = new PolarAPI() | ||
const authedApi = new PolarAPI( | ||
new Configuration({ | ||
accessToken: '<MY_ACCESS_TOKEN>' | ||
}) | ||
); | ||
new Configuration({ | ||
accessToken: '<MY_ACCESS_TOKEN>', | ||
}), | ||
) | ||
``` | ||
@@ -43,21 +42,23 @@ | ||
```typescript | ||
import { Configuration, PolarAPI, Platforms, ListFundingSortBy } from '@polar-sh/sdk'; | ||
import { | ||
Configuration, | ||
ListFundingSortBy, | ||
Platforms, | ||
PolarAPI, | ||
} from '@polar-sh/sdk' | ||
const api = new PolarAPI(new Configuration()); | ||
const api = new PolarAPI(new Configuration()) | ||
const issuesFunding = await api.funding.search( | ||
{ | ||
platform: Platforms.GITHUB, | ||
organizationName: '<MY_GITHUB_ORGANIZATION_NAME>', | ||
badged: true, | ||
closed: false, | ||
sorting: [ | ||
ListFundingSortBy.MOST_FUNDED, | ||
ListFundingSortBy.MOST_ENGAGEMENT, | ||
ListFundingSortBy.NEWEST, | ||
], | ||
limit: 20, | ||
} | ||
); | ||
const issuesFunding = await api.funding.search({ | ||
platform: Platforms.GITHUB, | ||
organizationName: '<MY_GITHUB_ORGANIZATION_NAME>', | ||
badged: true, | ||
closed: false, | ||
sorting: [ | ||
ListFundingSortBy.MOST_FUNDED, | ||
ListFundingSortBy.MOST_ENGAGEMENT, | ||
ListFundingSortBy.NEWEST, | ||
], | ||
limit: 20, | ||
}) | ||
``` | ||
@@ -70,17 +71,15 @@ | ||
```typescript | ||
import { Configuration, PolarAPI } from '@polar-sh/sdk'; | ||
import { Configuration, PolarAPI } from '@polar-sh/sdk' | ||
const api = new PolarAPI(new Configuration()); | ||
const api = new PolarAPI(new Configuration()) | ||
const params = { | ||
organization: 'polarsource', | ||
repo: 'polar', | ||
number: 900 | ||
organization: 'polarsource', | ||
repo: 'polar', | ||
number: 900, | ||
} | ||
const issue = await api.issues.lookup( | ||
{ | ||
externalUrl: `https://github.com/${params.organization}/${params.repo}/issues/${params.number}`, | ||
} | ||
); | ||
const issue = await api.issues.lookup({ | ||
externalUrl: `https://github.com/${params.organization}/${params.repo}/issues/${params.number}`, | ||
}) | ||
``` | ||
@@ -93,13 +92,13 @@ | ||
```typescript | ||
import { Configuration, PolarAPI } from '@polar-sh/sdk'; | ||
import { Configuration, PolarAPI } from '@polar-sh/sdk' | ||
const api = new PolarAPI( | ||
new Configuration({ | ||
accessToken: '<MY_ACCESS_TOKEN>' | ||
}) | ||
); | ||
new Configuration({ | ||
accessToken: '<MY_ACCESS_TOKEN>', | ||
}), | ||
) | ||
await api.issues.addPolarBadge({ | ||
id: '<ISSUE_ID>' | ||
}); | ||
``` | ||
id: '<ISSUE_ID>', | ||
}) | ||
``` |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1066327
24554