module TD.Query.AddLocalMessage
(AddLocalMessage(..)
, defaultAddLocalMessage
) 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.MessageSender as MessageSender
import qualified TD.Data.InputMessageReplyTo as InputMessageReplyTo
import qualified TD.Data.InputMessageContent as InputMessageContent
data AddLocalMessage
= AddLocalMessage
{ AddLocalMessage -> Maybe Int
chat_id :: Maybe Int
, AddLocalMessage -> Maybe MessageSender
sender_id :: Maybe MessageSender.MessageSender
, AddLocalMessage -> Maybe InputMessageReplyTo
reply_to :: Maybe InputMessageReplyTo.InputMessageReplyTo
, AddLocalMessage -> Maybe Bool
disable_notification :: Maybe Bool
, AddLocalMessage -> Maybe InputMessageContent
input_message_content :: Maybe InputMessageContent.InputMessageContent
}
deriving (AddLocalMessage -> AddLocalMessage -> Bool
(AddLocalMessage -> AddLocalMessage -> Bool)
-> (AddLocalMessage -> AddLocalMessage -> Bool)
-> Eq AddLocalMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AddLocalMessage -> AddLocalMessage -> Bool
== :: AddLocalMessage -> AddLocalMessage -> Bool
$c/= :: AddLocalMessage -> AddLocalMessage -> Bool
/= :: AddLocalMessage -> AddLocalMessage -> Bool
Eq, Int -> AddLocalMessage -> ShowS
[AddLocalMessage] -> ShowS
AddLocalMessage -> String
(Int -> AddLocalMessage -> ShowS)
-> (AddLocalMessage -> String)
-> ([AddLocalMessage] -> ShowS)
-> Show AddLocalMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AddLocalMessage -> ShowS
showsPrec :: Int -> AddLocalMessage -> ShowS
$cshow :: AddLocalMessage -> String
show :: AddLocalMessage -> String
$cshowList :: [AddLocalMessage] -> ShowS
showList :: [AddLocalMessage] -> ShowS
Show)
instance I.ShortShow AddLocalMessage where
shortShow :: AddLocalMessage -> String
shortShow
AddLocalMessage
{ chat_id :: AddLocalMessage -> Maybe Int
chat_id = Maybe Int
chat_id_
, sender_id :: AddLocalMessage -> Maybe MessageSender
sender_id = Maybe MessageSender
sender_id_
, reply_to :: AddLocalMessage -> Maybe InputMessageReplyTo
reply_to = Maybe InputMessageReplyTo
reply_to_
, disable_notification :: AddLocalMessage -> Maybe Bool
disable_notification = Maybe Bool
disable_notification_
, input_message_content :: AddLocalMessage -> Maybe InputMessageContent
input_message_content = Maybe InputMessageContent
input_message_content_
}
= String
"AddLocalMessage"
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
"sender_id" String -> Maybe MessageSender -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe MessageSender
sender_id_
, String
"reply_to" String -> Maybe InputMessageReplyTo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputMessageReplyTo
reply_to_
, String
"disable_notification" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
disable_notification_
, String
"input_message_content" String -> Maybe InputMessageContent -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputMessageContent
input_message_content_
]
instance AT.ToJSON AddLocalMessage where
toJSON :: AddLocalMessage -> Value
toJSON
AddLocalMessage
{ chat_id :: AddLocalMessage -> Maybe Int
chat_id = Maybe Int
chat_id_
, sender_id :: AddLocalMessage -> Maybe MessageSender
sender_id = Maybe MessageSender
sender_id_
, reply_to :: AddLocalMessage -> Maybe InputMessageReplyTo
reply_to = Maybe InputMessageReplyTo
reply_to_
, disable_notification :: AddLocalMessage -> Maybe Bool
disable_notification = Maybe Bool
disable_notification_
, input_message_content :: AddLocalMessage -> Maybe InputMessageContent
input_message_content = Maybe InputMessageContent
input_message_content_
}
= [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
"addLocalMessage"
, 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
"sender_id" Key -> Maybe MessageSender -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe MessageSender
sender_id_
, Key
"reply_to" Key -> Maybe InputMessageReplyTo -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputMessageReplyTo
reply_to_
, Key
"disable_notification" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
disable_notification_
, Key
"input_message_content" Key -> Maybe InputMessageContent -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputMessageContent
input_message_content_
]
defaultAddLocalMessage :: AddLocalMessage
defaultAddLocalMessage :: AddLocalMessage
defaultAddLocalMessage =
AddLocalMessage
{ chat_id :: Maybe Int
chat_id = Maybe Int
forall a. Maybe a
Nothing
, sender_id :: Maybe MessageSender
sender_id = Maybe MessageSender
forall a. Maybe a
Nothing
, reply_to :: Maybe InputMessageReplyTo
reply_to = Maybe InputMessageReplyTo
forall a. Maybe a
Nothing
, disable_notification :: Maybe Bool
disable_notification = Maybe Bool
forall a. Maybe a
Nothing
, input_message_content :: Maybe InputMessageContent
input_message_content = Maybe InputMessageContent
forall a. Maybe a
Nothing
}