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

    Class Feed

    An OPDS 2.0 catalog feed.

    Hierarchy

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

      Parameters

      Returns Feed

    • Creates a new Feed instance with a title.

      Parameters

      Returns Feed

    • Adds an extra top-level property (e.g. a custom sub-collection) to the feed.

      Parameters

      • key: string

        The key of the property.

      • value: any

        The value of the property.

      Returns Feed

      The Feed instance (for chaining).

    • Adds one or more facet groups to the feed.

      Parameters

      • ...facets: Facet[]

        The facet groups to add.

      Returns Feed

      The Feed instance (for chaining).

    • Adds one or more groups to the feed.

      Parameters

      • ...groups: Group[]

        The groups to add.

      Returns Feed

      The Feed instance (for chaining).

    • Adds one or more links.

      Parameters

      • ...links: Link[]

        The links to add.

      Returns Feed

      This instance (for chaining).

    • Adds multiple links.

      Parameters

      • links: Link[]

        The links to add.

      Returns Feed

      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 Feed

      This instance (for chaining).

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

      Parameters

      Returns Feed

      This instance (for chaining).

    • Adds a pagination link to the feed. Any existing link with the same relation is replaced.

      Parameters

      • rel: PaginationRel

        The relation (first, previous, next or last).

      • href: string

        The URL of the page.

      Returns Feed

      The Feed instance (for chaining).

    • Adds multiple pagination links to the feed. Existing links with the same relation are replaced.

      Parameters

      • links: Partial<Record<PaginationRel, string>>

        Object with relations as keys and URLs as values.

      Returns Feed

      The Feed instance (for chaining).

    • Adds one or more publications.

      Parameters

      • ...publications: Publication[]

        The publications to add.

      Returns Feed

      This instance (for chaining).

    • Adds multiple publications.

      Parameters

      Returns Feed

      This instance (for chaining).

    • Adds a search link to the feed.

      Parameters

      • href: string

        The URI template of the search, which must contain a query parameter (e.g. /search{?query}).

      • type: string = OPDS_FEED_TYPE

        The media type of the search results (default: application/opds+json).

      Returns Feed

      The Feed 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 Feed

      This instance (for chaining).

    • Gets the extra top-level properties of the feed.

      Returns Record<string, any>

      The extra properties.

    • Gets the facet groups of the feed.

      Returns Facet[]

      The array of facet groups.

    • Gets the groups of the feed.

      Returns Group[]

      The array of groups.

    • 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 a pagination link of the feed.

      Parameters

      • rel: PaginationRel

        The relation (first, previous, next or last).

      Returns Link | undefined

      The link, or undefined if not found.

    • Gets the publications.

      Returns Publication[]

      The array of publications.

    • Gets the search link of the feed.

      Returns Link | undefined

      The search link, or undefined if not found.

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

      This instance (for chaining).

    • Sets the identifier of the feed.

      Parameters

      • identifier: string

        The identifier (URI) of the feed.

      Returns Feed

      The Feed instance (for chaining).

    • Merges the given fields into the metadata.

      Parameters

      • metadata: Partial<FeedMetadata>

        The metadata fields to set.

      Returns Feed

      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 Feed

      This instance (for chaining).

    • Sets the last modification date.

      Parameters

      • modified: string

        The date in ISO 8601 format.

      Returns Feed

      This instance (for chaining).

    • Sets the total number of items in the collection.

      Parameters

      • numberOfItems: number

        The number of items.

      Returns Feed

      This instance (for chaining).

    • Sets the pagination metadata of the feed.

      Parameters

      • pagination: { currentPage?: number; itemsPerPage?: number; numberOfItems?: number }

        Total number of items, items per page and the current page.

      Returns Feed

      The Feed instance (for chaining).

    • Sets the subtitle.

      Parameters

      Returns Feed

      This instance (for chaining).

    • Converts the feed to an OPDS 2.0 JSON string.

      Parameters

      Returns string

      The feed as a JSON string.

    • Used by JSON.stringify to serialize the feed.

      Returns Record<string, any>

    • Converts the feed to a plain object following the OPDS 2.0 JSON structure. Blank values are removed.

      Parameters

      Returns Record<string, any>

      The feed as a plain object.

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

      Returns string[]

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

    • Creates a Feed instance from OPDS 2.0 JSON.

      Parameters

      • json: string | object

        The JSON string or an already parsed object.

      Returns Feed

      A new Feed instance.