module TD.Query.SendInlineQueryResultMessage
(SendInlineQueryResultMessage(..)
, defaultSendInlineQueryResultMessage
) 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 Data.Text as T
data SendInlineQueryResultMessage
= SendInlineQueryResultMessage
{ SendInlineQueryResultMessage -> Maybe Int
chat_id :: Maybe Int
, SendInlineQueryResultMessage -> Maybe Int
message_thread_id :: Maybe Int
, SendInlineQueryResultMessage -> Maybe InputMessageReplyTo
reply_to :: Maybe InputMessageReplyTo.InputMessageReplyTo
, SendInlineQueryResultMessage -> Maybe MessageSendOptions
options :: Maybe MessageSendOptions.MessageSendOptions
, SendInlineQueryResultMessage -> Maybe Int
query_id :: Maybe Int
, SendInlineQueryResultMessage -> Maybe Text
result_id :: Maybe T.Text
, SendInlineQueryResultMessage -> Maybe Bool
hide_via_bot :: Maybe Bool
}
deriving (SendInlineQueryResultMessage
-> SendInlineQueryResultMessage -> Bool
(SendInlineQueryResultMessage
-> SendInlineQueryResultMessage -> Bool)
-> (SendInlineQueryResultMessage
-> SendInlineQueryResultMessage -> Bool)
-> Eq SendInlineQueryResultMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SendInlineQueryResultMessage
-> SendInlineQueryResultMessage -> Bool
== :: SendInlineQueryResultMessage
-> SendInlineQueryResultMessage -> Bool
$c/= :: SendInlineQueryResultMessage
-> SendInlineQueryResultMessage -> Bool
/= :: SendInlineQueryResultMessage
-> SendInlineQueryResultMessage -> Bool
Eq, Int -> SendInlineQueryResultMessage -> ShowS
[SendInlineQueryResultMessage] -> ShowS
SendInlineQueryResultMessage -> String
(Int -> SendInlineQueryResultMessage -> ShowS)
-> (SendInlineQueryResultMessage -> String)
-> ([SendInlineQueryResultMessage] -> ShowS)
-> Show SendInlineQueryResultMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SendInlineQueryResultMessage -> ShowS
showsPrec :: Int -> SendInlineQueryResultMessage -> ShowS
$cshow :: SendInlineQueryResultMessage -> String
show :: SendInlineQueryResultMessage -> String
$cshowList :: [SendInlineQueryResultMessage] -> ShowS
showList :: [SendInlineQueryResultMessage] -> ShowS
Show)
instance I.ShortShow SendInlineQueryResultMessage where
shortShow :: SendInlineQueryResultMessage -> String
shortShow
SendInlineQueryResultMessage
{ chat_id :: SendInlineQueryResultMessage -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_thread_id :: SendInlineQueryResultMessage -> Maybe Int
message_thread_id = Maybe Int
message_thread_id_
, reply_to :: SendInlineQueryResultMessage -> Maybe InputMessageReplyTo
reply_to = Maybe InputMessageReplyTo
reply_to_
, options :: SendInlineQueryResultMessage -> Maybe MessageSendOptions
options = Maybe MessageSendOptions
options_
, query_id :: SendInlineQueryResultMessage -> Maybe Int
query_id = Maybe Int
query_id_
, result_id :: SendInlineQueryResultMessage -> Maybe Text
result_id = Maybe Text
result_id_
, hide_via_bot :: SendInlineQueryResultMessage -> Maybe Bool
hide_via_bot = Maybe Bool
hide_via_bot_
}
= String
"SendInlineQueryResultMessage"
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
"query_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
query_id_
, String
"result_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
result_id_
, String
"hide_via_bot" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
hide_via_bot_
]
instance AT.ToJSON SendInlineQueryResultMessage where
toJSON :: SendInlineQueryResultMessage -> Value
toJSON
SendInlineQueryResultMessage
{ chat_id :: SendInlineQueryResultMessage -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_thread_id :: SendInlineQueryResultMessage -> Maybe Int
message_thread_id = Maybe Int
message_thread_id_
, reply_to :: SendInlineQueryResultMessage -> Maybe InputMessageReplyTo
reply_to = Maybe InputMessageReplyTo
reply_to_
, options :: SendInlineQueryResultMessage -> Maybe MessageSendOptions
options = Maybe MessageSendOptions
options_
, query_id :: SendInlineQueryResultMessage -> Maybe Int
query_id = Maybe Int
query_id_
, result_id :: SendInlineQueryResultMessage -> Maybe Text
result_id = Maybe Text
result_id_
, hide_via_bot :: SendInlineQueryResultMessage -> Maybe Bool
hide_via_bot = Maybe Bool
hide_via_bot_
}
= [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
"sendInlineQueryResultMessage"
, 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
"query_id" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (Int -> Value) -> Maybe Int -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> Value
I.writeInt64 Maybe Int
query_id_
, Key
"result_id" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
result_id_
, Key
"hide_via_bot" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
hide_via_bot_
]
defaultSendInlineQueryResultMessage :: SendInlineQueryResultMessage
defaultSendInlineQueryResultMessage :: SendInlineQueryResultMessage
defaultSendInlineQueryResultMessage =
SendInlineQueryResultMessage
{ 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
, query_id :: Maybe Int
query_id = Maybe Int
forall a. Maybe a
Nothing
, result_id :: Maybe Text
result_id = Maybe Text
forall a. Maybe a
Nothing
, hide_via_bot :: Maybe Bool
hide_via_bot = Maybe Bool
forall a. Maybe a
Nothing
}