exhal v1.0.0 ExHal

Use HAL APIs with ease.

Summary

Functions

Fetches value of specified property or links whose rel matches

Returns link or property of the specified name, or the result of default_fun if neither are found

Returns [%Link{}...] when link exists

    result of `default_fun` otherwise

Returns <property value> when property exists

    result of `default_fun` otherwise

Returns a new %ExHal.Document representing the HAL document provided

Returns {:ok, <url of specified document>}

Functions

fetch(a_document, name)

Fetches value of specified property or links whose rel matches

Returns {:ok, <property value>} if name identifies a property;

    `{:ok, [%Link{}, ...]}`   if `name` identifies a link;
    `:error`                  othewise
get_lazy(a_doc, name, default_fun)

Returns link or property of the specified name, or the result of default_fun if neither are found.

get_property_lazy(a_doc, prop_name, default_fun)

Returns <property value> when property exists

    result of `default_fun` otherwise
parse(hal_str)

Returns a new %ExHal.Document representing the HAL document provided.

url(a_doc, default_fn \\ fn _doc -> :error end)

Returns {:ok, <url of specified document>}