aknorw / discojs

Easiest way to use the Discogs API in Javascript/Typescript :musical_note:
https://aknorw.github.io/discojs
MIT License
63 stars 9 forks source link

Is there a way to get all the items in my collection #2

Closed thibmaek closed 6 years ago

thibmaek commented 6 years ago

Hi, I tried going through the documentation but only found a way to get my "All" folder and seller inventory. Is there a way to get the records in my collection?

aknorw commented 6 years ago

Hi, It's possible to achieve what you want with the API, but unfortunately I didn't implement (yet) some functions that are required to achieve this with discojs. Will definitely add the missing parts asap.

Here's the code that should work once the changes are made :

client.getIdentity()
  .then(({ username }) => {
    client.listFoldersForUser(username)
      .then(({ folders }) => {
        const allFolder = folders.find(folder => folder.name === 'All')
        client.getReleasesInFolder(username, allFolder.id) // Not yet implemented
          .then((releases) => {
            // ...
          })
      })
  })

Thanks for catching this !

thibmaek commented 6 years ago

Cool, if you want I can also take a look at it and create a PR?

aknorw commented 6 years ago

That would be great, but I have to (re)work a little on the project before :

aknorw commented 6 years ago

Hi, Just updated the library to include the method getItemsInFolderForUser. I'm closing this issue, let me know if you're having trouble. Cheers, Antoine

thibmaek commented 6 years ago

Nice!