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 aStateFlowof CgsStreamStateall(…, scope)returns a PaginatedResource you observe through itsstateand advance withloadNextPage()
val issues = CGS.content().issues.all(pageSize = 20, scope = viewModelScope)
viewModelScope.launch { issues.state.collect { state -> render(state.items) } }
// From the list's scroll listener, as the user nears the end:
fun onNearEnd() = viewModelScope.launch { issues.loadNextPage() }Session awareness
Every accessor here follows the session. When the signed-in account or the active profile changes, whatever was loaded is dropped and requested again against the new session — you never have to re-request after switching profiles. A reload that fails after such a switch carries at most what was cached for the new session, never the previous profile's content. While no one is signed in, every flow here reports CgsError.Auth.Missing, and picks up again on its own after the next sign-in.
Lifecycle
All of it is bound to the CoroutineScope you pass in: requests stop five seconds after 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.