Closed jordzhu closed 7 years ago
Hey @jordzhu, thanks for the issue!
So I've briefly described how each method works here. It might be kind of confusing though, so I'll try to re-explain.
Each method takes 2 optional arguments – query
and cb
. The first argument is the one that should contain the URL/request parameters (i.e. year
for this method).
nba.data.team({ year: '2016' }, function(err, res) {
if (err) {
console.error(err);
return;
}
console.log(res);
});
The documentation for data
endpoint parameters is incomplete right now, so if you're looking for some sort of specification for a parameter, feel free to ask away (most should be intuitive). It'll be updated very soon.
There are a few examples here, but it isn't as comprehensive as it should/can be 😅. That'll be updated very soon as well.
The example you gave definitely helped. Looking forward to future updates, I think some more documentation will be very helpful. Either way great job man!
Thanks dude! This helped a lot, I agree with sharpar :)
I'm not sure if I'm doing something wrong or not, but when I call currentScoreboard, it doesn't show the current scores.
nba.data.currentScoreboard(function(err, res) {
if (err) {
console.error(err);
return;
}
console.log(res);
});
Output:
{ games: [], numGames: 0 }
Also for scoreboard, what format is the date parameter supposed to be in?
For scoreboard the date format is 'yyyy-mm-dd' so something like 20161027
.
As for the currentScoreboard endpoint it doesn't seem to be working.
@sharpar Yeah, looks like the currentScoreboard
endpoint is returning nothing right now. I'm not entirely sure that this ever worked (might've just assumed it does, since it doesn't error out), going to keep it around for the time being.
@WataruKay is right about the date
format, should be of the form "yyyymmdd"
.
Got a PR in the works (https://github.com/kshvmdn/nba.js/pull/11) for the data parameter references.
Should be merged soon (missing some information for teamUrlCode
/ seasonScheduleYear
right now, would love some help 😄).
I just got all the teamurls valid for endpoints that use teamUrlCode
'hawks', 'fcbarcelona', 'celtics', 'nets', 'san_lorenzo', 'hornets', 'bulls', 'cavaliers', 'mavericks', 'nuggets', 'pistons', 'warriors', 'maccabi_haifa', 'rockets', 'pacers', 'clippers', 'lakers', 'grizzlies', 'heat', 'bucks', 'timberwolves', 'pelicans', 'knicks', 'thunder', 'magic', 'sixers', 'suns', 'blazers', 'real_madrid', 'kings', 'spurs', 'shanghai_sharks', 'raptors', 'jazz', 'wizards'
Should I wait for #11 to be merged then make a new pull request?
@WataruKay Awesome! And sure, let me merge that right now. Also note that I've changed a few of the parameter names (including teamUrlCode
), refer to https://github.com/kshvmdn/nba.js/commit/88c7d76e2b3958a49511cb02ea5358eafe29003a for more info.
I've submitted #12 with the 'teamName' values.
What would an example of using parameters look like? I'm just not really understanding the syntax (for example, the teams method has the parameter year)
Thanks!