|
|
|
@ -6,195 +6,168 @@ export enum ResourceType { |
|
|
|
|
Tag = "tag" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export interface TrackBase { |
|
|
|
|
mbApi_typename: "track", |
|
|
|
|
export interface Id { |
|
|
|
|
id: number, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
name?: string, |
|
|
|
|
storeLinks?: string[], |
|
|
|
|
albumId?: number | null, |
|
|
|
|
export function isId(q : any) : q is Id { |
|
|
|
|
return 'id' in q; |
|
|
|
|
} |
|
|
|
|
export interface TrackBaseWithRefs extends TrackBase { |
|
|
|
|
artistIds?: number[], |
|
|
|
|
albumId?: number | null, |
|
|
|
|
tagIds?: number[], |
|
|
|
|
|
|
|
|
|
export interface Name { |
|
|
|
|
name: string, |
|
|
|
|
} |
|
|
|
|
export interface TrackBaseWithDetails extends TrackBase { |
|
|
|
|
artists: ArtistWithId[], |
|
|
|
|
album: AlbumWithId | null, |
|
|
|
|
tags: TagWithId[], |
|
|
|
|
|
|
|
|
|
export function isName(q : any) : q is Name { |
|
|
|
|
return 'name' in q; |
|
|
|
|
} |
|
|
|
|
export interface TrackWithDetails extends TrackBaseWithDetails { |
|
|
|
|
name: string, |
|
|
|
|
|
|
|
|
|
export interface StoreLinks { |
|
|
|
|
storeLinks: string[], |
|
|
|
|
} |
|
|
|
|
export interface TrackWithRefs extends TrackBaseWithRefs { |
|
|
|
|
name: string, |
|
|
|
|
artistIds: number[], |
|
|
|
|
|
|
|
|
|
export interface TrackRefs { |
|
|
|
|
albumId: number | null, |
|
|
|
|
artistIds: number[], |
|
|
|
|
tagIds: number[], |
|
|
|
|
} |
|
|
|
|
export interface Track extends TrackBase { |
|
|
|
|
name: string, |
|
|
|
|
album: AlbumWithId | null, |
|
|
|
|
artists: ArtistWithId[], |
|
|
|
|
tags: TagWithId[], |
|
|
|
|
} |
|
|
|
|
export interface TrackWithRefsWithId extends TrackWithRefs { |
|
|
|
|
id: number, |
|
|
|
|
} |
|
|
|
|
export interface TrackWithDetailsWithId extends TrackWithDetails { |
|
|
|
|
id: number, |
|
|
|
|
|
|
|
|
|
export interface TrackDetails { |
|
|
|
|
artists: (Artist & Id)[], |
|
|
|
|
album: (Album & Id) | null, |
|
|
|
|
tags: (Tag & Id)[], |
|
|
|
|
} |
|
|
|
|
export interface TrackWithId extends Track { |
|
|
|
|
id: number, |
|
|
|
|
|
|
|
|
|
export interface Track { |
|
|
|
|
mbApi_typename: "track", |
|
|
|
|
|
|
|
|
|
name?: string, |
|
|
|
|
id?: number, |
|
|
|
|
storeLinks?: string[], |
|
|
|
|
albumId?: number | null, |
|
|
|
|
artistIds?: number[], |
|
|
|
|
tagIds?: number[], |
|
|
|
|
artists?: (Artist & Id & Name)[], |
|
|
|
|
album?: (Album & Id & Name) | null, |
|
|
|
|
tags?: (Tag & Id & Name)[], |
|
|
|
|
} |
|
|
|
|
export function isTrackBase(q: any): q is TrackBase { |
|
|
|
|
|
|
|
|
|
export function isTrack(q: any): q is Track { |
|
|
|
|
return q.mbApi_typename && q.mbApi_typename === "track"; |
|
|
|
|
} |
|
|
|
|
export function isTrackBaseWithRefs(q: any): q is TrackBaseWithRefs { |
|
|
|
|
return isTrackBase(q); |
|
|
|
|
|
|
|
|
|
export function isTrackRefs(q: any): q is TrackRefs { |
|
|
|
|
return isTag(q) && 'albumId' in q && 'artistIds' in q && 'tagIds' in q; |
|
|
|
|
} |
|
|
|
|
export function isTrackWithRefs(q: any): q is TrackWithRefs { |
|
|
|
|
return isTrackBaseWithRefs(q) && "name" in q; |
|
|
|
|
|
|
|
|
|
export function isTrackDetails(q: any): q is TrackDetails { |
|
|
|
|
return isTag(q) && 'album' in q && 'artists' in q && 'tags' in q; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export interface ArtistRefs { |
|
|
|
|
albumIds: number[], |
|
|
|
|
tagIds: number[], |
|
|
|
|
trackIds: number[], |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export interface ArtistDetails { |
|
|
|
|
albums?: (Album & Id)[], |
|
|
|
|
tags?: (Tag & Id)[], |
|
|
|
|
tracks?: (Track & Id)[], |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export interface ArtistBase { |
|
|
|
|
export interface Artist { |
|
|
|
|
mbApi_typename: "artist", |
|
|
|
|
|
|
|
|
|
name?: string, |
|
|
|
|
id?: number, |
|
|
|
|
storeLinks?: string[], |
|
|
|
|
} |
|
|
|
|
export interface ArtistBaseWithRefs extends ArtistBase { |
|
|
|
|
albumIds?: number[], |
|
|
|
|
tagIds?: number[], |
|
|
|
|
trackIds?: number[], |
|
|
|
|
albums?: (Album & Id)[], |
|
|
|
|
tags?: (Tag & Id)[], |
|
|
|
|
tracks?: (Track & Id)[], |
|
|
|
|
} |
|
|
|
|
export interface ArtistBaseWithDetails extends ArtistBase { |
|
|
|
|
albums: AlbumWithId[], |
|
|
|
|
tags: TagWithId[], |
|
|
|
|
tracks: TrackWithId[], |
|
|
|
|
} |
|
|
|
|
export interface ArtistWithDetails extends ArtistBaseWithDetails { |
|
|
|
|
name: string, |
|
|
|
|
} |
|
|
|
|
export interface ArtistWithRefs extends ArtistBaseWithRefs { |
|
|
|
|
name: string, |
|
|
|
|
albumIds: number[], |
|
|
|
|
tagIds: number[], |
|
|
|
|
trackIds: number[], |
|
|
|
|
} |
|
|
|
|
export interface Artist extends ArtistBase { |
|
|
|
|
name: string, |
|
|
|
|
} |
|
|
|
|
export interface ArtistWithRefsWithId extends ArtistWithRefs { |
|
|
|
|
id: number, |
|
|
|
|
} |
|
|
|
|
export interface ArtistWithDetailsWithId extends ArtistWithDetails { |
|
|
|
|
id: number, |
|
|
|
|
} |
|
|
|
|
export interface ArtistWithId extends Artist { |
|
|
|
|
id: number, |
|
|
|
|
} |
|
|
|
|
export function isArtistBase(q: any): q is ArtistBase { |
|
|
|
|
|
|
|
|
|
export function isArtist(q: any): q is Artist { |
|
|
|
|
return q.mbApi_typename && q.mbApi_typename === "artist"; |
|
|
|
|
} |
|
|
|
|
export function isArtistBaseWithRefs(q: any): q is ArtistBaseWithRefs { |
|
|
|
|
return isArtistBase(q); |
|
|
|
|
} |
|
|
|
|
export function isArtistWithRefs(q: any): q is ArtistWithRefs { |
|
|
|
|
return isArtistBaseWithRefs(q) && "name" in q; |
|
|
|
|
|
|
|
|
|
export function isArtistRefs(q: any): q is ArtistRefs { |
|
|
|
|
return isTag(q) && 'albumIds' in q && 'trackIds' in q && 'tagIds' in q; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export function isArtistDetails(q: any): q is ArtistDetails { |
|
|
|
|
return isTag(q) && 'albums' in q && 'tracks' in q && 'tags' in q; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export interface AlbumBase { |
|
|
|
|
export interface Album { |
|
|
|
|
mbApi_typename: "album", |
|
|
|
|
|
|
|
|
|
name?: string, |
|
|
|
|
id?: number, |
|
|
|
|
storeLinks?: string[], |
|
|
|
|
} |
|
|
|
|
export interface AlbumBaseWithRefs extends AlbumBase { |
|
|
|
|
artistIds?: number[], |
|
|
|
|
trackIds?: number[], |
|
|
|
|
tagIds?: number[], |
|
|
|
|
artists?: (Artist & Id)[], |
|
|
|
|
tracks?: (Track & Id)[], |
|
|
|
|
tags?: (Tag & Id)[], |
|
|
|
|
} |
|
|
|
|
export interface AlbumBaseWithDetails extends AlbumBase { |
|
|
|
|
artists: ArtistWithId[], |
|
|
|
|
tracks: TrackWithId[], |
|
|
|
|
tags: TagWithId[], |
|
|
|
|
} |
|
|
|
|
export interface AlbumWithDetails extends AlbumBaseWithDetails { |
|
|
|
|
name: string, |
|
|
|
|
} |
|
|
|
|
export interface AlbumWithRefs extends AlbumBaseWithRefs { |
|
|
|
|
name: string, |
|
|
|
|
|
|
|
|
|
export interface AlbumRefs { |
|
|
|
|
artistIds: number[], |
|
|
|
|
trackIds: number[], |
|
|
|
|
tagIds: number[], |
|
|
|
|
} |
|
|
|
|
export interface Album extends AlbumBase { |
|
|
|
|
name: string, |
|
|
|
|
artists: ArtistWithId[], |
|
|
|
|
} |
|
|
|
|
export interface AlbumWithRefsWithId extends AlbumWithRefs { |
|
|
|
|
id: number, |
|
|
|
|
} |
|
|
|
|
export interface AlbumWithDetailsWithId extends AlbumWithDetails { |
|
|
|
|
id: number, |
|
|
|
|
} |
|
|
|
|
export interface AlbumWithId extends Album { |
|
|
|
|
id: number, |
|
|
|
|
|
|
|
|
|
export interface AlbumDetails { |
|
|
|
|
artists: (Artist & Id)[], |
|
|
|
|
tracks: (Track & Id)[], |
|
|
|
|
tags: (Tag & Id)[], |
|
|
|
|
} |
|
|
|
|
export function isAlbumBase(q: any): q is AlbumBase { |
|
|
|
|
|
|
|
|
|
export function isAlbum(q: any): q is Album { |
|
|
|
|
return q.mbApi_typename && q.mbApi_typename === "album"; |
|
|
|
|
} |
|
|
|
|
export function isAlbumBaseWithRefs(q: any): q is AlbumBaseWithRefs { |
|
|
|
|
return isAlbumBase(q); |
|
|
|
|
} |
|
|
|
|
export function isAlbumWithRefs(q: any): q is AlbumWithRefs { |
|
|
|
|
return isAlbumBaseWithRefs(q) && "name" in q; |
|
|
|
|
|
|
|
|
|
export function isAlbumRefs(q: any): q is AlbumRefs { |
|
|
|
|
return isTag(q) && 'artistIds' in q && 'trackIds' in q && 'tagIds' in q; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export function isAlbumDetails(q: any): q is AlbumDetails { |
|
|
|
|
return isTag(q) && 'artists' in q && 'tracks' in q && 'tags' in q; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export interface TagBase { |
|
|
|
|
export interface Tag { |
|
|
|
|
mbApi_typename: "tag", |
|
|
|
|
|
|
|
|
|
name?: string, |
|
|
|
|
} |
|
|
|
|
export interface TagBaseWithRefs extends TagBase { |
|
|
|
|
id?: number, |
|
|
|
|
parentId?: number | null, |
|
|
|
|
parent?: (Tag & Id) | null, |
|
|
|
|
} |
|
|
|
|
export interface TagBaseWithDetails extends TagBase { |
|
|
|
|
parent?: TagWithId | null, |
|
|
|
|
} |
|
|
|
|
export interface TagWithDetails extends TagBaseWithDetails { |
|
|
|
|
name: string, |
|
|
|
|
} |
|
|
|
|
export interface TagWithRefs extends TagBaseWithRefs { |
|
|
|
|
name: string, |
|
|
|
|
|
|
|
|
|
export interface TagRefs { |
|
|
|
|
parentId: number | null, |
|
|
|
|
} |
|
|
|
|
export interface Tag extends TagBaseWithDetails { |
|
|
|
|
name: string, |
|
|
|
|
} |
|
|
|
|
export interface TagWithRefsWithId extends TagWithRefs { |
|
|
|
|
id: number, |
|
|
|
|
} |
|
|
|
|
export interface TagWithDetailsWithId extends TagWithDetails { |
|
|
|
|
id: number, |
|
|
|
|
} |
|
|
|
|
export interface TagWithId extends Tag { |
|
|
|
|
id: number, |
|
|
|
|
|
|
|
|
|
export interface TagDetails { |
|
|
|
|
parent: (Tag & Id) | null, |
|
|
|
|
} |
|
|
|
|
export function isTagBase(q: any): q is TagBase { |
|
|
|
|
|
|
|
|
|
export function isTag(q: any): q is Tag { |
|
|
|
|
return q.mbApi_typename && q.mbApi_typename === "tag"; |
|
|
|
|
} |
|
|
|
|
export function isTagBaseWithRefs(q: any): q is TagBaseWithRefs { |
|
|
|
|
return isTagBase(q); |
|
|
|
|
} |
|
|
|
|
export function isTagWithRefs(q: any): q is TagWithRefs { |
|
|
|
|
return isTagBaseWithRefs(q) && "name" in q; |
|
|
|
|
|
|
|
|
|
export function isTagRefs(q: any): q is TagRefs { |
|
|
|
|
return isTag(q) && 'parentId' in q; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export function isTagDetails(q: any): q is TagDetails { |
|
|
|
|
return isTag(q) && 'parent' in q; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// There are several implemented integration solutions,
|
|
|
|
|
// enumerated here.
|
|
|
|
|