Skip to content
forked from pacexy/poro

Integrate official Riot's League of Legends API with Leaguepedia API.

License

Notifications You must be signed in to change notification settings

igormaraujo/poro

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

poro

I will continue to develop this repo next month:)

Integrate official Riot's League of Legends API with Leaguepedia API.

Install

npm i poro

Usage

const { leaguepedia, riot } = require('poro')

// It is recommended to use await in an async function.
const matchSchedule = await leaguepedia.fetchMatchSchedule({
  where: [2020, 'LCS', 'Summer']
})
console.log(matchSchedule)

// You can also use callback instead.
leaguepedia.fetchMatchSchedule(, , (err, data) => {
  console.log(data)
})

Parameters

In Cargo query, you can see the parameters needed for a query.

In the implement of Poro, you don't need to specify fields, it will always return all fields in a table. If you want to see all fields of a table, go to Cargo tables,

Every fetcher has the same declaration, just like:

function fetchSomethingInLeaguepedia(parameter, callback) {
  ...
}

All parameters for a query are placed in parameter.

where can be a string (should meet SQL syntax) or an array of string (means keywords in _pageName). Use string when your query condition is complex.

parameter: {
  where?: string | string[]
  joinOn?: string
  groupBy?: string | string[]
  having?: string
  orderBy?: string | object | (string | object)[]
  limit?: number // default Number.MAX_SAFE_INTEGER
  offset?: number // default 0
  format?: string // default 'json'
}

Example

const matchSchedule = await leaguepedia.fetchMatchSchedule({
  where: `_pageName LIKE "%2020%" AND Team1 = "G2" OR MatchDay > 10`,
  groupBy: ['Team1', 'Team2'],
  orderBy: [{ field: 'DateTime_UTC', type: 'DESC' }, '_pageName'],
  limit: 100,
  offset: 50,
})

About

Integrate official Riot's League of Legends API with Leaguepedia API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 95.3%
  • Nunjucks 4.4%
  • JavaScript 0.3%