ifta-sdk
v0.1.0
Published
Typed, ESM-first client for the Truker IFTA REST API.
Readme
IFTA SDK
Typed, ESM-first JavaScript/TypeScript client for the Truker IFTA REST API, generated from the public OpenAPI spec.
Installation
npm install ifta-sdkQuick start
import { createIftaClient } from "ifta-sdk";
const client = createIftaClient({
token: process.env.IFTA_API_TOKEN,
// baseUrl defaults to https://truker.app
});
const periods = await client.listPeriods();
const period = await client.getPeriod("1Q2024");
const rates = await client.listRates({ quarter: "1Q2024", country: "US", changed: true });API
createIftaClient(options?)
Creates an IftaClient instance.
Options:
baseUrl– override API base (default:https://truker.app).token– bearer token with theifta.readability.fetch– custom fetch implementation (falls back toglobalThis.fetch).
Client methods
listPeriods(init?)→PaginatedPeriodsgetPeriod(quarter, init?)→PeriodDetaillistRates(params?, init?)→PaginatedRates
Each method accepts an optional RequestInit to pass headers, signal, etc.
Types
All response shapes are exported: PeriodSummary, PeriodDetail, RateResource, Footnote, FuelType, Jurisdiction, PaginatedPeriods, PaginatedRates, RatesQuery, and supporting pagination types.
Errors
Non-2xx responses throw HttpError with status, statusText, and parsed body (JSON when available).
Development
- Build:
npm run build - OpenAPI source:
openapi.json(downloaded from https://ifta-api.truker.app/openapi.json)
Author: Vadim Goncharov
