module TD.Query.AcceptCall
(AcceptCall(..)
, defaultAcceptCall
) 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.CallProtocol as CallProtocol
data AcceptCall
= AcceptCall
{ AcceptCall -> Maybe Int
call_id :: Maybe Int
, AcceptCall -> Maybe CallProtocol
protocol :: Maybe CallProtocol.CallProtocol
}
deriving (AcceptCall -> AcceptCall -> Bool
(AcceptCall -> AcceptCall -> Bool)
-> (AcceptCall -> AcceptCall -> Bool) -> Eq AcceptCall
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AcceptCall -> AcceptCall -> Bool
== :: AcceptCall -> AcceptCall -> Bool
$c/= :: AcceptCall -> AcceptCall -> Bool
/= :: AcceptCall -> AcceptCall -> Bool
Eq, Int -> AcceptCall -> ShowS
[AcceptCall] -> ShowS
AcceptCall -> String
(Int -> AcceptCall -> ShowS)
-> (AcceptCall -> String)
-> ([AcceptCall] -> ShowS)
-> Show AcceptCall
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AcceptCall -> ShowS
showsPrec :: Int -> AcceptCall -> ShowS
$cshow :: AcceptCall -> String
show :: AcceptCall -> String
$cshowList :: [AcceptCall] -> ShowS
showList :: [AcceptCall] -> ShowS
Show)
instance I.ShortShow AcceptCall where
shortShow :: AcceptCall -> String
shortShow
AcceptCall
{ call_id :: AcceptCall -> Maybe Int
call_id = Maybe Int
call_id_
, protocol :: AcceptCall -> Maybe CallProtocol
protocol = Maybe CallProtocol
protocol_
}
= String
"AcceptCall"
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
"protocol" String -> Maybe CallProtocol -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe CallProtocol
protocol_
]
instance AT.ToJSON AcceptCall where
toJSON :: AcceptCall -> Value
toJSON
AcceptCall
{ call_id :: AcceptCall -> Maybe Int
call_id = Maybe Int
call_id_
, protocol :: AcceptCall -> Maybe CallProtocol
protocol = Maybe CallProtocol
protocol_
}
= [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
"acceptCall"
, 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
"protocol" Key -> Maybe CallProtocol -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe CallProtocol
protocol_
]
defaultAcceptCall :: AcceptCall
defaultAcceptCall :: AcceptCall
defaultAcceptCall =
AcceptCall
{ call_id :: Maybe Int
call_id = Maybe Int
forall a. Maybe a
Nothing
, protocol :: Maybe CallProtocol
protocol = Maybe CallProtocol
forall a. Maybe a
Nothing
}