halboy
halboy copied to clipboard
Populate templated links directly using resource.
Since halboy is already capable of expanding templated URIs at navigation time, it would be really nice to be able to do the same at read time. For example:
;; { "_links": { "rel": { "href": "https://example.com{?template}", "templated": true } } }
(hal/get-href resource :rel {:template :params})
; => "https://example.com?template=params"
Would it make more sense to do this in a separate method, e.g.
(hal/expand-href resource :rel {:template :params})
So you could have a fallback value, e.g.
(hal/get-href resource :rel default)
Yeah, that would work for me :) Can create a PR if you need.