module TD.Query.SetName
(SetName(..)
, defaultSetName
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified Data.Text as T
data SetName
= SetName
{ SetName -> Maybe Text
first_name :: Maybe T.Text
, SetName -> Maybe Text
last_name :: Maybe T.Text
}
deriving (SetName -> SetName -> Bool
(SetName -> SetName -> Bool)
-> (SetName -> SetName -> Bool) -> Eq SetName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetName -> SetName -> Bool
== :: SetName -> SetName -> Bool
$c/= :: SetName -> SetName -> Bool
/= :: SetName -> SetName -> Bool
Eq, Int -> SetName -> ShowS
[SetName] -> ShowS
SetName -> String
(Int -> SetName -> ShowS)
-> (SetName -> String) -> ([SetName] -> ShowS) -> Show SetName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetName -> ShowS
showsPrec :: Int -> SetName -> ShowS
$cshow :: SetName -> String
show :: SetName -> String
$cshowList :: [SetName] -> ShowS
showList :: [SetName] -> ShowS
Show)
instance I.ShortShow SetName where
shortShow :: SetName -> String
shortShow
SetName
{ first_name :: SetName -> Maybe Text
first_name = Maybe Text
first_name_
, last_name :: SetName -> Maybe Text
last_name = Maybe Text
last_name_
}
= String
"SetName"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"first_name" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
first_name_
, String
"last_name" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
last_name_
]
instance AT.ToJSON SetName where
toJSON :: SetName -> Value
toJSON
SetName
{ first_name :: SetName -> Maybe Text
first_name = Maybe Text
first_name_
, last_name :: SetName -> Maybe Text
last_name = Maybe Text
last_name_
}
= [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
"setName"
, Key
"first_name" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
first_name_
, Key
"last_name" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
last_name_
]
defaultSetName :: SetName
defaultSetName :: SetName
defaultSetName =
SetName
{ first_name :: Maybe Text
first_name = Maybe Text
forall a. Maybe a
Nothing
, last_name :: Maybe Text
last_name = Maybe Text
forall a. Maybe a
Nothing
}