Refactoring endpoints into subcategories
ToshY opened this issue · 0 comments
Problem
Initially BaseRequest
class was made to include all endpoints for the "basic" API endpoints. As most of the endpoints are neatly divided into subcategories, e.g. Countries, Pull Zone, Purge, etc., the problem arises that some functionality like purging is both available as a subcategory Purge, as well as an endpoint for the Pull Zone category /purgeCache
, which could lead to confusion as it's not clear from the call directly, $baseRequest->purgeCache()
, which "purge" we are actually doing.
Propose
Option 1
In order to clear things up, either the methods should be renamed. Maybe prefixing by the subcategory?
// old
$baseRequest->purgeCache();
// new
$baseRequest->pullZonePurgeCache();
This could work, but if we want to be consistent, for some subcategories this would make some not really nice looking method names
// old
$baseRequest->purgeUrl();
// new
$baseRequest->purgePurgeUrl();
Option 2
Maybe creating models for each subcategory would make things clearer.
$baseRequest->getUser()->getDetails();
$baseRequest->getUser()->updateDetails();
$baseRequest->getUser()->resetApiKey();
$baseRequest->getUser()->closeTheAccount();
$baseRequest->getUser()->getDpaDetails();
Option 3
Any other suggestions or ideas on how to improve this are welcome.