module TD.Query.AddMessageReaction
(AddMessageReaction(..)
, defaultAddMessageReaction
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified TD.Data.ReactionType as ReactionType
data AddMessageReaction
= AddMessageReaction
{ AddMessageReaction -> Maybe Int
chat_id :: Maybe Int
, AddMessageReaction -> Maybe Int
message_id :: Maybe Int
, AddMessageReaction -> Maybe ReactionType
reaction_type :: Maybe ReactionType.ReactionType
, AddMessageReaction -> Maybe Bool
is_big :: Maybe Bool
, AddMessageReaction -> Maybe Bool
update_recent_reactions :: Maybe Bool
}
deriving (AddMessageReaction -> AddMessageReaction -> Bool
(AddMessageReaction -> AddMessageReaction -> Bool)
-> (AddMessageReaction -> AddMessageReaction -> Bool)
-> Eq AddMessageReaction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AddMessageReaction -> AddMessageReaction -> Bool
== :: AddMessageReaction -> AddMessageReaction -> Bool
$c/= :: AddMessageReaction -> AddMessageReaction -> Bool
/= :: AddMessageReaction -> AddMessageReaction -> Bool
Eq, Int -> AddMessageReaction -> ShowS
[AddMessageReaction] -> ShowS
AddMessageReaction -> String
(Int -> AddMessageReaction -> ShowS)
-> (AddMessageReaction -> String)
-> ([AddMessageReaction] -> ShowS)
-> Show AddMessageReaction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AddMessageReaction -> ShowS
showsPrec :: Int -> AddMessageReaction -> ShowS
$cshow :: AddMessageReaction -> String
show :: AddMessageReaction -> String
$cshowList :: [AddMessageReaction] -> ShowS
showList :: [AddMessageReaction] -> ShowS
Show)
instance I.ShortShow AddMessageReaction where
shortShow :: AddMessageReaction -> String
shortShow
AddMessageReaction
{ chat_id :: AddMessageReaction -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_id :: AddMessageReaction -> Maybe Int
message_id = Maybe Int
message_id_
, reaction_type :: AddMessageReaction -> Maybe ReactionType
reaction_type = Maybe ReactionType
reaction_type_
, is_big :: AddMessageReaction -> Maybe Bool
is_big = Maybe Bool
is_big_
, update_recent_reactions :: AddMessageReaction -> Maybe Bool
update_recent_reactions = Maybe Bool
update_recent_reactions_
}
= String
"AddMessageReaction"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"chat_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_id_
, String
"message_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
message_id_
, String
"reaction_type" String -> Maybe ReactionType -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ReactionType
reaction_type_
, String
"is_big" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_big_
, String
"update_recent_reactions" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
update_recent_reactions_
]
instance AT.ToJSON AddMessageReaction where
toJSON :: AddMessageReaction -> Value
toJSON
AddMessageReaction
{ chat_id :: AddMessageReaction -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_id :: AddMessageReaction -> Maybe Int
message_id = Maybe Int
message_id_
, reaction_type :: AddMessageReaction -> Maybe ReactionType
reaction_type = Maybe ReactionType
reaction_type_
, is_big :: AddMessageReaction -> Maybe Bool
is_big = Maybe Bool
is_big_
, update_recent_reactions :: AddMessageReaction -> Maybe Bool
update_recent_reactions = Maybe Bool
update_recent_reactions_
}
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"addMessageReaction"
, Key
"chat_id" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
chat_id_
, Key
"message_id" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
message_id_
, Key
"reaction_type" Key -> Maybe ReactionType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe ReactionType
reaction_type_
, Key
"is_big" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
is_big_
, Key
"update_recent_reactions" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
update_recent_reactions_
]
defaultAddMessageReaction :: AddMessageReaction
defaultAddMessageReaction :: AddMessageReaction
defaultAddMessageReaction =
AddMessageReaction
{ chat_id :: Maybe Int
chat_id = Maybe Int
forall a. Maybe a
Nothing
, message_id :: Maybe Int
message_id = Maybe Int
forall a. Maybe a
Nothing
, reaction_type :: Maybe ReactionType
reaction_type = Maybe ReactionType
forall a. Maybe a
Nothing
, is_big :: Maybe Bool
is_big = Maybe Bool
forall a. Maybe a
Nothing
, update_recent_reactions :: Maybe Bool
update_recent_reactions = Maybe Bool
forall a. Maybe a
Nothing
}