module GitHub.Endpoints.Activity.Notifications where
import GitHub.Data
import GitHub.Internal.Prelude
import GitHub.Request
import Prelude ()
getNotifications :: Auth -> IO (Either Error (Vector Notification))
getNotifications :: Auth -> IO (Either Error (Vector Notification))
getNotifications auth :: Auth
auth =
Auth
-> GenRequest 'MtJSON 'RA (Vector Notification)
-> IO (Either Error (Vector Notification))
forall am (mt :: MediaType *) a (rw :: RW).
(AuthMethod am, ParseResponse mt a) =>
am -> GenRequest mt rw a -> IO (Either Error a)
executeRequest Auth
auth (GenRequest 'MtJSON 'RA (Vector Notification)
-> IO (Either Error (Vector Notification)))
-> GenRequest 'MtJSON 'RA (Vector Notification)
-> IO (Either Error (Vector Notification))
forall a b. (a -> b) -> a -> b
$ FetchCount -> GenRequest 'MtJSON 'RA (Vector Notification)
getNotificationsR FetchCount
FetchAll
getNotificationsR :: FetchCount -> Request 'RA (Vector Notification)
getNotificationsR :: FetchCount -> GenRequest 'MtJSON 'RA (Vector Notification)
getNotificationsR = Paths
-> QueryString
-> FetchCount
-> GenRequest 'MtJSON 'RA (Vector Notification)
forall a (mt :: RW).
FromJSON a =>
Paths -> QueryString -> FetchCount -> Request mt (Vector a)
pagedQuery ["notifications"] []
markNotificationAsRead :: Auth -> Id Notification -> IO (Either Error ())
markNotificationAsRead :: Auth -> Id Notification -> IO (Either Error ())
markNotificationAsRead auth :: Auth
auth nid :: Id Notification
nid =
Auth -> GenRequest 'MtUnit 'RW () -> IO (Either Error ())
forall am (mt :: MediaType *) a (rw :: RW).
(AuthMethod am, ParseResponse mt a) =>
am -> GenRequest mt rw a -> IO (Either Error a)
executeRequest Auth
auth (GenRequest 'MtUnit 'RW () -> IO (Either Error ()))
-> GenRequest 'MtUnit 'RW () -> IO (Either Error ())
forall a b. (a -> b) -> a -> b
$ Id Notification -> GenRequest 'MtUnit 'RW ()
markNotificationAsReadR Id Notification
nid
markNotificationAsReadR :: Id Notification -> GenRequest 'MtUnit 'RW ()
markNotificationAsReadR :: Id Notification -> GenRequest 'MtUnit 'RW ()
markNotificationAsReadR nid :: Id Notification
nid = CommandMethod -> Paths -> ByteString -> GenRequest 'MtUnit 'RW ()
forall (mt :: MediaType *) a.
CommandMethod -> Paths -> ByteString -> GenRequest mt 'RW a
Command
CommandMethod
Patch
["notifications", "threads", Id Notification -> Text
forall a. IsPathPart a => a -> Text
toPathPart Id Notification
nid]
(() -> ByteString
forall a. ToJSON a => a -> ByteString
encode ())
markNotificationsAsRead :: Auth -> IO (Either Error ())
markNotificationsAsRead :: Auth -> IO (Either Error ())
markNotificationsAsRead auth :: Auth
auth =
Auth -> GenRequest 'MtUnit 'RW () -> IO (Either Error ())
forall am (mt :: MediaType *) a (rw :: RW).
(AuthMethod am, ParseResponse mt a) =>
am -> GenRequest mt rw a -> IO (Either Error a)
executeRequest Auth
auth GenRequest 'MtUnit 'RW ()
markAllNotificationsAsReadR
markAllNotificationsAsReadR :: GenRequest 'MtUnit 'RW ()
markAllNotificationsAsReadR :: GenRequest 'MtUnit 'RW ()
markAllNotificationsAsReadR =
CommandMethod -> Paths -> ByteString -> GenRequest 'MtUnit 'RW ()
forall (mt :: MediaType *) a.
CommandMethod -> Paths -> ByteString -> GenRequest mt 'RW a
Command CommandMethod
Put ["notifications"] (ByteString -> GenRequest 'MtUnit 'RW ())
-> ByteString -> GenRequest 'MtUnit 'RW ()
forall a b. (a -> b) -> a -> b
$ Value -> ByteString
forall a. ToJSON a => a -> ByteString
encode Value
emptyObject