module TD.Data.UpgradedGiftCollectionNames
(UpgradedGiftCollectionNames(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified Data.Text as T
data UpgradedGiftCollectionNames
= UpgradedGiftCollectionNames
{ UpgradedGiftCollectionNames -> Maybe [Text]
names :: Maybe [T.Text]
}
deriving (UpgradedGiftCollectionNames -> UpgradedGiftCollectionNames -> Bool
(UpgradedGiftCollectionNames
-> UpgradedGiftCollectionNames -> Bool)
-> (UpgradedGiftCollectionNames
-> UpgradedGiftCollectionNames -> Bool)
-> Eq UpgradedGiftCollectionNames
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UpgradedGiftCollectionNames -> UpgradedGiftCollectionNames -> Bool
== :: UpgradedGiftCollectionNames -> UpgradedGiftCollectionNames -> Bool
$c/= :: UpgradedGiftCollectionNames -> UpgradedGiftCollectionNames -> Bool
/= :: UpgradedGiftCollectionNames -> UpgradedGiftCollectionNames -> Bool
Eq, Int -> UpgradedGiftCollectionNames -> ShowS
[UpgradedGiftCollectionNames] -> ShowS
UpgradedGiftCollectionNames -> String
(Int -> UpgradedGiftCollectionNames -> ShowS)
-> (UpgradedGiftCollectionNames -> String)
-> ([UpgradedGiftCollectionNames] -> ShowS)
-> Show UpgradedGiftCollectionNames
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UpgradedGiftCollectionNames -> ShowS
showsPrec :: Int -> UpgradedGiftCollectionNames -> ShowS
$cshow :: UpgradedGiftCollectionNames -> String
show :: UpgradedGiftCollectionNames -> String
$cshowList :: [UpgradedGiftCollectionNames] -> ShowS
showList :: [UpgradedGiftCollectionNames] -> ShowS
Show)
instance I.ShortShow UpgradedGiftCollectionNames where
shortShow :: UpgradedGiftCollectionNames -> String
shortShow UpgradedGiftCollectionNames
{ names :: UpgradedGiftCollectionNames -> Maybe [Text]
names = Maybe [Text]
names_
}
= String
"UpgradedGiftCollectionNames"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"names" String -> Maybe [Text] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [Text]
names_
]
instance AT.FromJSON UpgradedGiftCollectionNames where
parseJSON :: Value -> Parser UpgradedGiftCollectionNames
parseJSON v :: Value
v@(AT.Object Object
obj) = do
String
t <- Object
obj Object -> Key -> Parser String
forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"@type" :: AT.Parser String
case String
t of
String
"upgradedGiftCollectionNames" -> Value -> Parser UpgradedGiftCollectionNames
parseUpgradedGiftCollectionNames Value
v
String
_ -> Parser UpgradedGiftCollectionNames
forall a. Monoid a => a
mempty
where
parseUpgradedGiftCollectionNames :: A.Value -> AT.Parser UpgradedGiftCollectionNames
parseUpgradedGiftCollectionNames :: Value -> Parser UpgradedGiftCollectionNames
parseUpgradedGiftCollectionNames = String
-> (Object -> Parser UpgradedGiftCollectionNames)
-> Value
-> Parser UpgradedGiftCollectionNames
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"UpgradedGiftCollectionNames" ((Object -> Parser UpgradedGiftCollectionNames)
-> Value -> Parser UpgradedGiftCollectionNames)
-> (Object -> Parser UpgradedGiftCollectionNames)
-> Value
-> Parser UpgradedGiftCollectionNames
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe [Text]
names_ <- Object
o Object -> Key -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"names"
UpgradedGiftCollectionNames -> Parser UpgradedGiftCollectionNames
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (UpgradedGiftCollectionNames -> Parser UpgradedGiftCollectionNames)
-> UpgradedGiftCollectionNames
-> Parser UpgradedGiftCollectionNames
forall a b. (a -> b) -> a -> b
$ UpgradedGiftCollectionNames
{ names :: Maybe [Text]
names = Maybe [Text]
names_
}
parseJSON Value
_ = Parser UpgradedGiftCollectionNames
forall a. Monoid a => a
mempty