Content

interface Content

Everything the catalogue holds — articles, issues, videos, media and publications — as seen by the profile currently active on the session.

Obtained from CGS.content. Each domain is its own small service with the same two shapes:

  • get(id, scope) observes one item as a StateFlow of CgsStreamState

  • all(…, scope) returns a PaginatedResource you observe through its state and advance with loadNextPage()

val issues = CGS.content().issues.all(pageSize = 20, scope = viewModelScope)
issues.state.collect { state ->
render(state.items)
if (state.canLoadMore) issues.loadNextPage()
}

Session awareness

Every accessor here follows the session. When the active profile or the language changes, whatever was loaded is dropped and requested again against the new session — you never have to re-request after switching profiles. A refresh that fails is reported as a failure with no stale data attached, so a screen never shows one profile's content under another's.

Lifecycle

All of it is bound to the CoroutineScope you pass in: requests stop once nothing collects anymore, and resume on the next collection. Pass the scope of whatever is displaying the data — a viewModelScope, typically — and there is nothing to release by hand.

Properties

Link copied to clipboard
abstract val articles: Articles

Articles, whether they belong to an issue or stand on their own.

Link copied to clipboard
abstract val issues: Issues

Issues: one dated release of a publication, downloadable and readable page by page.

Link copied to clipboard
abstract val medias: Medias

Media: the publisher a set of publications belongs to.

Link copied to clipboard

Publications: a magazine, a newspaper, a video channel — whatever issues are published under.

Link copied to clipboard
abstract val videos: Videos

Videos, and the publications they are distributed under.