From 61db9b7dd20b7510df5cea2844e0596dd134dd94 Mon Sep 17 00:00:00 2001 From: Denis Laxalde Date: Mon, 3 Jun 2019 13:20:29 +0200 Subject: [PATCH] Bind "delete thread subscription" notification endpoint This is used to "mute" a thread of notifications. --- src/GitHub.hs | 1 + src/GitHub/Endpoints/Activity/Notifications.hs | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/GitHub.hs b/src/GitHub.hs index e00a53cb..02a26d87 100644 --- a/src/GitHub.hs +++ b/src/GitHub.hs @@ -31,6 +31,7 @@ module GitHub ( getNotificationsR, markNotificationAsReadR, markAllNotificationsAsReadR, + deleteThreadSubscriptionR, -- ** Starring -- | See diff --git a/src/GitHub/Endpoints/Activity/Notifications.hs b/src/GitHub/Endpoints/Activity/Notifications.hs index 7c246c54..d22ccf2b 100644 --- a/src/GitHub/Endpoints/Activity/Notifications.hs +++ b/src/GitHub/Endpoints/Activity/Notifications.hs @@ -34,3 +34,15 @@ markNotificationAsReadR nid = Command markAllNotificationsAsReadR :: GenRequest 'MtUnit 'RW () markAllNotificationsAsReadR = Command Put ["notifications"] $ encode emptyObject + +deleteThreadSubscription :: Auth -> Id Notification -> IO (Either Error ()) +deleteThreadSubscription auth nid = + executeRequest auth $ deleteThreadSubscriptionR nid + +-- | Delete a thread subscription. +-- See +deleteThreadSubscriptionR :: Id Notification -> GenRequest 'MtUnit 'RW () +deleteThreadSubscriptionR nid = Command + Delete + ["notifications", "threads", toPathPart nid, "subscription"] + mempty