Kshabazz\BattleNet\D3\Connections\Http¶
-
class
Http
¶ Class Http
-
constant
API_PROFILE_URL
¶
-
constant
API_HERO_URL
¶
-
constant
API_ITEM_URL
¶
-
constant
AUTHORIZE_URI
¶
-
constant
TOKEN_URI
¶
-
__construct
($pApiKey, $pBattleNetId, $pClient, $pLocale = 'en_US')¶ Constructor
Parameters: - $pApiKey (string) – Key obtained for use with Diablo 3 REST service.
- $pBattleNetId (string) – BattleNet ID.
- $pClient (KshabazzSlibHttpClient) – Client for making HTTP request.
- $pLocale (string) –
-
__destruct
()¶ Destructor
-
battleNetUrlSafeId
()¶ Get BattleNet ID with the pound symbol replaced with a dash.
Returns: string BattleNet ID
-
battleNetId
()¶ Get BattleNet ID
Returns: string BattleNet ID
-
getHero
($pHeroId)¶ Request Hero JSON from Battle.Net.
<code> <?php // Make a request to: // https://us.api.battle.net/d3/profile/<battleNetIdName>-<battleNetIdNumber>/hero/<hero-id>?locale=<string>&apikey=<> // Note: Leave off the trailing ‘/’ when setting ?> </code>
Parameters: - $pHeroId (int) – Hero ID.
Returns: null|string
-
getItem
($pItemId)¶ Make a request to the API to get an item (JSON).
<code> // Make a request to: // https://us.battle.net/api/d3/data/item/COGHsoAIEgcIBBXIGEoRHYQRdRUdnWyzFB2qXu51MA04kwNAAFAKYJMD </code>
Parameters: - $pItemId (string) – Can be obtained from items a hero has equipped.
Returns: string|null API JSON data.
-
getItemsAsModels
($pItemHashes)¶ For each item the hero has equipped construct an ModelItem and return them as an array. This is costly, it makes an HTTP request for each item in the list.
Parameters: - $pItemHashes (array) – List of item hash IDs.
Returns: array|null Item models
-
getProfile
()¶ Get a profile from Battle.net. <code> // Makes a request to: https://us.api.battle.net/d3/profile/<battleNetIdName>-<battleNetIdNumber>/
</code>
Returns: null|string
-
setRegion
($pRegion)¶ Set the region.
Parameters: - $pRegion –
Returns: string
-
url
()¶ Returns: string
-
constant