{"id":19529583,"url":"https://github.com/pacexy/poro","last_synced_at":"2025-04-26T11:35:23.877Z","repository":{"id":38320455,"uuid":"273759017","full_name":"pacexy/poro","owner":"pacexy","description":"API of Leaguepedia and League of Legends","archived":false,"fork":false,"pushed_at":"2024-04-09T04:48:12.000Z","size":1501,"stargazers_count":18,"open_issues_count":12,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-31T15:53:22.576Z","etag":null,"topics":["communitydragon","data-dragon","hextech","league-of-legends","leaguepedia"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pacexy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-06-20T18:00:02.000Z","updated_at":"2024-10-04T15:49:40.000Z","dependencies_parsed_at":"2023-11-26T06:31:30.610Z","dependency_job_id":"dcc3f63f-d924-499a-a687-799e859a3727","html_url":"https://github.com/pacexy/poro","commit_stats":{"total_commits":155,"total_committers":3,"mean_commits":"51.666666666666664","dds":0.06451612903225812,"last_synced_commit":"50e2291837fdf34f546fb15c1dc64321b1cb7e7a"},"previous_names":[],"tags_count":47,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacexy%2Fporo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacexy%2Fporo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacexy%2Fporo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacexy%2Fporo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pacexy","download_url":"https://codeload.github.com/pacexy/poro/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224034221,"owners_count":17244751,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["communitydragon","data-dragon","hextech","league-of-legends","leaguepedia"],"created_at":"2024-11-11T01:26:05.751Z","updated_at":"2024-11-11T01:26:06.720Z","avatar_url":"https://github.com/pacexy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# poro\n\n- Leaguepedia API\n- Riot League of Legends API\n- Community Dragon\n- Data Dragon\n\n## Install\n\n```sh\nnpm i poro\n```\n\n## Usage\n\n### Leaguepedia\n\n```ts\nimport { CargoClient } from 'poro'\n\nconst cargo = new CargoClient()\n// specify fields\nconst teams = await cargo.query({\n  tables: ['Teams'],\n  fields: ['Teams.Name', 'Teams.Region'],\n})\n// filter\nconst g2 = await cargo.query({\n  tables: ['Teams'],\n  where: 'Teams.Name = \"G2 Esports\"',\n})\n// join on\nconst broadcastMusicUsages = await cargo.query({\n  tables: ['BroadcastMusicUsages', 'BroadcastMusicTracks'],\n  joinOn: [\n    {\n      left: 'BroadcastMusicUsages.TrackID',\n      right: 'BroadcastMusicTracks.TrackID',\n    },\n  ],\n})\n// group\nconst proplayers = await cargo.query({\n  tables: ['Pentakills'],\n  groupBy: ['Pentakills.Name'],\n  having: 'COUNT(DateDisplay) \u003e 10',\n})\n```\n\n### Riot\n\n```ts\nimport { RiotClient, Riot } from 'poro'\n\nconst riot = new RiotClient({\n  auth: 'RIOT-API-KEY',\n  platform: Riot.Platform.KR,\n  region: Riot.Region.ASIA,\n})\nconst leagueEntries = await riot\n  .path('/lol/league-exp/v4/entries/{queue}/{tier}/{division}', {\n    queue: Riot.Queue.RANKED_SOLO_5x5,\n    tier: Riot.Tier.CHALLENGER,\n    division: Riot.Division.I,\n  })\n  .get({ query: { page: 1 } })\n```\n\n### General Data\n\n```ts\nimport { general, Riot } from 'poro'\n\n// https://static.developer.riotgames.com/docs/lol/gameModes.json\nconst gameModes = await axios\u003cRiot.General.GameModes\u003e(general.doc('gameModes'))\n\n// https://ddragon.leagueoflegends.com/realms/na.json\nconst realm = await axios\u003cRiot.General.Realm\u003e(general.realm('na'))\n```\n\n### Data Dragon\n\n```ts\nimport { DataDragon, Riot } from 'poro'\n\nconst ddragon = new DataDragon('11.16.1', 'en_US')\n\n// https://ddragon.leagueoflegends.com/cdn/11.16.1/data/en_US/summoner.json\nconst summoner = await axios\u003cRiot.Data.SummonerJSON\u003e(ddragon.meta('summoner'))\n```\n\n### Community Dragon\n\n```ts\nimport { CommunityDragon, Riot } from 'poro'\n\nconst cdragon = new CommunityDragon('latest', 'default')\n\n// https://raw.communitydragon.org/latest/plugins/rcp-fe-lol-static-assets/global/default/images/ranked-mini-regalia/challenger.png\ncdragon.tier(Riot.Tier.CHALLENGER)\n```\n\n## APIs\n\n`CargoClient` and `RiotClient` are designed for server side and use axios to send requests.\n\nTypes are out of box, so you don't have to define them yourself.\n\n### Leaguepedia\n\n\u003e You can get the axios instance with `cargo.axiosInstance`.\n\n```ts\ninterface CargoClientOptions {\n  // Prefix to field names starting with '_' (like '_ID', '_pageName', etc.)\n  metadataPrefix?: string\n}\n```\n\nSee the parameters needed for a query in [Cargo query](https://lol.fandom.com/wiki/Special:CargoQuery) (or [API sandbox](https://lol.fandom.com/wiki/Special:ApiSandbox))\n\nSee all fields of a table in\n[Cargo tables](https://lol.fandom.com/wiki/Special:CargoTables).\n\n```ts\ninterface CargoQueryParameter {\n  tables: Table[]\n  fields?: Field[] // defaults to all fields\n  where?: string\n  joinOn?: JoinOn[]\n  groupBy?: Field[]\n  having?: string\n  orderBy?: OrderBy[] // defaults to `[{ field: `${tables[0]}._pageName` }]`\n  limit?: number // defaults to `Number.MAX_SAFE_INTEGER`\n  offset?: number // defaults to `0`\n  format?: string // defaults to 'json'\n}\n\ninterface JoinOn {\n  left: Field\n  right: Field\n}\n\ninterface OrderBy {\n  field: Field\n  desc?: boolean // defaults to `false`\n}\n```\n\n### Riot\n\n\u003e You can get the axios instance with `riot.axiosInstance`.\n\n```ts\ninterface RiotClientConfig extends LimiterConfig {\n  // Riot API KEY\n  auth: string\n  // Instance-scoped platform\n  platform?: Platform\n  // Instance-scoped region\n  region?: Region\n}\n\ninterface LimiterConfig {\n  // Concurrency for each region\n  concurrency?: number\n  // If `true`, display debug info.\n  // If 'mock', display debug info and mock requests.\n  debug?: boolean | 'mock'\n}\n```\n\nSometime you need method-scoped `platform` and `region`. Add it as the last parameter in `path` method and it will override the instance-scoped one.\n\n```ts\nriot.path(\n  '/lol/summoner/v4/summoners/{encryptedSummonerId}',\n  { encryptedSummonerId: '...' },\n  Riot.Platform.KR,\n)\n```\n\n## Credits\n\nThe Riot API client is inspired by [Building Strongly Typed REST Clients with TypeScript\n](https://www.youtube.com/watch?v=aZ6nnGlfBG8) ([repository](https://github.com/joheredi/openjs-world-2021)).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpacexy%2Fporo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpacexy%2Fporo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpacexy%2Fporo/lists"}