-
Notifications
You must be signed in to change notification settings - Fork 11
/
Market.php
84 lines (65 loc) · 1.81 KB
/
Market.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
namespace XIVAPI\Api;
use GuzzleHttp\RequestOptions;
use XIVAPI\Guzzle\Guzzle;
class Market
{
public function item(int $itemId, array $servers = [], string $dc = '')
{
if (empty($servers) && empty($dc)) {
throw new \Exception('You must provide either a list of servers or a DC name');
}
$options = [];
if ($servers) {
$options['servers'] = implode(',', $servers);
}
if ($dc) {
$options['dc'] = $dc;
}
return Guzzle::get("/market/item/{$itemId}", [
RequestOptions::QUERY => $options
]);
}
public function items(array $itemIds, array $servers, string $dc = '')
{
if (empty($itemIds)) {
throw new \Exception('You must provide a list of item ids');
}
if (empty($servers) && empty($dc)) {
throw new \Exception('You must provide either a list of servers or a DC name');
}
$options = [];
$options['ids'] = implode(',', $itemIds);
if ($servers) {
$options['servers'] = implode(',', $servers);
}
if ($dc) {
$options['dc'] = $dc;
}
return Guzzle::get("/market/items", [
RequestOptions::QUERY => $options
]);
}
public function search($elasticQuery)
{
return Guzzle::get("/market/search", [
RequestOptions::JSON => $elasticQuery
]);
}
public function ids()
{
return Guzzle::get("/market/ids");
}
public function categories()
{
return Guzzle::get("/market/categories");
}
public function stats()
{
return Guzzle::get("/market/stats");
}
public function online()
{
return Guzzle::get("/market/online");
}
}