SDK
@pealboard/sdk is a dependency-free TypeScript client over /v1, generated
from the same OpenAPI document this reference is. It is not published to npm
or to any other registry — publishing is not available in this environment —
so it is installed from its source at
github.com/mersoft-corp/rohan-sdk,
pinned to a tag.
That repository is private today. If you do not have access to it, ask support@pealboard.com.
Install it
Section titled “Install it”pnpm add "@pealboard/sdk@github:mersoft-corp/rohan-sdk#v0.1.0"dist/ is committed in the repository, so this needs no build step on your
side. Pealboard’s own applications do not depend on this package through
node_modules at all: each vendors a copy of src/ into its own
packages/sdk-vendored/, checked against the source commit by its own sync
script, because a published package is not available to point at internally
either.
Quick start
Section titled “Quick start”import { Pealboard } from "@pealboard/sdk";
const client = new Pealboard({ apiKey: process.env.PEALBOARD_API_KEY! });
const { data: issues } = await client.issues.list({ state: "open" });
const issue = await client.issues.create( { repositoryId: "a1b2c3d4-...", title: "Board columns misalign at 360px" }, { idempotencyKey: crypto.randomUUID() },);new Pealboard({ apiKey, workspaceId?, baseUrl?, fetch?, timeoutMs? }) takes:
| Option | Default | What it does |
|---|---|---|
apiKey |
required | Sent as Authorization: Bearer <apiKey>. |
workspaceId |
none | Sent as X-Workspace-Id. Required once a key can reach more than one workspace; call client.setWorkspaceId(id) to change it later. |
baseUrl |
https://api.pealboard.com |
Override for a proxy or a staging deployment. |
fetch |
the ambient global fetch |
Provide one explicitly in a runtime with none, or to stub it in a test. |
timeoutMs |
30000 |
A request past this throws PealboardError coded timeout. |
A 429 is retried once automatically, honoring Retry-After up to 60
seconds; a second 429 is thrown to the caller. Every other non-2xx response
throws a PealboardError carrying code, status, requestId, remedy and
detail from the API’s own envelope — see Errors.
A paged list method returns { data, nextCursor }. Where paging matters —
issues, issue comments, project items, portal customers and requests, views
(over run()), notifications — the resource also has an iterate() that
pages through all of it as an async generator:
for await (const issue of client.issues.iterate({ label: ["bug"] })) { console.log(issue.number, issue.title);}Methods, by resource
Section titled “Methods, by resource”Every method name below is a method on client.<resource>; a nested one,
like comments, is a method on client.issues.comments.
| Resource | Methods |
|---|---|
account |
me(), workspaces() |
issues |
list(), get(), create(), update(), bulk(), activity(), iterate() |
issues.comments |
list(), create(), update(), delete(), iterate() |
projects |
list(), get() |
projects.items |
list(), add(), update(), remove(), move(), iterate() — one project’s cards and their field values |
labels |
list(), create() |
milestones |
list(), create() |
views |
list(), get(), create(), update(), delete(), run(), board(), iterate() |
portals |
list(), get(), create(), update(), delete() |
portals.requestTypes, portals.companies |
list(), create(), update(), delete() — scoped to a portal id |
portals.customers |
list(), create(), update(), delete(), iterate() |
portals.requests |
list(), get(), create(), update(), remove(), release(), reject(), iterate() |
notifications |
list(), markRead(), iterate() |
apiKeys |
list(), create(), revoke() |
billing |
get(), checkout(), portal(), trial() |
github |
installUrl(), installation(), bindInstallation(), installationsAvailable(), repositories(), setRepositorySync(), sync(), syncStatus() |
create() on every resource that makes something takes a second argument,
{ idempotencyKey? }: omit it and the client generates one with
crypto.randomUUID(), so every create is idempotent by default. See
Idempotency.
Every input and output type is exported from @pealboard/sdk — Issue,
Page<T>, ErrorBody, and a per-method type such as CreateIssueInput — and
is generated from the OpenAPI document, so a field here and a field in the
API reference are the same field.
Not wrapped yet
Section titled “Not wrapped yet”The client covers what a workspace credential calls under /v1, plus
/account. It does not yet wrap members, invitations, attachments, the
Slack integration, or the audit log — all present in the OpenAPI document,
none yet given a resource file — nor GET /v1/me (the workspace-scoped
identity call, distinct from account.me(), which wraps GET /account/me).
Call these directly against /v1 with the same API key until they are
added. It also does not wrap /portal/*: a portal session authenticates
separately and is never a workspace credential.