Merge links & embedded
Closed this issue · 4 comments
This is a major refactor, but Hyperclient should not differntiate between links
and embeded
they are all resource with more or less information.
Instead of accessing client.links.posts.first
or client.embedded.posts.first
one should be able to simply access client.resources.posts.first
I think resources
introduces a concept that HAL doesn't have.
What do you think about taking it a bit further without actually changing the semantics of existing code?
In general when you do x.y
, can't you say that y
is first a property and if that doesn't exist a link, and if that doesn't exist an embedded collection, and if that doesn't exist it's an error? In ambiguous cases when you have a property 'y' and a link 'y', you could always default to the full syntax.
Check out the changes in https://github.com/dblock/hyperclient/tree/delegation-of-methods, that is actually mergeable and accomplishes what I proposed above. I'll PR after #61 is merged.
Closing this.