Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Populate templated links directly using resource. #13

Open
tobyclemson opened this issue Mar 26, 2019 · 2 comments
Open

Populate templated links directly using resource. #13

tobyclemson opened this issue Mar 26, 2019 · 2 comments

Comments

@tobyclemson
Copy link
Contributor

tobyclemson commented Mar 26, 2019

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"
@jimmythompson
Copy link
Owner

jimmythompson commented Mar 27, 2019

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)

@tobyclemson
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants