mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2025-01-31 19:40:14 +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;
|
||||
get([], [], 1);
|
||||
|
||||
function get(inventory, currency, step, start) {
|
||||
function get(inventory, currency, start) {
|
||||
self.httpRequest({
|
||||
"uri": "https://steamcommunity.com/inventory/" + userID.getSteamID64() + "/" + appID + "/" + contextID,
|
||||
"headers": {
|
||||
@ -311,8 +311,8 @@ SteamCommunity.prototype.getUserInventory = function(userID, appID, contextID, t
|
||||
}
|
||||
}
|
||||
|
||||
if(body.total_inventory_count > 5000 * step) {
|
||||
get(inventory, currency, step + 1, body.assets[body.assets.length - 1].assetid);
|
||||
if (body.more_items) {
|
||||
get(inventory, currency, body.last_assetid);
|
||||
} else {
|
||||
callback(null, inventory, currency, body.total_inventory_count);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user