Module

Network.HTTP.Affjax

Package
purescript-affjax
Repository
slamdata/purescript-affjax

#AJAX Source

data AJAX :: Effect

The effect type for AJAX requests made with Affjax.

#Affjax Source

type Affjax e a = Aff (ajax :: AJAX | e) (AffjaxResponse a)

The type for Affjax requests.

#AffjaxRequest Source

type AffjaxRequest a = { content :: Maybe a, headers :: Array RequestHeader, method :: Either Method CustomMethod, password :: Maybe String, url :: URL, username :: Maybe String, withCredentials :: Boolean }

#AffjaxResponse Source

type AffjaxResponse a = { headers :: Array ResponseHeader, response :: a, status :: StatusCode }

The type of records that will be received as an Affjax response.

#URL Source

type URL = String

Type alias for URL strings to aid readability of types.

#affjax Source

affjax :: forall b a e. Requestable a => Respondable b => AffjaxRequest a -> Affjax e b

Makes an Affjax request.

#get Source

get :: forall a e. Respondable a => URL -> Affjax e a

Makes a GET request to the specified URL.

#post Source

post :: forall b a e. Requestable a => Respondable b => URL -> a -> Affjax e b

Makes a POST request to the specified URL, sending data.

#post' Source

post' :: forall b a e. Requestable a => Respondable b => URL -> Maybe a -> Affjax e b

Makes a POST request to the specified URL with the option to send data.

#post_ Source

post_ :: forall a e. Requestable a => URL -> a -> Affjax e Unit

Makes a POST request to the specified URL, sending data and ignoring the response.

#post_' Source

post_' :: forall a e. Requestable a => URL -> Maybe a -> Affjax e Unit

Makes a POST request to the specified URL with the option to send data, and ignores the response.

#put Source

put :: forall b a e. Requestable a => Respondable b => URL -> a -> Affjax e b

Makes a PUT request to the specified URL, sending data.

#put' Source

put' :: forall b a e. Requestable a => Respondable b => URL -> Maybe a -> Affjax e b

Makes a PUT request to the specified URL with the option to send data.

#put_ Source

put_ :: forall a e. Requestable a => URL -> a -> Affjax e Unit

Makes a PUT request to the specified URL, sending data and ignoring the response.

#put_' Source

put_' :: forall a e. Requestable a => URL -> Maybe a -> Affjax e Unit

Makes a PUT request to the specified URL with the option to send data, and ignores the response.

#delete Source

delete :: forall a e. Respondable a => URL -> Affjax e a

Makes a DELETE request to the specified URL.

#delete_ Source

delete_ :: forall e. URL -> Affjax e Unit

Makes a DELETE request to the specified URL and ignores the response.

#patch Source

patch :: forall b a e. Requestable a => Respondable b => URL -> a -> Affjax e b

Makes a PATCH request to the specified URL, sending data.

#patch' Source

patch' :: forall b a e. Requestable a => Respondable b => URL -> Maybe a -> Affjax e b

Makes a PATCH request to the specified URL with the option to send data.

#patch_ Source

patch_ :: forall a e. Requestable a => URL -> a -> Affjax e Unit

Makes a PATCH request to the specified URL, sending data and ignoring the response.

#patch_' Source

patch_' :: forall a e. Requestable a => URL -> Maybe a -> Affjax e Unit

Makes a PATCH request to the specified URL with the option to send data, and ignores the response.

#RetryDelayCurve Source

type RetryDelayCurve = Int -> Milliseconds

A sequence of retry delays, in milliseconds.

#RetryPolicy Source

type RetryPolicy = { delayCurve :: RetryDelayCurve, shouldRetryWithStatusCode :: StatusCode -> Boolean, timeout :: Maybe Milliseconds }

Expresses a policy for retrying Affjax requests with backoff.

#defaultRetryPolicy Source

defaultRetryPolicy :: RetryPolicy

A sensible default for retries: no timeout, maximum delay of 30s, initial delay of 0.1s, exponential backoff, and no status code triggers a retry.

#retry Source

retry :: forall b a e. Requestable a => RetryPolicy -> (AffjaxRequest a -> Affjax (avar :: AVAR, ref :: REF | e) b) -> (AffjaxRequest a -> Affjax (avar :: AVAR, ref :: REF | e) b)

Retry a request using a RetryPolicy. After the timeout, the last received response is returned; if it was not possible to communicate with the server due to an error, then this is bubbled up.

#affjax' Source

affjax' :: forall b a e. Requestable a => Respondable b => AffjaxRequest a -> (Error -> Eff (ajax :: AJAX | e) Unit) -> (AffjaxResponse b -> Eff (ajax :: AJAX | e) Unit) -> Eff (ajax :: AJAX | e) (Canceler (ajax :: AJAX | e))

Run a request directly without using Aff.