bttmly / nba

Node.js client for nba.com API endpoints
MIT License
708 stars 173 forks source link

Update Docs #19

Closed brandly closed 8 years ago

brandly commented 8 years ago

I know you're aware of it, but I figured I'd open the issue.

One thing I think would be nice is including an example of the options under a method, so you can see how to call the method, but also click the URL to view an actual response.

Most of my use has been reading stats-endpoints, and then logging out responses to see what data I'm working with. If you're open to it, I could follow this workflow and write some docs. Let me know what you think!

bttmly commented 8 years ago

Sure thing, documentation contributions would be very welcome! I haven't had time to take a proper stab at it. The best place to start is with the integration tests actually, since there is a working example call for each method.

Next, if you create a directory called responses in the root of your clone, each of the stats methods tests will save a json file there with the full response body, which is handy to refer to. (Run npm test or make test in the root of the project). Finally, I just added a file called test/interactive.js. If you run it with node test/interactive.js, it'll run the tests but then attach a Node REPL where the responses are available so you can interactively play around with their shape. You can find the data by StatsData[methodName] or SportVuData[methodName]

Taking this a step further, it seems doable with the pieces here so far to do some kind of documentation generation -- at least for the simple part of saying "the object looks like this, with this key being a number, this key a string, this key an array of objects that look like such and such". In many cases the responses are pretty comprehensive and it'd be a pain (not to mention extremely error prone) to document them by hand.

bttmly commented 8 years ago

Upcoming version 3 of this library will have some decent documentation.

brandly commented 8 years ago

Excited for the new version! Excited for the new NBA season!!

On Monday, October 17, 2016, Nick Bottomley notifications@github.com wrote:

Closed #19 https://github.com/nickb1080/nba/issues/19.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nickb1080/nba/issues/19#event-825362095, or mute the thread https://github.com/notifications/unsubscribe-auth/AAyF2PzkGM3KQqa7OTH6eTLA3NDIPOIuks5q0ur7gaJpZM4HBxPm .

bttmly commented 8 years ago

several new endpoints are added in the v3 branch, plus various other improvements https://github.com/nickb1080/nba/tree/v3

bttmly commented 8 years ago

@brandly v3 is out! There are some autogenerated docs showing what parameters are accepted for the stats namespace. I'm working on better documentation for the other namespaces, as well as automatically generating docs the "shape" of each API response.

arjunblj commented 8 years ago

This is awesome @nickb1080 -- thanks!

brandly commented 8 years ago

great work @nickb1080! i've got an old version running in a chat bot, so i'll have to update soon