0.0.2 • Published 3 years ago

@mattplays/overwatch-api v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

OverwatchAPI

This package is a wrapper for the unofficial Overwatch API

  1. Overwatch
    1. Usage
    2. Functions
      1. GetProfile
        1. Inputs
        2. Output
        3. Usage
      2. GetCompleteStats
        1. Inputs
        2. Output
        3. Usage
      3. GetHeroStats
        1. Inputs
        2. Output
        3. Usage
    3. Return Types
      1. OverwatchProfile

Overwatch

This is an Unoffical API [Unoffical Docs](https://ow-api.com/docs/)

Usage

const {OverwatchAPI} = require("@mattplays/overwatch-api")
const API = new OverwatchAPI();

Functions

GetProfile

This endpoint retrieves stats commonly used by bots and other services.

Inputs
type OverwatchPlatform = "pc" | "xbox" | "ps4" | "nintendo-switch";
type OverwatchRegion = "us" | "eu" | "asia";
ParameterTypeRequiredDescription
platformOverwatchPlatformYesThe platform of the user
regionOverwatchRegionYesThe region of the user
battletagstringYesThe battletag of the user ie. My_Name_Is_Jeff_From_The_OW_Team#11561
Output

The GetProfile function returns a Promise<OverwatchProfile>

Usage
const API = new OverwatchAPI();
API.GetProfile("pc", "us", "My_Name_Is_Jeff_From_The_OW_Team#11561").then((data) => {
// Your Code Here :D
})

GetCompleteStats

Inputs
type OverwatchPlatform = "pc" | "xbox" | "ps4" | "nintendo-switch";
type OverwatchRegion = "us" | "eu" | "asia";
ParameterTypeRequiredDescription
platformOverwatchPlatformYesThe platform of the user
regionOverwatchRegionYesThe region of the user
battletagstringYesThe battletag of the user ie. My_Name_Is_Jeff_From_The_OW_Team#11561
Output

The GetCompleteStats function returns something im too lazy to add type def for so Promise<any> is what you get.

Usage
const API = new OverwatchAPI();
API.GetCompleteStats("pc", "us", "My_Name_Is_Jeff_From_The_OW_Team#11561").then((data) => {
// Your Code Here :D
})

GetHeroStats

Inputs
type OverwatchPlatform = "pc" | "xbox" | "ps4" | "nintendo-switch";
type OverwatchRegion = "us" | "eu" | "asia";
type OverwatchHeros = ['ana' , 'ashe' , 'baptiste' , 'bastion' , 'brigitte' , 'doomfist' , 'dva' , 'echo' , 'genji' , 'hammond' , 'hanzo' , 'junkrat' , 'lucio' , 'mccree' , 'mei' , 'mercy' , 'moira' , 'orisa' , 'pharah' , 'reaper' , 'reinhardt' , 'roadhog' , 'sigma' , 'soldier' , 'sombra' , 'symmetra' , 'torbjorn' , 'tracer' , 'widowmaker' , 'winston' , 'zarya' , 'zenyatta'];
ParameterTypeRequiredDescription
platformOverwatchPlatformYesThe platform of the user
regionOverwatchRegionYesThe region of the user
battletagstringYesThe battletag of the user ie. My_Name_Is_Jeff_From_The_OW_Team#11561
herosOverwatchHerosYesAn Array of heros you want stats for.
Output

The GetHeroStats function returns something i was also too lazy to type def so Promise<any> is your best friend.

Usage
const API = new OverwatchAPI();
API.GetHeroStats("pc", "us", "My_Name_Is_Jeff_From_The_OW_Team#11561", ["genji", "hanzo"]).then((data) => {
// Your Code Here :D
})

Return Types

OverwatchProfile

export interface OverwatchProfile {
    competitiveStats: {
        awards: {
            cards: number,
            medals: number,
            medalsBronze: number,
            medalsSilver: number,
            medalsGold: number
        },
        games: {
            played: number, 
            won: number
        },
    },
    endorsment: number,
    endorsementIcon: string,
    gamesWon: number,
    icon: string,
    level: number,
    levelIcon: string,
    name: string,
    prestige: number,
    prestigeIcon: string,
    private: boolean,
    quickPlayStats: {
        awards: {
            cards: number,
            medals: number,
            medalsBronze: number,
            medalsSilver: number,
            medalsGold: number,
        },
        games: {played: number, won: number},
    },
    rating: number,
    ratingIcon: string,
    ratings: {
        level: number, 
        role: string, 
        roleIcon: string
    }[],
}