1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* (c) Christian Gripp <[email protected]> |
5
|
|
|
* |
6
|
|
|
* For the full copyright and license information, please view the LICENSE |
7
|
|
|
* file that was distributed with this source code. |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace Core23\SetlistFm\Service; |
11
|
|
|
|
12
|
|
|
use Core23\SetlistFm\Exception\ApiException; |
13
|
|
|
use Core23\SetlistFm\Exception\NotFoundException; |
14
|
|
|
|
15
|
|
|
final class SetlistService extends AbstractService |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* Get setlist information. |
19
|
|
|
* |
20
|
|
|
* @param string $setlistId |
21
|
|
|
* |
22
|
|
|
* @return array |
23
|
|
|
* |
24
|
|
|
* @throws ApiException |
25
|
|
|
* @throws NotFoundException |
26
|
|
|
*/ |
27
|
|
|
public function getSetlist(string $setlistId): array |
28
|
|
|
{ |
29
|
|
|
return $this->call('setlist/'.$setlistId); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Get setlist information by version id. |
34
|
|
|
* |
35
|
|
|
* @param string $versionId |
36
|
|
|
* |
37
|
|
|
* @return array |
38
|
|
|
* |
39
|
|
|
* @throws ApiException |
40
|
|
|
* @throws NotFoundException |
41
|
|
|
*/ |
42
|
|
|
public function getSetlistByVersion(string $versionId): array |
43
|
|
|
{ |
44
|
|
|
return $this->call('setlist/version/'.$versionId); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Get artist setlist information. |
49
|
|
|
* |
50
|
|
|
* @param string $mbid |
51
|
|
|
* @param int $page |
52
|
|
|
* |
53
|
|
|
* @return array |
54
|
|
|
* |
55
|
|
|
* @throws ApiException |
56
|
|
|
* @throws NotFoundException |
57
|
|
|
*/ |
58
|
|
|
public function getArtistSetlists(string $mbid, int $page = 1): array |
59
|
|
|
{ |
60
|
|
|
return $this->call('artist/'.$mbid.'/setlists', array( |
61
|
|
|
'p' => $page, |
62
|
|
|
))['setlist']; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Get venue setlist information. |
67
|
|
|
* |
68
|
|
|
* @param string $venueId |
69
|
|
|
* @param int $page |
70
|
|
|
* |
71
|
|
|
* @return array |
72
|
|
|
* |
73
|
|
|
* @throws ApiException |
74
|
|
|
* @throws NotFoundException |
75
|
|
|
*/ |
76
|
|
|
public function getVenueSetlists(string $venueId, int $page = 1): array |
77
|
|
|
{ |
78
|
|
|
return $this->call('venue/'.$venueId.'/setlists', array( |
79
|
|
|
'p' => $page, |
80
|
|
|
))['setlist']; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* Search for setlists. Returns setlists matches sorted by relevance. |
85
|
|
|
* |
86
|
|
|
* @param array $fields |
87
|
|
|
* @param int $page |
88
|
|
|
* |
89
|
|
|
* @return array |
90
|
|
|
* |
91
|
|
|
* @throws ApiException |
92
|
|
|
* @throws NotFoundException |
93
|
|
|
*/ |
94
|
|
|
public function search(array $fields, int $page = 1): array |
95
|
|
|
{ |
96
|
|
|
return $this->call('search/setlists', array_merge($fields, array( |
97
|
|
|
'p' => $page, |
98
|
|
|
)))['setlist']; |
99
|
|
|
} |
100
|
|
|
} |
101
|
|
|
|