RBWCM-SDK Documentation - v1.1.0
    Preparing search index...

    RBWCM-SDK Documentation - v1.1.0

    RBWCM Logo

    The official Enterprise-grade TypeScript SDK for the RBWCM Ranked System.

    TypeScript Axios Redis TypeDoc


    • 100% Type-Safe: Built with TypeScript, offering comprehensive IntelliSense and strict payload typing.
    • Real-Time Events: Subscribe to live backend events (draft picks, game starts, map bans) just like Discord.js using client.on().
    • Active Record Entities: Interact with objects directly! Easily call user.strike(), game.score(), or map.uploadImage() right from the entity.
    • Multipart Uploads: Built-in NodeJS buffer support for uploading rank icons and map images.
    • Complete Coverage: Manages Matchmaking, Captain Drafts, Parties, Punishments, Statistics, Queues, and Match History.

    This package is hosted privately on GitHub Packages. To install it, you must configure your npm environment.

    1. Generate a GitHub Personal Access Token (PAT) Create a token with the read:packages scope in your GitHub Developer Settings.

    2. Configure your project In the root directory of the project where you want to use the SDK, create an .npmrc file:

    @rbwcm:registry=https://npm.pkg.github.com
    //npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN_HERE
    

    ⚠️ Important: Add .npmrc to your .gitignore to keep your token secure!

    3. Install the SDK

    npm install @rbwcm/rbwcm-sdk
    

    To begin, initialize the RankedClient with your API credentials and Redis connection string. You must call client.connect() to start receiving real-time events.

    import { RankedClient } from '@rbwcm/rbwcm-sdk';

    const client = new RankedClient({
    apiUrl: 'https://api.example.com',
    apiKey: 'your-secret-admin-key',
    redisUrl: 'redis://localhost:6379',
    redisPassword: 'optional-password'
    });

    client.once('ready', () => {
    console.log('✅ RBWCM SDK is connected and listening to Redis!');
    });

    await client.connect();

    The SDK is organized into Managers (e.g., client.users, client.matchmaking, client.games) that return Entities.

    Interacting with Entities (Active Record) Entities are smart objects. Once you fetch them, you can perform actions directly on them without going back to the manager.

    const user = await client.users.getById(123);

    await user.strike({ reason: 'Toxicity in game chat' });

    const party = await user.getParty();
    if (party) {
    console.log(`User is in a party led by ${party.leaderId}`);
    }

    Matchmaking & Drafts Interact with the drafting system seamlessly:

    const draft = await client.matchmaking.getDraftState(gameId);

    await draft.pickPlayer(pickedUserId, captainId);

    await draft.banMap('map-uuid-here', captainId);

    Uploading Assets (Images & Icons) Upload buffers directly from Node.js to update Maps and Ranks:

    import * as fs from 'fs';

    const map = await client.maps.getActiveMaps('system-uuid')[0];
    const buffer = fs.readFileSync('./local/path/to/arena.png');

    const newUrl = await map.uploadImage(buffer, 'arena.png');
    console.log(`Map image updated! View at: ${newUrl}`);

    The SDK automatically parses incoming NestJS microservice envelopes from Redis and turns them into strongly-typed events.

    client.on('game.started', (payload) => {
    console.log(`Game ${payload.gameId} has started in queue ${payload.queueId}!`);
    payload.players.forEach(p => {
    console.log(`- Player ${p.ign} is on Team ${p.team}`);
    });
    });

    client.on('draft.pickSuccess', (payload) => {
    console.log(`Player ${payload.pickedUser.ign} was picked by Team ${payload.pickedByTeamIndex}!`);
    });

    Comprehensive HTML documentation is generated via TypeDoc. If you have access to the SDK source code, you can generate it locally:

    npm run docs
    

    Open docs/index.html in your browser to explore all available Managers, Entities, and Events.

    This project is proprietary and confidential. All rights are reserved.

    See the LICENSE file for the full copyright notice and terms of use.