mirror of
https://github.com/appwrite/sdk-for-apple.git
synced 2026-04-07 19:17:50 +00:00
36 lines
841 B
Swift
36 lines
841 B
Swift
import Foundation
|
|
import JSONCodable
|
|
|
|
/// Locale codes list
|
|
public class LocaleCodeList {
|
|
|
|
/// Total number of localeCodes documents that matched your query.
|
|
public let total: Int
|
|
|
|
/// List of localeCodes.
|
|
public let localeCodes: [LocaleCode]
|
|
|
|
|
|
init(
|
|
total: Int,
|
|
localeCodes: [LocaleCode]
|
|
) {
|
|
self.total = total
|
|
self.localeCodes = localeCodes
|
|
}
|
|
|
|
public func toMap() -> [String: Any] {
|
|
return [
|
|
"total": total as Any,
|
|
"localeCodes": localeCodes.map { $0.toMap() } as Any
|
|
]
|
|
}
|
|
|
|
public static func from(map: [String: Any] ) -> LocaleCodeList {
|
|
return LocaleCodeList(
|
|
total: map["total"] as! Int,
|
|
localeCodes: (map["localeCodes"] as! [[String: Any]]).map { LocaleCode.from(map: $0) }
|
|
)
|
|
}
|
|
}
|