module TD.Query.GetInternalLink
(GetInternalLink(..)
, defaultGetInternalLink
) 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.InternalLinkType as InternalLinkType
data GetInternalLink
= GetInternalLink
{ GetInternalLink -> Maybe InternalLinkType
_type :: Maybe InternalLinkType.InternalLinkType
, GetInternalLink -> Maybe Bool
is_http :: Maybe Bool
}
deriving (GetInternalLink -> GetInternalLink -> Bool
(GetInternalLink -> GetInternalLink -> Bool)
-> (GetInternalLink -> GetInternalLink -> Bool)
-> Eq GetInternalLink
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetInternalLink -> GetInternalLink -> Bool
== :: GetInternalLink -> GetInternalLink -> Bool
$c/= :: GetInternalLink -> GetInternalLink -> Bool
/= :: GetInternalLink -> GetInternalLink -> Bool
Eq, Int -> GetInternalLink -> ShowS
[GetInternalLink] -> ShowS
GetInternalLink -> String
(Int -> GetInternalLink -> ShowS)
-> (GetInternalLink -> String)
-> ([GetInternalLink] -> ShowS)
-> Show GetInternalLink
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetInternalLink -> ShowS
showsPrec :: Int -> GetInternalLink -> ShowS
$cshow :: GetInternalLink -> String
show :: GetInternalLink -> String
$cshowList :: [GetInternalLink] -> ShowS
showList :: [GetInternalLink] -> ShowS
Show)
instance I.ShortShow GetInternalLink where
shortShow :: GetInternalLink -> String
shortShow
GetInternalLink
{ _type :: GetInternalLink -> Maybe InternalLinkType
_type = Maybe InternalLinkType
_type_
, is_http :: GetInternalLink -> Maybe Bool
is_http = Maybe Bool
is_http_
}
= String
"GetInternalLink"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"_type" String -> Maybe InternalLinkType -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InternalLinkType
_type_
, String
"is_http" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_http_
]
instance AT.ToJSON GetInternalLink where
toJSON :: GetInternalLink -> Value
toJSON
GetInternalLink
{ _type :: GetInternalLink -> Maybe InternalLinkType
_type = Maybe InternalLinkType
_type_
, is_http :: GetInternalLink -> Maybe Bool
is_http = Maybe Bool
is_http_
}
= [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
"getInternalLink"
, Key
"type" Key -> Maybe InternalLinkType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InternalLinkType
_type_
, Key
"is_http" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
is_http_
]
defaultGetInternalLink :: GetInternalLink
defaultGetInternalLink :: GetInternalLink
defaultGetInternalLink =
GetInternalLink
{ _type :: Maybe InternalLinkType
_type = Maybe InternalLinkType
forall a. Maybe a
Nothing
, is_http :: Maybe Bool
is_http = Maybe Bool
forall a. Maybe a
Nothing
}