twilio-0.1.3.1: Twilio REST API library for Haskell

Safe HaskellNone
LanguageHaskell98

Control.Monad.Twilio

Contents

Synopsis

The Twilio monad

type Twilio = TwilioT IO Source #

This monad allows you to make authenticated REST API requests to Twilio using your AccountSID and AuthToken.

runTwilio :: Credentials -> Twilio a -> IO a Source #

Run zero or more REST API requests to Twilio.

runTwilio' Source #

Arguments

:: IO String

Account SID

-> IO String

Authentication Token

-> Twilio a 
-> IO a 

Parse an AccountSID and AuthToken before running zero or more REST API requests to Twilio.

For example, you can fetch the Calls resource in the IO monad as follows:

module Main where

import Control.Monad.IO.Class (liftIO)
import System.Environment (getEnv)
import Twilio.Calls as Calls
import Twilio.Types

-- | Print calls.
main :: IO ()
main = runTwilio' (getEnv "ACCOUNT_SID")
                  (getEnv "AUTH_TOKEN")
     $ Calls.get >>= liftIO . print

The Twilio monad transformer

newtype TwilioT m a Source #

This monad transformer allows you to make authenticated REST API requests to Twilio using your AccountSID and AuthToken.

Constructors

TwilioT (Monad m => (Credentials, AccountSID) -> RequestT m a) 

Instances

MonadTrans TwilioT Source # 

Methods

lift :: Monad m => m a -> TwilioT m a #

Monad m => Monad (TwilioT m) Source # 

Methods

(>>=) :: TwilioT m a -> (a -> TwilioT m b) -> TwilioT m b #

(>>) :: TwilioT m a -> TwilioT m b -> TwilioT m b #

return :: a -> TwilioT m a #

fail :: String -> TwilioT m a #

Functor (TwilioT m) Source # 

Methods

fmap :: (a -> b) -> TwilioT m a -> TwilioT m b #

(<$) :: a -> TwilioT m b -> TwilioT m a #

Applicative m => Applicative (TwilioT m) Source # 

Methods

pure :: a -> TwilioT m a #

(<*>) :: TwilioT m (a -> b) -> TwilioT m a -> TwilioT m b #

(*>) :: TwilioT m a -> TwilioT m b -> TwilioT m b #

(<*) :: TwilioT m a -> TwilioT m b -> TwilioT m a #

MonadIO m => MonadIO (TwilioT m) Source # 

Methods

liftIO :: IO a -> TwilioT m a #

MonadThrow m => MonadThrow (TwilioT m) Source # 

Methods

throwM :: Exception e => e -> TwilioT m a #

Monad m => MonadRequest (TwilioT m) Source # 

Methods

request :: (Response ByteString -> TwilioT m a) -> Request -> TwilioT m a Source #

(MonadThrow m, Delete1 a) => Delete (a -> TwilioT m ()) Source #

Instances of Delete1 are instances of Delete.

Methods

delete :: a -> TwilioT m () Source #

(MonadThrow m, Post3 a b c r) => Post (a -> b -> c -> TwilioT m r) Source # 

Methods

post :: a -> b -> c -> TwilioT m r Source #

(MonadThrow m, Post2 a b r) => Post (a -> b -> TwilioT m r) Source # 

Methods

post :: a -> b -> TwilioT m r Source #

(MonadThrow m, Post1 a r) => Post (a -> TwilioT m r) Source #

Instances of Post1 are instances of Post.

Methods

post :: a -> TwilioT m r Source #

(MonadThrow m, Post0 r) => Post (TwilioT m r) Source #

Instances of Post0 are instances of Post.

Methods

post :: TwilioT m r Source #

(MonadThrow m, Get2 a b r) => Get (a -> b -> TwilioT m r) Source #

Instances of Get2 are instances of Get.

Methods

get :: a -> b -> TwilioT m r Source #

(MonadThrow m, Get1 a r) => Get (a -> TwilioT m r) Source #

Instances of Get1 are instances of Get.

Methods

get :: a -> TwilioT m r Source #

(MonadThrow m, Get0 r) => Get (TwilioT m r) Source #

Instances of Get0 are instances of Get.

Methods

get :: TwilioT m r Source #

Monad m => MonadReader (Credentials, AccountSID) (TwilioT m) Source # 

runTwilioT :: MonadIO m => Credentials -> TwilioT m a -> m a Source #

Run zero or more REST API requests to Twilio, unwrapping the inner monad m.

runTwilioT' Source #

Arguments

:: (Functor m, MonadThrow m, MonadIO m) 
=> m String

Account SID

-> m String

Authentication Token

-> TwilioT m a 
-> m a 

Parse an AccountSID and AuthToken before running zero or more REST API requests to Twilio, unwrapping the inner monad m.

Types

type Credentials = (AccountSID, AuthToken) Source #

Your AccountSID and AuthToken are used to make authenticated REST API requests to Twilio.