{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
module GitHub.Types.Base.ReviewLinks where
import Data.Aeson (FromJSON (..), ToJSON (..), object)
import Data.Aeson.Types (Value (..), (.:), (.=))
import Test.QuickCheck.Arbitrary (Arbitrary (..))
import GitHub.Types.Base.Link
data ReviewLinks = ReviewLinks
{ ReviewLinks -> Link
reviewLinksHtml :: Link
, ReviewLinks -> Link
reviewLinksPullRequest :: Link
} deriving (ReviewLinks -> ReviewLinks -> Bool
(ReviewLinks -> ReviewLinks -> Bool)
-> (ReviewLinks -> ReviewLinks -> Bool) -> Eq ReviewLinks
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReviewLinks -> ReviewLinks -> Bool
$c/= :: ReviewLinks -> ReviewLinks -> Bool
== :: ReviewLinks -> ReviewLinks -> Bool
$c== :: ReviewLinks -> ReviewLinks -> Bool
Eq, Int -> ReviewLinks -> ShowS
[ReviewLinks] -> ShowS
ReviewLinks -> String
(Int -> ReviewLinks -> ShowS)
-> (ReviewLinks -> String)
-> ([ReviewLinks] -> ShowS)
-> Show ReviewLinks
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReviewLinks] -> ShowS
$cshowList :: [ReviewLinks] -> ShowS
show :: ReviewLinks -> String
$cshow :: ReviewLinks -> String
showsPrec :: Int -> ReviewLinks -> ShowS
$cshowsPrec :: Int -> ReviewLinks -> ShowS
Show, ReadPrec [ReviewLinks]
ReadPrec ReviewLinks
Int -> ReadS ReviewLinks
ReadS [ReviewLinks]
(Int -> ReadS ReviewLinks)
-> ReadS [ReviewLinks]
-> ReadPrec ReviewLinks
-> ReadPrec [ReviewLinks]
-> Read ReviewLinks
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReviewLinks]
$creadListPrec :: ReadPrec [ReviewLinks]
readPrec :: ReadPrec ReviewLinks
$creadPrec :: ReadPrec ReviewLinks
readList :: ReadS [ReviewLinks]
$creadList :: ReadS [ReviewLinks]
readsPrec :: Int -> ReadS ReviewLinks
$creadsPrec :: Int -> ReadS ReviewLinks
Read)
instance FromJSON ReviewLinks where
parseJSON :: Value -> Parser ReviewLinks
parseJSON (Object Object
x) = Link -> Link -> ReviewLinks
ReviewLinks
(Link -> Link -> ReviewLinks)
-> Parser Link -> Parser (Link -> ReviewLinks)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
x Object -> Key -> Parser Link
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"html"
Parser (Link -> ReviewLinks) -> Parser Link -> Parser ReviewLinks
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
x Object -> Key -> Parser Link
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"pull_request"
parseJSON Value
_ = String -> Parser ReviewLinks
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"ReviewLinks"
instance ToJSON ReviewLinks where
toJSON :: ReviewLinks -> Value
toJSON ReviewLinks{Link
reviewLinksPullRequest :: Link
reviewLinksHtml :: Link
reviewLinksPullRequest :: ReviewLinks -> Link
reviewLinksHtml :: ReviewLinks -> Link
..} = [Pair] -> Value
object
[ Key
"html" Key -> Link -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Link
reviewLinksHtml
, Key
"pull_request" Key -> Link -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Link
reviewLinksPullRequest
]
instance Arbitrary ReviewLinks where
arbitrary :: Gen ReviewLinks
arbitrary = Link -> Link -> ReviewLinks
ReviewLinks
(Link -> Link -> ReviewLinks)
-> Gen Link -> Gen (Link -> ReviewLinks)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen Link
forall a. Arbitrary a => Gen a
arbitrary
Gen (Link -> ReviewLinks) -> Gen Link -> Gen ReviewLinks
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Gen Link
forall a. Arbitrary a => Gen a
arbitrary