From 933aa88ea184db4b7f5727ae459309b756ea3544 Mon Sep 17 00:00:00 2001 From: Joshua Hall Date: Tue, 26 Jun 2018 09:04:39 -0500 Subject: [PATCH] Updated type declaration file based on guidelines/travis ci error messages --- types/overwatch-api/index.d.ts | 568 ++++++++++++++++----------------- 1 file changed, 284 insertions(+), 284 deletions(-) diff --git a/types/overwatch-api/index.d.ts b/types/overwatch-api/index.d.ts index f2e05c8ed2..8eaac311c8 100644 --- a/types/overwatch-api/index.d.ts +++ b/types/overwatch-api/index.d.ts @@ -1,328 +1,328 @@ -// Type definitions for overwatch-api +// Type definitions for overwatch-api 0.4 // Project: https://github.com/alfg/overwatch-api // Definitions by: JoshuaHall // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module "overwatch-api" { - type callbackFunc = (err: Error | null, data: T) => void; +// TypeScript Version: 2.1 - type OverwatchPlatform = "pc" | "xbl" | "psn"; - type OverwatchServerRegion = "us" | "eu" | "kr" | "cn" | "global"; - type OverwatchHero = - | "Zarya" - | "Mercy" - | "Reinhardt" - | "Zenyatta" - | "Hanzo" - | "Orisa" - | "Genji" - | "Roadhog" - | "McCree" - | "Tracer" - | "Ana" - | "Winston" - | "D.Va" - | "Moira" - | "Junkrat" - | "Soldier: 76" - | "Brigitte" - | "Lúcio" - | "Torbjörn" - | "Reaper" - | "Pharah" - | "Widowmaker" - | "Bastion" - | "Symmetra" - | "Mei" - | "Sombra" - | "Doomfist"; +export type callbackFunc = (err: Error | null, data: T) => void; - interface GameType { - won: number; - played: number; - } +export type OverwatchPlatform = "pc" | "xbl" | "psn"; +export type OverwatchServerRegion = "us" | "eu" | "kr" | "cn" | "global"; +export type OverwatchHero = + | "Zarya" + | "Mercy" + | "Reinhardt" + | "Zenyatta" + | "Hanzo" + | "Orisa" + | "Genji" + | "Roadhog" + | "McCree" + | "Tracer" + | "Ana" + | "Winston" + | "D.Va" + | "Moira" + | "Junkrat" + | "Soldier: 76" + | "Brigitte" + | "Lúcio" + | "Torbjörn" + | "Reaper" + | "Pharah" + | "Widowmaker" + | "Bastion" + | "Symmetra" + | "Mei" + | "Sombra" + | "Doomfist"; - type QuickplayGameType = GameType; +export interface GameType { + won: number; + played: number; +} + +export type QuickplayGameType = GameType; + +export interface CompetitiveGameType extends GameType { + lost: number; + draw: number; + win_rate: number; +} + +export interface GameTypes { + quickplay: QuickplayGameType; + competitive: CompetitiveGameType; +} + +export interface Playtime { + quickplay: string; + competitive: string; +} + +export interface CompetitiveRankInfo { + rank: number; + rank_img: string; +} + +export interface OverwatchApiResponse { + username: string; + level: number; + portrait: string; +} + +export interface ProfileApiResponse extends OverwatchApiResponse { + games: GameTypes; + playtime: Playtime; + competitive: CompetitiveRankInfo; + levelFrame: string; + star: string; +} + +export interface TopHeroStats { + hero: OverwatchHero; + img: string; +} + +export interface HeroTimePlayed extends TopHeroStats { + played: string; +} + +export interface HeroGamesWon extends TopHeroStats { + games_won: string; +} + +export interface HeroWinRate extends TopHeroStats { + win_rate: string; +} + +export interface Stat { + title: string; + value: string; +} + +export interface StatsByGameType { + quickplay: T[]; + competitive: T[]; +} + +export interface StatByGameType { + quickplay: T; + competitive: U; +} + +export interface QuickplayTopHeroData { + played: HeroTimePlayed[]; + games_won: HeroGamesWon[]; +} + +export interface CompetitiveTopHeroData extends QuickplayTopHeroData { + win_rate: HeroWinRate[]; +} + +export interface StatsCategories { + top_heroes: StatByGameType< + QuickplayTopHeroData, + CompetitiveTopHeroData + >; + combat: StatsByGameType; + match_awards: StatsByGameType; + assists: StatsByGameType; + average: StatsByGameType; + miscellaneous: StatsByGameType; + best: StatsByGameType; + game: StatsByGameType; +} + +export interface StatsApiResponse extends OverwatchApiResponse { + stats: StatsCategories; +} + +export function getProfile( + platform: OverwatchPlatform, + region: OverwatchServerRegion, + tag: string, + callback: callbackFunc, +): void; +export function getStats( + platform: OverwatchPlatform, + region: OverwatchServerRegion, + tag: string, + callback: callbackFunc, +): void; +export namespace owl { + interface ApiResponse { + data: T; + } + + interface StandingInfo { + matchWin: number; + matchLoss: number; + matchDraw: number; + matchBye: number; + gameWin: number; + gameLoss: number; + gameTie: number; + gamePointsFor: number; + gamePointsAgainst: number; + placement: number; + } - interface CompetitiveGameType extends GameType { - lost: number; - draw: number; - win_rate: number; + interface StandingComparison { + key: string; + value: number; } - interface GameTypes { - quickplay: QuickplayGameType; - competitive: CompetitiveGameType; + interface StageStandingInfo extends PreseasonStandingInfo { + isPlayoffWinner: boolean; } - interface Playtime { - quickplay: string; - competitive: string; + interface Stages { + stage1: StageStandingInfo; + stage2: StageStandingInfo; + stage3: StageStandingInfo; + stage4: StageStandingInfo; } - interface CompetitiveRankInfo { - rank: number; - rank_img: string; + interface PreseasonStandingInfo extends StandingInfo { + comparisons: StandingComparison[]; } - interface OverwatchApiResponse { - username: string; - level: number; - portrait: string; + interface TeamStandingInfo { + id: number; + divisionId: number; + name: string; + abbreviatedName: string; + league: StandingInfo; + stages: Stages; + preseason: PreseasonStandingInfo; } - interface ProfileApiResponse extends OverwatchApiResponse { - games: GameTypes; - playtime: Playtime; - competitive: CompetitiveRankInfo; - levelFrame: string; - star: string; + interface LiveMatchData { + liveMatch: {}; } - interface TopHeroStats { - hero: OverwatchHero; - img: string; + interface TournamentData { + id: number; + type: string; } - interface HeroTimePlayed extends TopHeroStats { - played: string; + interface MatchScores { + value: number; } - interface HeroGamesWon extends TopHeroStats { - games_won: string; + interface TeamData { + id: number; + availableLanguages: string[]; + handle: string; + name: string; + homeLocation: string; + primaryColor: string; + secondaryColor: string; + game: string; + abbreviatedName: string; + addressCountry: string; + logo: string; + icon: string; + secondaryPhoto: string; + type: string; } - interface HeroWinRate extends TopHeroStats { - win_rate: string; + interface MatchGameScore { + team1: number; + team2: number; } - interface Stat { - title: string; - value: string; + interface MatchGameAttributeData { + instanceID: string; + map: string; + mapScore: MatchGameScore; } - interface StatsByGameType { - quickplay: T[]; - competitive: T[]; + type ScoreTuple = [number, number]; + + interface MatchGameData { + id: number; + points: ScoreTuple; + attributes: MatchGameAttributeData; + attributesVersion: string; + state: string; + status: string; + statusReason: string; + stats: null; + handle: string; } - interface StatByGameType { - quickplay: T; - competitive: U; + interface MatchVideoData { + name: number; + description: string; + vodLink: string; + youtubeId: string; + thumbnailUrl: string; } - interface QuickplayTopHeroData { - played: HeroTimePlayed[]; - games_won: HeroGamesWon[]; + interface MatchTournamentData { + id: number; + type: string; + location: string; } - interface CompetitiveTopHeroData extends QuickplayTopHeroData { - win_rate: HeroWinRate[]; + interface MatchData { + id: number; + competitors: TeamData[]; + scores: MatchScores[]; + conclusionValue: number; + conclusionStrategy: string; + winner: TeamData; + state: string; + status: string; + statusReason: string; + attributes: {}; + games: MatchGameData[]; + clientHints: any[]; + dateCreated: number; + flags: any[]; + handle: string; + startDate: string; + endDate: string; + showStartTime: boolean; + showEndTime: boolean; + startDateTS: number; + endDateTS: number; + youtubeId: string; + wins: ScoreTuple; + ties: ScoreTuple; + losses: ScoreTuple; + videos: MatchVideoData[]; + tournament: MatchTournamentData; } - interface StatsCategories { - top_heroes: StatByGameType< - QuickplayTopHeroData, - CompetitiveTopHeroData - >; - combat: StatsByGameType; - match_awards: StatsByGameType; - assists: StatsByGameType; - average: StatsByGameType; - miscellaneous: StatsByGameType; - best: StatsByGameType; - game: StatsByGameType; + interface WeekData { + id: number; + startDate: number; + endDate: number; + matches: MatchData[]; + name: string; } - interface StatsApiResponse extends OverwatchApiResponse { - stats: StatsCategories; + interface StageScheduleInfo { + id: number; + slug: string; + enabled: boolean; + name: string; + tournament: TournamentData[]; + matches: MatchData[]; + weeks: WeekData[]; } - function getProfile( - platform: OverwatchPlatform, - region: OverwatchServerRegion, - tag: string, - callback: callbackFunc, - ): void; - function getStats( - platform: OverwatchPlatform, - region: OverwatchServerRegion, - tag: string, - callback: callbackFunc, - ): void; - namespace owl { - interface ApiResponse { - data: T; - } - - interface StandingInfo { - matchWin: number; - matchLoss: number; - matchDraw: number; - matchBye: number; - gameWin: number; - gameLoss: number; - gameTie: number; - gamePointsFor: number; - gamePointsAgainst: number; - placement: number; - } - - interface StandingComparison { - key: string; - value: number; - } - - interface StageStandingInfo extends PreseasonStandingInfo { - isPlayoffWinner: boolean; - } - - interface Stages { - stage1: StageStandingInfo; - stage2: StageStandingInfo; - stage3: StageStandingInfo; - stage4: StageStandingInfo; - } - - interface PreseasonStandingInfo extends StandingInfo { - comparisons: StandingComparison[]; - } - - interface TeamStandingInfo { - id: number; - divisionId: number; - name: string; - abbreviatedName: string; - league: StandingInfo; - stages: Stages; - preseason: PreseasonStandingInfo; - } - - interface LiveMatchData { - liveMatch: {}; - } - - interface TournamentData { - id: number; - type: string; - } - - interface MatchScores { - value: number; - } - - interface TeamData { - id: number; - availableLanguages: string[]; - handle: string; - name: string; - homeLocation: string; - primaryColor: string; - secondaryColor: string; - game: string; - abbreviatedName: string; - addressCountry: string; - logo: string; - icon: string; - secondaryPhoto: string; - type: string; - } - - interface MatchGameScore { - team1: number; - team2: number; - } - - interface MatchGameAttributeData { - instanceID: string; - map: string; - mapScore: MatchGameScore; - } - - type ScoreTuple = [number, number]; - - interface MatchGameData { - id: number; - points: ScoreTuple; - attributes: MatchGameAttributeData; - attributesVersion: string; - state: string; - status: string; - statusReason: string; - stats: null; - handle: string; - } - - interface MatchVideoData { - name: number; - description: string; - vodLink: string; - youtubeId: string; - thumbnailUrl: string; - } - - interface MatchTournamentData { - id: number; - type: string; - location: string; - } - - interface MatchData { - id: number; - competitors: TeamData[]; - scores: MatchScores[]; - conclusionValue: number; - conclusionStrategy: string; - winner: TeamData; - state: string; - status: string; - statusReason: string; - attributes: {}; - games: MatchGameData[]; - clientHints: any[]; - dateCreated: number; - flags: any[]; - handle: string; - startDate: string; - endDate: string; - showStartTime: boolean; - showEndTime: boolean; - startDateTS: number; - endDateTS: number; - youtubeId: string; - wins: ScoreTuple; - ties: ScoreTuple; - losses: ScoreTuple; - videos: MatchVideoData[]; - tournament: MatchTournamentData; - } - - interface WeekData { - id: number; - startDate: number; - endDate: number; - matches: MatchData[]; - name: string; - } - - interface StageScheduleInfo { - id: number; - slug: string; - enabled: boolean; - name: string; - tournament: TournamentData[]; - matches: MatchData[]; - weeks: WeekData[]; - } - - interface ScheduleInfo { - startDate: string; - endDate: string; - stages: StageScheduleInfo[]; - } - - function getLiveMatch(callback: callbackFunc>): void; - function getStandings(callback: callbackFunc>): void; - function getSchedule(callback: callbackFunc>): void; + interface ScheduleInfo { + startDate: string; + endDate: string; + stages: StageScheduleInfo[]; } + + function getLiveMatch(callback: callbackFunc>): void; + function getStandings(callback: callbackFunc>): void; + function getSchedule(callback: callbackFunc>): void; }