r6-data.js 1.7.3 → 1.8.2

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 CHANGED
@@ -95,6 +95,42 @@ When using `getAccountInfo()`, you'll receive data about the player's profile, i
95
95
  - Play time statistics
96
96
  - Player profile settings and customization
97
97
 
98
+ ## Getting Player Ban Status
99
+
100
+ The `getIsBanned()` function allows you to check if a player is currently banned from Rainbow Six Siege.
101
+
102
+ ```javascript
103
+ const r6Info = require('r6-data.js');
104
+
105
+ async function main() {
106
+ try {
107
+ // Check if player is banned
108
+ const banStatus = await r6Info.getIsBanned({
109
+ nameOnPlatform: 'PlayerName',
110
+ platformType: 'uplay'
111
+ });
112
+
113
+ console.log('Ban status:', banStatus);
114
+ return banStatus;
115
+
116
+ } catch (error) {
117
+ console.error('Error checking ban status:', error.message);
118
+ }
119
+ }
120
+
121
+ main();
122
+ ```
123
+
124
+ ### Parameters
125
+
126
+ The `getIsBanned()` function accepts an object with the following parameters:
127
+
128
+ - `nameOnPlatform`: (Required) The player's name on the platform
129
+ - `platformType`: (Required) The platform type - "uplay", "psn", or "xbl"
130
+
131
+ ### Ban Status Response
132
+ When using `getIsBanned()`, you'll receive data indicating the player's ban status.
133
+
98
134
  ## Getting Player Statistics
99
135
 
100
136
  The `getPlayerStats()` function allows you to retrieve detailed gameplay statistics from the official Rainbow Six Siege API. This function is specifically designed for retrieving player performance data across different game modes.
@@ -1,7 +1,7 @@
1
1
  const axios = require('axios');
2
2
 
3
3
  const axiosInstance = axios.create({
4
- baseURL: 'https://r6-api.vercel.app/api',
4
+ baseURL: 'https://api.r6data.eu/api',
5
5
  headers: {
6
6
  'Content-Type': 'application/json',
7
7
  'Accept': 'application/json',
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // TypeScript declarations for r6-data.js (module-style, no ambient wrapper)
1
+ // TypeScript declarations for r6-data.js
2
2
 
3
3
  // Re-export all types and interfaces from modular files
4
4
  export * from './types';
@@ -6,6 +6,7 @@ export * from './types';
6
6
  // ----- Default export -----
7
7
  import {
8
8
  getAccountInfo,
9
+ getIsBanned,
9
10
  getPlayerStats,
10
11
  getSeasonalStats,
11
12
  getServiceStatus,
@@ -25,6 +26,7 @@ import {
25
26
 
26
27
  declare const r6Data: {
27
28
  getAccountInfo: typeof getAccountInfo;
29
+ getIsBanned: typeof getIsBanned;
28
30
  getPlayerStats: typeof getPlayerStats;
29
31
  getSeasonalStats: typeof getSeasonalStats;
30
32
  getServiceStatus: typeof getServiceStatus;
package/index.js CHANGED
@@ -14,6 +14,7 @@ const createDiscordR6Webhook = require('./methods/createDiscordR6Webhook');
14
14
  const getGameStats = require('./methods/getGameStats');
15
15
  const getSeasonalStats = require('./methods/getSeasonalStats');
16
16
  const getPlayerComparisons = require('./methods/getPlayerComparisons');
17
+ const getIsBanned = require('./methods/getIsBanned');
17
18
 
18
19
  // Export individual functions for named imports
19
20
  module.exports = {
@@ -33,6 +34,7 @@ module.exports = {
33
34
  getGameStats,
34
35
  getSeasonalStats,
35
36
  getPlayerComparisons,
37
+ getIsBanned,
36
38
  };
37
39
 
38
40
  // Export individual functions as named exports for ES6 compatibility
@@ -51,4 +53,5 @@ module.exports.getPlayerStats = getPlayerStats;
51
53
  module.exports.createDiscordR6Webhook = createDiscordR6Webhook;
52
54
  module.exports.getGameStats = getGameStats;
53
55
  module.exports.getSeasonalStats = getSeasonalStats;
54
- module.exports.getPlayerComparisons = getPlayerComparisons;
56
+ module.exports.getPlayerComparisons = getPlayerComparisons;
57
+ module.exports.getIsBanned = getIsBanned;
@@ -0,0 +1,39 @@
1
+ const axiosInstance = require('../axiosInstance/axiosInstance');
2
+ const buildUrlAndParams = require('./util');
3
+
4
+ /**
5
+ * Get Rainbow Six Siege player ban status
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 ban status
10
+ */
11
+ async function getIsBanned({ 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: 'isBanned',
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 getIsBanned 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 = getIsBanned;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "r6-data.js",
3
- "version": "1.7.3",
3
+ "version": "1.8.2",
4
4
  "description": "R6 (Rainbow Six Siege) API wrapper for player stats, operators, maps, ranks, seasons, and game data. Typescript support. Last Updated Y10S4",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -2,6 +2,7 @@
2
2
 
3
3
  import {
4
4
  AccountInfoParams,
5
+ GetIsBannedParams,
5
6
  PlayerStatsParams,
6
7
  SeasonalStatsParams,
7
8
  PlayerComparisonsParams,
@@ -23,6 +24,7 @@ import {
23
24
  } from './result-interfaces';
24
25
 
25
26
  export function getAccountInfo(params: AccountInfoParams): Promise<any>;
27
+ export function getIsBanned(params: GetIsBannedParams): Promise<any>;
26
28
  export function getPlayerStats(params: PlayerStatsParams): Promise<any>;
27
29
  export function getSeasonalStats(params: SeasonalStatsParams): Promise<any>;
28
30
  export function getServiceStatus(): Promise<any>;
@@ -7,6 +7,8 @@ export interface AccountInfoParams {
7
7
  platformType: PlatformType;
8
8
  }
9
9
 
10
+ export interface GetIsBannedParams extends AccountInfoParams {}
11
+
10
12
  export interface PlayerStatsParams extends AccountInfoParams {
11
13
  platform_families: PlatformFamily;
12
14
  board_id?: BoardId;