noahzgordon/elm-jsonapi/3.0.0

NOTE: the latest version is 3.0.1

Rerouted (retagged, verified). The tag now points at a different commit than when this version was published. The Lamdera package server serves a copy recovered from https://github.com/noahzgordon/elm-jsonapi.

What we checked: Tag 3.0.0 now points at f2309b1f0284, not the published commit. Rebuilt with git archive from commit 4b26872c7c76 of https://github.com/noahzgordon/elm-jsonapi (zip prefix noahzgordon-elm-jsonapi-4b26872/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 2bca32d696641706fa06d77402d2cc267ea40420.

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/noahzgordon/elm-jsonapi/zipball/3.0.0/

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 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 -> Decoder a -> Resource -> Result 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.

relatedResource : String -> Resource -> Result String (Maybe 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.

build : String -> 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, Value ) -> ClientResource -> ClientResource

Add a list of string-value pairs as attributes to a ClientResource

withRelationship : String -> ResourceIdentifier -> ClientResource -> ClientResource

Add a relationship with a single related resource to a ClientResource

withRelationships : String -> List ResourceIdentifier -> ClientResource -> ClientResource

Add a relationship with a collection of related resources to a ClientResource

withUuid : String -> ClientResource -> Result String 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.