module TD.Query.ViewMessages
(ViewMessages(..)
, defaultViewMessages
) 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.MessageSource as MessageSource
data ViewMessages
= ViewMessages
{ ViewMessages -> Maybe Int
chat_id :: Maybe Int
, ViewMessages -> Maybe [Int]
message_ids :: Maybe [Int]
, ViewMessages -> Maybe MessageSource
source :: Maybe MessageSource.MessageSource
, ViewMessages -> Maybe Bool
force_read :: Maybe Bool
}
deriving (ViewMessages -> ViewMessages -> Bool
(ViewMessages -> ViewMessages -> Bool)
-> (ViewMessages -> ViewMessages -> Bool) -> Eq ViewMessages
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ViewMessages -> ViewMessages -> Bool
== :: ViewMessages -> ViewMessages -> Bool
$c/= :: ViewMessages -> ViewMessages -> Bool
/= :: ViewMessages -> ViewMessages -> Bool
Eq, Int -> ViewMessages -> ShowS
[ViewMessages] -> ShowS
ViewMessages -> String
(Int -> ViewMessages -> ShowS)
-> (ViewMessages -> String)
-> ([ViewMessages] -> ShowS)
-> Show ViewMessages
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ViewMessages -> ShowS
showsPrec :: Int -> ViewMessages -> ShowS
$cshow :: ViewMessages -> String
show :: ViewMessages -> String
$cshowList :: [ViewMessages] -> ShowS
showList :: [ViewMessages] -> ShowS
Show)
instance I.ShortShow ViewMessages where
shortShow :: ViewMessages -> String
shortShow
ViewMessages
{ chat_id :: ViewMessages -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_ids :: ViewMessages -> Maybe [Int]
message_ids = Maybe [Int]
message_ids_
, source :: ViewMessages -> Maybe MessageSource
source = Maybe MessageSource
source_
, force_read :: ViewMessages -> Maybe Bool
force_read = Maybe Bool
force_read_
}
= String
"ViewMessages"
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
"source" String -> Maybe MessageSource -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe MessageSource
source_
, String
"force_read" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
force_read_
]
instance AT.ToJSON ViewMessages where
toJSON :: ViewMessages -> Value
toJSON
ViewMessages
{ chat_id :: ViewMessages -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_ids :: ViewMessages -> Maybe [Int]
message_ids = Maybe [Int]
message_ids_
, source :: ViewMessages -> Maybe MessageSource
source = Maybe MessageSource
source_
, force_read :: ViewMessages -> Maybe Bool
force_read = Maybe Bool
force_read_
}
= [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
"viewMessages"
, 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
"source" Key -> Maybe MessageSource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe MessageSource
source_
, Key
"force_read" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
force_read_
]
defaultViewMessages :: ViewMessages
defaultViewMessages :: ViewMessages
defaultViewMessages =
ViewMessages
{ 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
, source :: Maybe MessageSource
source = Maybe MessageSource
forall a. Maybe a
Nothing
, force_read :: Maybe Bool
force_read = Maybe Bool
forall a. Maybe a
Nothing
}