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