## Parent
#1
## What to build
Authentication, library fetching, and download history — the data layer that feeds into downloads later.
**client module (partial):**
- OAuth2 password grant against `POST /oauth/token` → access_token (in-memory per-run, no persistence)
- Required headers baked in: `X-LibroFm-AppVer=7.34.8`, `User-Agent=okhttp/5.3.2` (configurable)
- Paginated library fetch: `GET /api/v10/library` — loop through all pages until no next page, return complete book list
- Uses httpx with configurable base URL and timeout
- All HTTP interactions mockable for tests (accept transport override or use httpx.MockTransport patterns)
**history module:**
- Read/write `download_history.json` — maps ISBN → {title, format, path, downloaded_at}
- Check whether an ISBN was previously downloaded (returns bool)
- Write entry only after fully successful download (this slice just builds the API; writing happens when downloads exist)
- Handle corrupt/missing JSON gracefully (treat as empty history, log warning)
**cli skeleton:**
- Wire together: load config → auth → fetch all library pages → filter undownloaded via history → print list of books to download
- No actual downloading yet — this slice proves the auth+fetch pipeline works end-to-end
## Acceptance criteria
- [ ] OAuth2 password grant returns access_token on valid credentials
- [ ] Auth fails clearly on invalid credentials (exit code 1, descriptive message)
- [ ] Library fetch returns all books across multiple pages (not just first page)
- [ ] Single-page library handled correctly (no infinite loop)
- [ ] Required headers sent with every request (X-LibroFm-AppVer, User-Agent)
- [ ] History file created if it does not exist
- [ ] Previously downloaded ISBNs are correctly identified as "already downloaded"
- [ ] Corrupt/missing history JSON treated as empty (with warning logged)
- [ ] CLI prints list of new (undownloaded) books when run
- [ ] CLI exits 0 when auth succeeds and library is fetched
- [ ] ~30 tests: auth success/failure, single-page + multi-page pagination, headers present, history round-trip, corrupt recovery, CLI smoke test with mocked client
- [ ] All tests pass
## Blocked by
#2
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Parent
#1
What to build
Authentication, library fetching, and download history — the data layer that feeds into downloads later.
client module (partial):
POST /oauth/token→ access_token (in-memory per-run, no persistence)X-LibroFm-AppVer=7.34.8,User-Agent=okhttp/5.3.2(configurable)GET /api/v10/library— loop through all pages until no next page, return complete book listhistory module:
download_history.json— maps ISBN → {title, format, path, downloaded_at}cli skeleton:
Acceptance criteria
Blocked by
#2
Closed via commit
515f5c0— all 11 AC met, 41/41 tests passing.