lol-api-js
Version:
Integration package LoL Riot API and your typescript/javascript
54 lines (49 loc) • 8.93 kB
HTML
<html class="default no-js"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>lol-api-js</title><meta name="description" content="Documentation for lol-api-js"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script async src="assets/search.js" id="search-script"></script></head><body><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base="."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">lol-api-js</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label><input type="checkbox" id="tsd-filter-externals" checked/><label class="tsd-widget" for="tsd-filter-externals">Externals</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><h1> lol-api-js</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><div class="tsd-panel tsd-typography">
<a href="#lol-api-js" id="lol-api-js" style="color: inherit; text-decoration: none;">
<h1>lol-api-js</h1>
</a>
<a href="#a-wrapper-framework-for-fetching-data-from-the-riot-games-league-of-legends-api-using-typescript" id="a-wrapper-framework-for-fetching-data-from-the-riot-games-league-of-legends-api-using-typescript" style="color: inherit; text-decoration: none;">
<h3>A wrapper framework for fetching data from the Riot Games League of Legends API using typescript.</h3>
</a>
<p><em>Created by Ricardo Bohadana Martins, september 2021.</em></p>
<p>The lol-api-js package is a wrapper framework for working with data fetched from the Riot Games League of Legends API. It also uses the <em>datadragon</em> static files to provide easy management of game images and icons.</p>
<p>At the moment, the development requeires the following packages, listed in the <em>package.json</em> file:</p>
<ul>
<li>chai</li>
<li>mocha</li>
<li>axios</li>
<li>chai</li>
<li>mocha</li>
<li>ts-node</li>
<li>typedoc</li>
<li>typescript</li>
</ul>
<a href="#framework-features" id="framework-features" style="color: inherit; text-decoration: none;">
<h3>Framework features</h3>
</a>
<p>This package features 3 major javascript/typescript classes:</p>
<a href="#the-api-class" id="the-api-class" style="color: inherit; text-decoration: none;">
<h5>The API class</h5>
</a>
<p>Consists of a class to setup your project.
You must initialize this class at the start of your project with your Riot Developer API Key and the base path for your local <em>datadragon</em> folder
From version 1.0.1 and forwards, the API class has become the main class for making requests. From this class, you can retrieve a Summoner object and a Match Object.</p>
<p><strong>Example:</strong></p>
<pre><code class="language-javascript"><span class="hl-0">var</span><span class="hl-1"> </span><span class="hl-2">api</span><span class="hl-1"> = </span><span class="hl-0">new</span><span class="hl-1"> </span><span class="hl-3">API</span><span class="hl-1">(</span><span class="hl-4">"you key here"</span><span class="hl-1">, </span><span class="hl-4">"datadragon path here"</span><span class="hl-1">);</span><br/><span class="hl-0">var</span><span class="hl-1"> </span><span class="hl-2">summoner</span><span class="hl-1"> = </span><span class="hl-2">api</span><span class="hl-1">.</span><span class="hl-3">getSummoner</span><span class="hl-1">(</span><span class="hl-4">"summonerName"</span><span class="hl-1">);</span><br/><span class="hl-5">// type of summoner = Summoner object</span>
</code></pre>
<a href="#the-summoner-class" id="the-summoner-class" style="color: inherit; text-decoration: none;">
<h5>The Summoner class</h5>
</a>
<p>Consists of a class to retrieve summoner information after the API class call to the Riot Games League of Legends API.</p>
<p>Example:</p>
<pre><code class="language-javascript"><span class="hl-0">var</span><span class="hl-1"> </span><span class="hl-2">api</span><span class="hl-1"> = </span><span class="hl-0">new</span><span class="hl-1"> </span><span class="hl-3">API</span><span class="hl-1">(</span><span class="hl-4">"you key here"</span><span class="hl-1">, </span><span class="hl-4">"datadragon path here"</span><span class="hl-1">);</span><br/><span class="hl-0">var</span><span class="hl-1"> </span><span class="hl-2">summoner</span><span class="hl-1"> = </span><span class="hl-2">api</span><span class="hl-1">.</span><span class="hl-3">getSummoner</span><span class="hl-1">(</span><span class="hl-4">"summonerName"</span><span class="hl-1">);</span><br/><span class="hl-0">var</span><span class="hl-1"> </span><span class="hl-2">icon_path</span><span class="hl-1"> = </span><span class="hl-2">summoner</span><span class="hl-1">.</span><span class="hl-3">getProfileIcon</span><span class="hl-1">();</span><br/><span class="hl-5">// type of icon_path = string containing the path to a profile icon</span>
</code></pre>
<a href="#the-match-class" id="the-match-class" style="color: inherit; text-decoration: none;">
<h5>The Match class</h5>
</a>
<p>Consists of a class to retrieve match information from the Riot Games League of Legends API.
You need a matchId to fetch for match information, and you can get those matchIds for a given summoner name with a Summoner class object.</p>
<p>Example:</p>
<pre><code class="language-javascript"><span class="hl-0">var</span><span class="hl-1"> </span><span class="hl-2">api</span><span class="hl-1"> = </span><span class="hl-0">new</span><span class="hl-1"> </span><span class="hl-3">API</span><span class="hl-1">(</span><span class="hl-4">"you key here"</span><span class="hl-1">, </span><span class="hl-4">"datadragon path here"</span><span class="hl-1">);</span><br/><span class="hl-0">var</span><span class="hl-1"> </span><span class="hl-2">summoner</span><span class="hl-1"> = </span><span class="hl-2">api</span><span class="hl-1">.</span><span class="hl-3">getSummoner</span><span class="hl-1">(</span><span class="hl-4">"summonerName"</span><span class="hl-1">);</span><br/><span class="hl-0">var</span><span class="hl-1"> </span><span class="hl-2">match</span><span class="hl-1"> = </span><span class="hl-2">summoner</span><span class="hl-1">.</span><span class="hl-3">getMatch</span><span class="hl-1">(</span><span class="hl-2">summoner</span><span class="hl-1">.</span><span class="hl-2">matchIds</span><span class="hl-1">[</span><span class="hl-6">0</span><span class="hl-1">]);</span><br/><span class="hl-5">// type of match = Match object</span>
</code></pre>
</div></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class="current"><a href="modules.html">Modules</a></li><li class=" tsd-kind-module"><a href="modules/championMastery.html">champion<wbr/>Mastery</a></li><li class=" tsd-kind-module"><a href="modules/index.html">index</a></li><li class=" tsd-kind-module"><a href="modules/league.html">league</a></li><li class=" tsd-kind-module"><a href="modules/summoner.html">summoner</a></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="assets/main.js"></script></body></html>