module TD.Data.KeyboardButtonType
(KeyboardButtonType(..)) 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.ChatAdministratorRights as ChatAdministratorRights
import qualified Data.Text as T
data KeyboardButtonType
= KeyboardButtonTypeText
| KeyboardButtonTypeRequestPhoneNumber
| KeyboardButtonTypeRequestLocation
| KeyboardButtonTypeRequestPoll
{ KeyboardButtonType -> Maybe Bool
force_regular :: Maybe Bool
, KeyboardButtonType -> Maybe Bool
force_quiz :: Maybe Bool
}
| KeyboardButtonTypeRequestUsers
{ KeyboardButtonType -> Maybe Int
_id :: Maybe Int
, KeyboardButtonType -> Maybe Bool
restrict_user_is_bot :: Maybe Bool
, KeyboardButtonType -> Maybe Bool
user_is_bot :: Maybe Bool
, KeyboardButtonType -> Maybe Bool
restrict_user_is_premium :: Maybe Bool
, KeyboardButtonType -> Maybe Bool
user_is_premium :: Maybe Bool
, KeyboardButtonType -> Maybe Int
max_quantity :: Maybe Int
, KeyboardButtonType -> Maybe Bool
request_name :: Maybe Bool
, KeyboardButtonType -> Maybe Bool
request_username :: Maybe Bool
, KeyboardButtonType -> Maybe Bool
request_photo :: Maybe Bool
}
| KeyboardButtonTypeRequestChat
{ _id :: Maybe Int
, KeyboardButtonType -> Maybe Bool
chat_is_channel :: Maybe Bool
, KeyboardButtonType -> Maybe Bool
restrict_chat_is_forum :: Maybe Bool
, KeyboardButtonType -> Maybe Bool
chat_is_forum :: Maybe Bool
, KeyboardButtonType -> Maybe Bool
restrict_chat_has_username :: Maybe Bool
, KeyboardButtonType -> Maybe Bool
chat_has_username :: Maybe Bool
, KeyboardButtonType -> Maybe Bool
chat_is_created :: Maybe Bool
, KeyboardButtonType -> Maybe ChatAdministratorRights
user_administrator_rights :: Maybe ChatAdministratorRights.ChatAdministratorRights
, KeyboardButtonType -> Maybe ChatAdministratorRights
bot_administrator_rights :: Maybe ChatAdministratorRights.ChatAdministratorRights
, KeyboardButtonType -> Maybe Bool
bot_is_member :: Maybe Bool
, KeyboardButtonType -> Maybe Bool
request_title :: Maybe Bool
, request_username :: Maybe Bool
, request_photo :: Maybe Bool
}
| KeyboardButtonTypeWebApp
{ KeyboardButtonType -> Maybe Text
url :: Maybe T.Text
}
deriving (KeyboardButtonType -> KeyboardButtonType -> Bool
(KeyboardButtonType -> KeyboardButtonType -> Bool)
-> (KeyboardButtonType -> KeyboardButtonType -> Bool)
-> Eq KeyboardButtonType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: KeyboardButtonType -> KeyboardButtonType -> Bool
== :: KeyboardButtonType -> KeyboardButtonType -> Bool
$c/= :: KeyboardButtonType -> KeyboardButtonType -> Bool
/= :: KeyboardButtonType -> KeyboardButtonType -> Bool
Eq, Int -> KeyboardButtonType -> ShowS
[KeyboardButtonType] -> ShowS
KeyboardButtonType -> String
(Int -> KeyboardButtonType -> ShowS)
-> (KeyboardButtonType -> String)
-> ([KeyboardButtonType] -> ShowS)
-> Show KeyboardButtonType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> KeyboardButtonType -> ShowS
showsPrec :: Int -> KeyboardButtonType -> ShowS
$cshow :: KeyboardButtonType -> String
show :: KeyboardButtonType -> String
$cshowList :: [KeyboardButtonType] -> ShowS
showList :: [KeyboardButtonType] -> ShowS
Show)
instance I.ShortShow KeyboardButtonType where
shortShow :: KeyboardButtonType -> String
shortShow KeyboardButtonType
KeyboardButtonTypeText
= String
"KeyboardButtonTypeText"
shortShow KeyboardButtonType
KeyboardButtonTypeRequestPhoneNumber
= String
"KeyboardButtonTypeRequestPhoneNumber"
shortShow KeyboardButtonType
KeyboardButtonTypeRequestLocation
= String
"KeyboardButtonTypeRequestLocation"
shortShow KeyboardButtonTypeRequestPoll
{ force_regular :: KeyboardButtonType -> Maybe Bool
force_regular = Maybe Bool
force_regular_
, force_quiz :: KeyboardButtonType -> Maybe Bool
force_quiz = Maybe Bool
force_quiz_
}
= String
"KeyboardButtonTypeRequestPoll"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"force_regular" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
force_regular_
, String
"force_quiz" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
force_quiz_
]
shortShow KeyboardButtonTypeRequestUsers
{ _id :: KeyboardButtonType -> Maybe Int
_id = Maybe Int
_id_
, restrict_user_is_bot :: KeyboardButtonType -> Maybe Bool
restrict_user_is_bot = Maybe Bool
restrict_user_is_bot_
, user_is_bot :: KeyboardButtonType -> Maybe Bool
user_is_bot = Maybe Bool
user_is_bot_
, restrict_user_is_premium :: KeyboardButtonType -> Maybe Bool
restrict_user_is_premium = Maybe Bool
restrict_user_is_premium_
, user_is_premium :: KeyboardButtonType -> Maybe Bool
user_is_premium = Maybe Bool
user_is_premium_
, max_quantity :: KeyboardButtonType -> Maybe Int
max_quantity = Maybe Int
max_quantity_
, request_name :: KeyboardButtonType -> Maybe Bool
request_name = Maybe Bool
request_name_
, request_username :: KeyboardButtonType -> Maybe Bool
request_username = Maybe Bool
request_username_
, request_photo :: KeyboardButtonType -> Maybe Bool
request_photo = Maybe Bool
request_photo_
}
= String
"KeyboardButtonTypeRequestUsers"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
_id_
, String
"restrict_user_is_bot" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
restrict_user_is_bot_
, String
"user_is_bot" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
user_is_bot_
, String
"restrict_user_is_premium" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
restrict_user_is_premium_
, String
"user_is_premium" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
user_is_premium_
, String
"max_quantity" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
max_quantity_
, String
"request_name" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
request_name_
, String
"request_username" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
request_username_
, String
"request_photo" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
request_photo_
]
shortShow KeyboardButtonTypeRequestChat
{ _id :: KeyboardButtonType -> Maybe Int
_id = Maybe Int
_id_
, chat_is_channel :: KeyboardButtonType -> Maybe Bool
chat_is_channel = Maybe Bool
chat_is_channel_
, restrict_chat_is_forum :: KeyboardButtonType -> Maybe Bool
restrict_chat_is_forum = Maybe Bool
restrict_chat_is_forum_
, chat_is_forum :: KeyboardButtonType -> Maybe Bool
chat_is_forum = Maybe Bool
chat_is_forum_
, restrict_chat_has_username :: KeyboardButtonType -> Maybe Bool
restrict_chat_has_username = Maybe Bool
restrict_chat_has_username_
, chat_has_username :: KeyboardButtonType -> Maybe Bool
chat_has_username = Maybe Bool
chat_has_username_
, chat_is_created :: KeyboardButtonType -> Maybe Bool
chat_is_created = Maybe Bool
chat_is_created_
, user_administrator_rights :: KeyboardButtonType -> Maybe ChatAdministratorRights
user_administrator_rights = Maybe ChatAdministratorRights
user_administrator_rights_
, bot_administrator_rights :: KeyboardButtonType -> Maybe ChatAdministratorRights
bot_administrator_rights = Maybe ChatAdministratorRights
bot_administrator_rights_
, bot_is_member :: KeyboardButtonType -> Maybe Bool
bot_is_member = Maybe Bool
bot_is_member_
, request_title :: KeyboardButtonType -> Maybe Bool
request_title = Maybe Bool
request_title_
, request_username :: KeyboardButtonType -> Maybe Bool
request_username = Maybe Bool
request_username_
, request_photo :: KeyboardButtonType -> Maybe Bool
request_photo = Maybe Bool
request_photo_
}
= String
"KeyboardButtonTypeRequestChat"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
_id_
, String
"chat_is_channel" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
chat_is_channel_
, String
"restrict_chat_is_forum" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
restrict_chat_is_forum_
, String
"chat_is_forum" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
chat_is_forum_
, String
"restrict_chat_has_username" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
restrict_chat_has_username_
, String
"chat_has_username" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
chat_has_username_
, String
"chat_is_created" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
chat_is_created_
, String
"user_administrator_rights" String -> Maybe ChatAdministratorRights -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatAdministratorRights
user_administrator_rights_
, String
"bot_administrator_rights" String -> Maybe ChatAdministratorRights -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatAdministratorRights
bot_administrator_rights_
, String
"bot_is_member" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
bot_is_member_
, String
"request_title" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
request_title_
, String
"request_username" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
request_username_
, String
"request_photo" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
request_photo_
]
shortShow KeyboardButtonTypeWebApp
{ url :: KeyboardButtonType -> Maybe Text
url = Maybe Text
url_
}
= String
"KeyboardButtonTypeWebApp"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"url" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
url_
]
instance AT.FromJSON KeyboardButtonType where
parseJSON :: Value -> Parser KeyboardButtonType
parseJSON v :: Value
v@(AT.Object Object
obj) = do
String
t <- Object
obj Object -> Key -> Parser String
forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"@type" :: AT.Parser String
case String
t of
String
"keyboardButtonTypeText" -> KeyboardButtonType -> Parser KeyboardButtonType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure KeyboardButtonType
KeyboardButtonTypeText
String
"keyboardButtonTypeRequestPhoneNumber" -> KeyboardButtonType -> Parser KeyboardButtonType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure KeyboardButtonType
KeyboardButtonTypeRequestPhoneNumber
String
"keyboardButtonTypeRequestLocation" -> KeyboardButtonType -> Parser KeyboardButtonType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure KeyboardButtonType
KeyboardButtonTypeRequestLocation
String
"keyboardButtonTypeRequestPoll" -> Value -> Parser KeyboardButtonType
parseKeyboardButtonTypeRequestPoll Value
v
String
"keyboardButtonTypeRequestUsers" -> Value -> Parser KeyboardButtonType
parseKeyboardButtonTypeRequestUsers Value
v
String
"keyboardButtonTypeRequestChat" -> Value -> Parser KeyboardButtonType
parseKeyboardButtonTypeRequestChat Value
v
String
"keyboardButtonTypeWebApp" -> Value -> Parser KeyboardButtonType
parseKeyboardButtonTypeWebApp Value
v
String
_ -> Parser KeyboardButtonType
forall a. Monoid a => a
mempty
where
parseKeyboardButtonTypeRequestPoll :: A.Value -> AT.Parser KeyboardButtonType
parseKeyboardButtonTypeRequestPoll :: Value -> Parser KeyboardButtonType
parseKeyboardButtonTypeRequestPoll = String
-> (Object -> Parser KeyboardButtonType)
-> Value
-> Parser KeyboardButtonType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"KeyboardButtonTypeRequestPoll" ((Object -> Parser KeyboardButtonType)
-> Value -> Parser KeyboardButtonType)
-> (Object -> Parser KeyboardButtonType)
-> Value
-> Parser KeyboardButtonType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Bool
force_regular_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"force_regular"
Maybe Bool
force_quiz_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"force_quiz"
KeyboardButtonType -> Parser KeyboardButtonType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (KeyboardButtonType -> Parser KeyboardButtonType)
-> KeyboardButtonType -> Parser KeyboardButtonType
forall a b. (a -> b) -> a -> b
$ KeyboardButtonTypeRequestPoll
{ force_regular :: Maybe Bool
force_regular = Maybe Bool
force_regular_
, force_quiz :: Maybe Bool
force_quiz = Maybe Bool
force_quiz_
}
parseKeyboardButtonTypeRequestUsers :: A.Value -> AT.Parser KeyboardButtonType
parseKeyboardButtonTypeRequestUsers :: Value -> Parser KeyboardButtonType
parseKeyboardButtonTypeRequestUsers = String
-> (Object -> Parser KeyboardButtonType)
-> Value
-> Parser KeyboardButtonType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"KeyboardButtonTypeRequestUsers" ((Object -> Parser KeyboardButtonType)
-> Value -> Parser KeyboardButtonType)
-> (Object -> Parser KeyboardButtonType)
-> Value
-> Parser KeyboardButtonType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Int
_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"id"
Maybe Bool
restrict_user_is_bot_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"restrict_user_is_bot"
Maybe Bool
user_is_bot_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"user_is_bot"
Maybe Bool
restrict_user_is_premium_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"restrict_user_is_premium"
Maybe Bool
user_is_premium_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"user_is_premium"
Maybe Int
max_quantity_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"max_quantity"
Maybe Bool
request_name_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"request_name"
Maybe Bool
request_username_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"request_username"
Maybe Bool
request_photo_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"request_photo"
KeyboardButtonType -> Parser KeyboardButtonType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (KeyboardButtonType -> Parser KeyboardButtonType)
-> KeyboardButtonType -> Parser KeyboardButtonType
forall a b. (a -> b) -> a -> b
$ KeyboardButtonTypeRequestUsers
{ _id :: Maybe Int
_id = Maybe Int
_id_
, restrict_user_is_bot :: Maybe Bool
restrict_user_is_bot = Maybe Bool
restrict_user_is_bot_
, user_is_bot :: Maybe Bool
user_is_bot = Maybe Bool
user_is_bot_
, restrict_user_is_premium :: Maybe Bool
restrict_user_is_premium = Maybe Bool
restrict_user_is_premium_
, user_is_premium :: Maybe Bool
user_is_premium = Maybe Bool
user_is_premium_
, max_quantity :: Maybe Int
max_quantity = Maybe Int
max_quantity_
, request_name :: Maybe Bool
request_name = Maybe Bool
request_name_
, request_username :: Maybe Bool
request_username = Maybe Bool
request_username_
, request_photo :: Maybe Bool
request_photo = Maybe Bool
request_photo_
}
parseKeyboardButtonTypeRequestChat :: A.Value -> AT.Parser KeyboardButtonType
parseKeyboardButtonTypeRequestChat :: Value -> Parser KeyboardButtonType
parseKeyboardButtonTypeRequestChat = String
-> (Object -> Parser KeyboardButtonType)
-> Value
-> Parser KeyboardButtonType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"KeyboardButtonTypeRequestChat" ((Object -> Parser KeyboardButtonType)
-> Value -> Parser KeyboardButtonType)
-> (Object -> Parser KeyboardButtonType)
-> Value
-> Parser KeyboardButtonType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Int
_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"id"
Maybe Bool
chat_is_channel_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"chat_is_channel"
Maybe Bool
restrict_chat_is_forum_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"restrict_chat_is_forum"
Maybe Bool
chat_is_forum_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"chat_is_forum"
Maybe Bool
restrict_chat_has_username_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"restrict_chat_has_username"
Maybe Bool
chat_has_username_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"chat_has_username"
Maybe Bool
chat_is_created_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"chat_is_created"
Maybe ChatAdministratorRights
user_administrator_rights_ <- Object
o Object -> Key -> Parser (Maybe ChatAdministratorRights)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"user_administrator_rights"
Maybe ChatAdministratorRights
bot_administrator_rights_ <- Object
o Object -> Key -> Parser (Maybe ChatAdministratorRights)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"bot_administrator_rights"
Maybe Bool
bot_is_member_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"bot_is_member"
Maybe Bool
request_title_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"request_title"
Maybe Bool
request_username_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"request_username"
Maybe Bool
request_photo_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"request_photo"
KeyboardButtonType -> Parser KeyboardButtonType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (KeyboardButtonType -> Parser KeyboardButtonType)
-> KeyboardButtonType -> Parser KeyboardButtonType
forall a b. (a -> b) -> a -> b
$ KeyboardButtonTypeRequestChat
{ _id :: Maybe Int
_id = Maybe Int
_id_
, chat_is_channel :: Maybe Bool
chat_is_channel = Maybe Bool
chat_is_channel_
, restrict_chat_is_forum :: Maybe Bool
restrict_chat_is_forum = Maybe Bool
restrict_chat_is_forum_
, chat_is_forum :: Maybe Bool
chat_is_forum = Maybe Bool
chat_is_forum_
, restrict_chat_has_username :: Maybe Bool
restrict_chat_has_username = Maybe Bool
restrict_chat_has_username_
, chat_has_username :: Maybe Bool
chat_has_username = Maybe Bool
chat_has_username_
, chat_is_created :: Maybe Bool
chat_is_created = Maybe Bool
chat_is_created_
, user_administrator_rights :: Maybe ChatAdministratorRights
user_administrator_rights = Maybe ChatAdministratorRights
user_administrator_rights_
, bot_administrator_rights :: Maybe ChatAdministratorRights
bot_administrator_rights = Maybe ChatAdministratorRights
bot_administrator_rights_
, bot_is_member :: Maybe Bool
bot_is_member = Maybe Bool
bot_is_member_
, request_title :: Maybe Bool
request_title = Maybe Bool
request_title_
, request_username :: Maybe Bool
request_username = Maybe Bool
request_username_
, request_photo :: Maybe Bool
request_photo = Maybe Bool
request_photo_
}
parseKeyboardButtonTypeWebApp :: A.Value -> AT.Parser KeyboardButtonType
parseKeyboardButtonTypeWebApp :: Value -> Parser KeyboardButtonType
parseKeyboardButtonTypeWebApp = String
-> (Object -> Parser KeyboardButtonType)
-> Value
-> Parser KeyboardButtonType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"KeyboardButtonTypeWebApp" ((Object -> Parser KeyboardButtonType)
-> Value -> Parser KeyboardButtonType)
-> (Object -> Parser KeyboardButtonType)
-> Value
-> Parser KeyboardButtonType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
url_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"url"
KeyboardButtonType -> Parser KeyboardButtonType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (KeyboardButtonType -> Parser KeyboardButtonType)
-> KeyboardButtonType -> Parser KeyboardButtonType
forall a b. (a -> b) -> a -> b
$ KeyboardButtonTypeWebApp
{ url :: Maybe Text
url = Maybe Text
url_
}
parseJSON Value
_ = Parser KeyboardButtonType
forall a. Monoid a => a
mempty
instance AT.ToJSON KeyboardButtonType where
toJSON :: KeyboardButtonType -> Value
toJSON KeyboardButtonType
KeyboardButtonTypeText
= [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
"keyboardButtonTypeText"
]
toJSON KeyboardButtonType
KeyboardButtonTypeRequestPhoneNumber
= [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
"keyboardButtonTypeRequestPhoneNumber"
]
toJSON KeyboardButtonType
KeyboardButtonTypeRequestLocation
= [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
"keyboardButtonTypeRequestLocation"
]
toJSON KeyboardButtonTypeRequestPoll
{ force_regular :: KeyboardButtonType -> Maybe Bool
force_regular = Maybe Bool
force_regular_
, force_quiz :: KeyboardButtonType -> Maybe Bool
force_quiz = Maybe Bool
force_quiz_
}
= [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
"keyboardButtonTypeRequestPoll"
, Key
"force_regular" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
force_regular_
, Key
"force_quiz" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
force_quiz_
]
toJSON KeyboardButtonTypeRequestUsers
{ _id :: KeyboardButtonType -> Maybe Int
_id = Maybe Int
_id_
, restrict_user_is_bot :: KeyboardButtonType -> Maybe Bool
restrict_user_is_bot = Maybe Bool
restrict_user_is_bot_
, user_is_bot :: KeyboardButtonType -> Maybe Bool
user_is_bot = Maybe Bool
user_is_bot_
, restrict_user_is_premium :: KeyboardButtonType -> Maybe Bool
restrict_user_is_premium = Maybe Bool
restrict_user_is_premium_
, user_is_premium :: KeyboardButtonType -> Maybe Bool
user_is_premium = Maybe Bool
user_is_premium_
, max_quantity :: KeyboardButtonType -> Maybe Int
max_quantity = Maybe Int
max_quantity_
, request_name :: KeyboardButtonType -> Maybe Bool
request_name = Maybe Bool
request_name_
, request_username :: KeyboardButtonType -> Maybe Bool
request_username = Maybe Bool
request_username_
, request_photo :: KeyboardButtonType -> Maybe Bool
request_photo = Maybe Bool
request_photo_
}
= [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
"keyboardButtonTypeRequestUsers"
, Key
"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
_id_
, Key
"restrict_user_is_bot" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
restrict_user_is_bot_
, Key
"user_is_bot" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
user_is_bot_
, Key
"restrict_user_is_premium" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
restrict_user_is_premium_
, Key
"user_is_premium" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
user_is_premium_
, Key
"max_quantity" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
max_quantity_
, Key
"request_name" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
request_name_
, Key
"request_username" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
request_username_
, Key
"request_photo" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
request_photo_
]
toJSON KeyboardButtonTypeRequestChat
{ _id :: KeyboardButtonType -> Maybe Int
_id = Maybe Int
_id_
, chat_is_channel :: KeyboardButtonType -> Maybe Bool
chat_is_channel = Maybe Bool
chat_is_channel_
, restrict_chat_is_forum :: KeyboardButtonType -> Maybe Bool
restrict_chat_is_forum = Maybe Bool
restrict_chat_is_forum_
, chat_is_forum :: KeyboardButtonType -> Maybe Bool
chat_is_forum = Maybe Bool
chat_is_forum_
, restrict_chat_has_username :: KeyboardButtonType -> Maybe Bool
restrict_chat_has_username = Maybe Bool
restrict_chat_has_username_
, chat_has_username :: KeyboardButtonType -> Maybe Bool
chat_has_username = Maybe Bool
chat_has_username_
, chat_is_created :: KeyboardButtonType -> Maybe Bool
chat_is_created = Maybe Bool
chat_is_created_
, user_administrator_rights :: KeyboardButtonType -> Maybe ChatAdministratorRights
user_administrator_rights = Maybe ChatAdministratorRights
user_administrator_rights_
, bot_administrator_rights :: KeyboardButtonType -> Maybe ChatAdministratorRights
bot_administrator_rights = Maybe ChatAdministratorRights
bot_administrator_rights_
, bot_is_member :: KeyboardButtonType -> Maybe Bool
bot_is_member = Maybe Bool
bot_is_member_
, request_title :: KeyboardButtonType -> Maybe Bool
request_title = Maybe Bool
request_title_
, request_username :: KeyboardButtonType -> Maybe Bool
request_username = Maybe Bool
request_username_
, request_photo :: KeyboardButtonType -> Maybe Bool
request_photo = Maybe Bool
request_photo_
}
= [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
"keyboardButtonTypeRequestChat"
, Key
"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
_id_
, Key
"chat_is_channel" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
chat_is_channel_
, Key
"restrict_chat_is_forum" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
restrict_chat_is_forum_
, Key
"chat_is_forum" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
chat_is_forum_
, Key
"restrict_chat_has_username" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
restrict_chat_has_username_
, Key
"chat_has_username" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
chat_has_username_
, Key
"chat_is_created" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
chat_is_created_
, Key
"user_administrator_rights" Key -> Maybe ChatAdministratorRights -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe ChatAdministratorRights
user_administrator_rights_
, Key
"bot_administrator_rights" Key -> Maybe ChatAdministratorRights -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe ChatAdministratorRights
bot_administrator_rights_
, Key
"bot_is_member" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
bot_is_member_
, Key
"request_title" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
request_title_
, Key
"request_username" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
request_username_
, Key
"request_photo" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
request_photo_
]
toJSON KeyboardButtonTypeWebApp
{ url :: KeyboardButtonType -> Maybe Text
url = Maybe Text
url_
}
= [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
"keyboardButtonTypeWebApp"
, Key
"url" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
url_
]