module GitHub.Data.Activities where

import GitHub.Data.Id          (Id, mkId)
import GitHub.Data.Repos       (Repo, RepoRef)
import GitHub.Data.URL         (URL)
import GitHub.Internal.Prelude

import Prelude ()

import qualified Data.Text as T

data RepoStarred = RepoStarred
    { RepoStarred -> UTCTime
repoStarredStarredAt :: !UTCTime
    , RepoStarred -> Repo
repoStarredRepo      :: !Repo
    }
  deriving (Int -> RepoStarred -> ShowS
[RepoStarred] -> ShowS
RepoStarred -> String
(Int -> RepoStarred -> ShowS)
-> (RepoStarred -> String)
-> ([RepoStarred] -> ShowS)
-> Show RepoStarred
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RepoStarred -> ShowS
showsPrec :: Int -> RepoStarred -> ShowS
$cshow :: RepoStarred -> String
show :: RepoStarred -> String
$cshowList :: [RepoStarred] -> ShowS
showList :: [RepoStarred] -> ShowS
Show, Typeable RepoStarred
Typeable RepoStarred =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> RepoStarred -> c RepoStarred)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c RepoStarred)
-> (RepoStarred -> Constr)
-> (RepoStarred -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c RepoStarred))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c RepoStarred))
-> ((forall b. Data b => b -> b) -> RepoStarred -> RepoStarred)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> RepoStarred -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> RepoStarred -> r)
-> (forall u. (forall d. Data d => d -> u) -> RepoStarred -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> RepoStarred -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> RepoStarred -> m RepoStarred)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> RepoStarred -> m RepoStarred)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> RepoStarred -> m RepoStarred)
-> Data RepoStarred
RepoStarred -> Constr
RepoStarred -> DataType
(forall b. Data b => b -> b) -> RepoStarred -> RepoStarred
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> RepoStarred -> u
forall u. (forall d. Data d => d -> u) -> RepoStarred -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RepoStarred -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RepoStarred -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> RepoStarred -> m RepoStarred
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RepoStarred -> m RepoStarred
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RepoStarred
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RepoStarred -> c RepoStarred
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c RepoStarred)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c RepoStarred)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RepoStarred -> c RepoStarred
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RepoStarred -> c RepoStarred
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RepoStarred
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RepoStarred
$ctoConstr :: RepoStarred -> Constr
toConstr :: RepoStarred -> Constr
$cdataTypeOf :: RepoStarred -> DataType
dataTypeOf :: RepoStarred -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c RepoStarred)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c RepoStarred)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c RepoStarred)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c RepoStarred)
$cgmapT :: (forall b. Data b => b -> b) -> RepoStarred -> RepoStarred
gmapT :: (forall b. Data b => b -> b) -> RepoStarred -> RepoStarred
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RepoStarred -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RepoStarred -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RepoStarred -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RepoStarred -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> RepoStarred -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> RepoStarred -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> RepoStarred -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> RepoStarred -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> RepoStarred -> m RepoStarred
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> RepoStarred -> m RepoStarred
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RepoStarred -> m RepoStarred
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RepoStarred -> m RepoStarred
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RepoStarred -> m RepoStarred
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RepoStarred -> m RepoStarred
Data, Typeable, RepoStarred -> RepoStarred -> Bool
(RepoStarred -> RepoStarred -> Bool)
-> (RepoStarred -> RepoStarred -> Bool) -> Eq RepoStarred
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RepoStarred -> RepoStarred -> Bool
== :: RepoStarred -> RepoStarred -> Bool
$c/= :: RepoStarred -> RepoStarred -> Bool
/= :: RepoStarred -> RepoStarred -> Bool
Eq, Eq RepoStarred
Eq RepoStarred =>
(RepoStarred -> RepoStarred -> Ordering)
-> (RepoStarred -> RepoStarred -> Bool)
-> (RepoStarred -> RepoStarred -> Bool)
-> (RepoStarred -> RepoStarred -> Bool)
-> (RepoStarred -> RepoStarred -> Bool)
-> (RepoStarred -> RepoStarred -> RepoStarred)
-> (RepoStarred -> RepoStarred -> RepoStarred)
-> Ord RepoStarred
RepoStarred -> RepoStarred -> Bool
RepoStarred -> RepoStarred -> Ordering
RepoStarred -> RepoStarred -> RepoStarred
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: RepoStarred -> RepoStarred -> Ordering
compare :: RepoStarred -> RepoStarred -> Ordering
$c< :: RepoStarred -> RepoStarred -> Bool
< :: RepoStarred -> RepoStarred -> Bool
$c<= :: RepoStarred -> RepoStarred -> Bool
<= :: RepoStarred -> RepoStarred -> Bool
$c> :: RepoStarred -> RepoStarred -> Bool
> :: RepoStarred -> RepoStarred -> Bool
$c>= :: RepoStarred -> RepoStarred -> Bool
>= :: RepoStarred -> RepoStarred -> Bool
$cmax :: RepoStarred -> RepoStarred -> RepoStarred
max :: RepoStarred -> RepoStarred -> RepoStarred
$cmin :: RepoStarred -> RepoStarred -> RepoStarred
min :: RepoStarred -> RepoStarred -> RepoStarred
Ord, (forall x. RepoStarred -> Rep RepoStarred x)
-> (forall x. Rep RepoStarred x -> RepoStarred)
-> Generic RepoStarred
forall x. Rep RepoStarred x -> RepoStarred
forall x. RepoStarred -> Rep RepoStarred x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. RepoStarred -> Rep RepoStarred x
from :: forall x. RepoStarred -> Rep RepoStarred x
$cto :: forall x. Rep RepoStarred x -> RepoStarred
to :: forall x. Rep RepoStarred x -> RepoStarred
Generic)

instance NFData RepoStarred where rnf :: RepoStarred -> ()
rnf = RepoStarred -> ()
forall a. (Generic a, GNFData (Rep a)) => a -> ()
genericRnf
instance Binary RepoStarred

-- JSON Instances
instance FromJSON RepoStarred where
    parseJSON :: Value -> Parser RepoStarred
parseJSON = String
-> (Object -> Parser RepoStarred) -> Value -> Parser RepoStarred
forall a. String -> (Object -> Parser a) -> Value -> Parser a
withObject String
"RepoStarred" ((Object -> Parser RepoStarred) -> Value -> Parser RepoStarred)
-> (Object -> Parser RepoStarred) -> Value -> Parser RepoStarred
forall a b. (a -> b) -> a -> b
$ \Object
o -> UTCTime -> Repo -> RepoStarred
RepoStarred
        (UTCTime -> Repo -> RepoStarred)
-> Parser UTCTime -> Parser (Repo -> RepoStarred)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser UTCTime
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"starred_at"
        Parser (Repo -> RepoStarred) -> Parser Repo -> Parser RepoStarred
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser Repo
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"repo"

data Subject = Subject
    { Subject -> Text
subjectTitle :: !Text
    , Subject -> URL
subjectURL :: !URL
    , Subject -> Maybe URL
subjectLatestCommentURL :: !(Maybe URL)
    -- https://developer.github.com/v3/activity/notifications/ doesn't indicate
    -- what the possible values for this field are.
    -- TODO: Make an ADT for this.
    , Subject -> Text
subjectType :: !Text
    }
  deriving (Int -> Subject -> ShowS
[Subject] -> ShowS
Subject -> String
(Int -> Subject -> ShowS)
-> (Subject -> String) -> ([Subject] -> ShowS) -> Show Subject
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Subject -> ShowS
showsPrec :: Int -> Subject -> ShowS
$cshow :: Subject -> String
show :: Subject -> String
$cshowList :: [Subject] -> ShowS
showList :: [Subject] -> ShowS
Show, Typeable Subject
Typeable Subject =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> Subject -> c Subject)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Subject)
-> (Subject -> Constr)
-> (Subject -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Subject))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Subject))
-> ((forall b. Data b => b -> b) -> Subject -> Subject)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Subject -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Subject -> r)
-> (forall u. (forall d. Data d => d -> u) -> Subject -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Subject -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Subject -> m Subject)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Subject -> m Subject)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Subject -> m Subject)
-> Data Subject
Subject -> Constr
Subject -> DataType
(forall b. Data b => b -> b) -> Subject -> Subject
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Subject -> u
forall u. (forall d. Data d => d -> u) -> Subject -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Subject -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Subject -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Subject -> m Subject
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Subject -> m Subject
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Subject
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Subject -> c Subject
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Subject)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Subject)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Subject -> c Subject
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Subject -> c Subject
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Subject
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Subject
$ctoConstr :: Subject -> Constr
toConstr :: Subject -> Constr
$cdataTypeOf :: Subject -> DataType
dataTypeOf :: Subject -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Subject)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Subject)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Subject)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Subject)
$cgmapT :: (forall b. Data b => b -> b) -> Subject -> Subject
gmapT :: (forall b. Data b => b -> b) -> Subject -> Subject
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Subject -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Subject -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Subject -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Subject -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Subject -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> Subject -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Subject -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Subject -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Subject -> m Subject
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Subject -> m Subject
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Subject -> m Subject
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Subject -> m Subject
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Subject -> m Subject
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Subject -> m Subject
Data, Typeable, Subject -> Subject -> Bool
(Subject -> Subject -> Bool)
-> (Subject -> Subject -> Bool) -> Eq Subject
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Subject -> Subject -> Bool
== :: Subject -> Subject -> Bool
$c/= :: Subject -> Subject -> Bool
/= :: Subject -> Subject -> Bool
Eq, Eq Subject
Eq Subject =>
(Subject -> Subject -> Ordering)
-> (Subject -> Subject -> Bool)
-> (Subject -> Subject -> Bool)
-> (Subject -> Subject -> Bool)
-> (Subject -> Subject -> Bool)
-> (Subject -> Subject -> Subject)
-> (Subject -> Subject -> Subject)
-> Ord Subject
Subject -> Subject -> Bool
Subject -> Subject -> Ordering
Subject -> Subject -> Subject
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Subject -> Subject -> Ordering
compare :: Subject -> Subject -> Ordering
$c< :: Subject -> Subject -> Bool
< :: Subject -> Subject -> Bool
$c<= :: Subject -> Subject -> Bool
<= :: Subject -> Subject -> Bool
$c> :: Subject -> Subject -> Bool
> :: Subject -> Subject -> Bool
$c>= :: Subject -> Subject -> Bool
>= :: Subject -> Subject -> Bool
$cmax :: Subject -> Subject -> Subject
max :: Subject -> Subject -> Subject
$cmin :: Subject -> Subject -> Subject
min :: Subject -> Subject -> Subject
Ord, (forall x. Subject -> Rep Subject x)
-> (forall x. Rep Subject x -> Subject) -> Generic Subject
forall x. Rep Subject x -> Subject
forall x. Subject -> Rep Subject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Subject -> Rep Subject x
from :: forall x. Subject -> Rep Subject x
$cto :: forall x. Rep Subject x -> Subject
to :: forall x. Rep Subject x -> Subject
Generic)

instance NFData Subject where rnf :: Subject -> ()
rnf = Subject -> ()
forall a. (Generic a, GNFData (Rep a)) => a -> ()
genericRnf
instance Binary Subject

instance FromJSON Subject where
    parseJSON :: Value -> Parser Subject
parseJSON = String -> (Object -> Parser Subject) -> Value -> Parser Subject
forall a. String -> (Object -> Parser a) -> Value -> Parser a
withObject String
"Subject" ((Object -> Parser Subject) -> Value -> Parser Subject)
-> (Object -> Parser Subject) -> Value -> Parser Subject
forall a b. (a -> b) -> a -> b
$ \Object
o -> Text -> URL -> Maybe URL -> Text -> Subject
Subject
        (Text -> URL -> Maybe URL -> Text -> Subject)
-> Parser Text -> Parser (URL -> Maybe URL -> Text -> Subject)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"title"
        Parser (URL -> Maybe URL -> Text -> Subject)
-> Parser URL -> Parser (Maybe URL -> Text -> Subject)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser URL
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"url"
        Parser (Maybe URL -> Text -> Subject)
-> Parser (Maybe URL) -> Parser (Text -> Subject)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser (Maybe URL)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"latest_comment_url"
        Parser (Text -> Subject) -> Parser Text -> Parser Subject
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"type"

data NotificationReason
    = AssignReason
    | AuthorReason
    | CommentReason
    | InvitationReason
    | ManualReason
    | MentionReason
    | ReviewRequestedReason
    | StateChangeReason
    | SubscribedReason
    | TeamMentionReason
  deriving (Int -> NotificationReason -> ShowS
[NotificationReason] -> ShowS
NotificationReason -> String
(Int -> NotificationReason -> ShowS)
-> (NotificationReason -> String)
-> ([NotificationReason] -> ShowS)
-> Show NotificationReason
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> NotificationReason -> ShowS
showsPrec :: Int -> NotificationReason -> ShowS
$cshow :: NotificationReason -> String
show :: NotificationReason -> String
$cshowList :: [NotificationReason] -> ShowS
showList :: [NotificationReason] -> ShowS
Show, Typeable NotificationReason
Typeable NotificationReason =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g)
 -> NotificationReason
 -> c NotificationReason)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c NotificationReason)
-> (NotificationReason -> Constr)
-> (NotificationReason -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c NotificationReason))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c NotificationReason))
-> ((forall b. Data b => b -> b)
    -> NotificationReason -> NotificationReason)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> NotificationReason -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> NotificationReason -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> NotificationReason -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> NotificationReason -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> NotificationReason -> m NotificationReason)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> NotificationReason -> m NotificationReason)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> NotificationReason -> m NotificationReason)
-> Data NotificationReason
NotificationReason -> Constr
NotificationReason -> DataType
(forall b. Data b => b -> b)
-> NotificationReason -> NotificationReason
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> NotificationReason -> u
forall u. (forall d. Data d => d -> u) -> NotificationReason -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NotificationReason -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NotificationReason -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> NotificationReason -> m NotificationReason
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> NotificationReason -> m NotificationReason
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NotificationReason
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> NotificationReason
-> c NotificationReason
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NotificationReason)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c NotificationReason)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> NotificationReason
-> c NotificationReason
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> NotificationReason
-> c NotificationReason
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NotificationReason
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NotificationReason
$ctoConstr :: NotificationReason -> Constr
toConstr :: NotificationReason -> Constr
$cdataTypeOf :: NotificationReason -> DataType
dataTypeOf :: NotificationReason -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NotificationReason)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NotificationReason)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c NotificationReason)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c NotificationReason)
$cgmapT :: (forall b. Data b => b -> b)
-> NotificationReason -> NotificationReason
gmapT :: (forall b. Data b => b -> b)
-> NotificationReason -> NotificationReason
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NotificationReason -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NotificationReason -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NotificationReason -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NotificationReason -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> NotificationReason -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> NotificationReason -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> NotificationReason -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> NotificationReason -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> NotificationReason -> m NotificationReason
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> NotificationReason -> m NotificationReason
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> NotificationReason -> m NotificationReason
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> NotificationReason -> m NotificationReason
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> NotificationReason -> m NotificationReason
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> NotificationReason -> m NotificationReason
Data, Int -> NotificationReason
NotificationReason -> Int
NotificationReason -> [NotificationReason]
NotificationReason -> NotificationReason
NotificationReason -> NotificationReason -> [NotificationReason]
NotificationReason
-> NotificationReason -> NotificationReason -> [NotificationReason]
(NotificationReason -> NotificationReason)
-> (NotificationReason -> NotificationReason)
-> (Int -> NotificationReason)
-> (NotificationReason -> Int)
-> (NotificationReason -> [NotificationReason])
-> (NotificationReason
    -> NotificationReason -> [NotificationReason])
-> (NotificationReason
    -> NotificationReason -> [NotificationReason])
-> (NotificationReason
    -> NotificationReason
    -> NotificationReason
    -> [NotificationReason])
-> Enum NotificationReason
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: NotificationReason -> NotificationReason
succ :: NotificationReason -> NotificationReason
$cpred :: NotificationReason -> NotificationReason
pred :: NotificationReason -> NotificationReason
$ctoEnum :: Int -> NotificationReason
toEnum :: Int -> NotificationReason
$cfromEnum :: NotificationReason -> Int
fromEnum :: NotificationReason -> Int
$cenumFrom :: NotificationReason -> [NotificationReason]
enumFrom :: NotificationReason -> [NotificationReason]
$cenumFromThen :: NotificationReason -> NotificationReason -> [NotificationReason]
enumFromThen :: NotificationReason -> NotificationReason -> [NotificationReason]
$cenumFromTo :: NotificationReason -> NotificationReason -> [NotificationReason]
enumFromTo :: NotificationReason -> NotificationReason -> [NotificationReason]
$cenumFromThenTo :: NotificationReason
-> NotificationReason -> NotificationReason -> [NotificationReason]
enumFromThenTo :: NotificationReason
-> NotificationReason -> NotificationReason -> [NotificationReason]
Enum, NotificationReason
NotificationReason
-> NotificationReason -> Bounded NotificationReason
forall a. a -> a -> Bounded a
$cminBound :: NotificationReason
minBound :: NotificationReason
$cmaxBound :: NotificationReason
maxBound :: NotificationReason
Bounded, Typeable, NotificationReason -> NotificationReason -> Bool
(NotificationReason -> NotificationReason -> Bool)
-> (NotificationReason -> NotificationReason -> Bool)
-> Eq NotificationReason
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: NotificationReason -> NotificationReason -> Bool
== :: NotificationReason -> NotificationReason -> Bool
$c/= :: NotificationReason -> NotificationReason -> Bool
/= :: NotificationReason -> NotificationReason -> Bool
Eq, Eq NotificationReason
Eq NotificationReason =>
(NotificationReason -> NotificationReason -> Ordering)
-> (NotificationReason -> NotificationReason -> Bool)
-> (NotificationReason -> NotificationReason -> Bool)
-> (NotificationReason -> NotificationReason -> Bool)
-> (NotificationReason -> NotificationReason -> Bool)
-> (NotificationReason -> NotificationReason -> NotificationReason)
-> (NotificationReason -> NotificationReason -> NotificationReason)
-> Ord NotificationReason
NotificationReason -> NotificationReason -> Bool
NotificationReason -> NotificationReason -> Ordering
NotificationReason -> NotificationReason -> NotificationReason
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: NotificationReason -> NotificationReason -> Ordering
compare :: NotificationReason -> NotificationReason -> Ordering
$c< :: NotificationReason -> NotificationReason -> Bool
< :: NotificationReason -> NotificationReason -> Bool
$c<= :: NotificationReason -> NotificationReason -> Bool
<= :: NotificationReason -> NotificationReason -> Bool
$c> :: NotificationReason -> NotificationReason -> Bool
> :: NotificationReason -> NotificationReason -> Bool
$c>= :: NotificationReason -> NotificationReason -> Bool
>= :: NotificationReason -> NotificationReason -> Bool
$cmax :: NotificationReason -> NotificationReason -> NotificationReason
max :: NotificationReason -> NotificationReason -> NotificationReason
$cmin :: NotificationReason -> NotificationReason -> NotificationReason
min :: NotificationReason -> NotificationReason -> NotificationReason
Ord, (forall x. NotificationReason -> Rep NotificationReason x)
-> (forall x. Rep NotificationReason x -> NotificationReason)
-> Generic NotificationReason
forall x. Rep NotificationReason x -> NotificationReason
forall x. NotificationReason -> Rep NotificationReason x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. NotificationReason -> Rep NotificationReason x
from :: forall x. NotificationReason -> Rep NotificationReason x
$cto :: forall x. Rep NotificationReason x -> NotificationReason
to :: forall x. Rep NotificationReason x -> NotificationReason
Generic)

instance NFData NotificationReason where rnf :: NotificationReason -> ()
rnf = NotificationReason -> ()
forall a. (Generic a, GNFData (Rep a)) => a -> ()
genericRnf
instance Binary NotificationReason

instance FromJSON NotificationReason where
    parseJSON :: Value -> Parser NotificationReason
parseJSON = String
-> (Text -> Parser NotificationReason)
-> Value
-> Parser NotificationReason
forall a. String -> (Text -> Parser a) -> Value -> Parser a
withText String
"NotificationReason" ((Text -> Parser NotificationReason)
 -> Value -> Parser NotificationReason)
-> (Text -> Parser NotificationReason)
-> Value
-> Parser NotificationReason
forall a b. (a -> b) -> a -> b
$ \Text
t -> case Text -> Text
T.toLower Text
t of
        Text
"assign"           -> NotificationReason -> Parser NotificationReason
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure NotificationReason
AssignReason
        Text
"author"           -> NotificationReason -> Parser NotificationReason
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure NotificationReason
AuthorReason
        Text
"comment"          -> NotificationReason -> Parser NotificationReason
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure NotificationReason
CommentReason
        Text
"invitation"       -> NotificationReason -> Parser NotificationReason
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure NotificationReason
InvitationReason
        Text
"manual"           -> NotificationReason -> Parser NotificationReason
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure NotificationReason
ManualReason
        Text
"mention"          -> NotificationReason -> Parser NotificationReason
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure NotificationReason
MentionReason
        Text
"review_requested" -> NotificationReason -> Parser NotificationReason
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure NotificationReason
ReviewRequestedReason
        Text
"state_change"     -> NotificationReason -> Parser NotificationReason
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure NotificationReason
StateChangeReason
        Text
"subscribed"       -> NotificationReason -> Parser NotificationReason
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure NotificationReason
SubscribedReason
        Text
"team_mention"     -> NotificationReason -> Parser NotificationReason
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure NotificationReason
TeamMentionReason
        Text
_                  -> String -> Parser NotificationReason
forall a. String -> Parser a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> Parser NotificationReason)
-> String -> Parser NotificationReason
forall a b. (a -> b) -> a -> b
$ String
"Unknown NotificationReason " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Text -> String
forall a. Show a => a -> String
show Text
t

data Notification = Notification
    -- XXX: The notification id field type IS in fact string. Not sure why gh
    -- chose to do this when all the other ids are Numbers...
    { Notification -> Id Notification
notificationId :: !(Id Notification)
    , Notification -> RepoRef
notificationRepo :: !RepoRef
    , Notification -> Subject
notificationSubject :: !Subject
    , Notification -> NotificationReason
notificationReason :: !NotificationReason
    , Notification -> Bool
notificationUnread :: !Bool
    , Notification -> Maybe UTCTime
notificationUpdatedAt :: !(Maybe UTCTime)
    , Notification -> Maybe UTCTime
notificationLastReadAt :: !(Maybe UTCTime)
    , Notification -> URL
notificationUrl :: !URL
    }
  deriving (Int -> Notification -> ShowS
[Notification] -> ShowS
Notification -> String
(Int -> Notification -> ShowS)
-> (Notification -> String)
-> ([Notification] -> ShowS)
-> Show Notification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Notification -> ShowS
showsPrec :: Int -> Notification -> ShowS
$cshow :: Notification -> String
show :: Notification -> String
$cshowList :: [Notification] -> ShowS
showList :: [Notification] -> ShowS
Show, Typeable Notification
Typeable Notification =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> Notification -> c Notification)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Notification)
-> (Notification -> Constr)
-> (Notification -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Notification))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c Notification))
-> ((forall b. Data b => b -> b) -> Notification -> Notification)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Notification -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Notification -> r)
-> (forall u. (forall d. Data d => d -> u) -> Notification -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> Notification -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Notification -> m Notification)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Notification -> m Notification)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Notification -> m Notification)
-> Data Notification
Notification -> Constr
Notification -> DataType
(forall b. Data b => b -> b) -> Notification -> Notification
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Notification -> u
forall u. (forall d. Data d => d -> u) -> Notification -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Notification -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Notification -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Notification -> m Notification
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Notification -> m Notification
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Notification
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Notification -> c Notification
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Notification)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c Notification)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Notification -> c Notification
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Notification -> c Notification
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Notification
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Notification
$ctoConstr :: Notification -> Constr
toConstr :: Notification -> Constr
$cdataTypeOf :: Notification -> DataType
dataTypeOf :: Notification -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Notification)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Notification)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c Notification)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c Notification)
$cgmapT :: (forall b. Data b => b -> b) -> Notification -> Notification
gmapT :: (forall b. Data b => b -> b) -> Notification -> Notification
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Notification -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Notification -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Notification -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Notification -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Notification -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> Notification -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Notification -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Notification -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Notification -> m Notification
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Notification -> m Notification
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Notification -> m Notification
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Notification -> m Notification
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Notification -> m Notification
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Notification -> m Notification
Data, Typeable, Notification -> Notification -> Bool
(Notification -> Notification -> Bool)
-> (Notification -> Notification -> Bool) -> Eq Notification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Notification -> Notification -> Bool
== :: Notification -> Notification -> Bool
$c/= :: Notification -> Notification -> Bool
/= :: Notification -> Notification -> Bool
Eq, Eq Notification
Eq Notification =>
(Notification -> Notification -> Ordering)
-> (Notification -> Notification -> Bool)
-> (Notification -> Notification -> Bool)
-> (Notification -> Notification -> Bool)
-> (Notification -> Notification -> Bool)
-> (Notification -> Notification -> Notification)
-> (Notification -> Notification -> Notification)
-> Ord Notification
Notification -> Notification -> Bool
Notification -> Notification -> Ordering
Notification -> Notification -> Notification
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Notification -> Notification -> Ordering
compare :: Notification -> Notification -> Ordering
$c< :: Notification -> Notification -> Bool
< :: Notification -> Notification -> Bool
$c<= :: Notification -> Notification -> Bool
<= :: Notification -> Notification -> Bool
$c> :: Notification -> Notification -> Bool
> :: Notification -> Notification -> Bool
$c>= :: Notification -> Notification -> Bool
>= :: Notification -> Notification -> Bool
$cmax :: Notification -> Notification -> Notification
max :: Notification -> Notification -> Notification
$cmin :: Notification -> Notification -> Notification
min :: Notification -> Notification -> Notification
Ord, (forall x. Notification -> Rep Notification x)
-> (forall x. Rep Notification x -> Notification)
-> Generic Notification
forall x. Rep Notification x -> Notification
forall x. Notification -> Rep Notification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Notification -> Rep Notification x
from :: forall x. Notification -> Rep Notification x
$cto :: forall x. Rep Notification x -> Notification
to :: forall x. Rep Notification x -> Notification
Generic)

instance NFData Notification where rnf :: Notification -> ()
rnf = Notification -> ()
forall a. (Generic a, GNFData (Rep a)) => a -> ()
genericRnf
instance Binary Notification

instance FromJSON Notification where
    parseJSON :: Value -> Parser Notification
parseJSON = String
-> (Object -> Parser Notification) -> Value -> Parser Notification
forall a. String -> (Object -> Parser a) -> Value -> Parser a
withObject String
"Notification" ((Object -> Parser Notification) -> Value -> Parser Notification)
-> (Object -> Parser Notification) -> Value -> Parser Notification
forall a b. (a -> b) -> a -> b
$ \Object
o -> Id Notification
-> RepoRef
-> Subject
-> NotificationReason
-> Bool
-> Maybe UTCTime
-> Maybe UTCTime
-> URL
-> Notification
Notification
        (Id Notification
 -> RepoRef
 -> Subject
 -> NotificationReason
 -> Bool
 -> Maybe UTCTime
 -> Maybe UTCTime
 -> URL
 -> Notification)
-> Parser (Id Notification)
-> Parser
     (RepoRef
      -> Subject
      -> NotificationReason
      -> Bool
      -> Maybe UTCTime
      -> Maybe UTCTime
      -> URL
      -> Notification)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Any Notification -> Int -> Id Notification
forall (proxy :: * -> *) entity. proxy entity -> Int -> Id entity
mkId Any Notification
forall a. HasCallStack => a
undefined (Int -> Id Notification)
-> (String -> Int) -> String -> Id Notification
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Int
forall a. Read a => String -> a
read (String -> Id Notification)
-> Parser String -> Parser (Id Notification)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser String
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"id")
        Parser
  (RepoRef
   -> Subject
   -> NotificationReason
   -> Bool
   -> Maybe UTCTime
   -> Maybe UTCTime
   -> URL
   -> Notification)
-> Parser RepoRef
-> Parser
     (Subject
      -> NotificationReason
      -> Bool
      -> Maybe UTCTime
      -> Maybe UTCTime
      -> URL
      -> Notification)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser RepoRef
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"repository"
        Parser
  (Subject
   -> NotificationReason
   -> Bool
   -> Maybe UTCTime
   -> Maybe UTCTime
   -> URL
   -> Notification)
-> Parser Subject
-> Parser
     (NotificationReason
      -> Bool -> Maybe UTCTime -> Maybe UTCTime -> URL -> Notification)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser Subject
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"subject"
        Parser
  (NotificationReason
   -> Bool -> Maybe UTCTime -> Maybe UTCTime -> URL -> Notification)
-> Parser NotificationReason
-> Parser
     (Bool -> Maybe UTCTime -> Maybe UTCTime -> URL -> Notification)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser NotificationReason
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"reason"
        Parser
  (Bool -> Maybe UTCTime -> Maybe UTCTime -> URL -> Notification)
-> Parser Bool
-> Parser (Maybe UTCTime -> Maybe UTCTime -> URL -> Notification)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser Bool
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"unread"
        Parser (Maybe UTCTime -> Maybe UTCTime -> URL -> Notification)
-> Parser (Maybe UTCTime)
-> Parser (Maybe UTCTime -> URL -> Notification)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser (Maybe UTCTime)
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"updated_at"
        Parser (Maybe UTCTime -> URL -> Notification)
-> Parser (Maybe UTCTime) -> Parser (URL -> Notification)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser (Maybe UTCTime)
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"last_read_at"
        Parser (URL -> Notification) -> Parser URL -> Parser Notification
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser URL
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"url"