Skip to content

Commit

Permalink
update to 18.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
leamare committed Mar 14, 2020
1 parent 0e345c5 commit e6b60c4
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 8 deletions.
13 changes: 13 additions & 0 deletions ENDPOINTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ API Endpoint | Function | Parameters

API Endpoint | Function | Parameters
-- | -- | --
`GET /playersByRank` | `playersByRank()` |
`GET /players/{account_id}` | `player($player_id)` | `$player_id (int) = {account_id}`
`GET /players/{account_id}/wl` | `player_winloss($player_id [, $params])` | `$player_id (int) = {account_id}`, `$params`
`GET /players/{account_id}/recentMatches` | `player_recent_matches($player_id)` | `$player_id (int) = {account_id}`
Expand Down Expand Up @@ -48,6 +49,12 @@ API Endpoint | Function | Parameters
-- | -- | --
`GET /publicMatches` | `public_matches([$less_than_match_id])` | `$less_than_match_id (int) = less_than_match_id` - Get matches with a match ID lower than this value; null = not set (default)

### Parsed Matches

API Endpoint | Function | Parameters
-- | -- | --
`GET /parsedMatches` | `parsed_matches([$less_than_match_id])` | `$less_than_match_id (int) = less_than_match_id` - Get matches with a match ID lower than this value; null = not set (default)

### Explorer

API Endpoint | Function | Parameters
Expand Down Expand Up @@ -174,6 +181,12 @@ API Endpoint | Function | Parameters
-- | -- | --
`GET /admin/apiMetrics` | `api_metrics()` | none

### Constants

API Endpoint | Function | Parameters
-- | -- | --
`GET /constants/{resource}` | `constants()` | `$resource (string) = {resource}` - Resource name e.g. `heroes`

### Find Matches

API Endpoint | Function | Parameters
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# Simple OpenDota API library for PHP

### API version: 17.7.0
### API version: 18.0.0

Simple OpenDota API support realization for PHP.
Simple OpenDota API support for PHP.

Handles API cooldown (to not get banned), API key usage, usage of various instances of OpenDota, Cli reporting.

It's sync only version with weird methods naming. It's intended to be used for **simple** PHP scripts (cli ones in the first place). For Async version made for ReactPHP look for reactive-opendota-php.

Note: It doesn't have an implementation for /feed endpoint. The endpoint tends to be unstable and it also requires HTTP streams support which doesn't work well with sync PHP.

## Requirements

Expand Down
56 changes: 50 additions & 6 deletions simple_opendota.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,18 @@ public function match($match_id, $mode = 0) {
return $this->request("matches/".$match_id, $mode);
}

// ********** Players By Rank

/**
* GET /playersByRank
* Players ordered by rank/medal tier
*
* @return mixed $result List of players [ account_id, rank_tier, fh_unavailable ]
*/
public function playersByRank($mode = 0) {
return $this->request("playersByRank", $mode);
}

// ********** Players

/**
Expand Down Expand Up @@ -511,6 +523,26 @@ public function public_matches($less_than_match_id = null, $sort = 0, $mode = 0)
return $this->request("publicMatches", $mode, $params);
}

// ********** Parsed Matches

/**
* GET /parsedMatches
* Get list of randomly sampled public matches
*
* @param int $less_than_match_id = null Get matches with a match ID lower than this value
* @param int $mode = 0 Fast mode flag (skip requests if cooldown or wait for API)
*
* @return mixed $result
*/
public function parsed_matches($less_than_match_id = null, $mode = 0) {
$params = [];

if ( $less_than_match_id !== null )
$params['less_than_match_id'] = (int)$less_than_match_id;

return $this->request("parsedMatches", $mode, $params);
}

// ********* Explorer

/**
Expand Down Expand Up @@ -564,20 +596,16 @@ public function distributions($mode = 0) {
* Search players by personaname
*
* @param string $request Search query string
* @param float $similarity = 0.51 Minimum similarity treshold, between 0 and 1
* @param int $mode = 0 Fast mode flag (skip requests if cooldown or wait for API)
*
* @return mixed $result
*/
public function search($request, $similarity=0.51, $mode = 0) {
public function search($request, $mode = 0) {
$params = [];

if ( empty($request) )
return \false;

if ( $similarity != 0.51 )
$params['similarity'] = (float) $similarity;

$params['q'] = $request;

return $this->request("search", $mode, $params);
Expand Down Expand Up @@ -726,7 +754,7 @@ public function hero_durations($hero_id, $mode = 0) {
return $this->request("heroes/".((int)$hero_id)."/durations", $mode);
}

/**
/**
* GET /heroes/{hero_id}/players
* Get players who have played this hero
*
Expand Down Expand Up @@ -966,6 +994,22 @@ public function find_matches($teams, $mode = 0) {
return $this->request("findMatches", $mode, $teams);
}

// ********** Constants

/**
* GET /constants
* Get static game data mirrored from the dotaconstants repository
* Resources: https://github.com/odota/dotaconstants/tree/master/build
*
* @param string $resource Resource name e.g. heroes
* @param int $mode = 0 Fast mode flag (skip requests if cooldown or wait for API)
*
* @return mixed $result
*/
public function constants($resource, $mode = 0) {
return $this->request("constants/".$resource, $mode);
}

// ********** Feed

/**
Expand Down

0 comments on commit e6b60c4

Please sign in to comment.