noahzgordon/elm-jsonapi/2.0.1

NOTE: this package is not compatible with Elm 0.19.1

JsonApi.Resources

Helper functions for working with a single JsonApi Resource

Common Helpers

id : Resource -> String

Get the string ID of a Resource

attributes : Decoder a -> Resource -> Result String a

Serialize the attributes of a Resource. Because the attributes are unstructured, you must provide a Json Decoder to convert them into a type that you define.

attribute : String -> Decoder a -> Resource -> Result String a

Serialize a single attributes of a Resource. You must provide the string key of the attribute and a Json Decoder to convert the attribute into a type that you define.

relatedResource : String -> Resource -> Result String Resource

Find a related resource. Will return an Err if a resource collection is found.

relatedResourceCollection : String -> Resource -> Result String (List Resource)

Find a related collection of resources. Will return an Err if a single resource is found.

meta : Resource -> Meta

Pull the meta value off of a Resource.

relatedMeta : String -> Resource -> Result String Meta

Retreive the meta information from a relationship. Will return an Err if the relationship does not exist.