noahzgordon/elm-jsonapi/3.0.1

JsonApi.Documents

Helper functions for working with a full JsonApi Document

Common Helpers

jsonapi : Document -> Maybe JsonApiObject

Fetch information from the top-level 'jsonapi' object

primaryResource : Document -> Result String (Maybe Resource)

Retrieve the primary resource from a decoded Document. This function assumes a singular primary resource and will return an Err if the document contains a collection of primary resources.

primaryResourceCollection : Document -> Result String (List Resource)

Retrieve a collection of primary resources from a decoded Document. This function assumes a collection primary resources and will return an Err if the document contains a singular primary resource.

meta : Document -> Meta

Fetch the top-level meta object from the document.