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

    Class Publication

    An OPDS 2.0 publication.

    Index
    • Adds a contributor with the given role. Multiple contributors with the same role are collected in a list.

      Parameters

      • role: ContributorRole

        The role of the contributor (e.g. author, translator, publisher).

      • contributor: string | ContributorObject

        The name of the contributor, or a contributor object.

      Returns Publication

      The Publication instance (for chaining).

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

      Parameters

      • key: string

        The key of the property.

      • value: any

        The value of the property.

      Returns Publication

      The Publication instance (for chaining).

    • Adds an image to the images collection of the publication.

      Parameters

      • href: string

        The URL of the image.

      • type: string = 'image/jpeg'

        The media type of the image (default: image/jpeg).

      • Optionalsize: { height?: number; width?: number }

        The dimensions of the image in pixels (optional).

      Returns Publication

      The Publication instance (for chaining).

    • Adds one or more links to the publication.

      Parameters

      • ...links: Link[]

        The links to add.

      Returns Publication

      The Publication instance (for chaining).

    • Adds multiple links to the publication.

      Parameters

      • links: Link[]

        The links to add.

      Returns Publication

      The Publication instance (for chaining).

    • Adds a self link to the publication, pointing to its OPDS publication document.

      Parameters

      • href: string

        The URL of the publication document.

      Returns Publication

      The Publication instance (for chaining).

    • Gets all acquisition links of the publication.

      Returns Link[]

      The array of acquisition links.

    • Gets the identifier of the publication.

      Returns string | undefined

      The identifier of the publication.

    • Gets the images of the publication.

      Returns Link[]

      The array of image links.

    • Gets the current links of the publication.

      Returns Link[]

      The array of links.

    • Gets the self link of the publication.

      Returns Link | undefined

      The self link, or undefined if not found.

    • Sets the description of the publication.

      Parameters

      • description: string

        The description text.

      Returns Publication

      The Publication instance (for chaining).

    • Sets the language(s) of the publication.

      Parameters

      • language: string | string[]

        BCP 47 language tag(s) (e.g. en).

      Returns Publication

      The Publication instance (for chaining).

    • Sets the last modification date of the publication.

      Parameters

      • modified: string

        The date in ISO 8601 format.

      Returns Publication

      The Publication instance (for chaining).

    • Sets the number of pages of the publication.

      Parameters

      • numberOfPages: number

        The number of pages.

      Returns Publication

      The Publication instance (for chaining).

    • Sets the publication date of the publication.

      Parameters

      • published: string

        The date in ISO 8601 format.

      Returns Publication

      The Publication instance (for chaining).

    • Sets the series the publication belongs to.

      Parameters

      • name: LanguageMap

        The name of the series.

      • Optionalposition: number

        The position of the publication in the series (optional).

      • Optionallinks: Link[]

        Links related to the series, e.g. to a feed of the series (optional).

      Returns Publication

      The Publication instance (for chaining).

    • Sets the schema.org type of the publication.

      Parameters

      • type: string

        The type URI (e.g. http://schema.org/Book).

      Returns Publication

      The Publication instance (for chaining).

    • Converts the publication to an OPDS 2.0 JSON string.

      Parameters

      Returns string

      The publication as a JSON string.

    • Used by JSON.stringify to serialize the publication.

      Returns Record<string, any>

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

      Parameters

      Returns Record<string, any>

      The publication as a plain object.

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

      Returns string[]

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

    • Creates a Publication instance from OPDS 2.0 JSON.

      Parameters

      • json: string | object

        The JSON string or an already parsed object.

      Returns Publication

      A new Publication instance.