module TD.Query.TerminateSession
(TerminateSession(..)
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data TerminateSession
= TerminateSession
{ TerminateSession -> Maybe Int
session_id :: Maybe Int
}
deriving (TerminateSession -> TerminateSession -> Bool
(TerminateSession -> TerminateSession -> Bool)
-> (TerminateSession -> TerminateSession -> Bool)
-> Eq TerminateSession
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TerminateSession -> TerminateSession -> Bool
== :: TerminateSession -> TerminateSession -> Bool
$c/= :: TerminateSession -> TerminateSession -> Bool
/= :: TerminateSession -> TerminateSession -> Bool
Eq, Int -> TerminateSession -> ShowS
[TerminateSession] -> ShowS
TerminateSession -> String
(Int -> TerminateSession -> ShowS)
-> (TerminateSession -> String)
-> ([TerminateSession] -> ShowS)
-> Show TerminateSession
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TerminateSession -> ShowS
showsPrec :: Int -> TerminateSession -> ShowS
$cshow :: TerminateSession -> String
show :: TerminateSession -> String
$cshowList :: [TerminateSession] -> ShowS
showList :: [TerminateSession] -> ShowS
Show)
instance I.ShortShow TerminateSession where
shortShow :: TerminateSession -> String
shortShow
TerminateSession
{ session_id :: TerminateSession -> Maybe Int
session_id = Maybe Int
session_id_
}
= String
"TerminateSession"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"session_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
session_id_
]
instance AT.ToJSON TerminateSession where
toJSON :: TerminateSession -> Value
toJSON
TerminateSession
{ session_id :: TerminateSession -> Maybe Int
session_id = Maybe Int
session_id_
}
= [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
"terminateSession"
, Key
"session_id" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (Int -> Value) -> Maybe Int -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> Value
I.writeInt64 Maybe Int
session_id_
]