Fixes issue #134 - Update a list with the API

This commit is contained in:
stom79 2017-12-13 15:57:52 +01:00
parent 13f047ed94
commit b8cd4f671b
1 changed files with 25 additions and 0 deletions

View File

@ -1157,6 +1157,31 @@ public class API {
}
/**
* Update a list by its id
* @param id String, the id of the list
* @param title String, the title of the list
* @return APIResponse
*/
public APIResponse updateList(String id, String title){
HashMap<String, String> params = new HashMap<>();
params.put("title",title);
List<fr.gouv.etalab.mastodon.client.Entities.List> lists = new ArrayList<>();
fr.gouv.etalab.mastodon.client.Entities.List list;
try {
String response = new HttpsConnection().put(getAbsoluteUrl(String.format("/lists/%s", id)), 60, params, 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;
}
/**
* Parse json response an unique account