halboy icon indicating copy to clipboard operation
halboy copied to clipboard

Populate templated links directly using resource.

Open tobyclemson opened this issue 6 years ago • 2 comments

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"

tobyclemson avatar Mar 26 '19 16:03 tobyclemson

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)

jimmythompson avatar Mar 27 '19 15:03 jimmythompson

Yeah, that would work for me :) Can create a PR if you need.

tobyclemson avatar Nov 11 '20 17:11 tobyclemson