npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@rainbow6/sdk

v1.0.1

Published

Typescript SDK for the Rainbow 6 API

Downloads

3

Readme

Travis (.com) npm

@rainbow6/sdk

Typescript SDK for the Rainbow 6 API

Usage

Important: This module requires credentials to access Ubisoft accounts. It should only be used on backend servers and the credentials should be handled as you would handle any other secure value. It is recommended to create a new account for using the API.

Installation

npm install @rainbow6/sdk

Example

const {
  Siege,
  SearchPlatform,
  Platform,
  Mode,
  Region,
  allStats,
} = require("@rainbow6/sdk");

(async () => {
  const r6 = new Siege([
    {
      email: "[email protected]",
      password: '123456',
    },
  ]);
  await r6.init();

  // if you ever see me in game, please don't spawn peek me
  const { profileId } = await r6.getPlayer("FledRose0", SearchPlatform.pc);
  console.log(profileId);
  const { xp } = await r6.getProgression(profileId, Platform.pc);
  console.log(xp);
  const { mmr } = await r6.getRank(
    profileId,
    Platform.pc,
    Mode.ranked,
    Region.na,
    -1
  );
  console.log(mmr);
  const {
    profile: {
      general: { kills },
    },
  } = await r6.getStats(profileId, Platform.pc, allStats);
  console.log(kills);
  // don't spawn peek this guy either
  const { profileId: profileId2 } = await r6.getPlayer(
    "FledRoseO",
    SearchPlatform.pc
  );
  const bulk = await r6.getBulkStats(
    [profileId, profileId2],
    Platform.pc,
    allStats
  );
  console.log(bulk[profileId].profile.casual, bulk[profileId2].profile.casual);
})();

Overview

This SDK is designed as a light wrapper around the Ubisoft APIs will full support for all of the stats endpoints and parameters as well as bulk queries.

It only supports PVP (we're yet to see a compelling use case for PVE data) and does not add additional metadata to API responses. The focus of this SDK is handling authentication, load balancing across keys, and cleaning up the response from the API.

API

new Siege()

constructor(credentials: CredentialSet[]): Siege

Creates an API client which rotates between the provided credential sets.

Siege.init()

async init(): Promise<void>

Performs initial setup (authentication).

Siege.search()

async search(query: string, platform: SearchPlatform): Promise<PlayerProfile[] | null>

Searches for players by name.

  • query - the search term
  • platform - platform to search

Siege.getPlayer()

async getPlayer(name: string, platform: SearchPlatform): Promise<PlayerProfile | null>

Wrapper around Siege.search. name must be an exact match.

Siege.getProgressions()

async getProgressions(profiles: string[], platform: Platform): Promise<{ [profileId: string]: ProfileProgression } | null>

Gets players' progression in game.

  • profiles - profiles to get progression for
  • platform - platform to get progression on

Siege.getProgression()

async getProgression(profile: string, platform: Platform): Promise<ProfileProgression | null>

Wrapper around Siege.getProgressions().

Siege.getRanks()

async getRanks(profiles: string[], platform: Platform, board: Mode, region: Region, season: number): Promise<null | { [profileId: string]: ProfileRank }>

Get players' rank in game.

  • profiles - profiles to get ranks for
  • platform - platform for stats
  • board - game mode for rank
  • region - region for rank
  • season - season for rank

Siege.getRank()

async getRanks(profile: string, platform: Platform, board: Mode, region: Region, season: number): Promise<null | ProfileRank>

Wrapper around Siege.getRanks().

Siege.getBulkStats()

async getBulkStats(profiles: string[], platform: Platform, stats: Statistic[]): Promise<null | { [profileId: string]: ProfileStats }>

Retrieves requested stats for all profiles

  • profiles - profiles to get stats for
  • platform - platform to get stats on
  • stats - stats to get

Siege.getStats()

async getBulkStats(profile: string, platform: Platform, stats: Statistic[]): Promise<null | ProfileStats>

Retrieves requested stats for all profiles

  • profiles - profiles to get stats for
  • platform - platform to get stats on
  • stats - stats to get

Enums

To prevent typos and make code more readable, enums are available for some parameters.

SearchPlatform

A profile platform.

Possible values:

  • SearchPlatform.pc
  • SearchPlatform.steam
  • SearchPlatform.xbox
  • SearchPlatform.playstation
  • SearchPlatform.twitch

Platform

A gameplay platform.

Possible values:

  • Platform.pc
  • Platform.xbox
  • Platform.playstation

Region

A gameplay region.

Possible values:

  • Region.na
  • Region.europe
  • Region.asia

Mode

A major game mode.

Possible values:

  • Mode.casual
  • Mode.ranked

Statistic

A supported statistic.

There are over 100 supported statistics. Please refer directly to the source code or typings for the latest list.

You can import allStats if you want the entire list.

Development

Available Scripts

In the project directory, you can run:

npm run build

Builds the package using typescript into ./lib

npm test

Launches the Jest to run tests.

npm run lint

Checks code for style issues and syntax errors with TSLint and Prettier.

npm run lint:fix

Checks code for style issues and syntax errors with TSLint and Prettier, attempting to fix them when possible.

Publishing a new version

Travis is configured to run deploys on tags.

Credit

danielwerg/r6api.js was used as a reference for understanding the authentication process.