| @@ 67-80 (lines=14) @@ | ||
| 64 | * |
|
| 65 | * @return Setlist[] |
|
| 66 | */ |
|
| 67 | public function getArtistSetlists(string $mbid, int $page = 1): array |
|
| 68 | { |
|
| 69 | $response = $this->connection->call('artist/'.$mbid.'/setlists', [ |
|
| 70 | 'p' => $page, |
|
| 71 | ]); |
|
| 72 | ||
| 73 | if (!\array_key_exists('setlist', $response)) { |
|
| 74 | return []; |
|
| 75 | } |
|
| 76 | ||
| 77 | return array_map(static function ($data) { |
|
| 78 | return Setlist::fromApi($data); |
|
| 79 | }, $response['setlist']); |
|
| 80 | } |
|
| 81 | ||
| 82 | /** |
|
| 83 | * Get venue setlists. |
|
| @@ 90-103 (lines=14) @@ | ||
| 87 | * |
|
| 88 | * @return Setlist[] |
|
| 89 | */ |
|
| 90 | public function getVenueSetlists(string $venueId, int $page = 1): array |
|
| 91 | { |
|
| 92 | $response = $this->connection->call('venue/'.$venueId.'/setlists', [ |
|
| 93 | 'p' => $page, |
|
| 94 | ]); |
|
| 95 | ||
| 96 | if (!\array_key_exists('setlist', $response)) { |
|
| 97 | return []; |
|
| 98 | } |
|
| 99 | ||
| 100 | return array_map(static function ($data) { |
|
| 101 | return Setlist::fromApi($data); |
|
| 102 | }, $response['setlist']); |
|
| 103 | } |
|
| 104 | ||
| 105 | /** |
|
| 106 | * Search for setlists. |
|
| @@ 53-66 (lines=14) @@ | ||
| 50 | * |
|
| 51 | * @return Setlist[] |
|
| 52 | */ |
|
| 53 | public function getAttends(string $userId, int $page = 1): array |
|
| 54 | { |
|
| 55 | $response = $this->connection->call('user/'.$userId.'/attended', [ |
|
| 56 | 'p' => $page, |
|
| 57 | ]); |
|
| 58 | ||
| 59 | if (!\array_key_exists('setlist', $response)) { |
|
| 60 | return []; |
|
| 61 | } |
|
| 62 | ||
| 63 | return array_map(static function ($data) { |
|
| 64 | return Setlist::fromApi($data); |
|
| 65 | }, $response['setlist']); |
|
| 66 | } |
|
| 67 | ||
| 68 | /** |
|
| 69 | * Get a list of edited venues for a user id. |
|
| @@ 76-89 (lines=14) @@ | ||
| 73 | * |
|
| 74 | * @return Setlist[] |
|
| 75 | */ |
|
| 76 | public function getEdits(string $userId, int $page = 1): array |
|
| 77 | { |
|
| 78 | $response = $this->connection->call('user/'.$userId.'/edited', [ |
|
| 79 | 'p' => $page, |
|
| 80 | ]); |
|
| 81 | ||
| 82 | if (!\array_key_exists('setlist', $response)) { |
|
| 83 | return []; |
|
| 84 | } |
|
| 85 | ||
| 86 | return array_map(static function ($data) { |
|
| 87 | return Setlist::fromApi($data); |
|
| 88 | }, $response['setlist']); |
|
| 89 | } |
|
| 90 | } |
|
| 91 | ||