fantasydata / fantasydata-api-node

FantasyData API client library wrapper for Node
MIT License
23 stars 8 forks source link

MLBv3StatsClient.getPlayersPromise() returns empty array #1

Closed mbonig closed 6 years ago

mbonig commented 6 years ago

This code, ran in node -v: v8.9.0

const fdClientModule = require('fantasydata-node-client');

const keys = {
  'MLBv3StatsClient': 'xxxx'
};
const FantasyDataClient = new fdClientModule(keys);

const playersPromise = FantasyDataClient.MLBv3StatsClient.getPlayersPromise();

playersPromise
  .then((resp) => {
    console.log(resp);

  })
  .catch(err => console.error(err));

results as printed:

[]

When I run it in the developers portal, I get results (after a LONG hang, but they get there)

Would have expected to get a non-empty array.

neipo13 commented 6 years ago

Yeah, an empty array is definitely not what we were looking for here.

Reproducing this was simple with the code you posted. Looks like function naming was bad, two calls both called getPlayersPromise but with different parameters. It was trying to use the get players by team version with null for the team. Quite possible this same bug is happening elsewhere. I'll correct our generation to take this into account and hopefully have a new version out soon.

Thanks @mbonig for passing this along.

neipo13 commented 6 years ago

This issue is now resolved as of e924ef423aaa0daaebc066e9ae6076fc829cb7fa. We adjusted the naming conventions to be unique (and maybe a bit wordy).

@mbonig important to note that many function names will have changed (getPlayersPromise became getPlayerDetailsByActivePromise)

mbonig commented 6 years ago

Great, I'll give it a try, thanks!

mbonig commented 6 years ago

That call works better now. Thanks.