You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 baseApiClient
so it handles the headers (now done in each function) and the requests params. Kind of howrequests
does it, as it has a mainrequest
function and the underlying GET, POST... methods call it under the hood. Check it.Create base
get
,list
andcreate
methods inApiClient
as many of the resources use the same way to retrieve information, for example aget
basically needs an object id to retrieve the information.The text was updated successfully, but these errors were encountered: