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

cant get data for master release #65

Closed MartinBarker closed 4 years ago

MartinBarker commented 4 years ago

hello, I've been looking for a way to get info from a discogs url on my node.js webpage. Previously I was just doing a GET request for the api url, that worked fine but had a rate limit of like 3 per minute which was very slow. This package is alot faster and more reliable, but it only works for release codes?

I know the function getReleases, and I can use it successfully with release URL's like so:

//url = https://www.discogs.com/Malcolm-McLaren-Duck-Rock/release/29852
//so code = 29852
  db.getRelease(29852, function(err, resp){
    console.log('resp = ', resp)

    //if err message is present return that, else return full response 
    if(resp.message){
      res.status(400).send(resp.message)
    }else{
      res.status(200).send(resp)
    }
  });

This returns data for the release ID page 29852 correctly. But If I have a master url, like:

https://www.discogs.com/Malcolm-McLaren-Duck-Rock/master/68613

Is there any way I can get metadata info for the master release itself? My master release code is 68613.

Like a db.getMaster(68613,function(err, resp){ function, or a way to choose the first release code under a master.

@bartve im not too familiar with this package but would love to help and add this feature. do you think it would just require copying the getRelease function declaration here but with getMaster ?

 database.getMaster = function(masterCode callback) {
        return client.get('/master/' + masterCode, callback);
    };
MartinBarker commented 4 years ago

nvm appears that getMaster() works,