SquirclesIO/elm-utils/1.0.0

Formerly PerformanceIMMO/elm-utils. Search finds this package by either name.

Perfimmo.Http.HttpRequest

HttpRequest

Types

type Request a
= Get String (Expect a)
| Delete String (Expect a)
| Post String Body (Expect a)
| Put String Body (Expect a)
| Patch String Body (Expect a)

Request

= BodyResponse Metadata a

BodyResponse

type HttpError e
= TechnicalError String
| DomainError (BodyResponse e)

HttpError

type alias HttpResult e a =
Result (HttpError e) (BodyResponse a)

HttpResult

type alias ResponseDecoder e a =
{ koDecoder : Decoder e
, okDecoder : Decoder a
}

ResponseDecoder

Functions

withAuthReq : Request a -> Cmd a

withAuthReq

request : RestNavigationLink -> Body -> Expect a -> Request a

request

authRequest : RestNavigationLink -> Body -> Expect a -> Cmd a

authRequest

withAuthReqWithHeaders : List Header -> Request a -> Cmd a

withAuthReqWithHeaders

Helper

printHttpError : Error -> String

printHttpError

Expect

expectJsonResponse : (Result Error ( Metadata, a ) -> msg) -> Decoder a -> Expect msg

expectJsonResponse

expectWhateverResponse : (Result Error Metadata -> msg) -> Expect msg

expectWhateverResponse

expectJsonResponse2 : (HttpResult e a -> msg) -> ResponseDecoder e a -> Expect msg

expectJsonResponse2

expectWhateverOkResult : (HttpResult e () -> msg) -> Decoder e -> Expect msg

expectWhateverOkResult

Transformations

bool2Uri : Bool -> String

bool2Uri