PerformanceIMMO / elm-utils / Perfimmo.Http.HttpRequest

HttpRequest

Types


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

Request


type BodyResponse a
    = BodyResponse Http.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 : Json.Decode.Decoder e
, okDecoder : Json.Decode.Decoder a 
}

ResponseDecoder

Functions

withAuthReq : Request a -> Platform.Cmd.Cmd a

withAuthReq

request : Perfimmo.Http.RestNavigationLink.RestNavigationLink -> Http.Body -> Http.Expect a -> Request a

request

authRequest : Perfimmo.Http.RestNavigationLink.RestNavigationLink -> Http.Body -> Http.Expect a -> Platform.Cmd.Cmd a

authRequest

withAuthReqWithHeaders : List Http.Header -> Request a -> Platform.Cmd.Cmd a

withAuthReqWithHeaders

Helper

printHttpError : Http.Error -> String

printHttpError

Expect

expectJsonResponse : (Result Http.Error ( Http.Metadata, a ) -> msg) -> Json.Decode.Decoder a -> Http.Expect msg

expectJsonResponse

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

expectWhateverResponse

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

expectJsonResponse2

expectWhateverOkResult : (HttpResult e () -> msg) -> Json.Decode.Decoder e -> Http.Expect msg

expectWhateverOkResult

Transformations

bool2Uri : Basics.Bool -> String

bool2Uri