Skip to content

follow() should support names and titles #458

@mattbishop

Description

@mattbishop

Currently it looks like follow(rel, options) only support templated URIs. It would be good to add a way to follow a link by title.

Also, for HAL links, these are useful fields in the spec that could be part of the follow() options:

  • name
  • type
  • profile
  • deprecation
  • hreflang

Here is my workaround, using deprecated methods:

  public async followListEntry(name: string) {
    // NOTE: links() is deprecated in Ketting
    const entryLinks = await this.resource.links("https://level3.rest/patterns/list#list-entry")
    // @ts-ignore
    const entry = entryLinks.find((l) => l.name === name)
    assert(entry !== undefined, `cannot find link named '${name}' in list: ${JSON.stringify(entryLinks)}`)
    this.resource = await this.client.go(entry)
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions