-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetData.js
36 lines (33 loc) · 1.15 KB
/
getData.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const API = require('call-of-duty-api')({ platform: "battle" });
const login = require('./login');
/**
* Tries to fetch the short version data from the API for the specified player ID
* @param playerId the account id of the player to fetch API data for
* @return a promise with the fetch player data status
*/
async function getShortData(playerId) {
try {
var loginStatus = await login.login();
console.log(loginStatus);
console.log('Looking up short data for ' + playerId);
return API.MWBattleData(playerId);
} catch (Error) {
console.log('Error: ' + Error);
}
}
/**
* Tries to fetch the long version data from the API for the specified player ID
* @param playerId the account id of the player to fetch API data for
* @return a promise with the fetch player data status
*/
async function getLongData(playerId) {
try {
var loginStatus = await login.login();
console.log(loginStatus);
console.log('Looking up long data for ' + playerId);
return API.MWwz(playerId);
} catch (Error) {
console.log('Error: ' + Error);
}
}
module.exports = { getShortData, getLongData };