From d19471fd4df6123c669128ff8bdf004deb0b7066 Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Sun, 12 Jun 2022 06:10:29 -0400 Subject: [PATCH] announcements: implement list feeds endpoint Signed-off-by: Eric Callahan --- moonraker/components/announcements.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/moonraker/components/announcements.py b/moonraker/components/announcements.py index a1a819e..4bd4730 100644 --- a/moonraker/components/announcements.py +++ b/moonraker/components/announcements.py @@ -73,6 +73,10 @@ class Announcements: "/server/announcements/feed", ["POST", "DELETE"], self._handle_feed_request ) + self.server.register_endpoint( + "/server/announcements/feeds", ["GET"], + self._handle_list_feeds + ) self.server.register_notification( "announcements:dismissed", "announcement_dismissed" ) @@ -164,6 +168,11 @@ class Announcements: "modified": changed } + async def _handle_list_feeds( + self, web_request: WebRequest + ) -> Dict[str, Any]: + return {"feeds": list(self.subscriptions.keys())} + async def _handle_feed_request( self, web_request: WebRequest ) -> Dict[str, Any]: