Handles media-related operations such as fetching media items, resolving media paths, and managing cache.

Constructors

Properties

baseUri: string = ...

Methods

  • Retrieves all media items, optionally bypassing the cache.

    Parameters

    • OptionalskipCache: boolean

      If true, bypasses the in-memory cache and fetches fresh data.

    Returns Promise<MediaExtended[]>

    A promise that resolves to an array of extended media items.

  • Retrieves a media item by its ID. Optionally skips the cache.

    Parameters

    • id: string

      The unique identifier of the media item to retrieve.

    • OptionalskipCache: boolean

      Whether to bypass the cache and fetch directly from the source.

    Returns Promise<MediaExtended>

    A promise that resolves to the retrieved media item.

  • Fetches a media file (binary) for specified media ID.

    Parameters

    • id: string

      Identifier of the media.

    • filename: string

      Name of the file to fetch from the media bin.

    • Optionaldata: MediaGetBinBody

      Optional additional parameters for the request.

    Returns Promise<Buffer>

    A promise that resolves to the binary data (Buffer) of the requested media file.

  • Resolves the full path of a media item by traversing its parent hierarchy.

    Parameters

    • media: Media

      The media item for which to resolve the path.

    • allMedia: Media[]

      An array of all media items, used to locate parent items.

    Returns string

    The resolved full path of the media item.

  • Constructs a URI for accessing a media binary with optional data.

    Parameters

    • id: string

      The identifier for the media resource.

    • filename: string

      The name of the file to be accessed.

    • Optionaldata: MediaGetBinBody

      Optional data to be included in the query string.

    Returns string

    The constructed URI.