@types/spotify-api
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -6,2 +6,3 @@ // Type definitions for The Spotify Web API (including changes March 29th 2016) | ||
// Nils Måsén <https://github.com/piksel> | ||
// Basti Ortiz <https://github.com/Some-Dood> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
@@ -30,17 +31,42 @@ // TypeScript Version: 2.2 | ||
* | ||
* q and type are not optional in the API, however they are marked as optional here, since various libraries | ||
* implement them as function call parameters instead. This could be changed. | ||
* | ||
* @param q Required. The search query's keywords (and optional field filters and operators). | ||
* @param type Required. A comma-separated list of item types to search across. Valid types are: album, artist, playlist, and track. | ||
* @param market Optional. An ISO 3166-1 alpha-2 country code or the string from_token | ||
* @param limit Optional. The maximum number of results to return. Default: 20. Minimum: 1. Maximum: 50. | ||
* @param offset Optional. The index of the first result to return. Default: 0 (i.e., the first result). Maximum offset: 100.000. Use with limit to get the next page of search results. | ||
* `q` and `type` are required in the API. Previous versions of the type declarations marked them | ||
* as optional in order for external libraries to "implement them as function call parameters instead". | ||
* Now, the type declaration shall mark them as required. If necessary, one can consider this to be a | ||
* "breaking change". In that case, one can use TypeScript's built-in utility type `Omit<T, K>`. | ||
* For example, one can remove the `q` and `type` by annotating the type | ||
* as `Omit<SpotifyApi.SearchForItemParameterObject, "q" | "type">`. | ||
*/ | ||
interface SearchForItemParameterObject { | ||
q?: string; | ||
type?: string; | ||
/** | ||
* The search query's keywords (and optional field filters and operators). | ||
*/ | ||
q: string; | ||
/** | ||
* A comma-separated list of item types to search across. Valid types are: `album`, `artist`, `playlist`, and `track`. | ||
* Search results include hits from all the specified item types. | ||
* For example: `q=name:abacab&type=album,track` returns both albums and tracks with `“abacab”` included in their name. | ||
*/ | ||
type: string; | ||
/** | ||
* An [ISO 3166-1 alpha-2 country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) or the string `from_token`. | ||
* If a country code is specified, only artists, albums, and tracks with content that is playable in that market is returned. | ||
*/ | ||
market?: string; | ||
/** | ||
* The maximum number of results to return. | ||
* Default: `20`. Minimum: `1`. Maximum: `50`. | ||
*/ | ||
limit?: number; | ||
/** | ||
* The index of the first result to return. | ||
* Default: `0` (first result). Maximum offset (including limit): `2,000`. | ||
* Use with limit to get the next page of search results. | ||
*/ | ||
offset?: number; | ||
/** | ||
* Possible values: `audio`. | ||
* If `include_external=audio` is specified, the response will include any relevant audio content that is hosted externally. | ||
* By default external content is filtered out from responses. | ||
*/ | ||
include_external?: string; | ||
} | ||
@@ -62,49 +88,49 @@ | ||
interface RecommendationsOptionsObject { | ||
limit?: number, | ||
market?: string, | ||
max_acousticness?: number, | ||
max_danceability?: number, | ||
max_duration_ms?: number, | ||
max_energy?: number, | ||
max_instrumentalness?: number, | ||
max_key?: number, | ||
max_liveness?: number, | ||
max_loudness?: number, | ||
max_mode?: number, | ||
max_popularity?: number, | ||
max_speechiness?: number, | ||
max_tempo?: number, | ||
max_time_signature?: number, | ||
max_valence?: number, | ||
min_acousticness?: number, | ||
min_danceability?: number, | ||
min_duration_ms?: number, | ||
min_energy?: number, | ||
min_instrumentalness?: number, | ||
min_key?: number, | ||
min_liveness?: number, | ||
min_loudness?: number, | ||
min_mode?: number, | ||
min_popularity?: number, | ||
min_speechiness?: number, | ||
min_tempo?: number, | ||
min_time_signature?: number, | ||
min_valence?: number, | ||
seed_artists?: string[] | string, // Array of strings or Comma separated string | ||
seed_genres?: string[] | string, // Array of strings or Comma separated string | ||
seed_tracks?: string[] | string, // Array of strings or Comma separated string | ||
target_acousticness?: number | ||
target_danceability?: number | ||
target_duration_ms?: number | ||
target_energy?: number | ||
target_instrumentalness?: number | ||
target_key?: number | ||
target_liveness?: number | ||
target_loudness?: number | ||
target_mode?: number | ||
target_popularity?: number | ||
target_speechiness?: number | ||
target_tempo?: number | ||
target_time_signature?: number | ||
target_valence?: number | ||
limit?: number; | ||
market?: string; | ||
max_acousticness?: number; | ||
max_danceability?: number; | ||
max_duration_ms?: number; | ||
max_energy?: number; | ||
max_instrumentalness?: number; | ||
max_key?: number; | ||
max_liveness?: number; | ||
max_loudness?: number; | ||
max_mode?: number; | ||
max_popularity?: number; | ||
max_speechiness?: number; | ||
max_tempo?: number; | ||
max_time_signature?: number; | ||
max_valence?: number; | ||
min_acousticness?: number; | ||
min_danceability?: number; | ||
min_duration_ms?: number; | ||
min_energy?: number; | ||
min_instrumentalness?: number; | ||
min_key?: number; | ||
min_liveness?: number; | ||
min_loudness?: number; | ||
min_mode?: number; | ||
min_popularity?: number; | ||
min_speechiness?: number; | ||
min_tempo?: number; | ||
min_time_signature?: number; | ||
min_valence?: number; | ||
seed_artists?: string[] | string; // Array of strings or Comma separated string | ||
seed_genres?: string[] | string; // Array of strings or Comma separated string | ||
seed_tracks?: string[] | string; // Array of strings or Comma separated string | ||
target_acousticness?: number; | ||
target_danceability?: number; | ||
target_duration_ms?: number; | ||
target_energy?: number; | ||
target_instrumentalness?: number; | ||
target_key?: number; | ||
target_liveness?: number; | ||
target_loudness?: number; | ||
target_mode?: number; | ||
target_popularity?: number; | ||
target_speechiness?: number; | ||
target_tempo?: number; | ||
target_time_signature?: number; | ||
target_valence?: number; | ||
} | ||
@@ -146,3 +172,3 @@ | ||
interface RestrictionsObject { | ||
reason: string | ||
reason: string; | ||
} | ||
@@ -166,3 +192,3 @@ | ||
interface PlaylistSnapshotResponse { | ||
snapshot_id: string | ||
snapshot_id: string; | ||
} | ||
@@ -188,3 +214,3 @@ | ||
interface MultipleAlbumsResponse { | ||
albums: AlbumObjectFull[] | ||
albums: AlbumObjectFull[]; | ||
} | ||
@@ -215,3 +241,3 @@ | ||
interface MultipleArtistsResponse { | ||
artists: ArtistObjectFull[] | ||
artists: ArtistObjectFull[]; | ||
} | ||
@@ -234,3 +260,3 @@ | ||
interface ArtistsTopTracksResponse { | ||
tracks: TrackObjectFull[] | ||
tracks: TrackObjectFull[]; | ||
} | ||
@@ -245,3 +271,3 @@ | ||
interface ArtistsRelatedArtistsResponse { | ||
artists: ArtistObjectFull[] | ||
artists: ArtistObjectFull[]; | ||
} | ||
@@ -275,3 +301,3 @@ | ||
interface MultipleAudioFeaturesResponse { | ||
"audio_features": AudioFeaturesObject[] | ||
audio_features: AudioFeaturesObject[]; | ||
} | ||
@@ -286,4 +312,4 @@ | ||
interface ListOfFeaturedPlaylistsResponse { | ||
message?: string, | ||
playlists: PagingObject<PlaylistObjectSimplified> | ||
message?: string; | ||
playlists: PagingObject<PlaylistObjectSimplified>; | ||
} | ||
@@ -298,4 +324,4 @@ | ||
interface ListOfNewReleasesResponse { | ||
message?: string, | ||
albums: PagingObject<AlbumObjectSimplified> | ||
message?: string; | ||
albums: PagingObject<AlbumObjectSimplified>; | ||
} | ||
@@ -310,3 +336,3 @@ | ||
interface MultipleCategoriesResponse { | ||
categories: PagingObject<CategoryObject> | ||
categories: PagingObject<CategoryObject>; | ||
} | ||
@@ -329,3 +355,3 @@ | ||
interface CategoryPlaylistsReponse { | ||
playlists: PagingObject<PlaylistObjectSimplified> | ||
playlists: PagingObject<PlaylistObjectSimplified>; | ||
} | ||
@@ -348,3 +374,3 @@ | ||
interface UsersFollowedArtistsResponse { | ||
artists: CursorBasedPagingObject<ArtistObjectFull> | ||
artists: CursorBasedPagingObject<ArtistObjectFull>; | ||
} | ||
@@ -495,3 +521,3 @@ | ||
interface AvailableGenreSeedsResponse { | ||
"genres": string[] | ||
"genres": string[]; | ||
} | ||
@@ -516,3 +542,3 @@ | ||
interface ArtistSearchResponse { | ||
artists: PagingObject<ArtistObjectFull> | ||
artists: PagingObject<ArtistObjectFull>; | ||
} | ||
@@ -527,3 +553,3 @@ | ||
interface PlaylistSearchResponse { | ||
playlists: PagingObject<PlaylistObjectSimplified> | ||
playlists: PagingObject<PlaylistObjectSimplified>; | ||
} | ||
@@ -538,3 +564,3 @@ | ||
interface TrackSearchResponse { | ||
tracks: PagingObject<TrackObjectFull> | ||
tracks: PagingObject<TrackObjectFull>; | ||
} | ||
@@ -548,5 +574,3 @@ | ||
*/ | ||
interface SearchResponse extends Partial<ArtistSearchResponse>, Partial<AlbumSearchResponse>, Partial<TrackSearchResponse>, Partial<PlaylistSearchResponse> { | ||
} | ||
interface SearchResponse extends Partial<ArtistSearchResponse>, Partial<AlbumSearchResponse>, Partial<TrackSearchResponse>, Partial<PlaylistSearchResponse> {} | ||
@@ -568,3 +592,3 @@ /** | ||
interface MultipleTracksResponse { | ||
tracks: TrackObjectFull[] | ||
tracks: TrackObjectFull[]; | ||
} | ||
@@ -694,8 +718,28 @@ | ||
interface AlbumObjectFull extends AlbumObjectSimplified { | ||
copyrights: CopyrightObject[], | ||
external_ids: ExternalIdObject, | ||
genres: string[], | ||
/** | ||
* The copyright statements of the album. | ||
*/ | ||
copyrights: CopyrightObject[]; | ||
/** | ||
* Known external IDs for the album. | ||
*/ | ||
external_ids: ExternalIdObject; | ||
/** | ||
* A list of the genres used to classify the album. | ||
* For example: `"Prog Rock"` , `"Post-Grunge"`. (If not yet classified, the array is empty.) | ||
*/ | ||
genres: string[]; | ||
/** | ||
* The label for the album. | ||
*/ | ||
label: string, | ||
popularity: number, | ||
tracks: PagingObject<TrackObjectSimplified> | ||
/** | ||
* The popularity of the album. The value will be between `0` and `100`, with `100` being the most popular. | ||
* The popularity is calculated from the popularity of the album’s individual tracks; | ||
*/ | ||
popularity: number; | ||
/** | ||
* The tracks of the album. | ||
*/ | ||
tracks: PagingObject<TrackObjectSimplified>; | ||
} | ||
@@ -707,17 +751,52 @@ | ||
*/ | ||
interface AlbumObjectSimplified { | ||
album_group?: string, | ||
album_type: string, | ||
artists: ArtistObjectSimplified[], | ||
available_markets?: string[], | ||
external_urls: ExternalUrlObject, | ||
href: string, | ||
id: string, | ||
images: ImageObject[], | ||
name: string, | ||
release_date: string, | ||
release_date_precision: string, | ||
restrictions?: RestrictionsObject, | ||
type: "album", | ||
uri: string | ||
interface AlbumObjectSimplified extends ContextObject { | ||
/** | ||
* The field is present when getting an artist’s albums. | ||
* Possible values are “album”, “single”, “compilation”, “appears_on”. | ||
* Compare to album_type this field represents relationship between the artist and the album. | ||
*/ | ||
album_group?: "album" | "single" | "compilation" | "appears_on"; | ||
/** | ||
* The type of the album: one of “album”, “single”, or “compilation”. | ||
*/ | ||
album_type: "album" | "single" | "compilation"; | ||
/** | ||
* The artists of the album. | ||
* Each artist object includes a link in href to more detailed information about the artist. | ||
*/ | ||
artists: ArtistObjectSimplified[]; | ||
/** | ||
* The markets in which the album is available: [ISO 3166-1 alpha-2 country codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). | ||
* Note that an album is considered available in a market when at least 1 of its tracks is available in that market. | ||
*/ | ||
available_markets?: string[]; | ||
/** | ||
* The [Spotify ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the album. | ||
*/ | ||
id: string; | ||
/** | ||
* The cover art for the album in various sizes, widest first. | ||
*/ | ||
images: ImageObject[]; | ||
/** | ||
* The name of the album. In case of an album takedown, the value may be an empty string. | ||
*/ | ||
name: string; | ||
/** | ||
* The date the album was first released, for example `1981`. | ||
* Depending on the precision, it might be shown as `1981-12` or `1981-12-15`. | ||
*/ | ||
release_date: string; | ||
/** | ||
* The precision with which release_date value is known: `year`, `month`, or `day`. | ||
*/ | ||
release_date_precision: "year" | "month" | "day"; | ||
/** | ||
* Part of the response when [Track Relinking](https://developer.spotify.com/documentation/general/guides/track-relinking-guide/) is applied, | ||
* the original track is not available in the given market, and Spotify did not have any tracks to relink it with. | ||
* The track response will still contain metadata for the original track, | ||
* and a restrictions object containing the reason why the track is not available: `"restrictions" : {"reason" : "market"}` | ||
*/ | ||
restrictions?: RestrictionsObject; | ||
type: "album"; | ||
} | ||
@@ -730,6 +809,21 @@ | ||
interface ArtistObjectFull extends ArtistObjectSimplified { | ||
followers: FollowersObject, | ||
genres: string[], | ||
images: ImageObject[], | ||
popularity: number, | ||
/** | ||
* Information about the followers of the artist. | ||
*/ | ||
followers: FollowersObject; | ||
/** | ||
* A list of the genres the artist is associated with. | ||
* For example: `"Prog Rock"` , `"Post-Grunge"`. | ||
* (If not yet classified, the array is empty.) | ||
*/ | ||
genres: string[]; | ||
/** | ||
* Images of the artist in various sizes, widest first. | ||
*/ | ||
images: ImageObject[]; | ||
/** | ||
* The popularity of the artist. The value will be between `0` and `100`, with `100` being the most popular. | ||
* The artist’s popularity is calculated from the popularity of all the artist’s tracks. | ||
*/ | ||
popularity: number; | ||
} | ||
@@ -741,9 +835,12 @@ | ||
*/ | ||
interface ArtistObjectSimplified { | ||
external_urls: ExternalUrlObject, | ||
href: string, | ||
id: string, | ||
name: string, | ||
type: "artist", | ||
uri: string | ||
interface ArtistObjectSimplified extends ContextObject { | ||
/** | ||
* The name of the artist. | ||
*/ | ||
name: string; | ||
/** | ||
* The [Spotify ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the artist. | ||
*/ | ||
id: string; | ||
type: "artist"; | ||
} | ||
@@ -756,20 +853,20 @@ | ||
interface AudioFeaturesObject { | ||
acousticness: number, | ||
analysis_url: string, | ||
danceability: number, | ||
duration_ms: number, | ||
energy: number, | ||
id: string, | ||
instrumentalness: number, | ||
key: number, | ||
liveness: number, | ||
loudness: number, | ||
mode: number, | ||
speechiness: number, | ||
tempo: number, | ||
time_signature: number, | ||
track_href: string, | ||
type: "audio_features", | ||
uri: string, | ||
valence: number | ||
acousticness: number; | ||
analysis_url: string; | ||
danceability: number; | ||
duration_ms: number; | ||
energy: number; | ||
id: string; | ||
instrumentalness: number; | ||
key: number; | ||
liveness: number; | ||
loudness: number; | ||
mode: number; | ||
speechiness: number; | ||
tempo: number; | ||
time_signature: number; | ||
track_href: string; | ||
type: "audio_features"; | ||
uri: string; | ||
valence: number; | ||
} | ||
@@ -782,6 +879,6 @@ | ||
interface CategoryObject { | ||
href: string, | ||
icons: ImageObject[], | ||
id: string, | ||
name: string | ||
href: string; | ||
icons: ImageObject[]; | ||
id: string; | ||
name: string; | ||
} | ||
@@ -794,4 +891,4 @@ | ||
interface CopyrightObject { | ||
text: string, | ||
type: "C" | "P" | ||
text: string; | ||
type: "C" | "P"; | ||
} | ||
@@ -804,4 +901,4 @@ | ||
interface CursorObject { | ||
after: string | ||
before?: string | ||
after: string; | ||
before?: string; | ||
} | ||
@@ -814,4 +911,11 @@ | ||
interface ErrorObject { | ||
status: number, | ||
message: string | ||
/** | ||
* The HTTP status code (also returned in the response header; | ||
* see [Response Status Codes](https://developer.spotify.com/documentation/web-api/#response-status-codes) for more information). | ||
*/ | ||
status: number; | ||
/** | ||
* A short description of the cause of the error. | ||
*/ | ||
message: string; | ||
} | ||
@@ -826,5 +930,5 @@ | ||
interface ExternalIdObject { | ||
isrc?: string, | ||
ean?: string, | ||
upc?: string | ||
isrc?: string; | ||
ean?: string; | ||
upc?: string; | ||
} | ||
@@ -839,3 +943,3 @@ | ||
interface ExternalUrlObject { | ||
spotify: string | ||
spotify: string; | ||
} | ||
@@ -848,4 +952,11 @@ | ||
interface FollowersObject { | ||
href: string, | ||
total: number | ||
/** | ||
* A link to the Web API endpoint providing full details of the followers; `null` if not available. | ||
* Please note that this will always be set to `null`, as the Web API does not support it at the moment. | ||
*/ | ||
href: null; | ||
/** | ||
* The total number of followers. | ||
*/ | ||
total: number; | ||
} | ||
@@ -858,5 +969,14 @@ | ||
interface ImageObject { | ||
height?: number, | ||
url: string, | ||
width?: number | ||
/** | ||
* The image height in pixels. If unknown: `null` or not returned. | ||
*/ | ||
height?: number; | ||
/** | ||
* The source URL of the image. | ||
*/ | ||
url: string; | ||
/** | ||
* The image width in pixels. If unknown: null or not returned. | ||
*/ | ||
width?: number; | ||
} | ||
@@ -869,9 +989,9 @@ | ||
interface PagingObject<T> { | ||
href: string, | ||
items: T[], | ||
limit: number, | ||
next: string, | ||
offset: number, | ||
previous: string, | ||
total: number | ||
href: string; | ||
items: T[]; | ||
limit: number; | ||
next: string; | ||
offset: number; | ||
previous: string; | ||
total: number; | ||
} | ||
@@ -884,8 +1004,8 @@ | ||
interface CursorBasedPagingObject<T> { | ||
href: string, | ||
items: T[], | ||
limit: number, | ||
next: string, | ||
cursors: CursorObject, | ||
total?: number | ||
href: string; | ||
items: T[]; | ||
limit: number; | ||
next: string; | ||
cursors: CursorObject; | ||
total?: number; | ||
} | ||
@@ -897,14 +1017,40 @@ | ||
*/ | ||
interface PlaylistBaseObject { | ||
collaborative: boolean, | ||
external_urls: ExternalUrlObject, | ||
href: string, | ||
id: string, | ||
images: ImageObject[], | ||
name: string, | ||
owner: UserObjectPublic, | ||
public: boolean, | ||
snapshot_id: string, | ||
type: "playlist", | ||
uri: string | ||
interface PlaylistBaseObject extends ContextObject { | ||
/** | ||
* Returns `true` if context is not search and the owner allows other users to modify the playlist. | ||
* Otherwise returns `false`. | ||
*/ | ||
collaborative: boolean; | ||
/** | ||
* The [Spotify ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the playlist. | ||
*/ | ||
id: string; | ||
/** | ||
* Images for the playlist. The array may be empty or contain up to three images. | ||
* The images are returned by size in descending order. | ||
* See [Working with Playlists](https://developer.spotify.com/documentation/general/guides/working-with-playlists/). | ||
* Note: If returned, the source URL for the image (`url`) is temporary and will expire in less than a day. | ||
*/ | ||
images: ImageObject[]; | ||
/** | ||
* The name of the playlist. | ||
*/ | ||
name: string; | ||
/** | ||
* The user who owns the playlist. | ||
*/ | ||
owner: UserObjectPublic; | ||
/** | ||
* The playlist’s public/private status: | ||
* `true` the playlist is public, | ||
* `false` the playlist is private, | ||
* or `null` the playlist status is not relevant. | ||
*/ | ||
public: boolean | null; | ||
/** | ||
* The version identifier for the current playlist. Can be supplied in other requests to target a specific playlist version: | ||
* see [Remove tracks from a playlist](https://developer.spotify.com/documentation/web-api/reference/playlists/remove-tracks-playlist/). | ||
*/ | ||
snapshot_id: string; | ||
type: "playlist"; | ||
} | ||
@@ -914,8 +1060,17 @@ | ||
* Playlist Object Full | ||
* [](https://developer.spotify.com/web-api/object-model/) | ||
* [](https://developer.spotify.com/web-api/object-model/#playlist-object-full) | ||
*/ | ||
interface PlaylistObjectFull extends PlaylistBaseObject { | ||
description: string, | ||
followers: FollowersObject, | ||
tracks: PagingObject<PlaylistTrackObject> | ||
/** | ||
* The playlist description. Only returned for modified, verified playlists, otherwise null. | ||
*/ | ||
description: string | null; | ||
/** | ||
* Information about the followers of the playlist. | ||
*/ | ||
followers: FollowersObject; | ||
/** | ||
* Information about the tracks of the playlist. | ||
*/ | ||
tracks: PagingObject<PlaylistTrackObject>; | ||
} | ||
@@ -929,5 +1084,5 @@ | ||
tracks: { | ||
href: string, | ||
total: number | ||
} | ||
href: string; | ||
total: number; | ||
}; | ||
} | ||
@@ -940,6 +1095,6 @@ | ||
interface PlaylistTrackObject { | ||
added_at: string, | ||
added_by: UserObjectPublic, | ||
is_local: boolean, | ||
track: TrackObjectFull | ||
added_at: string; | ||
added_by: UserObjectPublic; | ||
is_local: boolean; | ||
track: TrackObjectFull; | ||
} | ||
@@ -952,4 +1107,4 @@ | ||
interface RecommendationsObject { | ||
seeds: RecommendationsSeedObject[], | ||
tracks: TrackObjectSimplified[] | ||
seeds: RecommendationsSeedObject[]; | ||
tracks: TrackObjectSimplified[]; | ||
} | ||
@@ -962,8 +1117,8 @@ | ||
interface RecommendationsSeedObject { | ||
afterFilteringSize: number, | ||
afterRelinkingSize: number, | ||
href: string, | ||
id: string, | ||
initialPoolSize: number, | ||
type: "artist" | "track" | "genre" | ||
afterFilteringSize: number; | ||
afterRelinkingSize: number; | ||
href: string; | ||
id: string; | ||
initialPoolSize: number; | ||
type: "artist" | "track" | "genre"; | ||
} | ||
@@ -976,4 +1131,4 @@ | ||
interface SavedTrackObject { | ||
added_at: string, | ||
track: TrackObjectFull | ||
added_at: string; | ||
track: TrackObjectFull; | ||
} | ||
@@ -986,4 +1141,4 @@ | ||
interface SavedAlbumObject { | ||
added_at: string, | ||
album: AlbumObjectFull | ||
added_at: string; | ||
album: AlbumObjectFull; | ||
} | ||
@@ -996,5 +1151,21 @@ | ||
interface TrackObjectFull extends TrackObjectSimplified { | ||
album: AlbumObjectSimplified, | ||
external_ids: ExternalIdObject, | ||
popularity: number | ||
/** | ||
* The album on which the track appears. | ||
*/ | ||
album: AlbumObjectSimplified; | ||
/** | ||
* Known external IDs for the track. | ||
*/ | ||
external_ids: ExternalIdObject; | ||
/** | ||
* The popularity of the track. The value will be between `0` and `100`, with `100` being the most popular. | ||
* The popularity of a track is a value between `0` and `100`, with `100` being the most popular. | ||
* The popularity is calculated by algorithm and is based, in the most part, | ||
* on the total number of plays the track has had and how recent those plays are. | ||
*/ | ||
popularity: number; | ||
/** | ||
* Whether or not the track is from a local file. | ||
*/ | ||
is_local?: boolean; | ||
} | ||
@@ -1007,17 +1178,73 @@ | ||
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 | ||
/** | ||
* The artists who performed the track. | ||
*/ | ||
artists: ArtistObjectSimplified[]; | ||
/** | ||
* A list of the countries in which the track can be played, | ||
* identified by their [ISO 3166-1 alpha-2 code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). | ||
*/ | ||
available_markets?: string[]; | ||
/** | ||
* The disc number (usually `1` unless the album consists of more than one disc). | ||
*/ | ||
disc_number: number; | ||
/** | ||
* The track length in milliseconds. | ||
*/ | ||
duration_ms: number; | ||
/** | ||
* Whether or not the track has explicit lyrics (`true` = yes it does; `false` = no it does not OR unknown). | ||
*/ | ||
explicit: boolean; | ||
/** | ||
* Known external URLs for this track. | ||
*/ | ||
external_urls: ExternalUrlObject; | ||
/** | ||
* A link to the Web API endpoint providing full details of the track. | ||
*/ | ||
href: string; | ||
/** | ||
* The [Spotify ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the track. | ||
*/ | ||
id: string; | ||
/** | ||
* Part of the response when [Track Relinking](https://developer.spotify.com/documentation/general/guides/track-relinking-guide/) is applied. | ||
* If `true`, the track is playable in the given market. Otherwise, `false`. | ||
*/ | ||
is_playable?: boolean; | ||
/** | ||
* Part of the response when [Track Relinking](https://developer.spotify.com/documentation/general/guides/track-relinking-guide/) is applied, | ||
* and the requested track has been replaced with different track. | ||
* The track in the `linked_from` object contains information about the originally requested track. | ||
*/ | ||
linked_from?: TrackLinkObject; | ||
/** | ||
* Part of the response when [Track Relinking](https://developer.spotify.com/documentation/general/guides/track-relinking-guide/) is applied, | ||
* the original track is not available in the given market, and Spotify did not have any tracks to relink it with. | ||
* The track response will still contain metadata for the original track, and a restrictions object containing the reason | ||
* why the track is not available: `"restrictions" : {"reason" : "market"}`. | ||
*/ | ||
restrictions?: RestrictionsObject; | ||
/** | ||
* The name of the track. | ||
*/ | ||
name: string; | ||
/** | ||
* A link to a 30 second preview (MP3 format) of the track. Can be null | ||
*/ | ||
preview_url: string | null; | ||
/** | ||
* The number of the track. If an album has several discs, the track number is the number on the specified disc. | ||
*/ | ||
track_number: number; | ||
/** | ||
* The object type: “track”. | ||
*/ | ||
type: "track"; | ||
/** | ||
* The [Spotify URI](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the track. | ||
*/ | ||
uri: string; | ||
} | ||
@@ -1030,7 +1257,7 @@ | ||
interface TrackLinkObject { | ||
external_urls: ExternalUrlObject, | ||
href: string, | ||
id: string, | ||
type: "track", | ||
uri: string | ||
external_urls: ExternalUrlObject; | ||
href: string; | ||
id: string; | ||
type: "track"; | ||
uri: string; | ||
} | ||
@@ -1043,6 +1270,6 @@ | ||
interface UserObjectPrivate extends UserObjectPublic { | ||
birthdate: string, | ||
country: string, | ||
email: string, | ||
product: string | ||
birthdate: string; | ||
country: string; | ||
email: string; | ||
product: string; | ||
} | ||
@@ -1055,10 +1282,10 @@ | ||
interface UserObjectPublic { | ||
display_name?: string, | ||
external_urls: ExternalUrlObject, | ||
followers?: FollowersObject, | ||
href: string, | ||
id: string, | ||
images?: ImageObject[], | ||
type: "user", | ||
uri: string | ||
display_name?: string; | ||
external_urls: ExternalUrlObject; | ||
followers?: FollowersObject; | ||
href: string; | ||
id: string; | ||
images?: ImageObject[]; | ||
type: "user"; | ||
uri: string; | ||
} | ||
@@ -1071,5 +1298,17 @@ | ||
interface ContextObject { | ||
type: ContextObjectType; | ||
href: string | null; | ||
external_urls: ExternalUrlObject | null; | ||
/** | ||
* The object type. | ||
*/ | ||
type: "artist" | "playlist" | "album"; | ||
/** | ||
* A link to the Web API endpoint providing full details. | ||
*/ | ||
href: string; | ||
/** | ||
* Known external URLs. | ||
*/ | ||
external_urls: ExternalUrlObject; | ||
/** | ||
* The [Spotify URI](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids). | ||
*/ | ||
uri: string; | ||
@@ -1090,3 +1329,3 @@ } | ||
shuffle_state: boolean; | ||
repeat_state: PlaybackRepeatState; | ||
repeat_state: "off" | "track" | "context"; | ||
} | ||
@@ -1111,5 +1350,2 @@ | ||
} | ||
type ContextObjectType = 'artist' | 'playlist' | 'album'; | ||
type PlaybackRepeatState = 'off' | 'track' | 'context'; | ||
} |
{ | ||
"name": "@types/spotify-api", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "TypeScript definitions for The Spotify Web API (including changes March 29th 2016)", | ||
@@ -21,2 +21,7 @@ "license": "MIT", | ||
"githubUsername": "piksel" | ||
}, | ||
{ | ||
"name": "Basti Ortiz", | ||
"url": "https://github.com/Some-Dood", | ||
"githubUsername": "Some-Dood" | ||
} | ||
@@ -33,4 +38,4 @@ ], | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "a97981d7a92890855cc4ca18ab301407dbe6aac73e6aa0349011a42223409ba9", | ||
"typesPublisherContentHash": "1a5495f55c55dc5d1fb14aedbd168858776096210947a3d4dd4053eb23550433", | ||
"typeScriptVersion": "2.8" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Tue, 07 Jan 2020 00:41:54 GMT | ||
* Last updated: Mon, 13 Apr 2020 19:11:33 GMT | ||
* Dependencies: none | ||
@@ -17,2 +17,2 @@ * Global values: none | ||
# Credits | ||
These definitions were written by Niels Kristian Hansen Skovmand (https://github.com/skovmand), Magnar Ovedal Myrtveit (https://github.com/Stadly), and Nils Måsén (https://github.com/piksel). | ||
These definitions were written by [Niels Kristian Hansen Skovmand](https://github.com/skovmand), [Magnar Ovedal Myrtveit](https://github.com/Stadly), [Nils Måsén](https://github.com/piksel), and [Basti Ortiz](https://github.com/Some-Dood). |
Sorry, the diff of this file is not supported yet
46545
1191