Skip to content

Commit f68bcef

Browse files
committed
Update LibraryPlaylist with isFavorite boolean
1 parent fea74ae commit f68bcef

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

Sources/MusadoraKit/Library/MusicLibraryPlaylist.swift renamed to Sources/MusadoraKit/Library/LibraryPlaylist.swift

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// MusicLibraryPlaylist.swift
2+
// LibraryPlaylist.swift
33
// MusadoraKit
44
//
55
// Created by Rudrank Riyam on 06/10/22.
@@ -9,15 +9,15 @@ import Foundation
99

1010
/// Represents a playlist within a user's music library.
1111
///
12-
/// A `MusicLibraryPlaylist` provides a detailed view of a playlist, including its attributes and associated metadata.
12+
/// A `LibraryPlaylist` represents a playlist within a user's music library, providing detailed information about its attributes and metadata.
1313
/// This includes details like its editability, public status, artwork, and more.
1414
///
1515
/// Example usage:
1616
///
17-
/// let playlist: MusicLibraryPlaylist = fetchPlaylist(withID: someID)
17+
/// let playlist: LibraryPlaylist = fetchPlaylist(withID: someID)
1818
/// print(playlist.attributes.name) // Prints the name of the playlist
1919
///
20-
public struct MusicLibraryPlaylist: Codable, MusicItem {
20+
public struct LibraryPlaylist: Codable, MusicItem {
2121
/// The unique identifier for the playlist.
2222
///
2323
/// This identifier is unique to each playlist and can be used for fetching, updating, or deleting specific playlists.
@@ -49,7 +49,7 @@ public struct MusicLibraryPlaylist: Codable, MusicItem {
4949
public let hasCatalog: Bool
5050

5151
/// Parameters that determine how the playlist can be played.
52-
public var playParams: MusicLibraryPlaylistPlayParameters
52+
public var playParams: LibraryPlaylistPlayParameters
5353

5454
/// A brief description of the playlist.
5555
///
@@ -58,6 +58,9 @@ public struct MusicLibraryPlaylist: Codable, MusicItem {
5858

5959
/// Visual representation or image associated with the playlist.
6060
public let artwork: Artwork?
61+
62+
/// A Boolean value indicating whether the playlist is in the user's favorites.
63+
public let inFavorites: Bool
6164
}
6265

6366
/// Contains the textual description of a playlist.
@@ -74,7 +77,7 @@ public struct MusicLibraryPlaylist: Codable, MusicItem {
7477

7578
@available(macOS 14.0, *)
7679
@available(watchOS, unavailable)
77-
extension MusicLibraryPlaylist: PlayableMusicItem {
80+
extension LibraryPlaylist: PlayableMusicItem {
7881
/// Retrieves the parameters required to play the playlist.
7982
///
8083
/// - Returns: A set of play parameters or `nil` if they can't be determined.
@@ -99,7 +102,7 @@ extension MusicLibraryPlaylist: PlayableMusicItem {
99102
}
100103

101104
/// Defines the parameters required for playback of a library playlist.
102-
public struct MusicLibraryPlaylistPlayParameters: Codable, Sendable {
105+
public struct LibraryPlaylistPlayParameters: Codable, Sendable {
103106
/// The unique identifier associated with the playlist.
104107
public let id: MusicItemID
105108

@@ -115,4 +118,4 @@ public struct MusicLibraryPlaylistPlayParameters: Codable, Sendable {
115118
}
116119
}
117120

118-
extension MusicLibraryPlaylist: Identifiable {}
121+
extension LibraryPlaylist: Identifiable {}

Sources/MusadoraKit/Music Items/LibraryPlaylists.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
//
77

88
/// A collection of library playlists.
9-
public typealias LibraryPlaylists = MusicItemCollection<MusicLibraryPlaylist>
9+
public typealias LibraryPlaylists = MusicItemCollection<LibraryPlaylist>

0 commit comments

Comments
 (0)