Skip to content

Commit

Permalink
Added All api end point except findmatches and explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
xitox97 committed Apr 25, 2020
1 parent f1d4650 commit 32a2309
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ build
composer.lock
docs
vendor
coverage
coverage
.phpunit.result.cache
1 change: 0 additions & 1 deletion .phpunit.result.cache

This file was deleted.

83 changes: 83 additions & 0 deletions src/LaravelOpendota.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public function __construct()

/**
* Get player details based on player dota 2 ID
* @param int $player_id {account_id}
*/
public function getPlayer($player_id)
{
Expand All @@ -23,6 +24,8 @@ public function getPlayer($player_id)

/**
* Get player Win/Loss count
* @param int $player_id {account_id}
* @param mixed $params = [] Assoc array of parameters applied (see OpenDota docs for reference)
*/
public function getPlayerWL($player_id, $params = [])
{
Expand All @@ -31,6 +34,7 @@ public function getPlayerWL($player_id, $params = [])

/**
* Get player Recent matches played
* @param int $player_id {account_id}
*/
public function getPlayerRecentMatches($player_id)
{
Expand All @@ -39,6 +43,8 @@ public function getPlayerRecentMatches($player_id)

/**
* Get player Matches played
* @param int $player_id {account_id}
* @param mixed $params = [] Assoc array of parameters applied (see OpenDota docs for reference)
*/
public function getPlayerMatches($player_id, $params = [])
{
Expand All @@ -47,6 +53,8 @@ public function getPlayerMatches($player_id, $params = [])

/**
* Get player Heroes played
* @param int $player_id {account_id}
* @param mixed $params = [] Assoc array of parameters applied (see OpenDota docs for reference)
*/
public function getPlayerHeroes($player_id, $params = [])
{
Expand All @@ -55,6 +63,8 @@ public function getPlayerHeroes($player_id, $params = [])

/**
* Get Players played with
* @param int $player_id {account_id}
* @param mixed $params = [] Assoc array of parameters applied (see OpenDota docs for reference)
*/
public function getPlayerPeers($player_id, $params = [])
{
Expand All @@ -63,6 +73,8 @@ public function getPlayerPeers($player_id, $params = [])

/**
* Get Pro players played with the player
* @param int $player_id {account_id}
* @param mixed $params = [] Assoc array of parameters applied (see OpenDota docs for reference)
*/
public function getPlayerPros($player_id, $params = [])
{
Expand All @@ -71,6 +83,8 @@ public function getPlayerPros($player_id, $params = [])

/**
* Get player's Totals in stats
* @param int $player_id {account_id}
* @param mixed $params = [] Assoc array of parameters applied (see OpenDota docs for reference)
*/
public function getPlayerTotals($player_id, $params = [])
{
Expand All @@ -79,6 +93,8 @@ public function getPlayerTotals($player_id, $params = [])

/**
* Get player's Counts in categories
* @param int $player_id {account_id}
* @param mixed $params = [] Assoc array of parameters applied (see OpenDota docs for reference)
*/
public function getPlayerCounts($player_id, $params = [])
{
Expand Down Expand Up @@ -146,6 +162,7 @@ public function postPlayerRefresh($player_id)

/**
* Get match details based on match ID
* @param string $match_id {match_id}
*/
public function getMatch($match_id)
{
Expand Down Expand Up @@ -210,6 +227,7 @@ public function getDistributions()

/**
* Search players by personaname.
* @param string $personaname
*/
public function searchPlayers($personaname)
{
Expand All @@ -218,6 +236,7 @@ public function searchPlayers($personaname)

/**
* Get Top players by hero
* @param int $hero_id
*/
public function getRankingsByHero($hero_id)
{
Expand All @@ -226,6 +245,7 @@ public function getRankingsByHero($hero_id)

/**
* Get Benchmarks of average stat values for a hero
* @param int $hero_id
*/
public function getBenchmarks($hero_id)
{
Expand Down Expand Up @@ -276,6 +296,7 @@ public function getHeroes()

/**
* Get recent matches with a hero
* @param int $hero_id
*/
public function getHeroMatches($hero_id)
{
Expand All @@ -284,6 +305,7 @@ public function getHeroMatches($hero_id)

/**
* Get results against other heroes for a hero
* @param int $hero_id
*/
public function getHeroMatchups($hero_id)
{
Expand All @@ -292,6 +314,7 @@ public function getHeroMatchups($hero_id)

/**
* Get hero performance over a range of match durations
* @param int $hero_id
*/
public function getHeroDurations($hero_id)
{
Expand All @@ -300,6 +323,7 @@ public function getHeroDurations($hero_id)

/**
* Get players who have played this hero
* @param int $hero_id
*/
public function getHeroPlayers($hero_id)
{
Expand All @@ -308,6 +332,7 @@ public function getHeroPlayers($hero_id)

/**
* Get item popularity of hero categoried by start, early, mid and late game, analyzed from professional games
* @param int $hero_id
*/
public function getHeroItemPopularity($hero_id)
{
Expand Down Expand Up @@ -340,6 +365,7 @@ public function getTeams()

/**
* Get data for a team
* @param int $team_id {team_id}
*/
public function getTeam($team_id)
{
Expand All @@ -348,6 +374,7 @@ public function getTeam($team_id)

/**
* Get matches for a team
* @param int $team_id {team_id}
*/
public function getTeamMatches($team_id)
{
Expand All @@ -356,6 +383,7 @@ public function getTeamMatches($team_id)

/**
* Get players who have played for a team
* @param int $team_id {team_id}
*/
public function getTeamsPlayer($team_id)
{
Expand All @@ -364,6 +392,7 @@ public function getTeamsPlayer($team_id)

/**
* Get heroes for a team
* @param int $team_id {team_id}
*/
public function getTeamsHeroes($team_id)
{
Expand All @@ -372,12 +401,22 @@ public function getTeamsHeroes($team_id)

/**
* Get data to construct a replay URL with
* @param string $match_id {match_id}
*/
public function getReplays($match_id)
{
return Http::get($this->api_url . 'replays', ['match_id' => $match_id]);
}

/**
* Get top performances in a stat
* @param string $field {match_id} Field name to query
*/
public function getRecords($field)
{
return Http::get($this->api_url . 'records/' . $field);
}

/**
* Get top currently ongoing live games
*/
Expand All @@ -386,4 +425,48 @@ public function getLive()
return Http::get($this->api_url . 'live');
}

/**
* Get Win rates for certain item timings on a hero for items that cost at least 1400 gold
* @param mixed $params = [] Assoc array of parameters applied to filter matches (see OpenDota docs for reference)
*/
public function getScenariosItemTimings($params = [])
{
return Http::get($this->api_url . 'scenarios/itemTimings' , $params);
}

/**
* Win rates for heroes in certain lane roles
* @param mixed $params = [] Assoc array of parameters applied to filter matches (see OpenDota docs for reference)
*/
public function getScenariosLaneRoles($params = [])
{
return Http::get($this->api_url . 'scenarios/laneRoles' , $params);
}

/**
* Win rates for heroes in certain lane roles
* @param mixed $params = [] Assoc array of parameters applied to filter matches (see OpenDota docs for reference)
*/
public function getScenariosMisc($params = [])
{
return Http::get($this->api_url . 'scenarios/misc' , $params);
}

/**
* Get database schema
*/
public function getSchema()
{
return Http::get($this->api_url . 'schema');
}

/**
* Get static game data mirrored from the dotaconstants repository. If no resource is specified, returns an array of available resources.
* Resources: https://github.com/odota/dotaconstants/tree/master/build
*/
public function getConstants($resource = '')
{
return Http::get($this->api_url . 'constants', ['resource' => $resource]);
}

}
12 changes: 6 additions & 6 deletions tests/ExampleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ public function test_laravel_http_player()
// $this->assertSame(113429216, $player);
// }

public function test_get_players_by_rank_function()
{
$openDota = new LaravelOpendota();
// public function test_get_players_by_rank_function()
// {
// $openDota = new LaravelOpendota();

$players = $openDota->getLive();
// $players = $openDota->getLive();

dd($players->json());
}
// dd($players->json());
// }
}

0 comments on commit 32a2309

Please sign in to comment.