module TD.Query.DeleteMessages
(DeleteMessages(..)
, defaultDeleteMessages
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data DeleteMessages
= DeleteMessages
{ DeleteMessages -> Maybe Int
chat_id :: Maybe Int
, DeleteMessages -> Maybe [Int]
message_ids :: Maybe [Int]
, DeleteMessages -> Maybe Bool
revoke :: Maybe Bool
}
deriving (DeleteMessages -> DeleteMessages -> Bool
(DeleteMessages -> DeleteMessages -> Bool)
-> (DeleteMessages -> DeleteMessages -> Bool) -> Eq DeleteMessages
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DeleteMessages -> DeleteMessages -> Bool
== :: DeleteMessages -> DeleteMessages -> Bool
$c/= :: DeleteMessages -> DeleteMessages -> Bool
/= :: DeleteMessages -> DeleteMessages -> Bool
Eq, Int -> DeleteMessages -> ShowS
[DeleteMessages] -> ShowS
DeleteMessages -> String
(Int -> DeleteMessages -> ShowS)
-> (DeleteMessages -> String)
-> ([DeleteMessages] -> ShowS)
-> Show DeleteMessages
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DeleteMessages -> ShowS
showsPrec :: Int -> DeleteMessages -> ShowS
$cshow :: DeleteMessages -> String
show :: DeleteMessages -> String
$cshowList :: [DeleteMessages] -> ShowS
showList :: [DeleteMessages] -> ShowS
Show)
instance I.ShortShow DeleteMessages where
shortShow :: DeleteMessages -> String
shortShow
DeleteMessages
{ chat_id :: DeleteMessages -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_ids :: DeleteMessages -> Maybe [Int]
message_ids = Maybe [Int]
message_ids_
, revoke :: DeleteMessages -> Maybe Bool
revoke = Maybe Bool
revoke_
}
= String
"DeleteMessages"
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_ids" String -> Maybe [Int] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [Int]
message_ids_
, String
"revoke" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
revoke_
]
instance AT.ToJSON DeleteMessages where
toJSON :: DeleteMessages -> Value
toJSON
DeleteMessages
{ chat_id :: DeleteMessages -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_ids :: DeleteMessages -> Maybe [Int]
message_ids = Maybe [Int]
message_ids_
, revoke :: DeleteMessages -> Maybe Bool
revoke = Maybe Bool
revoke_
}
= [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
"deleteMessages"
, 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_ids" 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_ids_
, Key
"revoke" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
revoke_
]
defaultDeleteMessages :: DeleteMessages
defaultDeleteMessages :: DeleteMessages
defaultDeleteMessages =
DeleteMessages
{ chat_id :: Maybe Int
chat_id = Maybe Int
forall a. Maybe a
Nothing
, message_ids :: Maybe [Int]
message_ids = Maybe [Int]
forall a. Maybe a
Nothing
, revoke :: Maybe Bool
revoke = Maybe Bool
forall a. Maybe a
Nothing
}