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

DRY on clients #16

Open
Gonmeso opened this issue Aug 4, 2023 · 0 comments
Open

DRY on clients #16

Gonmeso opened this issue Aug 4, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@Gonmeso
Copy link
Collaborator

Gonmeso commented Aug 4, 2023

There is a lot of code duplication in the clients mainly because each action handles the request by its own. A couple of ways to improve and follow the DRY principle would be:

  • Create a perform_request/handle_request functionality at base ApiClient so it handles the headers (now done in each function) and the requests params. Kind of how requests does it, as it has a main request function and the underlying GET, POST... methods call it under the hood. Check it.

  • Create base get, list and create methods in ApiClient as many of the resources use the same way to retrieve information, for example a get basically needs an object id to retrieve the information.

@Gonmeso Gonmeso added the enhancement New feature or request label Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant