# overtrack.js

> A node wrapper for OverTrack

Latest version **0.3.2-alpha** (published 2017-11-04) · 0 weekly downloads

## Install

```sh
npm install overtrack.js
pnpm add overtrack.js
yarn add overtrack.js
bun add overtrack.js
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.2-alpha |
| Published | 2017-11-04 |
| First published | 2017-09-21 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | aidant |
| Keywords | overwatch, overtrack, lib, api |

## Links

- npm: https://www.npmjs.com/package/overtrack.js
- Repository: https://github.com/aidant/overtrack.js
- Homepage: https://github.com/aidant/overtrack.js#readme
- Issues: https://github.com/aidant/overtrack.js/issues
- npm.io page: https://npm.io/package/overtrack.js

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^0.16.2

## Alternatives

- [@cantoo/pdf-lib](https://npm.io/package/@cantoo/pdf-lib.md) — 297.9K weekly downloads
- [datatables.net-buttons](https://npm.io/package/datatables.net-buttons.md) — 200.1K weekly downloads
- [@ckeditor/ckeditor5-export-pdf](https://npm.io/package/@ckeditor/ckeditor5-export-pdf.md) — 167.0K weekly downloads
- [scanbot-web-sdk](https://npm.io/package/scanbot-web-sdk.md) — 15.0K weekly downloads
- [@syncfusion/ej2-angular-pdfviewer](https://npm.io/package/@syncfusion/ej2-angular-pdfviewer.md) — 8.8K weekly downloads

## Recent versions

- 0.3.2-alpha (latest) — 2017-11-04
- 0.3.1-alpha — 2017-11-01
- 0.3.0-alpha — 2017-11-01
- 0.2.3-alpha — 2017-10-29
- 0.2.2-alpha — 2017-10-02
- 0.2.1-alpha — 2017-10-02
- 0.2.0-alpha — 2017-10-02
- 0.1.0-alpha — 2017-09-29
- 0.0.5-alpha — 2017-09-27
- 0.0.4-alpha — 2017-09-26
- 0.0.3-alpha — 2017-09-25
- 0.0.2-alpha — 2017-09-23
- 0.0.1-alpha — 2017-09-23
- 0.0.0 — 2017-09-21

## README

# OverTrack.js
[![npm](https://img.shields.io/npm/v/overtrack.js.svg)](https://www.npmjs.com/package/overtrack.js)
[![GitHub issues](https://img.shields.io/github/issues/aidant/overtrack.js.svg)](https://github.com/aidant/overtrack.js/issues)
### Installing
###### NOTE
Node 8.x is required
```shell
npm install --save overtrack.js
```

### Example
```js
const ot = require('overtrack.js')

ot.player('eeveea')
  .then((games) => console.log(games))
  .catch(console.error)

```

<hr>

###### NOTE
I plan on writing better docs before release.
## Methods
###### NOTE
All methods return Promises

[ot.player(key)](#otplayerkey)<br>
[ot.sr(key[, options])](#otsrkey-options)<br>
[ot.clientVersion()](#otclientversion)<br>
[ot.lastMatch(key)](#otlastmatchkey)<br>

<hr>

### `ot.player(key)`
##### Returns: [Simple game object.](#simple)
##### Example:
```js
ot.player('eeveea')
  .then((games) => {
    const game = games[0]
    console.log('Simple game object:', game)
    return game.detailed()
  })
  .then((game) => console.log('Detailed game object:', game))
  .catch(console.error)
```

<hr>

### `ot.sr(key[, options])`
##### `options`
* **multipleAccounts:** `Boolean` Default: `false`

##### Returns: `Number` or `Array`
```js
  [
    { name: String, sr: Number },
    {...}
  ]
```
##### Example:
```js
ot.sr('eeveea')
  .then((sr) => console.log(sr))
  .catch(console.error)

ot.sr('eeveea', { multipleAccounts: true })
  .then((accounts) => {
    const message = accounts
      .map((x) => `${x.name}: ${x.sr}`)
      .join('\n')
    console.log(message)
  })
  .catch(console.error)
```

<hr>

### `ot.clientVersion()`
##### Returns: `Object`
```js
{
  message: String,
  number: String
}
```
##### Example:
```js
ot.clientVersion()
  .then((version) => console.log(version.message))
  .catch(console.error)
```

<hr>

### `ot.lastMatch(key)`
###### NOTE
Some fields may be null.
##### ~~Returns: [Simple game object.](#simple)~~
##### Example:
```js
ot.lastMatch('eeveea')
  .then((game) => {
    console.log('Last match:', game)
    return game.detailed()
  })
  .then((game) => console.log('Detailed game object:', game))
  .catch(console.error)
```

<hr>

## Objects

### `simple`

* `detailed`
  * Function, Returns: Promise<[Detailed game object](#detailed)>
* [`heroesPlayed`](#heroesplayed)
* [`map`](#map)
* [`misc`](#misc)
* [`result`](#result)
* [`season`](#season)
* [`sr`](#sr)
* [`time`](#time)

### `detailed`

* [`heroStatistics`](#herostatistics)
* [`heroesPlayed`](#heroesplayed)
* [`killfeed`](#killfeed)
* [`map`](#map)
* [`misc`](#misc)
* [`objectiveStages`](#objectivestages)
* [`result`](#result)
* [`season`](#season)
* [`sr`](#sr)
* [`time`](#time)
* [`teams`](#teams)

<hr>

### `heroStatistics`
```js
{
  elims: Number,
  damage: Number,
  objectiveKills: Number,
  healing: Number,
  objectiveTime: Number,
  deaths: Number,
  tabHealth: Number,
  timePlayed: Number,
  specific: [
    { value: Number, name: String },
    {...}
  ]
}
```

<hr>

### `heroesPlayed`
```js
[
  { hero: String, percent: Number },
  {...}
]
```

<hr>

### `killfeed`
###### NOTE
There are two different types of objects in the array kills, and resurrects.
```js
  [
    {
      left: {
        hero: String,
        player: String,
        team: 'blue' || 'red'
      },
      resurrect: true,
      right: {
        hero: String,
        player: String,
        team: 'blue' || 'red'
      },
      timestamp: Number
    },
    {
      assisters: [
        String
      ],
      killicon: {
        hero: String,
        ability: String
      },
      left: {
        hero: String,
        player: String,
        team: 'blue' || 'red'
      },
      resurrect: false,
      right: {
        hero: String,
        player: String,
        team: 'blue' || 'red'
      },
      timestamp: Number
    },
    {...}
  ]
```

<hr>

### `map`
```js
{
  name: String,
  type: String
}
```

<hr>

### `misc`
```js
  customGame: Boolean || null,
  key: String || null,
  url: String|| null,
  userId: Number || null,
  user: String || null,
  player: String || null,
  json: String || null,
  viewable: Boolean || null
```

<hr>

### `objectiveStages`
###### **This has not been parsed yet and is the raw info form overtarck api**

<hr>

### `result`
```js
{
  blue: {
    score: Number,
    outcome: String
  },
  red: {
    score: Number,
    outcome: String
  }
}
```

<hr>

### `season`
```js
{
  name: String,
  number: Number,
  offSeason: Boolean
}
```

<hr>

## `sr`
```js
{
  diff: Number,
  end: Number || null,
  name: String,
  start: Number || null
}
```

<hr>

### `teams`
```js
{
  blue: {
    sr: Number,
    players: [
      { name: String, rank: String },
      {...}
    ]
  },
  red: {
    sr: Number,
    players: [
      { name: String, rank: String },
      {...}
    ]
  }
}
```

<hr>

### `time`
```js
{
  start: Number,
  end: Number || null,
  length: Number
}
```

<hr>

## Development
Pull requests are welcome.
#### Linter
[JavaScript Standard Style](https://standardjs.com/#are-there-text-editor-plugins)

---
_Source: https://npm.io/package/overtrack.js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
