wrapzone
v1.1.1
Published
A typed wrapper for the Call of Duty: Modern Warfare API
Downloads
8
Maintainers
Readme
Welcome to Wrapzone 👋
Wrapzone is a Wrapper for the Call of Duty® Modern Warfare (2019) API.
It aims to simplify parsing the huge JSON-File returned from the API endpoint.
Install
npm install wrapzone
Usage
Initialize a Wrapzone instance
const Wrapzone = require("wrapzone").default;
const platform = "<platform>" // psn | xbl | battle
const userName = "<userName>" // Username (include id for battle.net like name#12345)
await Wrapzone.authenticate('<ActivisionEmail>', '<ActivisionPassword>')
const player = await Wrapzone.get(platform, userName);
Updating a Wrapzone instance
A Wrapzone instance queries the API only once on instantiation to reduce unnecessary traffic.
It can be updated manually via
player.updatePlayerData() // Uses the saved platform and userName to fetch the data
player.setPlayerData(platform, userName) // Uses the provided platform and userName to fetch the data
Note: Both of these methods are async since the API is queried and should be awaited
All other methods on a Wrapzone object can be used to query the retrieved data. They are all synchronous.
A full documentation of all methods and types can be found here.
Getting the raw json
const raw = player.raw
Until this package covers all properties, the raw untyped json data can be retrieved to use how you want to.
The Wrapzone object can still be used to wrap the call to the API.