arei / node-untappd

NodeJS API for Untappd

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing options for some api endpoints

spoike opened this issue · comments

There are some options that are not passed on, e.g. the user activity feed has a since_id option that would generate less data over the wire when polling the feed. Only limit and max_id is supported.

It'd be nice if you could just pass the params in an object to the function instead. Like this:

untappd.userFeed(cb, user_name, {
  since_id: last_id,
  limit: 5
});

That way you won't need to maintain the params if new ones show up in the API and this lib can instead just stringify the params instead of what is currently done:

that.userFeed = function(callback, lookupUser, params) {
    // snip-snip guard statements
    return get("/v4/user/checkins/"+lookupUser, QS.stringify(params), callback);
}

Agreed. A PR would be welcome.

See the two PRs #9 and #10 for solving this. I know the diff is quite large but I think the refactoring prevents this same type of issue from being reopened in the future by allowing an object of key's and values instead of explicitly declaring them.

Alright, despite screwing up the merge and having to do it by hand, I think I got this merged in. Please take a look and let me know if I missed something else. Also published new version to NPM.