EngageSoftware/elm-dnn-http/1.0.0

NOTE: this package is not compatible with Elm 0.19.1

Engage.Http

Helpers for working with DNN Web API

Types

type alias Config =
{ baseUrl : String
, headers : List Header
}

Configuration type

  • baseUrl the base URL for Http request
  • headers: `list of the header for Http request

Http Verbs

get :
Config
-> Decoder success
-> { methodName : String
, queryStringParams : List ( String, String )
}
-> Task Never (WebData success)

Http GET

Config
-> Decoder success
-> { methodName : String
, value : Value
}
-> Task Never (WebData success)

Http POST

Config
-> Decoder success
-> { methodName : String
, value : Value
}
-> Task Never (WebData success)

Http PATCH

put :
Config
-> Decoder success
-> { methodName : String
, value : Value
}
-> Task Never (WebData success)

Http PUT

Config
-> { methodName : String
, value : Value
}
-> Task Never (WebData String)

Http DELETE

Helper functions

getErrorMessage : { a | localization : Localization } -> Error -> String

Get the localized error message from the Http.Error

Decode/Encoder

configDecoder : Decoder Config

Json decoder for Config

serverErrorDecoder : { a | localization : Localization } -> Decoder String

Json decoder for server error, localized.

multipleServerErrorDecoder : { a | localization : Localization } -> Decoder String

Json decoder for multiple server error messages, localized.

nullDecoder : Decoder ()

Null decoder. Useful for when the server doesn't return any value.