kinyerakenneth / lastfm-java

Automatically exported from code.google.com/p/lastfm-java
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

User.getFriends should return PaginatedResult<User> instead of Collection<User> #24

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
like in summary: User.getFriends should return PaginatedResult<User> instead of 
Collection<User>

Best regards,
Dawid

PS. good work!

Original issue reported on code.google.com by dawid.pi...@gmail.com on 31 May 2011 at 9:25

GoogleCodeExporter commented 9 years ago
Fixed in trunk, will be in the next binary. Thanks!
Will also break backwards compatability, unfortunately.

Original comment by jannikov...@gmail.com on 31 May 2011 at 12:41

GoogleCodeExporter commented 9 years ago
wow! That was fast! 

Thanks a lot!
Dawid

Original comment by dawid.pi...@gmail.com on 31 May 2011 at 1:09

GoogleCodeExporter commented 9 years ago
I just looked up the source. If I may suggest something, I corrected this in my 
own copy in the following way:

    public static PaginatedResult<User> getFriends(String user, String apiKey) {
        return getFriends(user, false, 50, apiKey, 1);
    }

    public static PaginatedResult<User> getFriends(String user, boolean recenttracks, int limit, String apiKey, int page) { 
        Map<String, String> params = new HashMap<String, String>();
        params.put("user", user);
        params.put("recenttracks", String.valueOf(recenttracks));
        params.put("limit", String.valueOf(limit));
        params.put("page", String.valueOf(page));
        Result result = Caller.getInstance().call("user.getFriends", apiKey, params);
        return ResponseBuilder.buildPaginatedResult(result, User.class);
    }

This allows retrieving of also other pages that the (default) first one.

Original comment by dawid.pi...@gmail.com on 31 May 2011 at 1:19

GoogleCodeExporter commented 9 years ago
whoops :)

Original comment by jannikov...@gmail.com on 4 Jun 2011 at 4:51