From 7f16b12d26986ef1db6b17079a5349ab11e996e4 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 19 Feb 2026 10:32:41 +0000 Subject: [PATCH 1/4] regenerate --- CHANGELOG.md | 25 -- README.md | 2 +- Sources/Appwrite/Query.swift | 26 ++ Sources/Appwrite/Services/Activities.swift | 76 +++++ Sources/Appwrite/Services/Databases.swift | 28 +- Sources/Appwrite/Services/TablesDB.swift | 28 +- Sources/AppwriteEnums/BuildRuntime.swift | 20 ++ Sources/AppwriteEnums/Runtime.swift | 20 ++ Sources/AppwriteEnums/Scopes.swift | 3 + Sources/AppwriteModels/ActivityEvent.swift | 322 ++++++++++++++++++ .../AppwriteModels/ActivityEventList.swift | 52 +++ .../AppwriteModels/AttributeLongtext.swift | 15 +- .../AppwriteModels/AttributeMediumtext.swift | 15 +- Sources/AppwriteModels/AttributeText.swift | 15 +- Sources/AppwriteModels/AttributeVarchar.swift | 15 +- Sources/AppwriteModels/ColumnLongtext.swift | 15 +- Sources/AppwriteModels/ColumnMediumtext.swift | 15 +- Sources/AppwriteModels/ColumnText.swift | 15 +- Sources/AppwriteModels/ColumnVarchar.swift | 15 +- .../get-event.md} | 6 +- .../list-events.md} | 6 +- .../databases/create-longtext-attribute.md | 3 +- .../databases/create-mediumtext-attribute.md | 3 +- .../databases/create-text-attribute.md | 3 +- .../databases/create-varchar-attribute.md | 3 +- .../get-queue-billing-project-aggregation.md | 15 - .../get-queue-billing-team-aggregation.md | 15 - .../health/get-queue-region-manager.md | 15 - .../tablesdb/create-longtext-column.md | 3 +- .../tablesdb/create-mediumtext-column.md | 3 +- docs/examples/tablesdb/create-text-column.md | 3 +- .../tablesdb/create-varchar-column.md | 3 +- 32 files changed, 678 insertions(+), 125 deletions(-) create mode 100644 Sources/Appwrite/Services/Activities.swift create mode 100644 Sources/AppwriteModels/ActivityEvent.swift create mode 100644 Sources/AppwriteModels/ActivityEventList.swift rename docs/examples/{health/get-queue-threats.md => activities/get-event.md} (68%) rename docs/examples/{health/get-queue-priority-builds.md => activities/list-events.md} (66%) delete mode 100644 docs/examples/health/get-queue-billing-project-aggregation.md delete mode 100644 docs/examples/health/get-queue-billing-team-aggregation.md delete mode 100644 docs/examples/health/get-queue-region-manager.md diff --git a/CHANGELOG.md b/CHANGELOG.md index c3b9b6b..33ec214 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,30 +1,5 @@ # Change Log -## 15.1.0 - -* Add `dart-3.10` and `flutter-3.38` to `BuildRuntime` and `Runtime` enums -* Add `bytesMax` and `bytesUsed` properties to `Collection` and `Table` models -* Fix `Roles` enum removed from Teams service; `roles` parameter now accepts `[String]` -* Add support for the new `Backups` service - -## 15.0.0 - -* Add array-based enum parameters (e.g., `permissions: [BrowserPermission]`). -* Breaking change: `Output` enum has been removed; use `ImageFormat` instead. -* Add `getQueueAudits` support to `Health` service. -* Add longtext/mediumtext/text/varchar attribute and column helpers to `Databases` and `TablesDB` services. - -## 14.1.0 - -* Added ability to create columns and indexes synchronously while creating a table - -## 14.0.0 - -* Rename `VCSDeploymentType` enum to `VCSReferenceType` -* Change `createTemplateDeployment` method signature: replace `version` parameter with `type` (TemplateReferenceType) and `reference` parameters -* Add `getScreenshot` method to `Avatars` service -* Add `Theme`, `Timezone` and `Output` enums - ## 13.3.0 * Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance diff --git a/README.md b/README.md index 0b9e3f1..cd54e45 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-swift/releases).** +**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-swift/releases).** > This is the Swift SDK for integrating with Appwrite from your Swift server-side code. If you're looking for the Apple SDK you should check [appwrite/sdk-for-apple](https://github.com/appwrite/sdk-for-apple) diff --git a/Sources/Appwrite/Query.swift b/Sources/Appwrite/Query.swift index 40bdbd7..b76af3d 100644 --- a/Sources/Appwrite/Query.swift +++ b/Sources/Appwrite/Query.swift @@ -350,6 +350,10 @@ public struct Query : Codable, CustomStringConvertible { ).description } + /// Filter resources where attribute contains the specified value. + /// For string attributes, checks if the string contains the substring. + /// + /// - Note: For array attributes, use ``containsAny(_:value:)`` or ``containsAll(_:value:)`` instead. public static func contains(_ attribute: String, value: Any) -> String { return Query( method: "contains", @@ -358,6 +362,28 @@ public struct Query : Codable, CustomStringConvertible { ).description } + /// Filter resources where attribute contains ANY of the specified values. + /// For array and relationship attributes, matches documents where the attribute + /// contains at least one of the given values. + public static func containsAny(_ attribute: String, value: [Any]) -> String { + return Query( + method: "containsAny", + attribute: attribute, + values: value + ).description + } + + /// Filter resources where attribute contains ALL of the specified values. + /// For array and relationship attributes, matches documents where the attribute + /// contains every one of the given values. + public static func containsAll(_ attribute: String, value: [Any]) -> String { + return Query( + method: "containsAll", + attribute: attribute, + values: value + ).description + } + public static func notContains(_ attribute: String, value: Any) -> String { return Query( method: "notContains", diff --git a/Sources/Appwrite/Services/Activities.swift b/Sources/Appwrite/Services/Activities.swift new file mode 100644 index 0000000..f6812b2 --- /dev/null +++ b/Sources/Appwrite/Services/Activities.swift @@ -0,0 +1,76 @@ +import AsyncHTTPClient +import Foundation +import NIO +import JSONCodable +import AppwriteEnums +import AppwriteModels + +/// +open class Activities: Service { + + /// + /// List all events for selected filters. + /// + /// - Parameters: + /// - queries: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.ActivityEventList + /// + open func listEvents( + queries: String? = nil + ) async throws -> AppwriteModels.ActivityEventList { + let apiPath: String = "/activities/events" + + let apiParams: [String: Any?] = [ + "queries": queries + ] + + let apiHeaders: [String: String] = [:] + + let converter: (Any) -> AppwriteModels.ActivityEventList = { response in + return AppwriteModels.ActivityEventList.from(map: response as! [String: Any]) + } + + return try await client.call( + method: "GET", + path: apiPath, + headers: apiHeaders, + params: apiParams, + converter: converter + ) + } + + /// + /// Get event by ID. + /// + /// + /// - Parameters: + /// - eventId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.ActivityEvent + /// + open func getEvent( + eventId: String + ) async throws -> AppwriteModels.ActivityEvent { + let apiPath: String = "/activities/events/{eventId}" + .replacingOccurrences(of: "{eventId}", with: eventId) + + let apiParams: [String: Any] = [:] + + let apiHeaders: [String: String] = [:] + + let converter: (Any) -> AppwriteModels.ActivityEvent = { response in + return AppwriteModels.ActivityEvent.from(map: response as! [String: Any]) + } + + return try await client.call( + method: "GET", + path: apiPath, + headers: apiHeaders, + params: apiParams, + converter: converter + ) + } + + +} \ No newline at end of file diff --git a/Sources/Appwrite/Services/Databases.swift b/Sources/Appwrite/Services/Databases.swift index 84c0a0f..5c30f30 100644 --- a/Sources/Appwrite/Services/Databases.swift +++ b/Sources/Appwrite/Services/Databases.swift @@ -1516,6 +1516,7 @@ open class Databases: Service { /// - required: Bool /// - default: String (optional) /// - array: Bool (optional) + /// - encrypt: Bool (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.AttributeLongtext /// @@ -1525,7 +1526,8 @@ open class Databases: Service { key: String, `required`: Bool, `default`: String? = nil, - array: Bool? = nil + array: Bool? = nil, + encrypt: Bool? = nil ) async throws -> AppwriteModels.AttributeLongtext { let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/longtext" .replacingOccurrences(of: "{databaseId}", with: databaseId) @@ -1535,7 +1537,8 @@ open class Databases: Service { "key": key, "required": `required`, "default": `default`, - "array": array + "array": array, + "encrypt": encrypt ] let apiHeaders: [String: String] = [ @@ -1617,6 +1620,7 @@ open class Databases: Service { /// - required: Bool /// - default: String (optional) /// - array: Bool (optional) + /// - encrypt: Bool (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.AttributeMediumtext /// @@ -1626,7 +1630,8 @@ open class Databases: Service { key: String, `required`: Bool, `default`: String? = nil, - array: Bool? = nil + array: Bool? = nil, + encrypt: Bool? = nil ) async throws -> AppwriteModels.AttributeMediumtext { let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext" .replacingOccurrences(of: "{databaseId}", with: databaseId) @@ -1636,7 +1641,8 @@ open class Databases: Service { "key": key, "required": `required`, "default": `default`, - "array": array + "array": array, + "encrypt": encrypt ] let apiHeaders: [String: String] = [ @@ -2084,6 +2090,7 @@ open class Databases: Service { /// - required: Bool /// - default: String (optional) /// - array: Bool (optional) + /// - encrypt: Bool (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.AttributeText /// @@ -2093,7 +2100,8 @@ open class Databases: Service { key: String, `required`: Bool, `default`: String? = nil, - array: Bool? = nil + array: Bool? = nil, + encrypt: Bool? = nil ) async throws -> AppwriteModels.AttributeText { let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/text" .replacingOccurrences(of: "{databaseId}", with: databaseId) @@ -2103,7 +2111,8 @@ open class Databases: Service { "key": key, "required": `required`, "default": `default`, - "array": array + "array": array, + "encrypt": encrypt ] let apiHeaders: [String: String] = [ @@ -2289,6 +2298,7 @@ open class Databases: Service { /// - required: Bool /// - default: String (optional) /// - array: Bool (optional) + /// - encrypt: Bool (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.AttributeVarchar /// @@ -2299,7 +2309,8 @@ open class Databases: Service { size: Int, `required`: Bool, `default`: String? = nil, - array: Bool? = nil + array: Bool? = nil, + encrypt: Bool? = nil ) async throws -> AppwriteModels.AttributeVarchar { let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/varchar" .replacingOccurrences(of: "{databaseId}", with: databaseId) @@ -2310,7 +2321,8 @@ open class Databases: Service { "size": size, "required": `required`, "default": `default`, - "array": array + "array": array, + "encrypt": encrypt ] let apiHeaders: [String: String] = [ diff --git a/Sources/Appwrite/Services/TablesDB.swift b/Sources/Appwrite/Services/TablesDB.swift index 602de15..b94b426 100644 --- a/Sources/Appwrite/Services/TablesDB.swift +++ b/Sources/Appwrite/Services/TablesDB.swift @@ -1488,6 +1488,7 @@ open class TablesDB: Service { /// - required: Bool /// - default: String (optional) /// - array: Bool (optional) + /// - encrypt: Bool (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.ColumnLongtext /// @@ -1497,7 +1498,8 @@ open class TablesDB: Service { key: String, `required`: Bool, `default`: String? = nil, - array: Bool? = nil + array: Bool? = nil, + encrypt: Bool? = nil ) async throws -> AppwriteModels.ColumnLongtext { let apiPath: String = "/tablesdb/{databaseId}/tables/{tableId}/columns/longtext" .replacingOccurrences(of: "{databaseId}", with: databaseId) @@ -1507,7 +1509,8 @@ open class TablesDB: Service { "key": key, "required": `required`, "default": `default`, - "array": array + "array": array, + "encrypt": encrypt ] let apiHeaders: [String: String] = [ @@ -1589,6 +1592,7 @@ open class TablesDB: Service { /// - required: Bool /// - default: String (optional) /// - array: Bool (optional) + /// - encrypt: Bool (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.ColumnMediumtext /// @@ -1598,7 +1602,8 @@ open class TablesDB: Service { key: String, `required`: Bool, `default`: String? = nil, - array: Bool? = nil + array: Bool? = nil, + encrypt: Bool? = nil ) async throws -> AppwriteModels.ColumnMediumtext { let apiPath: String = "/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext" .replacingOccurrences(of: "{databaseId}", with: databaseId) @@ -1608,7 +1613,8 @@ open class TablesDB: Service { "key": key, "required": `required`, "default": `default`, - "array": array + "array": array, + "encrypt": encrypt ] let apiHeaders: [String: String] = [ @@ -2051,6 +2057,7 @@ open class TablesDB: Service { /// - required: Bool /// - default: String (optional) /// - array: Bool (optional) + /// - encrypt: Bool (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.ColumnText /// @@ -2060,7 +2067,8 @@ open class TablesDB: Service { key: String, `required`: Bool, `default`: String? = nil, - array: Bool? = nil + array: Bool? = nil, + encrypt: Bool? = nil ) async throws -> AppwriteModels.ColumnText { let apiPath: String = "/tablesdb/{databaseId}/tables/{tableId}/columns/text" .replacingOccurrences(of: "{databaseId}", with: databaseId) @@ -2070,7 +2078,8 @@ open class TablesDB: Service { "key": key, "required": `required`, "default": `default`, - "array": array + "array": array, + "encrypt": encrypt ] let apiHeaders: [String: String] = [ @@ -2254,6 +2263,7 @@ open class TablesDB: Service { /// - required: Bool /// - default: String (optional) /// - array: Bool (optional) + /// - encrypt: Bool (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.ColumnVarchar /// @@ -2264,7 +2274,8 @@ open class TablesDB: Service { size: Int, `required`: Bool, `default`: String? = nil, - array: Bool? = nil + array: Bool? = nil, + encrypt: Bool? = nil ) async throws -> AppwriteModels.ColumnVarchar { let apiPath: String = "/tablesdb/{databaseId}/tables/{tableId}/columns/varchar" .replacingOccurrences(of: "{databaseId}", with: databaseId) @@ -2275,7 +2286,8 @@ open class TablesDB: Service { "size": size, "required": `required`, "default": `default`, - "array": array + "array": array, + "encrypt": encrypt ] let apiHeaders: [String: String] = [ diff --git a/Sources/AppwriteEnums/BuildRuntime.swift b/Sources/AppwriteEnums/BuildRuntime.swift index 20ce5d1..63c4a45 100644 --- a/Sources/AppwriteEnums/BuildRuntime.swift +++ b/Sources/AppwriteEnums/BuildRuntime.swift @@ -8,24 +8,35 @@ public enum BuildRuntime: String, CustomStringConvertible { case node200 = "node-20.0" case node210 = "node-21.0" case node22 = "node-22" + case node23 = "node-23" + case node24 = "node-24" + case node25 = "node-25" case php80 = "php-8.0" case php81 = "php-8.1" case php82 = "php-8.2" case php83 = "php-8.3" + case php84 = "php-8.4" case ruby30 = "ruby-3.0" case ruby31 = "ruby-3.1" case ruby32 = "ruby-3.2" case ruby33 = "ruby-3.3" + case ruby34 = "ruby-3.4" + case ruby40 = "ruby-4.0" case python38 = "python-3.8" case python39 = "python-3.9" case python310 = "python-3.10" case python311 = "python-3.11" case python312 = "python-3.12" + case python313 = "python-3.13" + case python314 = "python-3.14" case pythonMl311 = "python-ml-3.11" case pythonMl312 = "python-ml-3.12" + case pythonMl313 = "python-ml-3.13" case deno140 = "deno-1.40" case deno146 = "deno-1.46" case deno20 = "deno-2.0" + case deno25 = "deno-2.5" + case deno26 = "deno-2.6" case dart215 = "dart-2.15" case dart216 = "dart-2.16" case dart217 = "dart-2.17" @@ -41,25 +52,34 @@ public enum BuildRuntime: String, CustomStringConvertible { case dotnet60 = "dotnet-6.0" case dotnet70 = "dotnet-7.0" case dotnet80 = "dotnet-8.0" + case dotnet10 = "dotnet-10" case java80 = "java-8.0" case java110 = "java-11.0" case java170 = "java-17.0" case java180 = "java-18.0" case java210 = "java-21.0" case java22 = "java-22" + case java25 = "java-25" case swift55 = "swift-5.5" case swift58 = "swift-5.8" case swift59 = "swift-5.9" case swift510 = "swift-5.10" + case swift62 = "swift-6.2" case kotlin16 = "kotlin-1.6" case kotlin18 = "kotlin-1.8" case kotlin19 = "kotlin-1.9" case kotlin20 = "kotlin-2.0" + case kotlin23 = "kotlin-2.3" case cpp17 = "cpp-17" case cpp20 = "cpp-20" case bun10 = "bun-1.0" case bun11 = "bun-1.1" + case bun12 = "bun-1.2" + case bun13 = "bun-1.3" case go123 = "go-1.23" + case go124 = "go-1.24" + case go125 = "go-1.25" + case go126 = "go-1.26" case static1 = "static-1" case flutter324 = "flutter-3.24" case flutter327 = "flutter-3.27" diff --git a/Sources/AppwriteEnums/Runtime.swift b/Sources/AppwriteEnums/Runtime.swift index 21f64c7..3b92581 100644 --- a/Sources/AppwriteEnums/Runtime.swift +++ b/Sources/AppwriteEnums/Runtime.swift @@ -8,24 +8,35 @@ public enum Runtime: String, CustomStringConvertible { case node200 = "node-20.0" case node210 = "node-21.0" case node22 = "node-22" + case node23 = "node-23" + case node24 = "node-24" + case node25 = "node-25" case php80 = "php-8.0" case php81 = "php-8.1" case php82 = "php-8.2" case php83 = "php-8.3" + case php84 = "php-8.4" case ruby30 = "ruby-3.0" case ruby31 = "ruby-3.1" case ruby32 = "ruby-3.2" case ruby33 = "ruby-3.3" + case ruby34 = "ruby-3.4" + case ruby40 = "ruby-4.0" case python38 = "python-3.8" case python39 = "python-3.9" case python310 = "python-3.10" case python311 = "python-3.11" case python312 = "python-3.12" + case python313 = "python-3.13" + case python314 = "python-3.14" case pythonMl311 = "python-ml-3.11" case pythonMl312 = "python-ml-3.12" + case pythonMl313 = "python-ml-3.13" case deno140 = "deno-1.40" case deno146 = "deno-1.46" case deno20 = "deno-2.0" + case deno25 = "deno-2.5" + case deno26 = "deno-2.6" case dart215 = "dart-2.15" case dart216 = "dart-2.16" case dart217 = "dart-2.17" @@ -41,25 +52,34 @@ public enum Runtime: String, CustomStringConvertible { case dotnet60 = "dotnet-6.0" case dotnet70 = "dotnet-7.0" case dotnet80 = "dotnet-8.0" + case dotnet10 = "dotnet-10" case java80 = "java-8.0" case java110 = "java-11.0" case java170 = "java-17.0" case java180 = "java-18.0" case java210 = "java-21.0" case java22 = "java-22" + case java25 = "java-25" case swift55 = "swift-5.5" case swift58 = "swift-5.8" case swift59 = "swift-5.9" case swift510 = "swift-5.10" + case swift62 = "swift-6.2" case kotlin16 = "kotlin-1.6" case kotlin18 = "kotlin-1.8" case kotlin19 = "kotlin-1.9" case kotlin20 = "kotlin-2.0" + case kotlin23 = "kotlin-2.3" case cpp17 = "cpp-17" case cpp20 = "cpp-20" case bun10 = "bun-1.0" case bun11 = "bun-1.1" + case bun12 = "bun-1.2" + case bun13 = "bun-1.3" case go123 = "go-1.23" + case go124 = "go-1.24" + case go125 = "go-1.25" + case go126 = "go-1.26" case static1 = "static-1" case flutter324 = "flutter-3.24" case flutter327 = "flutter-3.27" diff --git a/Sources/AppwriteEnums/Scopes.swift b/Sources/AppwriteEnums/Scopes.swift index 95c5343..aeec943 100644 --- a/Sources/AppwriteEnums/Scopes.swift +++ b/Sources/AppwriteEnums/Scopes.swift @@ -49,6 +49,8 @@ public enum Scopes: String, CustomStringConvertible { case targetsWrite = "targets.write" case rulesRead = "rules.read" case rulesWrite = "rules.write" + case schedulesRead = "schedules.read" + case schedulesWrite = "schedules.write" case migrationsRead = "migrations.read" case migrationsWrite = "migrations.write" case vcsRead = "vcs.read" @@ -64,6 +66,7 @@ public enum Scopes: String, CustomStringConvertible { case restorationsWrite = "restorations.write" case domainsRead = "domains.read" case domainsWrite = "domains.write" + case eventsRead = "events.read" public var description: String { return rawValue diff --git a/Sources/AppwriteModels/ActivityEvent.swift b/Sources/AppwriteModels/ActivityEvent.swift new file mode 100644 index 0000000..ad82368 --- /dev/null +++ b/Sources/AppwriteModels/ActivityEvent.swift @@ -0,0 +1,322 @@ +import Foundation +import JSONCodable + +/// ActivityEvent +open class ActivityEvent: Codable { + + enum CodingKeys: String, CodingKey { + case id = "$id" + case userType = "userType" + case userId = "userId" + case userEmail = "userEmail" + case userName = "userName" + case resourceParent = "resourceParent" + case resourceType = "resourceType" + case resourceId = "resourceId" + case resource = "resource" + case event = "event" + case userAgent = "userAgent" + case ip = "ip" + case mode = "mode" + case country = "country" + case time = "time" + case projectId = "projectId" + case teamId = "teamId" + case hostname = "hostname" + case osCode = "osCode" + case osName = "osName" + case osVersion = "osVersion" + case clientType = "clientType" + case clientCode = "clientCode" + case clientName = "clientName" + case clientVersion = "clientVersion" + case clientEngine = "clientEngine" + case clientEngineVersion = "clientEngineVersion" + case deviceName = "deviceName" + case deviceBrand = "deviceBrand" + case deviceModel = "deviceModel" + case countryCode = "countryCode" + case countryName = "countryName" + } + + /// Event ID. + public let id: String + /// User type. + public let userType: String + /// User ID. + public let userId: String + /// User Email. + public let userEmail: String + /// User Name. + public let userName: String + /// Resource parent. + public let resourceParent: String + /// Resource type. + public let resourceType: String + /// Resource ID. + public let resourceId: String + /// Resource. + public let resource: String + /// Event name. + public let event: String + /// User agent. + public let userAgent: String + /// IP address. + public let ip: String + /// API mode when event triggered. + public let mode: String + /// Location. + public let country: String + /// Log creation date in ISO 8601 format. + public let time: String + /// Project ID. + public let projectId: String + /// Team ID. + public let teamId: String + /// Hostname. + public let hostname: String + /// Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). + public let osCode: String + /// Operating system name. + public let osName: String + /// Operating system version. + public let osVersion: String + /// Client type. + public let clientType: String + /// Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). + public let clientCode: String + /// Client name. + public let clientName: String + /// Client version. + public let clientVersion: String + /// Client engine name. + public let clientEngine: String + /// Client engine name. + public let clientEngineVersion: String + /// Device name. + public let deviceName: String + /// Device brand name. + public let deviceBrand: String + /// Device model name. + public let deviceModel: String + /// Country two-character ISO 3166-1 alpha code. + public let countryCode: String + /// Country name. + public let countryName: String + + init( + id: String, + userType: String, + userId: String, + userEmail: String, + userName: String, + resourceParent: String, + resourceType: String, + resourceId: String, + resource: String, + event: String, + userAgent: String, + ip: String, + mode: String, + country: String, + time: String, + projectId: String, + teamId: String, + hostname: String, + osCode: String, + osName: String, + osVersion: String, + clientType: String, + clientCode: String, + clientName: String, + clientVersion: String, + clientEngine: String, + clientEngineVersion: String, + deviceName: String, + deviceBrand: String, + deviceModel: String, + countryCode: String, + countryName: String + ) { + self.id = id + self.userType = userType + self.userId = userId + self.userEmail = userEmail + self.userName = userName + self.resourceParent = resourceParent + self.resourceType = resourceType + self.resourceId = resourceId + self.resource = resource + self.event = event + self.userAgent = userAgent + self.ip = ip + self.mode = mode + self.country = country + self.time = time + self.projectId = projectId + self.teamId = teamId + self.hostname = hostname + self.osCode = osCode + self.osName = osName + self.osVersion = osVersion + self.clientType = clientType + self.clientCode = clientCode + self.clientName = clientName + self.clientVersion = clientVersion + self.clientEngine = clientEngine + self.clientEngineVersion = clientEngineVersion + self.deviceName = deviceName + self.deviceBrand = deviceBrand + self.deviceModel = deviceModel + self.countryCode = countryCode + self.countryName = countryName + } + + public required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + + self.id = try container.decode(String.self, forKey: .id) + self.userType = try container.decode(String.self, forKey: .userType) + self.userId = try container.decode(String.self, forKey: .userId) + self.userEmail = try container.decode(String.self, forKey: .userEmail) + self.userName = try container.decode(String.self, forKey: .userName) + self.resourceParent = try container.decode(String.self, forKey: .resourceParent) + self.resourceType = try container.decode(String.self, forKey: .resourceType) + self.resourceId = try container.decode(String.self, forKey: .resourceId) + self.resource = try container.decode(String.self, forKey: .resource) + self.event = try container.decode(String.self, forKey: .event) + self.userAgent = try container.decode(String.self, forKey: .userAgent) + self.ip = try container.decode(String.self, forKey: .ip) + self.mode = try container.decode(String.self, forKey: .mode) + self.country = try container.decode(String.self, forKey: .country) + self.time = try container.decode(String.self, forKey: .time) + self.projectId = try container.decode(String.self, forKey: .projectId) + self.teamId = try container.decode(String.self, forKey: .teamId) + self.hostname = try container.decode(String.self, forKey: .hostname) + self.osCode = try container.decode(String.self, forKey: .osCode) + self.osName = try container.decode(String.self, forKey: .osName) + self.osVersion = try container.decode(String.self, forKey: .osVersion) + self.clientType = try container.decode(String.self, forKey: .clientType) + self.clientCode = try container.decode(String.self, forKey: .clientCode) + self.clientName = try container.decode(String.self, forKey: .clientName) + self.clientVersion = try container.decode(String.self, forKey: .clientVersion) + self.clientEngine = try container.decode(String.self, forKey: .clientEngine) + self.clientEngineVersion = try container.decode(String.self, forKey: .clientEngineVersion) + self.deviceName = try container.decode(String.self, forKey: .deviceName) + self.deviceBrand = try container.decode(String.self, forKey: .deviceBrand) + self.deviceModel = try container.decode(String.self, forKey: .deviceModel) + self.countryCode = try container.decode(String.self, forKey: .countryCode) + self.countryName = try container.decode(String.self, forKey: .countryName) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + + try container.encode(id, forKey: .id) + try container.encode(userType, forKey: .userType) + try container.encode(userId, forKey: .userId) + try container.encode(userEmail, forKey: .userEmail) + try container.encode(userName, forKey: .userName) + try container.encode(resourceParent, forKey: .resourceParent) + try container.encode(resourceType, forKey: .resourceType) + try container.encode(resourceId, forKey: .resourceId) + try container.encode(resource, forKey: .resource) + try container.encode(event, forKey: .event) + try container.encode(userAgent, forKey: .userAgent) + try container.encode(ip, forKey: .ip) + try container.encode(mode, forKey: .mode) + try container.encode(country, forKey: .country) + try container.encode(time, forKey: .time) + try container.encode(projectId, forKey: .projectId) + try container.encode(teamId, forKey: .teamId) + try container.encode(hostname, forKey: .hostname) + try container.encode(osCode, forKey: .osCode) + try container.encode(osName, forKey: .osName) + try container.encode(osVersion, forKey: .osVersion) + try container.encode(clientType, forKey: .clientType) + try container.encode(clientCode, forKey: .clientCode) + try container.encode(clientName, forKey: .clientName) + try container.encode(clientVersion, forKey: .clientVersion) + try container.encode(clientEngine, forKey: .clientEngine) + try container.encode(clientEngineVersion, forKey: .clientEngineVersion) + try container.encode(deviceName, forKey: .deviceName) + try container.encode(deviceBrand, forKey: .deviceBrand) + try container.encode(deviceModel, forKey: .deviceModel) + try container.encode(countryCode, forKey: .countryCode) + try container.encode(countryName, forKey: .countryName) + } + + public func toMap() -> [String: Any] { + return [ + "$id": id as Any, + "userType": userType as Any, + "userId": userId as Any, + "userEmail": userEmail as Any, + "userName": userName as Any, + "resourceParent": resourceParent as Any, + "resourceType": resourceType as Any, + "resourceId": resourceId as Any, + "resource": resource as Any, + "event": event as Any, + "userAgent": userAgent as Any, + "ip": ip as Any, + "mode": mode as Any, + "country": country as Any, + "time": time as Any, + "projectId": projectId as Any, + "teamId": teamId as Any, + "hostname": hostname as Any, + "osCode": osCode as Any, + "osName": osName as Any, + "osVersion": osVersion as Any, + "clientType": clientType as Any, + "clientCode": clientCode as Any, + "clientName": clientName as Any, + "clientVersion": clientVersion as Any, + "clientEngine": clientEngine as Any, + "clientEngineVersion": clientEngineVersion as Any, + "deviceName": deviceName as Any, + "deviceBrand": deviceBrand as Any, + "deviceModel": deviceModel as Any, + "countryCode": countryCode as Any, + "countryName": countryName as Any + ] + } + + public static func from(map: [String: Any] ) -> ActivityEvent { + return ActivityEvent( + id: map["$id"] as! String, + userType: map["userType"] as! String, + userId: map["userId"] as! String, + userEmail: map["userEmail"] as! String, + userName: map["userName"] as! String, + resourceParent: map["resourceParent"] as! String, + resourceType: map["resourceType"] as! String, + resourceId: map["resourceId"] as! String, + resource: map["resource"] as! String, + event: map["event"] as! String, + userAgent: map["userAgent"] as! String, + ip: map["ip"] as! String, + mode: map["mode"] as! String, + country: map["country"] as! String, + time: map["time"] as! String, + projectId: map["projectId"] as! String, + teamId: map["teamId"] as! String, + hostname: map["hostname"] as! String, + osCode: map["osCode"] as! String, + osName: map["osName"] as! String, + osVersion: map["osVersion"] as! String, + clientType: map["clientType"] as! String, + clientCode: map["clientCode"] as! String, + clientName: map["clientName"] as! String, + clientVersion: map["clientVersion"] as! String, + clientEngine: map["clientEngine"] as! String, + clientEngineVersion: map["clientEngineVersion"] as! String, + deviceName: map["deviceName"] as! String, + deviceBrand: map["deviceBrand"] as! String, + deviceModel: map["deviceModel"] as! String, + countryCode: map["countryCode"] as! String, + countryName: map["countryName"] as! String + ) + } +} diff --git a/Sources/AppwriteModels/ActivityEventList.swift b/Sources/AppwriteModels/ActivityEventList.swift new file mode 100644 index 0000000..78f3f0b --- /dev/null +++ b/Sources/AppwriteModels/ActivityEventList.swift @@ -0,0 +1,52 @@ +import Foundation +import JSONCodable + +/// Activity event list +open class ActivityEventList: Codable { + + enum CodingKeys: String, CodingKey { + case total = "total" + case events = "events" + } + + /// Total number of events that matched your query. + public let total: Int + /// List of events. + public let events: [ActivityEvent] + + init( + total: Int, + events: [ActivityEvent] + ) { + self.total = total + self.events = events + } + + 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.events = try container.decode([ActivityEvent].self, forKey: .events) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + + try container.encode(total, forKey: .total) + try container.encode(events, forKey: .events) + } + + public func toMap() -> [String: Any] { + return [ + "total": total as Any, + "events": events.map { $0.toMap() } as Any + ] + } + + public static func from(map: [String: Any] ) -> ActivityEventList { + return ActivityEventList( + total: map["total"] as! Int, + events: (map["events"] as! [[String: Any]]).map { ActivityEvent.from(map: $0) } + ) + } +} diff --git a/Sources/AppwriteModels/AttributeLongtext.swift b/Sources/AppwriteModels/AttributeLongtext.swift index 563a8f1..4c5631f 100644 --- a/Sources/AppwriteModels/AttributeLongtext.swift +++ b/Sources/AppwriteModels/AttributeLongtext.swift @@ -15,6 +15,7 @@ open class AttributeLongtext: Codable { case createdAt = "$createdAt" case updatedAt = "$updatedAt" case `default` = "default" + case encrypt = "encrypt" } /// Attribute Key. @@ -35,6 +36,8 @@ open class AttributeLongtext: Codable { public let updatedAt: String /// Default value for attribute when not provided. Cannot be set when attribute is required. public let `default`: String? + /// Defines whether this attribute is encrypted or not. + public let encrypt: Bool? init( key: String, @@ -45,7 +48,8 @@ open class AttributeLongtext: Codable { array: Bool?, createdAt: String, updatedAt: String, - `default`: String? + `default`: String?, + encrypt: Bool? ) { self.key = key self.type = type @@ -56,6 +60,7 @@ open class AttributeLongtext: Codable { self.createdAt = createdAt self.updatedAt = updatedAt self.`default` = `default` + self.encrypt = encrypt } public required init(from decoder: Decoder) throws { @@ -70,6 +75,7 @@ open class AttributeLongtext: Codable { self.createdAt = try container.decode(String.self, forKey: .createdAt) self.updatedAt = try container.decode(String.self, forKey: .updatedAt) self.`default` = try container.decodeIfPresent(String.self, forKey: .`default`) + self.encrypt = try container.decodeIfPresent(Bool.self, forKey: .encrypt) } public func encode(to encoder: Encoder) throws { @@ -84,6 +90,7 @@ open class AttributeLongtext: Codable { try container.encode(createdAt, forKey: .createdAt) try container.encode(updatedAt, forKey: .updatedAt) try container.encodeIfPresent(`default`, forKey: .`default`) + try container.encodeIfPresent(encrypt, forKey: .encrypt) } public func toMap() -> [String: Any] { @@ -96,7 +103,8 @@ open class AttributeLongtext: Codable { "array": array as Any, "$createdAt": createdAt as Any, "$updatedAt": updatedAt as Any, - "default": `default` as Any + "default": `default` as Any, + "encrypt": encrypt as Any ] } @@ -110,7 +118,8 @@ open class AttributeLongtext: Codable { array: map["array"] as? Bool, createdAt: map["$createdAt"] as! String, updatedAt: map["$updatedAt"] as! String, - default: map["default"] as? String + default: map["default"] as? String, + encrypt: map["encrypt"] as? Bool ) } } diff --git a/Sources/AppwriteModels/AttributeMediumtext.swift b/Sources/AppwriteModels/AttributeMediumtext.swift index cdddaff..90f69dd 100644 --- a/Sources/AppwriteModels/AttributeMediumtext.swift +++ b/Sources/AppwriteModels/AttributeMediumtext.swift @@ -15,6 +15,7 @@ open class AttributeMediumtext: Codable { case createdAt = "$createdAt" case updatedAt = "$updatedAt" case `default` = "default" + case encrypt = "encrypt" } /// Attribute Key. @@ -35,6 +36,8 @@ open class AttributeMediumtext: Codable { public let updatedAt: String /// Default value for attribute when not provided. Cannot be set when attribute is required. public let `default`: String? + /// Defines whether this attribute is encrypted or not. + public let encrypt: Bool? init( key: String, @@ -45,7 +48,8 @@ open class AttributeMediumtext: Codable { array: Bool?, createdAt: String, updatedAt: String, - `default`: String? + `default`: String?, + encrypt: Bool? ) { self.key = key self.type = type @@ -56,6 +60,7 @@ open class AttributeMediumtext: Codable { self.createdAt = createdAt self.updatedAt = updatedAt self.`default` = `default` + self.encrypt = encrypt } public required init(from decoder: Decoder) throws { @@ -70,6 +75,7 @@ open class AttributeMediumtext: Codable { self.createdAt = try container.decode(String.self, forKey: .createdAt) self.updatedAt = try container.decode(String.self, forKey: .updatedAt) self.`default` = try container.decodeIfPresent(String.self, forKey: .`default`) + self.encrypt = try container.decodeIfPresent(Bool.self, forKey: .encrypt) } public func encode(to encoder: Encoder) throws { @@ -84,6 +90,7 @@ open class AttributeMediumtext: Codable { try container.encode(createdAt, forKey: .createdAt) try container.encode(updatedAt, forKey: .updatedAt) try container.encodeIfPresent(`default`, forKey: .`default`) + try container.encodeIfPresent(encrypt, forKey: .encrypt) } public func toMap() -> [String: Any] { @@ -96,7 +103,8 @@ open class AttributeMediumtext: Codable { "array": array as Any, "$createdAt": createdAt as Any, "$updatedAt": updatedAt as Any, - "default": `default` as Any + "default": `default` as Any, + "encrypt": encrypt as Any ] } @@ -110,7 +118,8 @@ open class AttributeMediumtext: Codable { array: map["array"] as? Bool, createdAt: map["$createdAt"] as! String, updatedAt: map["$updatedAt"] as! String, - default: map["default"] as? String + default: map["default"] as? String, + encrypt: map["encrypt"] as? Bool ) } } diff --git a/Sources/AppwriteModels/AttributeText.swift b/Sources/AppwriteModels/AttributeText.swift index 0bc621f..5f95de1 100644 --- a/Sources/AppwriteModels/AttributeText.swift +++ b/Sources/AppwriteModels/AttributeText.swift @@ -15,6 +15,7 @@ open class AttributeText: Codable { case createdAt = "$createdAt" case updatedAt = "$updatedAt" case `default` = "default" + case encrypt = "encrypt" } /// Attribute Key. @@ -35,6 +36,8 @@ open class AttributeText: Codable { public let updatedAt: String /// Default value for attribute when not provided. Cannot be set when attribute is required. public let `default`: String? + /// Defines whether this attribute is encrypted or not. + public let encrypt: Bool? init( key: String, @@ -45,7 +48,8 @@ open class AttributeText: Codable { array: Bool?, createdAt: String, updatedAt: String, - `default`: String? + `default`: String?, + encrypt: Bool? ) { self.key = key self.type = type @@ -56,6 +60,7 @@ open class AttributeText: Codable { self.createdAt = createdAt self.updatedAt = updatedAt self.`default` = `default` + self.encrypt = encrypt } public required init(from decoder: Decoder) throws { @@ -70,6 +75,7 @@ open class AttributeText: Codable { self.createdAt = try container.decode(String.self, forKey: .createdAt) self.updatedAt = try container.decode(String.self, forKey: .updatedAt) self.`default` = try container.decodeIfPresent(String.self, forKey: .`default`) + self.encrypt = try container.decodeIfPresent(Bool.self, forKey: .encrypt) } public func encode(to encoder: Encoder) throws { @@ -84,6 +90,7 @@ open class AttributeText: Codable { try container.encode(createdAt, forKey: .createdAt) try container.encode(updatedAt, forKey: .updatedAt) try container.encodeIfPresent(`default`, forKey: .`default`) + try container.encodeIfPresent(encrypt, forKey: .encrypt) } public func toMap() -> [String: Any] { @@ -96,7 +103,8 @@ open class AttributeText: Codable { "array": array as Any, "$createdAt": createdAt as Any, "$updatedAt": updatedAt as Any, - "default": `default` as Any + "default": `default` as Any, + "encrypt": encrypt as Any ] } @@ -110,7 +118,8 @@ open class AttributeText: Codable { array: map["array"] as? Bool, createdAt: map["$createdAt"] as! String, updatedAt: map["$updatedAt"] as! String, - default: map["default"] as? String + default: map["default"] as? String, + encrypt: map["encrypt"] as? Bool ) } } diff --git a/Sources/AppwriteModels/AttributeVarchar.swift b/Sources/AppwriteModels/AttributeVarchar.swift index ce14254..9967a33 100644 --- a/Sources/AppwriteModels/AttributeVarchar.swift +++ b/Sources/AppwriteModels/AttributeVarchar.swift @@ -16,6 +16,7 @@ open class AttributeVarchar: Codable { case updatedAt = "$updatedAt" case size = "size" case `default` = "default" + case encrypt = "encrypt" } /// Attribute Key. @@ -38,6 +39,8 @@ open class AttributeVarchar: Codable { public let size: Int /// Default value for attribute when not provided. Cannot be set when attribute is required. public let `default`: String? + /// Defines whether this attribute is encrypted or not. + public let encrypt: Bool? init( key: String, @@ -49,7 +52,8 @@ open class AttributeVarchar: Codable { createdAt: String, updatedAt: String, size: Int, - `default`: String? + `default`: String?, + encrypt: Bool? ) { self.key = key self.type = type @@ -61,6 +65,7 @@ open class AttributeVarchar: Codable { self.updatedAt = updatedAt self.size = size self.`default` = `default` + self.encrypt = encrypt } public required init(from decoder: Decoder) throws { @@ -76,6 +81,7 @@ open class AttributeVarchar: Codable { self.updatedAt = try container.decode(String.self, forKey: .updatedAt) self.size = try container.decode(Int.self, forKey: .size) self.`default` = try container.decodeIfPresent(String.self, forKey: .`default`) + self.encrypt = try container.decodeIfPresent(Bool.self, forKey: .encrypt) } public func encode(to encoder: Encoder) throws { @@ -91,6 +97,7 @@ open class AttributeVarchar: Codable { try container.encode(updatedAt, forKey: .updatedAt) try container.encode(size, forKey: .size) try container.encodeIfPresent(`default`, forKey: .`default`) + try container.encodeIfPresent(encrypt, forKey: .encrypt) } public func toMap() -> [String: Any] { @@ -104,7 +111,8 @@ open class AttributeVarchar: Codable { "$createdAt": createdAt as Any, "$updatedAt": updatedAt as Any, "size": size as Any, - "default": `default` as Any + "default": `default` as Any, + "encrypt": encrypt as Any ] } @@ -119,7 +127,8 @@ open class AttributeVarchar: Codable { createdAt: map["$createdAt"] as! String, updatedAt: map["$updatedAt"] as! String, size: map["size"] as! Int, - default: map["default"] as? String + default: map["default"] as? String, + encrypt: map["encrypt"] as? Bool ) } } diff --git a/Sources/AppwriteModels/ColumnLongtext.swift b/Sources/AppwriteModels/ColumnLongtext.swift index 6982431..859ec8f 100644 --- a/Sources/AppwriteModels/ColumnLongtext.swift +++ b/Sources/AppwriteModels/ColumnLongtext.swift @@ -15,6 +15,7 @@ open class ColumnLongtext: Codable { case createdAt = "$createdAt" case updatedAt = "$updatedAt" case `default` = "default" + case encrypt = "encrypt" } /// Column Key. @@ -35,6 +36,8 @@ open class ColumnLongtext: Codable { public let updatedAt: String /// Default value for column when not provided. Cannot be set when column is required. public let `default`: String? + /// Defines whether this column is encrypted or not. + public let encrypt: Bool? init( key: String, @@ -45,7 +48,8 @@ open class ColumnLongtext: Codable { array: Bool?, createdAt: String, updatedAt: String, - `default`: String? + `default`: String?, + encrypt: Bool? ) { self.key = key self.type = type @@ -56,6 +60,7 @@ open class ColumnLongtext: Codable { self.createdAt = createdAt self.updatedAt = updatedAt self.`default` = `default` + self.encrypt = encrypt } public required init(from decoder: Decoder) throws { @@ -70,6 +75,7 @@ open class ColumnLongtext: Codable { self.createdAt = try container.decode(String.self, forKey: .createdAt) self.updatedAt = try container.decode(String.self, forKey: .updatedAt) self.`default` = try container.decodeIfPresent(String.self, forKey: .`default`) + self.encrypt = try container.decodeIfPresent(Bool.self, forKey: .encrypt) } public func encode(to encoder: Encoder) throws { @@ -84,6 +90,7 @@ open class ColumnLongtext: Codable { try container.encode(createdAt, forKey: .createdAt) try container.encode(updatedAt, forKey: .updatedAt) try container.encodeIfPresent(`default`, forKey: .`default`) + try container.encodeIfPresent(encrypt, forKey: .encrypt) } public func toMap() -> [String: Any] { @@ -96,7 +103,8 @@ open class ColumnLongtext: Codable { "array": array as Any, "$createdAt": createdAt as Any, "$updatedAt": updatedAt as Any, - "default": `default` as Any + "default": `default` as Any, + "encrypt": encrypt as Any ] } @@ -110,7 +118,8 @@ open class ColumnLongtext: Codable { array: map["array"] as? Bool, createdAt: map["$createdAt"] as! String, updatedAt: map["$updatedAt"] as! String, - default: map["default"] as? String + default: map["default"] as? String, + encrypt: map["encrypt"] as? Bool ) } } diff --git a/Sources/AppwriteModels/ColumnMediumtext.swift b/Sources/AppwriteModels/ColumnMediumtext.swift index d3736f4..1190bcd 100644 --- a/Sources/AppwriteModels/ColumnMediumtext.swift +++ b/Sources/AppwriteModels/ColumnMediumtext.swift @@ -15,6 +15,7 @@ open class ColumnMediumtext: Codable { case createdAt = "$createdAt" case updatedAt = "$updatedAt" case `default` = "default" + case encrypt = "encrypt" } /// Column Key. @@ -35,6 +36,8 @@ open class ColumnMediumtext: Codable { public let updatedAt: String /// Default value for column when not provided. Cannot be set when column is required. public let `default`: String? + /// Defines whether this column is encrypted or not. + public let encrypt: Bool? init( key: String, @@ -45,7 +48,8 @@ open class ColumnMediumtext: Codable { array: Bool?, createdAt: String, updatedAt: String, - `default`: String? + `default`: String?, + encrypt: Bool? ) { self.key = key self.type = type @@ -56,6 +60,7 @@ open class ColumnMediumtext: Codable { self.createdAt = createdAt self.updatedAt = updatedAt self.`default` = `default` + self.encrypt = encrypt } public required init(from decoder: Decoder) throws { @@ -70,6 +75,7 @@ open class ColumnMediumtext: Codable { self.createdAt = try container.decode(String.self, forKey: .createdAt) self.updatedAt = try container.decode(String.self, forKey: .updatedAt) self.`default` = try container.decodeIfPresent(String.self, forKey: .`default`) + self.encrypt = try container.decodeIfPresent(Bool.self, forKey: .encrypt) } public func encode(to encoder: Encoder) throws { @@ -84,6 +90,7 @@ open class ColumnMediumtext: Codable { try container.encode(createdAt, forKey: .createdAt) try container.encode(updatedAt, forKey: .updatedAt) try container.encodeIfPresent(`default`, forKey: .`default`) + try container.encodeIfPresent(encrypt, forKey: .encrypt) } public func toMap() -> [String: Any] { @@ -96,7 +103,8 @@ open class ColumnMediumtext: Codable { "array": array as Any, "$createdAt": createdAt as Any, "$updatedAt": updatedAt as Any, - "default": `default` as Any + "default": `default` as Any, + "encrypt": encrypt as Any ] } @@ -110,7 +118,8 @@ open class ColumnMediumtext: Codable { array: map["array"] as? Bool, createdAt: map["$createdAt"] as! String, updatedAt: map["$updatedAt"] as! String, - default: map["default"] as? String + default: map["default"] as? String, + encrypt: map["encrypt"] as? Bool ) } } diff --git a/Sources/AppwriteModels/ColumnText.swift b/Sources/AppwriteModels/ColumnText.swift index 6309fdd..08072f1 100644 --- a/Sources/AppwriteModels/ColumnText.swift +++ b/Sources/AppwriteModels/ColumnText.swift @@ -15,6 +15,7 @@ open class ColumnText: Codable { case createdAt = "$createdAt" case updatedAt = "$updatedAt" case `default` = "default" + case encrypt = "encrypt" } /// Column Key. @@ -35,6 +36,8 @@ open class ColumnText: Codable { public let updatedAt: String /// Default value for column when not provided. Cannot be set when column is required. public let `default`: String? + /// Defines whether this column is encrypted or not. + public let encrypt: Bool? init( key: String, @@ -45,7 +48,8 @@ open class ColumnText: Codable { array: Bool?, createdAt: String, updatedAt: String, - `default`: String? + `default`: String?, + encrypt: Bool? ) { self.key = key self.type = type @@ -56,6 +60,7 @@ open class ColumnText: Codable { self.createdAt = createdAt self.updatedAt = updatedAt self.`default` = `default` + self.encrypt = encrypt } public required init(from decoder: Decoder) throws { @@ -70,6 +75,7 @@ open class ColumnText: Codable { self.createdAt = try container.decode(String.self, forKey: .createdAt) self.updatedAt = try container.decode(String.self, forKey: .updatedAt) self.`default` = try container.decodeIfPresent(String.self, forKey: .`default`) + self.encrypt = try container.decodeIfPresent(Bool.self, forKey: .encrypt) } public func encode(to encoder: Encoder) throws { @@ -84,6 +90,7 @@ open class ColumnText: Codable { try container.encode(createdAt, forKey: .createdAt) try container.encode(updatedAt, forKey: .updatedAt) try container.encodeIfPresent(`default`, forKey: .`default`) + try container.encodeIfPresent(encrypt, forKey: .encrypt) } public func toMap() -> [String: Any] { @@ -96,7 +103,8 @@ open class ColumnText: Codable { "array": array as Any, "$createdAt": createdAt as Any, "$updatedAt": updatedAt as Any, - "default": `default` as Any + "default": `default` as Any, + "encrypt": encrypt as Any ] } @@ -110,7 +118,8 @@ open class ColumnText: Codable { array: map["array"] as? Bool, createdAt: map["$createdAt"] as! String, updatedAt: map["$updatedAt"] as! String, - default: map["default"] as? String + default: map["default"] as? String, + encrypt: map["encrypt"] as? Bool ) } } diff --git a/Sources/AppwriteModels/ColumnVarchar.swift b/Sources/AppwriteModels/ColumnVarchar.swift index b261b47..5a39ce0 100644 --- a/Sources/AppwriteModels/ColumnVarchar.swift +++ b/Sources/AppwriteModels/ColumnVarchar.swift @@ -16,6 +16,7 @@ open class ColumnVarchar: Codable { case updatedAt = "$updatedAt" case size = "size" case `default` = "default" + case encrypt = "encrypt" } /// Column Key. @@ -38,6 +39,8 @@ open class ColumnVarchar: Codable { public let size: Int /// Default value for column when not provided. Cannot be set when column is required. public let `default`: String? + /// Defines whether this column is encrypted or not. + public let encrypt: Bool? init( key: String, @@ -49,7 +52,8 @@ open class ColumnVarchar: Codable { createdAt: String, updatedAt: String, size: Int, - `default`: String? + `default`: String?, + encrypt: Bool? ) { self.key = key self.type = type @@ -61,6 +65,7 @@ open class ColumnVarchar: Codable { self.updatedAt = updatedAt self.size = size self.`default` = `default` + self.encrypt = encrypt } public required init(from decoder: Decoder) throws { @@ -76,6 +81,7 @@ open class ColumnVarchar: Codable { self.updatedAt = try container.decode(String.self, forKey: .updatedAt) self.size = try container.decode(Int.self, forKey: .size) self.`default` = try container.decodeIfPresent(String.self, forKey: .`default`) + self.encrypt = try container.decodeIfPresent(Bool.self, forKey: .encrypt) } public func encode(to encoder: Encoder) throws { @@ -91,6 +97,7 @@ open class ColumnVarchar: Codable { try container.encode(updatedAt, forKey: .updatedAt) try container.encode(size, forKey: .size) try container.encodeIfPresent(`default`, forKey: .`default`) + try container.encodeIfPresent(encrypt, forKey: .encrypt) } public func toMap() -> [String: Any] { @@ -104,7 +111,8 @@ open class ColumnVarchar: Codable { "$createdAt": createdAt as Any, "$updatedAt": updatedAt as Any, "size": size as Any, - "default": `default` as Any + "default": `default` as Any, + "encrypt": encrypt as Any ] } @@ -119,7 +127,8 @@ open class ColumnVarchar: Codable { createdAt: map["$createdAt"] as! String, updatedAt: map["$updatedAt"] as! String, size: map["size"] as! Int, - default: map["default"] as? String + default: map["default"] as? String, + encrypt: map["encrypt"] as? Bool ) } } diff --git a/docs/examples/health/get-queue-threats.md b/docs/examples/activities/get-event.md similarity index 68% rename from docs/examples/health/get-queue-threats.md rename to docs/examples/activities/get-event.md index 6a717c7..0e27cbe 100644 --- a/docs/examples/health/get-queue-threats.md +++ b/docs/examples/activities/get-event.md @@ -6,10 +6,10 @@ let client = Client() .setProject("") // Your project ID .setKey("") // Your secret API key -let health = Health(client) +let activities = Activities(client) -let healthQueue = try await health.getQueueThreats( - threshold: 0 // optional +let activityEvent = try await activities.getEvent( + eventId: "" ) ``` diff --git a/docs/examples/health/get-queue-priority-builds.md b/docs/examples/activities/list-events.md similarity index 66% rename from docs/examples/health/get-queue-priority-builds.md rename to docs/examples/activities/list-events.md index e809be5..d36a987 100644 --- a/docs/examples/health/get-queue-priority-builds.md +++ b/docs/examples/activities/list-events.md @@ -6,10 +6,10 @@ let client = Client() .setProject("") // Your project ID .setKey("") // Your secret API key -let health = Health(client) +let activities = Activities(client) -let healthQueue = try await health.getQueuePriorityBuilds( - threshold: 0 // optional +let activityEventList = try await activities.listEvents( + queries: "" // optional ) ``` diff --git a/docs/examples/databases/create-longtext-attribute.md b/docs/examples/databases/create-longtext-attribute.md index c7e05b7..0ddf87f 100644 --- a/docs/examples/databases/create-longtext-attribute.md +++ b/docs/examples/databases/create-longtext-attribute.md @@ -14,7 +14,8 @@ let attributeLongtext = try await databases.createLongtextAttribute( key: "", required: false, default: "", // optional - array: false // optional + array: false, // optional + encrypt: false // optional ) ``` diff --git a/docs/examples/databases/create-mediumtext-attribute.md b/docs/examples/databases/create-mediumtext-attribute.md index 6d7f7f7..7a95cbd 100644 --- a/docs/examples/databases/create-mediumtext-attribute.md +++ b/docs/examples/databases/create-mediumtext-attribute.md @@ -14,7 +14,8 @@ let attributeMediumtext = try await databases.createMediumtextAttribute( key: "", required: false, default: "", // optional - array: false // optional + array: false, // optional + encrypt: false // optional ) ``` diff --git a/docs/examples/databases/create-text-attribute.md b/docs/examples/databases/create-text-attribute.md index a64c6f6..107be93 100644 --- a/docs/examples/databases/create-text-attribute.md +++ b/docs/examples/databases/create-text-attribute.md @@ -14,7 +14,8 @@ let attributeText = try await databases.createTextAttribute( key: "", required: false, default: "", // optional - array: false // optional + array: false, // optional + encrypt: false // optional ) ``` diff --git a/docs/examples/databases/create-varchar-attribute.md b/docs/examples/databases/create-varchar-attribute.md index ac2107f..0627b73 100644 --- a/docs/examples/databases/create-varchar-attribute.md +++ b/docs/examples/databases/create-varchar-attribute.md @@ -15,7 +15,8 @@ let attributeVarchar = try await databases.createVarcharAttribute( size: 1, required: false, default: "", // optional - array: false // optional + array: false, // optional + encrypt: false // optional ) ``` diff --git a/docs/examples/health/get-queue-billing-project-aggregation.md b/docs/examples/health/get-queue-billing-project-aggregation.md deleted file mode 100644 index e69ea6a..0000000 --- a/docs/examples/health/get-queue-billing-project-aggregation.md +++ /dev/null @@ -1,15 +0,0 @@ -```swift -import Appwrite - -let client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -let health = Health(client) - -let healthQueue = try await health.getQueueBillingProjectAggregation( - threshold: 0 // optional -) - -``` diff --git a/docs/examples/health/get-queue-billing-team-aggregation.md b/docs/examples/health/get-queue-billing-team-aggregation.md deleted file mode 100644 index 5aec80d..0000000 --- a/docs/examples/health/get-queue-billing-team-aggregation.md +++ /dev/null @@ -1,15 +0,0 @@ -```swift -import Appwrite - -let client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -let health = Health(client) - -let healthQueue = try await health.getQueueBillingTeamAggregation( - threshold: 0 // optional -) - -``` diff --git a/docs/examples/health/get-queue-region-manager.md b/docs/examples/health/get-queue-region-manager.md deleted file mode 100644 index 8db3e47..0000000 --- a/docs/examples/health/get-queue-region-manager.md +++ /dev/null @@ -1,15 +0,0 @@ -```swift -import Appwrite - -let client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID - .setKey("") // Your secret API key - -let health = Health(client) - -let healthQueue = try await health.getQueueRegionManager( - threshold: 0 // optional -) - -``` diff --git a/docs/examples/tablesdb/create-longtext-column.md b/docs/examples/tablesdb/create-longtext-column.md index 25956b2..f94c72b 100644 --- a/docs/examples/tablesdb/create-longtext-column.md +++ b/docs/examples/tablesdb/create-longtext-column.md @@ -14,7 +14,8 @@ let columnLongtext = try await tablesDB.createLongtextColumn( key: "", required: false, default: "", // optional - array: false // optional + array: false, // optional + encrypt: false // optional ) ``` diff --git a/docs/examples/tablesdb/create-mediumtext-column.md b/docs/examples/tablesdb/create-mediumtext-column.md index a76dd11..c681ce0 100644 --- a/docs/examples/tablesdb/create-mediumtext-column.md +++ b/docs/examples/tablesdb/create-mediumtext-column.md @@ -14,7 +14,8 @@ let columnMediumtext = try await tablesDB.createMediumtextColumn( key: "", required: false, default: "", // optional - array: false // optional + array: false, // optional + encrypt: false // optional ) ``` diff --git a/docs/examples/tablesdb/create-text-column.md b/docs/examples/tablesdb/create-text-column.md index 3e2fa55..71c5b23 100644 --- a/docs/examples/tablesdb/create-text-column.md +++ b/docs/examples/tablesdb/create-text-column.md @@ -14,7 +14,8 @@ let columnText = try await tablesDB.createTextColumn( key: "", required: false, default: "", // optional - array: false // optional + array: false, // optional + encrypt: false // optional ) ``` diff --git a/docs/examples/tablesdb/create-varchar-column.md b/docs/examples/tablesdb/create-varchar-column.md index 06701f8..de97715 100644 --- a/docs/examples/tablesdb/create-varchar-column.md +++ b/docs/examples/tablesdb/create-varchar-column.md @@ -15,7 +15,8 @@ let columnVarchar = try await tablesDB.createVarcharColumn( size: 1, required: false, default: "", // optional - array: false // optional + array: false, // optional + encrypt: false // optional ) ``` From dfa335cf1a7829e9184a53c5c4b736aa9d31d228 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 19 Feb 2026 11:07:54 +0000 Subject: [PATCH 2/4] release --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33ec214..d335cd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 15.1.0 + +* Added new query filtering helpers: Query.contains(_:, value:), Query.containsAny(_:, value: [Any]), and Query.containsAll(_:, value: [Any]) for string and array attributes. +* Extended Databases and TablesDB attribute creation APIs with an optional encrypt: Bool flag to support encrypted attributes (Longtext, Mediumtext, Text, Varchar) across multiple attribute types. +* Updated README and package manifest references to reflect versioning and compatibility: server compatibility noted as Appwrite server version 1.8.x; package dependency snippet updated from 15.1.0 to 15.0.0. +* Updated Client header x-sdk-version to 15.0.0 to align with the release. +* Removed deprecated/auxiliary CI templates and an autoclose workflow (internal maintenance). + ## 13.3.0 * Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance From a456e851385fdb2cea40cb3ebaa38bc0d97dc392 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 19 Feb 2026 11:22:39 +0000 Subject: [PATCH 3/4] regen --- CHANGELOG.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d335cd1..e486d14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,24 @@ * Updated Client header x-sdk-version to 15.0.0 to align with the release. * Removed deprecated/auxiliary CI templates and an autoclose workflow (internal maintenance). +## 15.0.0 + +* Add array-based enum parameters (e.g., `permissions: [BrowserPermission]`). +* Breaking change: `Output` enum has been removed; use `ImageFormat` instead. +* Add `getQueueAudits` support to `Health` service. +* Add longtext/mediumtext/text/varchar attribute and column helpers to `Databases` and `TablesDB` services. + +## 14.1.0 + +* Added ability to create columns and indexes synchronously while creating a table + +## 14.0.0 + +* Rename `VCSDeploymentType` enum to `VCSReferenceType` +* Change `createTemplateDeployment` method signature: replace `version` parameter with `type` (TemplateReferenceType) and `reference` parameters +* Add `getScreenshot` method to `Avatars` service +* Add `Theme`, `Timezone` and `Output` enums + ## 13.3.0 * Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance From cb4b11d6376f7aac03254dc03a6420688bbb6656 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 19 Feb 2026 11:43:28 +0000 Subject: [PATCH 4/4] add missing entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e486d14..e47cd09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * Updated README and package manifest references to reflect versioning and compatibility: server compatibility noted as Appwrite server version 1.8.x; package dependency snippet updated from 15.1.0 to 15.0.0. * Updated Client header x-sdk-version to 15.0.0 to align with the release. * Removed deprecated/auxiliary CI templates and an autoclose workflow (internal maintenance). +* Add support for the new `Backups` service ## 15.0.0