D3 - Diablo 3 REST Library¶
Description¶
A PHP library for accessing the Battle.net Diablo 3 REST service.
Contents:
Kshabazz\BattleNet\D3\Connections¶
Kshabazz\BattleNet\D3\Connections\Connection¶
-
class
Connection
¶ Interface Resource
-
getHero
($pHeroId)¶ Request Hero JSON from Battle.Net. ex: http://us.battle.net/api/d3/profile/<battleNetIdName>-<battleNetIdNumber>/hero/<hero-id> Note: Leave off the trailing ‘/’ when setting
Parameters: - $pHeroId –
Returns: string|null
-
getItem
($pItemId)¶ Get item JSON from Battle.Net D3 API. ex: http://us.battle.net/api/d3/data/item/COGHsoAIEgcIBBXIGEoRHYQRdRUdnWyzFB2qXu51MA04kwNAAFAKYJMD
Parameters: - $pItemId –
Returns: string|null
-
getItemsAsModels
($pItemHashes)¶ For each item the hero in the array construct an ModelItem and return them as an array.
Parameters: - $pItemHashes (array) – List of item hashes.
Returns: array|null
-
getProfile
()¶ ex: http://us.battle.net/api/d3/profile/<battleNetIdName>-<battleNetIdNumber>/
Returns: string|null
-
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
Kshabazz\BattleNet\D3\Connections\Sql¶
-
class
Sql
¶ Class Sql
-
__construct
($pBattleNetId, PDO $pPdo, $pIpAddress = NULL)¶ Constructor
Parameters: - $pBattleNetId (string) –
- $pPdo (PDO) –
- $pIpAddress (string) –
-
addRequest
($pUrl)¶ Add a record of the Battle.net Web API request.
Parameters: - $pUrl (string) – The Battle.net url web API URL requested.
Returns: bool|mixed
-
getHero
($pHeroId)¶ Get hero data from local database.
Parameters: - $pHeroId (int) –
Returns: string|null
-
getItem
($pItemHash)¶ Get item JSON data from local database.
Parameters: - $pItemHash (string) –
Returns: string|null
-
getItemsAsModels
($pItemHashes)¶ Parameters: - $pItemHashes –
-
getProfile
()¶ Get the profile from local database.
Returns: string|null
-
saveHero
($pHeroId, $pJson)¶ Save the hero in a local database.
Parameters: - $pHeroId –
- $pJson –
Returns: bool Indicates success (TRUE) or failure (FALSE).
-
saveItem
(Item $pItem, $shaString)¶ Save the item locally in a database.
Parameters: - $pItem (Item) –
- $shaString (string) – A unique string to use as a SHA seed for the item SHA value in the database.
Returns: bool
-
saveProfile
($pJson)¶ Save the users profile locally to the database.
Parameters: - $pJson (string) –
Returns: bool
-
Kshabazz\BattleNet\D3\Skills¶
Kshabazz\BattleNet\D3\Skills\Active¶
Kshabazz\BattleNet\D3\Skills\Passive¶
-
class
Passive
¶ Class Skill
-
__construct
($pProperies)¶ Parameters: - $pProperies –
-
description
()¶ Returns: string
-
flavor
()¶ Returns: string
-
name
()¶ Returns: string
-
orderIndex
()¶ Returns: int
-
requiredLevel
()¶ Returns: int
-
simpleDescription
()¶ Returns: string
-
slug
()¶ Returns: string
-
tooltipParams
()¶ Returns: string
-
getProperty
($property, $pProperties)¶ Get the property or return null.
Parameters: - $property –
- $pProperties –
Returns: null
-