module TD.Query.GetCommands
(GetCommands(..)
, defaultGetCommands
) 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.BotCommandScope as BotCommandScope
import qualified Data.Text as T
data GetCommands
= GetCommands
{ GetCommands -> Maybe BotCommandScope
scope :: Maybe BotCommandScope.BotCommandScope
, GetCommands -> Maybe Text
language_code :: Maybe T.Text
}
deriving (GetCommands -> GetCommands -> Bool
(GetCommands -> GetCommands -> Bool)
-> (GetCommands -> GetCommands -> Bool) -> Eq GetCommands
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetCommands -> GetCommands -> Bool
== :: GetCommands -> GetCommands -> Bool
$c/= :: GetCommands -> GetCommands -> Bool
/= :: GetCommands -> GetCommands -> Bool
Eq, Int -> GetCommands -> ShowS
[GetCommands] -> ShowS
GetCommands -> String
(Int -> GetCommands -> ShowS)
-> (GetCommands -> String)
-> ([GetCommands] -> ShowS)
-> Show GetCommands
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetCommands -> ShowS
showsPrec :: Int -> GetCommands -> ShowS
$cshow :: GetCommands -> String
show :: GetCommands -> String
$cshowList :: [GetCommands] -> ShowS
showList :: [GetCommands] -> ShowS
Show)
instance I.ShortShow GetCommands where
shortShow :: GetCommands -> String
shortShow
GetCommands
{ scope :: GetCommands -> Maybe BotCommandScope
scope = Maybe BotCommandScope
scope_
, language_code :: GetCommands -> Maybe Text
language_code = Maybe Text
language_code_
}
= String
"GetCommands"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"scope" String -> Maybe BotCommandScope -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe BotCommandScope
scope_
, String
"language_code" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
language_code_
]
instance AT.ToJSON GetCommands where
toJSON :: GetCommands -> Value
toJSON
GetCommands
{ scope :: GetCommands -> Maybe BotCommandScope
scope = Maybe BotCommandScope
scope_
, language_code :: GetCommands -> Maybe Text
language_code = Maybe Text
language_code_
}
= [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
"getCommands"
, Key
"scope" Key -> Maybe BotCommandScope -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe BotCommandScope
scope_
, Key
"language_code" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
language_code_
]
defaultGetCommands :: GetCommands
defaultGetCommands :: GetCommands
defaultGetCommands =
GetCommands
{ scope :: Maybe BotCommandScope
scope = Maybe BotCommandScope
forall a. Maybe a
Nothing
, language_code :: Maybe Text
language_code = Maybe Text
forall a. Maybe a
Nothing
}