From 6b454d7eabcb4341a5ce675ec7a4136e917326e3 Mon Sep 17 00:00:00 2001 From: Yue Cai Date: Wed, 16 Oct 2024 14:43:39 +0800 Subject: [PATCH 1/2] use the correct decode format --- Sources/MusadoraKit/Equivalents/CatalogEquivalent.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/MusadoraKit/Equivalents/CatalogEquivalent.swift b/Sources/MusadoraKit/Equivalents/CatalogEquivalent.swift index 83731bfa..a5c4b745 100644 --- a/Sources/MusadoraKit/Equivalents/CatalogEquivalent.swift +++ b/Sources/MusadoraKit/Equivalents/CatalogEquivalent.swift @@ -84,7 +84,7 @@ public extension MCatalog { /// - Returns: The equivalent music item of type `T` found in the specified storefront. /// - Throws: /// - An error if the network request fails or the response cannot be decoded. - static func equivalent(id: MusicItemID, targetStorefront: String) async throws -> T { + static func equivalent(id: MusicItemID, targetStorefront: String) async throws -> MusicItemCollection { var components = AppleMusicURLComponents() components.path = "catalog/\(targetStorefront)/\(T.resourcePath)/\(id)" components.queryItems = [URLQueryItem(name: "filter[equivalents]", value: id.rawValue)] @@ -95,7 +95,7 @@ public extension MCatalog { let request = MusicDataRequest(urlRequest: .init(url: url)) let response = try await request.response() - let item = try JSONDecoder().decode(T.self, from: response.data) - return item + let items = try JSONDecoder().decode(MusicItemCollection.self, from: response.data) + return items } } From 40768611c844f1a836543dc245e6fa0160978520 Mon Sep 17 00:00:00 2001 From: Yue Cai Date: Wed, 16 Oct 2024 15:00:19 +0800 Subject: [PATCH 2/2] Add Music Mate to the list --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8a811f5b..6fa66603 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ I am slowly adding all the methods used in MusadoraKit to it, so you can refer t ## Apps Using MusadoraKit +- [Music Mate](https://apps.apple.com/app/musicmate-music-map-friends/id1605379758): Meet music friends on the world map. - [Sonar](https://apps.apple.com/ca/app/sonar-music-community/id1626147292): Music & Community. Stream, Share & Discover - [Tuneder](https://apps.apple.com/us/app/tuneder-song-discovery/id6450867856?itsct=apps_box_badge&itscg=30200): An [open-source](https://github.com/adityasaravana/Tuneder) iOS app that helps Apple Music users discover new songs with a Tinder-like UI. - Musadora: Apple Music client focused on playlists