Skip to content

ghostrider-05/patreon-api.ts

Repository files navigation

Patreon-api.ts

npm npm GitHub issues GitHub stars

Typescript Oauth library for the V2 Patreon API with:

  • Support for Creator access tokens and Oauth tokens.
  • Client with methods for calling every endpoint, both resource and webhook endpoints
  • Methods to create a webhook server
  • Typescript types that strongly reflect your query for raw or normalized responses.
const query = buildQuery.campaign([])({ campaign: ['title']})
const payload = await client.fetchCampaign(query)
    // ^? { data: { attributes: { title: string } }, ... }
const campaign = await client.normalized.fetchCampaign(query)
    // ^? { title: string, id: string, type: Type.Campaign }

Installation

npm install patreon-api.ts
pnpm add patreon-api.ts
yarn add patreon-api.ts

Usage

Supported Patreon api: v2

[!CAUTION] This package does not include v1 of the Patreon API and starts with API v2

The default API version for this package is 2 and might change in major versions. When the default API version is changed, old versions will still receive updates. You can not import this module by API version since it is unlikely that Patreon will release a new version any time soon.

To read more about how to use this library, go to the documentation. Still doubting if this library has everything you need related to the Patreon API? Compare all libraries yourself.

Compatibility

To check for compatibility with this package, look if your platform:

  • has the globals: AbortController, setTimeout, clearTimeout, fetch, URL and URLSearchParams
  • supports ES2020
  • supports createHmac of the node:crypto module

[!WARNING] This is a server-side API & Oauth package and requires your application tokens. Make sure you do not share or expose your tokens or run this code client-side.

Examples

Changelog

Detailed changes are listed for each release in the changelog.

For upcoming releases, see the roadmap for planned changes.

Contributing

See the code of conduct and the contributing guide for how to contribute. You can also support the development by writing guides, posts and templates or by funding the maintainers.

License

MIT

Copyright (c) 2023-present, ghostrider-05