const provider: MetadataProvider = {
id: 'my-metadata',
kind: 'metadata',
name: 'My Source',
streamingProviderId: 'my-streaming',
// ...
};type ProviderRef = {
provider: string; // Must match your provider's id
id: string; // Your provider's identifier for this entity
url?: string; // Optional link to the source page
};export default {
async onEnable(api: NuclearPluginAPI) {
const results = await api.Metadata.search({
query: 'Radiohead',
types: ['artists', 'albums'],
limit: 10,
});
if (results.artists?.length) {
const artistId = results.artists[0].source.id;
const providerId = results.artists[0].source.provider;
// Fetch full details (routes to the same provider that returned the search result)
const artist = await api.Metadata.fetchArtistBio(artistId, providerId);
const albums = await api.Metadata.fetchArtistAlbums(artistId, providerId);
}
},
};api.Metadata.search(params: SearchParams, providerId?: string): Promise<SearchResults>
api.Metadata.fetchArtistBio(artistId: string, providerId?: string): Promise<ArtistBio>
api.Metadata.fetchArtistSocialStats(artistId: string, providerId?: string): Promise<ArtistSocialStats>
api.Metadata.fetchArtistAlbums(artistId: string, providerId?: string): Promise<AlbumRef[]>
api.Metadata.fetchArtistTopTracks(artistId: string, providerId?: string): Promise<TrackRef[]>
api.Metadata.fetchArtistPlaylists(artistId: string, providerId?: string): Promise<PlaylistRef[]>
api.Metadata.fetchArtistRelatedArtists(artistId: string, providerId?: string): Promise<ArtistRef[]>
api.Metadata.fetchAlbumDetails(albumId: string, providerId?: string): Promise<Album>
