View Source Contentful.Entry.LinkResolver (Contentful SDK v0.6.0)
The module provides functions to resolve Links included in items returned in an API response.
Link to this section Summary
Functions
In Contentful, you can create content that references other content. These are called "links". In API responses, any "links" in the "items" returned have a type "Link" and specify the "id" of the link but do not include all it's fields directly in the "items" array. Instead the full "link" and it's fields may be provided in the "includes" section of the response, depending on the value of the "include" query parameter in the request URL.
Link to this section Functions
@spec replace_links_with_entities(Contentful.Entry.t(), map()) :: Contentful.Entry.t()
In Contentful, you can create content that references other content. These are called "links". In API responses, any "links" in the "items" returned have a type "Link" and specify the "id" of the link but do not include all it's fields directly in the "items" array. Instead the full "link" and it's fields may be provided in the "includes" section of the response, depending on the value of the "include" query parameter in the request URL.
This function will find any "links" in the "fields" of an Entry, and replace them with the corresponding entities from the "includes" section This makes parsing the response easier, as you don't need to manually extract every linked entry from the "includes" section of the response.
Inspired by https://github.com/contentful/contentful.js/blob/master/ADVANCED.md#link-resolution