-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adde LibraryPlaylists and libraryPlaylists() method
- Loading branch information
1 parent
2e2db66
commit 32cf3be
Showing
2 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// LibraryPlaylists.swift | ||
// LibraryPlaylists | ||
// | ||
// Created by Rudrank Riyam on 06/10/22. | ||
// | ||
|
||
import Foundation | ||
import MusicKit | ||
|
||
/// A collection of library playlists. | ||
public typealias LibraryPlaylists = MusicItemCollection<LibraryPlaylist> | ||
|
||
public struct LibraryPlaylist: Codable, MusicItem { | ||
public let id: MusicItemID | ||
public let attributes: Attributes | ||
|
||
public struct Attributes: Codable, Sendable { | ||
public let canEdit: Bool | ||
public let name: String | ||
public let isPublic: Bool | ||
public let hasCatalog: Bool | ||
public let playParams: PlayParameters | ||
public let description: Description? | ||
public let artwork: Artwork? | ||
} | ||
|
||
public struct Description: Codable, Sendable { | ||
public let standard: String | ||
} | ||
|
||
public struct PlayParameters: Codable, Sendable { | ||
public let id: MusicItemID | ||
public let isLibrary: Bool | ||
public let globalID: MusicItemID? | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case id, isLibrary | ||
case globalID = "globalId" | ||
} | ||
} | ||
|
||
public var globalID: String? { | ||
attributes.playParams.globalID?.rawValue | ||
} | ||
} |