@vakantio/sdk
v1.1.1
Published
TypeScript SDK for the Vakantio travel blog API.
Readme
@vakantio/sdk
TypeScript SDK for the Vakantio API. Vakantio is where travelers keep a running journal of a trip — posts, photos, itineraries on a map — and choose who sees it: the open web, or just a follower list of friends and family.
ESM-only. Node 22.6+. Works in any modern runtime with fetch.
Install
npm install @vakantio/sdkQuick start
import { createVakantio } from "@vakantio/sdk";
// Unauthenticated — public endpoints only
const vak = createVakantio();
const posts = await vak.posts.list();
// Authenticated — pass a session id
const me = createVakantio(process.env.VAKANTIO_SESSION_ID);
const profile = await me.users.me();
await me.posts.like("post-id");Get a session id by running @vakantio/cli and logging in
once: npx vakantio login. The session is stored at ~/.vakantio/config.json.
Resources
The client groups endpoints into resources. Each is reachable as a property on the client instance:
| Resource | What it covers |
| ------------------- | ---------------------------------------------------------------- |
| vak.posts | List, get, create, update, publish, like, bookmark, delete posts |
| vak.blogs | Get/update blogs, manage authors, follow/unfollow, view stats |
| vak.users | Current user profile, bookmarks, following, settings |
| vak.destinations | Countries, states, cities |
| vak.trips | Trip itineraries (waypoints, routes, accommodations) |
| vak.comments | Read and write post comments |
| vak.media | Upload images and videos |
| vak.notifications | List and acknowledge notifications |
| vak.search(query) | Full-text search across posts, blogs, destinations |
| vak.telegram | Telegram bot integration |
| vak.auth | Programmatic auth helpers (mostly for tests / CI) |
Options
const vak = createVakantio("session-id", {
baseUrl: "https://api.vakantio.de", // override the default
fetch: customFetch, // inject a fetch impl (tests, polyfills)
onError: (err) => log.error(err), // observe failed requests
client: { name: "my-app", version: "1.0.0" }, // identify in User-Agent
});Errors
All non-2xx responses throw VakantioError, which exposes:
import { VakantioError } from "@vakantio/sdk";
try {
await vak.posts.get("does-not-exist");
} catch (err) {
if (err instanceof VakantioError) {
err.status; // HTTP status (e.g. 404)
err.code; // server-supplied error code, if any
err.message; // human-readable message
}
throw err;
}Types
All entity, parameter, and option types are exported from the package root —
see dist/index.d.ts (or your editor's autocomplete) for the full surface.
Related
@vakantio/cli— command-line client built on this SDK- vakantio.de — the product itself
License
MIT
