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