Copyright | (c) David Johnson 2014 |
---|---|
Maintainer | djohnson.m@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- stripe :: FromJSON (StripeReturn a) => StripeConfig -> StripeRequest a -> IO (Either StripeError (StripeReturn a))
- stripeConn :: FromJSON (StripeReturn a) => Connection -> StripeConfig -> StripeRequest a -> IO (Either StripeError (StripeReturn a))
- withConnection :: (Connection -> IO (Either StripeError a)) -> IO (Either StripeError a)
- data StripeRequest a = StripeRequest {}
- data StripeError = StripeError {}
- data StripeConfig = StripeConfig {}
- callAPI :: Connection -> (Value -> Result b) -> StripeConfig -> StripeRequest a -> IO (Either StripeError b)
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.
data StripeError #
Stripe Error
Instances
Show StripeError | |
Defined in Web.Stripe.Error showsPrec :: Int -> StripeError -> ShowS # show :: StripeError -> String # showList :: [StripeError] -> ShowS # | |
FromJSON StripeError | |
Defined in Web.Stripe.Error parseJSON :: Value -> Parser StripeError # parseJSONList :: Value -> Parser [StripeError] # | |
Exception StripeError | |
Defined in Web.Stripe.Error |
data StripeConfig #
Stripe config
Instances
low-level
:: Connection | an open connection to the server ( |
-> (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.