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

    Class Group

    A group in an OPDS 2.0 feed. A group contains either a navigation collection or a publications collection, never both.

    Hierarchy

    • BaseCollection
      • Group
    Index
    • Creates a new Group instance.

      Parameters

      Returns Group

    • Creates a new Group instance with a title.

      Parameters

      • title: LanguageMap

        The title of the group (e.g. Featured Books).

      Returns Group

    • Adds one or more links.

      Parameters

      • ...links: Link[]

        The links to add.

      Returns Group

      This instance (for chaining).

    • Adds multiple links.

      Parameters

      • links: Link[]

        The links to add.

      Returns Group

      This instance (for chaining).

    • Adds a link to the navigation collection. This is a convenience method for links to other OPDS 2.0 feeds.

      Parameters

      • href: string

        The URL of the linked feed.

      • title: string

        The title of the link.

      • Optionalrel: string

        The relation of the link (optional).

      • type: string = OPDS_FEED_TYPE

        The media type (default: application/opds+json).

      Returns Group

      This instance (for chaining).

    • Adds one or more links to the navigation collection. Each link must have a title.

      Parameters

      Returns Group

      This instance (for chaining).

    • Adds one or more publications.

      Parameters

      • ...publications: Publication[]

        The publications to add.

      Returns Group

      This instance (for chaining).

    • Adds multiple publications.

      Parameters

      Returns Group

      This instance (for chaining).

    • Adds a self link. Any existing self link is replaced.

      Parameters

      • href: string

        The URL of the collection.

      • type: string = OPDS_FEED_TYPE

        The media type (default: application/opds+json).

      Returns Group

      This instance (for chaining).

    • Gets the current links.

      Returns Link[]

      The array of links.

    • Gets the metadata.

      Returns FeedMetadata

      The metadata object.

    • Gets the navigation links.

      Returns NavigationLink[]

      The array of navigation links.

    • Gets the publications.

      Returns Publication[]

      The array of publications.

    • Gets the self link.

      Returns Link | undefined

      The self link, or undefined if not found.

    • Sets the description.

      Parameters

      • description: string

        The description text.

      Returns Group

      This instance (for chaining).

    • Merges the given fields into the metadata.

      Parameters

      • metadata: Partial<FeedMetadata>

        The metadata fields to set.

      Returns Group

      This instance (for chaining).

    • Sets a specific metadata field.

      Type Parameters

      Parameters

      • key: K

        The key of the metadata field.

      • value: FeedMetadata[K]

        The value to set.

      Returns Group

      This instance (for chaining).

    • Sets the last modification date.

      Parameters

      • modified: string

        The date in ISO 8601 format.

      Returns Group

      This instance (for chaining).

    • Sets the total number of items in the collection.

      Parameters

      • numberOfItems: number

        The number of items.

      Returns Group

      This instance (for chaining).

    • Sets the subtitle.

      Parameters

      Returns Group

      This instance (for chaining).

    • Used by JSON.stringify to serialize the group.

      Returns Record<string, any>

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

      Parameters

      Returns Record<string, any>

      The group as a plain object.

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

      Returns string[]

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

    • Creates a Group instance from OPDS 2.0 JSON.

      Parameters

      • json: string | object

        The JSON string or an already parsed object.

      Returns Group

      A new Group instance.