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