Skip to content

Instantly share code, notes, and snippets.

@xylude
Created July 21, 2017 12:02
Show Gist options
  • Save xylude/1c38fcd8d08ede96975af5ef7155b233 to your computer and use it in GitHub Desktop.
Save xylude/1c38fcd8d08ede96975af5ef7155b233 to your computer and use it in GitHub Desktop.
var userList = [];
function getUsers(page, cb) {
management.users.getAll({per_page: 50, page: page},function (err, users) {
if(!err) {
if (users.length > 0) {
userList = userList.concat(users);
getUsers(page + 1, cb);
} else {
if(cb) {
cb(true)
}
}
} else {
console.log(err);
cb(false)
}
})
}
getUsers(0, err => {
console.log(JSON.stringify(userList, null, 4));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment