Files
sdk-for-apple/Sources/AppwriteModels/LocaleCodeList.swift
T
Torsten Dittmann 5ca0d9c582 feat: release 1.4.0
2023-08-30 10:29:47 +02:00

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) }
)
}
}