Files
Chirag Aggarwal 7f801a9ed5 feat: SDK update for version 19.0.0 (#123)
* chore: update Apple SDK to 18.3.0

* chore: update Apple SDK to 18.3.0

* chore: update Apple SDK to 19.0.0

* docs: state the SDK targets Appwrite server version 2.0.x

* fix: regenerate with the latest sdk-generator and add auto image gravity
2026-09-07 10:48:33 -07:00

53 lines
1.4 KiB
Swift

import Foundation
import JSONCodable
/// Identities List
open class IdentityList: Codable {
enum CodingKeys: String, CodingKey {
case total = "total"
case identities = "identities"
}
/// Total number of identities that matched your query.
public let total: Int
/// List of identities.
public let identities: [Identity]
init(
total: Int,
identities: [Identity]
) {
self.total = total
self.identities = identities
}
public required init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.total = try container.decode(Int.self, forKey: .total)
self.identities = try container.decode([Identity].self, forKey: .identities)
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(total, forKey: .total)
try container.encode(identities, forKey: .identities)
}
public func toMap() -> [String: Any] {
return [
"total": total as Any,
"identities": identities.map { $0.toMap() } as Any,
]
}
public static func from(map: [String: Any]) -> IdentityList {
return IdentityList(
total: map["total"] as! Int,
identities: (map["identities"] as! [[String: Any]]).map { Identity.from(map: $0) }
)
}
}