🤖 Merge PR #45468 add apple-music-api ArtistResponse interface by @nchase

* add apple-music-api ArtistResponse interface

* add artist response test - make ArtistRelationship genre optional (API doesn't seem to return this, for small sample set of artists)

* bump apple-music-api to 0.4
This commit is contained in:
Noah Chase 2020-06-14 12:56:47 -04:00 committed by GitHub
parent a99e083fa3
commit 0e24e5408e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 2 deletions

View File

@ -563,3 +563,34 @@ const PlaylistResponse: AppleMusicApi.PlaylistResponse = {
},
],
};
const ArtistResponse: AppleMusicApi.ArtistResponse = {
data: [
{
id: '367955316',
type: 'artists',
href: '/v1/catalog/us/artists/367955316',
attributes: {
editorialNotes: {
short: 'short note',
standard: 'elaborated, standard-length note',
},
genreNames: ['Jazz', 'Rock'],
name: 'artist name',
url: 'artist/url',
},
relationships: {
albums: {
data: [
{
id: '897072740',
type: 'albums',
href: '/v1/catalog/us/albums/897072740',
},
],
href: '/v1/catalog/us/songs/897072750/albums',
},
},
},
],
};

View File

@ -1,4 +1,4 @@
// Type definitions for non-npm package Apple Music API 0.3
// Type definitions for non-npm package Apple Music API 0.4
// Project: https://developer.apple.com/documentation/applemusicapi/
// Definitions by: Noah Chase <https://github.com/nchase>
// Useff Chase <https://github.com/useffc>
@ -20,6 +20,11 @@ declare namespace AppleMusicApi {
data: Playlist[];
}
// https://developer.apple.com/documentation/applemusicapi/artistresponse
interface ArtistResponse {
data: Artist[];
}
// https://developer.apple.com/documentation/applemusicapi/relationship
interface Relationship<ResourceType> {
data: ResourceType[];
@ -130,7 +135,7 @@ declare namespace AppleMusicApi {
// https://developer.apple.com/documentation/applemusicapi/artist/relationships
interface ArtistRelationships {
albums: Relationship<Album>;
genres: Relationship<Genre>;
genres?: Relationship<Genre>;
}
// https://developer.apple.com/documentation/applemusicapi/album