Files
2023-02-03 19:01:36 +13:00

36 lines
789 B
Swift

import Foundation
import JSONCodable
/// Sessions List
public class SessionList {
/// Total number of sessions documents that matched your query.
public let total: Int
/// List of sessions.
public let sessions: [Session]
init(
total: Int,
sessions: [Session]
) {
self.total = total
self.sessions = sessions
}
public func toMap() -> [String: Any] {
return [
"total": total as Any,
"sessions": sessions.map { $0.toMap() } as Any
]
}
public static func from(map: [String: Any] ) -> SessionList {
return SessionList(
total: map["total"] as! Int,
sessions: (map["sessions"] as! [[String: Any]]).map { Session.from(map: $0) }
)
}
}