stripe-http-streams-2.0.0

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

method :: Method

Method of StripeRequest (i.e. GET, PUT, POST, PUT)

endpoint :: Text

Endpoint of StripeRequest

queryParams :: Params

Query Parameters of StripeRequest

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.