module TD.Data.InlineQueryResult
(InlineQueryResult(..)) 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 TD.Data.Thumbnail as Thumbnail
import qualified TD.Data.Contact as Contact
import qualified TD.Data.Location as Location
import qualified TD.Data.Venue as Venue
import qualified TD.Data.Game as Game
import qualified TD.Data.Animation as Animation
import qualified TD.Data.Audio as Audio
import qualified TD.Data.Document as Document
import qualified TD.Data.Photo as Photo
import qualified TD.Data.Sticker as Sticker
import qualified TD.Data.Video as Video
import qualified TD.Data.VoiceNote as VoiceNote
data InlineQueryResult
= InlineQueryResultArticle
{ InlineQueryResult -> Maybe Text
_id :: Maybe T.Text
, InlineQueryResult -> Maybe Text
url :: Maybe T.Text
, InlineQueryResult -> Maybe Text
title :: Maybe T.Text
, InlineQueryResult -> Maybe Text
description :: Maybe T.Text
, InlineQueryResult -> Maybe Thumbnail
thumbnail :: Maybe Thumbnail.Thumbnail
}
| InlineQueryResultContact
{ _id :: Maybe T.Text
, InlineQueryResult -> Maybe Contact
contact :: Maybe Contact.Contact
, thumbnail :: Maybe Thumbnail.Thumbnail
}
| InlineQueryResultLocation
{ _id :: Maybe T.Text
, InlineQueryResult -> Maybe Location
location :: Maybe Location.Location
, title :: Maybe T.Text
, thumbnail :: Maybe Thumbnail.Thumbnail
}
| InlineQueryResultVenue
{ _id :: Maybe T.Text
, InlineQueryResult -> Maybe Venue
venue :: Maybe Venue.Venue
, thumbnail :: Maybe Thumbnail.Thumbnail
}
| InlineQueryResultGame
{ _id :: Maybe T.Text
, InlineQueryResult -> Maybe Game
game :: Maybe Game.Game
}
| InlineQueryResultAnimation
{ _id :: Maybe T.Text
, InlineQueryResult -> Maybe Animation
animation :: Maybe Animation.Animation
, title :: Maybe T.Text
}
| InlineQueryResultAudio
{ _id :: Maybe T.Text
, InlineQueryResult -> Maybe Audio
audio :: Maybe Audio.Audio
}
| InlineQueryResultDocument
{ _id :: Maybe T.Text
, InlineQueryResult -> Maybe Document
document :: Maybe Document.Document
, title :: Maybe T.Text
, description :: Maybe T.Text
}
| InlineQueryResultPhoto
{ _id :: Maybe T.Text
, InlineQueryResult -> Maybe Photo
photo :: Maybe Photo.Photo
, title :: Maybe T.Text
, description :: Maybe T.Text
}
| InlineQueryResultSticker
{ _id :: Maybe T.Text
, InlineQueryResult -> Maybe Sticker
sticker :: Maybe Sticker.Sticker
}
| InlineQueryResultVideo
{ _id :: Maybe T.Text
, InlineQueryResult -> Maybe Video
video :: Maybe Video.Video
, title :: Maybe T.Text
, description :: Maybe T.Text
}
| InlineQueryResultVoiceNote
{ _id :: Maybe T.Text
, InlineQueryResult -> Maybe VoiceNote
voice_note :: Maybe VoiceNote.VoiceNote
, title :: Maybe T.Text
}
deriving (InlineQueryResult -> InlineQueryResult -> Bool
(InlineQueryResult -> InlineQueryResult -> Bool)
-> (InlineQueryResult -> InlineQueryResult -> Bool)
-> Eq InlineQueryResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: InlineQueryResult -> InlineQueryResult -> Bool
== :: InlineQueryResult -> InlineQueryResult -> Bool
$c/= :: InlineQueryResult -> InlineQueryResult -> Bool
/= :: InlineQueryResult -> InlineQueryResult -> Bool
Eq, Int -> InlineQueryResult -> ShowS
[InlineQueryResult] -> ShowS
InlineQueryResult -> String
(Int -> InlineQueryResult -> ShowS)
-> (InlineQueryResult -> String)
-> ([InlineQueryResult] -> ShowS)
-> Show InlineQueryResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InlineQueryResult -> ShowS
showsPrec :: Int -> InlineQueryResult -> ShowS
$cshow :: InlineQueryResult -> String
show :: InlineQueryResult -> String
$cshowList :: [InlineQueryResult] -> ShowS
showList :: [InlineQueryResult] -> ShowS
Show)
instance I.ShortShow InlineQueryResult where
shortShow :: InlineQueryResult -> String
shortShow InlineQueryResultArticle
{ _id :: InlineQueryResult -> Maybe Text
_id = Maybe Text
_id_
, url :: InlineQueryResult -> Maybe Text
url = Maybe Text
url_
, title :: InlineQueryResult -> Maybe Text
title = Maybe Text
title_
, description :: InlineQueryResult -> Maybe Text
description = Maybe Text
description_
, thumbnail :: InlineQueryResult -> Maybe Thumbnail
thumbnail = Maybe Thumbnail
thumbnail_
}
= String
"InlineQueryResultArticle"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
_id_
, String
"url" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
url_
, String
"title" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
title_
, String
"description" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
description_
, String
"thumbnail" String -> Maybe Thumbnail -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Thumbnail
thumbnail_
]
shortShow InlineQueryResultContact
{ _id :: InlineQueryResult -> Maybe Text
_id = Maybe Text
_id_
, contact :: InlineQueryResult -> Maybe Contact
contact = Maybe Contact
contact_
, thumbnail :: InlineQueryResult -> Maybe Thumbnail
thumbnail = Maybe Thumbnail
thumbnail_
}
= String
"InlineQueryResultContact"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
_id_
, String
"contact" String -> Maybe Contact -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Contact
contact_
, String
"thumbnail" String -> Maybe Thumbnail -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Thumbnail
thumbnail_
]
shortShow InlineQueryResultLocation
{ _id :: InlineQueryResult -> Maybe Text
_id = Maybe Text
_id_
, location :: InlineQueryResult -> Maybe Location
location = Maybe Location
location_
, title :: InlineQueryResult -> Maybe Text
title = Maybe Text
title_
, thumbnail :: InlineQueryResult -> Maybe Thumbnail
thumbnail = Maybe Thumbnail
thumbnail_
}
= String
"InlineQueryResultLocation"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
_id_
, String
"location" String -> Maybe Location -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Location
location_
, String
"title" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
title_
, String
"thumbnail" String -> Maybe Thumbnail -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Thumbnail
thumbnail_
]
shortShow InlineQueryResultVenue
{ _id :: InlineQueryResult -> Maybe Text
_id = Maybe Text
_id_
, venue :: InlineQueryResult -> Maybe Venue
venue = Maybe Venue
venue_
, thumbnail :: InlineQueryResult -> Maybe Thumbnail
thumbnail = Maybe Thumbnail
thumbnail_
}
= String
"InlineQueryResultVenue"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
_id_
, String
"venue" String -> Maybe Venue -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Venue
venue_
, String
"thumbnail" String -> Maybe Thumbnail -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Thumbnail
thumbnail_
]
shortShow InlineQueryResultGame
{ _id :: InlineQueryResult -> Maybe Text
_id = Maybe Text
_id_
, game :: InlineQueryResult -> Maybe Game
game = Maybe Game
game_
}
= String
"InlineQueryResultGame"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
_id_
, String
"game" String -> Maybe Game -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Game
game_
]
shortShow InlineQueryResultAnimation
{ _id :: InlineQueryResult -> Maybe Text
_id = Maybe Text
_id_
, animation :: InlineQueryResult -> Maybe Animation
animation = Maybe Animation
animation_
, title :: InlineQueryResult -> Maybe Text
title = Maybe Text
title_
}
= String
"InlineQueryResultAnimation"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
_id_
, String
"animation" String -> Maybe Animation -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Animation
animation_
, String
"title" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
title_
]
shortShow InlineQueryResultAudio
{ _id :: InlineQueryResult -> Maybe Text
_id = Maybe Text
_id_
, audio :: InlineQueryResult -> Maybe Audio
audio = Maybe Audio
audio_
}
= String
"InlineQueryResultAudio"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
_id_
, String
"audio" String -> Maybe Audio -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Audio
audio_
]
shortShow InlineQueryResultDocument
{ _id :: InlineQueryResult -> Maybe Text
_id = Maybe Text
_id_
, document :: InlineQueryResult -> Maybe Document
document = Maybe Document
document_
, title :: InlineQueryResult -> Maybe Text
title = Maybe Text
title_
, description :: InlineQueryResult -> Maybe Text
description = Maybe Text
description_
}
= String
"InlineQueryResultDocument"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
_id_
, String
"document" String -> Maybe Document -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Document
document_
, String
"title" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
title_
, String
"description" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
description_
]
shortShow InlineQueryResultPhoto
{ _id :: InlineQueryResult -> Maybe Text
_id = Maybe Text
_id_
, photo :: InlineQueryResult -> Maybe Photo
photo = Maybe Photo
photo_
, title :: InlineQueryResult -> Maybe Text
title = Maybe Text
title_
, description :: InlineQueryResult -> Maybe Text
description = Maybe Text
description_
}
= String
"InlineQueryResultPhoto"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
_id_
, String
"photo" String -> Maybe Photo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Photo
photo_
, String
"title" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
title_
, String
"description" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
description_
]
shortShow InlineQueryResultSticker
{ _id :: InlineQueryResult -> Maybe Text
_id = Maybe Text
_id_
, sticker :: InlineQueryResult -> Maybe Sticker
sticker = Maybe Sticker
sticker_
}
= String
"InlineQueryResultSticker"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
_id_
, String
"sticker" String -> Maybe Sticker -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Sticker
sticker_
]
shortShow InlineQueryResultVideo
{ _id :: InlineQueryResult -> Maybe Text
_id = Maybe Text
_id_
, video :: InlineQueryResult -> Maybe Video
video = Maybe Video
video_
, title :: InlineQueryResult -> Maybe Text
title = Maybe Text
title_
, description :: InlineQueryResult -> Maybe Text
description = Maybe Text
description_
}
= String
"InlineQueryResultVideo"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
_id_
, String
"video" String -> Maybe Video -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Video
video_
, String
"title" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
title_
, String
"description" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
description_
]
shortShow InlineQueryResultVoiceNote
{ _id :: InlineQueryResult -> Maybe Text
_id = Maybe Text
_id_
, voice_note :: InlineQueryResult -> Maybe VoiceNote
voice_note = Maybe VoiceNote
voice_note_
, title :: InlineQueryResult -> Maybe Text
title = Maybe Text
title_
}
= String
"InlineQueryResultVoiceNote"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
_id_
, String
"voice_note" String -> Maybe VoiceNote -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe VoiceNote
voice_note_
, String
"title" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
title_
]
instance AT.FromJSON InlineQueryResult where
parseJSON :: Value -> Parser InlineQueryResult
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
"inlineQueryResultArticle" -> Value -> Parser InlineQueryResult
parseInlineQueryResultArticle Value
v
String
"inlineQueryResultContact" -> Value -> Parser InlineQueryResult
parseInlineQueryResultContact Value
v
String
"inlineQueryResultLocation" -> Value -> Parser InlineQueryResult
parseInlineQueryResultLocation Value
v
String
"inlineQueryResultVenue" -> Value -> Parser InlineQueryResult
parseInlineQueryResultVenue Value
v
String
"inlineQueryResultGame" -> Value -> Parser InlineQueryResult
parseInlineQueryResultGame Value
v
String
"inlineQueryResultAnimation" -> Value -> Parser InlineQueryResult
parseInlineQueryResultAnimation Value
v
String
"inlineQueryResultAudio" -> Value -> Parser InlineQueryResult
parseInlineQueryResultAudio Value
v
String
"inlineQueryResultDocument" -> Value -> Parser InlineQueryResult
parseInlineQueryResultDocument Value
v
String
"inlineQueryResultPhoto" -> Value -> Parser InlineQueryResult
parseInlineQueryResultPhoto Value
v
String
"inlineQueryResultSticker" -> Value -> Parser InlineQueryResult
parseInlineQueryResultSticker Value
v
String
"inlineQueryResultVideo" -> Value -> Parser InlineQueryResult
parseInlineQueryResultVideo Value
v
String
"inlineQueryResultVoiceNote" -> Value -> Parser InlineQueryResult
parseInlineQueryResultVoiceNote Value
v
String
_ -> Parser InlineQueryResult
forall a. Monoid a => a
mempty
where
parseInlineQueryResultArticle :: A.Value -> AT.Parser InlineQueryResult
parseInlineQueryResultArticle :: Value -> Parser InlineQueryResult
parseInlineQueryResultArticle = String
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InlineQueryResultArticle" ((Object -> Parser InlineQueryResult)
-> Value -> Parser InlineQueryResult)
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
_id_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"id"
Maybe Text
url_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"url"
Maybe Text
title_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"title"
Maybe Text
description_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"description"
Maybe Thumbnail
thumbnail_ <- Object
o Object -> Key -> Parser (Maybe Thumbnail)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"thumbnail"
InlineQueryResult -> Parser InlineQueryResult
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InlineQueryResult -> Parser InlineQueryResult)
-> InlineQueryResult -> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ InlineQueryResultArticle
{ _id :: Maybe Text
_id = Maybe Text
_id_
, url :: Maybe Text
url = Maybe Text
url_
, title :: Maybe Text
title = Maybe Text
title_
, description :: Maybe Text
description = Maybe Text
description_
, thumbnail :: Maybe Thumbnail
thumbnail = Maybe Thumbnail
thumbnail_
}
parseInlineQueryResultContact :: A.Value -> AT.Parser InlineQueryResult
parseInlineQueryResultContact :: Value -> Parser InlineQueryResult
parseInlineQueryResultContact = String
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InlineQueryResultContact" ((Object -> Parser InlineQueryResult)
-> Value -> Parser InlineQueryResult)
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
_id_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"id"
Maybe Contact
contact_ <- Object
o Object -> Key -> Parser (Maybe Contact)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"contact"
Maybe Thumbnail
thumbnail_ <- Object
o Object -> Key -> Parser (Maybe Thumbnail)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"thumbnail"
InlineQueryResult -> Parser InlineQueryResult
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InlineQueryResult -> Parser InlineQueryResult)
-> InlineQueryResult -> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ InlineQueryResultContact
{ _id :: Maybe Text
_id = Maybe Text
_id_
, contact :: Maybe Contact
contact = Maybe Contact
contact_
, thumbnail :: Maybe Thumbnail
thumbnail = Maybe Thumbnail
thumbnail_
}
parseInlineQueryResultLocation :: A.Value -> AT.Parser InlineQueryResult
parseInlineQueryResultLocation :: Value -> Parser InlineQueryResult
parseInlineQueryResultLocation = String
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InlineQueryResultLocation" ((Object -> Parser InlineQueryResult)
-> Value -> Parser InlineQueryResult)
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
_id_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"id"
Maybe Location
location_ <- Object
o Object -> Key -> Parser (Maybe Location)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"location"
Maybe Text
title_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"title"
Maybe Thumbnail
thumbnail_ <- Object
o Object -> Key -> Parser (Maybe Thumbnail)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"thumbnail"
InlineQueryResult -> Parser InlineQueryResult
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InlineQueryResult -> Parser InlineQueryResult)
-> InlineQueryResult -> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ InlineQueryResultLocation
{ _id :: Maybe Text
_id = Maybe Text
_id_
, location :: Maybe Location
location = Maybe Location
location_
, title :: Maybe Text
title = Maybe Text
title_
, thumbnail :: Maybe Thumbnail
thumbnail = Maybe Thumbnail
thumbnail_
}
parseInlineQueryResultVenue :: A.Value -> AT.Parser InlineQueryResult
parseInlineQueryResultVenue :: Value -> Parser InlineQueryResult
parseInlineQueryResultVenue = String
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InlineQueryResultVenue" ((Object -> Parser InlineQueryResult)
-> Value -> Parser InlineQueryResult)
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
_id_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"id"
Maybe Venue
venue_ <- Object
o Object -> Key -> Parser (Maybe Venue)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"venue"
Maybe Thumbnail
thumbnail_ <- Object
o Object -> Key -> Parser (Maybe Thumbnail)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"thumbnail"
InlineQueryResult -> Parser InlineQueryResult
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InlineQueryResult -> Parser InlineQueryResult)
-> InlineQueryResult -> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ InlineQueryResultVenue
{ _id :: Maybe Text
_id = Maybe Text
_id_
, venue :: Maybe Venue
venue = Maybe Venue
venue_
, thumbnail :: Maybe Thumbnail
thumbnail = Maybe Thumbnail
thumbnail_
}
parseInlineQueryResultGame :: A.Value -> AT.Parser InlineQueryResult
parseInlineQueryResultGame :: Value -> Parser InlineQueryResult
parseInlineQueryResultGame = String
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InlineQueryResultGame" ((Object -> Parser InlineQueryResult)
-> Value -> Parser InlineQueryResult)
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
_id_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"id"
Maybe Game
game_ <- Object
o Object -> Key -> Parser (Maybe Game)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"game"
InlineQueryResult -> Parser InlineQueryResult
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InlineQueryResult -> Parser InlineQueryResult)
-> InlineQueryResult -> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ InlineQueryResultGame
{ _id :: Maybe Text
_id = Maybe Text
_id_
, game :: Maybe Game
game = Maybe Game
game_
}
parseInlineQueryResultAnimation :: A.Value -> AT.Parser InlineQueryResult
parseInlineQueryResultAnimation :: Value -> Parser InlineQueryResult
parseInlineQueryResultAnimation = String
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InlineQueryResultAnimation" ((Object -> Parser InlineQueryResult)
-> Value -> Parser InlineQueryResult)
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
_id_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"id"
Maybe Animation
animation_ <- Object
o Object -> Key -> Parser (Maybe Animation)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"animation"
Maybe Text
title_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"title"
InlineQueryResult -> Parser InlineQueryResult
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InlineQueryResult -> Parser InlineQueryResult)
-> InlineQueryResult -> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ InlineQueryResultAnimation
{ _id :: Maybe Text
_id = Maybe Text
_id_
, animation :: Maybe Animation
animation = Maybe Animation
animation_
, title :: Maybe Text
title = Maybe Text
title_
}
parseInlineQueryResultAudio :: A.Value -> AT.Parser InlineQueryResult
parseInlineQueryResultAudio :: Value -> Parser InlineQueryResult
parseInlineQueryResultAudio = String
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InlineQueryResultAudio" ((Object -> Parser InlineQueryResult)
-> Value -> Parser InlineQueryResult)
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
_id_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"id"
Maybe Audio
audio_ <- Object
o Object -> Key -> Parser (Maybe Audio)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"audio"
InlineQueryResult -> Parser InlineQueryResult
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InlineQueryResult -> Parser InlineQueryResult)
-> InlineQueryResult -> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ InlineQueryResultAudio
{ _id :: Maybe Text
_id = Maybe Text
_id_
, audio :: Maybe Audio
audio = Maybe Audio
audio_
}
parseInlineQueryResultDocument :: A.Value -> AT.Parser InlineQueryResult
parseInlineQueryResultDocument :: Value -> Parser InlineQueryResult
parseInlineQueryResultDocument = String
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InlineQueryResultDocument" ((Object -> Parser InlineQueryResult)
-> Value -> Parser InlineQueryResult)
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
_id_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"id"
Maybe Document
document_ <- Object
o Object -> Key -> Parser (Maybe Document)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"document"
Maybe Text
title_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"title"
Maybe Text
description_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"description"
InlineQueryResult -> Parser InlineQueryResult
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InlineQueryResult -> Parser InlineQueryResult)
-> InlineQueryResult -> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ InlineQueryResultDocument
{ _id :: Maybe Text
_id = Maybe Text
_id_
, document :: Maybe Document
document = Maybe Document
document_
, title :: Maybe Text
title = Maybe Text
title_
, description :: Maybe Text
description = Maybe Text
description_
}
parseInlineQueryResultPhoto :: A.Value -> AT.Parser InlineQueryResult
parseInlineQueryResultPhoto :: Value -> Parser InlineQueryResult
parseInlineQueryResultPhoto = String
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InlineQueryResultPhoto" ((Object -> Parser InlineQueryResult)
-> Value -> Parser InlineQueryResult)
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
_id_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"id"
Maybe Photo
photo_ <- Object
o Object -> Key -> Parser (Maybe Photo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"photo"
Maybe Text
title_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"title"
Maybe Text
description_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"description"
InlineQueryResult -> Parser InlineQueryResult
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InlineQueryResult -> Parser InlineQueryResult)
-> InlineQueryResult -> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ InlineQueryResultPhoto
{ _id :: Maybe Text
_id = Maybe Text
_id_
, photo :: Maybe Photo
photo = Maybe Photo
photo_
, title :: Maybe Text
title = Maybe Text
title_
, description :: Maybe Text
description = Maybe Text
description_
}
parseInlineQueryResultSticker :: A.Value -> AT.Parser InlineQueryResult
parseInlineQueryResultSticker :: Value -> Parser InlineQueryResult
parseInlineQueryResultSticker = String
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InlineQueryResultSticker" ((Object -> Parser InlineQueryResult)
-> Value -> Parser InlineQueryResult)
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
_id_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"id"
Maybe Sticker
sticker_ <- Object
o Object -> Key -> Parser (Maybe Sticker)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"sticker"
InlineQueryResult -> Parser InlineQueryResult
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InlineQueryResult -> Parser InlineQueryResult)
-> InlineQueryResult -> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ InlineQueryResultSticker
{ _id :: Maybe Text
_id = Maybe Text
_id_
, sticker :: Maybe Sticker
sticker = Maybe Sticker
sticker_
}
parseInlineQueryResultVideo :: A.Value -> AT.Parser InlineQueryResult
parseInlineQueryResultVideo :: Value -> Parser InlineQueryResult
parseInlineQueryResultVideo = String
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InlineQueryResultVideo" ((Object -> Parser InlineQueryResult)
-> Value -> Parser InlineQueryResult)
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
_id_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"id"
Maybe Video
video_ <- Object
o Object -> Key -> Parser (Maybe Video)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"video"
Maybe Text
title_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"title"
Maybe Text
description_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"description"
InlineQueryResult -> Parser InlineQueryResult
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InlineQueryResult -> Parser InlineQueryResult)
-> InlineQueryResult -> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ InlineQueryResultVideo
{ _id :: Maybe Text
_id = Maybe Text
_id_
, video :: Maybe Video
video = Maybe Video
video_
, title :: Maybe Text
title = Maybe Text
title_
, description :: Maybe Text
description = Maybe Text
description_
}
parseInlineQueryResultVoiceNote :: A.Value -> AT.Parser InlineQueryResult
parseInlineQueryResultVoiceNote :: Value -> Parser InlineQueryResult
parseInlineQueryResultVoiceNote = String
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InlineQueryResultVoiceNote" ((Object -> Parser InlineQueryResult)
-> Value -> Parser InlineQueryResult)
-> (Object -> Parser InlineQueryResult)
-> Value
-> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
_id_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"id"
Maybe VoiceNote
voice_note_ <- Object
o Object -> Key -> Parser (Maybe VoiceNote)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"voice_note"
Maybe Text
title_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"title"
InlineQueryResult -> Parser InlineQueryResult
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InlineQueryResult -> Parser InlineQueryResult)
-> InlineQueryResult -> Parser InlineQueryResult
forall a b. (a -> b) -> a -> b
$ InlineQueryResultVoiceNote
{ _id :: Maybe Text
_id = Maybe Text
_id_
, voice_note :: Maybe VoiceNote
voice_note = Maybe VoiceNote
voice_note_
, title :: Maybe Text
title = Maybe Text
title_
}
parseJSON Value
_ = Parser InlineQueryResult
forall a. Monoid a => a
mempty