thelinmichael/spotify-web-api-node

is_local should be an optional property of SpotifyApi.TrackObjectFull

RuurdBijlsma opened this issue · 1 comments

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;
}

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