Skip to content

Commit

Permalink
Merge pull request #56 from alfg/OzairP-master
Browse files Browse the repository at this point in the history
Ozair p master
  • Loading branch information
alfg authored Oct 21, 2018
2 parents ff19b3c + abb8c80 commit be65273
Show file tree
Hide file tree
Showing 3 changed files with 158 additions and 0 deletions.
148 changes: 148 additions & 0 deletions api/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
export as namespace OverwatchAPI
export = OverwatchAPI

declare namespace OverwatchAPI {
type PLATFORM = 'pc' | 'xbl' | 'psn'
type REGION = 'us' | 'eu' | 'kr' | 'cn' | 'global'

function getProfile(platform: PLATFORM, region: REGION, tag: string, callback: (err: Error, data: Profile) => void): void

function getStats(platform: PLATFORM, region: REGION, tag: string, callback: (err: Error, data: Stats) => void): void

interface owl {
getLiveMatch(callback: (err: Error, data: any) => void): void

getStandings(callback: (err: Error, data: any) => void): void

getSchedule(callback: (err: Error, data: any) => void): void
}

interface Endorsement {
value: number,
rate: number
}

interface Profile {
username: string,
level: number,
portrait: string,
endorsement: {
sportsmanship: Endorsement,
shotcaller: Endorsement,
teammate: Endorsement,
level: number,
frame: string,
icon: string,
},
private: boolean,
games: {
quickplay: {
won: number,
played: undefined
},
competitive: {
won: number,
lost: number,
draw: number,
played: number,
win_rate: number
}
},
playtime: {
quickplay: string,
competitive: string
},
competitive: {
rank: number,
rank_img: string
},
levelFrame: string,
star: string
}

interface Hero {
hero: string,
img: string
}

interface HeroPlaytime extends Hero {
played: string,
}

interface HeroWins extends Hero {
games_won: string,
}

interface HeroAccuracy extends Hero {
weapon_accuracy: string,
}

interface HeroElimsPerLife extends Hero {
eliminations_per_life: string,
}

interface HeroMultiKillBest extends Hero {
multikill_best: string,
}

interface HeroObjectiveKillsAverage extends Hero {
objective_kills_average: string,
}

interface HeroWinRate extends Hero {
win_rate: string,
}

interface Stat {
title: string,
value: string
}

interface QuickplayCompetitiveStats {
quickplay: Array<Stat>,
competitive: Array<Stat>
}

interface Stats {
username: string,
level: number,
portrait: string,
endorsement: {
sportsmanship: Endorsement,
shotcaller: Endorsement,
teammate: Endorsement,
level: number,
frame: string,
icon: string,
},
private: boolean,
stats: {
top_heroes: {
quickplay: {
played: Array<HeroPlaytime>,
games_won: Array<HeroWins>,
weapon_accuracy: Array<HeroAccuracy>,
eliminations_per_life: Array<HeroElimsPerLife>,
multikill_best: Array<HeroMultiKillBest>,
objective_kills_average: Array<HeroObjectiveKillsAverage>
},
competitive: {
played: Array<HeroPlaytime>,
games_won: Array<HeroWins>,
weapon_accuracy: Array<HeroAccuracy>,
eliminations_per_life: Array<HeroElimsPerLife>,
multikill_best: Array<HeroMultiKillBest>,
objective_kills_average: Array<HeroObjectiveKillsAverage>,
win_rate: Array<HeroWinRate>
}
},
combat: QuickplayCompetitiveStats,
match_awards: QuickplayCompetitiveStats,
assists: QuickplayCompetitiveStats,
average: QuickplayCompetitiveStats,
miscellaneous: QuickplayCompetitiveStats,
best: QuickplayCompetitiveStats,
game: QuickplayCompetitiveStats
}
}
}
1 change: 1 addition & 0 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.7.0",
"description": "An Unoffical Overwatch API.",
"main": "lib/index.js",
"typings": "index.d.ts",
"engines": {
"node": ">=6.11.1"
},
Expand Down
9 changes: 9 additions & 0 deletions test-script/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const overwatch = require('overwatch-api');

const platform = 'psn';
const region = 'global';
const tag = 'Drollestmaple03';

overwatch.getProfile(platform, region, tag, (err, json) => {
console.log(json);
});

0 comments on commit be65273

Please sign in to comment.