2021-07-07 22:39:18 +00:00
|
|
|
import Foundation
|
|
|
|
import SwiftyJSON
|
|
|
|
|
|
|
|
struct Thumbnail {
|
2021-07-22 12:43:13 +00:00
|
|
|
enum Quality: String, CaseIterable {
|
|
|
|
case maxres, maxresdefault, sddefault, high, medium, `default`, start, middle, end
|
|
|
|
}
|
|
|
|
|
2021-07-07 22:39:18 +00:00
|
|
|
var url: URL
|
2021-07-22 12:43:13 +00:00
|
|
|
var quality: Quality
|
2021-07-07 22:39:18 +00:00
|
|
|
|
|
|
|
init(_ json: JSON) {
|
|
|
|
url = json["url"].url!
|
2021-07-22 12:43:13 +00:00
|
|
|
quality = Quality(rawValue: json["quality"].string!)!
|
|
|
|
}
|
|
|
|
|
|
|
|
init(url: URL, quality: Quality) {
|
|
|
|
self.url = url
|
|
|
|
self.quality = quality
|
2021-07-07 22:39:18 +00:00
|
|
|
}
|
|
|
|
}
|