mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Use JSON version 2 API for MwQueryResponse responses (#2816)
This commit is contained in:
parent
01696ccc0e
commit
23c23cc9fc
3 changed files with 16 additions and 6 deletions
|
|
@ -238,6 +238,7 @@ public class OkHttpJsonApiClient {
|
|||
.newBuilder()
|
||||
.addQueryParameter("action", "query")
|
||||
.addQueryParameter("format", "json")
|
||||
.addQueryParameter("formatversion", "2")
|
||||
.addQueryParameter("titles", titles);
|
||||
|
||||
if (useGenerator) {
|
||||
|
|
@ -293,7 +294,8 @@ public class OkHttpJsonApiClient {
|
|||
.parse(commonsBaseUrl)
|
||||
.newBuilder()
|
||||
.addQueryParameter("action", "query")
|
||||
.addQueryParameter("format", "json");
|
||||
.addQueryParameter("format", "json")
|
||||
.addQueryParameter("formatversion", "2");
|
||||
|
||||
|
||||
if (queryType.equals("search")) {
|
||||
|
|
@ -408,6 +410,7 @@ public class OkHttpJsonApiClient {
|
|||
.newBuilder()
|
||||
.addQueryParameter("action", "query")
|
||||
.addQueryParameter("format", "json")
|
||||
.addQueryParameter("formatversion", "2")
|
||||
.addQueryParameter("list", "recentchanges")
|
||||
.addQueryParameter("rcstart", DateUtils.formatMWDate(startDate))
|
||||
.addQueryParameter("rcnamespace", FILE_NAMESPACE)
|
||||
|
|
@ -442,6 +445,7 @@ public class OkHttpJsonApiClient {
|
|||
.newBuilder()
|
||||
.addQueryParameter("action", "query")
|
||||
.addQueryParameter("format", "json")
|
||||
.addQueryParameter("formatversion", "2")
|
||||
.addQueryParameter("prop", "revisions")
|
||||
.addQueryParameter("rvprop", "timestamp|ids|user")
|
||||
.addQueryParameter("titles", filename)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import fr.free.nrw.commons.media.model.MwQueryPage;
|
|||
public class MwQueryResult {
|
||||
@SuppressWarnings("unused")
|
||||
@Nullable
|
||||
private HashMap<String, MwQueryPage> pages;
|
||||
private List<MwQueryPage> pages;
|
||||
private List<RecentChange> recentchanges;
|
||||
|
||||
@NonNull
|
||||
|
|
@ -21,7 +21,7 @@ public class MwQueryResult {
|
|||
if (pages == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return new ArrayList<>(pages.values());
|
||||
return pages;
|
||||
}
|
||||
|
||||
public List<RecentChange> getRecentchanges() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue