try manually paging
This commit is contained in:
+17
-1
@@ -717,6 +717,19 @@ public class MembershipManager {
|
|||||||
*/
|
*/
|
||||||
protected List<JsonObject> fetchAllOrderPositions(String path, MultiValueMap<String, String> queryParams,
|
protected List<JsonObject> fetchAllOrderPositions(String path, MultiValueMap<String, String> queryParams,
|
||||||
List<JsonObject> result) {
|
List<JsonObject> result) {
|
||||||
|
return fetchAllOrderPositions(path, queryParams, result, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch all order positions.
|
||||||
|
*
|
||||||
|
* @param path the path
|
||||||
|
* @param queryParams the query params
|
||||||
|
* @param result the result
|
||||||
|
* @return the list
|
||||||
|
*/
|
||||||
|
protected List<JsonObject> fetchAllOrderPositions(String path, MultiValueMap<String, String> queryParams,
|
||||||
|
List<JsonObject> result, int page) {
|
||||||
JsonElement response = pretixManager.request(path, HttpMethod.GET, queryParams);
|
JsonElement response = pretixManager.request(path, HttpMethod.GET, queryParams);
|
||||||
|
|
||||||
if (response == null) {
|
if (response == null) {
|
||||||
@@ -732,7 +745,10 @@ public class MembershipManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (orderPositions.has("next") && !orderPositions.get("next").isJsonNull()) {
|
if (orderPositions.has("next") && !orderPositions.get("next").isJsonNull()) {
|
||||||
return fetchAllOrderPositions(orderPositions.get("next").getAsString(), new LinkedMultiValueMap<String, String>(), result);
|
page += 1;
|
||||||
|
queryParams.remove("page");
|
||||||
|
queryParams.set("page", String.valueOf(page));
|
||||||
|
return fetchAllOrderPositions(path, queryParams, result, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("results: " + result.size() + " ? " + queryParams.getFirst("item"));
|
logger.debug("results: " + result.size() + " ? " + queryParams.getFirst("item"));
|
||||||
|
|||||||
Reference in New Issue
Block a user