module TD.Query.DiscardCall
(DiscardCall(..)
, defaultDiscardCall
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data DiscardCall
= DiscardCall
{ DiscardCall -> Maybe Int
call_id :: Maybe Int
, DiscardCall -> Maybe Bool
is_disconnected :: Maybe Bool
, DiscardCall -> Maybe Int
duration :: Maybe Int
, DiscardCall -> Maybe Bool
is_video :: Maybe Bool
, DiscardCall -> Maybe Int
connection_id :: Maybe Int
}
deriving (DiscardCall -> DiscardCall -> Bool
(DiscardCall -> DiscardCall -> Bool)
-> (DiscardCall -> DiscardCall -> Bool) -> Eq DiscardCall
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DiscardCall -> DiscardCall -> Bool
== :: DiscardCall -> DiscardCall -> Bool
$c/= :: DiscardCall -> DiscardCall -> Bool
/= :: DiscardCall -> DiscardCall -> Bool
Eq, Int -> DiscardCall -> ShowS
[DiscardCall] -> ShowS
DiscardCall -> String
(Int -> DiscardCall -> ShowS)
-> (DiscardCall -> String)
-> ([DiscardCall] -> ShowS)
-> Show DiscardCall
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DiscardCall -> ShowS
showsPrec :: Int -> DiscardCall -> ShowS
$cshow :: DiscardCall -> String
show :: DiscardCall -> String
$cshowList :: [DiscardCall] -> ShowS
showList :: [DiscardCall] -> ShowS
Show)
instance I.ShortShow DiscardCall where
shortShow :: DiscardCall -> String
shortShow
DiscardCall
{ call_id :: DiscardCall -> Maybe Int
call_id = Maybe Int
call_id_
, is_disconnected :: DiscardCall -> Maybe Bool
is_disconnected = Maybe Bool
is_disconnected_
, duration :: DiscardCall -> Maybe Int
duration = Maybe Int
duration_
, is_video :: DiscardCall -> Maybe Bool
is_video = Maybe Bool
is_video_
, connection_id :: DiscardCall -> Maybe Int
connection_id = Maybe Int
connection_id_
}
= String
"DiscardCall"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"call_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
call_id_
, String
"is_disconnected" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_disconnected_
, String
"duration" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
duration_
, String
"is_video" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_video_
, String
"connection_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
connection_id_
]
instance AT.ToJSON DiscardCall where
toJSON :: DiscardCall -> Value
toJSON
DiscardCall
{ call_id :: DiscardCall -> Maybe Int
call_id = Maybe Int
call_id_
, is_disconnected :: DiscardCall -> Maybe Bool
is_disconnected = Maybe Bool
is_disconnected_
, duration :: DiscardCall -> Maybe Int
duration = Maybe Int
duration_
, is_video :: DiscardCall -> Maybe Bool
is_video = Maybe Bool
is_video_
, connection_id :: DiscardCall -> Maybe Int
connection_id = Maybe Int
connection_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
"discardCall"
, Key
"call_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
call_id_
, Key
"is_disconnected" 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_disconnected_
, Key
"duration" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
duration_
, Key
"is_video" 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_video_
, Key
"connection_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
connection_id_
]
defaultDiscardCall :: DiscardCall
defaultDiscardCall :: DiscardCall
defaultDiscardCall =
DiscardCall
{ call_id :: Maybe Int
call_id = Maybe Int
forall a. Maybe a
Nothing
, is_disconnected :: Maybe Bool
is_disconnected = Maybe Bool
forall a. Maybe a
Nothing
, duration :: Maybe Int
duration = Maybe Int
forall a. Maybe a
Nothing
, is_video :: Maybe Bool
is_video = Maybe Bool
forall a. Maybe a
Nothing
, connection_id :: Maybe Int
connection_id = Maybe Int
forall a. Maybe a
Nothing
}