corvix.web.schemas

Typed response schemas for the Corvix web API.

These dataclasses are the single source of truth for the JSON shapes returned by the /api/v1 route handlers. Litestar serializes them directly and auto-generates an OpenAPI document from their annotations; the frontend’s TypeScript types are code-generated from that document (see scripts/export_openapi.py and frontend/src/api-types.gen.ts).

Every field is required (no defaults) so the generated OpenAPI schema marks each property as required and the TypeScript types never become accidentally optional. str | None fields map to a nullable-but-present property, matching how the handlers always emit the key.

Classes

DashboardItemResponse

A single notification row rendered by the dashboard table.

DashboardGroupResponse

A group of dashboard items (e.g. grouped by repository or reason).

DashboardSummaryResponse

Aggregate counts shown in the dashboard shell.

AccountErrorResponse

A per-account fetch failure recorded during a poll cycle.

PollerStatusResponse

Poller health surfaced to the UI for the staleness warning banner.

BrowserTabNotificationsConfigResponse

In-tab browser notification settings echoed to the frontend.

NotificationsConfigResponse

Notification configuration relevant to the browser client.

SnapshotResponse

Full dashboard snapshot returned by GET /api/v1/snapshot.

RuleSnippetsResponse

Prefilled ignore-rule snippets for a single notification.

Functions

_dashboard_item_response(→ DashboardItemResponse)

Convert a dashboarding.DashboardItem into its response schema.

build_snapshot_response(→ SnapshotResponse)

Assemble a typed SnapshotResponse from dashboard data.

Module Contents

class corvix.web.schemas.DashboardItemResponse[source][source]

A single notification row rendered by the dashboard table.

account_id: str[source][source]
account_label: str[source][source]
thread_id: str[source][source]
repository: str[source][source]
reason: str[source][source]
subject_type: str[source][source]
subject_title: str[source][source]
unread: bool[source][source]
updated_at: str[source][source]
score: float[source][source]
web_url: str | None[source][source]
matched_rules: list[str][source][source]
actions_taken: list[str][source][source]
class corvix.web.schemas.DashboardGroupResponse[source][source]

A group of dashboard items (e.g. grouped by repository or reason).

name: str[source][source]
items: list[DashboardItemResponse][source][source]
class corvix.web.schemas.DashboardSummaryResponse[source][source]

Aggregate counts shown in the dashboard shell.

unread_items: int[source][source]
read_items: int[source][source]
group_count: int[source][source]
repository_count: int[source][source]
reason_count: int[source][source]
class corvix.web.schemas.AccountErrorResponse[source][source]

A 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.web.schemas.PollerStatusResponse[source][source]

Poller health surfaced to the UI for the staleness warning banner.

status: str[source][source]
last_poll_time: str | None[source][source]
last_error: str | None[source][source]
last_error_time: str | None[source][source]
stale: bool[source][source]
account_errors: list[AccountErrorResponse][source][source]
class corvix.web.schemas.BrowserTabNotificationsConfigResponse[source][source]

In-tab browser notification settings echoed to the frontend.

enabled: bool[source][source]
max_per_cycle: int[source][source]
cooldown_seconds: int[source][source]
class corvix.web.schemas.NotificationsConfigResponse[source][source]

Notification configuration relevant to the browser client.

enabled: bool[source][source]
browser_tab: BrowserTabNotificationsConfigResponse[source][source]
class corvix.web.schemas.SnapshotResponse[source][source]

Full dashboard snapshot returned by GET /api/v1/snapshot.

name: str[source][source]
include_read: bool[source][source]
sort_by: str[source][source]
descending: bool[source][source]
generated_at: str | None[source][source]
groups: list[DashboardGroupResponse][source][source]
total_items: int[source][source]
summary: DashboardSummaryResponse[source][source]
dashboard_names: list[str][source][source]
poller: PollerStatusResponse[source][source]
notifications_config: NotificationsConfigResponse | None[source][source]
class corvix.web.schemas.RuleSnippetsResponse[source][source]

Prefilled ignore-rule snippets for a single notification.

dashboard_name: str[source][source]
dashboard_ignore_rule_snippet: str[source][source]
global_exclude_rule_snippet: str[source][source]
dashboard_ignore_rule_with_context_snippet: str | None[source][source]
global_exclude_rule_with_context_snippet: str | None[source][source]
has_context: bool[source][source]
corvix.web.schemas._dashboard_item_response(item: corvix.dashboarding.DashboardItem) DashboardItemResponse[source][source]

Convert a dashboarding.DashboardItem into its response schema.

corvix.web.schemas.build_snapshot_response(*, data: corvix.dashboarding.DashboardData, dashboard_names: list[str], poller: PollerStatusResponse, notifications_config: corvix.config.notifications.NotificationsConfig | None) SnapshotResponse[source][source]

Assemble a typed SnapshotResponse from dashboard data.

Centralizes the mapping from the internal DashboardData dataclass (plus the already-resolved poller status and config state) to the wire schema so the route handler stays thin and the contract lives in one place.