FabienHenon/jsonapi/1.0.0

NOTE: this package is not compatible with Elm 0.19.1

JsonApi

JsonApi exposes the ResourceInfo type and functions to get useful information for your resource decoders.

Type

type alias ResourceInfo =
ResourceInfo

The ResourceInfo is passed to your resource decoders. It contains useful information for decoding and for your resource, like your resource id and links

_Example of json api resource:_

{
    "data": [
        {
            "type": "users",
            "id": "13608770-76dd-47e5-a1c4-4d0d9c2483ad",
            "links": {
                "self": "http://link-to-user",
                "profile": "http://link-to-user-profile"
            },
            "attributes": {
                "firstname": "John",
                "lastname": "Doe",
                "gender": "male"
            },
            "relationships": {}
        }
    ]
}

Getter functions

id : ResourceInfo -> String

Returns the id of your resource.

From the json example above, id will return 13608770-76dd-47e5-a1c4-4d0d9c2483ad