@hateoas-ts/resource - v1.4.3
    Preparing search index...

    Function createClient

    • 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.

      Parameters

      • options: Config

        Client configuration options

      Returns Client

      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();