|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
|
|
4
|
|
|
namespace SpotifyApiConnect\Application\SpotifyWebApiPhp; |
|
5
|
|
|
|
|
6
|
|
|
use SpotifyWebAPI\SpotifyWebAPI as BaseSpotifyWebAPI; |
|
7
|
|
|
|
|
8
|
|
|
class SpotifyWebApi implements SpotifyWebApiInterface |
|
9
|
|
|
{ |
|
10
|
|
|
/** |
|
11
|
|
|
* @var BaseSpotifyWebAPI |
|
12
|
|
|
*/ |
|
13
|
|
|
private $baseSpotifyWebAPI; |
|
14
|
|
|
|
|
15
|
|
|
public function __construct() |
|
16
|
|
|
{ |
|
17
|
|
|
$this->baseSpotifyWebAPI = new BaseSpotifyWebAPI(); |
|
18
|
|
|
} |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* @param string $userId |
|
22
|
|
|
* @param string $playlistId |
|
23
|
|
|
* @param array $tracks |
|
24
|
|
|
* @param array $options |
|
25
|
|
|
* @return bool |
|
26
|
|
|
*/ |
|
27
|
|
|
public function addUserPlaylistTracks(string $userId, string $playlistId, array $tracks, array $options = []) |
|
28
|
|
|
{ |
|
29
|
|
|
return $this->baseSpotifyWebAPI->addUserPlaylistTracks($userId, $playlistId, $tracks, $options); |
|
|
|
|
|
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @param string $userId |
|
34
|
|
|
* @param string $playlistId |
|
35
|
|
|
* @param array $tracks |
|
36
|
|
|
* @param string $snapshotId |
|
37
|
|
|
* @return bool|string |
|
38
|
|
|
*/ |
|
39
|
|
|
public function deleteUserPlaylistTracks(string $userId, string $playlistId, array $tracks, string $snapshotId = '') |
|
40
|
|
|
{ |
|
41
|
|
|
return $this->baseSpotifyWebAPI->deleteUserPlaylistTracks($userId, $playlistId, $tracks, $snapshotId); |
|
|
|
|
|
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @param string $userId |
|
46
|
|
|
* @param string $playlistId |
|
47
|
|
|
* @param array $options |
|
48
|
|
|
* @return array|object |
|
49
|
|
|
*/ |
|
50
|
|
|
public function getUserPlaylist(string $userId, string $playlistId, array $options = []) |
|
51
|
|
|
{ |
|
52
|
|
|
return $this->baseSpotifyWebAPI->getUserPlaylist($userId, $playlistId, $options); |
|
|
|
|
|
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* @param string $userId |
|
57
|
|
|
* @param array $options |
|
58
|
|
|
* @return array|object |
|
59
|
|
|
*/ |
|
60
|
|
|
public function getUserPlaylists(string $userId, array $options = []) |
|
61
|
|
|
{ |
|
62
|
|
|
return $this->baseSpotifyWebAPI->getUserPlaylists($userId, $options); |
|
|
|
|
|
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @param $playlistId |
|
67
|
|
|
* @param array $options |
|
68
|
|
|
* @return array|object |
|
69
|
|
|
*/ |
|
70
|
|
|
public function getPlaylistTracks(string $playlistId, array $options = []) |
|
71
|
|
|
{ |
|
72
|
|
|
return $this->baseSpotifyWebAPI->getPlaylistTracks($playlistId, $options); |
|
|
|
|
|
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* @param string $query |
|
77
|
|
|
* @param array $type |
|
78
|
|
|
* @param array $options |
|
79
|
|
|
* @return array|object |
|
80
|
|
|
*/ |
|
81
|
|
|
public function search(string $query, array $type, array $options = []) |
|
82
|
|
|
{ |
|
83
|
|
|
return $this->baseSpotifyWebAPI->search($query, $type, $options); |
|
|
|
|
|
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* @param string $accessToken |
|
88
|
|
|
*/ |
|
89
|
|
|
public function setAccessToken(string $accessToken) |
|
90
|
|
|
{ |
|
91
|
|
|
$this->baseSpotifyWebAPI->setAccessToken($accessToken); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
} |