Files
root 1fb0191d08 feat: update Swift SDK to 16.0.0
* Breaking: Renamed `AppwriteEnums.IndexType` to `AppwriteEnums.DatabasesIndexType` in `Databases`\n* Added `DocumentsDB` service with list/create/get/update/delete and transaction endpoints\n* Added impersonation support: `setImpersonateUserId`, `setImpersonateUserEmail`, `setImpersonateUserPhone`\n* Updated `x-sdk-version` to `15.1.0` and `x-appwrite-response-format` to `1.9.0`\n* Updated README badge to display API version `1.9.0`
2026-03-24 13:13:35 +00:00

53 lines
1.4 KiB
Swift

import Foundation
import JSONCodable
/// Webhooks List
open class WebhookList: Codable {
enum CodingKeys: String, CodingKey {
case total = "total"
case webhooks = "webhooks"
}
/// Total number of webhooks that matched your query.
public let total: Int
/// List of webhooks.
public let webhooks: [Webhook]
init(
total: Int,
webhooks: [Webhook]
) {
self.total = total
self.webhooks = webhooks
}
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.webhooks = try container.decode([Webhook].self, forKey: .webhooks)
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(total, forKey: .total)
try container.encode(webhooks, forKey: .webhooks)
}
public func toMap() -> [String: Any] {
return [
"total": total as Any,
"webhooks": webhooks.map { $0.toMap() } as Any
]
}
public static func from(map: [String: Any] ) -> WebhookList {
return WebhookList(
total: map["total"] as! Int,
webhooks: (map["webhooks"] as! [[String: Any]]).map { Webhook.from(map: $0) }
)
}
}