Hi there!
I am trying to map the Apple Music API endpoints to MusicKit. For example, I am looking at the catalog playlist endpoints.
To get a catalog playlist by its identifier, it is:
let request = MusicCatalogResourceRequest<Playlist>(matching: \.id, equalTo: "pl.f4d106fed2bd41149aaacabb233eb5eb")
let response = try await request.response()
print(response.items)
For multiple identifiers, it is:
let request = MusicCatalogResourceRequest<Playlist>(matching: \.id, memberOf: ["pl.f4d106fed2bd41149aaacabb233eb5eb", "pl.4b364b8b182f4115acbf6deb83bd5222"])
let response = try await request.response()
print(response.items)
To get its relationship like more by curator and featured artists, I can set the properties
:
var request = MusicCatalogResourceRequest<Playlist>(matching: \.id, equalTo: "pl.f4d106fed2bd41149aaacabb233eb5eb")
request.properties = [.featuredArtists, .moreByCurator, .tracks]
let response = try await request.response()
print(response.items)
My question is, how can I map the endpoint Get a Catalog Playlist's Relationship Directly by Name" to MusicKit:
https://api.music.apple.com/v1/catalog/{storefront}/playlists/{id}/{relationship}
The possible value of the relationship can be curator, library, or tracks. Where can I set these relationship values in the MusicKit request?
Thank you!