| Copyright | (c) David Johnson 2014 |
|---|---|
| Maintainer | djohnson.m@gmail.com |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Web.Stripe.Client.HttpStreams
Contents
Description
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.
Constructors
| StripeRequest | |
data StripeError #
Stripe Error
Constructors
| StripeError | |
Fields | |
Instances
| Show StripeError | |
Defined in Web.Stripe.Error Methods showsPrec :: Int -> StripeError -> ShowS # show :: StripeError -> String # showList :: [StripeError] -> ShowS # | |
| FromJSON StripeError | |
Defined in Web.Stripe.Error | |
| Exception StripeError | |
Defined in Web.Stripe.Error Methods toException :: StripeError -> SomeException # fromException :: SomeException -> Maybe StripeError # displayException :: StripeError -> String # | |
data StripeConfig #
Stripe config
Constructors
| StripeConfig | |
Instances
low-level
Arguments
| :: 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.