Fixes issue #134 - Get lists for a user by its id with the API

This commit is contained in:
stom79 2017-12-13 16:07:53 +01:00
parent c7a67e7215
commit b2cb3d64aa
1 changed files with 21 additions and 0 deletions

View File

@ -1154,6 +1154,27 @@ public class API {
return apiResponse;
}
/**
* Get lists for a user by its id
* @return APIResponse
*/
public APIResponse getLists(String userId){
List<fr.gouv.etalab.mastodon.client.Entities.List> lists = new ArrayList<>();
fr.gouv.etalab.mastodon.client.Entities.List list;
try {
String response = new HttpsConnection().get(getAbsoluteUrl(String.format("/accounts/%s/lists", userId)), 60, null, prefKeyOauthTokenT);
list = parseList(new JSONObject(response));
lists.add(list);
} catch (HttpsConnection.HttpsConnectionException e) {
setError(e.getStatusCode(), e);
}catch (Exception e) {
setDefaultError();
}
apiResponse.setLists(lists);
return apiResponse;
}
/**
* Get a list