calions-app/jsonapi-http/1.4.0

NOTE: the latest version is 1.4.2

Renamed to FabienHenon/jsonapi-http. It is published under that name, and new versions come out there.

Versions published as calions-app/jsonapi-http still install under that name. 8 versions of 9 come from the new location (see their notes). 1 version could not be recovered and cannot be installed.

Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/FabienHenon/jsonapi-http.

What we checked: The repo moved to github.com/FabienHenon/jsonapi-http. Rebuilt with git archive from commit bbb426d8f880 of https://github.com/FabienHenon/jsonapi-http (zip prefix calions-app-jsonapi-http-bbb426d/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 466f6776a85d0ddff89675a834b284a3442dd657.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/calions-app/jsonapi-http/zipball/1.4.0/

Http.Request

Http.Request allows you to create http requests with jsonapi objects.

The request functions will return a RemoteData with a jsonapi Document. The content-type used in the request headers is application/vnd.api+json according to the jsonapi specification.

Definitions

type alias Request meta data =
{ url : Url
, headers : List Header
, body : Value
, documentDecoder :
Decoder (Result (List Error) (Document meta data))
}

Defines a Request with a url, some headers, a body, and a jsonapi document decoder. metaand data are types used by the jsonapi document that represent the meta object you would like to decode, and the data object you would like to decode

type alias RequestCustomData data =
{ url : Url
, headers : List Header
, body : Value
, documentDecoder : Decoder (Result (List Error) data)
}

Defines a Request with a url, some headers, a body, and a custom decoder. data is the type of the object you would like to decode.

type alias RequestNoContent =
{ url : Url
, headers : List Header
, body : Value
}

Defines a Request with a url, some headers, and a body. There is no content decoder. Useful for DELETE requests for instance.

type alias RequestFiles meta data msg =
{ url : Url
, headers : List Header
, multipartNames : List String
, files : List File
, multipartEncoder : String -> File -> Part
, documentDecoder :
Decoder (Result (List Error) (Document meta data))
, tracker : Maybe String
, msg : RemoteData RequestError (Document meta data) -> msg
}

Defines a Request with a url, some headers, a list of files, and a custom decoder. data is the type of the object you would like to decode.

type alias RequestEx meta data =
{ url : Url
, headers : List Header
, body : Value
, documentDecoder :
Decoder (Result (List Error) (Document meta data))
, extractHeaders : List String
}

Defines a RequestEx with a url, some headers, a body, and a jsonapi document decoder. metaand data are types used by the jsonapi document that represent the meta object you would like to decode, and the data object you would like to decode. You can also extract some response headers to use them later

type alias RequestCustomDataEx data =
{ url : Url
, headers : List Header
, body : Value
, documentDecoder : Decoder (Result (List Error) data)
, extractHeaders : List String
}

Defines a Request with a url, some headers, a body, and a custom decoder. data is the type of the object you would like to decode. You can also extract some response headers to use them later

type alias RequestNoContentEx =
{ url : Url
, headers : List Header
, body : Value
, extractHeaders : List String
}

Defines a Request with a url, some headers, and a body. There is no content decoder. Useful for DELETE requests for instance. You can also extract some response headers to use them later

type alias RequestFilesEx meta data msg =
{ url : Url
, headers : List Header
, multipartNames : List String
, files : List File
, multipartEncoder : String -> File -> Part
, documentDecoder :
Decoder (Result (List Error) (Document meta data))
, tracker : Maybe String
, extractHeaders : List String
, msg :
RemoteData
( RequestError, List ( String, String ) )
( Document meta data, List ( String, String ) )
-> msg
}

Defines a Request with a url, some headers, a list of files, and a custom decoder. data is the type of the object you would like to decode. You can also extract some response headers to use them later

Requests

Request meta data
-> Task Never (RemoteData RequestError (Document meta data))

Create a request task that will decode a jsonapi object

RequestCustomData data
-> Task Never (RemoteData RequestError data)

Create a request task that will decode a custom object

requestNoContent : RequestNoContent -> Task Never (RemoteData RequestError ())

Create a request task that will expect nothing to decode

requestFiles : RequestFiles meta data msg -> Cmd msg

Create a request files that will decode a jsonapi object

RequestEx meta data
-> Task
Never
(RemoteData
( RequestError, List ( String, String ) )
( Document meta data, List ( String, String ) )
)

Create a request task that will decode a jsonapi object. It will also return in the msg the list of extracted headers.

RequestCustomDataEx data
-> Task
Never
(RemoteData
( RequestError, List ( String, String ) )
( data, List ( String, String ) )
)

Create a request task that will decode a custom object. It will also return in the msg the list of extracted headers.

RequestNoContentEx
-> Task
Never
(RemoteData
( RequestError, List ( String, String ) )
(List ( String, String ))
)

Create a request task that will expect nothing to decode. It will also return in the msg the list of extracted headers.

requestFilesEx : RequestFilesEx meta data msg -> Cmd msg

Create a request files that will decode a jsonapi object. It will also return in the msg the list of extracted headers.