module TD.Data.InlineKeyboardButtonType
(InlineKeyboardButtonType(..)) 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 Data.ByteString as BS
import qualified TD.Data.TargetChat as TargetChat
data InlineKeyboardButtonType
= InlineKeyboardButtonTypeUrl
{ InlineKeyboardButtonType -> Maybe Text
url :: Maybe T.Text
}
| InlineKeyboardButtonTypeLoginUrl
{ url :: Maybe T.Text
, InlineKeyboardButtonType -> Maybe Int
_id :: Maybe Int
, InlineKeyboardButtonType -> Maybe Text
forward_text :: Maybe T.Text
}
| InlineKeyboardButtonTypeWebApp
{ url :: Maybe T.Text
}
| InlineKeyboardButtonTypeCallback
{ InlineKeyboardButtonType -> Maybe ByteString
_data :: Maybe BS.ByteString
}
| InlineKeyboardButtonTypeCallbackWithPassword
{ _data :: Maybe BS.ByteString
}
| InlineKeyboardButtonTypeCallbackGame
| InlineKeyboardButtonTypeSwitchInline
{ InlineKeyboardButtonType -> Maybe Text
query :: Maybe T.Text
, InlineKeyboardButtonType -> Maybe TargetChat
target_chat :: Maybe TargetChat.TargetChat
}
| InlineKeyboardButtonTypeBuy
| InlineKeyboardButtonTypeUser
{ InlineKeyboardButtonType -> Maybe Int
user_id :: Maybe Int
}
| InlineKeyboardButtonTypeCopyText
{ InlineKeyboardButtonType -> Maybe Text
text :: Maybe T.Text
}
deriving (InlineKeyboardButtonType -> InlineKeyboardButtonType -> Bool
(InlineKeyboardButtonType -> InlineKeyboardButtonType -> Bool)
-> (InlineKeyboardButtonType -> InlineKeyboardButtonType -> Bool)
-> Eq InlineKeyboardButtonType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: InlineKeyboardButtonType -> InlineKeyboardButtonType -> Bool
== :: InlineKeyboardButtonType -> InlineKeyboardButtonType -> Bool
$c/= :: InlineKeyboardButtonType -> InlineKeyboardButtonType -> Bool
/= :: InlineKeyboardButtonType -> InlineKeyboardButtonType -> Bool
Eq, Int -> InlineKeyboardButtonType -> ShowS
[InlineKeyboardButtonType] -> ShowS
InlineKeyboardButtonType -> String
(Int -> InlineKeyboardButtonType -> ShowS)
-> (InlineKeyboardButtonType -> String)
-> ([InlineKeyboardButtonType] -> ShowS)
-> Show InlineKeyboardButtonType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InlineKeyboardButtonType -> ShowS
showsPrec :: Int -> InlineKeyboardButtonType -> ShowS
$cshow :: InlineKeyboardButtonType -> String
show :: InlineKeyboardButtonType -> String
$cshowList :: [InlineKeyboardButtonType] -> ShowS
showList :: [InlineKeyboardButtonType] -> ShowS
Show)
instance I.ShortShow InlineKeyboardButtonType where
shortShow :: InlineKeyboardButtonType -> String
shortShow InlineKeyboardButtonTypeUrl
{ url :: InlineKeyboardButtonType -> Maybe Text
url = Maybe Text
url_
}
= String
"InlineKeyboardButtonTypeUrl"
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_
]
shortShow InlineKeyboardButtonTypeLoginUrl
{ url :: InlineKeyboardButtonType -> Maybe Text
url = Maybe Text
url_
, _id :: InlineKeyboardButtonType -> Maybe Int
_id = Maybe Int
_id_
, forward_text :: InlineKeyboardButtonType -> Maybe Text
forward_text = Maybe Text
forward_text_
}
= String
"InlineKeyboardButtonTypeLoginUrl"
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_
, String
"_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
_id_
, String
"forward_text" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
forward_text_
]
shortShow InlineKeyboardButtonTypeWebApp
{ url :: InlineKeyboardButtonType -> Maybe Text
url = Maybe Text
url_
}
= String
"InlineKeyboardButtonTypeWebApp"
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_
]
shortShow InlineKeyboardButtonTypeCallback
{ _data :: InlineKeyboardButtonType -> Maybe ByteString
_data = Maybe ByteString
_data_
}
= String
"InlineKeyboardButtonTypeCallback"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"_data" String -> Maybe ByteString -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ByteString
_data_
]
shortShow InlineKeyboardButtonTypeCallbackWithPassword
{ _data :: InlineKeyboardButtonType -> Maybe ByteString
_data = Maybe ByteString
_data_
}
= String
"InlineKeyboardButtonTypeCallbackWithPassword"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"_data" String -> Maybe ByteString -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ByteString
_data_
]
shortShow InlineKeyboardButtonType
InlineKeyboardButtonTypeCallbackGame
= String
"InlineKeyboardButtonTypeCallbackGame"
shortShow InlineKeyboardButtonTypeSwitchInline
{ query :: InlineKeyboardButtonType -> Maybe Text
query = Maybe Text
query_
, target_chat :: InlineKeyboardButtonType -> Maybe TargetChat
target_chat = Maybe TargetChat
target_chat_
}
= String
"InlineKeyboardButtonTypeSwitchInline"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"query" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
query_
, String
"target_chat" String -> Maybe TargetChat -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe TargetChat
target_chat_
]
shortShow InlineKeyboardButtonType
InlineKeyboardButtonTypeBuy
= String
"InlineKeyboardButtonTypeBuy"
shortShow InlineKeyboardButtonTypeUser
{ user_id :: InlineKeyboardButtonType -> Maybe Int
user_id = Maybe Int
user_id_
}
= String
"InlineKeyboardButtonTypeUser"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"user_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
]
shortShow InlineKeyboardButtonTypeCopyText
{ text :: InlineKeyboardButtonType -> Maybe Text
text = Maybe Text
text_
}
= String
"InlineKeyboardButtonTypeCopyText"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"text" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
text_
]
instance AT.FromJSON InlineKeyboardButtonType where
parseJSON :: Value -> Parser InlineKeyboardButtonType
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
"inlineKeyboardButtonTypeUrl" -> Value -> Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeUrl Value
v
String
"inlineKeyboardButtonTypeLoginUrl" -> Value -> Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeLoginUrl Value
v
String
"inlineKeyboardButtonTypeWebApp" -> Value -> Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeWebApp Value
v
String
"inlineKeyboardButtonTypeCallback" -> Value -> Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeCallback Value
v
String
"inlineKeyboardButtonTypeCallbackWithPassword" -> Value -> Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeCallbackWithPassword Value
v
String
"inlineKeyboardButtonTypeCallbackGame" -> InlineKeyboardButtonType -> Parser InlineKeyboardButtonType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure InlineKeyboardButtonType
InlineKeyboardButtonTypeCallbackGame
String
"inlineKeyboardButtonTypeSwitchInline" -> Value -> Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeSwitchInline Value
v
String
"inlineKeyboardButtonTypeBuy" -> InlineKeyboardButtonType -> Parser InlineKeyboardButtonType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure InlineKeyboardButtonType
InlineKeyboardButtonTypeBuy
String
"inlineKeyboardButtonTypeUser" -> Value -> Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeUser Value
v
String
"inlineKeyboardButtonTypeCopyText" -> Value -> Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeCopyText Value
v
String
_ -> Parser InlineKeyboardButtonType
forall a. Monoid a => a
mempty
where
parseInlineKeyboardButtonTypeUrl :: A.Value -> AT.Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeUrl :: Value -> Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeUrl = String
-> (Object -> Parser InlineKeyboardButtonType)
-> Value
-> Parser InlineKeyboardButtonType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InlineKeyboardButtonTypeUrl" ((Object -> Parser InlineKeyboardButtonType)
-> Value -> Parser InlineKeyboardButtonType)
-> (Object -> Parser InlineKeyboardButtonType)
-> Value
-> Parser InlineKeyboardButtonType
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"
InlineKeyboardButtonType -> Parser InlineKeyboardButtonType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InlineKeyboardButtonType -> Parser InlineKeyboardButtonType)
-> InlineKeyboardButtonType -> Parser InlineKeyboardButtonType
forall a b. (a -> b) -> a -> b
$ InlineKeyboardButtonTypeUrl
{ url :: Maybe Text
url = Maybe Text
url_
}
parseInlineKeyboardButtonTypeLoginUrl :: A.Value -> AT.Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeLoginUrl :: Value -> Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeLoginUrl = String
-> (Object -> Parser InlineKeyboardButtonType)
-> Value
-> Parser InlineKeyboardButtonType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InlineKeyboardButtonTypeLoginUrl" ((Object -> Parser InlineKeyboardButtonType)
-> Value -> Parser InlineKeyboardButtonType)
-> (Object -> Parser InlineKeyboardButtonType)
-> Value
-> Parser InlineKeyboardButtonType
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"
Maybe Int
_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"id"
Maybe Text
forward_text_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"forward_text"
InlineKeyboardButtonType -> Parser InlineKeyboardButtonType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InlineKeyboardButtonType -> Parser InlineKeyboardButtonType)
-> InlineKeyboardButtonType -> Parser InlineKeyboardButtonType
forall a b. (a -> b) -> a -> b
$ InlineKeyboardButtonTypeLoginUrl
{ url :: Maybe Text
url = Maybe Text
url_
, _id :: Maybe Int
_id = Maybe Int
_id_
, forward_text :: Maybe Text
forward_text = Maybe Text
forward_text_
}
parseInlineKeyboardButtonTypeWebApp :: A.Value -> AT.Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeWebApp :: Value -> Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeWebApp = String
-> (Object -> Parser InlineKeyboardButtonType)
-> Value
-> Parser InlineKeyboardButtonType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InlineKeyboardButtonTypeWebApp" ((Object -> Parser InlineKeyboardButtonType)
-> Value -> Parser InlineKeyboardButtonType)
-> (Object -> Parser InlineKeyboardButtonType)
-> Value
-> Parser InlineKeyboardButtonType
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"
InlineKeyboardButtonType -> Parser InlineKeyboardButtonType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InlineKeyboardButtonType -> Parser InlineKeyboardButtonType)
-> InlineKeyboardButtonType -> Parser InlineKeyboardButtonType
forall a b. (a -> b) -> a -> b
$ InlineKeyboardButtonTypeWebApp
{ url :: Maybe Text
url = Maybe Text
url_
}
parseInlineKeyboardButtonTypeCallback :: A.Value -> AT.Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeCallback :: Value -> Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeCallback = String
-> (Object -> Parser InlineKeyboardButtonType)
-> Value
-> Parser InlineKeyboardButtonType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InlineKeyboardButtonTypeCallback" ((Object -> Parser InlineKeyboardButtonType)
-> Value -> Parser InlineKeyboardButtonType)
-> (Object -> Parser InlineKeyboardButtonType)
-> Value
-> Parser InlineKeyboardButtonType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe ByteString
_data_ <- (String -> ByteString) -> Maybe String -> Maybe ByteString
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> ByteString
I.readBytes (Maybe String -> Maybe ByteString)
-> Parser (Maybe String) -> Parser (Maybe ByteString)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"data"
InlineKeyboardButtonType -> Parser InlineKeyboardButtonType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InlineKeyboardButtonType -> Parser InlineKeyboardButtonType)
-> InlineKeyboardButtonType -> Parser InlineKeyboardButtonType
forall a b. (a -> b) -> a -> b
$ InlineKeyboardButtonTypeCallback
{ _data :: Maybe ByteString
_data = Maybe ByteString
_data_
}
parseInlineKeyboardButtonTypeCallbackWithPassword :: A.Value -> AT.Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeCallbackWithPassword :: Value -> Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeCallbackWithPassword = String
-> (Object -> Parser InlineKeyboardButtonType)
-> Value
-> Parser InlineKeyboardButtonType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InlineKeyboardButtonTypeCallbackWithPassword" ((Object -> Parser InlineKeyboardButtonType)
-> Value -> Parser InlineKeyboardButtonType)
-> (Object -> Parser InlineKeyboardButtonType)
-> Value
-> Parser InlineKeyboardButtonType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe ByteString
_data_ <- (String -> ByteString) -> Maybe String -> Maybe ByteString
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> ByteString
I.readBytes (Maybe String -> Maybe ByteString)
-> Parser (Maybe String) -> Parser (Maybe ByteString)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"data"
InlineKeyboardButtonType -> Parser InlineKeyboardButtonType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InlineKeyboardButtonType -> Parser InlineKeyboardButtonType)
-> InlineKeyboardButtonType -> Parser InlineKeyboardButtonType
forall a b. (a -> b) -> a -> b
$ InlineKeyboardButtonTypeCallbackWithPassword
{ _data :: Maybe ByteString
_data = Maybe ByteString
_data_
}
parseInlineKeyboardButtonTypeSwitchInline :: A.Value -> AT.Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeSwitchInline :: Value -> Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeSwitchInline = String
-> (Object -> Parser InlineKeyboardButtonType)
-> Value
-> Parser InlineKeyboardButtonType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InlineKeyboardButtonTypeSwitchInline" ((Object -> Parser InlineKeyboardButtonType)
-> Value -> Parser InlineKeyboardButtonType)
-> (Object -> Parser InlineKeyboardButtonType)
-> Value
-> Parser InlineKeyboardButtonType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
query_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"query"
Maybe TargetChat
target_chat_ <- Object
o Object -> Key -> Parser (Maybe TargetChat)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"target_chat"
InlineKeyboardButtonType -> Parser InlineKeyboardButtonType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InlineKeyboardButtonType -> Parser InlineKeyboardButtonType)
-> InlineKeyboardButtonType -> Parser InlineKeyboardButtonType
forall a b. (a -> b) -> a -> b
$ InlineKeyboardButtonTypeSwitchInline
{ query :: Maybe Text
query = Maybe Text
query_
, target_chat :: Maybe TargetChat
target_chat = Maybe TargetChat
target_chat_
}
parseInlineKeyboardButtonTypeUser :: A.Value -> AT.Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeUser :: Value -> Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeUser = String
-> (Object -> Parser InlineKeyboardButtonType)
-> Value
-> Parser InlineKeyboardButtonType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InlineKeyboardButtonTypeUser" ((Object -> Parser InlineKeyboardButtonType)
-> Value -> Parser InlineKeyboardButtonType)
-> (Object -> Parser InlineKeyboardButtonType)
-> Value
-> Parser InlineKeyboardButtonType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Int
user_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"user_id"
InlineKeyboardButtonType -> Parser InlineKeyboardButtonType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InlineKeyboardButtonType -> Parser InlineKeyboardButtonType)
-> InlineKeyboardButtonType -> Parser InlineKeyboardButtonType
forall a b. (a -> b) -> a -> b
$ InlineKeyboardButtonTypeUser
{ user_id :: Maybe Int
user_id = Maybe Int
user_id_
}
parseInlineKeyboardButtonTypeCopyText :: A.Value -> AT.Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeCopyText :: Value -> Parser InlineKeyboardButtonType
parseInlineKeyboardButtonTypeCopyText = String
-> (Object -> Parser InlineKeyboardButtonType)
-> Value
-> Parser InlineKeyboardButtonType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InlineKeyboardButtonTypeCopyText" ((Object -> Parser InlineKeyboardButtonType)
-> Value -> Parser InlineKeyboardButtonType)
-> (Object -> Parser InlineKeyboardButtonType)
-> Value
-> Parser InlineKeyboardButtonType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
text_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"text"
InlineKeyboardButtonType -> Parser InlineKeyboardButtonType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InlineKeyboardButtonType -> Parser InlineKeyboardButtonType)
-> InlineKeyboardButtonType -> Parser InlineKeyboardButtonType
forall a b. (a -> b) -> a -> b
$ InlineKeyboardButtonTypeCopyText
{ text :: Maybe Text
text = Maybe Text
text_
}
parseJSON Value
_ = Parser InlineKeyboardButtonType
forall a. Monoid a => a
mempty
instance AT.ToJSON InlineKeyboardButtonType where
toJSON :: InlineKeyboardButtonType -> Value
toJSON InlineKeyboardButtonTypeUrl
{ url :: InlineKeyboardButtonType -> 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
"inlineKeyboardButtonTypeUrl"
, 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_
]
toJSON InlineKeyboardButtonTypeLoginUrl
{ url :: InlineKeyboardButtonType -> Maybe Text
url = Maybe Text
url_
, _id :: InlineKeyboardButtonType -> Maybe Int
_id = Maybe Int
_id_
, forward_text :: InlineKeyboardButtonType -> Maybe Text
forward_text = Maybe Text
forward_text_
}
= [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
"inlineKeyboardButtonTypeLoginUrl"
, 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_
, 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
"forward_text" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
forward_text_
]
toJSON InlineKeyboardButtonTypeWebApp
{ url :: InlineKeyboardButtonType -> 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
"inlineKeyboardButtonTypeWebApp"
, 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_
]
toJSON InlineKeyboardButtonTypeCallback
{ _data :: InlineKeyboardButtonType -> Maybe ByteString
_data = Maybe ByteString
_data_
}
= [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
"inlineKeyboardButtonTypeCallback"
, Key
"data" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (ByteString -> Value) -> Maybe ByteString -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Value
I.writeBytes Maybe ByteString
_data_
]
toJSON InlineKeyboardButtonTypeCallbackWithPassword
{ _data :: InlineKeyboardButtonType -> Maybe ByteString
_data = Maybe ByteString
_data_
}
= [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
"inlineKeyboardButtonTypeCallbackWithPassword"
, Key
"data" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (ByteString -> Value) -> Maybe ByteString -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Value
I.writeBytes Maybe ByteString
_data_
]
toJSON InlineKeyboardButtonType
InlineKeyboardButtonTypeCallbackGame
= [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
"inlineKeyboardButtonTypeCallbackGame"
]
toJSON InlineKeyboardButtonTypeSwitchInline
{ query :: InlineKeyboardButtonType -> Maybe Text
query = Maybe Text
query_
, target_chat :: InlineKeyboardButtonType -> Maybe TargetChat
target_chat = Maybe TargetChat
target_chat_
}
= [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
"inlineKeyboardButtonTypeSwitchInline"
, Key
"query" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
query_
, Key
"target_chat" Key -> Maybe TargetChat -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe TargetChat
target_chat_
]
toJSON InlineKeyboardButtonType
InlineKeyboardButtonTypeBuy
= [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
"inlineKeyboardButtonTypeBuy"
]
toJSON InlineKeyboardButtonTypeUser
{ user_id :: InlineKeyboardButtonType -> Maybe Int
user_id = Maybe Int
user_id_
}
= [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
"inlineKeyboardButtonTypeUser"
, Key
"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
user_id_
]
toJSON InlineKeyboardButtonTypeCopyText
{ text :: InlineKeyboardButtonType -> Maybe Text
text = Maybe Text
text_
}
= [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
"inlineKeyboardButtonTypeCopyText"
, Key
"text" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
text_
]