Skip to content

Commit

Permalink
Merge branch 'cblp-getUpdatesM'
Browse files Browse the repository at this point in the history
  • Loading branch information
klappvisor committed Mar 6, 2017
2 parents 563ad50 + 367c06b commit fe09a8a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
19 changes: 10 additions & 9 deletions src/Web/Telegram/API/Bot/API/Updates.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module Web.Telegram.API.Bot.API.Updates
( -- * Functions
getUpdates
, getUpdatesM
, getUpdatesM'
, setWebhook
, setWebhookM
, setWebhookWithCertificate
Expand All @@ -19,8 +20,8 @@ module Web.Telegram.API.Bot.API.Updates
, updatesApi
) where

import Data.Proxy
import Data.Maybe
import Data.Proxy
import Data.Text (Text, empty)
import Network.HTTP.Client (Manager)
import Servant.API
Expand Down Expand Up @@ -61,24 +62,24 @@ getUpdates_
:<|> deleteWebhook_
:<|> getWebhookInfo_ = client updatesApi

-- | Use this method to receive incoming updates using long polling. An Array of 'Update' objects is returned. Use `getUpdateM` for more features
-- | Use this method to receive incoming updates using long polling. A list of 'Update' objects is returned. Use `getUpdatesM` for more features
getUpdates
:: Token
-> Maybe Int -- ^ offset
-> Maybe Int -- ^ limit
-> Maybe Int -- ^ timeout
-> Manager
-> IO (Either ServantError UpdatesResponse)
getUpdates token offset limit timeout = runClient (getUpdatesM' request) token
getUpdates token offset limit timeout = runClient (getUpdatesM request) token
where request = GetUpdatesRequest offset limit timeout Nothing

-- | Get update with default parameters See 'getUpdate' for details.
getUpdatesM :: TelegramClient UpdatesResponse
getUpdatesM = getUpdatesM' getUpdatesRequest
-- | Get update with default parameters See 'getUpdates' for details.
getUpdatesM' :: TelegramClient UpdatesResponse
getUpdatesM' = getUpdatesM getUpdatesRequest

-- | See 'getUpdates'
getUpdatesM' :: GetUpdatesRequest -> TelegramClient UpdatesResponse
getUpdatesM' = run_ getUpdates_
getUpdatesM :: GetUpdatesRequest -> TelegramClient UpdatesResponse
getUpdatesM = run_ getUpdates_

-- | Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized 'Update'. In case of an unsuccessful request, we will give up after a reasonable amount of attempts.
--
Expand All @@ -104,7 +105,7 @@ setWebhookWithCertificate = runM setWebhookWithCertificateM
setWebhookWithCertificateM :: SetWebhookRequest -> TelegramClient SetWebhookResponse
setWebhookWithCertificateM = run_ setWebhookWithCert_

-- | Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success.
-- | Use this method to remove webhook integration if you decide to switch back to 'getUpdates'. Returns True on success.
deleteWebhook :: Token -> Manager -> IO (Either ServantError (Response Bool))
deleteWebhook = runClient deleteWebhookM

Expand Down
2 changes: 1 addition & 1 deletion telegram-api.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: telegram-api
version: 0.6.0.2
version: 0.6.1.0
synopsis: Telegram Bot API bindings
description: High-level bindings to the Telegram Bot API
homepage: http://github.com/klappvisor/haskell-telegram-api#readme
Expand Down

0 comments on commit fe09a8a

Please sign in to comment.