View on GitHub

Library API Documentation

Documentation for Library API Packages

Library Core / src / Publication

Class: Publication

src.Publication

Provides methods for interacting with a downloaded publication.

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Publication(__namedParameters)

Parameters

Name Type
__namedParameters PublicationCtor

Defined in

src/classes/Publication.ts:21

Properties

contentsPath

contentsPath: string

Defined in

src/classes/Publication.ts:19


filename

filename: string

Defined in

src/classes/Publication.ts:17


languageId

languageId: number

Defined in

src/classes/Publication.ts:21


path

path: string

Defined in

src/classes/Publication.ts:18


type

type: PublicationType

Defined in

src/classes/Publication.ts:20

Methods

getArticles

getArticles(): Promise<ArticleRow[]>

deprecated This is not tested and may no longer work.

Returns raw database rows for all the articles in this publication.

Returns

Promise<ArticleRow[]>

Defined in

src/classes/Publication.ts:144


getImages

getImages(date): Promise<ImageDTO[]>

Retrieves all the images for a particular date stored within the publication itself. As a publication includes multiple articles this chooses the one for that day and only returns the relevant images.

If you also want images from related articles use getRelatedPublications.

todo Validate date.

Parameters

Name Type Description
date string The date to search for, must be formatted as yyyy-mm-dd.

Returns

Promise<ImageDTO[]>

An array of mapped images, the array will be empty if no images were found.

Defined in

src/classes/Publication.ts:106


getMediaByDocumentId

getMediaByDocumentId(__namedParameters): Promise<Object>

todo Also support begin and end paragraphs.

Retrieves all the media for specified document (article) within a publication.

Parameters

Name Type
__namedParameters Object
__namedParameters.beginParagraph? null | number
__namedParameters.endParagraph? null | number
__namedParameters.id number

Returns

Promise<Object>

An array of mapped related publications, the array will be empty if none are found.

Defined in

src/classes/Publication.ts:78


getRelatedPublications

getRelatedPublications(date): Promise<RelatedPublicationDTO[]>

Retrieves all the related publications.

Parameters

Name Type Description
date string The date to search for, must be formatted as yyyy-mm-dd.

Returns

Promise<RelatedPublicationDTO[]>

An array of mapped related publications, the array will be empty if none are found.

Defined in

src/classes/Publication.ts:58


getVideos

getVideos(date): Promise<VideoDTO[]>

Retrieves all the videos for a particular date from the publication. As a publication includes multiple articles this chooses the one for that day and only returns the relevant videos.

todo Validate date.

Parameters

Name Type Description
date string The date to search for, must be formatted as yyyy-mm-dd.

Returns

Promise<VideoDTO[]>

An array of mapped videos, the array will be empty if no videos were found.

Defined in

src/classes/Publication.ts:127