mirror of
https://github.com/appwrite/sdk-for-apple.git
synced 2026-06-06 19:28:04 +00:00
36 lines
789 B
Swift
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) }
|
|
)
|
|
}
|
|
}
|