module TD.Query.GetLinkPreview
(GetLinkPreview(..)
, defaultGetLinkPreview
) 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.FormattedText as FormattedText
import qualified TD.Data.LinkPreviewOptions as LinkPreviewOptions
data GetLinkPreview
= GetLinkPreview
{ GetLinkPreview -> Maybe FormattedText
text :: Maybe FormattedText.FormattedText
, GetLinkPreview -> Maybe LinkPreviewOptions
link_preview_options :: Maybe LinkPreviewOptions.LinkPreviewOptions
}
deriving (GetLinkPreview -> GetLinkPreview -> Bool
(GetLinkPreview -> GetLinkPreview -> Bool)
-> (GetLinkPreview -> GetLinkPreview -> Bool) -> Eq GetLinkPreview
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetLinkPreview -> GetLinkPreview -> Bool
== :: GetLinkPreview -> GetLinkPreview -> Bool
$c/= :: GetLinkPreview -> GetLinkPreview -> Bool
/= :: GetLinkPreview -> GetLinkPreview -> Bool
Eq, Int -> GetLinkPreview -> ShowS
[GetLinkPreview] -> ShowS
GetLinkPreview -> String
(Int -> GetLinkPreview -> ShowS)
-> (GetLinkPreview -> String)
-> ([GetLinkPreview] -> ShowS)
-> Show GetLinkPreview
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetLinkPreview -> ShowS
showsPrec :: Int -> GetLinkPreview -> ShowS
$cshow :: GetLinkPreview -> String
show :: GetLinkPreview -> String
$cshowList :: [GetLinkPreview] -> ShowS
showList :: [GetLinkPreview] -> ShowS
Show)
instance I.ShortShow GetLinkPreview where
shortShow :: GetLinkPreview -> String
shortShow
GetLinkPreview
{ text :: GetLinkPreview -> Maybe FormattedText
text = Maybe FormattedText
text_
, link_preview_options :: GetLinkPreview -> Maybe LinkPreviewOptions
link_preview_options = Maybe LinkPreviewOptions
link_preview_options_
}
= String
"GetLinkPreview"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"text" String -> Maybe FormattedText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe FormattedText
text_
, String
"link_preview_options" String -> Maybe LinkPreviewOptions -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe LinkPreviewOptions
link_preview_options_
]
instance AT.ToJSON GetLinkPreview where
toJSON :: GetLinkPreview -> Value
toJSON
GetLinkPreview
{ text :: GetLinkPreview -> Maybe FormattedText
text = Maybe FormattedText
text_
, link_preview_options :: GetLinkPreview -> Maybe LinkPreviewOptions
link_preview_options = Maybe LinkPreviewOptions
link_preview_options_
}
= [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
"getLinkPreview"
, Key
"text" Key -> Maybe FormattedText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe FormattedText
text_
, Key
"link_preview_options" Key -> Maybe LinkPreviewOptions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe LinkPreviewOptions
link_preview_options_
]
defaultGetLinkPreview :: GetLinkPreview
defaultGetLinkPreview :: GetLinkPreview
defaultGetLinkPreview =
GetLinkPreview
{ text :: Maybe FormattedText
text = Maybe FormattedText
forall a. Maybe a
Nothing
, link_preview_options :: Maybe LinkPreviewOptions
link_preview_options = Maybe LinkPreviewOptions
forall a. Maybe a
Nothing
}