Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getPlayListsItemsById second parameter has incorrect documentation #43

Open
niklasHagner opened this issue Jan 28, 2018 · 0 comments
Open

Comments

@niklasHagner
Copy link

niklasHagner commented Jan 28, 2018

This function takes the params (id, maxResults, callback) .
But the comment incorrectly specifies them as id, id and callback.

The comment should be updated, changing the id to maxResults.

  /**
  * Playlists data from Playlist Id
  * @param {string} id
  * @param {int} id
  * @param {function} callback
  * https://developers.google.com/youtube/v3/docs/playlistItems/list
  */
  self.getPlayListsItemsById = function(id, maxResults, callback) {

    var validate = self.validate();
    
    if(typeof(maxResults) == "function"){
      callback = maxResults;
      maxResults = null;
    }

    if (validate !== null) {
      callback(validate);
    }
    else {
      self.clearParams();
      self.clearParts();

      self.addPart('contentDetails');
      self.addPart('id');
      self.addPart('snippet');
      self.addPart('status');

      self.addParam('part', self.getParts());
      self.addParam('playlistId', id);

      maxResults && self.addParam('maxResults', maxResults);

      self.request(self.getUrl('playlistItems'), callback);
    }
  };

https://github.com/nodenica/youtube-node/blob/129c1cbbc7a00331085392a6090cac83114e2ad9/lib/youtube.js

I see there are discussions here about changing the params for this function.

But I figure this is such a miniscule change that it might be worth doing in the meantime.

Just so no one else who reads the comments gets confused.
(which I did)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant