bartve / disconnect

An easy to use Node.js client with OAuth support to connect with the discogs.com API v2.0
MIT License
458 stars 79 forks source link

sorting releases from marketplace #51

Closed Shnass closed 5 years ago

Shnass commented 5 years ago

I can't see the examples of using the marketplace. I'm trying to get only the recently added records from the store, is it possible?

bartve commented 5 years ago

You can set sorting params for a marketplace inventory: https://www.discogs.com/developers/#page:marketplace,header:marketplace-inventory

So that would result into something like this to show the 10 most recent listings for user 'USER_NAME' (not tested!):

var marketplace = new Discogs().marketplace();
var params = {sort: 'listed', sort_order: 'desc', page: 1, per_page: 10};
marketplace.getInventory('USER_NAME', params, function(err, data){
    console.log(data);
});