http-barf-0.1.1.0: a library to make http requests without worrying much
Safe HaskellSafe-Inferred
LanguageGHC2021

Network.HTTP.Barf.Internal

Synopsis

exported

newtype Req Source #

The type of request modifications. The most important features of this type are the Monoid, Semigroup and IsList instances.

Constructors

MkReq 

Fields

Instances

Instances details
Monoid Req Source #

the empty Req does nothing to the "base" request

Instance details

Defined in Network.HTTP.Barf.Internal

Methods

mempty :: Req #

mappend :: Req -> Req -> Req #

mconcat :: [Req] -> Req #

Semigroup Req Source #

combining to Reqs composes the extensions to the request

Instance details

Defined in Network.HTTP.Barf.Internal

Methods

(<>) :: Req -> Req -> Req #

sconcat :: NonEmpty Req -> Req #

stimes :: Integral b => b -> Req -> Req #

IsList Req Source #

An IsList instance for Req makes it easy to combine multiple Reqs monoidally by passing them in list syntax. The idea is that it composes all of the request extensions in the list it gets passed

Even though toList = singleton, this instance does adhere to the laws of the IsList type class

Instance details

Defined in Network.HTTP.Barf.Internal

Associated Types

type Item Req #

Methods

fromList :: [Item Req] -> Req #

fromListN :: Int -> [Item Req] -> Req #

toList :: Req -> [Item Req] #

type Item Req Source # 
Instance details

Defined in Network.HTTP.Barf.Internal

type Item Req = Req

get_ Source #

Arguments

:: MonadIO m 
=> String

the url to connect to

-> Req

the modifier(s) to the request

-> m LazyByteString 

creates a GET request, use it like

get_ "http://localhost:8080" []

head_ Source #

Arguments

:: MonadIO m 
=> String

the url to connect to

-> Req

the modifier(s) to the request

-> m LazyByteString 

creates a HEAD request, use it like

head_ "http://localhost:8080" []

post_ Source #

Arguments

:: MonadIO m 
=> String

the url to connect to

-> Req

the modifier(s) to the request

-> m LazyByteString 

creates a POST request, use it like

post_ "http://localhost:8080" []

put_ Source #

Arguments

:: MonadIO m 
=> String

the url to connect to

-> Req

the modifier(s) to the request

-> m LazyByteString 

creates a PUT request, use it like

put_ "http://localhost:8080" []

delete_ Source #

Arguments

:: MonadIO m 
=> String

the url to connect to

-> Req

the modifier(s) to the request

-> m LazyByteString 

creates a DELETE request, use it like

delete_ "http://localhost:8080" []

q_ Source #

Arguments

:: String

the name of the query param

-> String

the value of the query param

-> Req 

q_ like "query"

h_ Source #

Arguments

:: String

the name of the header

-> String

the value of the header

-> Req 

h_ like "header"

j_ Source #

Arguments

:: ToJSON a 
=> a

the value of the json body

-> Req 

j_ like "json"

if the json body is already set, it will be overwritten

v_ Source #

Arguments

:: Value

the value of the json body

-> Req 

v_ like "value"

this is a convenience helper for using j_ specialised to Value. It is useful if you just want to quickly build a json body for your request.

if the json body is already set, it will be overwritten

inspectRequest_ :: Req Source #

print the request before dispatching, useful for debugging

dryRun_ :: Req Source #

when set, do not execute the request

internal

data Req' Source #

a data type representing an http request

Instances

Instances details
Generic Req' Source # 
Instance details

Defined in Network.HTTP.Barf.Internal

Associated Types

type Rep Req' :: Type -> Type #

Methods

from :: Req' -> Rep Req' x #

to :: Rep Req' x -> Req' #

Show Req' Source # 
Instance details

Defined in Network.HTTP.Barf.Internal

Methods

showsPrec :: Int -> Req' -> ShowS #

show :: Req' -> String #

showList :: [Req'] -> ShowS #

Eq Req' Source # 
Instance details

Defined in Network.HTTP.Barf.Internal

Methods

(==) :: Req' -> Req' -> Bool #

(/=) :: Req' -> Req' -> Bool #

Ord Req' Source # 
Instance details

Defined in Network.HTTP.Barf.Internal

Methods

compare :: Req' -> Req' -> Ordering #

(<) :: Req' -> Req' -> Bool #

(<=) :: Req' -> Req' -> Bool #

(>) :: Req' -> Req' -> Bool #

(>=) :: Req' -> Req' -> Bool #

max :: Req' -> Req' -> Req' #

min :: Req' -> Req' -> Req' #

type Rep Req' Source # 
Instance details

Defined in Network.HTTP.Barf.Internal