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

Support multiple methods per relation #7

Open
lukepuplett opened this issue Apr 23, 2019 · 0 comments
Open

Support multiple methods per relation #7

lukepuplett opened this issue Apr 23, 2019 · 0 comments

Comments

@lukepuplett
Copy link
Owner

lukepuplett commented Apr 23, 2019

A self or item link may support more than one action upon it, therefore we need to use the method and relation as a composite unique key.

The following things may need considering.

  • Offer .Replace(object model) and .Delete() steps with no parameters to act upon the current resource but checks whether the current resource has these links.

  • Some actions after deleting a resource make no sense. For example, deleting an entire subset may return an empty set, plus links, so To and Submit might be the only rational next steps. Consider this when designing the return type from a .Delete().

  • Because submitting on a simple read can feel odd, add .To("orders", new { skip = 10, take = 10 }) which submits with a Get. This bakes in a link between the step name To and the HTTP method name Get. Submit should continue to use/choose most appropriate HTTP method from the controls on offer.

  • Throw when cannot work out the most appropriate method to use for the step and rel.

To = GET, POST
ToItem = GET
Submit = GET, POST, PUT, match in that order on first with compatible inputs
Replace = PUT + payload
Delete = DELETE

  • Design above forces deletes to be done by getting the resource first, use ifmatch in control or from last response
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

1 participant