module TD.Query.CreatePrivateChat
(CreatePrivateChat(..)
, defaultCreatePrivateChat
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data CreatePrivateChat
= CreatePrivateChat
{ CreatePrivateChat -> Maybe Int
user_id :: Maybe Int
, CreatePrivateChat -> Maybe Bool
force :: Maybe Bool
}
deriving (CreatePrivateChat -> CreatePrivateChat -> Bool
(CreatePrivateChat -> CreatePrivateChat -> Bool)
-> (CreatePrivateChat -> CreatePrivateChat -> Bool)
-> Eq CreatePrivateChat
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CreatePrivateChat -> CreatePrivateChat -> Bool
== :: CreatePrivateChat -> CreatePrivateChat -> Bool
$c/= :: CreatePrivateChat -> CreatePrivateChat -> Bool
/= :: CreatePrivateChat -> CreatePrivateChat -> Bool
Eq, Int -> CreatePrivateChat -> ShowS
[CreatePrivateChat] -> ShowS
CreatePrivateChat -> String
(Int -> CreatePrivateChat -> ShowS)
-> (CreatePrivateChat -> String)
-> ([CreatePrivateChat] -> ShowS)
-> Show CreatePrivateChat
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CreatePrivateChat -> ShowS
showsPrec :: Int -> CreatePrivateChat -> ShowS
$cshow :: CreatePrivateChat -> String
show :: CreatePrivateChat -> String
$cshowList :: [CreatePrivateChat] -> ShowS
showList :: [CreatePrivateChat] -> ShowS
Show)
instance I.ShortShow CreatePrivateChat where
shortShow :: CreatePrivateChat -> String
shortShow
CreatePrivateChat
{ user_id :: CreatePrivateChat -> Maybe Int
user_id = Maybe Int
user_id_
, force :: CreatePrivateChat -> Maybe Bool
force = Maybe Bool
force_
}
= String
"CreatePrivateChat"
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
"force" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
force_
]
instance AT.ToJSON CreatePrivateChat where
toJSON :: CreatePrivateChat -> Value
toJSON
CreatePrivateChat
{ user_id :: CreatePrivateChat -> Maybe Int
user_id = Maybe Int
user_id_
, force :: CreatePrivateChat -> Maybe Bool
force = Maybe Bool
force_
}
= [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
"createPrivateChat"
, 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
"force" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
force_
]
defaultCreatePrivateChat :: CreatePrivateChat
defaultCreatePrivateChat :: CreatePrivateChat
defaultCreatePrivateChat =
CreatePrivateChat
{ user_id :: Maybe Int
user_id = Maybe Int
forall a. Maybe a
Nothing
, force :: Maybe Bool
force = Maybe Bool
forall a. Maybe a
Nothing
}