this ia a typescript client for the intavia api.
you can find more info about the project on the intavia website.
configure the api base url:
import { configureApiBaseUrl } from "@intavia/api-client";
const baseUrl = process.env.NEXT_PUBLIC_INTAVIA_API_BASE_URL;
configureApiBaseUrl(baseUrl);
call endpoint:
import { searchEntities } from "@intavia/api-client";
const response = await searchEntities.request({ q: "stefan" });
use zod
validation schemas:
import type { Person } from "@intavia/api-client";
import { person as personSchema } from "@intavia/api-client";
const person: Person = {
id: "1",
kind: "person",
label: { default: "stefan" },
};
const result = personSchema.safeParse(person);
if (result.success === true) {
console.log("Definitely a person.\n", result.data);
} else {
console.error("You sure this is a person?\n", result.error);
}