module TD.Query.SendMessage
(SendMessage(..)
, defaultSendMessage
) 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.InputMessageReplyTo as InputMessageReplyTo
import qualified TD.Data.MessageSendOptions as MessageSendOptions
import qualified TD.Data.ReplyMarkup as ReplyMarkup
import qualified TD.Data.InputMessageContent as InputMessageContent
data SendMessage
= SendMessage
{ SendMessage -> Maybe Int
chat_id :: Maybe Int
, SendMessage -> Maybe Int
message_thread_id :: Maybe Int
, SendMessage -> Maybe InputMessageReplyTo
reply_to :: Maybe InputMessageReplyTo.InputMessageReplyTo
, SendMessage -> Maybe MessageSendOptions
options :: Maybe MessageSendOptions.MessageSendOptions
, SendMessage -> Maybe ReplyMarkup
reply_markup :: Maybe ReplyMarkup.ReplyMarkup
, SendMessage -> Maybe InputMessageContent
input_message_content :: Maybe InputMessageContent.InputMessageContent
}
deriving (SendMessage -> SendMessage -> Bool
(SendMessage -> SendMessage -> Bool)
-> (SendMessage -> SendMessage -> Bool) -> Eq SendMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SendMessage -> SendMessage -> Bool
== :: SendMessage -> SendMessage -> Bool
$c/= :: SendMessage -> SendMessage -> Bool
/= :: SendMessage -> SendMessage -> Bool
Eq, Int -> SendMessage -> ShowS
[SendMessage] -> ShowS
SendMessage -> String
(Int -> SendMessage -> ShowS)
-> (SendMessage -> String)
-> ([SendMessage] -> ShowS)
-> Show SendMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SendMessage -> ShowS
showsPrec :: Int -> SendMessage -> ShowS
$cshow :: SendMessage -> String
show :: SendMessage -> String
$cshowList :: [SendMessage] -> ShowS
showList :: [SendMessage] -> ShowS
Show)
instance I.ShortShow SendMessage where
shortShow :: SendMessage -> String
shortShow
SendMessage
{ chat_id :: SendMessage -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_thread_id :: SendMessage -> Maybe Int
message_thread_id = Maybe Int
message_thread_id_
, reply_to :: SendMessage -> Maybe InputMessageReplyTo
reply_to = Maybe InputMessageReplyTo
reply_to_
, options :: SendMessage -> Maybe MessageSendOptions
options = Maybe MessageSendOptions
options_
, reply_markup :: SendMessage -> Maybe ReplyMarkup
reply_markup = Maybe ReplyMarkup
reply_markup_
, input_message_content :: SendMessage -> Maybe InputMessageContent
input_message_content = Maybe InputMessageContent
input_message_content_
}
= String
"SendMessage"
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_thread_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
message_thread_id_
, String
"reply_to" String -> Maybe InputMessageReplyTo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputMessageReplyTo
reply_to_
, String
"options" String -> Maybe MessageSendOptions -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe MessageSendOptions
options_
, String
"reply_markup" String -> Maybe ReplyMarkup -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ReplyMarkup
reply_markup_
, 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 SendMessage where
toJSON :: SendMessage -> Value
toJSON
SendMessage
{ chat_id :: SendMessage -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_thread_id :: SendMessage -> Maybe Int
message_thread_id = Maybe Int
message_thread_id_
, reply_to :: SendMessage -> Maybe InputMessageReplyTo
reply_to = Maybe InputMessageReplyTo
reply_to_
, options :: SendMessage -> Maybe MessageSendOptions
options = Maybe MessageSendOptions
options_
, reply_markup :: SendMessage -> Maybe ReplyMarkup
reply_markup = Maybe ReplyMarkup
reply_markup_
, input_message_content :: SendMessage -> 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
"sendMessage"
, 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_thread_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_thread_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
"options" Key -> Maybe MessageSendOptions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe MessageSendOptions
options_
, Key
"reply_markup" Key -> Maybe ReplyMarkup -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe ReplyMarkup
reply_markup_
, 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_
]
defaultSendMessage :: SendMessage
defaultSendMessage :: SendMessage
defaultSendMessage =
SendMessage
{ chat_id :: Maybe Int
chat_id = Maybe Int
forall a. Maybe a
Nothing
, message_thread_id :: Maybe Int
message_thread_id = Maybe Int
forall a. Maybe a
Nothing
, reply_to :: Maybe InputMessageReplyTo
reply_to = Maybe InputMessageReplyTo
forall a. Maybe a
Nothing
, options :: Maybe MessageSendOptions
options = Maybe MessageSendOptions
forall a. Maybe a
Nothing
, reply_markup :: Maybe ReplyMarkup
reply_markup = Maybe ReplyMarkup
forall a. Maybe a
Nothing
, input_message_content :: Maybe InputMessageContent
input_message_content = Maybe InputMessageContent
forall a. Maybe a
Nothing
}