module TD.Query.GetLoginUrl
(GetLoginUrl(..)
, defaultGetLoginUrl
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data GetLoginUrl
= GetLoginUrl
{ GetLoginUrl -> Maybe Int
chat_id :: Maybe Int
, GetLoginUrl -> Maybe Int
message_id :: Maybe Int
, GetLoginUrl -> Maybe Int
button_id :: Maybe Int
, GetLoginUrl -> Maybe Bool
allow_write_access :: Maybe Bool
}
deriving (GetLoginUrl -> GetLoginUrl -> Bool
(GetLoginUrl -> GetLoginUrl -> Bool)
-> (GetLoginUrl -> GetLoginUrl -> Bool) -> Eq GetLoginUrl
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetLoginUrl -> GetLoginUrl -> Bool
== :: GetLoginUrl -> GetLoginUrl -> Bool
$c/= :: GetLoginUrl -> GetLoginUrl -> Bool
/= :: GetLoginUrl -> GetLoginUrl -> Bool
Eq, Int -> GetLoginUrl -> ShowS
[GetLoginUrl] -> ShowS
GetLoginUrl -> String
(Int -> GetLoginUrl -> ShowS)
-> (GetLoginUrl -> String)
-> ([GetLoginUrl] -> ShowS)
-> Show GetLoginUrl
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetLoginUrl -> ShowS
showsPrec :: Int -> GetLoginUrl -> ShowS
$cshow :: GetLoginUrl -> String
show :: GetLoginUrl -> String
$cshowList :: [GetLoginUrl] -> ShowS
showList :: [GetLoginUrl] -> ShowS
Show)
instance I.ShortShow GetLoginUrl where
shortShow :: GetLoginUrl -> String
shortShow
GetLoginUrl
{ chat_id :: GetLoginUrl -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_id :: GetLoginUrl -> Maybe Int
message_id = Maybe Int
message_id_
, button_id :: GetLoginUrl -> Maybe Int
button_id = Maybe Int
button_id_
, allow_write_access :: GetLoginUrl -> Maybe Bool
allow_write_access = Maybe Bool
allow_write_access_
}
= String
"GetLoginUrl"
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
"message_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
message_id_
, String
"button_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
button_id_
, String
"allow_write_access" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
allow_write_access_
]
instance AT.ToJSON GetLoginUrl where
toJSON :: GetLoginUrl -> Value
toJSON
GetLoginUrl
{ chat_id :: GetLoginUrl -> Maybe Int
chat_id = Maybe Int
chat_id_
, message_id :: GetLoginUrl -> Maybe Int
message_id = Maybe Int
message_id_
, button_id :: GetLoginUrl -> Maybe Int
button_id = Maybe Int
button_id_
, allow_write_access :: GetLoginUrl -> Maybe Bool
allow_write_access = Maybe Bool
allow_write_access_
}
= [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
"getLoginUrl"
, 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
"message_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
message_id_
, Key
"button_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
button_id_
, Key
"allow_write_access" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
allow_write_access_
]
defaultGetLoginUrl :: GetLoginUrl
defaultGetLoginUrl :: GetLoginUrl
defaultGetLoginUrl =
GetLoginUrl
{ chat_id :: Maybe Int
chat_id = Maybe Int
forall a. Maybe a
Nothing
, message_id :: Maybe Int
message_id = Maybe Int
forall a. Maybe a
Nothing
, button_id :: Maybe Int
button_id = Maybe Int
forall a. Maybe a
Nothing
, allow_write_access :: Maybe Bool
allow_write_access = Maybe Bool
forall a. Maybe a
Nothing
}