whatadewitt / yahoo-fantasy-sports-api

NodeJS wrapper for the Yahoo! Fantasy Sports API
https://yahoo-fantasy-node-docs.vercel.app/
MIT License
200 stars 54 forks source link

Collections > League > Fetch - Subresource Scoreboard Only Returns Last in Array of Scoreboards #110

Open bryanmenke opened 9 months ago

bryanmenke commented 9 months ago

Leveraging the Collections > League > Fetch resource and adding the subresource of scoreboard does not return all matchups for NFL leagues, only the last matchup of the week.

Response object for scoreboard:

scoreboard: {
  matchups: [
    {
      week: "16",
      ...
    },
    {
      week: "16",
      ...
    },
    ...
  ],
}

However, by contrast the Resources > League > Scoreboard pulls back all weeks as expected.

Response Object is an array of Matchups for each week of the season:

scoreboards: [
  { matchups: Array(5), week: '1' },
  { matchups: Array(5), week: '2' },
  { matchups: Array(5), week: '3' },
  ...
]

I would expect these two responses to be identical. I'm able to work around by not including the scoreboard sub-resource and making a subsequent call for each league to get Scoreboards the second way.

Unfortunately all my leagues are private so I can't provide any specific league key examples, but I imagine this applies for any NFL league.

Thanks for developing this library and your continued support!

@whatadewitt

whatadewitt commented 9 months ago

There are a few different spots in their API where things just don't make sense like this and you have to do things with multiple calls that you'd think should only take one.

That said, can you try using a "matchups" sub-resource and see if it returns anything? I can give it a shot later today, but working the day job at the moment :D

whatadewitt commented 9 months ago

"Invalid subresource matchups requested"

Dammit... looks like it isn't exposed...

bryanmenke commented 9 months ago

@whatadewitt Sorry for reporting this then going dark there. holidays and family had illnesses run through. Seems like your library intends for this to return all leagues scoreboards and not just the last one in the array. Would be nice if it could do that more efficiently than calling scoreboards endpoint 1 by 1 for each league. Hope you are well! Appreciate you looking at this one.

whatadewitt commented 8 months ago

Unfortunately I am at the mercy of what Yahoo! allows. If you wanted to check here if what you're looking for is possible, I could try to implement it...

https://developer.yahoo.com/fantasysports/guide/