thelinmichael / spotify-web-api-node

A Node.js wrapper for Spotify's Web API.
http://thelinmichael.github.io/spotify-web-api-node/
MIT License
3.1k stars 499 forks source link

is_local should be an optional property of SpotifyApi.TrackObjectFull #500

Open RuurdBijlsma opened 10 months ago

RuurdBijlsma commented 10 months ago

When you retrieve a spotify track from either "liked" or a playlist, a property is added to the track object: is_local.

Example in api docs: https://developer.spotify.com/documentation/web-api/reference/get-users-saved-tracks

Current SpotifyApi.TrackObjectFull type definition:

interface TrackObjectFull extends TrackObjectSimplified {
  album: AlbumObjectSimplified;
  external_ids: ExternalIdObject;
  popularity: number;
}

interface TrackObjectSimplified {
  artists: ArtistObjectSimplified[];
  available_markets?: string[];
  disc_number: number;
  duration_ms: number;
  explicit: boolean;
  external_urls: ExternalUrlObject;
  href: string;
  id: string;
  is_playable?: boolean;
  linked_from?: TrackLinkObject;
  name: string;
  preview_url: string;
  track_number: number;
  type: 'track';
  uri: string;
}

In the API docs you can see in the docs that is_local is a property on the track object, on the same level as duration_ms, name, artists, album, etc.

Suggested fix:

Adjust TrackObjectFull, because PlaylistTrackObject and SavedTrackObject only use the full version, not the simplified track object:

interface TrackObjectFull extends TrackObjectSimplified {
  album: AlbumObjectSimplified;
  external_ids: ExternalIdObject;
  popularity: number;
  is_local?: boolean;
}
Abdullah-Malik commented 3 weeks ago

If you are looking to write an app with a newly written and updated SDK, take a look - https://github.com/Abdullah-Malik/spotified