Packbase TypeScript SDK
Start to use the official Packbase API client.
The @packbase/sdk-ts package is the official TypeScript library for the Packbase API. It supplies methods such as pb.profiles() and pb.howls.create(). You do not have to make each HTTP request manually.
The SDK works in Node.js 18 or later and in modern browsers. It includes TypeScript types. Your editor can show available methods and find type errors before you run the code.
The Packbase API is in development. Some methods or response fields can change. Read this documentation when you update the package.
A small example
import { PackbaseSDK } from '@packbase/sdk-ts'
// Use `pb` for each Packbase request.
const pb = new PackbaseSDK({ apiKey: 'your-api-key' })
// `await` pauses here until Packbase returns the profile.
const profile = await pb.profiles('rek')
console.log(profile.display_name)
// Create a post (Packbase calls posts "howls") inside a pack.
const howl = await pb.howls.create({
tenant_id: 'your-pack-id',
body: 'Hello from the SDK!',
tags: ['rating_safe'],
})
console.log(howl.id)The values 'your-api-key' and 'your-pack-id' are placeholders. Replace them with values from your Packbase account or application.
Lifecycle events
on() is chainable. Use off() to remove a listener when a component or process does not need it:
const = (: Profile) => .(.)
.('ready', )
.('ready', )Where to go next
If you have not used a JavaScript or TypeScript library, start with Installation. Then, complete the Quickstart. Use the reference pages when you know which method you must call.
Installation
Install the package and check that your project can import it.
Quickstart
Create a client and make your first few API calls.
Authentication
Choose between an API key and a browser login session.
Error Handling
Catch failed requests without crashing your app.
Connected Accounts
Discover providers and connect external accounts with OAuth or custom methods.