module TD.Query.SetBotSettings
(SetBotSettings(..)
, defaultSetBotSettings
) 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.BotSetting as BotSetting
data SetBotSettings
= SetBotSettings
{ SetBotSettings -> Maybe Int
bot_user_id :: Maybe Int
, SetBotSettings -> Maybe [BotSetting]
settings :: Maybe [BotSetting.BotSetting]
}
deriving (SetBotSettings -> SetBotSettings -> Bool
(SetBotSettings -> SetBotSettings -> Bool)
-> (SetBotSettings -> SetBotSettings -> Bool) -> Eq SetBotSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetBotSettings -> SetBotSettings -> Bool
== :: SetBotSettings -> SetBotSettings -> Bool
$c/= :: SetBotSettings -> SetBotSettings -> Bool
/= :: SetBotSettings -> SetBotSettings -> Bool
Eq, Int -> SetBotSettings -> ShowS
[SetBotSettings] -> ShowS
SetBotSettings -> String
(Int -> SetBotSettings -> ShowS)
-> (SetBotSettings -> String)
-> ([SetBotSettings] -> ShowS)
-> Show SetBotSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetBotSettings -> ShowS
showsPrec :: Int -> SetBotSettings -> ShowS
$cshow :: SetBotSettings -> String
show :: SetBotSettings -> String
$cshowList :: [SetBotSettings] -> ShowS
showList :: [SetBotSettings] -> ShowS
Show)
instance I.ShortShow SetBotSettings where
shortShow :: SetBotSettings -> String
shortShow
SetBotSettings
{ bot_user_id :: SetBotSettings -> Maybe Int
bot_user_id = Maybe Int
bot_user_id_
, settings :: SetBotSettings -> Maybe [BotSetting]
settings = Maybe [BotSetting]
settings_
}
= String
"SetBotSettings"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"bot_user_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
bot_user_id_
, String
"settings" String -> Maybe [BotSetting] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [BotSetting]
settings_
]
instance AT.ToJSON SetBotSettings where
toJSON :: SetBotSettings -> Value
toJSON
SetBotSettings
{ bot_user_id :: SetBotSettings -> Maybe Int
bot_user_id = Maybe Int
bot_user_id_
, settings :: SetBotSettings -> Maybe [BotSetting]
settings = Maybe [BotSetting]
settings_
}
= [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
"setBotSettings"
, Key
"bot_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
bot_user_id_
, Key
"settings" Key -> Maybe [BotSetting] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe [BotSetting]
settings_
]
defaultSetBotSettings :: SetBotSettings
defaultSetBotSettings :: SetBotSettings
defaultSetBotSettings =
SetBotSettings
{ bot_user_id :: Maybe Int
bot_user_id = Maybe Int
forall a. Maybe a
Nothing
, settings :: Maybe [BotSetting]
settings = Maybe [BotSetting]
forall a. Maybe a
Nothing
}