Module

Axios

Package
purescript-axios
Repository
iarthstar/purescript-axios

#Axios Source

class Axios req res | req -> res where

The Axios type class is for performing api calls using Axios JS

Members

#Header Source

data Header

The Header is simple product type for wrapping a pair of string values, as key value pairs forming headers json

Constructors

Instances

#Method Source

data Method

The Method type is used to represent common HTTP methods

Constructors

Instances

#Config Source

data Config

The Config is a product type for wrapping a pair of String and Foreign value, as key value pairs forming config json for axios

Constructors

Instances

#method Source

method :: Method -> Config

Converts an Method value into a Config with key method

#baseUrl Source

baseUrl :: String -> Config

Converts an String value into a Config with key baseURL

#timeout Source

timeout :: Int -> Config

Converts an Int value into a Config with key timeout

#auth Source

auth :: String -> String -> Config

Constructs a Config with key auth from pair of String values i.e. username and password

#headers Source

headers :: Array Header -> Config

Constructs a Config with key headers from an array of Header

#genericAxios Source

genericAxios :: forall res req. Decode res => Encode req => String -> Array Config -> req -> Aff (Either Error res)

A generic implementation of the axios member from Axios class i.e. takes an url, array of config and request body and gives the Either Error response

genericAxios "/req_res/users/9" 
 [ method GET
 , headers [ Header "Content-Type" "application/json" ]
 , baseUrl "https://grandeur-backend.herokuapp.com"
 , auth "1234" "1234"
 ] req

#defaultAxios Source

defaultAxios :: forall res req. Decode res => Encode req => String -> Method -> req -> Aff (Either Error res)

A default implementation of the axios member from Axios class i.e. takes an url, method and request body and gives the Either Error response

defaultAxios "https://grandeur-backend.herokuapp.com/gh_api/get_release_info/" POST req

#defaultAxios' Source

defaultAxios' :: forall res req. Decode res => Encode req => String -> Method -> Array Header -> req -> Aff (Either Error res)

Another default implementation of the axios member from Axios class i.e. takes an url, method, array of header and request body and gives the Either Error response

defaultAxios' "https://reqres.in/api/users/7" PATCH 
 [ Header "Content-Type" "application/json"]
 , Header "Cache-Control" "no-cache"]
 ] req
Modules
Axios