lol-api-js
Version:
Integration package LoL Riot API and your typescript/javascript
46 lines (40 loc) • 1.21 kB
text/typescript
import axios from "axios";
import API from ".";
import { Metadata, Info, Team, Participant } from "./matchInterfaces";
import Summoner, { summonerData } from "./summoner";
export default class Match extends API{
metadata: Metadata;
info: Info;
constructor(api_key: string, dataPath: string, metadata: Metadata, info: Info) {
super(api_key, dataPath);
this.metadata = metadata;
this.info = info;
}
/**
* Returns an Array of strings containing the paths to champions .jpg.
*
* @remarks
* This method is part of lol-api-js package from the Match class
*
* @returns an Array of strings with champion images paths
*
* @example
* const match = new Match();
* match.getMatch(puuid);
* const arrayOfPathImgs = match.getChampionsIcons();
*/
getChampionsIcons = (): string[] => {
const champions = this.info.participants.map((object: Participant) => {
return `${this.dataPath}/img/champion/tiles/${object.championName}_0.jpg`;
});
return champions;
};
}
export interface jsonMatch {
metadata: {
dataVersion: string;
participants: string[];
matchId: string;
};
info: Info;
}