ApiService

Main high-level class for services provided by the API wrapper.

package

petrepatrasc\BlizzardApiBundle\Service

Methods

__construct

__construct(\petrepatrasc\BlizzardApiBundle\Service\CallService $callService = null) 

Arguments

$callService

\petrepatrasc\BlizzardApiBundle\Service\CallService

The service that makes the actual API calls. As long as the API stays read-only, it will strictly be used as an extra dependency in order to mock the call to the WS.

Get a player's profile via the Battle.NET API.

getPlayerProfile(string $region, int $battleNetId, string $playerName, int $realm = 1) : \petrepatrasc\BlizzardApiBundle\Entity\Player

Arguments

$region

string

The region where the request should be made. Please use the Region class for consistency with future releases.

$battleNetId

int

The Battle.NET identifier of a player.

$playerName

string

The display name of the player.

$realm

int

The realm where the request should be made (defaults to 1).

Response

\petrepatrasc\BlizzardApiBundle\Entity\Player

Get the last ten matches that a player has played.

getPlayerLatestMatches(string $region, int $battleNetId, string $playerName, int $realm = 1) : array

Arguments

$region

string

The region where the request should be made. Please use the Region class for consistency with future releases.

$battleNetId

int

The Battle.NET identifier of a player.

$playerName

string

The display name of the player.

$realm

int

The realm where the request should be made (defaults to 1).

Response

array

An array containing Entity\Match entries.

Get information regarding a player's ladders.

getPlayerLaddersInformation(string $region, int $battleNetId, string $playerName, int $realm = 1) : \petrepatrasc\BlizzardApiBundle\Entity\Player\Ladder

Arguments

$region

string

The region where the request should be made. Please use the Region class for consistency with future releases.

$battleNetId

int

The Battle.NET identifier of a player.

$playerName

string

The display name of the player.

$realm

int

The realm where the request should be made (defaults to 1).

Response

\petrepatrasc\BlizzardApiBundle\Entity\Player\Ladder

Get information on the grandmaster league from a region.

getGrandmasterLeagueInformation(string $region, bool $previousSeason = false) : array

Arguments

$region

string

The region where the request should be made. Please use the Region class for consistency with future releases.

$previousSeason

bool

Whether the information should be for the previous season or not.

Response

array

Array containing all of the ladder members as LadderPosition instances.

Get information on a particular league from a region.

getLeagueInformation(string $region, int $id) : array

Arguments

$region

string

The region where the request should be made. Please use the Region class for consistency with future releases.

$id

int

The ID of the league.

Response

array

Get information on the rewards that are available.

getRewardsInformation(string $region) : \petrepatrasc\BlizzardApiBundle\Entity\Reward\Information

Arguments

$region

string

The region where the request should be made. Please use the Region class for consistency with future releases.

Response

\petrepatrasc\BlizzardApiBundle\Entity\Reward\Information

Get information on the achievements that are available.

getAchievementsInformation(string $region) : \petrepatrasc\BlizzardApiBundle\Entity\Achievement\Information

Arguments

$region

string

The region where the request should be made. Please use the Region class for consistency with future releases.

Response

\petrepatrasc\BlizzardApiBundle\Entity\Achievement\Information

Customisable league method, try using the wrapper methods first.

getLeagueInformationWrapper(string $region, array $parameters) : array

Arguments

$region

string

The region where the request should be made. Please use the Region class for consistency with future releases.

$parameters

array

The parameters that should be passed to the league API method.

Response

array

Array containing all of the ladder members as LadderPosition instances.

Make a call to the public API.

makeCall(string $region, string $apiMethod, array $params = array(), bool $trailingSlash = true) : array
throws

Arguments

$region

string

The region where the request should be made. Please use the Region class for consistency with future releases.

$apiMethod

string

The API method that should be called.

$params

array

The parameters that should be attached to the method call.

$trailingSlash

bool

Whether or not to include a trailing slash in the request (makes a large difference)

Response

array

JSON decoded array of the response.

Return a normalised player profile array, so that we have defaults set for everything in the event that certain values are not set in the array returned by the API.

getNormalisedPlayerProfileArray(array $apiData = array()) : array

Arguments

$apiData

array

The data that has been provided by the API and that should overwrite the default data.

Response

array

The API data, merged with the default data, into a normalised JSON decoded response.

Constants

Constants with URLS.

API_PROFILE_METHOD
todo

In the future, these should sit in a configuration file somewhere.

API_LADDER_METHOD

API_LADDER_METHOD

API_REWARDS_METHOD

API_REWARDS_METHOD

API_ACHIEVEMENTS_METHOD

API_ACHIEVEMENTS_METHOD

Properties

The service that makes the actual API calls. As long as the API stays read-only, it will strictly be used as an extra dependency in order to mock the call to the WS.

callService : 
var

CallService