corvix.domain

Domain models for GitHub notifications.

Attributes

Classes

AccountError

Per-account fetch failure recorded during a poll cycle.

PollerStatus

Status written to the cache by the poller/watch loop.

Notification

Normalized notification from GitHub's notifications API.

NotificationRecord

Scored and rule-evaluated notification persisted for dashboards.

Functions

_as_object_map(→ dict[str, object] | None)

_require_non_empty_str(→ str)

_optional_str(→ str | None)

_optional_bool(→ bool)

_optional_float(→ float)

_optional_str_list(→ list[str])

_optional_context(→ dict[str, object])

_require_object_map(→ dict[str, object])

_require_non_empty_str_value(→ str)

parse_timestamp(→ datetime.datetime)

Parse an ISO8601 timestamp into a timezone-aware datetime.

format_timestamp(→ str)

Format a timezone-aware datetime as an ISO8601 string.

notification_key(→ str)

Return a stable account-scoped key for a notification.

_get_non_empty_str_or_default(→ str)

Module Contents

class corvix.domain.AccountError[source][source]

Per-account fetch failure recorded during a poll cycle.

account_id: str[source][source]
account_label: str[source][source]
error: str[source][source]
class corvix.domain.PollerStatus[source][source]

Status written to the cache by the poller/watch loop.

status: str = 'unknown'[source][source]
last_poll_time: str | None = None[source][source]
last_error: str | None = None[source][source]
last_error_time: str | None = None[source][source]
account_errors: tuple[AccountError, Ellipsis] = ()[source][source]
corvix.domain.STORED_RECORD_LABEL = 'stored record'[source][source]
corvix.domain._as_object_map(value: object) dict[str, object] | None[source][source]
corvix.domain._require_non_empty_str(payload: collections.abc.Mapping[str, object], key: str, label: str) str[source][source]
corvix.domain._optional_str(payload: collections.abc.Mapping[str, object], key: str) str | None[source][source]
corvix.domain._optional_bool(payload: collections.abc.Mapping[str, object], key: str, default: bool, label: str) bool[source][source]
corvix.domain._optional_float(payload: collections.abc.Mapping[str, object], key: str, default: float, label: str) float[source][source]
corvix.domain._optional_str_list(payload: collections.abc.Mapping[str, object], key: str) list[str][source][source]
corvix.domain._optional_context(payload: collections.abc.Mapping[str, object], key: str) dict[str, object][source][source]
corvix.domain._require_object_map(value: object, message: str) dict[str, object][source][source]
corvix.domain._require_non_empty_str_value(value: object, message: str) str[source][source]
corvix.domain.parse_timestamp(value: str) datetime.datetime[source][source]

Parse an ISO8601 timestamp into a timezone-aware datetime.

corvix.domain.format_timestamp(value: datetime.datetime) str[source][source]

Format a timezone-aware datetime as an ISO8601 string.

class corvix.domain.Notification[source][source]

Normalized notification from GitHub’s notifications API.

thread_id: str[source][source]
repository: str[source][source]
reason: str[source][source]
subject_title: str[source][source]
subject_type: str[source][source]
unread: bool[source][source]
updated_at: datetime.datetime[source][source]
thread_url: str | None = None[source][source]
subject_url: str | None = None[source][source]
web_url: str | None = None[source][source]
repository_url: str | None = None[source][source]
account_id: str = 'primary'[source][source]
account_label: str = 'Primary'[source][source]
classmethod from_api_payload(payload: collections.abc.Mapping[str, object], *, account_id: str = 'primary', account_label: str = 'Primary') Notification[source][source]

Build a notification from a GitHub API response payload.

class corvix.domain.NotificationRecord[source][source]

Scored and rule-evaluated notification persisted for dashboards.

notification: Notification[source][source]
score: float[source][source]
excluded: bool[source][source]
matched_rules: tuple[str, Ellipsis] = ()[source][source]
actions_taken: tuple[str, Ellipsis] = ()[source][source]
dismissed: bool = False[source][source]
context: collections.abc.Mapping[str, object][source][source]
to_dict() dict[str, object][source][source]

Convert to a JSON-serializable dictionary.

classmethod from_dict(payload: collections.abc.Mapping[str, object]) NotificationRecord[source][source]

Parse a stored record.

corvix.domain.notification_key(notification: Notification) str[source][source]

Return a stable account-scoped key for a notification.

corvix.domain._get_non_empty_str_or_default(payload: collections.abc.Mapping[str, object], key: str, default: str) str[source][source]