module TD.Query.CreateCommunity
(CreateCommunity(..)
, defaultCreateCommunity
) 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
data
=
{ CreateCommunity -> Maybe Text
name :: Maybe T.Text
, CreateCommunity -> Maybe Int
chat_id :: Maybe Int
, CreateCommunity -> Maybe Bool
is_chat_hidden :: Maybe Bool
}
deriving (CreateCommunity -> CreateCommunity -> Bool
(CreateCommunity -> CreateCommunity -> Bool)
-> (CreateCommunity -> CreateCommunity -> Bool)
-> Eq CreateCommunity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CreateCommunity -> CreateCommunity -> Bool
== :: CreateCommunity -> CreateCommunity -> Bool
$c/= :: CreateCommunity -> CreateCommunity -> Bool
/= :: CreateCommunity -> CreateCommunity -> Bool
Eq, Int -> CreateCommunity -> ShowS
[CreateCommunity] -> ShowS
CreateCommunity -> String
(Int -> CreateCommunity -> ShowS)
-> (CreateCommunity -> String)
-> ([CreateCommunity] -> ShowS)
-> Show CreateCommunity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CreateCommunity -> ShowS
showsPrec :: Int -> CreateCommunity -> ShowS
$cshow :: CreateCommunity -> String
show :: CreateCommunity -> String
$cshowList :: [CreateCommunity] -> ShowS
showList :: [CreateCommunity] -> ShowS
Show)
instance I.ShortShow CreateCommunity where
shortShow :: CreateCommunity -> String
shortShow
CreateCommunity
{ name :: CreateCommunity -> Maybe Text
name = Maybe Text
name_
, chat_id :: CreateCommunity -> Maybe Int
chat_id = Maybe Int
chat_id_
, is_chat_hidden :: CreateCommunity -> Maybe Bool
is_chat_hidden = Maybe Bool
is_chat_hidden_
}
= String
"CreateCommunity"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"name" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
name_
, String
"chat_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_id_
, String
"is_chat_hidden" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_chat_hidden_
]
instance AT.ToJSON CreateCommunity where
toJSON :: CreateCommunity -> Value
toJSON
CreateCommunity
{ name :: CreateCommunity -> Maybe Text
name = Maybe Text
name_
, chat_id :: CreateCommunity -> Maybe Int
chat_id = Maybe Int
chat_id_
, is_chat_hidden :: CreateCommunity -> Maybe Bool
is_chat_hidden = Maybe Bool
is_chat_hidden_
}
= [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
"createCommunity"
, Key
"name" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
name_
, Key
"chat_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
chat_id_
, Key
"is_chat_hidden" 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_chat_hidden_
]
defaultCreateCommunity :: CreateCommunity
=
CreateCommunity
{ name :: Maybe Text
name = Maybe Text
forall a. Maybe a
Nothing
, chat_id :: Maybe Int
chat_id = Maybe Int
forall a. Maybe a
Nothing
, is_chat_hidden :: Maybe Bool
is_chat_hidden = Maybe Bool
forall a. Maybe a
Nothing
}