seripap / vainglory

(*DEPRECATED*: The API no longer exists, so this will no longer work) A Javascript API Client wrapper for Vainglory
MIT License
29 stars 7 forks source link

Add telemetry support #8

Closed nathancarter closed 7 years ago

nathancarter commented 7 years ago

Right now the parser.js file removes the included data from the match, which contains all the information about where to fetch the telemetry from an online URL. Please do not discard that information, so that the final match that the Vainglory JS API returns contains the telemetry information. Thanks!

seripap commented 7 years ago

I've added support for telemetry data with v1.0.0- it should work out of the box. Let me know if that works for you 👍

nathancarter commented 7 years ago

Just tested -- works great, thank you for the super-fast turnaround time!

seripap commented 7 years ago

Also just updated (v1.0.1) with a .resolve() helper that will return the data that is associated with the data URL.

const matchId = 'f5373c40-0aa9-11e7-bcff-0667892d829e';
vainglory.matches.single(matchId).then(async (match) => {
  const telemetry = await match.assets[0].resolve();
  console.log(telemetry);
}).catch((err) => console.error(err));

👍

nathancarter commented 7 years ago

Without await, is that just match.assets[0].resolve((telemetry) => doStuff(telemetry));?

seripap commented 7 years ago

it's just a promise, so something like;

match.assets[0].resolve().then(telemetry => doStuff(telemetry));
nathancarter commented 7 years ago

Ah, right, thanks!