module TD.Query.CreateCall
(CreateCall(..)
, defaultCreateCall
) 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 CreateCall
= CreateCall
{ CreateCall -> Maybe Int
user_id :: Maybe Int
, CreateCall -> Maybe CallProtocol
protocol :: Maybe CallProtocol.CallProtocol
, CreateCall -> Maybe Bool
is_video :: Maybe Bool
, CreateCall -> Maybe Int
group_call_id :: Maybe Int
}
deriving (CreateCall -> CreateCall -> Bool
(CreateCall -> CreateCall -> Bool)
-> (CreateCall -> CreateCall -> Bool) -> Eq CreateCall
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CreateCall -> CreateCall -> Bool
== :: CreateCall -> CreateCall -> Bool
$c/= :: CreateCall -> CreateCall -> Bool
/= :: CreateCall -> CreateCall -> Bool
Eq, Int -> CreateCall -> ShowS
[CreateCall] -> ShowS
CreateCall -> String
(Int -> CreateCall -> ShowS)
-> (CreateCall -> String)
-> ([CreateCall] -> ShowS)
-> Show CreateCall
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CreateCall -> ShowS
showsPrec :: Int -> CreateCall -> ShowS
$cshow :: CreateCall -> String
show :: CreateCall -> String
$cshowList :: [CreateCall] -> ShowS
showList :: [CreateCall] -> ShowS
Show)
instance I.ShortShow CreateCall where
shortShow :: CreateCall -> String
shortShow
CreateCall
{ user_id :: CreateCall -> Maybe Int
user_id = Maybe Int
user_id_
, protocol :: CreateCall -> Maybe CallProtocol
protocol = Maybe CallProtocol
protocol_
, is_video :: CreateCall -> Maybe Bool
is_video = Maybe Bool
is_video_
, group_call_id :: CreateCall -> Maybe Int
group_call_id = Maybe Int
group_call_id_
}
= String
"CreateCall"
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
"protocol" String -> Maybe CallProtocol -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe CallProtocol
protocol_
, String
"is_video" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_video_
, String
"group_call_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
group_call_id_
]
instance AT.ToJSON CreateCall where
toJSON :: CreateCall -> Value
toJSON
CreateCall
{ user_id :: CreateCall -> Maybe Int
user_id = Maybe Int
user_id_
, protocol :: CreateCall -> Maybe CallProtocol
protocol = Maybe CallProtocol
protocol_
, is_video :: CreateCall -> Maybe Bool
is_video = Maybe Bool
is_video_
, group_call_id :: CreateCall -> Maybe Int
group_call_id = Maybe Int
group_call_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
"createCall"
, 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
"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_
, 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
"group_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
group_call_id_
]
defaultCreateCall :: CreateCall
defaultCreateCall :: CreateCall
defaultCreateCall =
CreateCall
{ user_id :: Maybe Int
user_id = Maybe Int
forall a. Maybe a
Nothing
, protocol :: Maybe CallProtocol
protocol = Maybe CallProtocol
forall a. Maybe a
Nothing
, is_video :: Maybe Bool
is_video = Maybe Bool
forall a. Maybe a
Nothing
, group_call_id :: Maybe Int
group_call_id = Maybe Int
forall a. Maybe a
Nothing
}