{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
module Telegram.Bot.API.InlineMode.InlineQueryResult where
import Data.Aeson
( FromJSON (..), ToJSON (..), KeyValue ((.=)), Value (..)
, withObject, (.:), (.:?)
)
import Data.Aeson.Types (Parser)
import Data.Hashable (Hashable)
import Data.Text (Text)
import GHC.Generics (Generic)
import Telegram.Bot.API.Internal.Utils
import Telegram.Bot.API.Types
import Telegram.Bot.API.InlineMode.InputMessageContent
import Telegram.Bot.API.Internal.TH (makeDefault)
import qualified Data.Text as Text
newtype InlineQueryResultId = InlineQueryResultId Text
deriving (InlineQueryResultId -> InlineQueryResultId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InlineQueryResultId -> InlineQueryResultId -> Bool
$c/= :: InlineQueryResultId -> InlineQueryResultId -> Bool
== :: InlineQueryResultId -> InlineQueryResultId -> Bool
$c== :: InlineQueryResultId -> InlineQueryResultId -> Bool
Eq, Int -> InlineQueryResultId -> ShowS
[InlineQueryResultId] -> ShowS
InlineQueryResultId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InlineQueryResultId] -> ShowS
$cshowList :: [InlineQueryResultId] -> ShowS
show :: InlineQueryResultId -> String
$cshow :: InlineQueryResultId -> String
showsPrec :: Int -> InlineQueryResultId -> ShowS
$cshowsPrec :: Int -> InlineQueryResultId -> ShowS
Show, forall x. Rep InlineQueryResultId x -> InlineQueryResultId
forall x. InlineQueryResultId -> Rep InlineQueryResultId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InlineQueryResultId x -> InlineQueryResultId
$cfrom :: forall x. InlineQueryResultId -> Rep InlineQueryResultId x
Generic, [InlineQueryResultId] -> Encoding
[InlineQueryResultId] -> Value
InlineQueryResultId -> Encoding
InlineQueryResultId -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [InlineQueryResultId] -> Encoding
$ctoEncodingList :: [InlineQueryResultId] -> Encoding
toJSONList :: [InlineQueryResultId] -> Value
$ctoJSONList :: [InlineQueryResultId] -> Value
toEncoding :: InlineQueryResultId -> Encoding
$ctoEncoding :: InlineQueryResultId -> Encoding
toJSON :: InlineQueryResultId -> Value
$ctoJSON :: InlineQueryResultId -> Value
ToJSON, Value -> Parser [InlineQueryResultId]
Value -> Parser InlineQueryResultId
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [InlineQueryResultId]
$cparseJSONList :: Value -> Parser [InlineQueryResultId]
parseJSON :: Value -> Parser InlineQueryResultId
$cparseJSON :: Value -> Parser InlineQueryResultId
FromJSON, Eq InlineQueryResultId
Int -> InlineQueryResultId -> Int
InlineQueryResultId -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: InlineQueryResultId -> Int
$chash :: InlineQueryResultId -> Int
hashWithSalt :: Int -> InlineQueryResultId -> Int
$chashWithSalt :: Int -> InlineQueryResultId -> Int
Hashable)
data InlineQueryResultGeneric = InlineQueryResultGeneric
{ InlineQueryResultGeneric -> InlineQueryResultId
inlineQueryResultId :: InlineQueryResultId
, InlineQueryResultGeneric -> Maybe Text
inlineQueryResultTitle :: Maybe Text
, InlineQueryResultGeneric -> Maybe Text
inlineQueryResultCaption :: Maybe Text
, InlineQueryResultGeneric -> Maybe Text
inlineQueryResultParseMode :: Maybe Text
, InlineQueryResultGeneric -> Maybe [MessageEntity]
inlineQueryResultCaptionEntities :: Maybe [MessageEntity]
, InlineQueryResultGeneric -> Maybe InlineKeyboardMarkup
inlineQueryResultReplyMarkup :: Maybe InlineKeyboardMarkup
, InlineQueryResultGeneric -> Maybe InputMessageContent
inlineQueryResultInputMessageContent :: Maybe InputMessageContent
, InlineQueryResultGeneric -> Maybe Text
inlineQueryResultDescription :: Maybe Text
}
deriving (forall x.
Rep InlineQueryResultGeneric x -> InlineQueryResultGeneric
forall x.
InlineQueryResultGeneric -> Rep InlineQueryResultGeneric x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InlineQueryResultGeneric x -> InlineQueryResultGeneric
$cfrom :: forall x.
InlineQueryResultGeneric -> Rep InlineQueryResultGeneric x
Generic, Int -> InlineQueryResultGeneric -> ShowS
[InlineQueryResultGeneric] -> ShowS
InlineQueryResultGeneric -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InlineQueryResultGeneric] -> ShowS
$cshowList :: [InlineQueryResultGeneric] -> ShowS
show :: InlineQueryResultGeneric -> String
$cshow :: InlineQueryResultGeneric -> String
showsPrec :: Int -> InlineQueryResultGeneric -> ShowS
$cshowsPrec :: Int -> InlineQueryResultGeneric -> ShowS
Show)
instance ToJSON InlineQueryResultGeneric where toJSON :: InlineQueryResultGeneric -> Value
toJSON = forall a (d :: Meta) (f :: * -> *).
(Generic a, GToJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
a -> Value
gtoJSON
instance FromJSON InlineQueryResultGeneric where parseJSON :: Value -> Parser InlineQueryResultGeneric
parseJSON = forall a (d :: Meta) (f :: * -> *).
(Generic a, GFromJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
Value -> Parser a
gparseJSON
data InlineQueryResultGenericThumbnail = InlineQueryResultGenericThumbnail
{ InlineQueryResultGenericThumbnail -> InlineQueryResultGeneric
inlineQueryResultGenericGeneric :: InlineQueryResultGeneric
, InlineQueryResultGenericThumbnail -> Maybe Text
inlineQueryResultGenericThumbnailUrl :: Maybe Text
, InlineQueryResultGenericThumbnail -> Maybe Text
inlineQueryResultGenericThumbnailMimeType :: Maybe Text
, InlineQueryResultGenericThumbnail -> Maybe Integer
inlineQueryResultGenericThumbnailWidth :: Maybe Integer
, InlineQueryResultGenericThumbnail -> Maybe Integer
inlineQueryResultGenericThumbnailHeight :: Maybe Integer
}
deriving (forall x.
Rep InlineQueryResultGenericThumbnail x
-> InlineQueryResultGenericThumbnail
forall x.
InlineQueryResultGenericThumbnail
-> Rep InlineQueryResultGenericThumbnail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InlineQueryResultGenericThumbnail x
-> InlineQueryResultGenericThumbnail
$cfrom :: forall x.
InlineQueryResultGenericThumbnail
-> Rep InlineQueryResultGenericThumbnail x
Generic, Int -> InlineQueryResultGenericThumbnail -> ShowS
[InlineQueryResultGenericThumbnail] -> ShowS
InlineQueryResultGenericThumbnail -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InlineQueryResultGenericThumbnail] -> ShowS
$cshowList :: [InlineQueryResultGenericThumbnail] -> ShowS
show :: InlineQueryResultGenericThumbnail -> String
$cshow :: InlineQueryResultGenericThumbnail -> String
showsPrec :: Int -> InlineQueryResultGenericThumbnail -> ShowS
$cshowsPrec :: Int -> InlineQueryResultGenericThumbnail -> ShowS
Show)
instance ToJSON InlineQueryResultGenericThumbnail where
toJSON :: InlineQueryResultGenericThumbnail -> Value
toJSON InlineQueryResultGenericThumbnail{Maybe Integer
Maybe Text
InlineQueryResultGeneric
inlineQueryResultGenericThumbnailHeight :: Maybe Integer
inlineQueryResultGenericThumbnailWidth :: Maybe Integer
inlineQueryResultGenericThumbnailMimeType :: Maybe Text
inlineQueryResultGenericThumbnailUrl :: Maybe Text
inlineQueryResultGenericGeneric :: InlineQueryResultGeneric
inlineQueryResultGenericThumbnailHeight :: InlineQueryResultGenericThumbnail -> Maybe Integer
inlineQueryResultGenericThumbnailWidth :: InlineQueryResultGenericThumbnail -> Maybe Integer
inlineQueryResultGenericThumbnailMimeType :: InlineQueryResultGenericThumbnail -> Maybe Text
inlineQueryResultGenericThumbnailUrl :: InlineQueryResultGenericThumbnail -> Maybe Text
inlineQueryResultGenericGeneric :: InlineQueryResultGenericThumbnail -> InlineQueryResultGeneric
..}
= Value -> [Pair] -> Value
addJsonFields (forall a. ToJSON a => a -> Value
toJSON InlineQueryResultGeneric
inlineQueryResultGenericGeneric)
[ Key
"thumbnail_url" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
inlineQueryResultGenericThumbnailUrl
, Key
"thumbnail_mime_type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
inlineQueryResultGenericThumbnailMimeType
, Key
"thumbnail_width" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Integer
inlineQueryResultGenericThumbnailWidth
, Key
"thumbnail_height" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Integer
inlineQueryResultGenericThumbnailHeight
]
instance FromJSON InlineQueryResultGenericThumbnail where
parseJSON :: Value -> Parser InlineQueryResultGenericThumbnail
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
withObject String
"InlineQueryResult" \Object
o -> InlineQueryResultGeneric
-> Maybe Text
-> Maybe Text
-> Maybe Integer
-> Maybe Integer
-> InlineQueryResultGenericThumbnail
InlineQueryResultGenericThumbnail
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
parseJSON (Object -> Value
Object Object
o)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"thumbnail_url"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"thumbnail_mime_type"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"thumbnail_width"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"thumbnail_height"
data InlineQueryResult
= InlineQueryResultArticle
{ InlineQueryResult -> InlineQueryResultGenericThumbnail
inlineQueryResultArticleGeneric :: InlineQueryResultGenericThumbnail
, InlineQueryResult -> Maybe Text
inlineQueryResultArticleUrl :: Maybe Text
, InlineQueryResult -> Maybe Bool
inlineQueryResultArticleHideUrl :: Maybe Bool
}
| InlineQueryResultPhoto
{ InlineQueryResult -> InlineQueryResultGenericThumbnail
inlineQueryResultPhotoGeneric :: InlineQueryResultGenericThumbnail
, InlineQueryResult -> Text
inlineQueryResultPhotoPhotoUrl :: Text
, InlineQueryResult -> Maybe Integer
inlineQueryResultPhotoPhotoWidth :: Maybe Integer
, InlineQueryResult -> Maybe Integer
inlineQueryResultPhotoPhotoHeight :: Maybe Integer
}
| InlineQueryResultGif
{ InlineQueryResult -> InlineQueryResultGenericThumbnail
inlineQueryResultGifGeneric :: InlineQueryResultGenericThumbnail
, InlineQueryResult -> Text
inlineQueryResultGifGifUrl :: Text
, InlineQueryResult -> Maybe Integer
inlineQueryResultGifGifWidth :: Maybe Integer
, InlineQueryResult -> Maybe Integer
inlineQueryResultGifGifHeight :: Maybe Integer
, InlineQueryResult -> Maybe Integer
inlineQueryResultGifGifDuration :: Maybe Integer
}
| InlineQueryResultMpeg4Gif
{ InlineQueryResult -> InlineQueryResultGenericThumbnail
inlineQueryResultMpeg4GifGeneric :: InlineQueryResultGenericThumbnail
, InlineQueryResult -> Text
inlineQueryResultMpeg4GifMpeg4Url :: Text
, InlineQueryResult -> Maybe Integer
inlineQueryResultMpeg4GifMpeg4Width :: Maybe Integer
, InlineQueryResult -> Maybe Integer
inlineQueryResultMpeg4GifMpeg4Height :: Maybe Integer
, InlineQueryResult -> Maybe Integer
inlineQueryResultMpeg4GifMpeg4Duration :: Maybe Integer
}
| InlineQueryResultVideo
{ InlineQueryResult -> InlineQueryResultGenericThumbnail
inlineQueryResultVideoGeneric :: InlineQueryResultGenericThumbnail
, InlineQueryResult -> Text
inlineQueryResultVideoVideoUrl :: Text
, InlineQueryResult -> Text
inlineQueryResultVideoMimeType :: Text
, InlineQueryResult -> Maybe Integer
inlineQueryResultVideoVideoWidth :: Maybe Integer
, InlineQueryResult -> Maybe Integer
inlineQueryResultVideoVideoHeight :: Maybe Integer
, InlineQueryResult -> Maybe Integer
inlineQueryResultVideoVideoDuration :: Maybe Integer
}
| InlineQueryResultAudio
{ InlineQueryResult -> InlineQueryResultGeneric
inlineQueryResultAudioGeneric :: InlineQueryResultGeneric
, InlineQueryResult -> Text
inlineQueryResultAudioAudioUrl :: Text
, InlineQueryResult -> Maybe Text
inlineQueryResultAudioPerformer :: Maybe Text
, InlineQueryResult -> Maybe Integer
inlineQueryResultAudioAudioDuration :: Maybe Integer
}
| InlineQueryResultVoice
{ InlineQueryResult -> InlineQueryResultGeneric
inlineQueryResultVoiceGeneric :: InlineQueryResultGeneric
, InlineQueryResult -> Text
inlineQueryResultVoiceVoiceUrl :: Text
, InlineQueryResult -> Maybe Integer
inlineQueryResultVoiceVoiceDuration :: Maybe Integer
}
| InlineQueryResultDocument
{ InlineQueryResult -> InlineQueryResultGenericThumbnail
inlineQueryResultDocumentGeneric :: InlineQueryResultGenericThumbnail
, InlineQueryResult -> Text
inlineQueryResultDocumentDocumentUrl :: Text
, InlineQueryResult -> Text
inlineQueryResultDocumentMimeType :: Text
}
| InlineQueryResultLocation
{ InlineQueryResult -> InlineQueryResultGenericThumbnail
inlineQueryResultLocationGeneric :: InlineQueryResultGenericThumbnail
, InlineQueryResult -> Float
inlineQueryResultLocationLatitude :: Float
, InlineQueryResult -> Float
inlineQueryResultLocationLongitude :: Float
, InlineQueryResult -> Maybe Float
inlineQueryResultLocationHorizontalAccuracy :: Maybe Float
, InlineQueryResult -> Maybe Seconds
inlineQueryResultLocationLivePeriod :: Maybe Seconds
, InlineQueryResult -> Maybe Int
inlineQueryResultLocationHeading :: Maybe Int
, InlineQueryResult -> Maybe Int
inlineQueryResultLocationProximityAlertRadius :: Maybe Int
}
| InlineQueryResultVenue
{ InlineQueryResult -> InlineQueryResultGenericThumbnail
inlineQueryResultVenueGeneric :: InlineQueryResultGenericThumbnail
, InlineQueryResult -> Float
inlineQueryResultVenueLatitude :: Float
, InlineQueryResult -> Float
inlineQueryResultVenueLongitude :: Float
, InlineQueryResult -> Text
inlineQueryResultVenueAddress :: Text
, InlineQueryResult -> Maybe Text
inlineQueryResultVenueFoursquareId :: Maybe Text
, InlineQueryResult -> Maybe Text
inlineQueryResultVenueFoursquareType :: Maybe Text
, InlineQueryResult -> Maybe Text
inlineQueryResultVenueGooglePlaceId :: Maybe Text
, InlineQueryResult -> Maybe Text
inlineQueryResultVenueGooglePlaceType :: Maybe Text
}
| InlineQueryResultContact
{ InlineQueryResult -> InlineQueryResultGenericThumbnail
inlineQueryResultContactGeneric :: InlineQueryResultGenericThumbnail
, InlineQueryResult -> Text
inlineQueryResultContactPhoneNumber :: Text
, InlineQueryResult -> Text
inlineQueryResultContactFirstName :: Text
, InlineQueryResult -> Maybe Text
inlineQueryResultContactLastName :: Maybe Text
, InlineQueryResult -> Maybe Text
inlineQueryResultContactVcard :: Maybe Text
}
| InlineQueryResultGame
{ InlineQueryResult -> InlineQueryResultGeneric
inlineQueryResultGameGeneric :: InlineQueryResultGeneric
, InlineQueryResult -> Text
inlineQueryResultGameGameShortName :: Text
}
| InlineQueryResultCachedPhoto
{ InlineQueryResult -> InlineQueryResultGeneric
inlineQueryResultCachedPhotoGeneric :: InlineQueryResultGeneric
, InlineQueryResult -> FileId
inlineQueryResultCachedPhotoPhotoFileId :: FileId
}
| InlineQueryResultCachedGif
{ InlineQueryResult -> InlineQueryResultGeneric
inlineQueryResultCachedGifGeneric :: InlineQueryResultGeneric
, InlineQueryResult -> FileId
iinlineQueryResultCachedGifGifFileId :: FileId
}
| InlineQueryResultCachedMpeg4Gif
{ InlineQueryResult -> InlineQueryResultGeneric
inlineQueryResultCachedMpeg4GifGeneric :: InlineQueryResultGeneric
, InlineQueryResult -> FileId
inlineQueryResultCachedMpeg4GifMpeg4FileId :: FileId
}
| InlineQueryResultCachedSticker
{ InlineQueryResult -> InlineQueryResultGeneric
inlineQueryResultCachedStickerGeneric :: InlineQueryResultGeneric
, InlineQueryResult -> FileId
inlineQueryResultCachedStickerStickerFileId :: FileId
}
| InlineQueryResultCachedDocument
{ InlineQueryResult -> InlineQueryResultGeneric
inlineQueryResultCachedDocumentGeneric :: InlineQueryResultGeneric
, InlineQueryResult -> FileId
inlineQueryResultCachedDocumentDocumentFileId :: FileId
}
| InlineQueryResultCachedVideo
{ InlineQueryResult -> InlineQueryResultGeneric
inlineQueryResultCachedVideoGeneric :: InlineQueryResultGeneric
, InlineQueryResult -> FileId
inlineQueryResultCachedVideoVideoFileId :: FileId
}
| InlineQueryResultCachedVoice
{ InlineQueryResult -> InlineQueryResultGeneric
inlineQueryResultCachedVoiceGeneric :: InlineQueryResultGeneric
, InlineQueryResult -> FileId
inlineQueryResultCachedVoiceVoiceFileId :: FileId
}
| InlineQueryResultCachedAudio
{ InlineQueryResult -> InlineQueryResultGeneric
inlineQueryResultCachedAudioGeneric :: InlineQueryResultGeneric
, InlineQueryResult -> FileId
inlineQueryResultCachedAudioAudioFileId :: FileId
}
deriving (forall x. Rep InlineQueryResult x -> InlineQueryResult
forall x. InlineQueryResult -> Rep InlineQueryResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InlineQueryResult x -> InlineQueryResult
$cfrom :: forall x. InlineQueryResult -> Rep InlineQueryResult x
Generic, Int -> InlineQueryResult -> ShowS
[InlineQueryResult] -> ShowS
InlineQueryResult -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InlineQueryResult] -> ShowS
$cshowList :: [InlineQueryResult] -> ShowS
show :: InlineQueryResult -> String
$cshow :: InlineQueryResult -> String
showsPrec :: Int -> InlineQueryResult -> ShowS
$cshowsPrec :: Int -> InlineQueryResult -> ShowS
Show)
instance ToJSON InlineQueryResult where
toJSON :: InlineQueryResult -> Value
toJSON = \case
InlineQueryResultArticle InlineQueryResultGenericThumbnail
g Maybe Text
url Maybe Bool
hideUrl ->
Value -> [Pair] -> Value
addJsonFields (forall a. ToJSON a => a -> Value
toJSON InlineQueryResultGenericThumbnail
g)
(Text -> [Pair] -> [Pair]
addType Text
"article"
[ Key
"url" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
url
, Key
"hide_url" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Bool
hideUrl
])
InlineQueryResultPhoto InlineQueryResultGenericThumbnail
g Text
photoUrl Maybe Integer
photoWidth Maybe Integer
photoHeight ->
Value -> [Pair] -> Value
addJsonFields (forall a. ToJSON a => a -> Value
toJSON InlineQueryResultGenericThumbnail
g)
(Text -> [Pair] -> [Pair]
addType Text
"photo"
[ Key
"photo_url" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
photoUrl
, Key
"photo_width" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Integer
photoWidth
, Key
"photo_height" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Integer
photoHeight
])
InlineQueryResultGif InlineQueryResultGenericThumbnail
g Text
gifUrl Maybe Integer
gifWidth Maybe Integer
gifHeight Maybe Integer
gifDuration ->
Value -> [Pair] -> Value
addJsonFields (forall a. ToJSON a => a -> Value
toJSON InlineQueryResultGenericThumbnail
g)
(Text -> [Pair] -> [Pair]
addType Text
"gif"
[ Key
"gif_url" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
gifUrl
, Key
"gif_width" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Integer
gifWidth
, Key
"gif_height" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Integer
gifHeight
, Key
"gif_duration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Integer
gifDuration
])
InlineQueryResultMpeg4Gif InlineQueryResultGenericThumbnail
g Text
mpeg4Url Maybe Integer
mpeg4Width Maybe Integer
mpeg4Height Maybe Integer
mpeg4Duration ->
Value -> [Pair] -> Value
addJsonFields (forall a. ToJSON a => a -> Value
toJSON InlineQueryResultGenericThumbnail
g)
(Text -> [Pair] -> [Pair]
addType Text
"mpeg4_gif"
[ Key
"mpeg4_url" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
mpeg4Url
, Key
"mpeg4_width" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Integer
mpeg4Width
, Key
"mpeg4_height" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Integer
mpeg4Height
, Key
"mpeg4_duration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Integer
mpeg4Duration
])
InlineQueryResultVideo InlineQueryResultGenericThumbnail
g Text
videoUrl Text
mimeType Maybe Integer
videoWidth Maybe Integer
videoHeight Maybe Integer
videoDuration ->
Value -> [Pair] -> Value
addJsonFields (forall a. ToJSON a => a -> Value
toJSON InlineQueryResultGenericThumbnail
g)
(Text -> [Pair] -> [Pair]
addType Text
"video"
[ Key
"video_url" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
videoUrl
, Key
"mime_type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
mimeType
, Key
"video_width" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Integer
videoWidth
, Key
"video_height" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Integer
videoHeight
, Key
"video_duration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Integer
videoDuration
])
InlineQueryResultAudio InlineQueryResultGeneric
g Text
audioUrl Maybe Text
performer Maybe Integer
audioDuration ->
Value -> [Pair] -> Value
addJsonFields (forall a. ToJSON a => a -> Value
toJSON InlineQueryResultGeneric
g)
(Text -> [Pair] -> [Pair]
addType Text
"audio"
[ Key
"audio_url" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
audioUrl
, Key
"performer" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
performer
, Key
"audio_duration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Integer
audioDuration
])
InlineQueryResultVoice InlineQueryResultGeneric
g Text
voiceUrl Maybe Integer
voiceDuration ->
Value -> [Pair] -> Value
addJsonFields (forall a. ToJSON a => a -> Value
toJSON InlineQueryResultGeneric
g)
(Text -> [Pair] -> [Pair]
addType Text
"voice"
[ Key
"voice_url" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
voiceUrl
, Key
"voice_duration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Integer
voiceDuration
])
InlineQueryResultDocument InlineQueryResultGenericThumbnail
g Text
documentUrl Text
mimeType ->
Value -> [Pair] -> Value
addJsonFields (forall a. ToJSON a => a -> Value
toJSON InlineQueryResultGenericThumbnail
g)
(Text -> [Pair] -> [Pair]
addType Text
"document"
[ Key
"document_url" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
documentUrl
, Key
"mime_type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
mimeType
])
InlineQueryResultLocation InlineQueryResultGenericThumbnail
g Float
latitude Float
longitude Maybe Float
horizontalAccuracy Maybe Seconds
livePeriod Maybe Int
heading Maybe Int
proximityAlertRadius ->
Value -> [Pair] -> Value
addJsonFields (forall a. ToJSON a => a -> Value
toJSON InlineQueryResultGenericThumbnail
g)
(Text -> [Pair] -> [Pair]
addType Text
"location"
[ Key
"latitude" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Float
latitude
, Key
"longitude" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Float
longitude
, Key
"horizontal_accuracy" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
horizontalAccuracy
, Key
"live_period" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Seconds
livePeriod
, Key
"heading" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
heading
, Key
"proximity_alert_radius" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
proximityAlertRadius
])
InlineQueryResultVenue InlineQueryResultGenericThumbnail
g Float
latitude Float
longitude Text
address Maybe Text
foursquareId Maybe Text
foursquareType Maybe Text
googlePlaceId Maybe Text
googlePlaceType ->
Value -> [Pair] -> Value
addJsonFields (forall a. ToJSON a => a -> Value
toJSON InlineQueryResultGenericThumbnail
g)
(Text -> [Pair] -> [Pair]
addType Text
"venue"
[ Key
"latitude" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Float
latitude
, Key
"longitude" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Float
longitude
, Key
"address" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
address
, Key
"foursquare_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
foursquareId
, Key
"foursquare_type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
foursquareType
, Key
"google_place_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
googlePlaceId
, Key
"google_place_type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
googlePlaceType
])
InlineQueryResultContact InlineQueryResultGenericThumbnail
g Text
phoneNumber Text
firstName Maybe Text
lastName Maybe Text
vcard ->
Value -> [Pair] -> Value
addJsonFields (forall a. ToJSON a => a -> Value
toJSON InlineQueryResultGenericThumbnail
g)
(Text -> [Pair] -> [Pair]
addType Text
"contact"
[ Key
"phone_number" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
phoneNumber
, Key
"first_name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
firstName
, Key
"last_name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
lastName
, Key
"vcard" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
vcard
])
InlineQueryResultGame InlineQueryResultGeneric
g Text
gameShortName ->
Value -> [Pair] -> Value
addJsonFields (forall a. ToJSON a => a -> Value
toJSON InlineQueryResultGeneric
g)
(Text -> [Pair] -> [Pair]
addType Text
"game"
[ Key
"game_short_name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= Text
gameShortName
])
InlineQueryResultCachedPhoto InlineQueryResultGeneric
g FileId
photoFileId ->
Value -> [Pair] -> Value
addJsonFields (forall a. ToJSON a => a -> Value
toJSON InlineQueryResultGeneric
g)
(Text -> [Pair] -> [Pair]
addType Text
"photo"
[ Key
"photo_file_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= FileId
photoFileId
])
InlineQueryResultCachedGif InlineQueryResultGeneric
g FileId
gifFileId ->
Value -> [Pair] -> Value
addJsonFields (forall a. ToJSON a => a -> Value
toJSON InlineQueryResultGeneric
g)
(Text -> [Pair] -> [Pair]
addType Text
"gif"
[ Key
"gif_file_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= FileId
gifFileId
])
InlineQueryResultCachedMpeg4Gif InlineQueryResultGeneric
g FileId
mpeg4FileId ->
Value -> [Pair] -> Value
addJsonFields (forall a. ToJSON a => a -> Value
toJSON InlineQueryResultGeneric
g)
(Text -> [Pair] -> [Pair]
addType Text
"mpeg4_gif"
[ Key
"mpeg4_file_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= FileId
mpeg4FileId
])
InlineQueryResultCachedSticker InlineQueryResultGeneric
g FileId
stickerFileId ->
Value -> [Pair] -> Value
addJsonFields (forall a. ToJSON a => a -> Value
toJSON InlineQueryResultGeneric
g)
(Text -> [Pair] -> [Pair]
addType Text
"sticker"
[ Key
"sticker_file_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= FileId
stickerFileId
])
InlineQueryResultCachedDocument InlineQueryResultGeneric
g FileId
documentFileId ->
Value -> [Pair] -> Value
addJsonFields (forall a. ToJSON a => a -> Value
toJSON InlineQueryResultGeneric
g)
(Text -> [Pair] -> [Pair]
addType Text
"document"
[ Key
"document_file_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= FileId
documentFileId
])
InlineQueryResultCachedVideo InlineQueryResultGeneric
g FileId
videoFileId ->
Value -> [Pair] -> Value
addJsonFields (forall a. ToJSON a => a -> Value
toJSON InlineQueryResultGeneric
g)
(Text -> [Pair] -> [Pair]
addType Text
"video"
[ Key
"video_file_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= FileId
videoFileId
])
InlineQueryResultCachedVoice InlineQueryResultGeneric
g FileId
voiceFileId ->
Value -> [Pair] -> Value
addJsonFields (forall a. ToJSON a => a -> Value
toJSON InlineQueryResultGeneric
g)
(Text -> [Pair] -> [Pair]
addType Text
"voice"
[ Key
"voice_file_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= FileId
voiceFileId
])
InlineQueryResultCachedAudio InlineQueryResultGeneric
g FileId
audioFileId ->
Value -> [Pair] -> Value
addJsonFields (forall a. ToJSON a => a -> Value
toJSON InlineQueryResultGeneric
g)
(Text -> [Pair] -> [Pair]
addType Text
"audio"
[ Key
"audio_file_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= FileId
audioFileId
])
instance FromJSON InlineQueryResult where
parseJSON :: Value -> Parser InlineQueryResult
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
withObject String
"InlineQueryResult" \Object
o ->
(Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"type" :: Parser Text) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Text
"article" -> InlineQueryResultGenericThumbnail
-> Maybe Text -> Maybe Bool -> InlineQueryResult
InlineQueryResultArticle
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
parseJSON (Object -> Value
Object Object
o)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"url"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"hide_url"
Text
"photo" -> Object -> Key -> Parser (Maybe FileId)
parseFileId Object
o Key
"photo_file_id" forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Maybe FileId
Nothing -> InlineQueryResultGenericThumbnail
-> Text -> Maybe Integer -> Maybe Integer -> InlineQueryResult
InlineQueryResultPhoto
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
parseJSON (Object -> Value
Object Object
o)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"photo_url"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"photo_width"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"photo_height"
Just FileId
fileId -> InlineQueryResultGeneric -> FileId -> InlineQueryResult
InlineQueryResultCachedPhoto forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
parseJSON (Object -> Value
Object Object
o) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (f :: * -> *) a. Applicative f => a -> f a
pure FileId
fileId
Text
"gif" -> Object -> Key -> Parser (Maybe FileId)
parseFileId Object
o Key
"gif_file_id" forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Maybe FileId
Nothing -> InlineQueryResultGenericThumbnail
-> Text
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> InlineQueryResult
InlineQueryResultGif
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
parseJSON (Object -> Value
Object Object
o)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"gif_url"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"gif_width"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"gif_height"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"gif_duration"
Just FileId
fileId -> InlineQueryResultGeneric -> FileId -> InlineQueryResult
InlineQueryResultCachedGif forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
parseJSON (Object -> Value
Object Object
o) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (f :: * -> *) a. Applicative f => a -> f a
pure FileId
fileId
Text
"mpeg4_gif" -> Object -> Key -> Parser (Maybe FileId)
parseFileId Object
o Key
"mpeg4_file_id" forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Maybe FileId
Nothing -> InlineQueryResultGenericThumbnail
-> Text
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> InlineQueryResult
InlineQueryResultMpeg4Gif
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
parseJSON (Object -> Value
Object Object
o)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"mpeg4_url"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"mpeg4_width"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"mpeg4_height"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"mpeg4_duration"
Just FileId
fileId -> InlineQueryResultGeneric -> FileId -> InlineQueryResult
InlineQueryResultCachedMpeg4Gif
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
parseJSON (Object -> Value
Object Object
o)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (f :: * -> *) a. Applicative f => a -> f a
pure FileId
fileId
Text
"video" -> Object -> Key -> Parser (Maybe FileId)
parseFileId Object
o Key
"video_file_id" forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Maybe FileId
Nothing -> InlineQueryResultGenericThumbnail
-> Text
-> Text
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> InlineQueryResult
InlineQueryResultVideo
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
parseJSON (Object -> Value
Object Object
o)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"video_url"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"mime_type"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"video_width"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"video_height"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"video_duration"
Just FileId
fileId -> InlineQueryResultGeneric -> FileId -> InlineQueryResult
InlineQueryResultCachedVideo
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
parseJSON (Object -> Value
Object Object
o)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (f :: * -> *) a. Applicative f => a -> f a
pure FileId
fileId
Text
"audio" -> Object -> Key -> Parser (Maybe FileId)
parseFileId Object
o Key
"audio_file_id" forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Maybe FileId
Nothing -> InlineQueryResultGeneric
-> Text -> Maybe Text -> Maybe Integer -> InlineQueryResult
InlineQueryResultAudio
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
parseJSON (Object -> Value
Object Object
o)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"audio_url"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"performer"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"duration"
Just FileId
fileId -> InlineQueryResultGeneric -> FileId -> InlineQueryResult
InlineQueryResultCachedAudio forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
parseJSON (Object -> Value
Object Object
o) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (f :: * -> *) a. Applicative f => a -> f a
pure FileId
fileId
Text
"voice" -> Object -> Key -> Parser (Maybe FileId)
parseFileId Object
o Key
"voice_file_id" forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Maybe FileId
Nothing -> InlineQueryResultGeneric
-> Text -> Maybe Integer -> InlineQueryResult
InlineQueryResultVoice
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
parseJSON (Object -> Value
Object Object
o)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"voice_url"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"voice_duration"
Just FileId
fileId -> InlineQueryResultGeneric -> FileId -> InlineQueryResult
InlineQueryResultCachedVoice forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
parseJSON (Object -> Value
Object Object
o) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (f :: * -> *) a. Applicative f => a -> f a
pure FileId
fileId
Text
"document" -> Object -> Key -> Parser (Maybe FileId)
parseFileId Object
o Key
"document_file_id" forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Maybe FileId
Nothing -> InlineQueryResultGenericThumbnail
-> Text -> Text -> InlineQueryResult
InlineQueryResultDocument
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
parseJSON (Object -> Value
Object Object
o)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"document_url"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"mime_type"
Just FileId
fileId -> InlineQueryResultGeneric -> FileId -> InlineQueryResult
InlineQueryResultCachedDocument forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
parseJSON (Object -> Value
Object Object
o) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (f :: * -> *) a. Applicative f => a -> f a
pure FileId
fileId
Text
"location" -> InlineQueryResultGenericThumbnail
-> Float
-> Float
-> Maybe Float
-> Maybe Seconds
-> Maybe Int
-> Maybe Int
-> InlineQueryResult
InlineQueryResultLocation
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
parseJSON (Object -> Value
Object Object
o)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"latitude"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"longitude"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"horizontal_accuracy"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"live_period"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"heading"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"proximity_alert_radius"
Text
"venue" -> InlineQueryResultGenericThumbnail
-> Float
-> Float
-> Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> InlineQueryResult
InlineQueryResultVenue
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
parseJSON (Object -> Value
Object Object
o)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"latitude"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"longitude"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"address"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"foursquare_id"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"foursquare_type"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"google_place_id"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"google_place_type"
Text
"contact" -> InlineQueryResultGenericThumbnail
-> Text -> Text -> Maybe Text -> Maybe Text -> InlineQueryResult
InlineQueryResultContact
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
parseJSON (Object -> Value
Object Object
o)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"phone_number"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"first_name"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"last_name"
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"vcard"
Text
"game" -> InlineQueryResultGeneric -> Text -> InlineQueryResult
InlineQueryResultGame
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
parseJSON (Object -> Value
Object Object
o)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"game_short_name"
Text
t -> forall (m :: * -> *) a. MonadFail m => String -> m a
fail forall a b. (a -> b) -> a -> b
$ Text -> String
Text.unpack (Text
"Unknown type: " forall a. Semigroup a => a -> a -> a
<> Text
t)
where
parseFileId :: Object -> Key -> Parser (Maybe FileId)
parseFileId Object
o Key
fileField = Object
o forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
fileField :: Parser (Maybe FileId)
defInlineQueryResultArticle :: InlineQueryResultGenericThumbnail -> InlineQueryResult
defInlineQueryResultArticle :: InlineQueryResultGenericThumbnail -> InlineQueryResult
defInlineQueryResultArticle InlineQueryResultGenericThumbnail
g = InlineQueryResultGenericThumbnail
-> Maybe Text -> Maybe Bool -> InlineQueryResult
InlineQueryResultArticle InlineQueryResultGenericThumbnail
g forall a. Maybe a
Nothing forall a. Maybe a
Nothing
defInlineQueryResultPhotoUrl :: InlineQueryResultGenericThumbnail -> Text -> InlineQueryResult
defInlineQueryResultPhotoUrl :: InlineQueryResultGenericThumbnail -> Text -> InlineQueryResult
defInlineQueryResultPhotoUrl InlineQueryResultGenericThumbnail
g Text
photoUrl = InlineQueryResultGenericThumbnail
-> Text -> Maybe Integer -> Maybe Integer -> InlineQueryResult
InlineQueryResultPhoto InlineQueryResultGenericThumbnail
g Text
photoUrl forall a. Maybe a
Nothing forall a. Maybe a
Nothing
defInlineQueryResultGif :: InlineQueryResultGenericThumbnail -> Text -> InlineQueryResult
defInlineQueryResultGif :: InlineQueryResultGenericThumbnail -> Text -> InlineQueryResult
defInlineQueryResultGif InlineQueryResultGenericThumbnail
g Text
gifUrl = InlineQueryResultGenericThumbnail
-> Text
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> InlineQueryResult
InlineQueryResultGif InlineQueryResultGenericThumbnail
g Text
gifUrl forall a. Maybe a
Nothing forall a. Maybe a
Nothing forall a. Maybe a
Nothing
defInlineQueryResultMpeg4Gif :: InlineQueryResultGenericThumbnail -> Text -> InlineQueryResult
defInlineQueryResultMpeg4Gif :: InlineQueryResultGenericThumbnail -> Text -> InlineQueryResult
defInlineQueryResultMpeg4Gif InlineQueryResultGenericThumbnail
g Text
mpeg4Url = InlineQueryResultGenericThumbnail
-> Text
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> InlineQueryResult
InlineQueryResultMpeg4Gif InlineQueryResultGenericThumbnail
g Text
mpeg4Url forall a. Maybe a
Nothing forall a. Maybe a
Nothing forall a. Maybe a
Nothing
defInlineQueryResultVideo :: InlineQueryResultGenericThumbnail -> Text -> Text -> InlineQueryResult
defInlineQueryResultVideo :: InlineQueryResultGenericThumbnail
-> Text -> Text -> InlineQueryResult
defInlineQueryResultVideo InlineQueryResultGenericThumbnail
g Text
videoUrl Text
mimeType
= InlineQueryResultGenericThumbnail
-> Text
-> Text
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> InlineQueryResult
InlineQueryResultVideo InlineQueryResultGenericThumbnail
g Text
videoUrl Text
mimeType forall a. Maybe a
Nothing forall a. Maybe a
Nothing forall a. Maybe a
Nothing
defInlineQueryResultAudio :: InlineQueryResultGeneric -> Text -> InlineQueryResult
defInlineQueryResultAudio :: InlineQueryResultGeneric -> Text -> InlineQueryResult
defInlineQueryResultAudio InlineQueryResultGeneric
g Text
audioUrl = InlineQueryResultGeneric
-> Text -> Maybe Text -> Maybe Integer -> InlineQueryResult
InlineQueryResultAudio InlineQueryResultGeneric
g Text
audioUrl forall a. Maybe a
Nothing forall a. Maybe a
Nothing
defInlineQueryResultVoice :: InlineQueryResultGeneric -> Text -> InlineQueryResult
defInlineQueryResultVoice :: InlineQueryResultGeneric -> Text -> InlineQueryResult
defInlineQueryResultVoice InlineQueryResultGeneric
g Text
voiceUrl = InlineQueryResultGeneric
-> Text -> Maybe Integer -> InlineQueryResult
InlineQueryResultVoice InlineQueryResultGeneric
g Text
voiceUrl forall a. Maybe a
Nothing
defInlineQueryResultDocument :: InlineQueryResultGenericThumbnail -> Text -> Text -> InlineQueryResult
defInlineQueryResultDocument :: InlineQueryResultGenericThumbnail
-> Text -> Text -> InlineQueryResult
defInlineQueryResultDocument = InlineQueryResultGenericThumbnail
-> Text -> Text -> InlineQueryResult
InlineQueryResultDocument
defInlineQueryResultLocation :: InlineQueryResultGenericThumbnail -> Float -> Float -> InlineQueryResult
defInlineQueryResultLocation :: InlineQueryResultGenericThumbnail
-> Float -> Float -> InlineQueryResult
defInlineQueryResultLocation InlineQueryResultGenericThumbnail
g Float
lat Float
lon
= InlineQueryResultGenericThumbnail
-> Float
-> Float
-> Maybe Float
-> Maybe Seconds
-> Maybe Int
-> Maybe Int
-> InlineQueryResult
InlineQueryResultLocation InlineQueryResultGenericThumbnail
g Float
lat Float
lon forall a. Maybe a
Nothing forall a. Maybe a
Nothing forall a. Maybe a
Nothing forall a. Maybe a
Nothing
defInlineQueryResultVenue :: InlineQueryResultGenericThumbnail -> Float -> Float -> Text -> InlineQueryResult
defInlineQueryResultVenue :: InlineQueryResultGenericThumbnail
-> Float -> Float -> Text -> InlineQueryResult
defInlineQueryResultVenue InlineQueryResultGenericThumbnail
g Float
lat Float
lon Text
address
= InlineQueryResultGenericThumbnail
-> Float
-> Float
-> Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> InlineQueryResult
InlineQueryResultVenue InlineQueryResultGenericThumbnail
g Float
lat Float
lon Text
address forall a. Maybe a
Nothing forall a. Maybe a
Nothing forall a. Maybe a
Nothing forall a. Maybe a
Nothing
defInlineQueryResultContact :: InlineQueryResultGenericThumbnail -> Text -> Text -> InlineQueryResult
defInlineQueryResultContact :: InlineQueryResultGenericThumbnail
-> Text -> Text -> InlineQueryResult
defInlineQueryResultContact InlineQueryResultGenericThumbnail
g Text
phoneNumber Text
firstName
= InlineQueryResultGenericThumbnail
-> Text -> Text -> Maybe Text -> Maybe Text -> InlineQueryResult
InlineQueryResultContact InlineQueryResultGenericThumbnail
g Text
phoneNumber Text
firstName forall a. Maybe a
Nothing forall a. Maybe a
Nothing
data InlineQueryResultsButton = InlineQueryResultsButton
{ InlineQueryResultsButton -> Text
inlineQueryResultsButtonText :: Text
, InlineQueryResultsButton -> Maybe WebAppInfo
inlineQueryResultsButtonWebApp :: Maybe WebAppInfo
, InlineQueryResultsButton -> Maybe Text
inlineQueryResultsButtonStartParameter :: Maybe Text
}
deriving forall x.
Rep InlineQueryResultsButton x -> InlineQueryResultsButton
forall x.
InlineQueryResultsButton -> Rep InlineQueryResultsButton x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InlineQueryResultsButton x -> InlineQueryResultsButton
$cfrom :: forall x.
InlineQueryResultsButton -> Rep InlineQueryResultsButton x
Generic
instance ToJSON InlineQueryResultsButton where toJSON :: InlineQueryResultsButton -> Value
toJSON = forall a (d :: Meta) (f :: * -> *).
(Generic a, GToJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
a -> Value
gtoJSON
instance FromJSON InlineQueryResultsButton where parseJSON :: Value -> Parser InlineQueryResultsButton
parseJSON = forall a (d :: Meta) (f :: * -> *).
(Generic a, GFromJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
Value -> Parser a
gparseJSON
foldMap makeDefault
[ ''InlineQueryResultGeneric
, ''InlineQueryResultGenericThumbnail
]