module TD.Query.SetUserNote
(SetUserNote(..)
, defaultSetUserNote
) 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
data SetUserNote
= SetUserNote
{ SetUserNote -> Maybe Int
user_id :: Maybe Int
, SetUserNote -> Maybe FormattedText
note :: Maybe FormattedText.FormattedText
}
deriving (SetUserNote -> SetUserNote -> Bool
(SetUserNote -> SetUserNote -> Bool)
-> (SetUserNote -> SetUserNote -> Bool) -> Eq SetUserNote
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetUserNote -> SetUserNote -> Bool
== :: SetUserNote -> SetUserNote -> Bool
$c/= :: SetUserNote -> SetUserNote -> Bool
/= :: SetUserNote -> SetUserNote -> Bool
Eq, Int -> SetUserNote -> ShowS
[SetUserNote] -> ShowS
SetUserNote -> String
(Int -> SetUserNote -> ShowS)
-> (SetUserNote -> String)
-> ([SetUserNote] -> ShowS)
-> Show SetUserNote
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetUserNote -> ShowS
showsPrec :: Int -> SetUserNote -> ShowS
$cshow :: SetUserNote -> String
show :: SetUserNote -> String
$cshowList :: [SetUserNote] -> ShowS
showList :: [SetUserNote] -> ShowS
Show)
instance I.ShortShow SetUserNote where
shortShow :: SetUserNote -> String
shortShow
SetUserNote
{ user_id :: SetUserNote -> Maybe Int
user_id = Maybe Int
user_id_
, note :: SetUserNote -> Maybe FormattedText
note = Maybe FormattedText
note_
}
= String
"SetUserNote"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"user_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
, String
"note" String -> Maybe FormattedText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe FormattedText
note_
]
instance AT.ToJSON SetUserNote where
toJSON :: SetUserNote -> Value
toJSON
SetUserNote
{ user_id :: SetUserNote -> Maybe Int
user_id = Maybe Int
user_id_
, note :: SetUserNote -> Maybe FormattedText
note = Maybe FormattedText
note_
}
= [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
"setUserNote"
, Key
"user_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
user_id_
, Key
"note" Key -> Maybe FormattedText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe FormattedText
note_
]
defaultSetUserNote :: SetUserNote
defaultSetUserNote :: SetUserNote
defaultSetUserNote =
SetUserNote
{ user_id :: Maybe Int
user_id = Maybe Int
forall a. Maybe a
Nothing
, note :: Maybe FormattedText
note = Maybe FormattedText
forall a. Maybe a
Nothing
}