opds-ts - v3.0.0
    Preparing search index...

    Class Facet

    A facet group in an OPDS 2.0 feed, used to filter or reorder the publications of a feed.

    Index
    • Adds a facet to the group. This is a convenience method for facets linking to OPDS 2.0 feeds.

      Parameters

      • href: string

        The URL of the facet.

      • title: string

        The title of the facet (e.g. English).

      • options: { active?: boolean; numberOfItems?: number; type?: string } = {}

        numberOfItems hints at the number of publications for this facet, active marks the facet as currently selected.

      Returns Facet

      The Facet instance (for chaining).

    • Adds one or more links to the facet group.

      Parameters

      • ...links: Link[]

        The links to add.

      Returns Facet

      The Facet instance (for chaining).

    • Gets the links of the facet group.

      Returns Link[]

      The array of links.

    • Used by JSON.stringify to serialize the facet group.

      Returns Record<string, any>

    • Converts the facet group to a plain object following the OPDS 2.0 JSON structure.

      Parameters

      Returns Record<string, any>

      The facet group as a plain object.

    • Checks the facet group against the requirements of the OPDS 2.0 specification.

      Returns string[]

      A list of problems. An empty list means the facet group is valid.

    • Creates a Facet instance from OPDS 2.0 JSON.

      Parameters

      • json: string | object

        The JSON string or an already parsed object.

      Returns Facet

      A new Facet instance.