@sdkfixturelab260904/parcel-events-sdk
v1.4.0
Published
TypeScript SDK generated by the Doctorine SDK Foundry (sdkSha 009cf90da150).
Readme
@sdkfixturelab260904/parcel-events-sdk
Type-safe TypeScript SDK — generated by the Doctorine SDK Foundry. Zero runtime dependencies (the HTTP kernel is vendored under src/core/).
Install
npm install @sdkfixturelab260904/parcel-events-sdkQuickstart
import ParcelEventsSdk from "@sdkfixturelab260904/parcel-events-sdk";
const client = new ParcelEventsSdk({ apiKey: "my-api-key" });
const result = await client.labels.create({
format: "pdf",
shipment_id: "shp_00000000000000000001"
}, {
idempotencyKey: "123e4567-e89b-12d3-a456-426614174000"
});
console.log(result);Every method is listed with its arguments, return type and HTTP anchor in API_REFERENCE.md; each method's JSDoc carries a runnable @example.
Authentication
apiKey— API key sent as headerParcel-API-Key— falls back to thePARCEL_EVENTS_API_KEYenvironment variable.bearerToken— Bearer token — falls back to thePARCEL_EVENTS_BEARER_TOKENenvironment variable.
const client = new ParcelEventsSdk({ apiKey: "my-api-key" });Pagination
List methods return page objects that are AsyncIterable — for await walks every page transparently:
const page = await client.pickups.list();
for await (const item of page) {
console.log(item);
}
// or page-by-page: page.items(), page.hasNextPage(), await page.getNextPage()Webhooks
This API delivers 1 typed webhook event to your endpoint. The spec does not declare a signature scheme Doctorine can verify against, so no verifier is emitted — authenticate deliveries per the API's own docs, then parse:
import type { WebhookEventMap } from "@sdkfixturelab260904/parcel-events-sdk";
const payload = JSON.parse(rawBody) as WebhookEventMap["shipmentStatusChanged"];Errors
Non-2xx responses throw typed errors (APIError subclasses, body + x-request-id attached):
import { APIError, AuthenticationError } from "@sdkfixturelab260904/parcel-events-sdk";
try {
// … any client call
} catch (error) {
if (error instanceof AuthenticationError) console.error(error.status, error.requestId);
else if (error instanceof APIError) console.error(error.status, error.body);
else throw error;
}Retries & timeouts
Retries are on by default (max 3, exponential backoff from 250 ms, honoring Retry-After). Configure per client:
const client = new ParcelEventsSdk({ retries: { maxRetries: 5 }, timeoutMs: 30_000 });Responses, request options & undocumented endpoints
Every method returns an APIPromise: await it for the parsed body, .withResponse() for the body with its status and headers, .asResponse() for the raw Response. client.get/post/put/patch/delete reach endpoints the spec does not describe; withOptions derives a client for one call site; defaultQuery, fetchOptions and a redacting logger are constructor options.
import ParcelEventsSdk from "@sdkfixturelab260904/parcel-events-sdk";
const client = new ParcelEventsSdk({});
const { data, status, headers } = await client.get<{ id: string }>("/v1/things/th_1").withResponse();
console.log(status, headers["x-request-id"], data.id);
const raw = await client.get("/v1/things/th_1").asResponse();
console.log(raw.status);
const patient = client.withOptions({ timeoutMs: 120_000, retries: { maxRetries: 5 }, defaultHeaders: { "x-trace": "t1" } });
await patient.post("/v1/things", { body: { name: "x" } });
const verbose = new ParcelEventsSdk({ defaultQuery: { version: "2026-09-03" }, logLevel: "debug" });
await verbose.get("/v1/things");Provenance
Reproducible build — see .doctorine-sdk.json. sdkSha 009cf90da150224552e348f26955546b72d6053ca723e92a8e84507dd4196bee · configSha 3b30b7bffa895fb980dad02715f00f4e9bfa44b0a1609697a9abc1366c009a3d · bundleSha ee4e0c67f413a3bbf6c37174648831489b9449db1af378e2b81e66e833d86f55.
Internal notes (dev2)
We tune retries for parcel bursts.
