1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Xklusive\BattlenetApi\Services; |
4
|
|
|
|
5
|
|
|
use Illuminate\Support\Collection; |
6
|
|
|
use Xklusive\BattlenetApi\BattlenetHttpClient; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* @author Guillaume Meheust <[email protected]> |
10
|
|
|
*/ |
11
|
|
|
class DiabloService extends BattlenetHttpClient |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* {@inheritdoc} |
15
|
|
|
*/ |
16
|
|
|
protected $gameParam = '/d3'; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Get a Hero profile data. |
20
|
|
|
* |
21
|
|
|
* Returns the hero profile of a Battle Tag's hero |
22
|
|
|
* |
23
|
|
|
* @param string $battleTag Battle Tag in name-#### format (ie. Noob-1234) |
24
|
|
|
* @param array ...$options |
25
|
|
|
* @return \GuzzleHttp\Exception\ClientException|Collection |
26
|
|
|
*/ |
27
|
|
|
public function getCareerProfile($battleTag, ...$options) |
28
|
|
|
{ |
29
|
|
|
return $this->cache('/profile/'.(string) urlencode($battleTag).'/', $options, __FUNCTION__); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Get profile information. |
34
|
|
|
* |
35
|
|
|
* Returns the hero profile of a Battle Tag's hero |
36
|
|
|
* |
37
|
|
|
* @param string $battleTag Battle Tag in name-#### format (ie. Noob-1234) |
38
|
|
|
* @param int $heroId The hero id of the hero to look up |
39
|
|
|
* @param array ...$options |
40
|
|
|
* @return \GuzzleHttp\Exception\ClientException|Collection |
41
|
|
|
*/ |
42
|
|
|
public function getHeroProfile($battleTag, $heroId, ...$options) |
43
|
|
|
{ |
44
|
|
|
return $this->cache('/profile/'.(string) urlencode($battleTag).'/hero/'.(int) $heroId, $options, __FUNCTION__); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Get data about an item. |
49
|
|
|
* |
50
|
|
|
* Returns data for a profile item |
51
|
|
|
* |
52
|
|
|
* @param string $itemDataString The item data string (from a profile) containing the item to lookup |
53
|
|
|
* @param array ...$options |
54
|
|
|
* @return \GuzzleHttp\Exception\ClientException|Collection |
55
|
|
|
*/ |
56
|
|
|
public function getItem($itemDataString, ...$options) |
57
|
|
|
{ |
58
|
|
|
return $this->cache('/data/item/'.(string) $itemDataString, $options, __FUNCTION__); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Get data about a follower. |
63
|
|
|
* |
64
|
|
|
* Returns data for a follower |
65
|
|
|
* |
66
|
|
|
* @param string $follower possible values (templar, scoundrel, enchantress) |
67
|
|
|
* @param array ...$options |
68
|
|
|
* @return \GuzzleHttp\Exception\ClientException|Collection |
69
|
|
|
*/ |
70
|
|
|
public function getFollowerData($follower, ...$options) |
71
|
|
|
{ |
72
|
|
|
return $this->cache('/data/follower/'.(string) $follower, $options, __FUNCTION__); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Get data about an artisan. |
77
|
|
|
* |
78
|
|
|
* Returns data for an artisan |
79
|
|
|
* |
80
|
|
|
* @param string $artisan The data about an artisan. Possible values (blacksmith, jeweler, mystic) |
81
|
|
|
* @param array ...$options |
82
|
|
|
* @return \GuzzleHttp\Exception\ClientException|Collection |
83
|
|
|
*/ |
84
|
|
|
public function getArtisanData($artisan, ...$options) |
85
|
|
|
{ |
86
|
|
|
return $this->cache('/data/artisan/'.(string) $artisan, $options, __FUNCTION__); |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|