Swiftgram/TelegramCore/TelegramMediaLocation.swift
2016-09-05 23:20:51 +03:00

32 lines
798 B
Swift

import Foundation
#if os(macOS)
import PostboxMac
#else
import Postbox
#endif
public protocol TelegramMediaLocation: Coding {
var uniqueId: String { get }
func equalsTo(_ other: TelegramMediaLocation) -> Bool
}
public protocol TelegramCloudMediaLocation {
var datacenterId: Int { get }
var apiInputLocation: Api.InputFileLocation { get }
}
public extension TelegramMediaLocation {
public var cloudLocation: TelegramCloudMediaLocation! {
switch self {
case let location as TelegramCloudFileLocation:
return location
case let location as TelegramCloudDocumentLocation:
return location
case _:
assertionFailure("not supported")
return nil
}
}
}