Client configuration options
A configured Client instance
import { createClient, Entity, Collection } from '@hateoas-ts/resource';
// Define your entity types
type Post = Entity<{ id: string; title: string }, { self: Post; author: User }>;
type User = Entity<
{ id: string; name: string },
{ self: User; posts: Collection<Post> }
>;
// Create client and navigate resources
const client = createClient({ baseURL: 'https://api.example.com' });
const user = await client.go<User>('/users/123').get();
// Follow HATEOAS links - no URL hardcoding!
const posts = await user.follow('posts').get();
Creates a new HATEOAS client instance.
The client is the entry point for interacting with HAL-compliant REST APIs. It manages resource navigation, caching, and middleware execution.