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 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 object |
59
|
|
|
*/ |
60
|
|
|
public function getUserPlaylists(string $userId, array $options = []) |
61
|
|
|
{ |
62
|
|
|
return $this->baseSpotifyWebAPI->getUserPlaylists($userId, $options); |
|
|
|
|
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @param string $userId |
67
|
|
|
* @param $playlistId |
68
|
|
|
* @param array $options |
69
|
|
|
* @return object |
70
|
|
|
*/ |
71
|
|
|
public function getUserPlaylistTracks(string $userId, $playlistId, array $options = []) |
72
|
|
|
{ |
73
|
|
|
return $this->baseSpotifyWebAPI->getUserPlaylistTracks($userId, $playlistId, $options); |
|
|
|
|
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @param string $query |
78
|
|
|
* @param array $type |
79
|
|
|
* @param array $options |
80
|
|
|
* @return object |
81
|
|
|
*/ |
82
|
|
|
public function search(string $query, array $type, array $options = []) |
83
|
|
|
{ |
84
|
|
|
return $this->baseSpotifyWebAPI->search($query, $type, $options); |
|
|
|
|
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @param string $accessToken |
89
|
|
|
*/ |
90
|
|
|
public function setAccessToken(string $accessToken) |
91
|
|
|
{ |
92
|
|
|
$this->baseSpotifyWebAPI->setAccessToken($accessToken); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
} |