I'm working an API which works as "intermediary" between a REST API and the developer.
In this way, when the programmer do something like this:
User user = client.getUser(nickname);
it will execute a network request to download from the service the data about the user and then the programmer can use the data by doing things like
and so on.
Now there are some methods like
getFollowers() which execute another network request and i could do it in two ways:
Download all the data in the
getUsermethod (and not only the most important) but in this way the request time could be very long since it should execute the request to various urls
Download the data when the user calls the method, it looks like the best way and to improve it i could cache the result so the next call to
getFollowersreturns immediately with the data already download instead of execute again the request.
What is the best way? And i should let methods like