SpotifyWebAPI\SpotifyWebAPI::reorderUserPlaylistTracks PHP Метод

reorderUserPlaylistTracks() публичный Метод

Requires a valid access token. https://developer.spotify.com/web-api/reorder-playlists-tracks/
public reorderUserPlaylistTracks ( string $userId, string $playlistId, array | object $options ) : string | boolean
$userId string ID of the user.
$playlistId string ID of the playlist.
$options array | object Options for the new . - int range_start Required. Position of the first track to be reordered. - int range_length Optional. The amount of tracks to be reordered. - int insert_before Required. Position where the tracks should be inserted. - string snapshot_id Optional. The playlist's snapshot ID.
Результат string | boolean A new snapshot ID or false if the tracks weren't successfully reordered.
    public function reorderUserPlaylistTracks($userId, $playlistId, $options)
    {
        $options = json_encode($options);
        $headers = $this->authHeaders();
        $headers['Content-Type'] = 'application/json';
        $uri = '/v1/users/' . $userId . '/playlists/' . $playlistId . '/tracks';
        $this->lastResponse = $this->request->api('PUT', $uri, $options, $headers);
        $body = $this->lastResponse['body'];
        if (isset($body->snapshot_id)) {
            return $body->snapshot_id;
        }
        return false;
    }