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

Standardise all responses on a base object #205

Closed
apawsey opened this issue Jan 13, 2020 · 1 comment
Closed

Standardise all responses on a base object #205

apawsey opened this issue Jan 13, 2020 · 1 comment
Assignees

Comments

@apawsey
Copy link

apawsey commented Jan 13, 2020

Follow up from #201

While refactoring the ApiClientBase calls, I wanted to find a way to ensure that regardless of the call/operation being performed, I could easily see if it was a failure or a success. In the EF core providers, there is a behaviour called ExecutionStrategy that allows providers to implement things such as retries. With every single response being a different object, and with the exceptions being handled differently again, there would be almost no way to say "Run this generic operation, and if it fails, try it again"... there would need to be code specific to each response.

However, my implementation is not entirely consistent, because there are some areas where the standard ResponseDetails property an end up null when it shouldn't be. That's purely down to me not being consistent and making certain choices before I worked through the whole api. Those will need to be fixed to ensure that the property is never empty.

@DiscoPYF
Copy link
Collaborator

@apawsey Regarding this specific use case:

Run this generic operation, and if it fails, try it again

What about creating a custom transport? You can implement a specific IApiClientTransport interface to provide the retry logic, or maybe extend the existing HttpApiTransport?
That way you have access to all requests and the full response properties to decide what to do.

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

3 participants