mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-05-28 21:28:22 +00:00
40 lines
921 B
Swift
40 lines
921 B
Swift
|
import Foundation
|
||
|
|
||
|
public struct RawStreamEvent: Decodable {
|
||
|
public let event: String
|
||
|
public let stream: [String]
|
||
|
public let payload: String
|
||
|
}
|
||
|
|
||
|
public protocol StreamEvent: Identifiable{
|
||
|
var date: Date { get }
|
||
|
var id: String { get }
|
||
|
}
|
||
|
|
||
|
public struct StreamEventUpdate: StreamEvent {
|
||
|
public let date = Date()
|
||
|
public var id: String { status.id }
|
||
|
public let status: Status
|
||
|
public init(status: Status) {
|
||
|
self.status = status
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public struct StreamEventDelete: StreamEvent {
|
||
|
public let date = Date()
|
||
|
public var id: String { status + date.description }
|
||
|
public let status: String
|
||
|
public init(status: String) {
|
||
|
self.status = status
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public struct StreamEventNotification: StreamEvent {
|
||
|
public let date = Date()
|
||
|
public var id: String { notification.id }
|
||
|
public let notification: Notification
|
||
|
public init(notification: Notification) {
|
||
|
self.notification = notification
|
||
|
}
|
||
|
}
|