Matched API Client to online API return values and calls:
- added fav_file API call - added "favorites" value to FileInfo holder
This commit is contained in:
@@ -73,9 +73,8 @@ public class ApiClient {
|
|||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileInfo[] getFileInfo(String auth, List<Integer> ids) throws IOException, ApiException {
|
public FileInfo[] getFileInfo(List<Integer> ids) throws IOException, ApiException {
|
||||||
QueryBuilder builder = new QueryBuilder(ApiMethods.replay_files);
|
QueryBuilder builder = new QueryBuilder(ApiMethods.replay_files);
|
||||||
builder.put("auth", auth);
|
|
||||||
builder.put("ids", buildListString(ids));
|
builder.put("ids", buildListString(ids));
|
||||||
FileInfo[] info = invokeAndReturn(builder, FileInfo[].class);
|
FileInfo[] info = invokeAndReturn(builder, FileInfo[].class);
|
||||||
return info;
|
return info;
|
||||||
@@ -138,6 +137,14 @@ public class ApiClient {
|
|||||||
invokeAndReturn(builder, Success.class);
|
invokeAndReturn(builder, Success.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void favFile(String auth, int file, boolean fav) throws IOException, ApiException {
|
||||||
|
QueryBuilder builder = new QueryBuilder(ApiMethods.fav_file);
|
||||||
|
builder.put("auth", auth);
|
||||||
|
builder.put("id", file);
|
||||||
|
builder.put("fav", fav);
|
||||||
|
invokeAndReturn(builder, Success.class);
|
||||||
|
}
|
||||||
|
|
||||||
public void removeFile(String auth, int file) throws IOException, ApiException {
|
public void removeFile(String auth, int file) throws IOException, ApiException {
|
||||||
QueryBuilder builder = new QueryBuilder(ApiMethods.remove_file);
|
QueryBuilder builder = new QueryBuilder(ApiMethods.remove_file);
|
||||||
builder.put("auth", auth);
|
builder.put("auth", auth);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public class ApiMethods {
|
|||||||
public static final String get_thumbnail = "get_thumbnail";
|
public static final String get_thumbnail = "get_thumbnail";
|
||||||
public static final String remove_file = "remove_file";
|
public static final String remove_file = "remove_file";
|
||||||
public static final String rate_file = "rate_file";
|
public static final String rate_file = "rate_file";
|
||||||
|
public static final String fav_file = "fav_file";
|
||||||
public static final String check_auth = "check_auth";
|
public static final String check_auth = "check_auth";
|
||||||
public static final String get_language = "get_language";
|
public static final String get_language = "get_language";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,13 +11,14 @@ public class FileInfo {
|
|||||||
private int size;
|
private int size;
|
||||||
private int category;
|
private int category;
|
||||||
private int downloads;
|
private int downloads;
|
||||||
|
private int favorites;
|
||||||
private String name;
|
private String name;
|
||||||
private boolean thumbnail;
|
private boolean thumbnail;
|
||||||
|
|
||||||
|
|
||||||
public FileInfo(int id, ReplayMetaData metadata, String owner,
|
public FileInfo(int id, ReplayMetaData metadata, String owner,
|
||||||
Rating ratings, int size, int category, int downloads, String name,
|
Rating ratings, int size, int category, int downloads, String name,
|
||||||
boolean thumbnail) {
|
boolean thumbnail, int favorites) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.metadata = metadata;
|
this.metadata = metadata;
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
@@ -27,6 +28,7 @@ public class FileInfo {
|
|||||||
this.downloads = downloads;
|
this.downloads = downloads;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.thumbnail = thumbnail;
|
this.thumbnail = thumbnail;
|
||||||
|
this.favorites = favorites;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
@@ -57,6 +59,8 @@ public class FileInfo {
|
|||||||
return downloads;
|
return downloads;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getFavorites() { return favorites; }
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public class GuiReplayViewer extends GuiScreen implements GuiYesNoCallback {
|
|||||||
|
|
||||||
for(Pair<Pair<File, ReplayMetaData>, File> p : replayFileList) {
|
for(Pair<Pair<File, ReplayMetaData>, File> p : replayFileList) {
|
||||||
FileInfo fileInfo = new FileInfo(-1, p.first().second(), null, null,
|
FileInfo fileInfo = new FileInfo(-1, p.first().second(), null, null,
|
||||||
-1, -1, -1, FilenameUtils.getBaseName(p.first().first().getName()), true);
|
-1, -1, -1, FilenameUtils.getBaseName(p.first().first().getName()), true, -1);
|
||||||
replayGuiList.addEntry(fileInfo, p.second());
|
replayGuiList.addEntry(fileInfo, p.second());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user