Skip to content

Commit 04866fa

Browse files
authored
Merge pull request #44 from roblack/add-variants-media-field
2 parents 986063e + 1a57285 commit 04866fa

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Sources/Types+Media.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ public struct Media: Codable, Identifiable {
4545

4646
/// URL to the media content
4747
public let url: URL?
48+
49+
/// Each media object may have multiple display or playback variants, with different resolutions or formats
50+
public let variants: [Variant]?
4851
}
4952

5053
public enum MediaType: String, Codable, RawRepresentable {
@@ -86,6 +89,17 @@ extension Media {
8689
/// The number of views the media has received
8790
public let viewCount: Int
8891
}
92+
93+
public struct Variant: Codable {
94+
/// Bitrate of the media resource
95+
var bitRate: Int?
96+
97+
/// Type of media
98+
var contentType: MediaType
99+
100+
/// URL to the media content
101+
var url: String
102+
}
89103
}
90104

91105
extension Media: Fielded {
@@ -104,6 +118,7 @@ extension Media: Fielded {
104118
case \.url: return "url"
105119
case \.organicMetrics: return "organic_metrics"
106120
case \.promotedMetrics: return "promoted_metrics"
121+
case \.variants: return "variants"
107122
default: return nil
108123
}
109124
}

0 commit comments

Comments
 (0)