Skip to content

Comments

feat: expose user state (done, starred) on TimelineEvent#104

Open
mhlavac wants to merge 1 commit intoEdupageAPI:masterfrom
mhlavac:feat/timeline-user-state
Open

feat: expose user state (done, starred) on TimelineEvent#104
mhlavac wants to merge 1 commit intoEdupageAPI:masterfrom
mhlavac:feat/timeline-user-state

Conversation

@mhlavac
Copy link

@mhlavac mhlavac commented Feb 21, 2026

Summary

  • Add 6 new fields to TimelineEvent populated from userProps data that Edupage already returns but the library was discarding:
    • is_done / done_at — whether the user dismissed/completed the item and when
    • is_starred — whether the user starred/pinned the item
    • reaction_count — number of reactions (likes) on the item
    • created_at — original creation timestamp (distinct from display timestamp)
    • is_removed — soft-delete flag from raw event data
  • All new fields have default values — fully backward-compatible, no existing code breaks
  • Add first unit tests for the timeline module (30 tests)

How it works

Edupage stores per-user item state in two places:

  • edu.data["userProps"] — available from the login cache (used by get_notifications())
  • response["timelineUserProps"] — returned by the history API endpoint (used by get_notifications_history())

Both are dicts keyed by timeline ID containing {"starred": "1"} and/or {"doneMaxCas": "2025-03-10 14:30:00"}. The library was already receiving this data but discarding it.

Additional raw event fields (pocet_reakcii, cas_pridania, removed) were also being discarded and are now exposed.

Test plan

  • 30 unit tests covering dataclass defaults, userProps parsing, raw event fields, public API integration, and edge cases
  • Tested against a live Edupage school account (parent account with 106 timeline items — 97 active, 9 done)
  • Verified is_done / done_at consistency: is_done is derived from done_at is not None
  • Verified backward compatibility: constructing TimelineEvent with only the original 7 positional args works

🤖 Generated with Claude Code

Add 6 new fields to TimelineEvent populated from userProps data that
Edupage already returns but the library was discarding:

- is_done / done_at: whether the user dismissed the item and when
- is_starred: whether the user starred/pinned the item
- reaction_count: number of reactions on the item
- created_at: original creation timestamp (distinct from display timestamp)
- is_removed: soft-delete flag

The userProps data is keyed by timeline ID and available in:
- edu.data["userProps"] (from login cache, used by get_notifications)
- response["timelineUserProps"] (from history endpoint, used by
  get_notifications_history)

All new fields have default values so existing code is unaffected.

Also adds the first unit tests for the timeline module (30 tests).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant