The record we use to extend Resource a.
You can render a list of resource depictions like so:
viewDepictions : Resource WithEdges -> List (Html msg)
viewDepictions resource =
List.map viewImage <|
depictions Media.Medium resourceThis next example won't compile because you need a Resource WithEdges
and this signature indicates they are missing.
viewDepictions : Resource {} -> List (Html msg)
viewDepictions resource =
List.map viewImage <|
depictions Media.Medium resourceA connection to a resource named by Predicate
The category of a Resource.
Every resource has one category, but can be part of a hierarchy of other
categories. For example news is part of text > article > news. This function
will always return the Category stored with the Resource.
Note: there hasn't been the need to expose any of the parent categories so far, if there is please file an issue.
The image url of the Resource depiction.
Returns the image url if there is a depiction and the mediaclass exists.
The image urls of the Resource depictions
Returns a list of image urls if there is a depiction and the mediaclass exists.
Return all edges with a given predicate.
The returned resources won't have any edges themselves, indicated by the {}
in Resource {}.
Decode a Resource that has edges.
Decode a Resource that does not have edges.
An Elm representation of a Ginger resource.
Note the
ain the record definition, this an extensible record. This means it includes at least all of these fields but may have others as well. This lets us reason about whether the edges are included in the data, compile time. The Ginger REST API includes edges nested only one level deep, but since the edges are also resources we can re-use this datatype likeResource {}. This tells use there are no other fields besides the ones here.So you'll see this used in function signatures like:
Note: the
Resource {}might actually have edges, they are just not fetched.