-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Use the Leanpub API via Wreq
--
-- This package helps you make requests to the Leanpub API in
-- conjunction with the wreq package.
@package leanpub-wreq
@version 1.1
module Leanpub.Wreq
-- | There are two ways to run a Leanpub action:
--
--
-- - Create a Context and then apply the newtyped Context
-- -> IO a function directly.
-- - 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.
--
newtype Leanpub a
Leanpub :: (Context -> IO a) -> Leanpub a
data Context
Context :: Session -> Maybe ApiSecretKey -> Context
[contextSession] :: Context -> Session
[contextKeyMaybe] :: Context -> Maybe ApiSecretKey
runLeanpub :: Config -> Leanpub a -> IO a
-- | Construct a Config by using <> to combine any of
-- the following:
--
--
--
-- Then use the config as the first argument to the runLeanpub
-- function.
data Config
configSession :: Session -> Config
configKey :: ApiSecretKey -> Config
configKeyFile :: FilePath -> Config
getBookSummary :: BookSlug -> Leanpub Value
getBookSalesSummary :: BookSlug -> Leanpub Value
createFreeBookCoupon :: BookSlug -> CouponCode -> CouponMaxUses -> Maybe CouponNote -> Leanpub Value
createManyFreeBookCoupons :: (CouponCode -> IO ()) -> Natural -> BookSlug -> CouponMaxUses -> Maybe CouponNote -> Leanpub ()
wreqGet :: Path -> Extension -> [QueryParam] -> Leanpub WreqResponse
wreqPost :: Path -> Extension -> [FormParam] -> Leanpub WreqResponse
wreqGetAeson :: Path -> [QueryParam] -> Leanpub Value
wreqPostAeson :: Path -> [FormParam] -> Leanpub Value
wreqPostAeson_ :: Path -> [FormParam] -> Leanpub ()
type WreqResponse = Response ByteString
type Path = [Text]
type Extension = Text
type QueryParam = (Text, Text)
-- | A key/value pair for an application/x-www-form-urlencoded
-- POST request body.
data FormParam
[:=] :: forall v. FormValue v => ByteString -> v -> FormParam
infixr 3 :=
-- | A session that spans multiple requests. This is responsible for cookie
-- management and TCP connection reuse.
data 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.
newAPISession :: IO Session
instance Control.Monad.Fail.MonadFail Leanpub.Wreq.Leanpub
instance Control.Monad.IO.Class.MonadIO Leanpub.Wreq.Leanpub
instance GHC.Base.Monad Leanpub.Wreq.Leanpub
instance GHC.Base.Applicative Leanpub.Wreq.Leanpub
instance GHC.Base.Functor Leanpub.Wreq.Leanpub
instance GHC.Base.Monoid Leanpub.Wreq.Config
instance GHC.Base.Semigroup Leanpub.Wreq.Config