core

The catalogue, the session and the downloads — everything the SDK does that isn't drawing.

Take this module alone to build your own interface on top of the catalogue. Everything starts at CGS, which hands out the five services once CGS.init has run:

AuthenticationCGS.authOpening a session from your own backend token, and picking the active profile.
ContentCGS.contentPublications, issues, articles, videos, media.
DownloadsCGS.downloadFetching an issue for offline reading, and following its progress.
Reading progressCGS.readingsHow far into each issue the reader got.
Reading listCGS.readingListIssues saved for later.

How results are shaped

Three shapes cover the whole module, and which one you get says how the call behaves:

  • CgsResult — a one-shot call that either succeeded or failed with a CgsError. Nothing is thrown.

  • StateFlow<CgsStreamState<T>> — a single item, observed. It can hold data and be refreshing, or hold data and report a failure, so a transient network problem never has to blank the screen.

  • PaginatedResource — a list. Observe its state, call loadNextPage() as the user scrolls, refresh() to force a round trip.

Everything observable is scoped to the active profile: change the profile or the language and the flows restart against the new session on their own, dropping what they held. They are also bound to a CoroutineScope you pass in, so nothing keeps running once your screen is gone.

Packages

Link copied to clipboard

The SDK's front door. CGS is the singleton every other service is reached through, SdkConfig configures it, and the service interfaces it hands out — Content, Download, Readings, ReadingList — live here too.

Link copied to clipboard

Opening and holding a session. You bring a token from your own backend; CgsAuth exchanges it for an SDK session and reports its state.

Link copied to clipboard

One small service per content domain — publications, issues, articles, videos, media. They all follow the same shape: get(id, scope) for one item, all(…, scope) for a paginated list.

Link copied to clipboard

CgsError, the sealed hierarchy every recoverable failure is reported through. Sealed so a when over it stays exhaustive as the SDK grows.

Link copied to clipboard

Integration mistakes: no license, a bad license, a call before init. These are thrown, not returned, because there is no runtime recovery — they mean the SDK is wired up wrong.

Link copied to clipboard

Where the SDK's diagnostics go. Ships with a Logcat implementation and a silent one; supply your own Logger to route them into your existing stack.

Link copied to clipboard

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.