-
Notifications
You must be signed in to change notification settings - Fork 196
Expand file tree
/
Copy pathNotifications.hs
More file actions
48 lines (41 loc) · 1.73 KB
/
Notifications.hs
File metadata and controls
48 lines (41 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
-----------------------------------------------------------------------------
-- |
-- License : BSD-3-Clause
-- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>
--
-- The repo watching API as described on
-- <https://developer.github.com/v3/activity/notifications/>.
module GitHub.Endpoints.Activity.Notifications (
getNotificationsR,
markNotificationAsReadR,
markAllNotificationsAsReadR,
) where
import GitHub.Data
import GitHub.Internal.Prelude
import Prelude ()
-- | List your notifications.
-- See <https://developer.github.com/v3/activity/notifications/#list-your-notifications>
getNotificationsR :: FetchCount -> Request 'RA (Vector Notification)
getNotificationsR = pagedQuery ["notifications"] []
-- | Mark a thread as read.
-- See <https://developer.github.com/v3/activity/notifications/#mark-a-thread-as-read>
markNotificationAsReadR :: Id Notification -> GenRequest 'MtUnit 'RW ()
markNotificationAsReadR nid = Command
Patch
["notifications", "threads", toPathPart nid]
(encode ())
-- | Mark as read.
-- See <https://developer.github.com/v3/activity/notifications/#mark-as-read>
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 <https://developer.github.com/v3/activity/notifications/#delete-a-thread-subscription>
deleteThreadSubscriptionR :: Id Notification -> GenRequest 'MtUnit 'RW ()
deleteThreadSubscriptionR nid = Command
Delete
["notifications", "threads", toPathPart nid, "subscription"]
mempty