packages feed

telegram-bot-api 6.5.1 → 6.7

raw patch · 35 files changed

+1008/−259 lines, 35 files

Files

CHANGELOG.md view
@@ -1,9 +1,47 @@ # telegram-bot-api +## 6.7 -- 2023-04-29++### Bot API 6.6 support++See [#147](https://github.com/fizruk/telegram-bot-simple/pull/147) and [#152](https://github.com/fizruk/telegram-bot-simple/pull/152).++- Add new methods: +    - `setMyDescription`, `getMyDecription`, `setMyShortDescription`, `getMyShortDescription`.+    - `setCustomEmojiStickerSetThumbnail`, `setStickerSetTitle`, `deleteStickerSet`, `setStickerEmojiList`, `setStickerKeywords`, `setStickerMaskPosition`.+- Modify following methods:+    - `sendSticker` (add `emoji`).+    - `createNewStickerSet`, `addStickerToSet` (`sticker` to `stickers`, introduced `InputSticker`).+    - `uploadStickerFile` (remove `png_sticker` and other formats, add `sticker`, `sticker_format` fields).+- Rename `thumb` to `thumbnail`:+    - Types: `Animation`, `Audio`, `Document`, `Sticker`, `Video`, `VideoNote`, `InputMediaAnimation`, `InputMediaAudio`, `InputMediaDocument`, `InputMediaVideo`, `StickerSet`.+    - Inlines: `InlineQueryResultPhoto`, `InlineQueryResultVideo`, `InlineQueryResultGif`, `InlineQueryResultMpeg4Gif`.+    - Methods: `setStickerThumb` (method renamed itself to `setStickerThumbnail`), `sendAnimation`, `sendAudio`, `sendDocument`, `sendVideo`, `sendVideoNote`, +- Modify `Sticker` type: add `needs_repainting` field.++- **Breaking changes**: Given the amount of Bot API changes, common record fields were moved tonew  `InlineQueryResultGeneric` data type and all thumbnails were moved to new `InlineQueryResultGenericThumbnail` data type.++- **Migration guide**:++    1. Provide `InlineQueryResultGeneric` (see `defInlineQueryResultGeneric`).+    2. Provide `InlineQueryResultGenericThumbnail` (see `defInlineQueryResultGenericThumbnail`).+    3. Specify your own `InlineQueryResult` (see helpers for each data constructor).++### Bot API 6.7 support++See [#155](https://github.com/fizruk/telegram-bot-simple/pull/155).++- Modify `answerInlineQuery` method.+- Modify `WriteAccessAllowed` data type.+- Add missing method `switchInlineQueryChosenChat`.+- Modify `ChatMemberUpdated` data type.+- Add new methods: `setMyName`, `getMyName`.++ ## 6.5.1 -- 2023-03-21  - Add new methods `getMyDescription`, `getMyShortDescription`, `setMyDescription`, `setMyShortDescription` (see [#141](https://github.com/fizruk/telegram-bot-simple/pull/141)).-- Re-export Forum, Games, Payments and Stickers in `Telegram.Bot.API.Methods` (see [#143](https://github.com/fizruk/telegram-bot-simple/issues/143).+- Re-export Forum, Games, Payments and Stickers in `Telegram.Bot.API.Methods` (see [#143](https://github.com/fizruk/telegram-bot-simple/issues/143)).  ## 6.5 (Telegram Bot API 6.5) 
src/Telegram/Bot/API/InlineMode.hs view
@@ -57,10 +57,7 @@   , answerInlineQueryCacheTime            :: Maybe Seconds       -- ^ The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.   , answerInlineQueryIsPersonal           :: Maybe Bool          -- ^ Pass 'True', if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query.   , answerInlineQueryNextOffset           :: Maybe Text          -- ^ Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes.-  , answerInlineQuerySwitchPmText         :: Maybe Text          -- ^ If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameter.-  , answerInlineQuerySwitchPmParameter    :: Maybe Text          -- ^ Deep-linking parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.------ Example: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.+  , answerInlineQueryButton               :: Maybe InlineQueryResultsButton -- ^ A JSON-serialized object describing a button to be shown above inline query results.   } deriving (Generic)  instance ToJSON AnswerInlineQueryRequest where toJSON = gtoJSON
src/Telegram/Bot/API/InlineMode/InlineQueryResult.hs view
@@ -1,82 +1,465 @@+{-# LANGUAGE BlockArguments #-} {-# LANGUAGE DeriveGeneric              #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE LambdaCase                 #-} {-# LANGUAGE OverloadedStrings          #-}+{-# LANGUAGE RecordWildCards            #-} module Telegram.Bot.API.InlineMode.InlineQueryResult where -import           Data.Aeson                      (FromJSON (..), ToJSON (..), Value (String))+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 (Contact)+import           Telegram.Bot.API.Types import           Telegram.Bot.API.InlineMode.InputMessageContent-import Telegram.Bot.API.Internal.TH (makeDefault)+import           Telegram.Bot.API.Internal.TH (makeDefault) --- | This object represents one result of an inline query-data InlineQueryResult = InlineQueryResult-  { inlineQueryResultType :: InlineQueryResultType -- ^ Type of the result-  , inlineQueryResultId :: InlineQueryResultId -- ^ Unique identifier for this result, 1-64 Bytes-  , inlineQueryResultTitle :: Maybe Text -- ^ Title of the result (only valid for "Article", "Photo", "Gif", "Mpeg4Gif", "Video", "Audio", "Voice", "Document", "Location", "Venue", "CachedPhoto", "CachedGif", "CachedMpeg4Gif", "CachedDocument", "CachedVideo", "CachedVoice" types of results)-  , inlineQueryResultInputMessageContent :: Maybe InputMessageContent-  , inlineQueryResultContact  :: Maybe Contact-  } deriving (Generic, Show)+import qualified Data.Text as Text  newtype InlineQueryResultId = InlineQueryResultId Text   deriving (Eq, Show, Generic, ToJSON, FromJSON, Hashable) -instance ToJSON InlineQueryResult where toJSON = gtoJSON-instance FromJSON InlineQueryResult where parseJSON = gparseJSON+data InlineQueryResultGeneric = InlineQueryResultGeneric+  { inlineQueryResultId :: InlineQueryResultId -- ^ Unique identifier for this result, 1-64 Bytes+  , inlineQueryResultTitle :: Maybe Text -- ^ Title of the result (only valid for "Article", "Photo", "Gif", "Mpeg4Gif", "Video", "Audio", "Voice", "Document", "Location", "Venue", "CachedPhoto", "CachedGif", "CachedMpeg4Gif", "CachedDocument", "CachedVideo", "CachedVoice" types of results)+  , inlineQueryResultCaption :: Maybe Text -- ^ Caption of the media to be sent, 0-1024 characters after entities parsing.+  , inlineQueryResultParseMode :: Maybe Text -- ^ Mode for parsing entities in the photo caption. See formatting options <https:\/\/core.telegram.org\/bots\/api#formatting-options> for more details.+  , inlineQueryResultCaptionEntities :: Maybe [MessageEntity] -- ^ List of special entities that appear in the caption, which can be specified instead of @parse_mode@.+  , inlineQueryResultReplyMarkup :: Maybe InlineKeyboardMarkup -- ^ Inline keyboard attached to the message.+  , inlineQueryResultInputMessageContent :: Maybe InputMessageContent -- ^  Content of the message to be sent instead of the media.+  , inlineQueryResultDescription :: Maybe Text -- ^ Short description of the result.+  }+  deriving (Generic, Show) --- | Type of inline query result-data InlineQueryResultType-  = InlineQueryResultCachedAudio-  | InlineQueryResultCachedDocument+instance ToJSON InlineQueryResultGeneric where toJSON = gtoJSON++instance FromJSON InlineQueryResultGeneric where parseJSON = gparseJSON++data InlineQueryResultGenericThumbnail = InlineQueryResultGenericThumbnail+  { inlineQueryResultGenericGeneric :: InlineQueryResultGeneric+  , inlineQueryResultGenericThumbnailUrl :: Maybe Text -- ^ URL of the thumbnail for the media.+  , inlineQueryResultGenericThumbnailMimeType :: Maybe Text -- ^ MIME type of the thumbnail, must be one of @image/jpeg@, @image/gif@, or @video/mp4@. Defaults to @image/jpeg@.+  , inlineQueryResultGenericThumbnailWidth :: Maybe Integer -- ^ Media width.+  , inlineQueryResultGenericThumbnailHeight :: Maybe Integer -- ^ Media height.+  }+  deriving (Generic, Show)++instance ToJSON InlineQueryResultGenericThumbnail where+  toJSON InlineQueryResultGenericThumbnail{..}+    = addJsonFields (toJSON inlineQueryResultGenericGeneric)+      [ "thumbnail_url" .= inlineQueryResultGenericThumbnailUrl+      , "thumbnail_mime_type" .= inlineQueryResultGenericThumbnailMimeType+      , "thumbnail_width" .= inlineQueryResultGenericThumbnailWidth+      , "thumbnail_height" .= inlineQueryResultGenericThumbnailHeight+      ]++instance FromJSON InlineQueryResultGenericThumbnail where+  parseJSON = withObject "InlineQueryResult" \o -> InlineQueryResultGenericThumbnail+    <$> parseJSON (Object o)+    <*> o .: "thumbnail_url"+    <*> o .: "thumbnail_mime_type"+    <*> o .: "thumbnail_width"+    <*> o .: "thumbnail_height"++-- | This object represents one result of an inline query+data InlineQueryResult+  = InlineQueryResultArticle+    { inlineQueryResultArticleGeneric :: InlineQueryResultGenericThumbnail+    , inlineQueryResultArticleUrl :: Maybe Text -- ^ URL of the result.+    , inlineQueryResultArticleHideUrl :: Maybe Bool -- ^ 'True' if you don't want the URL to be shown in the message.+    }+  | InlineQueryResultPhoto+    { inlineQueryResultPhotoGeneric :: InlineQueryResultGenericThumbnail+    , inlineQueryResultPhotoPhotoUrl :: Text -- ^ A valid URL of the photo. Photo must be in **JPEG** format. Photo size must not exceed 5MB.+    , inlineQueryResultPhotoPhotoWidth :: Maybe Integer -- ^ Width of the photo.+    , inlineQueryResultPhotoPhotoHeight :: Maybe Integer -- ^ Height of the photo.+    }+  | InlineQueryResultGif+    { inlineQueryResultGifGeneric :: InlineQueryResultGenericThumbnail+    , inlineQueryResultGifGifUrl :: Text -- ^ A valid URL for the GIF file. File size must not exceed 1MB.+    , inlineQueryResultGifGifWidth :: Maybe Integer -- ^ Width of the GIF.+    , inlineQueryResultGifGifHeight :: Maybe Integer -- ^ Height of the GIF.+    , inlineQueryResultGifGifDuration :: Maybe Integer -- ^ Duration of the GIF in seconds.+    }+  | InlineQueryResultMpeg4Gif+    { inlineQueryResultMpeg4GifGeneric :: InlineQueryResultGenericThumbnail+    , inlineQueryResultMpeg4GifMpeg4Url :: Text -- ^ A valid URL for the MPEG4 file. File size must not exceed 1MB.+    , inlineQueryResultMpeg4GifMpeg4Width :: Maybe Integer -- ^ Video width.+    , inlineQueryResultMpeg4GifMpeg4Height :: Maybe Integer -- ^ Video height.+    , inlineQueryResultMpeg4GifMpeg4Duration :: Maybe Integer -- ^ Video duration in seconds.+    }+  | InlineQueryResultVideo+    { inlineQueryResultVideoGeneric :: InlineQueryResultGenericThumbnail+    , inlineQueryResultVideoVideoUrl :: Text -- ^ A valid URL for the embedded video player or video file.+    , inlineQueryResultVideoMimeType :: Text -- ^ MIME type of the content of the video URL, @text/html@ or @video/mp4@.+    , inlineQueryResultVideoVideoWidth :: Maybe Integer -- ^ Video width.+    , inlineQueryResultVideoVideoHeight :: Maybe Integer -- ^ Video height.+    , inlineQueryResultVideoVideoDuration :: Maybe Integer -- ^ Video duration in seconds.+    }+  | InlineQueryResultAudio+    { inlineQueryResultAudioGeneric :: InlineQueryResultGeneric+    , inlineQueryResultAudioAudioUrl :: Text -- ^ A valid URL for the audio file.+    , inlineQueryResultAudioPerformer :: Maybe Text -- ^ Performer.+    , inlineQueryResultAudioAudioDuration :: Maybe Integer -- ^ Audio duration in seconds.+    }+  | InlineQueryResultVoice+    { inlineQueryResultVoiceGeneric :: InlineQueryResultGeneric+    , inlineQueryResultVoiceVoiceUrl :: Text -- ^ A valid URL for the voice recording.+    , inlineQueryResultVoiceVoiceDuration :: Maybe Integer -- ^ Recording duration in seconds.+    }+  | InlineQueryResultDocument+    { inlineQueryResultDocumentGeneric :: InlineQueryResultGenericThumbnail+    , inlineQueryResultDocumentDocumentUrl :: Text -- ^ A valid URL for the file.+    , inlineQueryResultDocumentMimeType :: Text -- ^ MIME type of the content of the file, either @application/pdf@ or @application/zip@.+    }+  | InlineQueryResultLocation+    { inlineQueryResultLocationGeneric :: InlineQueryResultGenericThumbnail+    , inlineQueryResultLocationLatitude :: Float -- ^ Location latitude in degrees.+    , inlineQueryResultLocationLongitude :: Float -- ^ Location longitude in degrees.+    , inlineQueryResultLocationHorizontalAccuracy :: Maybe Float -- ^ The radius of uncertainty for the location, measured in meters; 0-1500.+    , inlineQueryResultLocationLivePeriod :: Maybe Seconds -- ^ Period in seconds for which the location can be updated, should be between 60 and 86400.+    , inlineQueryResultLocationHeading :: Maybe Int -- ^ For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.+    , inlineQueryResultLocationProximityAlertRadius :: Maybe Int -- ^ For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.+    }+  | InlineQueryResultVenue+    { inlineQueryResultVenueGeneric :: InlineQueryResultGenericThumbnail+    , inlineQueryResultVenueLatitude :: Float -- ^ Latitude of the venue location in degrees.+    , inlineQueryResultVenueLongitude :: Float -- ^ Longitude of the venue location in degrees.+    , inlineQueryResultVenueAddress :: Text -- ^ Address of the venue.+    , inlineQueryResultVenueFoursquareId :: Maybe Text -- ^ Foursquare identifier of the venue if known.+    , inlineQueryResultVenueFoursquareType :: Maybe Text -- ^ Foursquare type of the venue, if known. (For example, @arts_entertainment/default@, @arts_entertainment/aquarium@ or @food/icecream@.)+    , inlineQueryResultVenueGooglePlaceId :: Maybe Text -- ^ Google Places identifier of the venue.+    , inlineQueryResultVenueGooglePlaceType :: Maybe Text -- ^ Google Places type of the venue. (See supported types <https:\/\/developers.google.com\/places\/web-service\/supported_types>.)+    }+  | InlineQueryResultContact+    { inlineQueryResultContactGeneric :: InlineQueryResultGenericThumbnail+    , inlineQueryResultContactPhoneNumber :: Text -- ^ Contact's phone number.+    , inlineQueryResultContactFirstName :: Text -- ^ Contact's first name.+    , inlineQueryResultContactLastName :: Maybe Text -- ^ Contact's last name.+    , inlineQueryResultContactVcard :: Maybe Text -- ^ Additional data about the contact in the form of a vCard <https:\/\/en.wikipedia.org\/wiki\/VCard>, 0-2048 bytes.+    }+  | InlineQueryResultGame+    { inlineQueryResultGameGeneric :: InlineQueryResultGeneric+    , inlineQueryResultGameGameShortName :: Text -- ^ Short name of the game.+    }+  | InlineQueryResultCachedPhoto+    { inlineQueryResultCachedPhotoGeneric :: InlineQueryResultGeneric+    , inlineQueryResultCachedPhotoPhotoFileId :: FileId -- ^ A valid file identifier of the photo.+    }   | InlineQueryResultCachedGif+    { inlineQueryResultCachedGifGeneric :: InlineQueryResultGeneric+    , iinlineQueryResultCachedGifGifFileId :: FileId -- ^ A valid file identifier for the GIF file.+    }   | InlineQueryResultCachedMpeg4Gif-  | InlineQueryResultCachedPhoto+    { inlineQueryResultCachedMpeg4GifGeneric :: InlineQueryResultGeneric+    , inlineQueryResultCachedMpeg4GifMpeg4FileId :: FileId -- ^ A valid file identifier for the MPEG4 file.+    }   | InlineQueryResultCachedSticker+    { inlineQueryResultCachedStickerGeneric :: InlineQueryResultGeneric+    , inlineQueryResultCachedStickerStickerFileId :: FileId -- ^ A valid file identifier of the sticker.+    }+  | InlineQueryResultCachedDocument+    { inlineQueryResultCachedDocumentGeneric :: InlineQueryResultGeneric+    , inlineQueryResultCachedDocumentDocumentFileId :: FileId -- ^ A valid file identifier for the file.+    }   | InlineQueryResultCachedVideo+    { inlineQueryResultCachedVideoGeneric :: InlineQueryResultGeneric+    , inlineQueryResultCachedVideoVideoFileId :: FileId -- ^ A valid file identifier for the video file.+    }   | InlineQueryResultCachedVoice-  | InlineQueryResultArticle-  | InlineQueryResultAudio-  | InlineQueryResultContact-  | InlineQueryResultGame-  | InlineQueryResultDocument-  | InlineQueryResultGif-  | InlineQueryResultLocation-  | InlineQueryResultMpeg4Gif-  | InlineQueryResultPhoto-  | InlineQueryResultVenue-  | InlineQueryResultVideo-  | InlineQueryResultVoice-  deriving (Eq, Show, Generic)+    { inlineQueryResultCachedVoiceGeneric :: InlineQueryResultGeneric+    , inlineQueryResultCachedVoiceVoiceFileId :: FileId -- ^ A valid file identifier for the voice message.+    }+  | InlineQueryResultCachedAudio+    { inlineQueryResultCachedAudioGeneric :: InlineQueryResultGeneric+    , inlineQueryResultCachedAudioAudioFileId :: FileId -- ^ A valid file identifier for the audio file.+    }+  deriving (Generic, Show) -getType :: InlineQueryResultType -> Text-getType InlineQueryResultCachedAudio = "audio"-getType InlineQueryResultCachedDocument = "document"-getType InlineQueryResultCachedGif = "gif"-getType InlineQueryResultCachedMpeg4Gif = "mpeg4_gif"-getType InlineQueryResultCachedPhoto = "photo"-getType InlineQueryResultCachedSticker = "sticker"-getType InlineQueryResultCachedVideo = "video"-getType InlineQueryResultCachedVoice = "voice"-getType InlineQueryResultArticle = "article"-getType InlineQueryResultAudio = "audio"-getType InlineQueryResultContact = "contact"-getType InlineQueryResultGame = "game"-getType InlineQueryResultDocument = "document"-getType InlineQueryResultGif = "gif"-getType InlineQueryResultLocation = "location"-getType InlineQueryResultMpeg4Gif = "mpeg4_gif"-getType InlineQueryResultPhoto = "photo"-getType InlineQueryResultVenue = "venue"-getType InlineQueryResultVideo = "video"-getType InlineQueryResultVoice = "voice"+instance ToJSON InlineQueryResult where+  toJSON = \case+    InlineQueryResultArticle g url hideUrl ->+      addJsonFields (toJSON g)+        (addType "article"+        [ "url" .= url+        , "hide_url" .= hideUrl+        ])+    InlineQueryResultPhoto g photoUrl photoWidth photoHeight ->+      addJsonFields (toJSON g)+        (addType "photo"+        [ "photo_url" .= photoUrl+        , "photo_width" .= photoWidth+        , "photo_height" .= photoHeight+        ])+    InlineQueryResultGif g gifUrl gifWidth gifHeight gifDuration ->+      addJsonFields (toJSON g)+        (addType "gif"+        [ "gif_url" .= gifUrl+        , "gif_width" .= gifWidth+        , "gif_height" .= gifHeight+        , "gif_duration" .= gifDuration+        ])+    InlineQueryResultMpeg4Gif g mpeg4Url mpeg4Width mpeg4Height mpeg4Duration ->+      addJsonFields (toJSON g)+        (addType "mpeg4_gif"+        [ "mpeg4_url" .= mpeg4Url+        , "mpeg4_width" .= mpeg4Width+        , "mpeg4_height" .= mpeg4Height+        , "mpeg4_duration" .= mpeg4Duration+        ])+    InlineQueryResultVideo g videoUrl mimeType videoWidth videoHeight videoDuration ->+      addJsonFields (toJSON g)+        (addType "video"+        [ "video_url" .= videoUrl+        , "mime_type" .= mimeType+        , "video_width" .= videoWidth+        , "video_height" .= videoHeight+        , "video_duration" .= videoDuration+        ])+    InlineQueryResultAudio g audioUrl performer audioDuration ->+      addJsonFields (toJSON g)+        (addType "audio"+        [ "audio_url" .= audioUrl+        , "performer" .= performer+        , "audio_duration" .= audioDuration+        ])+    InlineQueryResultVoice g voiceUrl voiceDuration ->+      addJsonFields (toJSON g)+        (addType "voice"+        [ "voice_url" .= voiceUrl+        , "voice_duration" .= voiceDuration+        ])+    InlineQueryResultDocument g documentUrl mimeType ->+      addJsonFields (toJSON g)+        (addType "document"+        [ "document_url" .= documentUrl+        , "mime_type" .= mimeType+        ])+    InlineQueryResultLocation g latitude longitude horizontalAccuracy livePeriod heading proximityAlertRadius ->+      addJsonFields (toJSON g)+        (addType "location"+        [ "latitude" .= latitude+        , "longitude" .= longitude+        , "horizontal_accuracy" .= horizontalAccuracy+        , "live_period" .= livePeriod+        , "heading" .= heading+        , "proximity_alert_radius" .= proximityAlertRadius+        ])+    InlineQueryResultVenue g latitude longitude address foursquareId foursquareType googlePlaceId googlePlaceType ->+      addJsonFields (toJSON g)+        (addType "venue"+        [ "latitude" .= latitude+        , "longitude" .= longitude+        , "address" .= address+        , "foursquare_id" .= foursquareId+        , "foursquare_type" .= foursquareType+        , "google_place_id" .= googlePlaceId+        , "google_place_type" .= googlePlaceType+        ])+    InlineQueryResultContact g phoneNumber firstName lastName vcard ->+      addJsonFields (toJSON g)+        (addType "contact"+        [ "phone_number" .= phoneNumber+        , "first_name" .= firstName+        , "last_name" .= lastName+        , "vcard" .= vcard+        ])+    InlineQueryResultGame g gameShortName ->+      addJsonFields (toJSON g)+        (addType "game"+        [ "game_short_name" .= gameShortName+        ])+    InlineQueryResultCachedPhoto g photoFileId ->+      addJsonFields (toJSON g)+        (addType "photo"+        [ "photo_file_id" .= photoFileId+        ])+    InlineQueryResultCachedGif g gifFileId ->+      addJsonFields (toJSON g)+        (addType "gif"+        [ "gif_file_id" .= gifFileId+        ])+    InlineQueryResultCachedMpeg4Gif g mpeg4FileId ->+      addJsonFields (toJSON g)+        (addType "mpeg4_gif"+        [ "mpeg4_file_id" .= mpeg4FileId+        ])+    InlineQueryResultCachedSticker g stickerFileId ->+      addJsonFields (toJSON g)+        (addType "sticker"+        [ "sticker_file_id" .= stickerFileId+        ])+    InlineQueryResultCachedDocument g documentFileId ->+      addJsonFields (toJSON g)+        (addType "document"+        [ "document_file_id" .= documentFileId+        ])+    InlineQueryResultCachedVideo g videoFileId ->+      addJsonFields (toJSON g)+        (addType "video"+        [ "video_file_id" .= videoFileId+        ])+    InlineQueryResultCachedVoice g voiceFileId ->+      addJsonFields (toJSON g)+        (addType "voice"+        [ "voice_file_id" .= voiceFileId+        ])+    InlineQueryResultCachedAudio g audioFileId ->+      addJsonFields (toJSON g)+        (addType "audio"+        [ "audio_file_id" .= audioFileId+        ]) -instance ToJSON InlineQueryResultType where-  toJSON = String . getType+instance FromJSON InlineQueryResult where+  parseJSON = withObject "InlineQueryResult" \o ->+    (o .: "type" :: Parser Text) >>= \case+    "article" -> InlineQueryResultArticle+      <$> parseJSON (Object o)+      <*> o .: "url"+      <*> o .: "hide_url"+    "photo" -> parseFileId o "photo_file_id" >>= \case+      Nothing -> InlineQueryResultPhoto+        <$> parseJSON (Object o) -- generic thumbnail+        <*> o .: "photo_url"+        <*> o .: "photo_width"+        <*> o .: "photo_height"+      Just fileId -> InlineQueryResultCachedPhoto <$> parseJSON (Object o) <*> pure fileId+    "gif" -> parseFileId o "gif_file_id" >>= \case+      Nothing -> InlineQueryResultGif+        <$> parseJSON (Object o) -- generic thumbnail+        <*> o .: "gif_url"+        <*> o .: "gif_width"+        <*> o .: "gif_height"+        <*> o .: "gif_duration"+      Just fileId -> InlineQueryResultCachedGif <$> parseJSON (Object o) <*> pure fileId+    "mpeg4_gif" -> parseFileId o "mpeg4_file_id" >>= \case+      Nothing -> InlineQueryResultMpeg4Gif+        <$> parseJSON (Object o) -- generic thumbnail+        <*> o .: "mpeg4_url"+        <*> o .: "mpeg4_width"+        <*> o .: "mpeg4_height"+        <*> o .: "mpeg4_duration"+      Just fileId -> InlineQueryResultCachedMpeg4Gif+        <$> parseJSON (Object o)+        <*> pure fileId+    "video" -> parseFileId o "video_file_id" >>= \case+      Nothing -> InlineQueryResultVideo+        <$> parseJSON (Object o)+        <*> o .: "video_url"+        <*> o .: "mime_type"+        <*> o .: "video_width"+        <*> o .: "video_height"+        <*> o .: "video_duration"+      Just fileId -> InlineQueryResultCachedVideo+        <$> parseJSON (Object o)+        <*> pure fileId+    "audio" -> parseFileId o "audio_file_id" >>= \case+      Nothing -> InlineQueryResultAudio+        <$> parseJSON (Object o)+        <*> o .: "audio_url"+        <*> o .: "performer"+        <*> o .: "duration"+      Just fileId -> InlineQueryResultCachedAudio <$> parseJSON (Object o) <*> pure fileId+    "voice" -> parseFileId o "voice_file_id" >>= \case+      Nothing -> InlineQueryResultVoice+        <$> parseJSON (Object o)+        <*> o .: "voice_url"+        <*> o .: "voice_duration"+      Just fileId -> InlineQueryResultCachedVoice <$> parseJSON (Object o) <*> pure fileId+    "document" -> parseFileId o "document_file_id" >>= \case+      Nothing -> InlineQueryResultDocument+        <$> parseJSON (Object o)+        <*> o .: "document_url"+        <*> o .: "mime_type"+      Just fileId -> InlineQueryResultCachedDocument <$> parseJSON (Object o) <*> pure fileId+    "location" -> InlineQueryResultLocation+      <$> parseJSON (Object o)+      <*> o .: "latitude"+      <*> o .: "longitude"+      <*> o .: "horizontal_accuracy"+      <*> o .: "live_period"+      <*> o .: "heading"+      <*> o .: "proximity_alert_radius"+    "venue" -> InlineQueryResultVenue+      <$> parseJSON (Object o)+      <*> o .: "latitude"+      <*> o .: "longitude"+      <*> o .: "address"+      <*> o .: "foursquare_id"+      <*> o .: "foursquare_type"+      <*> o .: "google_place_id"+      <*> o .: "google_place_type"+    "contact" -> InlineQueryResultContact+      <$> parseJSON (Object o)+      <*> o .: "phone_number"+      <*> o .: "first_name"+      <*> o .: "last_name"+      <*> o .: "vcard"+    "game" -> InlineQueryResultGame+      <$> parseJSON (Object o)+      <*> o .: "game_short_name"+    t -> fail $ Text.unpack ("Unknown type: " <> t)+    where+      parseFileId o fileField = o .:? fileField :: Parser (Maybe FileId)+    +defInlineQueryResultArticle :: InlineQueryResultGenericThumbnail -> InlineQueryResult+defInlineQueryResultArticle g = InlineQueryResultArticle g Nothing Nothing -instance FromJSON InlineQueryResultType where parseJSON = gparseJSON+defInlineQueryResultPhotoUrl :: InlineQueryResultGenericThumbnail -> Text -> InlineQueryResult+defInlineQueryResultPhotoUrl g photoUrl = InlineQueryResultPhoto g photoUrl Nothing Nothing -makeDefault ''InlineQueryResult+defInlineQueryResultGif :: InlineQueryResultGenericThumbnail -> Text -> InlineQueryResult+defInlineQueryResultGif g gifUrl = InlineQueryResultGif g gifUrl Nothing Nothing Nothing++defInlineQueryResultMpeg4Gif :: InlineQueryResultGenericThumbnail -> Text -> InlineQueryResult+defInlineQueryResultMpeg4Gif g mpeg4Url = InlineQueryResultMpeg4Gif g mpeg4Url Nothing Nothing Nothing++defInlineQueryResultVideo :: InlineQueryResultGenericThumbnail -> Text -> Text -> InlineQueryResult+defInlineQueryResultVideo g videoUrl mimeType+  = InlineQueryResultVideo g videoUrl mimeType Nothing Nothing Nothing++defInlineQueryResultAudio :: InlineQueryResultGeneric -> Text -> InlineQueryResult+defInlineQueryResultAudio g audioUrl = InlineQueryResultAudio g audioUrl Nothing Nothing++defInlineQueryResultVoice :: InlineQueryResultGeneric -> Text -> InlineQueryResult+defInlineQueryResultVoice g voiceUrl = InlineQueryResultVoice g voiceUrl Nothing++defInlineQueryResultDocument :: InlineQueryResultGenericThumbnail -> Text -> Text -> InlineQueryResult+defInlineQueryResultDocument = InlineQueryResultDocument++defInlineQueryResultLocation :: InlineQueryResultGenericThumbnail -> Float -> Float -> InlineQueryResult+defInlineQueryResultLocation g lat lon+  = InlineQueryResultLocation g lat lon Nothing Nothing Nothing Nothing++defInlineQueryResultVenue :: InlineQueryResultGenericThumbnail -> Float -> Float -> Text -> InlineQueryResult+defInlineQueryResultVenue g lat lon address+  = InlineQueryResultVenue g lat lon address Nothing Nothing Nothing Nothing++defInlineQueryResultContact :: InlineQueryResultGenericThumbnail -> Text -> Text -> InlineQueryResult+defInlineQueryResultContact g phoneNumber firstName+  = InlineQueryResultContact g phoneNumber firstName Nothing Nothing++-- | This object represents a button to be shown above inline query results. You must use exactly one of the optional fields.+data InlineQueryResultsButton = InlineQueryResultsButton+  { inlineQueryResultsButtonText :: Text +  , inlineQueryResultsButtonWebApp :: Maybe WebAppInfo+  , inlineQueryResultsButtonStartParameter :: Maybe Text -- ^ [Deep-linking](https://core.telegram.org/bots/features#deep-linking) parameter for the /start message sent to the bot when a user presses the button. 1-64 characters, only @A-Z@, @a-z@, @0-9@, @_@ and @-@ are allowed.+-- +-- Example: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a [switch_inline](https://core.telegram.org/bots/api#inlinekeyboardmarkup) button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.+  }+  deriving Generic++instance ToJSON InlineQueryResultsButton where toJSON = gtoJSON++instance FromJSON InlineQueryResultsButton where parseJSON = gparseJSON++foldMap makeDefault+  [ ''InlineQueryResultGeneric+  , ''InlineQueryResultGenericThumbnail+  ]
src/Telegram/Bot/API/InlineMode/InputMessageContent.hs view
@@ -6,38 +6,62 @@ import           GHC.Generics                    (Generic)  import           Telegram.Bot.API.Internal.Utils+import           Telegram.Bot.API.Types.LabeledPrice  -- | Represents the content of a text message to be sent as the result of an inline query.-data InputMessageContent =-  InputTextMessageContent -- ^ Represents the [content](https://core.telegram.org/bots/api#inputmessagecontent) of a text message to be sent as the result of an inline query.-  { inputMessageContentMessageText :: Text -- ^ Text of the message to be sent, 1-4096 characters-  , inputMessageContentParseMode :: Maybe Text -- ^ Mode for parsing entities in the message text. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.-  , inputMessageContentDisableWebPagePrefiew :: Maybe Bool -- ^ Disables link previews for links in the sent message-  }+data InputMessageContent+  = InputTextMessageContent -- ^ Represents the [content](https://core.telegram.org/bots/api#inputmessagecontent) of a text message to be sent as the result of an inline query.+    { inputMessageContentMessageText :: Text -- ^ Text of the message to be sent, 1-4096 characters+    , inputMessageContentParseMode :: Maybe Text -- ^ Mode for parsing entities in the message text. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.+    , inputMessageContentDisableWebPagePrefiew :: Maybe Bool -- ^ Disables link previews for links in the sent message+    }   | InputLocationMessageContent                                      -- ^ Represents the [content](https://core.telegram.org/bots/api#inputmessagecontent) of a location message to be sent as the result of an inline query.-  { inputMessageContentLatitude :: Float                     -- ^ Latitude of the location in degrees-  , inputMessageContentLongitude :: Float                    -- ^ Longitude of the location in degrees-  , inputMessageContentHorizontalAccuracy :: Maybe Float     -- ^ The radius of uncertainty for the location, measured in meters; 0-1500-  , inputMessageContentLivePeriod :: Maybe Integer           -- ^ Period in seconds for which the location can be updated, should be between 60 and 86400.-  , inputMessageContentHeading :: Maybe Integer              -- ^ For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.-  , inputMessageContentProximityAlertRadius :: Maybe Integer -- ^ For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.-  }+    { inputMessageContentLatitude :: Float                     -- ^ Latitude of the location in degrees+    , inputMessageContentLongitude :: Float                    -- ^ Longitude of the location in degrees+    , inputMessageContentHorizontalAccuracy :: Maybe Float     -- ^ The radius of uncertainty for the location, measured in meters; 0-1500+    , inputMessageContentLivePeriod :: Maybe Integer           -- ^ Period in seconds for which the location can be updated, should be between 60 and 86400.+    , inputMessageContentHeading :: Maybe Integer              -- ^ For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.+    , inputMessageContentProximityAlertRadius :: Maybe Integer -- ^ For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.+    }   | InputVenueMessageContent                              -- ^ Represents the content of a [venue](https://core.telegram.org/bots/api#inputmessagecontent) message to be sent as the result of an inline query.-  { inputMessageContentLatitude :: Float             -- ^ Latitude of the venue in degrees-  , inputMessageContentLongitude :: Float            -- ^ Longitude of the venue in degrees-  , inputMessageContentTitle :: Text                 -- ^ Name of the venue-  , inputMessageContentAddress :: Text               -- ^ Address of the venue-  , inputMessageContentFoursquareId :: Maybe Text    -- ^ Foursquare identifier of the venue, if known-  , inputMessageContentFoursquareType :: Maybe Text  -- ^ Foursquare type of the venue, if known. (For example, “arts_entertainment\/default”, “arts_entertainment\/aquarium” or “food\/icecream”.)-  , inputMessageContentGooglePlaceId :: Maybe Text   -- ^ Google Places identifier of the venue-  , inputMessageContentGooglePlaceType :: Maybe Text -- ^ Google Places type of the venue. (See [supported types](https://developers.google.com/places/web-service/supported_types).)-  }+    { inputMessageContentLatitude :: Float             -- ^ Latitude of the venue in degrees+    , inputMessageContentLongitude :: Float            -- ^ Longitude of the venue in degrees+    , inputMessageContentTitle :: Text                 -- ^ Name of the venue+    , inputMessageContentAddress :: Text               -- ^ Address of the venue+    , inputMessageContentFoursquareId :: Maybe Text    -- ^ Foursquare identifier of the venue, if known+    , inputMessageContentFoursquareType :: Maybe Text  -- ^ Foursquare type of the venue, if known. (For example, “arts_entertainment\/default”, “arts_entertainment\/aquarium” or “food\/icecream”.)+    , inputMessageContentGooglePlaceId :: Maybe Text   -- ^ Google Places identifier of the venue+    , inputMessageContentGooglePlaceType :: Maybe Text -- ^ Google Places type of the venue. (See [supported types](https://developers.google.com/places/web-service/supported_types).)+    }   | InputContactMessageContent                         -- ^ Represents the [content](https://core.telegram.org/bots/api#inputmessagecontent) of a contact message to be sent as the result of an inline query.-  { inputMessageContentPhoneNumber :: Text      -- ^ Contact's phone number-  , inputMessageContentFirstName :: Text        -- ^ Contact's first name-  , inputMessageContentSecondName :: Maybe Text -- ^ Contact's last name-  , inputMessageContentVcard :: Maybe Text      -- ^ Additional data about the contact in the form of a [vCard](https://en.wikipedia.org/wiki/VCard), 0-2048 bytes-  } deriving (Generic, Show)+    { inputMessageContentPhoneNumber :: Text      -- ^ Contact's phone number+    , inputMessageContentFirstName :: Text        -- ^ Contact's first name+    , inputMessageContentSecondName :: Maybe Text -- ^ Contact's last name+    , inputMessageContentVcard :: Maybe Text      -- ^ Additional data about the contact in the form of a [vCard](https://en.wikipedia.org/wiki/VCard), 0-2048 bytes+    }+  | InputInvoiceMessageContent                        -- ^ Represents the [content](https://core.telegram.org/bots/api#inputmessagecontent) of an invoice message to be sent as the result of an inline query.+    { inputMessageContentTitle :: Text -- ^ Product name, 1-32 characters.+    , inputMessageContentDescription :: Text -- ^ Product description, 1-255 characters.+    , inputMessageContentPayload :: Text -- ^ Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.+    , inputMessageContentProviderToken :: Text -- ^ Payment provider token, obtained via [@BotFather](https://t.me/botfather).+    , inputMessageContentCurrency :: Text -- ^ Three-letter ISO 4217 currency code, see [more on currencies](https://core.telegram.org/bots/payments#supported-currencies).+    , inputMessageContentPrices :: [LabeledPrice] -- ^ Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.).+    , inputMessageContentMaxTipAmount :: Maybe Integer -- ^ The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of @US$ 1.45@ pass @max_tip_amount = 145@. See the exp parameter in [currencies.json](https://core.telegram.org/bots/payments/currencies.json), it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0.+    , inputMessageContentSuggestedTipAmounts :: Maybe [Integer] -- ^ A JSON-serialized array of suggested amounts of tip in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed @max_tip_amount@.+    , inputMessageContentProviderData :: Maybe Text -- ^ A JSON-serialized object for data about the invoice, which will be shared with the payment provider. A detailed description of the required fields should be provided by the payment provider.+    , inputMessageContentPhotoUrl :: Maybe Text -- ^ URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service.+    , inputMessageContentPhotoSize :: Maybe Integer -- ^ Photo size in bytes.+    , inputMessageContentPhotoWidth :: Maybe Integer -- ^ Photo width.+    , inputMessageContentPhotoHeight :: Maybe Integer -- ^ Photo height.+    , inputMessageContentNeedName :: Maybe Bool -- ^ 'True' if you require the user's full name to complete the order.+    , inputMessageContentNeedPhoneNumber :: Maybe Bool -- ^ 'True' if you require the user's phone number to complete the order.+    , inputMessageContentNeedEmail :: Maybe Bool -- ^ 'True' if you require the user's email address to complete the order.+    , inputMessageContentNeedShippingAddress :: Maybe Bool -- ^ 'True' if you require the user's shipping address to complete the order.+    , inputMessageContentSendPhoneNumberToProvider :: Maybe Bool -- ^ 'True' if the user's phone number should be sent to provider.+    , inputMessageContentSendEmailToProvider :: Maybe Bool -- ^ 'True' if the user's email address should be sent to provider.+    , inputMessageContentIsFlexible :: Maybe Bool -- ^ 'True' if the final price depends on the shipping method.+    }+  deriving (Generic, Show)  -- ** Helper functions to easily construct 'InputMessageContent' 
src/Telegram/Bot/API/MakingRequests.hs view
@@ -1,6 +1,6 @@+{-# LANGUAGE CPP                        #-} {-# LANGUAGE DeriveGeneric              #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings          #-} module Telegram.Bot.API.MakingRequests where @@ -28,14 +28,28 @@ botBaseUrl token = BaseUrl Https "api.telegram.org" 443   (Text.unpack ("/bot" <> toUrlPiece token)) +botBaseUrlTest :: Token -> BaseUrl+botBaseUrlTest token = BaseUrl Https "api.telegram.org" 443+  (Text.unpack ("/bot" <> toUrlPiece token <> "/test"))+ defaultTelegramClientEnv :: Token -> IO ClientEnv defaultTelegramClientEnv token = mkClientEnv   <$> newManager tlsManagerSettings   <*> pure (botBaseUrl token) +defaultTelegramClientEnvTest :: Token -> IO ClientEnv+defaultTelegramClientEnvTest token = mkClientEnv+  <$> newManager tlsManagerSettings+  <*> pure (botBaseUrlTest token)+ defaultRunBot :: Token -> ClientM a -> IO (Either ClientError a) defaultRunBot token bot = do   env <- defaultTelegramClientEnv token+  runClientM bot env++defaultRunBotTest :: Token -> ClientM a -> IO (Either ClientError a)+defaultRunBotTest token bot = do+  env <- defaultTelegramClientEnvTest token   runClientM bot env  data Response a = Response
src/Telegram/Bot/API/Methods.hs view
@@ -24,6 +24,7 @@   , module Telegram.Bot.API.Methods.DeleteChatStickerSet   , module Telegram.Bot.API.Methods.DeleteMessage   , module Telegram.Bot.API.Methods.DeleteMyCommands+  , module Telegram.Bot.API.Methods.DeleteStickerSet   , module Telegram.Bot.API.Methods.EditChatInviteLink   , module Telegram.Bot.API.Methods.EditMessageLiveLocation   , module Telegram.Bot.API.Methods.ExportChatInviteLink@@ -68,9 +69,14 @@   , module Telegram.Bot.API.Methods.SetChatStickerSet   , module Telegram.Bot.API.Methods.SetChatTitle   , module Telegram.Bot.API.Methods.SetMyCommands+  , module Telegram.Bot.API.Methods.SetCustomEmojiStickerSetThumbnail   , module Telegram.Bot.API.Methods.SetMyDefaultAdministratorRights   , module Telegram.Bot.API.Methods.SetMyDescription   , module Telegram.Bot.API.Methods.SetMyShortDescription+  , module Telegram.Bot.API.Methods.SetStickerEmojiList+  , module Telegram.Bot.API.Methods.SetStickerKeywords+  , module Telegram.Bot.API.Methods.SetStickerMaskPosition+  , module Telegram.Bot.API.Methods.SetStickerSetTitle   , module Telegram.Bot.API.Methods.StopMessageLiveLocation   , module Telegram.Bot.API.Methods.UnbanChatMember   , module Telegram.Bot.API.Methods.UnbanChatSenderChat@@ -97,6 +103,7 @@ import Telegram.Bot.API.Methods.DeleteChatStickerSet import Telegram.Bot.API.Methods.DeleteMessage import Telegram.Bot.API.Methods.DeleteMyCommands+import Telegram.Bot.API.Methods.DeleteStickerSet import Telegram.Bot.API.Methods.EditChatInviteLink import Telegram.Bot.API.Methods.EditMessageLiveLocation import Telegram.Bot.API.Methods.ExportChatInviteLink@@ -141,9 +148,14 @@ import Telegram.Bot.API.Methods.SetChatStickerSet import Telegram.Bot.API.Methods.SetChatTitle import Telegram.Bot.API.Methods.SetMyCommands+import Telegram.Bot.API.Methods.SetCustomEmojiStickerSetThumbnail import Telegram.Bot.API.Methods.SetMyDefaultAdministratorRights import Telegram.Bot.API.Methods.SetMyDescription import Telegram.Bot.API.Methods.SetMyShortDescription+import Telegram.Bot.API.Methods.SetStickerEmojiList+import Telegram.Bot.API.Methods.SetStickerKeywords+import Telegram.Bot.API.Methods.SetStickerMaskPosition+import Telegram.Bot.API.Methods.SetStickerSetTitle import Telegram.Bot.API.Methods.StopMessageLiveLocation import Telegram.Bot.API.Methods.UnbanChatMember import Telegram.Bot.API.Methods.UnbanChatSenderChat
+ src/Telegram/Bot/API/Methods/DeleteStickerSet.hs view
@@ -0,0 +1,24 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE TypeOperators #-}+module Telegram.Bot.API.Methods.DeleteStickerSet where++import Data.Proxy+import Data.Text+import Servant.API+import Servant.Client hiding (Response)++import Telegram.Bot.API.MakingRequests+import Telegram.Bot.API.Types++-- ** 'deleteStickerSet'++type DeleteStickerSet = "deleteStickerSet"+  :> RequiredQueryParam "name" Text+  :> Post '[JSON] (Response Bool)++-- | Use this method to delete a sticker set that was created by the bot.+--   Returns 'True' on success.+deleteStickerSet :: Text -- ^ Sticker set name+  -> ClientM (Response Bool)+deleteStickerSet = client (Proxy @DeleteStickerSet)
+ src/Telegram/Bot/API/Methods/GetMyName.hs view
@@ -0,0 +1,38 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE TypeOperators #-}+module Telegram.Bot.API.Methods.GetMyName where++import Data.Aeson (FromJSON (..), ToJSON (..))+import Data.Proxy+import GHC.Generics (Generic)+import Data.Text (Text)+import Servant.API+import Servant.Client hiding (Response)++import Telegram.Bot.API.Internal.Utils+import Telegram.Bot.API.MakingRequests+import Telegram.Bot.API.Types+import Telegram.Bot.API.Internal.TH++-- ** 'GetMyName'++newtype GetMyNameRequest = GetMyNameRequest+  { getMyNameLanguageCode :: Maybe Text -- ^ A two-letter ISO 639-1 language code or an empty string.+  }+  deriving Generic++instance ToJSON   GetMyNameRequest where toJSON = gtoJSON+instance FromJSON GetMyNameRequest where parseJSON = gparseJSON++type GetMyName = "getMyName"+  :> ReqBody '[JSON] GetMyNameRequest+  :> Post '[JSON] (Response BotName)++-- | Use this method to get the current bot name for the given user language.+--   Returns 'BotName' on success.+getMyName :: GetMyNameRequest -> ClientM (Response BotName)+getMyName = client (Proxy @GetMyName)++makeDefault ''GetMyNameRequest
src/Telegram/Bot/API/Methods/SendAnimation.hs view
@@ -43,7 +43,7 @@   , sendAnimationDuration :: Maybe Int -- ^ Duration of sent animation in seconds   , sendAnimationWidth :: Maybe Int -- ^ Animation width   , sendAnimationHeight :: Maybe Int -- ^ Animation height-  , sendAnimationThumb :: Maybe InputFile -- ^ Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files »+  , sendAnimationThumbnail :: Maybe InputFile -- ^ Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files »   , sendAnimationCaption :: Maybe Text -- ^ Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing   , sendAnimationParseMode :: Maybe ParseMode  -- ^ Send 'MarkdownV2', 'HTML' or 'Markdown' (legacy), if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.   , sendAnimationCaptionEntities :: Maybe [MessageEntity] -- ^ A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode@@ -60,7 +60,7 @@  instance ToMultipart Tmp SendAnimationRequest where   toMultipart SendAnimationRequest{..} =-    maybe id (makeFile "thumb") sendAnimationThumb $+    maybe id (makeFile "thumbnail") sendAnimationThumbnail $     makeFile "animation" sendAnimationAnimation $     MultipartData fields [] where     fields =@@ -113,7 +113,7 @@ --   can currently send animation files of up to 50 --   MB in size, this limit may be changed in the future. sendAnimation :: SendAnimationRequest ->  ClientM (Response Message)-sendAnimation r = case (sendAnimationAnimation r, sendAnimationThumb r) of+sendAnimation r = case (sendAnimationAnimation r, sendAnimationThumbnail r) of   (InputFile{}, _) -> do     boundary <- liftIO genBoundary     client (Proxy @SendAnimationContent) (boundary, r)
src/Telegram/Bot/API/Methods/SendAudio.hs view
@@ -43,7 +43,7 @@   , sendAudioDuration :: Maybe Int -- ^ Duration of sent audio in seconds   , sendAudioPerformer :: Maybe Text -- ^ Performer   , sendAudioTitle :: Maybe Text -- ^ Track name-  , sendAudioThumb :: Maybe InputFile -- ^ Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files »+  , sendAudioThumbnail :: Maybe InputFile -- ^ Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files »   , sendAudioCaption :: Maybe Text -- ^ Audio caption (may also be used when resending audios by file_id), 0-1024 characters after entities parsing   , sendAudioParseMode :: Maybe ParseMode  -- ^ Send 'MarkdownV2', 'HTML' or 'Markdown' (legacy), if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.   , sendAudioCaptionEntities :: Maybe [MessageEntity] -- ^ A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode@@ -59,7 +59,7 @@  instance ToMultipart Tmp SendAudioRequest where   toMultipart SendAudioRequest{..} =-    maybe id (makeFile "thumb") sendAudioThumb $+    maybe id (makeFile "Thumbnail") sendAudioThumbnail $     makeFile "audio" sendAudioAudio $     MultipartData fields [] where     fields =@@ -113,7 +113,7 @@ -- --   For sending voice messages, use the sendVoice method instead. sendAudio :: SendAudioRequest ->  ClientM (Response Message)-sendAudio r = case (sendAudioAudio r, sendAudioThumb r) of+sendAudio r = case (sendAudioAudio r, sendAudioThumbnail r) of   (InputFile{}, _) -> do     boundary <- liftIO genBoundary     client (Proxy @SendAudioContent) (boundary, r)
src/Telegram/Bot/API/Methods/SendDocument.hs view
@@ -62,7 +62,7 @@   { sendDocumentChatId :: SomeChatId -- ^ Unique identifier for the target chat or username of the target channel (in the format @\@channelusername@).   , sendDocumentMessageThreadId :: Maybe MessageThreadId -- ^ Unique identifier for the target message thread (topic) of the forum; for forum supergroups only.   , sendDocumentDocument :: DocumentFile -- ^ Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data-  , sendDocumentThumb :: Maybe FilePath -- ^ Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>+  , sendDocumentThumbnail :: Maybe FilePath -- ^ Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>   , sendDocumentCaption :: Maybe Text -- ^ Document caption (may also be used when resending documents by file_id), 0-1024 characters after entities parsing   , sendDocumentParseMode :: Maybe ParseMode  -- ^ Send 'MarkdownV2', 'HTML' or 'Markdown' (legacy), if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.   , sendDocumentCaptionEntities :: Maybe [MessageEntity] -- ^ A JSON-serialized list of special entities that appear in the caption, which can be specified instead of /parse_mode/.@@ -98,7 +98,7 @@           SomeChatUsername txt -> txt       ] <>       (   (maybe id (\t -> ((Input "message_thread_id") (T.pack $ show t):)) sendDocumentMessageThreadId)-        $ (maybe id (\_ -> ((Input "thumb" "attach://thumb"):)) sendDocumentThumb)+        $ (maybe id (\_ -> ((Input "thumbnail" "attach://thumbnail"):)) sendDocumentThumbnail)         $ (maybe id (\t -> ((Input "caption" t):)) sendDocumentCaption)         $ (maybe id (\t -> ((Input "parse_mode" (TL.toStrict $ encodeToLazyText t)):)) sendDocumentParseMode)         $ (maybe id (\t -> ((Input "caption_entities" (TL.toStrict $ encodeToLazyText t)):)) sendDocumentCaptionEntities)@@ -111,7 +111,7 @@         [])     files       = (FileData "file" (T.pack $ takeFileName path) ct path)-      : maybe [] (\t -> [FileData "thumb" (T.pack $ takeFileName t) "image/jpeg" t]) sendDocumentThumb+      : maybe [] (\t -> [FileData "thumbnail" (T.pack $ takeFileName t) "image/jpeg" t]) sendDocumentThumbnail      DocumentFile path ct = sendDocumentDocument 
src/Telegram/Bot/API/Methods/SendVideo.hs view
@@ -43,7 +43,7 @@   , sendVideoDuration :: Maybe Int -- ^ Duration of sent video in seconds   , sendVideoWidth :: Maybe Int -- ^ Video width   , sendVideoHeight :: Maybe Int -- ^ Video height-  , sendVideoThumb :: Maybe InputFile -- ^ Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files »+  , sendVideoThumbnail :: Maybe InputFile -- ^ Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files »   , sendVideoCaption :: Maybe Text -- ^ Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing   , sendVideoParseMode :: Maybe ParseMode  -- ^ Send 'MarkdownV2', 'HTML' or 'Markdown' (legacy), if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.   , sendVideoCaptionEntities :: Maybe [MessageEntity] -- ^ A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode@@ -61,7 +61,7 @@  instance ToMultipart Tmp SendVideoRequest where   toMultipart SendVideoRequest{..} =-    maybe id (makeFile "thumb") sendVideoThumb $+    maybe id (makeFile "thumbnail") sendVideoThumbnail $     makeFile "video" sendVideoVideo $     MultipartData fields [] where     fields =@@ -116,7 +116,7 @@ --   Bots can currently send video files of up --   to 50 MB in size, this limit may be changed in the future. sendVideo :: SendVideoRequest ->  ClientM (Response Message)-sendVideo r = case (sendVideoVideo r, sendVideoThumb r) of+sendVideo r = case (sendVideoVideo r, sendVideoThumbnail r) of   (InputFile{}, _) -> do     boundary <- liftIO genBoundary     client (Proxy @SendVideoContent) (boundary, r)
src/Telegram/Bot/API/Methods/SendVideoNote.hs view
@@ -40,7 +40,7 @@   , sendVideoNoteVideoNote :: InputFile -- ^ Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. More info on Sending Files ». Sending video notes by a URL is currently unsupported   , sendVideoNoteDuration :: Maybe Int -- ^ Duration of sent video in seconds   , sendVideoNoteLength :: Maybe Int -- ^ Video width and height, i.e. diameter of the video message-  , sendVideoNoteThumb :: Maybe InputFile -- ^ Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files »+  , sendVideoNoteThumbnail :: Maybe InputFile -- ^ Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files »   , sendVideoNoteDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound.   , sendVideoNoteProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving   , sendVideoNoteReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message@@ -53,7 +53,7 @@  instance ToMultipart Tmp SendVideoNoteRequest where   toMultipart SendVideoNoteRequest{..} =-    maybe id (makeFile "thumb") sendVideoNoteThumb $+    maybe id (makeFile "thumbnail") sendVideoNoteThumbnail $     makeFile "video_note" sendVideoNoteVideoNote $     MultipartData fields [] where     fields =@@ -90,7 +90,7 @@ --   this method to send video messages. --   On success, the sent Message is returned. sendVideoNote :: SendVideoNoteRequest ->  ClientM (Response Message)-sendVideoNote r = case (sendVideoNoteVideoNote r, sendVideoNoteThumb r) of+sendVideoNote r = case (sendVideoNoteVideoNote r, sendVideoNoteThumbnail r) of   (InputFile{}, _) -> do     boundary <- liftIO genBoundary     client (Proxy @SendVideoNoteContent) (boundary, r)
+ src/Telegram/Bot/API/Methods/SetCustomEmojiStickerSetThumbnail.hs view
@@ -0,0 +1,38 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE TypeOperators #-}+module Telegram.Bot.API.Methods.SetCustomEmojiStickerSetThumbnail where++import Data.Aeson (FromJSON (..), ToJSON (..))+import Data.Proxy+import Data.Text+import GHC.Generics (Generic)+import Servant.API+import Servant.Client hiding (Response)++import Telegram.Bot.API.Internal.Utils+import Telegram.Bot.API.MakingRequests+import Telegram.Bot.API.Internal.TH++-- ** 'setCustomEmojiStickerSetThumbnail'++data SetCustomEmojiStickerSetThumbnailRequest = SetCustomEmojiStickerSetThumbnailRequest+    { setCustomEmojiStickerSetThumbnailName          :: Text -- ^ Sticker set name+    , setCustomEmojiStickerSetThumbnailCustomEmojiId :: Maybe Text -- ^ Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail.+    }+    deriving Generic++instance ToJSON   SetCustomEmojiStickerSetThumbnailRequest where toJSON = gtoJSON+instance FromJSON SetCustomEmojiStickerSetThumbnailRequest where parseJSON = gparseJSON++type SetCustomEmojiStickerSetThumbnail = "setCustomEmojiStickerSetThumbnail"+  :> ReqBody '[JSON] SetCustomEmojiStickerSetThumbnailRequest+  :> Post '[JSON] (Response Bool)++-- | Use this method to set the thumbnail of a custom emoji sticker set.+--   Returns 'True' on success.+setCustomEmojiStickerSetThumbnail :: SetCustomEmojiStickerSetThumbnailRequest -> ClientM (Response Bool)+setCustomEmojiStickerSetThumbnail = client (Proxy @SetCustomEmojiStickerSetThumbnail)++makeDefault ''SetCustomEmojiStickerSetThumbnailRequest
+ src/Telegram/Bot/API/Methods/SetMyName.hs view
@@ -0,0 +1,38 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE TypeOperators #-}+module Telegram.Bot.API.Methods.SetMyName where++import Data.Aeson (FromJSON (..), ToJSON (..))+import Data.Proxy+import GHC.Generics (Generic)+import Data.Text (Text)+import Servant.API+import Servant.Client hiding (Response)++import Telegram.Bot.API.Internal.Utils+import Telegram.Bot.API.MakingRequests+import Telegram.Bot.API.Internal.TH++-- ** 'setMyName'++data SetMyNameRequest = SetMyNameRequest+  { setMyNameName  :: Maybe Text -- ^ New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.+  , setMyNameLanguageCode :: Maybe Text -- ^ A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name.+  }+  deriving Generic++instance ToJSON   SetMyNameRequest where toJSON = gtoJSON+instance FromJSON SetMyNameRequest where parseJSON = gparseJSON++type SetMyName = "setMyName"+  :> ReqBody '[JSON] SetMyNameRequest+  :> Post '[JSON] (Response Bool)++-- | Use this method to change the bot's name.+--   Returns 'True' on success.+setMyName :: SetMyNameRequest -> ClientM (Response Bool)+setMyName = client (Proxy @SetMyName)++makeDefault ''SetMyNameRequest
+ src/Telegram/Bot/API/Methods/SetStickerEmojiList.hs view
@@ -0,0 +1,41 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE TypeOperators #-}+module Telegram.Bot.API.Methods.SetStickerEmojiList where++import Data.Aeson (FromJSON (..), ToJSON (..))+import Data.Proxy+import Data.Text+import GHC.Generics (Generic)+import Servant.API+import Servant.Client hiding (Response)++import Telegram.Bot.API.Internal.Utils+import Telegram.Bot.API.MakingRequests+import Telegram.Bot.API.Internal.TH++-- ** 'setStickerEmojiList'++-- | Request parameters for 'setStickerEmojiList'.+data SetStickerEmojiListRequest = SetStickerEmojiListRequest+  { setStickerEmojiListSticker :: Text -- ^ File identifier of the sticker+  , setStickerEmojiListEmojiList :: [Text] -- ^ A JSON-serialized list of 1-20 emoji associated with the sticker+  }+  deriving Generic++instance ToJSON   SetStickerEmojiListRequest where toJSON = gtoJSON+instance FromJSON SetStickerEmojiListRequest where parseJSON = gparseJSON++type SetStickerEmojiList = "setStickerEmojiList"+  :> ReqBody '[JSON] SetStickerEmojiListRequest+  :> Post '[JSON] (Response Bool)+ +-- | Use this method to change the list of+--   emoji assigned to a regular or custom emoji sticker.+--   The sticker must belong to a sticker set created by the bot.+--   Returns 'True' on success.+setStickerEmojiList :: SetStickerEmojiListRequest ->  ClientM (Response Bool)+setStickerEmojiList = client (Proxy @SetStickerEmojiList)++makeDefault ''SetStickerEmojiListRequest
+ src/Telegram/Bot/API/Methods/SetStickerKeywords.hs view
@@ -0,0 +1,41 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE TypeOperators #-}+module Telegram.Bot.API.Methods.SetStickerKeywords where++import Data.Aeson (FromJSON (..), ToJSON (..))+import Data.Proxy+import Data.Text+import GHC.Generics (Generic)+import Servant.API+import Servant.Client hiding (Response)++import Telegram.Bot.API.Internal.Utils+import Telegram.Bot.API.MakingRequests+import Telegram.Bot.API.Internal.TH++-- ** 'setStickerKeywords'++-- | Request parameters for 'setStickerKeywords'.+data SetStickerKeywordsRequest = SetStickerKeywordsRequest+  { setStickerKeywordsSticker :: Text -- ^ File identifier of the sticker+  , setStickerKeywordsKeywords :: Maybe [Text] -- ^ A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters+  }+  deriving Generic++instance ToJSON   SetStickerKeywordsRequest where toJSON = gtoJSON+instance FromJSON SetStickerKeywordsRequest where parseJSON = gparseJSON++type SetStickerKeywords = "setStickerKeywords"+  :> ReqBody '[JSON] SetStickerKeywordsRequest+  :> Post '[JSON] (Response Bool)++-- | Use this method to change search keywords+--   assigned to a regular or custom emoji sticker.+--   The sticker must belong to a sticker set created by the bot.+--   Returns 'True' on success.+setStickerKeywords :: SetStickerKeywordsRequest -> ClientM (Response Bool)+setStickerKeywords = client (Proxy @SetStickerKeywords)++makeDefault ''SetStickerKeywordsRequest
+ src/Telegram/Bot/API/Methods/SetStickerMaskPosition.hs view
@@ -0,0 +1,41 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE TypeOperators #-}+module Telegram.Bot.API.Methods.SetStickerMaskPosition where++import Data.Aeson (FromJSON (..), ToJSON (..))+import Data.Proxy+import Data.Text+import GHC.Generics (Generic)+import Servant.API+import Servant.Client hiding (Response)++import Telegram.Bot.API.Internal.Utils+import Telegram.Bot.API.MakingRequests+import Telegram.Bot.API.Internal.TH+import Telegram.Bot.API.Types++-- ** 'setStickerMaskPosition'++-- | Request parameters for 'setStickerMaskPosition'.+data SetStickerMaskPositionRequest = SetStickerMaskPositionRequest+  { setStickerMaskPositionSticker      :: Text -- ^ File identifier of the sticker+  , setStickerMaskPositionMaskPosition :: Maybe [MaskPosition] -- ^ A JSON-serialized object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position.+  }+  deriving Generic++instance ToJSON   SetStickerMaskPositionRequest where toJSON = gtoJSON+instance FromJSON SetStickerMaskPositionRequest where parseJSON = gparseJSON++type SetStickerMaskPosition = "setStickerMaskPosition"+  :> ReqBody '[JSON] SetStickerMaskPositionRequest+  :> Post '[JSON] (Response Bool)++-- | Use this method to change the mask position of a mask sticker.+--   The sticker must belong to a sticker set that was created by the bot.+--   Returns 'True' on success.+setStickerMaskPosition :: SetStickerMaskPositionRequest -> ClientM (Response Bool)+setStickerMaskPosition = client (Proxy @SetStickerMaskPosition)++makeDefault ''SetStickerMaskPositionRequest
+ src/Telegram/Bot/API/Methods/SetStickerSetTitle.hs view
@@ -0,0 +1,26 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE TypeOperators #-}+module Telegram.Bot.API.Methods.SetStickerSetTitle where++import Data.Proxy+import Data.Text+import Servant.API+import Servant.Client hiding (Response)++import Telegram.Bot.API.MakingRequests+import Telegram.Bot.API.Types++-- ** 'setStickerSetTitle'+type SetStickerSetTitle = "setStickerSetTitle"+    :> RequiredQueryParam "name" Text+    :> RequiredQueryParam "title" Text+    :> Post '[JSON] (Response Bool)++-- | Use this method to set the title of a created sticker set.+--   Returns True on success.+setStickerSetTitle :: Text -- ^ Sticker set name+  -> Text -- ^ Sticker set title, 1-64 characters+  -> ClientM (Response Bool)+setStickerSetTitle = client (Proxy @SetStickerSetTitle)
src/Telegram/Bot/API/Stickers.hs view
@@ -1,7 +1,6 @@ {-# LANGUAGE DataKinds                  #-} {-# LANGUAGE DeriveGeneric              #-} {-# LANGUAGE OverloadedStrings          #-}-{-# LANGUAGE CPP #-} {-# LANGUAGE TypeApplications           #-} {-# LANGUAGE TypeOperators              #-} {-# LANGUAGE RecordWildCards            #-}@@ -12,9 +11,6 @@  import Control.Monad.IO.Class import Data.Aeson-#if MIN_VERSION_aeson(2,0,0)-import Data.Aeson.Key (fromText)-#endif import Data.Aeson.Text import Data.Bool import Data.Text (Text)@@ -30,7 +26,7 @@ import Telegram.Bot.API.Internal.Utils import Telegram.Bot.API.MakingRequests (Response) import Telegram.Bot.API.Types-import Data.Maybe (catMaybes, maybeToList)+import Data.Maybe (catMaybes) import Data.Functor import Telegram.Bot.API.Internal.TH (makeDefault) @@ -41,11 +37,6 @@   | TgsSticker -- ^ TGS animation with the sticker, uploaded using multipart/form-data. See <https:\/\/core.telegram.org\/animated_stickers#technical-requirements> for technical requirements.   | WebmSticker -- ^ WEBM video with the sticker, uploaded using multipart/form-data. See <https:\/\/core.telegram.org\/stickers#video-sticker-requirements> for technical requirements. -stickerLabel :: StickerType -> T.Text-stickerLabel = \case-  PngSticker -> "png_sticker"-  TgsSticker -> "tgs_sticker"-  WebmSticker -> "webm_sticker"  -- | Sticker file with static/animated label. data StickerFile = StickerFile {stickerFileSticker :: InputFile, stickerFileLabel :: StickerType}@@ -56,6 +47,7 @@ data SendStickerRequest = SendStickerRequest   { sendStickerChatId                   :: SomeChatId -- ^ Unique identifier for the target chat or username of the target channel (in the format @channelusername).   , sendStickerMessageThreadId          :: Maybe MessageThreadId -- ^ Unique identifier for the target message thread (topic) of the forum; for forum supergroups only.+  , sendStickerEmoji                    :: Maybe Text -- ^ Emoji associated with the sticker; only for just uploaded stickers.   , sendStickerSticker                  :: InputFile -- ^ Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP file from the Internet, or upload a new one using multipart/form-data.   , sendStickerDisableNotification      :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound.   , sendStickerProtectContent           :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving.@@ -124,20 +116,26 @@   :> ReqBody '[JSON] GetCustomEmojiStickersRequest   :> Post '[JSON] (Response [Sticker]) +getCustomEmojiStickers :: GetCustomEmojiStickersRequest -> ClientM (Response [Sticker])+getCustomEmojiStickers = client (Proxy @GetCustomEmojiStickers)+ -- ** 'uploadStickerFile'  -- | Request parameters for 'uploadStickerFile'. data UploadStickerFileRequest = UploadStickerFileRequest-  { uploadStickerFileUserId     :: UserId -- ^ User identifier of sticker file owner-  , uploadStickerFilePngSticker :: InputFile -- ^ PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px.+  { uploadStickerFileUserId        :: UserId -- ^ User identifier of sticker file owner+  , uploadStickerFileSticker       :: InputFile -- ^ A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format. See https://core.telegram.org/stickers for technical requirements.+  , uploadStickerFileStickerFormat :: Text -- ^ Format of the sticker, must be one of “static”, “animated”, “video”   } deriving Generic  instance ToJSON UploadStickerFileRequest where toJSON = gtoJSON  instance ToMultipart Tmp UploadStickerFileRequest where   toMultipart UploadStickerFileRequest{..} =-    makeFile "png_sticker" uploadStickerFilePngSticker (MultipartData fields []) where-    fields = [ Input "user_id" $ T.pack . show $ uploadStickerFileUserId ]+    makeFile "sticker" uploadStickerFileSticker (MultipartData fields []) where+    fields = [ Input "user_id" $ T.pack . show $ uploadStickerFileUserId+             , Input "sticker_format" $ T.pack . show $ uploadStickerFileStickerFormat+             ]  type UploadStickerFileContent   = "uploadStickerFile"@@ -149,13 +147,13 @@   :> ReqBody '[JSON] UploadStickerFileRequest   :> Post '[JSON] (Response File) --- | Use this method to upload a .PNG file+-- | Use this method to upload f file in .WEBP, .PNG, .TGS, or .WEBM format --   with a sticker for later use in createNewStickerSet --   and addStickerToSet methods (can be used multiple times). --   Returns the uploaded File on success. uploadStickerFile :: UploadStickerFileRequest -> ClientM (Response File) uploadStickerFile r =-  case uploadStickerFilePngSticker r of+  case uploadStickerFileSticker r of     InputFile{} -> do       boundary <- liftIO genBoundary       client (Proxy @UploadStickerFileContent) (boundary, r)@@ -169,51 +167,15 @@   { createNewStickerSetUserId        :: UserId -- ^ User identifier of created sticker set owner   , createNewStickerSetName          :: T.Text -- ^ Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only english letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in “_by_<bot username>”. <bot_username> is case insensitive. 1-64 characters.   , createNewStickerSetTitle         :: T.Text -- ^ Sticker set title, 1-64 characters-  , createNewStickerSetSticker       :: StickerFile -- ^ Sticker file to upload-  , createNewStickerSetEmojis        :: T.Text -- ^ One or more emoji corresponding to the sticker-  , createNewStickerSetContainsMasks :: Maybe Bool -- ^ Pass True, if a set of mask stickers should be created-  , createNewStickerSetMaskPosition  :: Maybe MaskPosition -- ^ A JSON-serialized object for position where the mask should be placed on faces+  , createNewStickerSetStickers      :: [InputSticker] -- ^ A JSON-serialized list of 1-50 initial stickers to be added to the sticker set.+  , createNewStickerFormat           :: Text -- ^ Format of stickers in the set, must be one of “static”, “animated”, “video”.+  , createNewStickerSetType             :: Maybe StickerSetType -- ^ Type of stickers in the set, pass “regular”, “mask”, or “custom_emoji”. By default, a regular sticker set is created.+  , createNewStickerSetNeedsRepainting :: Maybe Bool -- ^ 'True' if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only.   } deriving Generic -instance ToJSON CreateNewStickerSetRequest where-  toJSON CreateNewStickerSetRequest{..} = object-    [ "user_id" .= createNewStickerSetUserId-    , "name" .= createNewStickerSetName-    , "title" .= createNewStickerSetTitle-#if MIN_VERSION_aeson(2,0,0)-    , fromText (stickerLabel stickerFileLabel) .= stickerFileSticker-#else-    , stickerLabel stickerFileLabel .= stickerFileSticker-#endif-    , "emojis" .= createNewStickerSetEmojis-    , "contains_mask" .= createNewStickerSetContainsMasks-    , "mask_position" .= createNewStickerSetMaskPosition-    ]-    where-      StickerFile{..} = createNewStickerSetSticker--instance ToMultipart Tmp CreateNewStickerSetRequest where-  toMultipart CreateNewStickerSetRequest{..} =-    makeFile (stickerLabel stickerFileLabel) stickerFileSticker (MultipartData fields []) where-    fields =-      [ Input "user_id" $ T.pack . show $ createNewStickerSetUserId-      , Input "name" createNewStickerSetName-      , Input "title" createNewStickerSetTitle-      , Input "emojis" createNewStickerSetEmojis-      ] <> catMaybes-      [ createNewStickerSetContainsMasks <&>-        \t -> Input "contains_masks" (bool "false" "true" t)-      , createNewStickerSetMaskPosition <&>-        \t -> Input "mask_position" (TL.toStrict $ encodeToLazyText t)-      ]-    StickerFile {..} = createNewStickerSetSticker--type CreateNewStickerSetContent-  = "createNewStickerSet"-  :> MultipartForm Tmp CreateNewStickerSetRequest-  :> Post '[JSON] (Response Bool)+instance ToJSON CreateNewStickerSetRequest where toJSON = gtoJSON -type CreateNewStickerSetLink+type CreateNewStickerSet   = "createNewStickerSet"   :> ReqBody '[JSON] CreateNewStickerSetRequest   :> Post '[JSON] (Response Bool)@@ -224,12 +186,7 @@ --   must use exactly one of the fields png_sticker or tgs_sticker. --   Returns True on success. createNewStickerSet :: CreateNewStickerSetRequest -> ClientM (Response Bool)-createNewStickerSet r =-  case stickerFileSticker $ createNewStickerSetSticker r of-    InputFile{} -> do-      boundary <- liftIO genBoundary-      client (Proxy @CreateNewStickerSetContent) (boundary, r)-    _ -> client (Proxy @CreateNewStickerSetLink) r+createNewStickerSet = client (Proxy @CreateNewStickerSet)  -- ** 'addStickerToSet' @@ -237,45 +194,12 @@ data AddStickerToSetRequest = AddStickerToSetRequest   { addStickerToSetUserId       :: UserId -- ^ User identifier of sticker set owner   , addStickerToSetName         :: T.Text -- ^ Sticker set name-  , addStickerToSetSticker      :: StickerFile -- ^ Sticker file to upload-  , addStickerToSetEmojis       :: T.Text -- ^ One or more emoji corresponding to the sticker-  , addStickerToSetMaskPosition :: Maybe MaskPosition -- ^ A JSON-serialized object for position where the mask should be placed on faces+  , addStickerToSetStickers     :: InputSticker -- ^ A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set isn't changed.   } deriving Generic -instance ToJSON AddStickerToSetRequest where-  toJSON AddStickerToSetRequest{..} = object-    [ "user_id" .= addStickerToSetUserId-    , "name" .= addStickerToSetName-#if MIN_VERSION_aeson(2,0,0)-    , fromText (stickerLabel stickerFileLabel) .= stickerFileSticker-#else-    , stickerLabel stickerFileLabel .= stickerFileSticker-#endif-    , "emojis" .= addStickerToSetEmojis-    , "mask_position" .= addStickerToSetMaskPosition-    ]-    where-      StickerFile{..} = addStickerToSetSticker--instance ToMultipart Tmp AddStickerToSetRequest where-  toMultipart AddStickerToSetRequest{..} =-    makeFile (stickerLabel stickerFileLabel) stickerFileSticker (MultipartData fields []) where-    fields =-      [ Input "user_id" $ T.pack . show $ addStickerToSetUserId-      , Input "name" addStickerToSetName-      , Input "emojis" addStickerToSetEmojis-      ] <> maybeToList-      ( addStickerToSetMaskPosition <&>-        \t -> Input "mask_position" (TL.toStrict $ encodeToLazyText t)-      )-    StickerFile {..} = addStickerToSetSticker--type AddStickerToSetContent-  = "addStickerToSet"-  :> MultipartForm Tmp AddStickerToSetRequest-  :> Post '[JSON] (Response Bool)+instance ToJSON AddStickerToSetRequest where toJSON = gtoJSON -type AddStickerToSetLink+type AddStickerToSet   = "addStickerToSet"   :> ReqBody '[JSON] AddStickerToSetRequest   :> Post '[JSON] (Response Bool)@@ -288,12 +212,7 @@ --   stickers. Static sticker sets can have up to 120 stickers. --   Returns True on success. addStickerToSet :: AddStickerToSetRequest -> ClientM (Response Bool)-addStickerToSet r =-  case stickerFileSticker $ addStickerToSetSticker r of-    InputFile{} -> do-      boundary <- liftIO genBoundary-      client (Proxy @AddStickerToSetContent) (boundary, r)-    _ -> client (Proxy @AddStickerToSetLink) r+addStickerToSet = client (Proxy @AddStickerToSet)   -- ** 'getStickerSet'@@ -337,45 +256,45 @@   -> ClientM (Response Bool) deleteStickerFromSet = client (Proxy @DeleteStickerFromSet) --- ** 'setStickerSetThumb'+-- ** 'setStickerSetThumbnail' --- | Request parameters for 'setStickerSetThumb'.-data SetStickerSetThumbRequest = SetStickerSetThumbRequest-  { setStickerSetThumbName   :: T.Text -- ^ Sticker set name-  , setStickerSetThumbUserId :: UserId -- ^ User identifier of the sticker set owner-  , setStickerSetThumbThumb  :: InputFile -- ^ A PNG image with the thumbnail, must be up to 128 kilobytes in size and have width and height exactly 100px, or a TGS animation with the thumbnail up to 32 kilobytes in size; see <https:\/\/core.telegram.org\/animated_stickers#technical-requirements> for animated sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. Animated sticker set thumbnail can't be uploaded via HTTP URL.+-- | Request parameters for 'setStickerSetThumbnail'.+data SetStickerSetThumbnailRequest = SetStickerSetThumbnailRequest+  { setStickerSetThumbnailName   :: T.Text -- ^ Sticker set name+  , setStickerSetThumbnailUserId :: UserId -- ^ User identifier of the sticker set owner+  , setStickerSetThumbnailThumbnail  :: InputFile -- ^ A PNG image with the thumbnail, must be up to 128 kilobytes in size and have width and height exactly 100px, or a TGS animation with the thumbnail up to 32 kilobytes in size; see <https:\/\/core.telegram.org\/animated_stickers#technical-requirements> for animated sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. Animated sticker set thumbnail can't be uploaded via HTTP URL.   } deriving Generic -instance ToJSON SetStickerSetThumbRequest where toJSON = gtoJSON+instance ToJSON SetStickerSetThumbnailRequest where toJSON = gtoJSON -instance ToMultipart Tmp SetStickerSetThumbRequest where-  toMultipart SetStickerSetThumbRequest{..} =-    makeFile "png_sticker" setStickerSetThumbThumb (MultipartData fields []) where+instance ToMultipart Tmp SetStickerSetThumbnailRequest where+  toMultipart SetStickerSetThumbnailRequest{..} =+    makeFile "png_sticker" setStickerSetThumbnailThumbnail (MultipartData fields []) where     fields =-      [ Input "user_id" $ T.pack . show $ setStickerSetThumbUserId-      , Input "name" setStickerSetThumbName+      [ Input "user_id" $ T.pack . show $ setStickerSetThumbnailUserId+      , Input "name" setStickerSetThumbnailName       ] -type SetStickerSetThumbContent-  = "setStickerSetThumb"-  :> MultipartForm Tmp SetStickerSetThumbRequest+type SetStickerSetThumbnailContent+  = "setStickerSetThumbnail"+  :> MultipartForm Tmp SetStickerSetThumbnailRequest   :> Post '[JSON] (Response Bool) -type SetStickerSetThumbLink-  = "setStickerSetThumb"-  :> ReqBody '[JSON] SetStickerSetThumbRequest+type SetStickerSetThumbnailLink+  = "setStickerSetThumbnail"+  :> ReqBody '[JSON] SetStickerSetThumbnailRequest   :> Post '[JSON] (Response Bool)  -- | Use this method to set the thumbnail of a sticker set. --   Animated thumbnails can be set for animated sticker sets only. --   Returns True on success.-setStickerSetThumb :: SetStickerSetThumbRequest -> ClientM (Response Bool)-setStickerSetThumb r =-  case setStickerSetThumbThumb r of+setStickerSetThumbnail :: SetStickerSetThumbnailRequest -> ClientM (Response Bool)+setStickerSetThumbnail r =+  case setStickerSetThumbnailThumbnail r of     InputFile{} -> do       boundary <- liftIO genBoundary-      client (Proxy @SetStickerSetThumbContent) (boundary, r)-    _ -> client (Proxy @SetStickerSetThumbLink) r+      client (Proxy @SetStickerSetThumbnailContent) (boundary, r)+    _ -> client (Proxy @SetStickerSetThumbnailLink) r  foldMap makeDefault   [ ''SendStickerRequest@@ -383,5 +302,5 @@   , ''UploadStickerFileRequest   , ''CreateNewStickerSetRequest   , ''AddStickerToSetRequest-  , ''SetStickerSetThumbRequest+  , ''SetStickerSetThumbnailRequest   ]
src/Telegram/Bot/API/Types.hs view
@@ -18,6 +18,7 @@   , module Telegram.Bot.API.Types.BotCommand   , module Telegram.Bot.API.Types.BotCommandScope   , module Telegram.Bot.API.Types.BotDescription+  , module Telegram.Bot.API.Types.BotName   , module Telegram.Bot.API.Types.BotShortDescription   , module Telegram.Bot.API.Types.CallbackGame   , module Telegram.Bot.API.Types.CallbackQuery@@ -105,6 +106,7 @@ import Telegram.Bot.API.Types.BotCommand import Telegram.Bot.API.Types.BotCommandScope import Telegram.Bot.API.Types.BotDescription+import Telegram.Bot.API.Types.BotName import Telegram.Bot.API.Types.BotShortDescription import Telegram.Bot.API.Types.CallbackGame import Telegram.Bot.API.Types.CallbackQuery
src/Telegram/Bot/API/Types/Animation.hs view
@@ -18,7 +18,7 @@   , animationWidth        :: Int           -- ^ Video width as defined by sender.   , animationHeight       :: Int           -- ^ Video height as defined by sender.   , animationDuration     :: Seconds         -- ^ Duration of the video in seconds as defined by sender.-  , animationThumb        :: Maybe PhotoSize -- ^ Animation thumbnail as defined by sender.+  , animationThumbnail    :: Maybe PhotoSize -- ^ Animation thumbnail as defined by sender.   , animationFileName     :: Maybe Text      -- ^ Original animation filename as defined by sender.   , animationMimeType     :: Maybe Text      -- ^ MIME type of the file as defined by sender.   , animationFileSize     :: Maybe Integer   -- ^ File size in bytes.
src/Telegram/Bot/API/Types/Audio.hs view
@@ -21,7 +21,7 @@   , audioFileName  :: Maybe Text -- ^ Original filename as defined by sender.   , audioMimeType  :: Maybe Text -- ^ MIME type of the file as defined by sender.   , audioFileSize  :: Maybe Integer -- ^ File size in bytes.-  , audioThumb     :: Maybe PhotoSize -- ^ Thumbnail of the album cover to which the music file belongs.+  , audioThumbnail :: Maybe PhotoSize -- ^ Thumbnail of the album cover to which the music file belongs.   }   deriving (Generic, Show) 
src/Telegram/Bot/API/Types/BotDescription.hs view
@@ -9,7 +9,7 @@ -- ** 'BotDescription'  -- | This object represents the bot's description.-data BotDescription = BotDescription+newtype BotDescription = BotDescription   { botDescriptionDescription :: Text -- ^ The bot's description.   }   deriving (Generic, Show)
+ src/Telegram/Bot/API/Types/BotName.hs view
@@ -0,0 +1,18 @@+{-# LANGUAGE DeriveGeneric #-}+module Telegram.Bot.API.Types.BotName where++import Data.Aeson (FromJSON (..), ToJSON (..))+import Data.Text (Text)+import GHC.Generics (Generic)+import Telegram.Bot.API.Internal.Utils++-- ** 'BotName'++-- | This object represents the bot's name.+newtype BotName = BotName+  { botNameName :: Text -- ^ The bot's name.+  }+  deriving (Generic, Show)++instance ToJSON   BotName where toJSON = gtoJSON+instance FromJSON BotName where parseJSON = gparseJSON
src/Telegram/Bot/API/Types/ChatMemberUpdated.hs view
@@ -21,6 +21,7 @@   , chatMemberUpdatedOldChatMember :: ChatMember           -- ^ Previous information about the chat member.   , chatMemberUpdatedNewChatMember :: ChatMember           -- ^ New information about the chat member.   , chatMemberUpdatedInviteLink    :: Maybe ChatInviteLink -- ^ Chat invite link, which was used by the user to join the chat; for joining by invite link events only.+  , chatMemberUpdatedViaChatFolderInviteLink :: Maybe Bool -- ^ 'True', if the user joined the chat via a chat folder invite link.   }   deriving (Generic, Show) 
src/Telegram/Bot/API/Types/Document.hs view
@@ -15,7 +15,7 @@ data Document = Document   { documentFileId   :: FileId -- ^ Unique file identifier.   , documentFileUniqueId :: FileId -- ^ Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.-  , documentThumb    :: Maybe PhotoSize -- ^ Document thumbnail as defined by sender.+  , documentThumbnail    :: Maybe PhotoSize -- ^ Document thumbnail as defined by sender.   , documentFileName :: Maybe Text -- ^ Original filename as defined by sender.   , documentMimeType :: Maybe Text -- ^ MIME type of the file as defined by sender.   , documentFileSize :: Maybe Integer -- ^ File size in bytes. 
src/Telegram/Bot/API/Types/InlineKeyboardButton.hs view
@@ -7,6 +7,7 @@  import Telegram.Bot.API.Types.CallbackGame import Telegram.Bot.API.Types.Common+import Telegram.Bot.API.Types.SwitchInlineQueryChosenChat import Telegram.Bot.API.Internal.Utils  -- ** 'InlineKeyboardButton'@@ -19,6 +20,7 @@   , inlineKeyboardButtonWebApp            :: Maybe WebAppInfo -- ^ Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method @answerWebAppQuery@. Available only in private chats between a user and the bot.   , inlineKeyboardButtonSwitchInlineQuery :: Maybe Text -- ^ If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot‘s username and the specified inline query in the input field. Can be empty, in which case just the bot’s username will be inserted.   , inlineKeyboardButtonSwitchInlineQueryCurrentChat :: Maybe Text -- ^ If set, pressing the button will insert the bot‘s username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot’s username will be inserted.+  , inlineKeyboardButtonSwitchInlineQueryChosenChat :: Maybe SwitchInlineQueryChosenChat -- ^ If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field.    , inlineKeyboardButtonCallbackGame      :: Maybe CallbackGame -- ^ Description of the game that will be launched when the user presses the button.   , inlineKeyboardButtonPay               :: Maybe Bool -- ^ Specify True, to send a Pay button.@@ -26,7 +28,7 @@   deriving (Generic, Show)  labeledInlineKeyboardButton :: Text -> InlineKeyboardButton-labeledInlineKeyboardButton label = InlineKeyboardButton label Nothing Nothing Nothing Nothing Nothing Nothing Nothing+labeledInlineKeyboardButton label = InlineKeyboardButton label Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing  instance ToJSON   InlineKeyboardButton where toJSON = gtoJSON instance FromJSON InlineKeyboardButton where parseJSON = gparseJSON
src/Telegram/Bot/API/Types/InputMedia.hs view
@@ -28,7 +28,7 @@   { inputMediaGenericMedia :: InputFile -- ^ File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name.   , inputMediaGenericCaption :: Maybe Text -- ^ Caption of the photo to be sent, 0-1024 characters after entities parsing.   , inputMediaGenericParseMode :: Maybe Text -- ^ Mode for parsing entities in the photo caption. See formatting options <https:\/\/core.telegram.org\/bots\/api#formatting-options> for more details.-  , inputMediaGenericCaptionEntities :: Maybe [MessageEntity] -- ^ List of special entities that appear in the caption, which can be specified instead of parse_mode.+  , inputMediaGenericCaptionEntities :: Maybe [MessageEntity] -- ^ List of special entities that appear in the caption, which can be specified instead of @parse_mode@.   }   deriving Generic @@ -45,20 +45,21 @@         \t -> Input "caption_entities" (TL.toStrict $ encodeToLazyText t)       ] -data InputMediaGenericThumb = InputMediaGenericThumb+data InputMediaGenericThumbnail = InputMediaGenericThumbnail   { inputMediaGenericGeneric :: InputMediaGeneric-  , inputMediaGenericThumb :: Maybe InputFile -- ^ Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. +  , inputMediaGenericThumbnail :: Maybe InputFile -- ^ Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.    } -instance ToJSON InputMediaGenericThumb where-  toJSON InputMediaGenericThumb{..}+instance ToJSON InputMediaGenericThumbnail where+  toJSON InputMediaGenericThumbnail{..}     = addJsonFields (toJSON inputMediaGenericGeneric)-      ["thumb" .= inputMediaGenericThumb]+      ["thumbnail" .= inputMediaGenericThumbnail] -instance ToMultipart Tmp InputMediaGenericThumb where+instance ToMultipart Tmp InputMediaGenericThumbnail where   toMultipart = \case-    InputMediaGenericThumb generic Nothing -> toMultipart generic-    InputMediaGenericThumb generic (Just thumb) -> makeFile "thumb" thumb (toMultipart generic)+    InputMediaGenericThumbnail generic Nothing -> toMultipart generic+    InputMediaGenericThumbnail generic (Just thumbnail) ->+      makeFile "thumbnail" thumbnail (toMultipart generic)   data InputMedia@@ -67,7 +68,7 @@     , inputMediaPhotoHasSpoiler :: Maybe Bool -- ^ Pass 'True' if the video needs to be covered with a spoiler animation.     }   | InputMediaVideo -- ^ Represents a video to be sent.-    { inputMediaVideoGeneric :: InputMediaGenericThumb+    { inputMediaVideoGeneric :: InputMediaGenericThumbnail     , inputMediaVideoWidth :: Maybe Integer -- ^ Video width     , inputMediaVideoHeight :: Maybe Integer -- ^ Video height     , inputMediaVideoDuration :: Maybe Integer -- ^ Video duration in seconds@@ -75,20 +76,20 @@     , inputMediaVideoHasSpoiler :: Maybe Bool -- ^ Pass 'True' if the video needs to be covered with a spoiler animation.     }   | InputMediaAnimation -- ^ Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent.-    { inputMediaAnimationGeneric :: InputMediaGenericThumb+    { inputMediaAnimationGeneric :: InputMediaGenericThumbnail     , inputMediaAnimationWidth :: Maybe Integer -- ^ Animation width     , inputMediaAnimationHeight :: Maybe Integer -- ^ Animation height     , inputMediaAnimationDuration :: Maybe Integer -- ^ Animation duration in seconds     , inputMediaAnimationHasSpoiler :: Maybe Bool -- ^ Pass 'True' if the video needs to be covered with a spoiler animation.     }   | InputMediaAudio -- ^ Represents an audio file to be treated as music to be sent.-    { inputMediaAudioGeneric :: InputMediaGenericThumb+    { inputMediaAudioGeneric :: InputMediaGenericThumbnail     , inputMediaAudioDuration :: Maybe Integer -- ^ Duration of the audio in seconds     , inputMediaAudioPerformer :: Maybe Text -- ^ Performer of the audio     , inputMediaAudioTitle :: Maybe Text -- ^ Title of the audio     }   | InputMediaDocument -- ^ Represents a general file to be sent.-    { inputMediaDocumentGeneric :: InputMediaGenericThumb+    { inputMediaDocumentGeneric :: InputMediaGenericThumbnail     , inputMediaDocumentDisableContentTypeDetection :: Maybe Bool -- ^ Disables automatic server-side content type detection for files uploaded using multipart/form-data. Always True, if the document is sent as part of an album.     } @@ -189,6 +190,7 @@   = InputFileId FileId   | FileUrl Text   | InputFile FilePath ContentType+  deriving (Generic, Show)  instance ToJSON InputFile where   toJSON (InputFileId i) = toJSON i
src/Telegram/Bot/API/Types/Sticker.hs view
@@ -8,10 +8,23 @@  import Telegram.Bot.API.Types.Common  import Telegram.Bot.API.Types.File+import Telegram.Bot.API.Types.InputMedia import Telegram.Bot.API.Types.MaskPosition import Telegram.Bot.API.Types.PhotoSize import Telegram.Bot.API.Internal.Utils +-- ** 'InputSticker'++data InputSticker = InputSticker+  { inputStickerSticker :: InputFile -- ^ The added sticker. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, upload a new one using @multipart/form-data@, or pass @attach://<file_attach_name>@ to upload a new one using @multipart/form-data@ under @<file_attach_name>@ name. Animated and video stickers can't be uploaded via HTTP URL.+  , inputStickerEmojiList :: [Text] -- ^ List of 1-20 emoji associated with the sticker.+  , inputStickerMaskPosition :: Maybe MaskPosition -- ^ Position where the mask should be placed on faces. For “mask” stickers only.+  , inputStickerKeywords :: Maybe [Text] -- ^ List of 0-20 search keywords for the sticker with total length of up to 64 characters. For “regular” and “custom_emoji” stickers only.+  }+  deriving (Generic, Show)++instance ToJSON   InputSticker where toJSON = gtoJSON+ -- ** 'Sticker'  -- | This object represents a sticker.@@ -22,13 +35,14 @@   , stickerHeight       :: Int              -- ^ Sticker height.   , stickerIsAnimated   :: Bool               -- ^ 'True', if the sticker is animated.   , stickerIsVideo      :: Bool               -- ^ 'True', if the sticker is a video sticker.-  , stickerThumb        :: Maybe PhotoSize    -- ^ Sticker thumbnail in the .WEBP or .JPG format.+  , stickerThumbnail    :: Maybe PhotoSize    -- ^ Sticker thumbnail in the .WEBP or .JPG format.   , stickerEmoji        :: Maybe Text         -- ^ Emoji associated with the sticker.   , stickerSetName      :: Maybe Text         -- ^ Name of the sticker set to which the sticker belongs.   , stickerPremiumAnimation :: Maybe File    -- ^ For premium regular stickers, premium animation for the sticker.   , stickerMaskPosition :: Maybe MaskPosition -- ^ For mask stickers, the position where the mask should be placed.   , stickerCustomEmojiId :: Maybe Text        -- ^ For custom emoji stickers, unique identifier of the custom emoji.   , stickerFileSize     :: Maybe Integer      -- ^ File size in bytes.+  , stickerNeedsRepainting  :: Maybe Bool      -- ^ Pass `True` if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only.   }   deriving (Generic, Show) @@ -46,7 +60,7 @@   , stickerSetIsVideo       :: Bool            -- ^ 'True', if the sticker is a video sticker.   , stickerSetContainsMasks :: Maybe Bool      -- ^ True, if the sticker set contains masks.   , stickerSetStickers      :: [Sticker]       -- ^ List of all set stickers.-  , stickerSetThumb         :: Maybe PhotoSize -- ^ Sticker set thumbnail in the .WEBP or .TGS format.+  , stickerSetThumbnail     :: Maybe PhotoSize -- ^ Sticker set thumbnail in the .WEBP or .TGS format.   }   deriving (Generic, Show) 
+ src/Telegram/Bot/API/Types/SwitchInlineQueryChosenChat.hs view
@@ -0,0 +1,23 @@+{-# LANGUAGE DeriveGeneric #-}+module Telegram.Bot.API.Types.SwitchInlineQueryChosenChat where++import Data.Aeson (FromJSON (..), ToJSON (..))+import Data.Text+import GHC.Generics (Generic)++import Telegram.Bot.API.Internal.Utils++-- ** 'SwitchInlineQueryChosenChat'++-- | This object represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query.+data SwitchInlineQueryChosenChat = SwitchInlineQueryChosenChat+  { switchInlineQueryChosenChatQuery :: Maybe Text -- ^ The default inline query to be inserted in the input field. If left empty, only the bot's username will be inserted.+  , switchInlineQueryChosenChatAllowUserChats :: Maybe Bool -- ^ 'True', if private chats with users can be chosen.+  , switchInlineQueryChosenChatAllowBotChats :: Maybe Bool -- ^ 'True', if private chats with bots can be chosen.+  , switchInlineQueryChosenChatAllowGroupChats :: Maybe Bool -- ^ 'True', if group and supergroup chats can be chosen.+  , switchInlineQueryChosenChatAllowChannelChats :: Maybe Bool -- ^ 'True', if channel chats can be chosen.+  }+  deriving (Show, Generic)++instance ToJSON   SwitchInlineQueryChosenChat where toJSON = gtoJSON+instance FromJSON SwitchInlineQueryChosenChat where parseJSON = gparseJSON
src/Telegram/Bot/API/Types/Video.hs view
@@ -18,7 +18,7 @@   , videoWidth        :: Int -- ^ Video width as defined by sender.   , videoHeight       :: Int -- ^ Video height as defined by sender.   , videoDuration     :: Seconds -- ^ Duration of the video in seconds as defined by sender.-  , videoThumb        :: Maybe PhotoSize -- ^ Video thumbnail.+  , videoThumbnail    :: Maybe PhotoSize -- ^ Video thumbnail.   , videoFileName     :: Maybe Text -- ^ Original filename as defined by sender.   , videoMimeType     :: Maybe Text -- ^ Mime type of a file as defined by sender.   , videoFileSize     :: Maybe Integer -- ^ File size in bytes.
src/Telegram/Bot/API/Types/VideoNote.hs view
@@ -16,7 +16,7 @@   , videoNoteFileUniqueId :: FileId -- ^ Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.   , videoNoteLength   :: Int -- ^ Video width and height as defined by sender.   , videoNoteDuration :: Seconds -- ^ Duration of the video in seconds as defined by sender.-  , videoNoteThumb    :: Maybe PhotoSize -- ^ Video thumbnail.+  , videoNoteThumbnail    :: Maybe PhotoSize -- ^ Video thumbnail.   , videoNoteFileSize :: Maybe Integer -- ^ File size in bytes.   }   deriving (Generic, Show)
src/Telegram/Bot/API/Types/WriteAccessAllowed.hs view
@@ -1,7 +1,8 @@ {-# LANGUAGE DeriveGeneric #-} module Telegram.Bot.API.Types.WriteAccessAllowed where -import Data.Aeson (FromJSON (..), ToJSON (..), Object)+import Data.Aeson (FromJSON (..), ToJSON (..))+import Data.Text import GHC.Generics (Generic)  import Telegram.Bot.API.Internal.Utils@@ -9,7 +10,9 @@ -- ** 'WriteAccessAllowed'  -- | This object represents a service message about a user allowing a bot added to the attachment menu to write messages. Currently holds no information.-newtype WriteAccessAllowed = WriteAccessAllowed Object+newtype WriteAccessAllowed = WriteAccessAllowed+  { writeAccessAllowedWebAppName :: Maybe Text -- ^ Name of the Web App which was launched from a link.+  }   deriving (Generic, Show)  instance ToJSON   WriteAccessAllowed where toJSON = gtoJSON
telegram-bot-api.cabal view
@@ -1,7 +1,7 @@ cabal-version: 1.12  name:           telegram-bot-api-version:        6.5.1+version:        6.7 synopsis:       Easy to use library for building Telegram bots. Exports Telegram Bot API. description:    Please see the README on Github at <https://github.com/fizruk/telegram-bot-simple#readme>                 .@@ -49,6 +49,7 @@       Telegram.Bot.API.Methods.DeleteChatStickerSet       Telegram.Bot.API.Methods.DeleteMessage       Telegram.Bot.API.Methods.DeleteMyCommands+      Telegram.Bot.API.Methods.DeleteStickerSet       Telegram.Bot.API.Methods.EditChatInviteLink       Telegram.Bot.API.Methods.EditMessageLiveLocation       Telegram.Bot.API.Methods.ExportChatInviteLink@@ -63,6 +64,7 @@       Telegram.Bot.API.Methods.GetMyCommands       Telegram.Bot.API.Methods.GetMyDefaultAdministratorRights       Telegram.Bot.API.Methods.GetMyDescription+      Telegram.Bot.API.Methods.GetMyName       Telegram.Bot.API.Methods.GetMyShortDescription       Telegram.Bot.API.Methods.GetUserProfilePhotos       Telegram.Bot.API.Methods.LeaveChat@@ -93,9 +95,15 @@       Telegram.Bot.API.Methods.SetChatStickerSet       Telegram.Bot.API.Methods.SetChatTitle       Telegram.Bot.API.Methods.SetMyCommands+      Telegram.Bot.API.Methods.SetCustomEmojiStickerSetThumbnail       Telegram.Bot.API.Methods.SetMyDefaultAdministratorRights       Telegram.Bot.API.Methods.SetMyDescription+      Telegram.Bot.API.Methods.SetMyName       Telegram.Bot.API.Methods.SetMyShortDescription+      Telegram.Bot.API.Methods.SetStickerEmojiList+      Telegram.Bot.API.Methods.SetStickerKeywords+      Telegram.Bot.API.Methods.SetStickerMaskPosition+      Telegram.Bot.API.Methods.SetStickerSetTitle       Telegram.Bot.API.Methods.StopMessageLiveLocation       Telegram.Bot.API.Methods.UnbanChatMember       Telegram.Bot.API.Methods.UnbanChatSenderChat@@ -112,6 +120,7 @@       Telegram.Bot.API.Types.BotCommand       Telegram.Bot.API.Types.BotCommandScope       Telegram.Bot.API.Types.BotDescription+      Telegram.Bot.API.Types.BotName       Telegram.Bot.API.Types.BotShortDescription       Telegram.Bot.API.Types.CallbackGame       Telegram.Bot.API.Types.CallbackQuery@@ -179,6 +188,7 @@       Telegram.Bot.API.Types.SomeReplyMarkup       Telegram.Bot.API.Types.Sticker       Telegram.Bot.API.Types.SuccessfulPayment+      Telegram.Bot.API.Types.SwitchInlineQueryChosenChat       Telegram.Bot.API.Types.User       Telegram.Bot.API.Types.UserProfilePhotos       Telegram.Bot.API.Types.UserShared