项目作者: RiftLurker

项目描述 :
REST API Wrapper for the League of Legends API
高级语言: JavaScript
项目地址: git://github.com/RiftLurker/league-wrapper.git
创建时间: 2016-10-16T13:17:21Z
项目社区:https://github.com/RiftLurker/league-wrapper

开源协议:Other

下载


league-wrapper

A wrapper for the League of Legends official API.

Introduction

This project aims to provide an easy to use interface for the League of Legends API.
Since it’s my first public project, please feel free to contact me and leave some feedback.

Also please keep in mind that this is not a stable version yet, so interface spec might change while the implementation is still worked on.

Installation

  1. $ npm install league-wrapper

Features

  • Wrapper for all provided services
  • Fully documented
  • JSDoc for the Response DataObjects
  • Can be used both as Promise or with callbacks

Example Usage

Getting started

The LeagueWrapper accepts the API key and an object with the default region used for the requests.
You can get your key from the Developer Portal.

If no region is passed the Wrapper will default to Region.EUW. Possible regions can be found here

  1. const LeagueWrapper = require('league-wrapper');
  2. const api = new LeagueWrapper('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', {
  3. region: LeagueWrapper.Region.EUW
  4. });

Using Promise

  1. api.summoner.getByNames('PostCrafter').then(function(summoners) {
  2. console.log(summoners);
  3. });
  4. /* Console output:
  5. {
  6. postcrafter: {
  7. id: 48944322,
  8. name: 'PostCrafter',
  9. profileIconId: 1376,
  10. summonerLevel: 30,
  11. revisionDate: 1476740328000
  12. }
  13. }
  14. */

Using callback

  1. api.summoner.getByNames('PostCrafter', function(error, summoners) {
  2. console.log(summoners);
  3. });
  4. /* Console output:
  5. {
  6. postcrafter: {
  7. id: 48944322,
  8. name: 'PostCrafter',
  9. profileIconId: 1376,
  10. summonerLevel: 30,
  11. revisionDate: 1476740328000
  12. }
  13. }
  14. */

Documentation

See here.

Examples

See here.

License

AGPL-3.0