{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
module Discord.Internal.Types.ApplicationInfo where
import Data.Aeson
import qualified Data.Text as T
import Discord.Internal.Types.Prelude
data FullApplication = FullApplication
{ FullApplication -> ApplicationId
fullApplicationID :: ApplicationId
, FullApplication -> Text
fullApplicationName :: T.Text
, FullApplication -> Int
fullApplicationFlags :: Int
} deriving (Int -> FullApplication -> ShowS
[FullApplication] -> ShowS
FullApplication -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FullApplication] -> ShowS
$cshowList :: [FullApplication] -> ShowS
show :: FullApplication -> String
$cshow :: FullApplication -> String
showsPrec :: Int -> FullApplication -> ShowS
$cshowsPrec :: Int -> FullApplication -> ShowS
Show, FullApplication -> FullApplication -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FullApplication -> FullApplication -> Bool
$c/= :: FullApplication -> FullApplication -> Bool
== :: FullApplication -> FullApplication -> Bool
$c== :: FullApplication -> FullApplication -> Bool
Eq, ReadPrec [FullApplication]
ReadPrec FullApplication
Int -> ReadS FullApplication
ReadS [FullApplication]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FullApplication]
$creadListPrec :: ReadPrec [FullApplication]
readPrec :: ReadPrec FullApplication
$creadPrec :: ReadPrec FullApplication
readList :: ReadS [FullApplication]
$creadList :: ReadS [FullApplication]
readsPrec :: Int -> ReadS FullApplication
$creadsPrec :: Int -> ReadS FullApplication
Read)
instance FromJSON FullApplication where
parseJSON :: Value -> Parser FullApplication
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
withObject String
"FullApplication" forall a b. (a -> b) -> a -> b
$ \Object
o ->
ApplicationId -> Text -> Int -> FullApplication
FullApplication forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"id"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"name"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"flags"