diff --git a/README.md b/README.md index cf898f3..72ad2a9 100644 --- a/README.md +++ b/README.md @@ -86,8 +86,6 @@ There are three more premade configurations provided: is the same as `TeemoJS.defaultConfig` but without any `endpoints`. - [`TeemoJS.championGGConfig`](https://github.com/MingweiSamuel/TeemoJS/blob/master/championGGConfig.json) is a configuration for the [Champion.GG API](http://api.champion.gg/). Oh, by the way, TeemoJS also supports the Champion.GG API. -- [`TeemoJS.defaultV3Config`](https://github.com/MingweiSamuel/TeemoJS/blob/master/defaultV3Config.json) -for old V3 endpoints being removed at the end of January 2019. - (`TeemoJS.ddragonConfig` TODO) Champion.GG Example: diff --git a/defaultConfig.json b/defaultConfig.json index 6eea001..6041a1f 100644 --- a/defaultConfig.json +++ b/defaultConfig.json @@ -68,6 +68,24 @@ "getByPUUID": "/lol/summoner/v4/summoners/by-puuid/%s", "getBySummonerId": "/lol/summoner/v4/summoners/%s" }, + "tftLeague": { + "getChallengerLeague": "/tft/league/v1/challenger", + "getLeagueEntriesForSummoner": "/tft/league/v1/entries/by-summoner/%s", + "getLeagueEntries": "/tft/league/v1/entries/%s/%s", + "getGrandmasterLeague": "/tft/league/v1/grandmaster", + "getLeagueById": "/tft/league/v1/leagues/%s", + "getMasterLeague": "/tft/league/v1/master" + }, + "tftMatch": { + "getMatchIdsByPUUID": "/tft/match/v1/matches/by-puuid/%s/ids", + "getMatch": "/tft/match/v1/matches/%s" + }, + "tftSummoner": { + "getByAccountId": "/tft/summoner/v1/summoners/by-account/%s", + "getBySummonerName": "/tft/summoner/v1/summoners/by-name/%s", + "getByPUUID": "/tft/summoner/v1/summoners/by-puuid/%s", + "getBySummonerId": "/tft/summoner/v1/summoners/%s" + }, "thirdPartyCode": { "getThirdPartyCodeBySummonerId": "/lol/platform/v4/third-party-code/by-summoner/%s" } diff --git a/gen.js b/gen.js index d5cd481..9f9c2af 100644 --- a/gen.js +++ b/gen.js @@ -6,7 +6,6 @@ const fs = Promise.promisifyAll(require("fs")); const { JSDOM } = require("jsdom"); let defaultConfig = require('./emptyConfig.json'); -let defaultV3Config = JSON.parse(JSON.stringify(defaultConfig)); req('https://developer.riotgames.com/api-methods/') .then(body => { @@ -25,8 +24,7 @@ req('https://developer.riotgames.com/api-methods/') return Promise.props(endpoints); }) .then(endpoints => { - let resV4 = {}; - let resV3 = {}; + let res = {}; for (let [name, body] of Object.entries(endpoints)) { let camelName = ''; let tokens = name.split('-'); @@ -37,10 +35,7 @@ req('https://developer.riotgames.com/api-methods/') console.log(camelName); let endpoint = {}; - if ('v3' === version) { - resV3[camelName] = endpoint; - } - resV4[camelName] = endpoint; + res[camelName] = endpoint; let data = JSON.parse(body); let dom = new JSDOM(data.html); @@ -53,11 +48,9 @@ req('https://developer.riotgames.com/api-methods/') endpoint[opName] = path; } } - defaultConfig.endpoints = resV4; - defaultV3Config.endpoints = resV3; + defaultConfig.endpoints = res; return Promise.all([ fs.writeFileAsync('defaultConfig.json', JSON.stringify(defaultConfig, null, 2)), - fs.writeFileAsync('defaultV3Config.json', JSON.stringify(defaultV3Config, null, 2)) ]); }); // .then(res => fs.writeFileAsync('defaultConfig.json', JSON.stringify(res, null, 2)));