3.0.1 • Published 4 months ago

mrivals v3.0.1

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
4 months ago

Instalation

This module uses flaresolverr to fetch data You need to have an flaresolverr instance to use this library, using the default docker image is fine.

To install use:

npm i mrivals

Set enviroments variables

This programs defaults this env to http://localhost:8191

You have to set the FLARESOLVERR_URL enviroment variable to the url of your flaresolverr instance.

Also you can pass it as an options of API.fetchUser

await API.fetchUser(username, { flaresolverrUrl: 'https://some.flaresolverr.domain:8191' });

Usage

There is only one static function that takes an username.

/* returns an API class instance with the data already fetched */
await API.fetchUser(username); // user#tag

You must call API.fetchUser before using any other method.

MethodsDescription
infouser and mmr info
overviewoverview stats
heroesheroes stats
rolesroles stats
peakRankpeak rank
rawreturn raw response

Example code

Feel free to use my riot username for testing

const { API } = require('mrivals');

try {
  const user = await API.fetchUser('ifraan');

  console.log('User:', user.info());
  console.log('Overview:', user.overview());
  console.log('Heroes:', user.heroes());
  console.log('Roles:', user.roles());
  console.log('Peak MMR:', user.peakRank());
  console.log('Raw:', user.raw());
} catch (e) {
  console.log(e);
  /* Error: We could not find the player [player]. */
}

Disclaimer

This project is fully for educational purposes and if you want to use the marvel rivals api in a production/commertial enviroment you should ask or email the guys at TRNetwork.

3.0.1

4 months ago

3.0.0

4 months ago

2.0.0

5 months ago

1.3.0

5 months ago