mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2025-04-01 21:30:11 +08:00
Added better paging controls for new inventory endpoint
This commit is contained in:
parent
9a3cf927c0
commit
d367e8eae4
@ -267,7 +267,7 @@ SteamCommunity.prototype.getUserInventory = function(userID, appID, contextID, t
|
|||||||
var pos = 1;
|
var pos = 1;
|
||||||
get([], [], 1);
|
get([], [], 1);
|
||||||
|
|
||||||
function get(inventory, currency, step, start) {
|
function get(inventory, currency, start) {
|
||||||
self.httpRequest({
|
self.httpRequest({
|
||||||
"uri": "https://steamcommunity.com/inventory/" + userID.getSteamID64() + "/" + appID + "/" + contextID,
|
"uri": "https://steamcommunity.com/inventory/" + userID.getSteamID64() + "/" + appID + "/" + contextID,
|
||||||
"headers": {
|
"headers": {
|
||||||
@ -311,8 +311,8 @@ SteamCommunity.prototype.getUserInventory = function(userID, appID, contextID, t
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(body.total_inventory_count > 5000 * step) {
|
if (body.more_items) {
|
||||||
get(inventory, currency, step + 1, body.assets[body.assets.length - 1].assetid);
|
get(inventory, currency, body.last_assetid);
|
||||||
} else {
|
} else {
|
||||||
callback(null, inventory, currency, body.total_inventory_count);
|
callback(null, inventory, currency, body.total_inventory_count);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user