module TD.Query.SetChatDraftMessage
(SetChatDraftMessage(..)
, defaultSetChatDraftMessage
) 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.DraftMessage as DraftMessage
data SetChatDraftMessage
= SetChatDraftMessage
{ SetChatDraftMessage -> Maybe Int
chat_id :: Maybe Int
, SetChatDraftMessage -> Maybe Int
message_thread_id :: Maybe Int
, SetChatDraftMessage -> Maybe DraftMessage
draft_message :: Maybe DraftMessage.DraftMessage
}
deriving (SetChatDraftMessage -> SetChatDraftMessage -> Bool
(SetChatDraftMessage -> SetChatDraftMessage -> Bool)
-> (SetChatDraftMessage -> SetChatDraftMessage -> Bool)
-> Eq SetChatDraftMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetChatDraftMessage -> SetChatDraftMessage -> Bool
== :: SetChatDraftMessage -> SetChatDraftMessage -> Bool
$c/= :: SetChatDraftMessage -> SetChatDraftMessage -> Bool
/= :: SetChatDraftMessage -> SetChatDraftMessage -> Bool
Eq, Int -> SetChatDraftMessage -> ShowS
[SetChatDraftMessage] -> ShowS
SetChatDraftMessage -> String
(Int -> SetChatDraftMessage -> ShowS)
-> (SetChatDraftMessage -> String)
-> ([SetChatDraftMessage] -> ShowS)
-> Show SetChatDraftMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetChatDraftMessage -> ShowS
showsPrec :: Int -> SetChatDraftMessage -> ShowS
$cshow :: SetChatDraftMessage -> String
show :: SetChatDraftMessage -> String
$cshowList :: [SetChatDraftMessage] -> ShowS
showList :: [SetChatDraftMessage] -> ShowS
Show)
instance I.ShortShow SetChatDraftMessage where
shortShow :: SetChatDraftMessage -> String
shortShow
SetChatDraftMessage
{ chat_id :: SetChatDraftMessage -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_thread_id :: SetChatDraftMessage -> Maybe Int
message_thread_id = Maybe Int
message_thread_id_
, draft_message :: SetChatDraftMessage -> Maybe DraftMessage
draft_message = Maybe DraftMessage
draft_message_
}
= String
"SetChatDraftMessage"
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
"draft_message" String -> Maybe DraftMessage -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe DraftMessage
draft_message_
]
instance AT.ToJSON SetChatDraftMessage where
toJSON :: SetChatDraftMessage -> Value
toJSON
SetChatDraftMessage
{ chat_id :: SetChatDraftMessage -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_thread_id :: SetChatDraftMessage -> Maybe Int
message_thread_id = Maybe Int
message_thread_id_
, draft_message :: SetChatDraftMessage -> Maybe DraftMessage
draft_message = Maybe DraftMessage
draft_message_
}
= [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
"setChatDraftMessage"
, 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
"draft_message" Key -> Maybe DraftMessage -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe DraftMessage
draft_message_
]
defaultSetChatDraftMessage :: SetChatDraftMessage
defaultSetChatDraftMessage :: SetChatDraftMessage
defaultSetChatDraftMessage =
SetChatDraftMessage
{ 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
, draft_message :: Maybe DraftMessage
draft_message = Maybe DraftMessage
forall a. Maybe a
Nothing
}