Helper functions for working with a single JsonApi Resource
id : JsonApi.Data.Resource -> String
Get the string ID of a Resource
attributes : Json.Decode.Decoder a -> JsonApi.Data.Resource -> Result Json.Decode.Error 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 -> Json.Decode.Decoder a -> JsonApi.Data.Resource -> Result Json.Decode.Error 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.
links : JsonApi.Data.Resource -> JsonApi.Data.Links
Pull the attributes off of a Resource.
relatedResource : String -> JsonApi.Data.Resource -> Result String (Maybe JsonApi.Data.Resource)
Find a related resource. Will return an Err if a resource collection is found.
relatedResourceCollection : String -> JsonApi.Data.Resource -> Result String (List JsonApi.Data.Resource)
Find a related collection of resources. Will return an Err if a single resource is found.
meta : JsonApi.Data.Resource -> JsonApi.Data.Meta
Pull the meta value off of a Resource.
relatedLinks : String -> JsonApi.Data.Resource -> Result String JsonApi.Data.Links
Retreive the links from a relationship. Will return an Err if the relationship does not exist.
relatedMeta : String -> JsonApi.Data.Resource -> Result String JsonApi.Data.Meta
Retreive the meta information from a relationship. Will return an Err if the relationship does not exist.
build : String -> JsonApi.Data.ClientResource
Construct a ClientResource instance with the supplied type. ClientResources are like Resources but without an 'id' field or related resources. Use them to represent new Resources that you want to POST to a JSON API server.
withAttributes : List ( String, Json.Encode.Value ) -> JsonApi.Data.ClientResource -> JsonApi.Data.ClientResource
Add a list of string-value pairs as attributes to a ClientResource
withRelationship : String -> JsonApi.Data.ResourceIdentifier -> JsonApi.Data.ClientResource -> JsonApi.Data.ClientResource
Add a relationship with a single related resource to a ClientResource
withRelationships : String -> List JsonApi.Data.ResourceIdentifier -> JsonApi.Data.ClientResource -> JsonApi.Data.ClientResource
Add a relationship with a collection of related resources to a ClientResource
withUuid : String -> JsonApi.Data.ClientResource -> Result String JsonApi.Data.ClientResource
Add a client-generated UUID to the resource. MUST be a valid Uuid in the canonical representation xxxxxxxx-xxxx-Axxx-Yxxx-xxxxxxxxxxxx where A is the version number between [1-5] and Y is in the range [8-B].
I recommend using http://package.elm-lang.org/packages/danyx23/elm-uuid/2.0.2/Uuid
to general a valid UUID.