Skip to content

Latest commit

 

History

History
122 lines (83 loc) · 1.84 KB

File metadata and controls

122 lines (83 loc) · 1.84 KB

Wild Rift Champions API Reference

This document describes the main API for the Wild Rift Champions API library.


Types

ChampionHeader

interface ChampionHeader {
	id: string;
	name: string;
	image_url: string;
}

Basic champion info.


Ability

interface Ability {
	name: string;
	icon_url: string;
	video_url: string;
	description: string;
	ability_type: AbilityType;
}

Represents a champion's ability.


Skin

interface Skin {
	name: string;
	image_url: string;
}

Represents a champion skin.


Champion

interface Champion extends ChampionHeader {
	role: string;
	skins: Skin[];
	intro_video_url: string;
	difficulty: number;
	abilities: Record<AbilityType, Ability>;
}

Full champion details.


Functions

fetchChampionHeaders

fetchChampionHeaders(): Promise<ChampionHeader[]>

Fetches all champion headers (basic info).


fetchChampion

fetchChampion(champion: ChampionHeader): Promise<Champion>

Fetches full champion details from a given header.

Throws:

  • Error if a network or parsing error occurs.

Example Usage

import { fetchChampionHeaders, fetchChampion } from "wildrift-champions-api";

async function example() {
	const headers = await fetchChampionHeaders();
	const ahriHeader = headers.find((c) => c.id === "ahri");
	if (ahriHeader) {
		const ahri = await fetchChampion(ahriHeader);
		console.log(ahri.name, ahri.role, ahri.abilities);
	}
}

Error Handling

  • All fetch functions throw an Error if a network or parsing error occurs.
  • Use try/catch to handle errors gracefully.

See Also