corvix.services =============== .. py:module:: corvix.services .. autoapi-nested-parse:: Application services orchestrating ingestion, actions, and rendering. Classes ------- .. autoapisummary:: corvix.services.NotificationsClient corvix.services.PollingSummary corvix.services.PollCycleInput Functions --------- .. autoapisummary:: corvix.services.run_poll_cycle corvix.services.run_watch_loop corvix.services.render_cached_dashboards corvix.services._select_dashboards corvix.services._build_enrichment_providers Module Contents --------------- .. py:class:: NotificationsClient Bases: :py:obj:`corvix.actions.MarkReadGateway`, :py:obj:`corvix.enrichment.base.JsonFetchClient`, :py:obj:`Protocol` Client capabilities required by the poll cycle orchestration. .. py:method:: fetch_notifications(polling: corvix.config.PollingConfig) -> list[corvix.domain.Notification] Fetch notifications with configured polling options. .. py:class:: PollingSummary Result of one polling cycle. .. py:attribute:: fetched :type: int .. py:attribute:: excluded :type: int .. py:attribute:: actions_taken :type: int .. py:attribute:: errors :type: list[str] :value: [] .. py:attribute:: dispatch :type: corvix.notifications.models.DispatchResult | None :value: None .. py:class:: PollCycleInput All inputs required by :func:`run_poll_cycle`. Attributes: config: Application configuration. clients: GitHub notifications clients. cache: Persistent notification cache. apply_actions: If ``False``, actions are recorded as dry-run only. now: Override the current time (useful for testing). notification_targets: Optional notification dispatch targets. .. py:attribute:: config :type: corvix.config.AppConfig .. py:attribute:: cache :type: corvix.storage.NotificationCache .. py:attribute:: clients :type: tuple[NotificationsClient, Ellipsis] :value: () .. py:attribute:: client :type: NotificationsClient | None :value: None .. py:attribute:: apply_actions :type: bool :value: False .. py:attribute:: now :type: datetime.datetime | None :value: None .. py:attribute:: notification_targets :type: list[corvix.notifications.targets.base.NotificationTarget] | None :value: None .. py:function:: run_poll_cycle(input: PollCycleInput) -> PollingSummary Fetch notifications, score/evaluate, optionally execute actions, and persist cache. If ``input.notification_targets`` is provided (and ``input.config.notifications.enabled`` is ``True``) the poll cycle will detect newly-arrived unread notifications and fan-out delivery to each target after saving the snapshot. .. py:function:: run_watch_loop(config: corvix.config.AppConfig, cache: corvix.storage.NotificationCache, apply_actions: bool, clients: tuple[NotificationsClient, Ellipsis] | None = None, client: NotificationsClient | None = None, iterations: int | None = None) -> list[PollingSummary] Run polling loop suitable for local daemon usage. .. py:function:: render_cached_dashboards(config: corvix.config.AppConfig, cache: corvix.storage.NotificationCache, console: rich.console.Console, dashboard_name: str | None = None) -> list[corvix.presentation.DashboardRenderResult] Load persisted records and render dashboards. .. py:function:: _select_dashboards(config: corvix.config.AppConfig, dashboard_name: str | None) -> list[corvix.config.DashboardSpec] .. py:function:: _build_enrichment_providers(config: corvix.config.AppConfig) -> list[corvix.enrichment.base.EnrichmentProvider]