criticalops-api
v1.0.2
Published
A wrapper for Critical Ops Game API
Downloads
5
Readme
criticalops-api
Description
criticalops-api
is a Node.js wrapper for accessing the Critical Ops Game API. It is developed by Nercly and is unofficial.
Installation
You can install criticalops-api
via npm:
npm install criticalops-api
Usage
const { fetchPlayerData } = require('criticalops-api');
// Example usage with player ID
fetchPlayerData('id', 'player_id_here')
.then(playerData => {
if (playerData) {
console.log(playerData);
} else {
console.log('Player not found.');
}
})
.catch(error => {
console.error('Error:', error);
});
// Example usage with player name
fetchPlayerData('name', 'player_name_here')
.then(playerData => {
if (playerData) {
console.log(playerData);
} else {
console.log('Player not found.');
}
})
.catch(error => {
console.error('Error:', error);
});
Output
{
basicInfo: {
userID: 197307608,
name: 'Nercly',
userType: 1,
iconID: 461,
playerLevel: {
level: 238,
current_xp: 16690,
next_level_xp: 20000
},
lastSeenTime: ''
},
userSettings: {
blockFriendRequests: false,
block_clan_requests: false
},
friendStatus: 0,
stats: {
seasonal_stats: [
{
season: 0,
ranked: {
k: 0,
d: 0,
a: 0,
w: 0,
l: 0
},
casual: {
k: 0,
d: 0,
a: 0,
w: 0,
l: 0
},
custom: {
k: 0,
d: 0,
a: 0,
w: 0,
l: 0
}
},
{
season: 1,
ranked: {
k: 0,
d: 0,
a: 0,
w: 0,
l: 0
},
casual: {
k: 0,
d: 0,
a: 0,
w: 0,
l: 0
},
custom: {
k: 0,
d: 0,
a: 0,
w: 0,
l: 0
}
},
{
season: 2,
ranked: {
k: 0,
d: 0,
a: 0,
w: 0,
l: 0
},
casual: {
k: 0,
d: 0,
a: 0,
w: 0,
l: 0
},
custom: {
k: 0,
d: 0,
a: 0,
w: 0,
l: 0
}
},
{
season: 3,
ranked: {
k: 0,
d: 0,
a: 0,
w: 0,
l: 0
},
casual: {
k: 0,
d: 0,
a: 0,
w: 0,
l: 0
},
custom: {
k: 0,
d: 0,
a: 0,
w: 0,
l: 0
}
},
{
season: 4,
ranked: {
k: 0,
d: 0,
a: 0,
w: 0,
l: 0
},
casual: {
k: 0,
d: 0,
a: 0,
w: 0,
l: 0
},
custom: {
k: 0,
d: 0,
a: 0,
w: 0,
l: 0
}
},
{
season: 5,
ranked: {
k: 0,
d: 0,
a: 0,
w: 0,
l: 0
},
casual: {
k: 0,
d: 0,
a: 0,
w: 0,
l: 0
},
custom: {
k: 0,
d: 0,
a: 0,
w: 0,
l: 0
}
},
{
season: 6,
ranked: {
k: 2524,
d: 3062,
a: 410,
w: 114,
l: 86
},
casual: {
k: 12971,
d: 9018,
a: 1558,
w: 90,
l: 29
},
custom: {
k: 4176,
d: 4558,
a: 310,
w: 0,
l: 0
}
},
{
season: 7,
ranked: {
k: 1209,
d: 1577,
a: 237,
w: 45,
l: 58
},
casual: {
k: 10886,
d: 7148,
a: 1223,
w: 211,
l: 43
},
custom: {
k: 2364,
d: 1207,
a: 36,
w: 0,
l: 0
}
},
{
season: 8,
ranked: {
k: 2220,
d: 2371,
a: 320,
w: 83,
l: 67
},
casual: {
k: 2284,
d: 1495,
a: 234,
w: 34,
l: 9
},
custom: {
k: 1183,
d: 1298,
a: 83,
w: 0,
l: 0
}
},
{
season: 9,
ranked: {
k: 1088,
d: 1179,
a: 182,
w: 36,
l: 42
},
casual: {
k: 649,
d: 465,
a: 80,
w: 4,
l: 1
},
custom: {
k: 591,
d: 573,
a: 30,
w: 0,
l: 0
}
},
{
season: 10,
ranked: {
k: 1141,
d: 1443,
a: 185,
w: 46,
l: 48
},
casual: {
k: 433,
d: 341,
a: 44,
w: 5,
l: 1
},
custom: {
k: 616,
d: 739,
a: 57,
w: 0,
l: 0
}
},
{
season: 11,
ranked: {
k: 0,
d: 0,
a: 0,
w: 0,
l: 0
},
casual: {
k: 0,
d: 0,
a: 0,
w: 0,
l: 0
},
custom: {
k: 0,
d: 0,
a: 0,
w: 0,
l: 0
}
}
],
ranked: {
placement_matches_left: 5,
highest_rank: 0,
rating: 1692,
rank: 0
}
},
ban: null,
clan: {
basicInfo: {
name: 'Wattielicious',
tag: 'WATX'
},
id: 15593,
memberRank: 10
}
}
API
fetchPlayerData(searchType, input)
searchType
: String - Specify whether to search by player ID ('id') or player name ('name').input
: String - Player ID or player name to search for.
Returns a Promise that resolves with the player data if found, or null
if not found or in case of an error.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
- Nercly (Discord: @nercly.)
Acknowledgements
This package utilizes the axios library for making HTTP requests.