mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-01-24 04:58:59 +00:00
27 lines
790 B
Swift
27 lines
790 B
Swift
import Foundation
|
|
import Postbox
|
|
|
|
final class StreamingResource: Coding {
|
|
let location: TelegramMediaLocation
|
|
let mimeType: String
|
|
let size: Int
|
|
|
|
init(location: TelegramMediaLocation, mimeType: String, size: Int) {
|
|
self.location = location
|
|
self.mimeType = mimeType
|
|
self.size = size
|
|
}
|
|
|
|
init(decoder: Decoder) {
|
|
self.location = decoder.decodeObjectForKey("l") as! TelegramMediaLocation
|
|
self.mimeType = decoder.decodeStringForKey("t")
|
|
self.size = Int(decoder.decodeInt32ForKey("s"))
|
|
}
|
|
|
|
func encode(_ encoder: Encoder) {
|
|
encoder.encodeObject(self.location, forKey: "l")
|
|
encoder.encodeString(self.mimeType, forKey: "t")
|
|
encoder.encodeInt32(Int32(self.size), forKey: "s")
|
|
}
|
|
}
|