Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@polar-sh/sdk

Package Overview
Dependencies
Maintainers
4
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polar-sh/sdk

The Polar SDK is a JavaScript library with capabilities to interact with the Polar API.

  • 0.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.6K
increased by0.76%
Maintainers
4
Weekly downloads
 
Created
Source

Polar SDK

The Polar SDK is a JavaScript library with capabilities to interact with the Polar API.

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.

Read more about our OpenAPI Schema & documentation

Usage

The SDK is available from NPM.

npm install @polar-sh/sdk

Once installed, you may import the SDK like you usually would:

import { Configuration, PolarAPI } from '@polar-sh/sdk'

const api = new PolarAPI()

const authedApi = new PolarAPI(
  new Configuration({
    accessToken: '<MY_ACCESS_TOKEN>',
  }),
)

Access Tokens

You can acquire an access token through your Settings page. This can be used to authenticate yourself with the API for create/update/delete actions.

Examples

Issues looking for funding

You can easily retrieve issues looking for funding using the Funding-service.

import {
  Configuration,
  ListFundingSortBy,
  Platforms,
  PolarAPI,
} from '@polar-sh/sdk'

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,
})

Issue data from GitHub Issue

Retrieve Polar data about a given GitHub issue.

import { Configuration, PolarAPI } from '@polar-sh/sdk'

const api = new PolarAPI(new Configuration())

const params = {
  organization: 'polarsource',
  repo: 'polar',
  number: 900,
}

const issue = await api.issues.lookup({
  externalUrl: `https://github.com/${params.organization}/${params.repo}/issues/${params.number}`,
})

Add Polar badge to a GitHub issue

Adds a Polar badge to a given GitHub issue.

import { Configuration, PolarAPI } from '@polar-sh/sdk'

const api = new PolarAPI(
  new Configuration({
    accessToken: '<MY_ACCESS_TOKEN>',
  }),
)

await api.issues.addPolarBadge({
  id: '<ISSUE_ID>',
})

FAQs

Package last updated on 04 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc