Package-level declarations

The content types the catalogue is made of, and the wrappers they arrive in. Each entity comes in a full form (Article) and a light one (ArticleShort) — lists give you the light form, get gives you the full one.

Types

Link copied to clipboard
data class Article(val id: ArticleId, val releaseDate: Date, val lastUpdate: Date, val primeImage: ArticleImage?, val title: String, val surTitle: String?, val subTitle: String?, val author: String?, val theme: String?, val subTheme: String?, val elements: List<ArticleElement>, val preview: String?, val wordCount: Long, val abstractLayout: String?, val templateId: TemplateId, val issueId: IssueId?, val articleNumber: Int?, val pages: List<Int>?, val themeTags: List<String>, val publicationId: PublicationId?, val formattedUrl: String?, val language: String?, val mediaTrackId: MediaTrackId?, val isAdvertisement: Boolean, val articlePath: String?, val isDigitalArticle: Boolean, val readingTime: Int) : Serializable

Represents an article with full detail.

Link copied to clipboard
sealed interface ArticleElement : Serializable

Represents a single element within an article's body. Elements are ordered and typed — the type property determines which concrete subtype to expect. Elements are either text-based subtypes each carrying a value string, or image-based (ArticleImage).

Link copied to clipboard
value class ArticleId(val value: String) : Serializable

An identifier for article data

Link copied to clipboard
data class ArticleImage(val type: String, val url: String, val caption: String?, val width: Int, val height: Int) : ArticleElement

An image in an article's body, or the article's own lead image.

Link copied to clipboard
data class ArticleShort(val id: ArticleId, val releaseDate: Date, val primeImage: ArticleImage?, val title: String, val theme: String?, val preview: String, val issueId: IssueId?, val issue: IssueReference?, val publicationId: PublicationId?, val publication: PublicationReference?, val formattedUrl: String?, val mediaTrackId: MediaTrackId?, val readingTime: Int) : Serializable

Represents a lightweight form of an article item. This is minimal content returned by paginated endpoints can be used to display lists of articles. For more detail, download the full Article.

Link copied to clipboard
sealed interface CgsResult<out T>

The outcome of a one-shot call that can fail: either Success with a value, or Failure with a CgsError saying why.

Link copied to clipboard
sealed interface CgsStreamState<out T>

The state of an observed value: what the SDK currently holds, and what it is doing about it.

Link copied to clipboard

What kind of thing a Publication is. Editorial rather than technical — it says how a publication should be presented and grouped, not how its content is read (that is ContentType).

Link copied to clipboard

What a Publication publishes, which decides how its content is read.

Link copied to clipboard
data class DateRange(val from: Date, val to: Date) : Serializable

A date window used to narrow a content search down to what was released inside it — see co.cafeyn.cgs.api.content.Issues.all.

Link copied to clipboard
data class Edition(val id: PublicationId, val name: String) : Serializable

One edition of a MultiEdition group.

Link copied to clipboard
sealed class Enrichment : Serializable

Represents an issue enrichment.

Link copied to clipboard
value class ExternalId(val value: String) : Serializable

An identifier for video external id

Link copied to clipboard
data class Issue(val id: IssueId, val title: String, val publicationId: PublicationId, val releaseDate: Date, val paperReleaseDate: Date, val issueNumber: Int?, val hasArticles: Boolean, val adPageNumber: Int?, val cover: String?, val pageCount: Int?, val ratio: Double?, val pdfEncryptionVersion: Int, val version: Int) : Serializable

Represents an issue with full detail.

Link copied to clipboard
value class IssueId(val value: String) : Serializable

An identifier for issue data

Link copied to clipboard
data class IssueReference(val id: IssueId, val title: String, val publicationId: PublicationId, val cover: String?) : Serializable

Represents a lightweight form of an issue item. This is side-loaded content belonging attached to paginated data like ArticleShort.

Link copied to clipboard
data class IssueShort(val id: IssueId, val title: String, val publicationId: PublicationId, val publication: PublicationReference?, val releaseDate: Date, val paperReleaseDate: Date, val issueNumber: Int?, val cover: String?) : Serializable

Represents a lightweight form of an issue item. This is minimal content returned by paginated endpoints can be used to display lists of issues. For more detail, download the full Issue.

Link copied to clipboard
value class LanguageId(val value: String) : Serializable

An identifier for language data

Link copied to clipboard
sealed interface LoadState

Where one of a list's two loads stands.

Link copied to clipboard
data class Media(val id: MediaId, val name: String, val description: String?, val creationDate: Date, val color: Int?, val logoUrl: String?, val certifications: List<String>, val publications: List<PublicationReference>) : Serializable

Represents a media with full detail.

Link copied to clipboard
value class MediaId(val value: String) : Serializable

An identifier for media data

Link copied to clipboard
data class MediaShort(val id: MediaId, val name: String, val creationDate: Date, val logoUrl: String?) : Serializable

Represents a lightweight form of a media item. This is minimal content returned by paginated endpoints can be used to display lists of media. For more detail, download the full Media.

Link copied to clipboard
value class MediaTrackId(val value: String) : Serializable

An identifier for media track data

Link copied to clipboard
data class MultiEdition(val principalPublication: Edition, val subEditions: List<Edition>) : Serializable

The editions of a multi-edition publication group (a regional daily, typically).

Link copied to clipboard
data class Page<T>(val items: List<T>, val nextPageToken: String?) : Serializable

Represents a paginated result of a listing.

Link copied to clipboard
data class PaginatedLoadStates(val refresh: LoadState, val append: LoadState)

The two loads a paginated list runs, tracked apart because they mean different things on screen: a first load owns the whole screen, a next-page load owns a footer.

Link copied to clipboard
interface PaginatedResource<out T>

A list that arrives one page at a time.

Link copied to clipboard
data class PaginatedState<out T>(val items: List<T>, val loadStates: PaginatedLoadStates)

Everything a paginated list needs to draw itself: the items loaded so far, and what the loading is doing.

Link copied to clipboard
data class Publication(val id: PublicationId, val title: String, val releaseFrequencyId: ReleaseFrequencyId, val mediaId: MediaId?, val topicIds: List<TopicId>, val type: ContentType, val source: ContentSource, val lastIssue: IssueShort? = null, val langIds: List<LanguageId>, val availableYears: List<Int> = emptyList(), val multiEdition: MultiEdition? = null) : Serializable

Represents a publication with full detail.

Link copied to clipboard
value class PublicationId(val value: String) : Serializable

An identifier for publication data

Link copied to clipboard
data class PublicationReference(val id: PublicationId, val title: String, val releaseFrequencyId: ReleaseFrequencyId, val mediaId: MediaId? = null, val topicIds: List<TopicId>, val type: ContentType, val source: ContentSource) : Serializable

Represents a lightweight form of a publication item. This is side-loaded content belonging attached to paginated data like IssueShort.

Link copied to clipboard
data class PublicationShort(val id: PublicationId, val title: String, val releaseFrequencyId: ReleaseFrequencyId, val mediaId: MediaId? = null, val topicIds: List<TopicId>, val type: ContentType, val source: ContentSource, val lastIssue: IssueShort? = null) : Serializable

Represents a lightweight form of a publication item. This is minimal content returned by paginated endpoints can be used to display lists of publications. For more detail, download the full Publication.

Link copied to clipboard

An identifier for release frequency data

Link copied to clipboard
value class TemplateId(val value: Int) : Serializable

An identifier for template data

Link copied to clipboard
value class TopicId(val value: String) : Serializable

An identifier for topic data

Link copied to clipboard
data class Video(val id: VideoId, val createdAt: Date, val createdBy: String, val modifiedAt: Date?, val modifiedBy: String?, val publicationId: PublicationId, val releaseDate: Date, val title: String, val externalId: ExternalId, val summary: String?, val format: Video.VideoFormat, val creators: List<String>, val language: String, val tags: List<String>, val width: Int, val height: Int, val duration: Int, val isOnline: Boolean, val coverUrl: String, val sponsored: Boolean, val ingestionPipelineVersion: Int) : Serializable

Represents a video with full detail.

Link copied to clipboard
value class VideoId(val value: String) : Serializable

An identifier for video data

Link copied to clipboard
data class VideoShort(val id: VideoId, val title: String, val publicationId: PublicationId, val publication: PublicationReference?, val releaseDate: Date, val coverUrl: String?) : Serializable

Represents a lightweight form of a video item. This is minimal content returned by paginated endpoints can be used to display lists of videos. For more detail, download the full Video.

Properties

Link copied to clipboard

There is another page to fetch. Drive PaginatedResource.loadNextPage off this as the user nears the end of the list; it is false while a page is already in flight, so it will not ask twice.

Link copied to clipboard

The error to show over the whole screen: set only when the list failed with nothing to display. A failure that still has items behind it stays null here — surface that one in place, without taking the list away.

Link copied to clipboard

The list came back with nothing — show an empty state, not an error. false while the first page is still loading and while it is in error, so it never flashes before the real answer.

Link copied to clipboard

The list has nothing yet and is fetching its first page — show a skeleton or a spinner over the whole screen.