mirror of
https://github.com/BlossomiShymae/clean-cuts.git
synced 2025-12-06 10:10:47 +01:00
Add companions (little legends) models
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Champion, ChampionSummary, Item, LocaleVersionArgs, Perk, SummonerEmote, SummonerIcon, WardSkin } from "./models";
|
||||
import { Champion, ChampionSummary, Item, LocaleVersionArgs, Perk, SummonerEmote, SummonerIcon, WardSkin, Companion } from './models';
|
||||
import axios from "axios";
|
||||
|
||||
export abstract class ApiObject {
|
||||
@@ -17,6 +17,7 @@ export class Client {
|
||||
public summonerEmotes: SummonerEmoteApi;
|
||||
public summonerIcons: SummonerIconApi;
|
||||
public wardSkins: WardSkinApi;
|
||||
public companions: CompanionsApi;
|
||||
|
||||
constructor() {
|
||||
this.items = new ItemApi();
|
||||
@@ -26,6 +27,7 @@ export class Client {
|
||||
this.summonerEmotes = new SummonerEmoteApi();
|
||||
this.summonerIcons = new SummonerIconApi();
|
||||
this.wardSkins = new WardSkinApi();
|
||||
this.companions = new CompanionsApi();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,4 +78,11 @@ export class WardSkinApi extends ApiObject {
|
||||
let res = await axios.get(`${this.getClientPath(args)}/v1/ward-skins.json`);
|
||||
return res.data.map((x: any) => new WardSkin(x));
|
||||
}
|
||||
}
|
||||
|
||||
export class CompanionsApi extends ApiObject {
|
||||
async listAsync(args: LocaleVersionArgs): Promise<Array<Companion>> {
|
||||
let res = await axios.get(`${this.getClientPath(args)}/v1/companions.json`);
|
||||
return res.data.map((x: any) => new Companion(x));
|
||||
}
|
||||
}
|
||||
@@ -291,4 +291,34 @@ export class Rarity extends CommunityDragonObject {
|
||||
this.region = json.region;
|
||||
this.rarity = json.rarity;
|
||||
}
|
||||
}
|
||||
|
||||
export class Companion extends CommunityDragonObject {
|
||||
contentId: string;
|
||||
itemId: number;
|
||||
name: string;
|
||||
loadoutsIcon: string;
|
||||
description: string;
|
||||
level: number;
|
||||
speciesName: string;
|
||||
speciesId: string;
|
||||
rarity: string;
|
||||
|
||||
constructor(json: any) {
|
||||
super();
|
||||
|
||||
this.contentId = json.contentId;
|
||||
this.itemId = json.itemId;
|
||||
this.name = json.name;
|
||||
this.loadoutsIcon = json.loadoutsIcon;
|
||||
this.description = json.description;
|
||||
this.level = json.level;
|
||||
this.speciesName = json.speciesName;
|
||||
this.speciesId = json.speciesId;
|
||||
this.rarity = json.rarity;
|
||||
}
|
||||
|
||||
getLoadoutsIcon(version: string): string {
|
||||
return this.resolveGamePath({path: this.loadoutsIcon, version: version});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user