# @ftw-cloud/cod-mw-api

> Wrapper for the Call Of Duty API.

Latest version **1.5.162** (published 2021-06-14) · 0 weekly downloads

## Install

```sh
npm install @ftw-cloud/cod-mw-api
pnpm add @ftw-cloud/cod-mw-api
yarn add @ftw-cloud/cod-mw-api
bun add @ftw-cloud/cod-mw-api
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.162 |
| Published | 2021-06-14 |
| First published | 2020-09-28 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 83.9 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | brandweb |
| Keywords | br, warzone, call-of-duty, call of duty, modern warfare, black ops, iw, battle royale |

## Links

- npm: https://www.npmjs.com/package/@ftw-cloud/cod-mw-api
- npm.io page: https://npm.io/package/@ftw-cloud/cod-mw-api

## Dependencies (3)

- [axios](https://npm.io/package/axios.md) ^0.20.0
- [uniqid](https://npm.io/package/uniqid.md) ^5.2.0
- [axios-rate-limit](https://npm.io/package/axios-rate-limit.md) ^1.2.1

## Alternatives

- [@snazzah/davey](https://npm.io/package/@snazzah/davey.md) — 1.5M weekly downloads
- [@vendure/testing](https://npm.io/package/@vendure/testing.md) — 8.3K weekly downloads
- [vue-simple-context-menu](https://npm.io/package/vue-simple-context-menu.md) — 6.6K weekly downloads
- [cypress-webpack-preprocessor-v5](https://npm.io/package/cypress-webpack-preprocessor-v5.md) — 2.1K weekly downloads
- [@backstage/plugin-catalog-backend-module-puppetdb](https://npm.io/package/@backstage/plugin-catalog-backend-module-puppetdb.md) — 1.3K weekly downloads

## Recent versions

- 1.5.162 (latest) — 2021-06-14
- 1.5.161 — 2021-06-09
- 1.5.160 — 2021-06-09
- 1.5.159 — 2021-06-01
- 1.5.158 — 2021-05-29
- 1.5.157 — 2021-05-25
- 1.5.156 — 2021-05-18
- 1.5.155 — 2021-05-18
- 1.5.154 — 2021-05-18
- 1.5.153 — 2021-05-13
- 1.5.150 — 2021-05-11
- 1.5.149 — 2021-05-11
- 1.5.148 — 2021-05-11
- 1.5.147 — 2021-05-06
- 1.5.146 — 2021-05-04
- … 128 more at https://npm.io/package/@ftw-cloud/cod-mw-api/versions

## README

# Call Of Duty API Wrapper

Call of Duty Api is a promised based wrapper for the "private" API that Activision use on the callofduty.com website.

## Install

```sh
npm install call-of-duty-api
```

## Initialize Module

```javascript
const API = require("call-of-duty-api")();
```

or

```javascript
const API = require("call-of-duty-api")({ platform: "battle" });
```

## List of Platforms

- psn
- steam
- xbl
- battle
- uno (activision ID)

```javascript
//How to access
API.platforms.psn;
```

Please note:
`uno` is for looking up via activision ID and this is only supported on a couple of endpoints.

### Supported Endpoints for activision ID

- MWcombatmp
- MWcombatwz
- MWmp
- MWwz
- MWstats

## Login

- This needs to be your activision account, not your platform login.

```javascript
 const API = require('call-of-duty-api')();
 API.login("<email>", "<password>").then(<?>).catch(<?>);
```

## Rate limiting

I have implemented axios-rate-limit incase you want to implement your own rate limitting.
All you need to do is pass a ratelimit object when initializing the module.

```javascript
const API = require("call-of-duty-api")({
  platform: "battle",
  ratelimit: { maxRequests: 2, perMilliseconds: 1000, maxRPS: 2 },
});
```

You can find out more about axios-rate-limit [here](https://www.npmjs.com/package/axios-rate-limit)

## Get Stats

```javascript
API.MWstats(<gamertag>, API.platforms.<platform>).then((output) => {
    console.log(output);
}).catch((err) => {
    console.log(err);
});
```

## Output

```javascript
{
    title: 'mw',
    platform: 'platform',
    username: 'gamertag',
    mp:
    { lifetime: { all: [Object], mode: [Object] },
    weekly: null,
    level: 0,
    maxLevel: 0,
    levelXpRemainder: 0,
    levelXpGained: 0,
    prestige: 0,
    prestigeId: 0,
    maxPrestige: 0 },
    zombies:
    { lifetime: { all: [Object], mode: {} },
    weekly: { all: [Object], mode: {} } },
    engagement: { timePlayedAll: 440544, seasonPass: 1 }
}
```

---

# Example Project

```javascript
const API = require("call-of-duty-api")({ platform: "battle" });
//I want Warzone Data
API.MWBattleData("Lierrmm#2364")
  .then((data) => {
    console.log(data); // see output
  })
  .catch((err) => {
    console.log(err);
  });
```

## Output

```javascript
[
  (br: {
    wins: 1,
    kills: 77,
    kdRatio: 1.2833333333333334,
    downs: 70,
    topTwentyFive: 20,
    topTen: 11,
    contracts: 15,
    revives: 0,
    topFive: 6,
    score: 55600,
    timePlayed: 27169,
    gamesPlayed: 20,
    scorePerMinute: 122.78699988958003,
    cash: 0,
    deaths: 60,
    title: "br",
  }),
  (br_dmz: {
    wins: 0,
    kills: 9,
    kdRatio: 1.2857142857142858,
    downs: 11,
    topTwentyFive: 0,
    topTen: 0,
    contracts: 2,
    revives: 0,
    topFive: 0,
    score: 4574,
    timePlayed: 1786,
    gamesPlayed: 1,
    scorePerMinute: 153.66181410974244,
    cash: 53,
    deaths: 7,
    title: "br_dmz",
  }),
  (br_all: {
    wins: 1,
    kills: 86,
    kdRatio: 1.2835820895522387,
    downs: 81,
    topTwentyFive: 20,
    topTen: 11,
    contracts: 17,
    revives: 0,
    topFive: 6,
    score: 60174,
    timePlayed: 28955,
    gamesPlayed: 21,
    scorePerMinute: 124.6914177171473,
    cash: 53,
    deaths: 67,
    title: "br_all",
  }),
];
```

---
_Source: https://npm.io/package/@ftw-cloud/cod-mw-api · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
