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

    Class ResourceRelation<TEntity>

    Represents a deferred resource relationship for chained HATEOAS navigation.

    ResourceRelation enables lazy, chainable navigation through HATEOAS links without immediately fetching intermediate resources. This is useful for building navigation paths that can be executed as a single operation.

    // Navigate through multiple links
    const comments = await client.go<User>('/users/123')
    .follow('posts')
    .follow('items')
    .follow('comments')
    .get();

    // With template variables at each step
    const result = await resource
    .follow('search', { q: 'hello' })
    .follow('items')
    .get();

    Type Parameters

    • TEntity extends Entity

      The entity type of the target resource

    Index

    Methods

    post

    • post(
          options: PostRequestOptions,
          postOptions?: { dedup?: boolean },
      ): Promise<State>

      Sends a POST request to the target resource.

      Resolves all intermediate relationships and performs POST on the target. Supports request deduplication via postOptions.dedup.

      Parameters

      • options: PostRequestOptions

        Request options including data payload and headers

      • OptionalpostOptions: { dedup?: boolean }

        Additional options (e.g., dedup: true)

      Returns Promise<State>

      A Promise resolving to the response state

      Throws HttpError When any request in the chain fails