Skip to content

Commit ea46234

Browse files
committed
Add documentation comments for enums and properties in MusadoraKit
1 parent b2bbf15 commit ea46234

File tree

6 files changed

+37
-0
lines changed

6 files changed

+37
-0
lines changed

Sources/MusadoraKit/Models/MusadoraKitError.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ extension MusadoraKitError: CustomStringConvertible {
123123
}
124124

125125
extension MusadoraKitError: LocalizedError {
126+
/// A localized description of the error.
126127
public var errorDescription: String? {
127128
description
128129
}

Sources/MusadoraKit/Models/UserMusicItem.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public enum UserMusicItem: Equatable, Hashable, Identifiable {
1414
}
1515

1616
extension UserMusicItem: MusicItem {
17+
/// The unique identifier for the music item.
1718
public var id: MusicItemID {
1819
let id: MusicItemID
1920

@@ -31,6 +32,7 @@ extension UserMusicItem: MusicItem {
3132
return id
3233
}
3334

35+
/// The artwork associated with the music item, if available.
3436
public var artwork: Artwork? {
3537
switch self {
3638
case .album(let album):
@@ -44,6 +46,7 @@ extension UserMusicItem: MusicItem {
4446
}
4547
}
4648

49+
/// The title or name of the music item.
4750
public var title: String {
4851
switch self {
4952
case .album(let album):
@@ -101,6 +104,7 @@ extension UserMusicItem: Encodable {
101104
}
102105

103106
extension UserMusicItem: PlayableMusicItem {
107+
/// The parameters to use when playing the music item.
104108
public var playParameters: PlayParameters? {
105109
switch self {
106110
case .album(let album):

Sources/MusadoraKit/MultipleResources/MusicCatalogResources/MusicCatalogResourcesType.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,30 @@ public enum MusicCatalogResourcesType {
2323
case radioShow(RadioShow)
2424
case musicVideo(MusicVideo)
2525

26+
/// The key identifying the type of catalog resource for API requests.
2627
public enum Key: String, Codable {
28+
/// Stations resource key.
2729
case stations
30+
/// Genres resource key.
2831
case genres
32+
/// Songs resource key.
2933
case songs
34+
/// Record labels resource key.
3035
case recordLabels = "record-labels"
36+
/// Playlists resource key.
3137
case playlists
38+
/// Artists resource key.
3239
case artists
40+
/// Albums resource key.
3341
case albums
42+
/// Curators resource key.
3443
case curators
44+
/// Radio shows resource key.
3545
case radioShows = "apple-curators"
46+
/// Music videos resource key.
3647
case musicVideos = "music-videos"
3748

49+
/// The formatted type string for use in API query parameters.
3850
public var type: String {
3951
"ids[\(rawValue)]".removingPercentEncoding ?? "ids[\(rawValue)]"
4052
}
@@ -43,6 +55,7 @@ public enum MusicCatalogResourcesType {
4355

4456
@available(iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 9.0, visionOS 1.0, *)
4557
extension MusicCatalogResourcesType: MusicItem {
58+
/// The unique identifier for the catalog resource.
4659
public var id: MusicItemID {
4760
let id: MusicItemID
4861

Sources/MusadoraKit/MultipleResources/MusicLibraryResources/MusicLibraryResourcesType.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,28 @@ public enum MusicLibraryResourcesType {
1616
case artist(Artist)
1717
case musicVideo(MusicVideo)
1818

19+
/// The key identifying the type of library resource for API requests.
1920
public enum Key: String, Codable {
21+
/// Library songs resource key.
2022
case songs = "library-songs"
23+
/// Library albums resource key.
2124
case albums = "library-albums"
25+
/// Library playlists resource key.
2226
case playlists = "library-playlists"
27+
/// Library artists resource key.
2328
case artists = "library-artists"
29+
/// Library music videos resource key.
2430
case musicVideos = "library-music-videos"
2531

32+
/// The formatted type string for use in API query parameters.
2633
public var type: String {
2734
"ids[\(rawValue)]".removingPercentEncoding ?? "ids[\(rawValue)]"
2835
}
2936
}
3037
}
3138

3239
extension MusicLibraryResourcesType: MusicItem {
40+
/// The unique identifier for the library resource.
3341
public var id: MusicItemID {
3442
let id: MusicItemID
3543

Sources/MusadoraKit/MusicStorefront.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,19 @@ public struct MusicStorefront: Codable {
102102
storefrontId = MusicStorefront.mapStorefrontIdFromCountryCode(id)
103103
}
104104

105+
/// The explicit content policy for a storefront.
105106
public enum ExplicitContentPolicy: String, Codable {
107+
/// Explicit content is allowed in this storefront.
106108
case allowed
109+
/// Explicit content requires the user to opt in.
107110
case optIn = "opt-in"
111+
/// Explicit content is prohibited in this storefront.
108112
case prohibited
109113
}
110114

115+
/// The type of the resource.
111116
public enum `Type`: String, Codable {
117+
/// The resource is a storefront.
112118
case storefronts
113119
}
114120

Sources/MusadoraKit/Ratings/Library/LibraryRatingMusicItemType.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@
55
// Created by Rudrank Riyam on 18/05/22.
66
//
77

8+
/// The type of library music item that can be rated.
89
public enum LibraryRatingMusicItemType: String, Codable {
10+
/// A song in the user's library.
911
case song = "library-songs"
12+
/// An album in the user's library.
1013
case album = "library-albums"
14+
/// A music video in the user's library.
1115
case musicVideo = "library-music-videos"
16+
/// A playlist in the user's library.
1217
case playlist = "library-playlists"
1318
}

0 commit comments

Comments
 (0)