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:
| Authentication | CGS.auth | Opening a session from your own backend token, and picking the active profile. |
| Content | CGS.content | Publications, issues, articles, videos, media. |
| Downloads | CGS.download | Fetching an issue for offline reading, and following its progress. |
| Reading progress | CGS.readings | How far into each issue the reader got. |
| Reading list | CGS.readingList | Issues 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, callloadNextPage()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
Opening and holding a session. You bring a token from your own backend; CgsAuth exchanges it for an SDK session and reports its state.
CgsError, the sealed hierarchy every recoverable failure is reported through. Sealed so a when over it stays exhaustive as the SDK grows.
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.
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.