The record we use to extend ResourceWith a.
You can render a list of resource depictions like so:
viewDepictions : ResourceWith Edges -> List (Html msg)
viewDepictions resource =
List.map viewImage <|
depictions Media.Medium resourceThis next example won't compile because you need a ResourceWith Edges
and this signature indicates they are missing.
viewDepictions : ResourceWith {} -> List (Html msg)
viewDepictions resource =
List.map viewImage <|
depictions Media.Medium resourceA connection to a resource named by Predicate
Alias for ResourceWith Edges
Get the category of a ResourceWith.
Every resource has a category, and that category can be part of a category tree.
For instance, the news category belongs to the category tree text > news.
This function will return only the category stored with the ResourceWith,
so in this case news, but not its parent text.
Get the entire category tree of a ResourceWith starting from the parent
category and ending with the smallest child. For example, in the case of a
news resource, it will return [text, news].
The image url of the ResourceWith depiction.
Returns the image url if there is a depiction and the mediaclass exists.
The image urls of the ResourceWith depictions
Returns a list of image urls if there is a depiction and the mediaclass exists.
Return all resources with a given predicate.
The returned resources won't have any edges themselves, indicated by the {}
in ResourceWith {}.
Decode a ResourceWith that has edges.
Decode a ResourceWith 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 likeResourceWith {}. This tells use there are no other fields besides the ones here.So you'll see this used in function signatures like:
Note: the
ResourceWith {}might actually have edges, they are just not fetched.