Skip to content

feat(messages): expose sender name and send time on Message - #109

Merged
nickknissen merged 2 commits into
nickknissen:mainfrom
kasperhartwich:feat/message-sender
Sep 26, 2026
Merged

nickknissen merged 2 commits into
nickknissen:mainfrom
kasperhartwich:feat/message-sender

Conversation

@kasperhartwich

@kasperhartwich kasperhartwich commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

The API returns sender.fullName and sendDateTime for every message, but
Message dropped both, so neither the library nor the JSON output of
aula messages could say who wrote a message or when it was sent.

Changes:

  • Message gains sender_name: str | None (from sender.fullName) and
    send_datetime: datetime | None (from sendDateTime, parsed with
    parse_api_datetime, like Post's timestamps). Both default to None for
    a missing, empty or unreadable value.
  • Both new fields are keyword-only, so the positional order is unchanged:
    Message(id, content_html, attachments, _raw) means what it did before.
  • dict(message) and --output json include them automatically, since
    AulaDataClass.__iter__ covers every field except _raw.

Tests:

  • tests/models/test_message.py: sender and time read from API data;
    missing sender; sender as None, {}, {"fullName": None},
    {"fullName": ""} and a non-dict; unreadable timestamps (None, "",
    garbage, a number); positional construction unchanged.
  • Full suite: 825 passed, 4 skipped. ruff format --check and ruff check
    clean.
  • Checked against a live account: messages now show their sender and send
    time in aula --output json messages.

The API returns sender.fullName and sendDateTime for every message, but
Message dropped them, so the JSON output of `aula messages` could not say
who wrote a message or when. Both are optional and default to None.
Review follow-up: sender_name and send_datetime are keyword-only, so
Message(id, html, attachments, raw) keeps meaning what it did. send_datetime
goes through parse_api_datetime like Post's timestamps, giving None for a
missing or unreadable value. Tests cover empty and odd senders, unreadable
timestamps and the positional order.
@nickknissen
nickknissen merged commit 99b743e into nickknissen:main Sep 26, 2026
3 checks passed
@kasperhartwich
kasperhartwich deleted the feat/message-sender branch September 26, 2026 07:29
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.

2 participants