r6-data.js 1.3.6 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +176 -4
- package/index.d.ts +92 -0
- package/index.js +4 -0
- package/methods/getGameStats.js +30 -0
- package/methods/getSeasonalStats.js +39 -0
- package/package.json +27 -3
- package/tsconfig.json +12 -0
package/README.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
# r6-data.js — Rainbow Six Siege (R6/R6S) Stats & Metadata API
|
|
2
|
+
|
|
2
3
|
Rainbow Six Siege API wrapper that gives infos about player's stats, maps, operators, ranks, seasons, charms etc. Last updated Y10S3
|
|
3
4
|
|
|
4
5
|
<div align="center">
|
|
@@ -14,9 +15,6 @@
|
|
|
14
15
|
|
|
15
16
|
## Installation
|
|
16
17
|
|
|
17
|
-
```sh
|
|
18
|
-
npm install r6-data.js
|
|
19
|
-
```
|
|
20
18
|
```sh
|
|
21
19
|
npm i r6-data.js
|
|
22
20
|
```
|
|
@@ -27,6 +25,51 @@ This is the website where you can directly track your stats and also check the a
|
|
|
27
25
|
|
|
28
26
|
Visit the official website: **[r6data.eu](https://r6data.eu/)**
|
|
29
27
|
|
|
28
|
+
## TypeScript Support
|
|
29
|
+
|
|
30
|
+
r6-data.js now includes full TypeScript support with complete type definitions! You can use it in TypeScript projects with full IntelliSense and type checking.
|
|
31
|
+
|
|
32
|
+
### TypeScript Import Examples
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
// ES6 import syntax
|
|
36
|
+
import * as r6 from 'r6-data.js';
|
|
37
|
+
|
|
38
|
+
// Or import specific functions
|
|
39
|
+
import { getAccountInfo, getPlayerStats, getOperators } from 'r6-data.js';
|
|
40
|
+
|
|
41
|
+
// Import types for better type safety
|
|
42
|
+
import type { AccountInfoParams, PlayerStatsParams, PlatformType } from 'r6-data.js';
|
|
43
|
+
|
|
44
|
+
// Example usage with types
|
|
45
|
+
async function getPlayerData() {
|
|
46
|
+
const accountParams: AccountInfoParams = {
|
|
47
|
+
nameOnPlatform: 'PlayerName',
|
|
48
|
+
platformType: 'uplay' as PlatformType
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const accountInfo = await r6.getAccountInfo(accountParams);
|
|
52
|
+
console.log('Account info:', accountInfo);
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### JavaScript (CommonJS) Import
|
|
57
|
+
|
|
58
|
+
```javascript
|
|
59
|
+
// Traditional require syntax (still supported)
|
|
60
|
+
const r6 = require('r6-data.js');
|
|
61
|
+
|
|
62
|
+
// Example usage
|
|
63
|
+
async function getPlayerData() {
|
|
64
|
+
const accountInfo = await r6.getAccountInfo({
|
|
65
|
+
nameOnPlatform: 'PlayerName',
|
|
66
|
+
platformType: 'uplay'
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
console.log('Account info:', accountInfo);
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
30
73
|
## Getting Player Account Information
|
|
31
74
|
|
|
32
75
|
The `getAccountInfo()` function allows you to retrieve player profile data from the official Rainbow Six Siege API. This function is specifically designed for retrieving account information such as player level, experience, clearance level, and profile settings.
|
|
@@ -133,6 +176,135 @@ You can filter these statistics by game mode using the `board_id` parameter:
|
|
|
133
176
|
- `standard`: Statistics for standard matches
|
|
134
177
|
- `ranked`: Statistics for ranked competitive matches
|
|
135
178
|
|
|
179
|
+
|
|
180
|
+
## Getting Seasonal Statistics
|
|
181
|
+
|
|
182
|
+
The `getSeasonalStats()` function allows you to get detailed rank points history and seasonal progression for a specific player in the current season. Includes timestamp, rank information, RP values, and rank images
|
|
183
|
+
|
|
184
|
+
```javascript
|
|
185
|
+
const r6Info = require('r6-data.js');
|
|
186
|
+
|
|
187
|
+
async function main() {
|
|
188
|
+
try {
|
|
189
|
+
// Get seasonal statistics for a player
|
|
190
|
+
const seasonalStats = await r6Info.getSeasonalStats({
|
|
191
|
+
nameOnPlatform: 'PlayerName',
|
|
192
|
+
platformType: 'uplay'
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
console.log('Seasonal statistics:', seasonalStats);
|
|
196
|
+
return seasonalStats;
|
|
197
|
+
|
|
198
|
+
} catch (error) {
|
|
199
|
+
console.error('Error retrieving seasonal statistics:', error.message);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
main();
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Parameters
|
|
207
|
+
|
|
208
|
+
The `getSeasonalStats()` function accepts an object with the following parameters:
|
|
209
|
+
|
|
210
|
+
- `nameOnPlatform`: (Required) The player's name on the platform
|
|
211
|
+
- `platformType`: (Required) The platform type - "uplay", "psn", or "xbl"
|
|
212
|
+
|
|
213
|
+
### Seasonal Statistics Response
|
|
214
|
+
|
|
215
|
+
```javascript
|
|
216
|
+
{
|
|
217
|
+
"data": {
|
|
218
|
+
"history": {
|
|
219
|
+
"metadata": {
|
|
220
|
+
"key": "RankPoints",
|
|
221
|
+
"name": "Rank Points",
|
|
222
|
+
"description": null
|
|
223
|
+
},
|
|
224
|
+
"data": [
|
|
225
|
+
[
|
|
226
|
+
"2025-10-14T21:43:27.315+00:00",
|
|
227
|
+
{
|
|
228
|
+
"displayName": "Rank Points",
|
|
229
|
+
"metadata": {
|
|
230
|
+
"rank": "PLATINUM II",
|
|
231
|
+
"imageUrl": "https://r6data.eu/assets/img/r6_ranks_img/platinum-2.webp",
|
|
232
|
+
"color": "#44ccc2"
|
|
233
|
+
},
|
|
234
|
+
"value": 3300,
|
|
235
|
+
"displayValue": "3,300",
|
|
236
|
+
"displayType": "Number"
|
|
237
|
+
}
|
|
238
|
+
],
|
|
239
|
+
[
|
|
240
|
+
"2025-10-14T21:12:55.821+00:00",
|
|
241
|
+
{
|
|
242
|
+
"displayName": "Rank Points",
|
|
243
|
+
"metadata": {
|
|
244
|
+
"rank": "PLATINUM II",
|
|
245
|
+
"imageUrl": "https://r6data.eu/assets/img/r6_ranks_img/platinum-2.webp",
|
|
246
|
+
"color": "#44ccc2"
|
|
247
|
+
},
|
|
248
|
+
"value": 3302,
|
|
249
|
+
"displayValue": "3,302",
|
|
250
|
+
"displayType": "Number"
|
|
251
|
+
}
|
|
252
|
+
]
|
|
253
|
+
]
|
|
254
|
+
},
|
|
255
|
+
"leaderboard": null,
|
|
256
|
+
"expiryDate": "0001-01-01T00:00:00+00:00",
|
|
257
|
+
"bestMatches": null
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Getting Game Statistics
|
|
262
|
+
|
|
263
|
+
The `getGameStats()` function allows you to get real-time player count statistics across all platforms including Steam, Ubisoft Connect, PlayStation, Xbox, and total player counts
|
|
264
|
+
|
|
265
|
+
```javascript
|
|
266
|
+
const r6Info = require('r6-data.js');
|
|
267
|
+
|
|
268
|
+
async function main() {
|
|
269
|
+
try {
|
|
270
|
+
// Get general game statistics
|
|
271
|
+
const gameStats = await r6Info.getGameStats();
|
|
272
|
+
|
|
273
|
+
console.log('Game statistics:', gameStats);
|
|
274
|
+
return gameStats;
|
|
275
|
+
|
|
276
|
+
} catch (error) {
|
|
277
|
+
console.error('Error retrieving game statistics:', error.message);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
main();
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Game Statistics Response
|
|
285
|
+
```javascript
|
|
286
|
+
{
|
|
287
|
+
"steam": {
|
|
288
|
+
"concurrent": 33631,
|
|
289
|
+
"estimate": 33631
|
|
290
|
+
},
|
|
291
|
+
"crossPlatform": {
|
|
292
|
+
"totalRegistered": 85000000,
|
|
293
|
+
"monthlyActive": 15300000,
|
|
294
|
+
"trendsEstimate": 175666,
|
|
295
|
+
"platforms": {
|
|
296
|
+
"pc": 6885000,
|
|
297
|
+
"playstation": 5355000,
|
|
298
|
+
"xbox": 3060000
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
"ubisoft": {
|
|
302
|
+
"onlineEstimate": 127739
|
|
303
|
+
},
|
|
304
|
+
"lastUpdated": "2025-10-15T22:39:38.636Z"
|
|
305
|
+
}
|
|
306
|
+
```
|
|
307
|
+
|
|
136
308
|
## Creating Discord Webhooks for R6 Stats
|
|
137
309
|
|
|
138
310
|
The `createDiscordR6Webhook()` function allows you to send Rainbow Six Siege player statistics directly to a Discord channel using webhooks. This creates formatted embeds with player stats that can be customized with various options.
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// TypeScript declarations for r6-data.js (module-style, no ambient wrapper)
|
|
2
|
+
|
|
3
|
+
// ----- Types -----
|
|
4
|
+
export type PlatformType = "uplay" | "psn" | "xbl";
|
|
5
|
+
export type PlatformFamily = "pc" | "console";
|
|
6
|
+
export type BoardId = "casual" | "event" | "warmup" | "standard" | "ranked";
|
|
7
|
+
export type RankVersion = "v1" | "v2" | "v3" | "v4" | "v5" | "v6";
|
|
8
|
+
|
|
9
|
+
export interface AccountInfoParams {
|
|
10
|
+
nameOnPlatform: string;
|
|
11
|
+
platformType: PlatformType;
|
|
12
|
+
}
|
|
13
|
+
export interface PlayerStatsParams extends AccountInfoParams {
|
|
14
|
+
platform_families: PlatformFamily;
|
|
15
|
+
board_id?: BoardId;
|
|
16
|
+
}
|
|
17
|
+
export interface SeasonalStatsParams extends AccountInfoParams {}
|
|
18
|
+
|
|
19
|
+
export interface GetMapsParams {
|
|
20
|
+
name?: string; location?: string; releaseDate?: string; playlists?: string; mapReworked?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface GetOperatorsParams {
|
|
23
|
+
name?: string; safename?: string; realname?: string; birthplace?: string; age?: number; date_of_birth?: string; season_introduced?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface GetSeasonsParams {
|
|
26
|
+
name?: string; map?: string; operators?: string; weapons?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface GetAttachmentParams {
|
|
29
|
+
name?: string; style?: string; rarity?: string; availability?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface GetCharmsParams {
|
|
32
|
+
name?: string; collection?: string; rarity?: string; availability?: string; bundle?: string; season?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface GetWeaponsParams { name?: string; }
|
|
35
|
+
export interface GetUniversalSkinsParams { name?: string; }
|
|
36
|
+
export interface GetRanksParams { version?: RankVersion; min_mmr?: number; max_mmr?: number; }
|
|
37
|
+
|
|
38
|
+
export interface SearchAllResult {
|
|
39
|
+
query: string;
|
|
40
|
+
summary: Record<string, number>;
|
|
41
|
+
results: {
|
|
42
|
+
operators: any[]; weapons: any[]; maps: any[]; seasons: any[]; charms: any[]; attachments: any[];
|
|
43
|
+
[k: string]: any;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export interface GameStats {
|
|
47
|
+
steam?: { concurrent?: number; estimate?: number };
|
|
48
|
+
crossPlatform?: { totalRegistered?: number; monthlyActive?: number; trendsEstimate?: number; platforms?: { pc?: number; playstation?: number; xbox?: number } };
|
|
49
|
+
ubisoft?: { onlineEstimate?: number };
|
|
50
|
+
lastUpdated?: string;
|
|
51
|
+
[k: string]: any;
|
|
52
|
+
}
|
|
53
|
+
export interface DiscordWebhookOptions {
|
|
54
|
+
playerName: string; title?: string; message?: string; color?: number; avatarUrl?: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ----- Functions -----
|
|
58
|
+
export function getAccountInfo(params: AccountInfoParams): Promise<any>;
|
|
59
|
+
export function getPlayerStats(params: PlayerStatsParams): Promise<any>;
|
|
60
|
+
export function getSeasonalStats(params: SeasonalStatsParams): Promise<any>;
|
|
61
|
+
export function getServiceStatus(): Promise<any>;
|
|
62
|
+
export function getGameStats(): Promise<GameStats>;
|
|
63
|
+
export function getMaps(params?: GetMapsParams): Promise<any[]>;
|
|
64
|
+
export function getOperators(params?: GetOperatorsParams): Promise<any[]>;
|
|
65
|
+
export function getSeasons(params?: GetSeasonsParams): Promise<any[]>;
|
|
66
|
+
export function getAttachment(params?: GetAttachmentParams): Promise<any[]>;
|
|
67
|
+
export function getCharms(params?: GetCharmsParams): Promise<any[]>;
|
|
68
|
+
export function getWeapons(params?: GetWeaponsParams): Promise<any[]>;
|
|
69
|
+
export function getUniversalSkins(params?: GetUniversalSkinsParams): Promise<any[]>;
|
|
70
|
+
export function getRanks(params?: GetRanksParams): Promise<any[]>;
|
|
71
|
+
export function getSearchAll(query: string): Promise<SearchAllResult>;
|
|
72
|
+
export function createDiscordR6Webhook(webhookUrl: string, playerData: any, options: DiscordWebhookOptions): Promise<any>;
|
|
73
|
+
|
|
74
|
+
// ----- Default export -----
|
|
75
|
+
declare const r6Data: {
|
|
76
|
+
getAccountInfo: typeof getAccountInfo;
|
|
77
|
+
getPlayerStats: typeof getPlayerStats;
|
|
78
|
+
getSeasonalStats: typeof getSeasonalStats;
|
|
79
|
+
getServiceStatus: typeof getServiceStatus;
|
|
80
|
+
getGameStats: typeof getGameStats;
|
|
81
|
+
getMaps: typeof getMaps;
|
|
82
|
+
getOperators: typeof getOperators;
|
|
83
|
+
getSeasons: typeof getSeasons;
|
|
84
|
+
getAttachment: typeof getAttachment;
|
|
85
|
+
getCharms: typeof getCharms;
|
|
86
|
+
getWeapons: typeof getWeapons;
|
|
87
|
+
getUniversalSkins: typeof getUniversalSkins;
|
|
88
|
+
getRanks: typeof getRanks;
|
|
89
|
+
getSearchAll: typeof getSearchAll;
|
|
90
|
+
createDiscordR6Webhook: typeof createDiscordR6Webhook;
|
|
91
|
+
};
|
|
92
|
+
export default r6Data;
|
package/index.js
CHANGED
|
@@ -11,6 +11,8 @@ const getSearchAll = require('./methods/getSearchAll');
|
|
|
11
11
|
const getAccountInfo = require('./methods/getAccountInfo');
|
|
12
12
|
const getPlayerStats = require('./methods/getPlayerStats');
|
|
13
13
|
const createDiscordR6Webhook = require('./methods/createDiscordR6Webhook');
|
|
14
|
+
const getGameStats = require('./methods/getGameStats');
|
|
15
|
+
const getSeasonalStats = require('./methods/getSeasonalStats');
|
|
14
16
|
|
|
15
17
|
const r6Data = {
|
|
16
18
|
getMaps,
|
|
@@ -26,6 +28,8 @@ const r6Data = {
|
|
|
26
28
|
getAccountInfo,
|
|
27
29
|
getPlayerStats,
|
|
28
30
|
createDiscordR6Webhook,
|
|
31
|
+
getGameStats,
|
|
32
|
+
getSeasonalStats,
|
|
29
33
|
};
|
|
30
34
|
|
|
31
35
|
module.exports = r6Data;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const axiosInstance = require('../axiosInstance/axiosInstance');
|
|
2
|
+
const buildUrlAndParams = require('./util');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Get Rainbow Six Siege game stats for all platform
|
|
6
|
+
* @returns {Promise<Object>} - Game stats for all platform
|
|
7
|
+
*/
|
|
8
|
+
async function getGameStats() {
|
|
9
|
+
try {
|
|
10
|
+
|
|
11
|
+
// Build the URL with parameters
|
|
12
|
+
const params = {
|
|
13
|
+
type: 'gameStats'
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const url = buildUrlAndParams('/stats', params);
|
|
17
|
+
|
|
18
|
+
const response = await axiosInstance.get(url);
|
|
19
|
+
|
|
20
|
+
return response.data;
|
|
21
|
+
} catch (error) {
|
|
22
|
+
console.error('Error during the game stats request:', error.message);
|
|
23
|
+
if (error.response && error.response.status === 401) {
|
|
24
|
+
throw new Error('request error');
|
|
25
|
+
}
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports = getGameStats;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const axiosInstance = require('../axiosInstance/axiosInstance');
|
|
2
|
+
const buildUrlAndParams = require('./util');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Get Rainbow Six Siege player stats for current season
|
|
6
|
+
* @param {Object} params - Parameters for the request
|
|
7
|
+
* @param {string} params.nameOnPlatform - Player name on the platform
|
|
8
|
+
* @param {string} params.platformType - Platform type (uplay, psn, xbl)
|
|
9
|
+
* @returns {Promise<Object>} - Player stats for current season
|
|
10
|
+
*/
|
|
11
|
+
async function getSeasonalStats({ nameOnPlatform, platformType } = {}) {
|
|
12
|
+
try {
|
|
13
|
+
// Validate required parameters
|
|
14
|
+
if (!nameOnPlatform || !platformType) {
|
|
15
|
+
throw new Error('Missing required parameters: nameOnPlatform, platformType');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Build the URL with parameters
|
|
19
|
+
const params = {
|
|
20
|
+
type: 'seasonalStats',
|
|
21
|
+
nameOnPlatform,
|
|
22
|
+
platformType
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const url = buildUrlAndParams('/stats', params);
|
|
26
|
+
|
|
27
|
+
const response = await axiosInstance.get(url);
|
|
28
|
+
|
|
29
|
+
return response.data;
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error('Error during the getSeasonalStats request:', error.message);
|
|
32
|
+
if (error.response && error.response.status === 401) {
|
|
33
|
+
throw new Error('Authentication error');
|
|
34
|
+
}
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
module.exports = getSeasonalStats;
|
package/package.json
CHANGED
|
@@ -1,15 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "r6-data.js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Rainbow Six Siege API wrapper for player's stats, maps, operators, ranks, seasons, charms etc. Last updated Y10S3",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"require": "./index.js",
|
|
9
|
+
"default": "./index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"types": "./index.d.ts",
|
|
13
|
+
"files": [
|
|
14
|
+
"index.js",
|
|
15
|
+
"index.d.ts",
|
|
16
|
+
"tsconfig.json",
|
|
17
|
+
"methods/",
|
|
18
|
+
"axiosInstance/",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
6
21
|
"scripts": {
|
|
7
|
-
"test": ""
|
|
22
|
+
"test": "node -e \"console.log('no tests yet')\"",
|
|
23
|
+
"lint": "eslint .",
|
|
24
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
8
25
|
},
|
|
9
26
|
"repository": {
|
|
10
27
|
"type": "git",
|
|
11
28
|
"url": "git+https://github.com/mazeor9/r6-data.js"
|
|
12
29
|
},
|
|
30
|
+
"homepage": "https://r6data.eu/",
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/mazeor9/r6-data.js/issues"
|
|
33
|
+
},
|
|
34
|
+
"funding": "https://buymeacoffee.com/mazeor",
|
|
13
35
|
"keywords": [
|
|
14
36
|
"r6",
|
|
15
37
|
"rainbow six",
|
|
@@ -63,6 +85,8 @@
|
|
|
63
85
|
"ms": "^2.1.3"
|
|
64
86
|
},
|
|
65
87
|
"devDependencies": {
|
|
66
|
-
"@types/node": "^24.
|
|
88
|
+
"@types/node": "^24.8.0",
|
|
89
|
+
"eslint": "^9.37.0",
|
|
90
|
+
"typescript": "^5.9.3"
|
|
67
91
|
}
|
|
68
92
|
}
|