stripe-http-streams-2.1.0: Stripe API for Haskell - http-streams backend

Copyright(c) David Johnson, 2014
Maintainerdjohnson.m@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Web.Stripe.Client.HttpStreams

Contents

Description

 

Synopsis

Documentation

stripe :: FromJSON (StripeReturn a) => StripeConfig -> StripeRequest a -> IO (Either StripeError (StripeReturn a)) Source #

Create a request to Stripe's API

stripeConn :: FromJSON (StripeReturn a) => Connection -> StripeConfig -> StripeRequest a -> IO (Either StripeError (StripeReturn a)) Source #

Create a request to Stripe's API using a connection opened with withConnection

withConnection :: (Connection -> IO (Either StripeError a)) -> IO (Either StripeError a) Source #

Open a connection to the stripe API server

data StripeRequest a :: * -> * #

Stripe Request holding Method, URL and Params for a Request. Also includes the function needed to decode the response.

Constructors

StripeRequest 

Fields

data StripeConfig :: * #

Stripe config

Constructors

StripeConfig 

Fields

Instances

Eq StripeConfig 
Data StripeConfig 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> StripeConfig -> c StripeConfig #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c StripeConfig #

toConstr :: StripeConfig -> Constr #

dataTypeOf :: StripeConfig -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c StripeConfig) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c StripeConfig) #

gmapT :: (forall b. Data b => b -> b) -> StripeConfig -> StripeConfig #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> StripeConfig -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> StripeConfig -> r #

gmapQ :: (forall d. Data d => d -> u) -> StripeConfig -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> StripeConfig -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> StripeConfig -> m StripeConfig #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> StripeConfig -> m StripeConfig #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> StripeConfig -> m StripeConfig #

Ord StripeConfig 
Read StripeConfig 
Show StripeConfig 

low-level

callAPI Source #

Arguments

:: Connection

an open connection to the server (withConnection)

-> (Value -> Result b)

function to convert JSON result to Haskell Value

-> StripeConfig

StripeConfig

-> StripeRequest a

StripeRequest

-> IO (Either StripeError b) 

Create a request to Stripe's API over an existing connection

see also: withConnection FIXME: all connection errors should be turned into a StripeError. But that is not yet implemented.

NOTES: this a pretty low-level function. You probably want stripe or stripeConn. If you call this function directly, you are responsible for ensuring the JSON conversion function supplied is correct for StripeRequest. In the rest of the library this property is enforced automatically by the type-system. But adding that constraint here made implementing the Stripe testing monad difficult.