From 156e9652e125ff13e76e650ffdf89dcac240aced Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Sun, 3 Apr 2022 08:30:08 -0400 Subject: [PATCH] announcements: add internal access methods Signed-off-by: Eric Callahan --- moonraker/components/announcements.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/moonraker/components/announcements.py b/moonraker/components/announcements.py index b78b2c8..a1a819e 100644 --- a/moonraker/components/announcements.py +++ b/moonraker/components/announcements.py @@ -234,13 +234,22 @@ class Announcements: self.entry_mgr.add_entry(entry) return entry - async def remove_internal_announcment(self, entry_id: str) -> None: + async def remove_announcement(self, entry_id: str) -> None: ret = await self.entry_mgr.remove_entry(entry_id) if ret is not None: entries = await self.entry_mgr.list_entries() self.server.send_event( "announcements:entries_updated", {"entries": entries} ) + async def dismiss_announcement( + self, entry_id, wake_time: Optional[int] = None + ) -> None: + await self.entry_mgr.dismiss_entry(entry_id, wake_time) + + async def get_announcements( + self, include_dismissed: bool = False + ) -> List[Dict[str, Any]]: + return await self.entry_mgr.list_entries(include_dismissed) def close(self): self.entry_mgr.close()