mirror of
https://github.com/appwrite/sdk-for-swift.git
synced 2026-04-07 19:17:48 +00:00
Merge pull request #55 from appwrite/dev
feat: Swift SDK update for version 15.1.0
This commit is contained in:
+5
-3
@@ -2,9 +2,11 @@
|
||||
|
||||
## 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]`
|
||||
* 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).
|
||||
* Add support for the new `Backups` service
|
||||
|
||||
## 15.0.0
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
[](https://twitter.com/appwrite)
|
||||
[](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)
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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] = [
|
||||
|
||||
@@ -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] = [
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -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) }
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ let client = Client()
|
||||
.setProject("<YOUR_PROJECT_ID>") // Your project ID
|
||||
.setKey("<YOUR_API_KEY>") // 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: "<EVENT_ID>"
|
||||
)
|
||||
|
||||
```
|
||||
+3
-3
@@ -6,10 +6,10 @@ let client = Client()
|
||||
.setProject("<YOUR_PROJECT_ID>") // Your project ID
|
||||
.setKey("<YOUR_API_KEY>") // 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
|
||||
)
|
||||
|
||||
```
|
||||
@@ -14,7 +14,8 @@ let attributeLongtext = try await databases.createLongtextAttribute(
|
||||
key: "",
|
||||
required: false,
|
||||
default: "<DEFAULT>", // optional
|
||||
array: false // optional
|
||||
array: false, // optional
|
||||
encrypt: false // optional
|
||||
)
|
||||
|
||||
```
|
||||
|
||||
@@ -14,7 +14,8 @@ let attributeMediumtext = try await databases.createMediumtextAttribute(
|
||||
key: "",
|
||||
required: false,
|
||||
default: "<DEFAULT>", // optional
|
||||
array: false // optional
|
||||
array: false, // optional
|
||||
encrypt: false // optional
|
||||
)
|
||||
|
||||
```
|
||||
|
||||
@@ -14,7 +14,8 @@ let attributeText = try await databases.createTextAttribute(
|
||||
key: "",
|
||||
required: false,
|
||||
default: "<DEFAULT>", // optional
|
||||
array: false // optional
|
||||
array: false, // optional
|
||||
encrypt: false // optional
|
||||
)
|
||||
|
||||
```
|
||||
|
||||
@@ -15,7 +15,8 @@ let attributeVarchar = try await databases.createVarcharAttribute(
|
||||
size: 1,
|
||||
required: false,
|
||||
default: "<DEFAULT>", // optional
|
||||
array: false // optional
|
||||
array: false, // optional
|
||||
encrypt: false // optional
|
||||
)
|
||||
|
||||
```
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
```swift
|
||||
import Appwrite
|
||||
|
||||
let client = Client()
|
||||
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
|
||||
.setProject("<YOUR_PROJECT_ID>") // Your project ID
|
||||
.setKey("<YOUR_API_KEY>") // Your secret API key
|
||||
|
||||
let health = Health(client)
|
||||
|
||||
let healthQueue = try await health.getQueueBillingProjectAggregation(
|
||||
threshold: 0 // optional
|
||||
)
|
||||
|
||||
```
|
||||
@@ -1,15 +0,0 @@
|
||||
```swift
|
||||
import Appwrite
|
||||
|
||||
let client = Client()
|
||||
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
|
||||
.setProject("<YOUR_PROJECT_ID>") // Your project ID
|
||||
.setKey("<YOUR_API_KEY>") // Your secret API key
|
||||
|
||||
let health = Health(client)
|
||||
|
||||
let healthQueue = try await health.getQueueBillingTeamAggregation(
|
||||
threshold: 0 // optional
|
||||
)
|
||||
|
||||
```
|
||||
@@ -1,15 +0,0 @@
|
||||
```swift
|
||||
import Appwrite
|
||||
|
||||
let client = Client()
|
||||
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
|
||||
.setProject("<YOUR_PROJECT_ID>") // Your project ID
|
||||
.setKey("<YOUR_API_KEY>") // Your secret API key
|
||||
|
||||
let health = Health(client)
|
||||
|
||||
let healthQueue = try await health.getQueueRegionManager(
|
||||
threshold: 0 // optional
|
||||
)
|
||||
|
||||
```
|
||||
@@ -14,7 +14,8 @@ let columnLongtext = try await tablesDB.createLongtextColumn(
|
||||
key: "",
|
||||
required: false,
|
||||
default: "<DEFAULT>", // optional
|
||||
array: false // optional
|
||||
array: false, // optional
|
||||
encrypt: false // optional
|
||||
)
|
||||
|
||||
```
|
||||
|
||||
@@ -14,7 +14,8 @@ let columnMediumtext = try await tablesDB.createMediumtextColumn(
|
||||
key: "",
|
||||
required: false,
|
||||
default: "<DEFAULT>", // optional
|
||||
array: false // optional
|
||||
array: false, // optional
|
||||
encrypt: false // optional
|
||||
)
|
||||
|
||||
```
|
||||
|
||||
@@ -14,7 +14,8 @@ let columnText = try await tablesDB.createTextColumn(
|
||||
key: "",
|
||||
required: false,
|
||||
default: "<DEFAULT>", // optional
|
||||
array: false // optional
|
||||
array: false, // optional
|
||||
encrypt: false // optional
|
||||
)
|
||||
|
||||
```
|
||||
|
||||
@@ -15,7 +15,8 @@ let columnVarchar = try await tablesDB.createVarcharColumn(
|
||||
size: 1,
|
||||
required: false,
|
||||
default: "<DEFAULT>", // optional
|
||||
array: false // optional
|
||||
array: false, // optional
|
||||
encrypt: false // optional
|
||||
)
|
||||
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user