leanpub-wreq-1.1.0.4: Use the Leanpub API via Wreq
Safe HaskellNone
LanguageHaskell2010

Leanpub.Wreq

Synopsis

The Leanpub monad

newtype Leanpub a Source #

There are two ways to run a Leanpub action:

  1. Create a Context and then apply the newtyped Context -> IO a function directly.
  2. Create a Config and then apply the runLeanpub function. This approach is likely more convenient, because it can do some things automatically like creating the Session and reading your API key from a file.

Constructors

Leanpub (Context -> IO a) 

Instances

Instances details
Monad Leanpub Source # 
Instance details

Defined in Leanpub.Wreq

Methods

(>>=) :: Leanpub a -> (a -> Leanpub b) -> Leanpub b #

(>>) :: Leanpub a -> Leanpub b -> Leanpub b #

return :: a -> Leanpub a #

Functor Leanpub Source # 
Instance details

Defined in Leanpub.Wreq

Methods

fmap :: (a -> b) -> Leanpub a -> Leanpub b #

(<$) :: a -> Leanpub b -> Leanpub a #

MonadFail Leanpub Source # 
Instance details

Defined in Leanpub.Wreq

Methods

fail :: String -> Leanpub a #

Applicative Leanpub Source # 
Instance details

Defined in Leanpub.Wreq

Methods

pure :: a -> Leanpub a #

(<*>) :: Leanpub (a -> b) -> Leanpub a -> Leanpub b #

liftA2 :: (a -> b -> c) -> Leanpub a -> Leanpub b -> Leanpub c #

(*>) :: Leanpub a -> Leanpub b -> Leanpub b #

(<*) :: Leanpub a -> Leanpub b -> Leanpub a #

MonadIO Leanpub Source # 
Instance details

Defined in Leanpub.Wreq

Methods

liftIO :: IO a -> Leanpub a #

Configuration

data Config Source #

Construct a Config by using <> to combine any of the following:

Then use the config as the first argument to the runLeanpub function.

Instances

Instances details
Semigroup Config Source # 
Instance details

Defined in Leanpub.Wreq

Monoid Config Source # 
Instance details

Defined in Leanpub.Wreq

Leanpub actions

createFreeBookCoupon Source #

Arguments

:: BookSlug

What book does the coupon give away?

-> CouponCode

The secret that the user needs to have to redeem the coupon

-> CouponMaxUses

How many times can each coupon be used?

-> Maybe CouponNote

An optional note to remind you what the coupon is for, why it was issued, etc.

-> Leanpub Value 

createManyFreeBookCoupons Source #

Arguments

:: (CouponCode -> IO ())

Action to perform after creating each coupon, e.g. perhaps print for use in a REPL.

-> Natural

How many coupons?

-> BookSlug

What book does the coupon give away?

-> CouponMaxUses

How many times can each coupon be used?

-> Maybe CouponNote

An optional note to remind you what the coupon is for, why it was issued, etc.

-> Leanpub () 

Wreq

type Path = [Text] Source #

data FormParam where #

A key/value pair for an application/x-www-form-urlencoded POST request body.

Constructors

(:=) :: forall v. FormValue v => ByteString -> v -> FormParam infixr 3 

Instances

Instances details
Show FormParam 
Instance details

Defined in Network.Wreq.Internal.Types

data Session #

A session that spans multiple requests. This is responsible for cookie management and TCP connection reuse.

Instances

Instances details
Show Session 
Instance details

Defined in Network.Wreq.Internal.Types

newAPISession :: IO Session #

Create a session.

This uses the default session manager settings, but does not manage cookies. It is intended for use with REST-like HTTP-based APIs, which typically do not use cookies.

Since: wreq-0.5.2.0