@@ -37,14 +37,16 @@ public struct MediaGroup {
37
37
category: MediaCategory ? = nil ,
38
38
rating: MediaRating ? = nil ,
39
39
description: MediaDescription ? = nil ,
40
- thumbnails: [ MediaThumbnail ] ? = nil
40
+ thumbnails: [ MediaThumbnail ] ? = nil ,
41
+ community: MediaCommunity ? = nil
41
42
) {
42
43
self . contents = contents
43
44
self . credits = credits
44
45
self . category = category
45
46
self . rating = rating
46
47
self . description = description
47
48
self . thumbnails = thumbnails
49
+ self . community = community
48
50
}
49
51
50
52
// MARK: Public
@@ -82,6 +84,11 @@ public struct MediaGroup {
82
84
/// at play, it is assumed that the images are in order of importance. It has
83
85
/// one required attribute and three optional attributes.
84
86
public var thumbnails : [ MediaThumbnail ] ?
87
+
88
+ /// This element stands for the community related content. This allows
89
+ /// inclusion of the user perception about a media object in the form of view
90
+ /// count, ratings and tags.
91
+ public var community : MediaCommunity ?
85
92
}
86
93
87
94
// MARK: - Sendable
@@ -106,6 +113,7 @@ extension MediaGroup: Codable {
106
113
case rating = " media:rating "
107
114
case description = " media:description "
108
115
case thumbnails = " media:thumbnail "
116
+ case community = " media:community "
109
117
}
110
118
111
119
public init ( from decoder: any Decoder ) throws {
@@ -117,6 +125,7 @@ extension MediaGroup: Codable {
117
125
rating = try container. decodeIfPresent ( MediaRating . self, forKey: MediaGroup . CodingKeys. rating)
118
126
description = try container. decodeIfPresent ( MediaDescription . self, forKey: MediaGroup . CodingKeys. description)
119
127
thumbnails = try container. decodeIfPresent ( [ MediaThumbnail ] . self, forKey: MediaGroup . CodingKeys. thumbnails)
128
+ community = try container. decodeIfPresent ( MediaCommunity . self, forKey: MediaGroup . CodingKeys. community)
120
129
}
121
130
122
131
public func encode( to encoder: any Encoder ) throws {
@@ -128,5 +137,6 @@ extension MediaGroup: Codable {
128
137
try container. encodeIfPresent ( rating, forKey: MediaGroup . CodingKeys. rating)
129
138
try container. encodeIfPresent ( description, forKey: MediaGroup . CodingKeys. description)
130
139
try container. encodeIfPresent ( thumbnails, forKey: MediaGroup . CodingKeys. thumbnails)
140
+ try container. encodeIfPresent ( community, forKey: MediaGroup . CodingKeys. community)
131
141
}
132
142
}
0 commit comments