module TD.Data.EmojiReaction
(EmojiReaction(..)) 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
import qualified TD.Data.Sticker as Sticker
data EmojiReaction
= EmojiReaction
{ EmojiReaction -> Maybe Text
emoji :: Maybe T.Text
, EmojiReaction -> Maybe Text
title :: Maybe T.Text
, EmojiReaction -> Maybe Bool
is_active :: Maybe Bool
, EmojiReaction -> Maybe Sticker
static_icon :: Maybe Sticker.Sticker
, EmojiReaction -> Maybe Sticker
appear_animation :: Maybe Sticker.Sticker
, EmojiReaction -> Maybe Sticker
select_animation :: Maybe Sticker.Sticker
, EmojiReaction -> Maybe Sticker
activate_animation :: Maybe Sticker.Sticker
, EmojiReaction -> Maybe Sticker
effect_animation :: Maybe Sticker.Sticker
, EmojiReaction -> Maybe Sticker
around_animation :: Maybe Sticker.Sticker
, EmojiReaction -> Maybe Sticker
center_animation :: Maybe Sticker.Sticker
}
deriving (EmojiReaction -> EmojiReaction -> Bool
(EmojiReaction -> EmojiReaction -> Bool)
-> (EmojiReaction -> EmojiReaction -> Bool) -> Eq EmojiReaction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EmojiReaction -> EmojiReaction -> Bool
== :: EmojiReaction -> EmojiReaction -> Bool
$c/= :: EmojiReaction -> EmojiReaction -> Bool
/= :: EmojiReaction -> EmojiReaction -> Bool
Eq, Int -> EmojiReaction -> ShowS
[EmojiReaction] -> ShowS
EmojiReaction -> String
(Int -> EmojiReaction -> ShowS)
-> (EmojiReaction -> String)
-> ([EmojiReaction] -> ShowS)
-> Show EmojiReaction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EmojiReaction -> ShowS
showsPrec :: Int -> EmojiReaction -> ShowS
$cshow :: EmojiReaction -> String
show :: EmojiReaction -> String
$cshowList :: [EmojiReaction] -> ShowS
showList :: [EmojiReaction] -> ShowS
Show)
instance I.ShortShow EmojiReaction where
shortShow :: EmojiReaction -> String
shortShow EmojiReaction
{ emoji :: EmojiReaction -> Maybe Text
emoji = Maybe Text
emoji_
, title :: EmojiReaction -> Maybe Text
title = Maybe Text
title_
, is_active :: EmojiReaction -> Maybe Bool
is_active = Maybe Bool
is_active_
, static_icon :: EmojiReaction -> Maybe Sticker
static_icon = Maybe Sticker
static_icon_
, appear_animation :: EmojiReaction -> Maybe Sticker
appear_animation = Maybe Sticker
appear_animation_
, select_animation :: EmojiReaction -> Maybe Sticker
select_animation = Maybe Sticker
select_animation_
, activate_animation :: EmojiReaction -> Maybe Sticker
activate_animation = Maybe Sticker
activate_animation_
, effect_animation :: EmojiReaction -> Maybe Sticker
effect_animation = Maybe Sticker
effect_animation_
, around_animation :: EmojiReaction -> Maybe Sticker
around_animation = Maybe Sticker
around_animation_
, center_animation :: EmojiReaction -> Maybe Sticker
center_animation = Maybe Sticker
center_animation_
}
= String
"EmojiReaction"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"emoji" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
emoji_
, String
"title" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
title_
, String
"is_active" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_active_
, String
"static_icon" String -> Maybe Sticker -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Sticker
static_icon_
, String
"appear_animation" String -> Maybe Sticker -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Sticker
appear_animation_
, String
"select_animation" String -> Maybe Sticker -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Sticker
select_animation_
, String
"activate_animation" String -> Maybe Sticker -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Sticker
activate_animation_
, String
"effect_animation" String -> Maybe Sticker -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Sticker
effect_animation_
, String
"around_animation" String -> Maybe Sticker -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Sticker
around_animation_
, String
"center_animation" String -> Maybe Sticker -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Sticker
center_animation_
]
instance AT.FromJSON EmojiReaction where
parseJSON :: Value -> Parser EmojiReaction
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
"emojiReaction" -> Value -> Parser EmojiReaction
parseEmojiReaction Value
v
String
_ -> Parser EmojiReaction
forall a. Monoid a => a
mempty
where
parseEmojiReaction :: A.Value -> AT.Parser EmojiReaction
parseEmojiReaction :: Value -> Parser EmojiReaction
parseEmojiReaction = String
-> (Object -> Parser EmojiReaction)
-> Value
-> Parser EmojiReaction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"EmojiReaction" ((Object -> Parser EmojiReaction) -> Value -> Parser EmojiReaction)
-> (Object -> Parser EmojiReaction)
-> Value
-> Parser EmojiReaction
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
emoji_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"emoji"
Maybe Text
title_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"title"
Maybe Bool
is_active_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"is_active"
Maybe Sticker
static_icon_ <- Object
o Object -> Key -> Parser (Maybe Sticker)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"static_icon"
Maybe Sticker
appear_animation_ <- Object
o Object -> Key -> Parser (Maybe Sticker)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"appear_animation"
Maybe Sticker
select_animation_ <- Object
o Object -> Key -> Parser (Maybe Sticker)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"select_animation"
Maybe Sticker
activate_animation_ <- Object
o Object -> Key -> Parser (Maybe Sticker)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"activate_animation"
Maybe Sticker
effect_animation_ <- Object
o Object -> Key -> Parser (Maybe Sticker)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"effect_animation"
Maybe Sticker
around_animation_ <- Object
o Object -> Key -> Parser (Maybe Sticker)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"around_animation"
Maybe Sticker
center_animation_ <- Object
o Object -> Key -> Parser (Maybe Sticker)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"center_animation"
EmojiReaction -> Parser EmojiReaction
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (EmojiReaction -> Parser EmojiReaction)
-> EmojiReaction -> Parser EmojiReaction
forall a b. (a -> b) -> a -> b
$ EmojiReaction
{ emoji :: Maybe Text
emoji = Maybe Text
emoji_
, title :: Maybe Text
title = Maybe Text
title_
, is_active :: Maybe Bool
is_active = Maybe Bool
is_active_
, static_icon :: Maybe Sticker
static_icon = Maybe Sticker
static_icon_
, appear_animation :: Maybe Sticker
appear_animation = Maybe Sticker
appear_animation_
, select_animation :: Maybe Sticker
select_animation = Maybe Sticker
select_animation_
, activate_animation :: Maybe Sticker
activate_animation = Maybe Sticker
activate_animation_
, effect_animation :: Maybe Sticker
effect_animation = Maybe Sticker
effect_animation_
, around_animation :: Maybe Sticker
around_animation = Maybe Sticker
around_animation_
, center_animation :: Maybe Sticker
center_animation = Maybe Sticker
center_animation_
}
parseJSON Value
_ = Parser EmojiReaction
forall a. Monoid a => a
mempty