module TD.Query.GetMessageLink
(GetMessageLink(..)
, defaultGetMessageLink
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data GetMessageLink
= GetMessageLink
{ GetMessageLink -> Maybe Int
chat_id :: Maybe Int
, GetMessageLink -> Maybe Int
message_id :: Maybe Int
, GetMessageLink -> Maybe Int
media_timestamp :: Maybe Int
, GetMessageLink -> Maybe Bool
for_album :: Maybe Bool
, GetMessageLink -> Maybe Bool
in_message_thread :: Maybe Bool
}
deriving (GetMessageLink -> GetMessageLink -> Bool
(GetMessageLink -> GetMessageLink -> Bool)
-> (GetMessageLink -> GetMessageLink -> Bool) -> Eq GetMessageLink
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetMessageLink -> GetMessageLink -> Bool
== :: GetMessageLink -> GetMessageLink -> Bool
$c/= :: GetMessageLink -> GetMessageLink -> Bool
/= :: GetMessageLink -> GetMessageLink -> Bool
Eq, Int -> GetMessageLink -> ShowS
[GetMessageLink] -> ShowS
GetMessageLink -> String
(Int -> GetMessageLink -> ShowS)
-> (GetMessageLink -> String)
-> ([GetMessageLink] -> ShowS)
-> Show GetMessageLink
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetMessageLink -> ShowS
showsPrec :: Int -> GetMessageLink -> ShowS
$cshow :: GetMessageLink -> String
show :: GetMessageLink -> String
$cshowList :: [GetMessageLink] -> ShowS
showList :: [GetMessageLink] -> ShowS
Show)
instance I.ShortShow GetMessageLink where
shortShow :: GetMessageLink -> String
shortShow
GetMessageLink
{ chat_id :: GetMessageLink -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_id :: GetMessageLink -> Maybe Int
message_id = Maybe Int
message_id_
, media_timestamp :: GetMessageLink -> Maybe Int
media_timestamp = Maybe Int
media_timestamp_
, for_album :: GetMessageLink -> Maybe Bool
for_album = Maybe Bool
for_album_
, in_message_thread :: GetMessageLink -> Maybe Bool
in_message_thread = Maybe Bool
in_message_thread_
}
= String
"GetMessageLink"
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_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
message_id_
, String
"media_timestamp" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
media_timestamp_
, String
"for_album" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
for_album_
, String
"in_message_thread" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
in_message_thread_
]
instance AT.ToJSON GetMessageLink where
toJSON :: GetMessageLink -> Value
toJSON
GetMessageLink
{ chat_id :: GetMessageLink -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_id :: GetMessageLink -> Maybe Int
message_id = Maybe Int
message_id_
, media_timestamp :: GetMessageLink -> Maybe Int
media_timestamp = Maybe Int
media_timestamp_
, for_album :: GetMessageLink -> Maybe Bool
for_album = Maybe Bool
for_album_
, in_message_thread :: GetMessageLink -> Maybe Bool
in_message_thread = Maybe Bool
in_message_thread_
}
= [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
"getMessageLink"
, 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_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_id_
, Key
"media_timestamp" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
media_timestamp_
, Key
"for_album" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
for_album_
, Key
"in_message_thread" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
in_message_thread_
]
defaultGetMessageLink :: GetMessageLink
defaultGetMessageLink :: GetMessageLink
defaultGetMessageLink =
GetMessageLink
{ chat_id :: Maybe Int
chat_id = Maybe Int
forall a. Maybe a
Nothing
, message_id :: Maybe Int
message_id = Maybe Int
forall a. Maybe a
Nothing
, media_timestamp :: Maybe Int
media_timestamp = Maybe Int
forall a. Maybe a
Nothing
, for_album :: Maybe Bool
for_album = Maybe Bool
forall a. Maybe a
Nothing
, in_message_thread :: Maybe Bool
in_message_thread = Maybe Bool
forall a. Maybe a
Nothing
}