module TD.Query.SendCallRating
(SendCallRating(..)
, defaultSendCallRating
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified Data.Text as T
import qualified TD.Data.CallProblem as CallProblem
data SendCallRating
= SendCallRating
{ SendCallRating -> Maybe Int
call_id :: Maybe Int
, SendCallRating -> Maybe Int
rating :: Maybe Int
, :: Maybe T.Text
, SendCallRating -> Maybe [CallProblem]
problems :: Maybe [CallProblem.CallProblem]
}
deriving (SendCallRating -> SendCallRating -> Bool
(SendCallRating -> SendCallRating -> Bool)
-> (SendCallRating -> SendCallRating -> Bool) -> Eq SendCallRating
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SendCallRating -> SendCallRating -> Bool
== :: SendCallRating -> SendCallRating -> Bool
$c/= :: SendCallRating -> SendCallRating -> Bool
/= :: SendCallRating -> SendCallRating -> Bool
Eq, Int -> SendCallRating -> ShowS
[SendCallRating] -> ShowS
SendCallRating -> String
(Int -> SendCallRating -> ShowS)
-> (SendCallRating -> String)
-> ([SendCallRating] -> ShowS)
-> Show SendCallRating
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SendCallRating -> ShowS
showsPrec :: Int -> SendCallRating -> ShowS
$cshow :: SendCallRating -> String
show :: SendCallRating -> String
$cshowList :: [SendCallRating] -> ShowS
showList :: [SendCallRating] -> ShowS
Show)
instance I.ShortShow SendCallRating where
shortShow :: SendCallRating -> String
shortShow
SendCallRating
{ call_id :: SendCallRating -> Maybe Int
call_id = Maybe Int
call_id_
, rating :: SendCallRating -> Maybe Int
rating = Maybe Int
rating_
, comment :: SendCallRating -> Maybe Text
comment = Maybe Text
comment_
, problems :: SendCallRating -> Maybe [CallProblem]
problems = Maybe [CallProblem]
problems_
}
= String
"SendCallRating"
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
"rating" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
rating_
, String
"comment" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
comment_
, String
"problems" String -> Maybe [CallProblem] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [CallProblem]
problems_
]
instance AT.ToJSON SendCallRating where
toJSON :: SendCallRating -> Value
toJSON
SendCallRating
{ call_id :: SendCallRating -> Maybe Int
call_id = Maybe Int
call_id_
, rating :: SendCallRating -> Maybe Int
rating = Maybe Int
rating_
, comment :: SendCallRating -> Maybe Text
comment = Maybe Text
comment_
, problems :: SendCallRating -> Maybe [CallProblem]
problems = Maybe [CallProblem]
problems_
}
= [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
"sendCallRating"
, 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
"rating" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
rating_
, Key
"comment" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
comment_
, Key
"problems" Key -> Maybe [CallProblem] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe [CallProblem]
problems_
]
defaultSendCallRating :: SendCallRating
defaultSendCallRating :: SendCallRating
defaultSendCallRating =
SendCallRating
{ call_id :: Maybe Int
call_id = Maybe Int
forall a. Maybe a
Nothing
, rating :: Maybe Int
rating = Maybe Int
forall a. Maybe a
Nothing
, comment :: Maybe Text
comment = Maybe Text
forall a. Maybe a
Nothing
, problems :: Maybe [CallProblem]
problems = Maybe [CallProblem]
forall a. Maybe a
Nothing
}