diff --git a/CHANGELOG.md b/CHANGELOG.md index 4be6435..e0fbda9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 15.0.0 + +* Add array-based enum parameters (e.g., `permissions: [BrowserPermission]`). + ## 14.1.0 * Added ability to create columns and indexes synchronously while creating a table diff --git a/LICENSE b/LICENSE index c1602fc..6f8702b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors. +Copyright (c) 2026 Appwrite (https://appwrite.io) and individual contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/README.md b/README.md index 5728511..50b7095 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![Swift Package Manager](https://img.shields.io/github/v/release/appwrite/sdk-for-swift.svg?color=green&style=flat-square) ![License](https://img.shields.io/github/license/appwrite/sdk-for-swift.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.8.0-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.8.1-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![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) @@ -11,7 +11,7 @@ > 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) -Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Swift SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) +Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Swift SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) ![Appwrite](https://github.com/appwrite/appwrite/raw/main/public/images/github.png) @@ -33,7 +33,7 @@ Add the package to your `Package.swift` dependencies: ```swift dependencies: [ - .package(url: "git@github.com:appwrite/sdk-for-swift.git", from: "14.1.0"), + .package(url: "git@github.com:appwrite/sdk-for-swift.git", from: "15.0.0"), ], ``` diff --git a/Sources/Appwrite/Client.swift b/Sources/Appwrite/Client.swift index 9c886e9..ae6afeb 100644 --- a/Sources/Appwrite/Client.swift +++ b/Sources/Appwrite/Client.swift @@ -22,7 +22,7 @@ open class Client { "x-sdk-name": "Swift", "x-sdk-platform": "server", "x-sdk-language": "swift", - "x-sdk-version": "14.1.0", + "x-sdk-version": "15.0.0", "x-appwrite-response-format": "1.8.0" ] @@ -380,7 +380,6 @@ open class Client { var request = HTTPClientRequest(url: endPoint + path + queryParameters) request.method = .RAW(value: method) - for (key, value) in self.headers.merging(headers, uniquingKeysWith: { $1 }) { request.headers.add(name: key, value: value) } diff --git a/Sources/Appwrite/Query.swift b/Sources/Appwrite/Query.swift index 7610dc3..40bdbd7 100644 --- a/Sources/Appwrite/Query.swift +++ b/Sources/Appwrite/Query.swift @@ -165,6 +165,20 @@ public struct Query : Codable, CustomStringConvertible { ).description } + /// Filter resources where attribute matches a regular expression pattern. + /// + /// - Parameters: + /// - attribute: The attribute to filter on. + /// - pattern: The regular expression pattern to match. + /// - Returns: The query string. + public static func regex(_ attribute: String, pattern: String) -> String { + return Query( + method: "regex", + attribute: attribute, + values: [pattern] + ).description + } + public static func lessThan(_ attribute: String, value: Any) -> String { return Query( method: "lessThan", @@ -211,6 +225,28 @@ public struct Query : Codable, CustomStringConvertible { ).description } + /// Filter resources where the specified attributes exist. + /// + /// - Parameter attributes: The list of attributes that must exist. + /// - Returns: The query string. + public static func exists(_ attributes: [String]) -> String { + return Query( + method: "exists", + values: attributes + ).description + } + + /// Filter resources where the specified attributes do not exist. + /// + /// - Parameter attributes: The list of attributes that must not exist. + /// - Returns: The query string. + public static func notExists(_ attributes: [String]) -> String { + return Query( + method: "notExists", + values: attributes + ).description + } + public static func between(_ attribute: String, start: Int, end: Int) -> String { return Query( method: "between", @@ -432,6 +468,28 @@ public struct Query : Codable, CustomStringConvertible { ).description } + /// Filter array elements where at least one element matches all the specified queries. + /// + /// - Parameters: + /// - attribute: The attribute containing the array to filter on. + /// - queries: The list of query strings to match against array elements. + /// - Returns: The query string. + public static func elemMatch(_ attribute: String, queries: [String]) -> String { + let decoder = JSONDecoder() + let decodedQueries = queries.compactMap { queryStr -> Query? in + guard let data = queryStr.data(using: .utf8) else { + return nil + } + return try? decoder.decode(Query.self, from: data) + } + + return Query( + method: "elemMatch", + attribute: attribute, + values: decodedQueries + ).description + } + public static func distanceEqual(_ attribute: String, values: [Any], distance: Double, meters: Bool = true) -> String { return Query( method: "distanceEqual", diff --git a/Sources/Appwrite/Services/Account.swift b/Sources/Appwrite/Services/Account.swift index f6de206..3c745db 100644 --- a/Sources/Appwrite/Services/Account.swift +++ b/Sources/Appwrite/Services/Account.swift @@ -272,14 +272,19 @@ open class Account: Service { /// from its creation and will be invalid if the user will logout in that time /// frame. /// + /// - Parameters: + /// - duration: Int (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.Jwt /// open func createJWT( + duration: Int? = nil ) async throws -> AppwriteModels.Jwt { let apiPath: String = "/account/jwts" - let apiParams: [String: Any] = [:] + let apiParams: [String: Any?] = [ + "duration": duration + ] let apiHeaders: [String: String] = [ "content-type": "application/json" diff --git a/Sources/Appwrite/Services/Avatars.swift b/Sources/Appwrite/Services/Avatars.swift index 0b0c381..9f42713 100644 --- a/Sources/Appwrite/Services/Avatars.swift +++ b/Sources/Appwrite/Services/Avatars.swift @@ -338,12 +338,12 @@ open class Avatars: Service { /// - longitude: Double (optional) /// - accuracy: Double (optional) /// - touch: Bool (optional) - /// - permissions: [String] (optional) + /// - permissions: [AppwriteEnums.BrowserPermission] (optional) /// - sleep: Int (optional) /// - width: Int (optional) /// - height: Int (optional) /// - quality: Int (optional) - /// - output: AppwriteEnums.Output (optional) + /// - output: AppwriteEnums.ImageFormat (optional) /// - Throws: Exception if the request fails /// - Returns: ByteBuffer /// @@ -362,12 +362,12 @@ open class Avatars: Service { longitude: Double? = nil, accuracy: Double? = nil, touch: Bool? = nil, - permissions: [String]? = nil, + permissions: [AppwriteEnums.BrowserPermission]? = nil, sleep: Int? = nil, width: Int? = nil, height: Int? = nil, quality: Int? = nil, - output: AppwriteEnums.Output? = nil + output: AppwriteEnums.ImageFormat? = nil ) async throws -> ByteBuffer { let apiPath: String = "/avatars/screenshots" diff --git a/Sources/Appwrite/Services/Databases.swift b/Sources/Appwrite/Services/Databases.swift index b425c2a..5dd6ce9 100644 --- a/Sources/Appwrite/Services/Databases.swift +++ b/Sources/Appwrite/Services/Databases.swift @@ -329,7 +329,7 @@ open class Databases: Service { /// /// - Parameters: /// - databaseId: String - /// - name: String + /// - name: String (optional) /// - enabled: Bool (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.Database @@ -337,7 +337,7 @@ open class Databases: Service { @available(*, deprecated, message: "This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead.") open func update( databaseId: String, - name: String, + name: String? = nil, enabled: Bool? = nil ) async throws -> AppwriteModels.Database { let apiPath: String = "/databases/{databaseId}" @@ -538,7 +538,7 @@ open class Databases: Service { /// - Parameters: /// - databaseId: String /// - collectionId: String - /// - name: String + /// - name: String (optional) /// - permissions: [String] (optional) /// - documentSecurity: Bool (optional) /// - enabled: Bool (optional) @@ -549,7 +549,7 @@ open class Databases: Service { open func updateCollection( databaseId: String, collectionId: String, - name: String, + name: String? = nil, permissions: [String]? = nil, documentSecurity: Bool? = nil, enabled: Bool? = nil @@ -1999,11 +1999,17 @@ open class Databases: Service { let apiHeaders: [String: String] = [:] + let converter: (Any) -> Any = { response in + return AppwriteModels.AttributeBoolean.from(map: response as! [String: Any]) + } + return try await client.call( method: "GET", path: apiPath, headers: apiHeaders, - params: apiParams ) + params: apiParams, + converter: converter + ) } /// @@ -2659,7 +2665,7 @@ open class Databases: Service { /// - databaseId: String /// - collectionId: String /// - documentId: String - /// - data: Any + /// - data: Any (optional) /// - permissions: [String] (optional) /// - transactionId: String (optional) /// - Throws: Exception if the request fails @@ -2670,7 +2676,7 @@ open class Databases: Service { databaseId: String, collectionId: String, documentId: String, - data: Any, + data: Any? = nil, permissions: [String]? = nil, transactionId: String? = nil, nestedType: T.Type @@ -2713,7 +2719,7 @@ open class Databases: Service { /// - databaseId: String /// - collectionId: String /// - documentId: String - /// - data: Any + /// - data: Any (optional) /// - permissions: [String] (optional) /// - transactionId: String (optional) /// - Throws: Exception if the request fails @@ -2724,7 +2730,7 @@ open class Databases: Service { databaseId: String, collectionId: String, documentId: String, - data: Any, + data: Any? = nil, permissions: [String]? = nil, transactionId: String? = nil ) async throws -> AppwriteModels.Document<[String: AnyCodable]> { @@ -3096,7 +3102,7 @@ open class Databases: Service { /// - key: String /// - type: AppwriteEnums.IndexType /// - attributes: [String] - /// - orders: [String] (optional) + /// - orders: [AppwriteEnums.OrderBy] (optional) /// - lengths: [Int] (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.Index @@ -3108,7 +3114,7 @@ open class Databases: Service { key: String, type: AppwriteEnums.IndexType, attributes: [String], - orders: [String]? = nil, + orders: [AppwriteEnums.OrderBy]? = nil, lengths: [Int]? = nil ) async throws -> AppwriteModels.Index { let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/indexes" diff --git a/Sources/Appwrite/Services/Functions.swift b/Sources/Appwrite/Services/Functions.swift index d8a6856..0223983 100644 --- a/Sources/Appwrite/Services/Functions.swift +++ b/Sources/Appwrite/Services/Functions.swift @@ -65,7 +65,7 @@ open class Functions: Service { /// - logging: Bool (optional) /// - entrypoint: String (optional) /// - commands: String (optional) - /// - scopes: [String] (optional) + /// - scopes: [AppwriteEnums.Scopes] (optional) /// - installationId: String (optional) /// - providerRepositoryId: String (optional) /// - providerBranch: String (optional) @@ -87,7 +87,7 @@ open class Functions: Service { logging: Bool? = nil, entrypoint: String? = nil, commands: String? = nil, - scopes: [String]? = nil, + scopes: [AppwriteEnums.Scopes]? = nil, installationId: String? = nil, providerRepositoryId: String? = nil, providerBranch: String? = nil, @@ -235,7 +235,7 @@ open class Functions: Service { /// - logging: Bool (optional) /// - entrypoint: String (optional) /// - commands: String (optional) - /// - scopes: [String] (optional) + /// - scopes: [AppwriteEnums.Scopes] (optional) /// - installationId: String (optional) /// - providerRepositoryId: String (optional) /// - providerBranch: String (optional) @@ -257,7 +257,7 @@ open class Functions: Service { logging: Bool? = nil, entrypoint: String? = nil, commands: String? = nil, - scopes: [String]? = nil, + scopes: [AppwriteEnums.Scopes]? = nil, installationId: String? = nil, providerRepositoryId: String? = nil, providerBranch: String? = nil, diff --git a/Sources/Appwrite/Services/Health.swift b/Sources/Appwrite/Services/Health.swift index e0bab3d..6f3023f 100644 --- a/Sources/Appwrite/Services/Health.swift +++ b/Sources/Appwrite/Services/Health.swift @@ -67,18 +67,18 @@ open class Health: Service { /// successful. /// /// - Throws: Exception if the request fails - /// - Returns: AppwriteModels.HealthStatus + /// - Returns: AppwriteModels.HealthStatusList /// open func getCache( - ) async throws -> AppwriteModels.HealthStatus { + ) async throws -> AppwriteModels.HealthStatusList { let apiPath: String = "/health/cache" let apiParams: [String: Any] = [:] let apiHeaders: [String: String] = [:] - let converter: (Any) -> AppwriteModels.HealthStatus = { response in - return AppwriteModels.HealthStatus.from(map: response as! [String: Any]) + let converter: (Any) -> AppwriteModels.HealthStatusList = { response in + return AppwriteModels.HealthStatusList.from(map: response as! [String: Any]) } return try await client.call( @@ -126,18 +126,18 @@ open class Health: Service { /// Check the Appwrite database servers are up and connection is successful. /// /// - Throws: Exception if the request fails - /// - Returns: AppwriteModels.HealthStatus + /// - Returns: AppwriteModels.HealthStatusList /// open func getDB( - ) async throws -> AppwriteModels.HealthStatus { + ) async throws -> AppwriteModels.HealthStatusList { let apiPath: String = "/health/db" let apiParams: [String: Any] = [:] let apiHeaders: [String: String] = [:] - let converter: (Any) -> AppwriteModels.HealthStatus = { response in - return AppwriteModels.HealthStatus.from(map: response as! [String: Any]) + let converter: (Any) -> AppwriteModels.HealthStatusList = { response in + return AppwriteModels.HealthStatusList.from(map: response as! [String: Any]) } return try await client.call( @@ -153,18 +153,51 @@ open class Health: Service { /// Check the Appwrite pub-sub servers are up and connection is successful. /// /// - Throws: Exception if the request fails - /// - Returns: AppwriteModels.HealthStatus + /// - Returns: AppwriteModels.HealthStatusList /// open func getPubSub( - ) async throws -> AppwriteModels.HealthStatus { + ) async throws -> AppwriteModels.HealthStatusList { let apiPath: String = "/health/pubsub" let apiParams: [String: Any] = [:] let apiHeaders: [String: String] = [:] - let converter: (Any) -> AppwriteModels.HealthStatus = { response in - return AppwriteModels.HealthStatus.from(map: response as! [String: Any]) + let converter: (Any) -> AppwriteModels.HealthStatusList = { response in + return AppwriteModels.HealthStatusList.from(map: response as! [String: Any]) + } + + return try await client.call( + method: "GET", + path: apiPath, + headers: apiHeaders, + params: apiParams, + converter: converter + ) + } + + /// + /// Get the number of audit logs that are waiting to be processed in the + /// Appwrite internal queue server. + /// + /// - Parameters: + /// - threshold: Int (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.HealthQueue + /// + open func getQueueAudits( + threshold: Int? = nil + ) async throws -> AppwriteModels.HealthQueue { + let apiPath: String = "/health/queue/audits" + + let apiParams: [String: Any?] = [ + "threshold": threshold + ] + + let apiHeaders: [String: String] = [:] + + let converter: (Any) -> AppwriteModels.HealthQueue = { response in + return AppwriteModels.HealthQueue.from(map: response as! [String: Any]) } return try await client.call( diff --git a/Sources/Appwrite/Services/TablesDB.swift b/Sources/Appwrite/Services/TablesDB.swift index 3c9ff74..d2f1a74 100644 --- a/Sources/Appwrite/Services/TablesDB.swift +++ b/Sources/Appwrite/Services/TablesDB.swift @@ -326,14 +326,14 @@ open class TablesDB: Service { /// /// - Parameters: /// - databaseId: String - /// - name: String + /// - name: String (optional) /// - enabled: Bool (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.Database /// open func update( databaseId: String, - name: String, + name: String? = nil, enabled: Bool? = nil ) async throws -> AppwriteModels.Database { let apiPath: String = "/tablesdb/{databaseId}" @@ -530,7 +530,7 @@ open class TablesDB: Service { /// - Parameters: /// - databaseId: String /// - tableId: String - /// - name: String + /// - name: String (optional) /// - permissions: [String] (optional) /// - rowSecurity: Bool (optional) /// - enabled: Bool (optional) @@ -540,7 +540,7 @@ open class TablesDB: Service { open func updateTable( databaseId: String, tableId: String, - name: String, + name: String? = nil, permissions: [String]? = nil, rowSecurity: Bool? = nil, enabled: Bool? = nil @@ -1961,11 +1961,17 @@ open class TablesDB: Service { let apiHeaders: [String: String] = [:] + let converter: (Any) -> Any = { response in + return AppwriteModels.ColumnBoolean.from(map: response as! [String: Any]) + } + return try await client.call( method: "GET", path: apiPath, headers: apiHeaders, - params: apiParams ) + params: apiParams, + converter: converter + ) } /// @@ -2101,7 +2107,7 @@ open class TablesDB: Service { /// - key: String /// - type: AppwriteEnums.IndexType /// - columns: [String] - /// - orders: [String] (optional) + /// - orders: [AppwriteEnums.OrderBy] (optional) /// - lengths: [Int] (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.ColumnIndex @@ -2112,7 +2118,7 @@ open class TablesDB: Service { key: String, type: AppwriteEnums.IndexType, columns: [String], - orders: [String]? = nil, + orders: [AppwriteEnums.OrderBy]? = nil, lengths: [Int]? = nil ) async throws -> AppwriteModels.ColumnIndex { let apiPath: String = "/tablesdb/{databaseId}/tables/{tableId}/indexes" diff --git a/Sources/Appwrite/Services/Teams.swift b/Sources/Appwrite/Services/Teams.swift index 54744d9..693c9e5 100644 --- a/Sources/Appwrite/Services/Teams.swift +++ b/Sources/Appwrite/Services/Teams.swift @@ -343,7 +343,7 @@ open class Teams: Service { /// /// - Parameters: /// - teamId: String - /// - roles: [String] + /// - roles: [AppwriteEnums.Roles] /// - email: String (optional) /// - userId: String (optional) /// - phone: String (optional) @@ -354,7 +354,7 @@ open class Teams: Service { /// open func createMembership( teamId: String, - roles: [String], + roles: [AppwriteEnums.Roles], email: String? = nil, userId: String? = nil, phone: String? = nil, @@ -435,14 +435,14 @@ open class Teams: Service { /// - Parameters: /// - teamId: String /// - membershipId: String - /// - roles: [String] + /// - roles: [AppwriteEnums.Roles] /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.Membership /// open func updateMembership( teamId: String, membershipId: String, - roles: [String] + roles: [AppwriteEnums.Roles] ) async throws -> AppwriteModels.Membership { let apiPath: String = "/teams/{teamId}/memberships/{membershipId}" .replacingOccurrences(of: "{teamId}", with: teamId) diff --git a/Sources/AppwriteEnums/BrowserPermission.swift b/Sources/AppwriteEnums/BrowserPermission.swift new file mode 100644 index 0000000..69143d7 --- /dev/null +++ b/Sources/AppwriteEnums/BrowserPermission.swift @@ -0,0 +1,28 @@ +import Foundation + +public enum BrowserPermission: String, CustomStringConvertible { + case geolocation = "geolocation" + case camera = "camera" + case microphone = "microphone" + case notifications = "notifications" + case midi = "midi" + case push = "push" + case clipboardRead = "clipboard-read" + case clipboardWrite = "clipboard-write" + case paymentHandler = "payment-handler" + case usb = "usb" + case bluetooth = "bluetooth" + case accelerometer = "accelerometer" + case gyroscope = "gyroscope" + case magnetometer = "magnetometer" + case ambientLightSensor = "ambient-light-sensor" + case backgroundSync = "background-sync" + case persistentStorage = "persistent-storage" + case screenWakeLock = "screen-wake-lock" + case webShare = "web-share" + case xrSpatialTracking = "xr-spatial-tracking" + + public var description: String { + return rawValue + } +} diff --git a/Sources/AppwriteEnums/DeploymentStatus.swift b/Sources/AppwriteEnums/DeploymentStatus.swift index 8d82e47..026aa6f 100644 --- a/Sources/AppwriteEnums/DeploymentStatus.swift +++ b/Sources/AppwriteEnums/DeploymentStatus.swift @@ -5,6 +5,7 @@ public enum DeploymentStatus: String, CustomStringConvertible { case processing = "processing" case building = "building" case ready = "ready" + case canceled = "canceled" case failed = "failed" public var description: String { diff --git a/Sources/AppwriteEnums/Name.swift b/Sources/AppwriteEnums/Name.swift index 2694464..9c76f24 100644 --- a/Sources/AppwriteEnums/Name.swift +++ b/Sources/AppwriteEnums/Name.swift @@ -11,6 +11,7 @@ public enum Name: String, CustomStringConvertible { case v1Webhooks = "v1-webhooks" case v1Certificates = "v1-certificates" case v1Builds = "v1-builds" + case v1Screenshots = "v1-screenshots" case v1Messaging = "v1-messaging" case v1Migrations = "v1-migrations" diff --git a/Sources/AppwriteEnums/OAuthProvider.swift b/Sources/AppwriteEnums/OAuthProvider.swift index 4c4ec6e..fb715a4 100644 --- a/Sources/AppwriteEnums/OAuthProvider.swift +++ b/Sources/AppwriteEnums/OAuthProvider.swift @@ -40,7 +40,6 @@ public enum OAuthProvider: String, CustomStringConvertible { case yandex = "yandex" case zoho = "zoho" case zoom = "zoom" - case mock = "mock" public var description: String { return rawValue diff --git a/Sources/AppwriteEnums/OrderBy.swift b/Sources/AppwriteEnums/OrderBy.swift new file mode 100644 index 0000000..870d291 --- /dev/null +++ b/Sources/AppwriteEnums/OrderBy.swift @@ -0,0 +1,10 @@ +import Foundation + +public enum OrderBy: String, CustomStringConvertible { + case asc = "asc" + case desc = "desc" + + public var description: String { + return rawValue + } +} diff --git a/Sources/AppwriteEnums/Output.swift b/Sources/AppwriteEnums/Output.swift deleted file mode 100644 index c8d245f..0000000 --- a/Sources/AppwriteEnums/Output.swift +++ /dev/null @@ -1,15 +0,0 @@ -import Foundation - -public enum Output: String, CustomStringConvertible { - case jpg = "jpg" - case jpeg = "jpeg" - case png = "png" - case webp = "webp" - case heic = "heic" - case avif = "avif" - case gif = "gif" - - public var description: String { - return rawValue - } -} diff --git a/Sources/AppwriteEnums/Roles.swift b/Sources/AppwriteEnums/Roles.swift new file mode 100644 index 0000000..48132fb --- /dev/null +++ b/Sources/AppwriteEnums/Roles.swift @@ -0,0 +1,11 @@ +import Foundation + +public enum Roles: String, CustomStringConvertible { + case admin = "admin" + case developer = "developer" + case owner = "owner" + + public var description: String { + return rawValue + } +} diff --git a/Sources/AppwriteEnums/Scopes.swift b/Sources/AppwriteEnums/Scopes.swift new file mode 100644 index 0000000..c92ee54 --- /dev/null +++ b/Sources/AppwriteEnums/Scopes.swift @@ -0,0 +1,63 @@ +import Foundation + +public enum Scopes: String, CustomStringConvertible { + case sessionsWrite = "sessions.write" + case usersRead = "users.read" + case usersWrite = "users.write" + case teamsRead = "teams.read" + case teamsWrite = "teams.write" + case databasesRead = "databases.read" + case databasesWrite = "databases.write" + case collectionsRead = "collections.read" + case collectionsWrite = "collections.write" + case tablesRead = "tables.read" + case tablesWrite = "tables.write" + case attributesRead = "attributes.read" + case attributesWrite = "attributes.write" + case columnsRead = "columns.read" + case columnsWrite = "columns.write" + case indexesRead = "indexes.read" + case indexesWrite = "indexes.write" + case documentsRead = "documents.read" + case documentsWrite = "documents.write" + case rowsRead = "rows.read" + case rowsWrite = "rows.write" + case filesRead = "files.read" + case filesWrite = "files.write" + case bucketsRead = "buckets.read" + case bucketsWrite = "buckets.write" + case functionsRead = "functions.read" + case functionsWrite = "functions.write" + case sitesRead = "sites.read" + case sitesWrite = "sites.write" + case logRead = "log.read" + case logWrite = "log.write" + case executionRead = "execution.read" + case executionWrite = "execution.write" + case localeRead = "locale.read" + case avatarsRead = "avatars.read" + case healthRead = "health.read" + case providersRead = "providers.read" + case providersWrite = "providers.write" + case messagesRead = "messages.read" + case messagesWrite = "messages.write" + case topicsRead = "topics.read" + case topicsWrite = "topics.write" + case subscribersRead = "subscribers.read" + case subscribersWrite = "subscribers.write" + case targetsRead = "targets.read" + case targetsWrite = "targets.write" + case rulesRead = "rules.read" + case rulesWrite = "rules.write" + case migrationsRead = "migrations.read" + case migrationsWrite = "migrations.write" + case vcsRead = "vcs.read" + case vcsWrite = "vcs.write" + case assistantRead = "assistant.read" + case tokensRead = "tokens.read" + case tokensWrite = "tokens.write" + + public var description: String { + return rawValue + } +} diff --git a/Sources/AppwriteModels/AlgoArgon2.swift b/Sources/AppwriteModels/AlgoArgon2.swift index fd88955..b43668e 100644 --- a/Sources/AppwriteModels/AlgoArgon2.swift +++ b/Sources/AppwriteModels/AlgoArgon2.swift @@ -13,17 +13,13 @@ open class AlgoArgon2: Codable { /// Algo type. public let type: String - /// Memory used to compute hash. public let memoryCost: Int - /// Amount of time consumed to compute hash public let timeCost: Int - /// Number of threads used to compute hash. public let threads: Int - init( type: String, memoryCost: Int, diff --git a/Sources/AppwriteModels/AlgoBcrypt.swift b/Sources/AppwriteModels/AlgoBcrypt.swift index b34095d..1da5027 100644 --- a/Sources/AppwriteModels/AlgoBcrypt.swift +++ b/Sources/AppwriteModels/AlgoBcrypt.swift @@ -11,7 +11,6 @@ open class AlgoBcrypt: Codable { /// Algo type. public let type: String - init( type: String ) { diff --git a/Sources/AppwriteModels/AlgoMd5.swift b/Sources/AppwriteModels/AlgoMd5.swift index 72fbb8d..210e26f 100644 --- a/Sources/AppwriteModels/AlgoMd5.swift +++ b/Sources/AppwriteModels/AlgoMd5.swift @@ -11,7 +11,6 @@ open class AlgoMd5: Codable { /// Algo type. public let type: String - init( type: String ) { diff --git a/Sources/AppwriteModels/AlgoPhpass.swift b/Sources/AppwriteModels/AlgoPhpass.swift index 7bd0c99..b044d8e 100644 --- a/Sources/AppwriteModels/AlgoPhpass.swift +++ b/Sources/AppwriteModels/AlgoPhpass.swift @@ -11,7 +11,6 @@ open class AlgoPhpass: Codable { /// Algo type. public let type: String - init( type: String ) { diff --git a/Sources/AppwriteModels/AlgoScrypt.swift b/Sources/AppwriteModels/AlgoScrypt.swift index 03ce541..45289c6 100644 --- a/Sources/AppwriteModels/AlgoScrypt.swift +++ b/Sources/AppwriteModels/AlgoScrypt.swift @@ -14,20 +14,15 @@ open class AlgoScrypt: Codable { /// Algo type. public let type: String - /// CPU complexity of computed hash. public let costCpu: Int - /// Memory complexity of computed hash. public let costMemory: Int - /// Parallelization of computed hash. public let costParallel: Int - /// Length used to compute hash. public let length: Int - init( type: String, costCpu: Int, diff --git a/Sources/AppwriteModels/AlgoScryptModified.swift b/Sources/AppwriteModels/AlgoScryptModified.swift index 0b2fa4e..5e64b11 100644 --- a/Sources/AppwriteModels/AlgoScryptModified.swift +++ b/Sources/AppwriteModels/AlgoScryptModified.swift @@ -13,17 +13,13 @@ open class AlgoScryptModified: Codable { /// Algo type. public let type: String - /// Salt used to compute hash. public let salt: String - /// Separator used to compute hash. public let saltSeparator: String - /// Key used to compute hash. public let signerKey: String - init( type: String, salt: String, diff --git a/Sources/AppwriteModels/AlgoSha.swift b/Sources/AppwriteModels/AlgoSha.swift index ffc0e05..399ab8b 100644 --- a/Sources/AppwriteModels/AlgoSha.swift +++ b/Sources/AppwriteModels/AlgoSha.swift @@ -11,7 +11,6 @@ open class AlgoSha: Codable { /// Algo type. public let type: String - init( type: String ) { diff --git a/Sources/AppwriteModels/AttributeBoolean.swift b/Sources/AppwriteModels/AttributeBoolean.swift index c728671..aa1a85b 100644 --- a/Sources/AppwriteModels/AttributeBoolean.swift +++ b/Sources/AppwriteModels/AttributeBoolean.swift @@ -19,32 +19,23 @@ open class AttributeBoolean: Codable { /// Attribute Key. public let key: String - /// Attribute type. public let type: String - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.AttributeStatus - /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String - /// Is attribute required? public let `required`: Bool - /// Is attribute an array? public let array: Bool? - /// Attribute creation date in ISO 8601 format. public let createdAt: String - /// Attribute update date in ISO 8601 format. public let updatedAt: String - /// Default value for attribute when not provided. Cannot be set when attribute is required. public let `default`: Bool? - init( key: String, type: String, diff --git a/Sources/AppwriteModels/AttributeDatetime.swift b/Sources/AppwriteModels/AttributeDatetime.swift index a21433b..8543576 100644 --- a/Sources/AppwriteModels/AttributeDatetime.swift +++ b/Sources/AppwriteModels/AttributeDatetime.swift @@ -20,35 +20,25 @@ open class AttributeDatetime: Codable { /// Attribute Key. public let key: String - /// Attribute type. public let type: String - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.AttributeStatus - /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String - /// Is attribute required? public let `required`: Bool - /// Is attribute an array? public let array: Bool? - /// Attribute creation date in ISO 8601 format. public let createdAt: String - /// Attribute update date in ISO 8601 format. public let updatedAt: String - /// ISO 8601 format. public let format: String - /// Default value for attribute when not provided. Only null is optional public let `default`: String? - init( key: String, type: String, diff --git a/Sources/AppwriteModels/AttributeEmail.swift b/Sources/AppwriteModels/AttributeEmail.swift index 1815b3f..204ee23 100644 --- a/Sources/AppwriteModels/AttributeEmail.swift +++ b/Sources/AppwriteModels/AttributeEmail.swift @@ -20,35 +20,25 @@ open class AttributeEmail: Codable { /// Attribute Key. public let key: String - /// Attribute type. public let type: String - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.AttributeStatus - /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String - /// Is attribute required? public let `required`: Bool - /// Is attribute an array? public let array: Bool? - /// Attribute creation date in ISO 8601 format. public let createdAt: String - /// Attribute update date in ISO 8601 format. public let updatedAt: String - /// String format. public let format: String - /// Default value for attribute when not provided. Cannot be set when attribute is required. public let `default`: String? - init( key: String, type: String, diff --git a/Sources/AppwriteModels/AttributeEnum.swift b/Sources/AppwriteModels/AttributeEnum.swift index 139308b..e21ccf3 100644 --- a/Sources/AppwriteModels/AttributeEnum.swift +++ b/Sources/AppwriteModels/AttributeEnum.swift @@ -21,38 +21,27 @@ open class AttributeEnum: Codable { /// Attribute Key. public let key: String - /// Attribute type. public let type: String - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.AttributeStatus - /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String - /// Is attribute required? public let `required`: Bool - /// Is attribute an array? public let array: Bool? - /// Attribute creation date in ISO 8601 format. public let createdAt: String - /// Attribute update date in ISO 8601 format. public let updatedAt: String - /// Array of elements in enumerated type. public let elements: [String] - /// String format. public let format: String - /// Default value for attribute when not provided. Cannot be set when attribute is required. public let `default`: String? - init( key: String, type: String, diff --git a/Sources/AppwriteModels/AttributeFloat.swift b/Sources/AppwriteModels/AttributeFloat.swift index 3a41dff..a40a76e 100644 --- a/Sources/AppwriteModels/AttributeFloat.swift +++ b/Sources/AppwriteModels/AttributeFloat.swift @@ -21,38 +21,27 @@ open class AttributeFloat: Codable { /// Attribute Key. public let key: String - /// Attribute type. public let type: String - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.AttributeStatus - /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String - /// Is attribute required? public let `required`: Bool - /// Is attribute an array? public let array: Bool? - /// Attribute creation date in ISO 8601 format. public let createdAt: String - /// Attribute update date in ISO 8601 format. public let updatedAt: String - /// Minimum value to enforce for new documents. public let min: Double? - /// Maximum value to enforce for new documents. public let max: Double? - /// Default value for attribute when not provided. Cannot be set when attribute is required. public let `default`: Double? - init( key: String, type: String, diff --git a/Sources/AppwriteModels/AttributeInteger.swift b/Sources/AppwriteModels/AttributeInteger.swift index 5d793e5..28dd00e 100644 --- a/Sources/AppwriteModels/AttributeInteger.swift +++ b/Sources/AppwriteModels/AttributeInteger.swift @@ -21,38 +21,27 @@ open class AttributeInteger: Codable { /// Attribute Key. public let key: String - /// Attribute type. public let type: String - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.AttributeStatus - /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String - /// Is attribute required? public let `required`: Bool - /// Is attribute an array? public let array: Bool? - /// Attribute creation date in ISO 8601 format. public let createdAt: String - /// Attribute update date in ISO 8601 format. public let updatedAt: String - /// Minimum value to enforce for new documents. public let min: Int? - /// Maximum value to enforce for new documents. public let max: Int? - /// Default value for attribute when not provided. Cannot be set when attribute is required. public let `default`: Int? - init( key: String, type: String, diff --git a/Sources/AppwriteModels/AttributeIp.swift b/Sources/AppwriteModels/AttributeIp.swift index 4d27dce..53e450c 100644 --- a/Sources/AppwriteModels/AttributeIp.swift +++ b/Sources/AppwriteModels/AttributeIp.swift @@ -20,35 +20,25 @@ open class AttributeIp: Codable { /// Attribute Key. public let key: String - /// Attribute type. public let type: String - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.AttributeStatus - /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String - /// Is attribute required? public let `required`: Bool - /// Is attribute an array? public let array: Bool? - /// Attribute creation date in ISO 8601 format. public let createdAt: String - /// Attribute update date in ISO 8601 format. public let updatedAt: String - /// String format. public let format: String - /// Default value for attribute when not provided. Cannot be set when attribute is required. public let `default`: String? - init( key: String, type: String, diff --git a/Sources/AppwriteModels/AttributeLine.swift b/Sources/AppwriteModels/AttributeLine.swift index 74302bb..965b9ba 100644 --- a/Sources/AppwriteModels/AttributeLine.swift +++ b/Sources/AppwriteModels/AttributeLine.swift @@ -19,32 +19,23 @@ open class AttributeLine: Codable { /// Attribute Key. public let key: String - /// Attribute type. public let type: String - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.AttributeStatus - /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String - /// Is attribute required? public let `required`: Bool - /// Is attribute an array? public let array: Bool? - /// Attribute creation date in ISO 8601 format. public let createdAt: String - /// Attribute update date in ISO 8601 format. public let updatedAt: String - /// Default value for attribute when not provided. Cannot be set when attribute is required. public let `default`: [AnyCodable]? - init( key: String, type: String, diff --git a/Sources/AppwriteModels/AttributeList.swift b/Sources/AppwriteModels/AttributeList.swift index 8789c6c..f21bfbd 100644 --- a/Sources/AppwriteModels/AttributeList.swift +++ b/Sources/AppwriteModels/AttributeList.swift @@ -11,11 +11,9 @@ open class AttributeList: Codable { /// Total number of attributes in the given collection. public let total: Int - /// List of attributes. public let attributes: [AnyCodable] - init( total: Int, attributes: [AnyCodable] diff --git a/Sources/AppwriteModels/AttributePoint.swift b/Sources/AppwriteModels/AttributePoint.swift index 93835e5..1c6d788 100644 --- a/Sources/AppwriteModels/AttributePoint.swift +++ b/Sources/AppwriteModels/AttributePoint.swift @@ -19,32 +19,23 @@ open class AttributePoint: Codable { /// Attribute Key. public let key: String - /// Attribute type. public let type: String - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.AttributeStatus - /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String - /// Is attribute required? public let `required`: Bool - /// Is attribute an array? public let array: Bool? - /// Attribute creation date in ISO 8601 format. public let createdAt: String - /// Attribute update date in ISO 8601 format. public let updatedAt: String - /// Default value for attribute when not provided. Cannot be set when attribute is required. public let `default`: [AnyCodable]? - init( key: String, type: String, diff --git a/Sources/AppwriteModels/AttributePolygon.swift b/Sources/AppwriteModels/AttributePolygon.swift index 7e4e8ba..7d2a6cb 100644 --- a/Sources/AppwriteModels/AttributePolygon.swift +++ b/Sources/AppwriteModels/AttributePolygon.swift @@ -19,32 +19,23 @@ open class AttributePolygon: Codable { /// Attribute Key. public let key: String - /// Attribute type. public let type: String - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.AttributeStatus - /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String - /// Is attribute required? public let `required`: Bool - /// Is attribute an array? public let array: Bool? - /// Attribute creation date in ISO 8601 format. public let createdAt: String - /// Attribute update date in ISO 8601 format. public let updatedAt: String - /// Default value for attribute when not provided. Cannot be set when attribute is required. public let `default`: [AnyCodable]? - init( key: String, type: String, diff --git a/Sources/AppwriteModels/AttributeRelationship.swift b/Sources/AppwriteModels/AttributeRelationship.swift index 7e74095..f899e0e 100644 --- a/Sources/AppwriteModels/AttributeRelationship.swift +++ b/Sources/AppwriteModels/AttributeRelationship.swift @@ -24,47 +24,33 @@ open class AttributeRelationship: Codable { /// Attribute Key. public let key: String - /// Attribute type. public let type: String - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.AttributeStatus - /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String - /// Is attribute required? public let `required`: Bool - /// Is attribute an array? public let array: Bool? - /// Attribute creation date in ISO 8601 format. public let createdAt: String - /// Attribute update date in ISO 8601 format. public let updatedAt: String - /// The ID of the related collection. public let relatedCollection: String - /// The type of the relationship. public let relationType: String - /// Is the relationship two-way? public let twoWay: Bool - /// The key of the two-way relationship. public let twoWayKey: String - /// How deleting the parent document will propagate to child documents. public let onDelete: String - /// Whether this is the parent or child side of the relationship public let side: String - init( key: String, type: String, diff --git a/Sources/AppwriteModels/AttributeString.swift b/Sources/AppwriteModels/AttributeString.swift index 1289873..c6e6d32 100644 --- a/Sources/AppwriteModels/AttributeString.swift +++ b/Sources/AppwriteModels/AttributeString.swift @@ -21,38 +21,27 @@ open class AttributeString: Codable { /// Attribute Key. public let key: String - /// Attribute type. public let type: String - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.AttributeStatus - /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String - /// Is attribute required? public let `required`: Bool - /// Is attribute an array? public let array: Bool? - /// Attribute creation date in ISO 8601 format. public let createdAt: String - /// Attribute update date in ISO 8601 format. public let updatedAt: String - /// Attribute size. 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, type: String, diff --git a/Sources/AppwriteModels/AttributeUrl.swift b/Sources/AppwriteModels/AttributeUrl.swift index 5996b4a..82e1ba2 100644 --- a/Sources/AppwriteModels/AttributeUrl.swift +++ b/Sources/AppwriteModels/AttributeUrl.swift @@ -20,35 +20,25 @@ open class AttributeUrl: Codable { /// Attribute Key. public let key: String - /// Attribute type. public let type: String - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.AttributeStatus - /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String - /// Is attribute required? public let `required`: Bool - /// Is attribute an array? public let array: Bool? - /// Attribute creation date in ISO 8601 format. public let createdAt: String - /// Attribute update date in ISO 8601 format. public let updatedAt: String - /// String format. public let format: String - /// Default value for attribute when not provided. Cannot be set when attribute is required. public let `default`: String? - init( key: String, type: String, diff --git a/Sources/AppwriteModels/Bucket.swift b/Sources/AppwriteModels/Bucket.swift index 326635b..8534648 100644 --- a/Sources/AppwriteModels/Bucket.swift +++ b/Sources/AppwriteModels/Bucket.swift @@ -18,47 +18,37 @@ open class Bucket: Codable { case encryption = "encryption" case antivirus = "antivirus" case transformations = "transformations" + case totalSize = "totalSize" } /// Bucket ID. public let id: String - /// Bucket creation time in ISO 8601 format. public let createdAt: String - /// Bucket update date in ISO 8601 format. public let updatedAt: String - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). public let permissions: [String] - /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). public let fileSecurity: Bool - /// Bucket name. public let name: String - /// Bucket enabled. public let enabled: Bool - /// Maximum file size supported. public let maximumFileSize: Int - /// Allowed file extensions. public let allowedFileExtensions: [String] - - /// Compression algorithm choosen for compression. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). + /// Compression algorithm chosen for compression. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). public let compression: String - /// Bucket is encrypted. public let encryption: Bool - /// Virus scanning is enabled. public let antivirus: Bool - /// Image transformations are enabled. public let transformations: Bool - + /// Total size of this bucket in bytes. + public let totalSize: Int init( id: String, @@ -73,7 +63,8 @@ open class Bucket: Codable { compression: String, encryption: Bool, antivirus: Bool, - transformations: Bool + transformations: Bool, + totalSize: Int ) { self.id = id self.createdAt = createdAt @@ -88,6 +79,7 @@ open class Bucket: Codable { self.encryption = encryption self.antivirus = antivirus self.transformations = transformations + self.totalSize = totalSize } public required init(from decoder: Decoder) throws { @@ -106,6 +98,7 @@ open class Bucket: Codable { self.encryption = try container.decode(Bool.self, forKey: .encryption) self.antivirus = try container.decode(Bool.self, forKey: .antivirus) self.transformations = try container.decode(Bool.self, forKey: .transformations) + self.totalSize = try container.decode(Int.self, forKey: .totalSize) } public func encode(to encoder: Encoder) throws { @@ -124,6 +117,7 @@ open class Bucket: Codable { try container.encode(encryption, forKey: .encryption) try container.encode(antivirus, forKey: .antivirus) try container.encode(transformations, forKey: .transformations) + try container.encode(totalSize, forKey: .totalSize) } public func toMap() -> [String: Any] { @@ -140,7 +134,8 @@ open class Bucket: Codable { "compression": compression as Any, "encryption": encryption as Any, "antivirus": antivirus as Any, - "transformations": transformations as Any + "transformations": transformations as Any, + "totalSize": totalSize as Any ] } @@ -158,7 +153,8 @@ open class Bucket: Codable { compression: map["compression"] as! String, encryption: map["encryption"] as! Bool, antivirus: map["antivirus"] as! Bool, - transformations: map["transformations"] as! Bool + transformations: map["transformations"] as! Bool, + totalSize: map["totalSize"] as! Int ) } } diff --git a/Sources/AppwriteModels/BucketList.swift b/Sources/AppwriteModels/BucketList.swift index b302f36..dcbb7fd 100644 --- a/Sources/AppwriteModels/BucketList.swift +++ b/Sources/AppwriteModels/BucketList.swift @@ -11,11 +11,9 @@ open class BucketList: Codable { /// Total number of buckets that matched your query. public let total: Int - /// List of buckets. public let buckets: [Bucket] - init( total: Int, buckets: [Bucket] diff --git a/Sources/AppwriteModels/Collection.swift b/Sources/AppwriteModels/Collection.swift index ad7ab94..bce5de7 100644 --- a/Sources/AppwriteModels/Collection.swift +++ b/Sources/AppwriteModels/Collection.swift @@ -19,35 +19,25 @@ open class Collection: Codable { /// Collection ID. public let id: String - /// Collection creation date in ISO 8601 format. public let createdAt: String - /// Collection update date in ISO 8601 format. public let updatedAt: String - /// Collection permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). public let permissions: [String] - /// Database ID. public let databaseId: String - /// Collection name. public let name: String - /// Collection enabled. Can be 'enabled' or 'disabled'. When disabled, the collection is inaccessible to users, but remains accessible to Server SDKs using API keys. public let enabled: Bool - /// Whether document-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). public let documentSecurity: Bool - /// Collection attributes. public let attributes: [AnyCodable] - /// Collection indexes. public let indexes: [Index] - init( id: String, createdAt: String, diff --git a/Sources/AppwriteModels/CollectionList.swift b/Sources/AppwriteModels/CollectionList.swift index b078619..810b79b 100644 --- a/Sources/AppwriteModels/CollectionList.swift +++ b/Sources/AppwriteModels/CollectionList.swift @@ -11,11 +11,9 @@ open class CollectionList: Codable { /// Total number of collections that matched your query. public let total: Int - /// List of collections. public let collections: [Collection] - init( total: Int, collections: [Collection] diff --git a/Sources/AppwriteModels/ColumnBoolean.swift b/Sources/AppwriteModels/ColumnBoolean.swift index 37a0601..f714117 100644 --- a/Sources/AppwriteModels/ColumnBoolean.swift +++ b/Sources/AppwriteModels/ColumnBoolean.swift @@ -19,32 +19,23 @@ open class ColumnBoolean: Codable { /// Column Key. public let key: String - /// Column type. public let type: String - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.ColumnStatus - /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String - /// Is column required? public let `required`: Bool - /// Is column an array? public let array: Bool? - /// Column creation date in ISO 8601 format. public let createdAt: String - /// Column update date in ISO 8601 format. public let updatedAt: String - /// Default value for column when not provided. Cannot be set when column is required. public let `default`: Bool? - init( key: String, type: String, diff --git a/Sources/AppwriteModels/ColumnDatetime.swift b/Sources/AppwriteModels/ColumnDatetime.swift index 8ef9867..43286d0 100644 --- a/Sources/AppwriteModels/ColumnDatetime.swift +++ b/Sources/AppwriteModels/ColumnDatetime.swift @@ -20,35 +20,25 @@ open class ColumnDatetime: Codable { /// Column Key. public let key: String - /// Column type. public let type: String - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.ColumnStatus - /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String - /// Is column required? public let `required`: Bool - /// Is column an array? public let array: Bool? - /// Column creation date in ISO 8601 format. public let createdAt: String - /// Column update date in ISO 8601 format. public let updatedAt: String - /// ISO 8601 format. public let format: String - /// Default value for column when not provided. Only null is optional public let `default`: String? - init( key: String, type: String, diff --git a/Sources/AppwriteModels/ColumnEmail.swift b/Sources/AppwriteModels/ColumnEmail.swift index c6e52a4..1fe0c92 100644 --- a/Sources/AppwriteModels/ColumnEmail.swift +++ b/Sources/AppwriteModels/ColumnEmail.swift @@ -20,35 +20,25 @@ open class ColumnEmail: Codable { /// Column Key. public let key: String - /// Column type. public let type: String - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.ColumnStatus - /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String - /// Is column required? public let `required`: Bool - /// Is column an array? public let array: Bool? - /// Column creation date in ISO 8601 format. public let createdAt: String - /// Column update date in ISO 8601 format. public let updatedAt: String - /// String format. public let format: String - /// Default value for column when not provided. Cannot be set when column is required. public let `default`: String? - init( key: String, type: String, diff --git a/Sources/AppwriteModels/ColumnEnum.swift b/Sources/AppwriteModels/ColumnEnum.swift index 570dc87..7311ece 100644 --- a/Sources/AppwriteModels/ColumnEnum.swift +++ b/Sources/AppwriteModels/ColumnEnum.swift @@ -21,38 +21,27 @@ open class ColumnEnum: Codable { /// Column Key. public let key: String - /// Column type. public let type: String - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.ColumnStatus - /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String - /// Is column required? public let `required`: Bool - /// Is column an array? public let array: Bool? - /// Column creation date in ISO 8601 format. public let createdAt: String - /// Column update date in ISO 8601 format. public let updatedAt: String - /// Array of elements in enumerated type. public let elements: [String] - /// String format. public let format: String - /// Default value for column when not provided. Cannot be set when column is required. public let `default`: String? - init( key: String, type: String, diff --git a/Sources/AppwriteModels/ColumnFloat.swift b/Sources/AppwriteModels/ColumnFloat.swift index 23ed59e..063d3bb 100644 --- a/Sources/AppwriteModels/ColumnFloat.swift +++ b/Sources/AppwriteModels/ColumnFloat.swift @@ -21,38 +21,27 @@ open class ColumnFloat: Codable { /// Column Key. public let key: String - /// Column type. public let type: String - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.ColumnStatus - /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String - /// Is column required? public let `required`: Bool - /// Is column an array? public let array: Bool? - /// Column creation date in ISO 8601 format. public let createdAt: String - /// Column update date in ISO 8601 format. public let updatedAt: String - /// Minimum value to enforce for new documents. public let min: Double? - /// Maximum value to enforce for new documents. public let max: Double? - /// Default value for column when not provided. Cannot be set when column is required. public let `default`: Double? - init( key: String, type: String, diff --git a/Sources/AppwriteModels/ColumnIndex.swift b/Sources/AppwriteModels/ColumnIndex.swift index c75fdb0..744183b 100644 --- a/Sources/AppwriteModels/ColumnIndex.swift +++ b/Sources/AppwriteModels/ColumnIndex.swift @@ -19,35 +19,25 @@ open class ColumnIndex: Codable { /// Index ID. public let id: String - /// Index creation date in ISO 8601 format. public let createdAt: String - /// Index update date in ISO 8601 format. public let updatedAt: String - /// Index Key. public let key: String - /// Index type. public let type: String - /// Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: String - /// Error message. Displays error generated on failure of creating or deleting an index. public let error: String - /// Index columns. public let columns: [String] - /// Index columns length. public let lengths: [Int] - /// Index orders. public let orders: [String]? - init( id: String, createdAt: String, diff --git a/Sources/AppwriteModels/ColumnIndexList.swift b/Sources/AppwriteModels/ColumnIndexList.swift index 476809c..d0edff0 100644 --- a/Sources/AppwriteModels/ColumnIndexList.swift +++ b/Sources/AppwriteModels/ColumnIndexList.swift @@ -11,11 +11,9 @@ open class ColumnIndexList: Codable { /// Total number of indexes that matched your query. public let total: Int - /// List of indexes. public let indexes: [ColumnIndex] - init( total: Int, indexes: [ColumnIndex] diff --git a/Sources/AppwriteModels/ColumnInteger.swift b/Sources/AppwriteModels/ColumnInteger.swift index 8a43e93..4a003b4 100644 --- a/Sources/AppwriteModels/ColumnInteger.swift +++ b/Sources/AppwriteModels/ColumnInteger.swift @@ -21,38 +21,27 @@ open class ColumnInteger: Codable { /// Column Key. public let key: String - /// Column type. public let type: String - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.ColumnStatus - /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String - /// Is column required? public let `required`: Bool - /// Is column an array? public let array: Bool? - /// Column creation date in ISO 8601 format. public let createdAt: String - /// Column update date in ISO 8601 format. public let updatedAt: String - /// Minimum value to enforce for new documents. public let min: Int? - /// Maximum value to enforce for new documents. public let max: Int? - /// Default value for column when not provided. Cannot be set when column is required. public let `default`: Int? - init( key: String, type: String, diff --git a/Sources/AppwriteModels/ColumnIp.swift b/Sources/AppwriteModels/ColumnIp.swift index a9dee8c..cd95a6a 100644 --- a/Sources/AppwriteModels/ColumnIp.swift +++ b/Sources/AppwriteModels/ColumnIp.swift @@ -20,35 +20,25 @@ open class ColumnIp: Codable { /// Column Key. public let key: String - /// Column type. public let type: String - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.ColumnStatus - /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String - /// Is column required? public let `required`: Bool - /// Is column an array? public let array: Bool? - /// Column creation date in ISO 8601 format. public let createdAt: String - /// Column update date in ISO 8601 format. public let updatedAt: String - /// String format. public let format: String - /// Default value for column when not provided. Cannot be set when column is required. public let `default`: String? - init( key: String, type: String, diff --git a/Sources/AppwriteModels/ColumnLine.swift b/Sources/AppwriteModels/ColumnLine.swift index f375b35..aacedcb 100644 --- a/Sources/AppwriteModels/ColumnLine.swift +++ b/Sources/AppwriteModels/ColumnLine.swift @@ -19,32 +19,23 @@ open class ColumnLine: Codable { /// Column Key. public let key: String - /// Column type. public let type: String - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.ColumnStatus - /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String - /// Is column required? public let `required`: Bool - /// Is column an array? public let array: Bool? - /// Column creation date in ISO 8601 format. public let createdAt: String - /// Column update date in ISO 8601 format. public let updatedAt: String - /// Default value for column when not provided. Cannot be set when column is required. public let `default`: [AnyCodable]? - init( key: String, type: String, diff --git a/Sources/AppwriteModels/ColumnList.swift b/Sources/AppwriteModels/ColumnList.swift index dead6f0..7a4c1d0 100644 --- a/Sources/AppwriteModels/ColumnList.swift +++ b/Sources/AppwriteModels/ColumnList.swift @@ -11,11 +11,9 @@ open class ColumnList: Codable { /// Total number of columns in the given table. public let total: Int - /// List of columns. public let columns: [AnyCodable] - init( total: Int, columns: [AnyCodable] diff --git a/Sources/AppwriteModels/ColumnPoint.swift b/Sources/AppwriteModels/ColumnPoint.swift index c3c13c4..9db7315 100644 --- a/Sources/AppwriteModels/ColumnPoint.swift +++ b/Sources/AppwriteModels/ColumnPoint.swift @@ -19,32 +19,23 @@ open class ColumnPoint: Codable { /// Column Key. public let key: String - /// Column type. public let type: String - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.ColumnStatus - /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String - /// Is column required? public let `required`: Bool - /// Is column an array? public let array: Bool? - /// Column creation date in ISO 8601 format. public let createdAt: String - /// Column update date in ISO 8601 format. public let updatedAt: String - /// Default value for column when not provided. Cannot be set when column is required. public let `default`: [AnyCodable]? - init( key: String, type: String, diff --git a/Sources/AppwriteModels/ColumnPolygon.swift b/Sources/AppwriteModels/ColumnPolygon.swift index d786d29..6eca76a 100644 --- a/Sources/AppwriteModels/ColumnPolygon.swift +++ b/Sources/AppwriteModels/ColumnPolygon.swift @@ -19,32 +19,23 @@ open class ColumnPolygon: Codable { /// Column Key. public let key: String - /// Column type. public let type: String - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.ColumnStatus - /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String - /// Is column required? public let `required`: Bool - /// Is column an array? public let array: Bool? - /// Column creation date in ISO 8601 format. public let createdAt: String - /// Column update date in ISO 8601 format. public let updatedAt: String - /// Default value for column when not provided. Cannot be set when column is required. public let `default`: [AnyCodable]? - init( key: String, type: String, diff --git a/Sources/AppwriteModels/ColumnRelationship.swift b/Sources/AppwriteModels/ColumnRelationship.swift index 76076e0..84e6e3e 100644 --- a/Sources/AppwriteModels/ColumnRelationship.swift +++ b/Sources/AppwriteModels/ColumnRelationship.swift @@ -24,47 +24,33 @@ open class ColumnRelationship: Codable { /// Column Key. public let key: String - /// Column type. public let type: String - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.ColumnStatus - /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String - /// Is column required? public let `required`: Bool - /// Is column an array? public let array: Bool? - /// Column creation date in ISO 8601 format. public let createdAt: String - /// Column update date in ISO 8601 format. public let updatedAt: String - /// The ID of the related table. public let relatedTable: String - /// The type of the relationship. public let relationType: String - /// Is the relationship two-way? public let twoWay: Bool - /// The key of the two-way relationship. public let twoWayKey: String - /// How deleting the parent document will propagate to child documents. public let onDelete: String - /// Whether this is the parent or child side of the relationship public let side: String - init( key: String, type: String, diff --git a/Sources/AppwriteModels/ColumnString.swift b/Sources/AppwriteModels/ColumnString.swift index 8cae67e..e879ac2 100644 --- a/Sources/AppwriteModels/ColumnString.swift +++ b/Sources/AppwriteModels/ColumnString.swift @@ -21,38 +21,27 @@ open class ColumnString: Codable { /// Column Key. public let key: String - /// Column type. public let type: String - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.ColumnStatus - /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String - /// Is column required? public let `required`: Bool - /// Is column an array? public let array: Bool? - /// Column creation date in ISO 8601 format. public let createdAt: String - /// Column update date in ISO 8601 format. public let updatedAt: String - /// Column size. 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, type: String, diff --git a/Sources/AppwriteModels/ColumnUrl.swift b/Sources/AppwriteModels/ColumnUrl.swift index ee54f27..8a95f70 100644 --- a/Sources/AppwriteModels/ColumnUrl.swift +++ b/Sources/AppwriteModels/ColumnUrl.swift @@ -20,35 +20,25 @@ open class ColumnUrl: Codable { /// Column Key. public let key: String - /// Column type. public let type: String - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.ColumnStatus - /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String - /// Is column required? public let `required`: Bool - /// Is column an array? public let array: Bool? - /// Column creation date in ISO 8601 format. public let createdAt: String - /// Column update date in ISO 8601 format. public let updatedAt: String - /// String format. public let format: String - /// Default value for column when not provided. Cannot be set when column is required. public let `default`: String? - init( key: String, type: String, diff --git a/Sources/AppwriteModels/Continent.swift b/Sources/AppwriteModels/Continent.swift index b8994d9..a310304 100644 --- a/Sources/AppwriteModels/Continent.swift +++ b/Sources/AppwriteModels/Continent.swift @@ -11,11 +11,9 @@ open class Continent: Codable { /// Continent name. public let name: String - /// Continent two letter code. public let code: String - init( name: String, code: String diff --git a/Sources/AppwriteModels/ContinentList.swift b/Sources/AppwriteModels/ContinentList.swift index 0e697e7..2279b9b 100644 --- a/Sources/AppwriteModels/ContinentList.swift +++ b/Sources/AppwriteModels/ContinentList.swift @@ -11,11 +11,9 @@ open class ContinentList: Codable { /// Total number of continents that matched your query. public let total: Int - /// List of continents. public let continents: [Continent] - init( total: Int, continents: [Continent] diff --git a/Sources/AppwriteModels/Country.swift b/Sources/AppwriteModels/Country.swift index c24f7e9..f5a7a10 100644 --- a/Sources/AppwriteModels/Country.swift +++ b/Sources/AppwriteModels/Country.swift @@ -11,11 +11,9 @@ open class Country: Codable { /// Country name. public let name: String - /// Country two-character ISO 3166-1 alpha code. public let code: String - init( name: String, code: String diff --git a/Sources/AppwriteModels/CountryList.swift b/Sources/AppwriteModels/CountryList.swift index 15a8d89..4d83832 100644 --- a/Sources/AppwriteModels/CountryList.swift +++ b/Sources/AppwriteModels/CountryList.swift @@ -11,11 +11,9 @@ open class CountryList: Codable { /// Total number of countries that matched your query. public let total: Int - /// List of countries. public let countries: [Country] - init( total: Int, countries: [Country] diff --git a/Sources/AppwriteModels/Currency.swift b/Sources/AppwriteModels/Currency.swift index 320337b..6e546f1 100644 --- a/Sources/AppwriteModels/Currency.swift +++ b/Sources/AppwriteModels/Currency.swift @@ -16,26 +16,19 @@ open class Currency: Codable { /// Currency symbol. public let symbol: String - /// Currency name. public let name: String - /// Currency native symbol. public let symbolNative: String - /// Number of decimal digits. public let decimalDigits: Int - /// Currency digit rounding. public let rounding: Double - /// Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format. public let code: String - /// Currency plural name public let namePlural: String - init( symbol: String, name: String, diff --git a/Sources/AppwriteModels/CurrencyList.swift b/Sources/AppwriteModels/CurrencyList.swift index 81d1c26..3d8cdcd 100644 --- a/Sources/AppwriteModels/CurrencyList.swift +++ b/Sources/AppwriteModels/CurrencyList.swift @@ -11,11 +11,9 @@ open class CurrencyList: Codable { /// Total number of currencies that matched your query. public let total: Int - /// List of currencies. public let currencies: [Currency] - init( total: Int, currencies: [Currency] diff --git a/Sources/AppwriteModels/Database.swift b/Sources/AppwriteModels/Database.swift index d23aa8f..d325d0c 100644 --- a/Sources/AppwriteModels/Database.swift +++ b/Sources/AppwriteModels/Database.swift @@ -16,23 +16,17 @@ open class Database: Codable { /// Database ID. public let id: String - /// Database name. public let name: String - /// Database creation date in ISO 8601 format. public let createdAt: String - /// Database update date in ISO 8601 format. public let updatedAt: String - /// If database is enabled. Can be 'enabled' or 'disabled'. When disabled, the database is inaccessible to users, but remains accessible to Server SDKs using API keys. public let enabled: Bool - /// Database type. public let type: AppwriteEnums.DatabaseType - init( id: String, name: String, diff --git a/Sources/AppwriteModels/DatabaseList.swift b/Sources/AppwriteModels/DatabaseList.swift index 57d9221..7d0e9e1 100644 --- a/Sources/AppwriteModels/DatabaseList.swift +++ b/Sources/AppwriteModels/DatabaseList.swift @@ -11,11 +11,9 @@ open class DatabaseList: Codable { /// Total number of databases that matched your query. public let total: Int - /// List of databases. public let databases: [Database] - init( total: Int, databases: [Database] diff --git a/Sources/AppwriteModels/Deployment.swift b/Sources/AppwriteModels/Deployment.swift index c6e22da..f317f35 100644 --- a/Sources/AppwriteModels/Deployment.swift +++ b/Sources/AppwriteModels/Deployment.swift @@ -37,86 +37,59 @@ open class Deployment: Codable { /// Deployment ID. public let id: String - /// Deployment creation date in ISO 8601 format. public let createdAt: String - /// Deployment update date in ISO 8601 format. public let updatedAt: String - /// Type of deployment. public let type: String - /// Resource ID. public let resourceId: String - /// Resource type. public let resourceType: String - /// The entrypoint file to use to execute the deployment code. public let entrypoint: String - /// The code size in bytes. public let sourceSize: Int - /// The build output size in bytes. public let buildSize: Int - /// The total size in bytes (source and build output). public let totalSize: Int - /// The current build ID. public let buildId: String - /// Whether the deployment should be automatically activated. public let activate: Bool - /// Screenshot with light theme preference file ID. public let screenshotLight: String - /// Screenshot with dark theme preference file ID. public let screenshotDark: String - - /// The deployment status. Possible values are "waiting", "processing", "building", "ready", and "failed". + /// The deployment status. Possible values are "waiting", "processing", "building", "ready", "canceled" and "failed". public let status: AppwriteEnums.DeploymentStatus - /// The build logs. public let buildLogs: String - /// The current build time in seconds. public let buildDuration: Int - /// The name of the vcs provider repository public let providerRepositoryName: String - /// The name of the vcs provider repository owner public let providerRepositoryOwner: String - /// The url of the vcs provider repository public let providerRepositoryUrl: String - /// The commit hash of the vcs commit public let providerCommitHash: String - /// The url of vcs commit author public let providerCommitAuthorUrl: String - /// The name of vcs commit author public let providerCommitAuthor: String - /// The commit message public let providerCommitMessage: String - /// The url of the vcs commit public let providerCommitUrl: String - /// The branch of the vcs repository public let providerBranch: String - /// The branch of the vcs repository public let providerBranchUrl: String - init( id: String, createdAt: String, diff --git a/Sources/AppwriteModels/DeploymentList.swift b/Sources/AppwriteModels/DeploymentList.swift index 12b984b..8345c98 100644 --- a/Sources/AppwriteModels/DeploymentList.swift +++ b/Sources/AppwriteModels/DeploymentList.swift @@ -11,11 +11,9 @@ open class DeploymentList: Codable { /// Total number of deployments that matched your query. public let total: Int - /// List of deployments. public let deployments: [Deployment] - init( total: Int, deployments: [Deployment] diff --git a/Sources/AppwriteModels/Document.swift b/Sources/AppwriteModels/Document.swift index 763db10..1a031a6 100644 --- a/Sources/AppwriteModels/Document.swift +++ b/Sources/AppwriteModels/Document.swift @@ -17,25 +17,18 @@ open class Document: Codable { /// Document ID. public let id: String - /// Document automatically incrementing ID. public let sequence: Int - /// Collection ID. public let collectionId: String - /// Database ID. public let databaseId: String - /// Document creation date in ISO 8601 format. public let createdAt: String - /// Document update date in ISO 8601 format. public let updatedAt: String - /// Document permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). public let permissions: [String] - /// Additional properties public let data: T diff --git a/Sources/AppwriteModels/DocumentList.swift b/Sources/AppwriteModels/DocumentList.swift index 77f2679..4f55579 100644 --- a/Sources/AppwriteModels/DocumentList.swift +++ b/Sources/AppwriteModels/DocumentList.swift @@ -11,11 +11,9 @@ open class DocumentList: Codable { /// Total number of documents that matched your query. public let total: Int - /// List of documents. public let documents: [Document] - init( total: Int, documents: [Document] diff --git a/Sources/AppwriteModels/Execution.swift b/Sources/AppwriteModels/Execution.swift index 625fd39..c4ee4ea 100644 --- a/Sources/AppwriteModels/Execution.swift +++ b/Sources/AppwriteModels/Execution.swift @@ -28,59 +28,41 @@ open class Execution: Codable { /// Execution ID. public let id: String - /// Execution creation date in ISO 8601 format. public let createdAt: String - /// Execution update date in ISO 8601 format. public let updatedAt: String - /// Execution roles. public let permissions: [String] - /// Function ID. public let functionId: String - /// Function's deployment ID used to create the execution. public let deploymentId: String - /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. public let trigger: AppwriteEnums.ExecutionTrigger - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, `failed`, or `scheduled`. public let status: AppwriteEnums.ExecutionStatus - /// HTTP request method type. public let requestMethod: String - /// HTTP request path and query. public let requestPath: String - /// HTTP request headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. public let requestHeaders: [Headers] - /// HTTP response status code. public let responseStatusCode: Int - /// HTTP response body. This will return empty unless execution is created as synchronous. public let responseBody: String - /// HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. public let responseHeaders: [Headers] - /// Function logs. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. public let logs: String - /// Function errors. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. public let errors: String - /// Resource(function/site) execution duration in seconds. public let duration: Double - /// The scheduled time for execution. If left empty, execution will be queued immediately. public let scheduledAt: String? - init( id: String, createdAt: String, diff --git a/Sources/AppwriteModels/ExecutionList.swift b/Sources/AppwriteModels/ExecutionList.swift index c903b34..4e09927 100644 --- a/Sources/AppwriteModels/ExecutionList.swift +++ b/Sources/AppwriteModels/ExecutionList.swift @@ -11,11 +11,9 @@ open class ExecutionList: Codable { /// Total number of executions that matched your query. public let total: Int - /// List of executions. public let executions: [Execution] - init( total: Int, executions: [Execution] diff --git a/Sources/AppwriteModels/File.swift b/Sources/AppwriteModels/File.swift index 713c7ca..5a19f88 100644 --- a/Sources/AppwriteModels/File.swift +++ b/Sources/AppwriteModels/File.swift @@ -16,41 +16,36 @@ open class File: Codable { case sizeOriginal = "sizeOriginal" case chunksTotal = "chunksTotal" case chunksUploaded = "chunksUploaded" + case encryption = "encryption" + case compression = "compression" } /// File ID. public let id: String - /// Bucket ID. public let bucketId: String - /// File creation date in ISO 8601 format. public let createdAt: String - /// File update date in ISO 8601 format. public let updatedAt: String - /// File permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). public let permissions: [String] - /// File name. public let name: String - /// File MD5 signature. public let signature: String - /// File mime type. public let mimeType: String - /// File original size in bytes. public let sizeOriginal: Int - /// Total number of chunks available public let chunksTotal: Int - /// Total number of chunks uploaded public let chunksUploaded: Int - + /// Whether file contents are encrypted at rest. + public let encryption: Bool + /// Compression algorithm used for the file. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). + public let compression: String init( id: String, @@ -63,7 +58,9 @@ open class File: Codable { mimeType: String, sizeOriginal: Int, chunksTotal: Int, - chunksUploaded: Int + chunksUploaded: Int, + encryption: Bool, + compression: String ) { self.id = id self.bucketId = bucketId @@ -76,6 +73,8 @@ open class File: Codable { self.sizeOriginal = sizeOriginal self.chunksTotal = chunksTotal self.chunksUploaded = chunksUploaded + self.encryption = encryption + self.compression = compression } public required init(from decoder: Decoder) throws { @@ -92,6 +91,8 @@ open class File: Codable { self.sizeOriginal = try container.decode(Int.self, forKey: .sizeOriginal) self.chunksTotal = try container.decode(Int.self, forKey: .chunksTotal) self.chunksUploaded = try container.decode(Int.self, forKey: .chunksUploaded) + self.encryption = try container.decode(Bool.self, forKey: .encryption) + self.compression = try container.decode(String.self, forKey: .compression) } public func encode(to encoder: Encoder) throws { @@ -108,6 +109,8 @@ open class File: Codable { try container.encode(sizeOriginal, forKey: .sizeOriginal) try container.encode(chunksTotal, forKey: .chunksTotal) try container.encode(chunksUploaded, forKey: .chunksUploaded) + try container.encode(encryption, forKey: .encryption) + try container.encode(compression, forKey: .compression) } public func toMap() -> [String: Any] { @@ -122,7 +125,9 @@ open class File: Codable { "mimeType": mimeType as Any, "sizeOriginal": sizeOriginal as Any, "chunksTotal": chunksTotal as Any, - "chunksUploaded": chunksUploaded as Any + "chunksUploaded": chunksUploaded as Any, + "encryption": encryption as Any, + "compression": compression as Any ] } @@ -138,7 +143,9 @@ open class File: Codable { mimeType: map["mimeType"] as! String, sizeOriginal: map["sizeOriginal"] as! Int, chunksTotal: map["chunksTotal"] as! Int, - chunksUploaded: map["chunksUploaded"] as! Int + chunksUploaded: map["chunksUploaded"] as! Int, + encryption: map["encryption"] as! Bool, + compression: map["compression"] as! String ) } } diff --git a/Sources/AppwriteModels/FileList.swift b/Sources/AppwriteModels/FileList.swift index 19d52a0..b265a6e 100644 --- a/Sources/AppwriteModels/FileList.swift +++ b/Sources/AppwriteModels/FileList.swift @@ -11,11 +11,9 @@ open class FileList: Codable { /// Total number of files that matched your query. public let total: Int - /// List of files. public let files: [File] - init( total: Int, files: [File] diff --git a/Sources/AppwriteModels/Framework.swift b/Sources/AppwriteModels/Framework.swift index 9885e94..10be45f 100644 --- a/Sources/AppwriteModels/Framework.swift +++ b/Sources/AppwriteModels/Framework.swift @@ -14,20 +14,15 @@ open class Framework: Codable { /// Framework key. public let key: String - /// Framework Name. public let name: String - /// Default runtime version. public let buildRuntime: String - /// List of supported runtime versions. public let runtimes: [String] - /// List of supported adapters. public let adapters: [FrameworkAdapter] - init( key: String, name: String, diff --git a/Sources/AppwriteModels/FrameworkAdapter.swift b/Sources/AppwriteModels/FrameworkAdapter.swift index 59348b4..fa3cc93 100644 --- a/Sources/AppwriteModels/FrameworkAdapter.swift +++ b/Sources/AppwriteModels/FrameworkAdapter.swift @@ -14,20 +14,15 @@ open class FrameworkAdapter: Codable { /// Adapter key. public let key: String - /// Default command to download dependencies. public let installCommand: String - /// Default command to build site into output directory. public let buildCommand: String - /// Default output directory of build. public let outputDirectory: String - /// Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed. public let fallbackFile: String - init( key: String, installCommand: String, diff --git a/Sources/AppwriteModels/FrameworkList.swift b/Sources/AppwriteModels/FrameworkList.swift index cbe4ae3..0626c53 100644 --- a/Sources/AppwriteModels/FrameworkList.swift +++ b/Sources/AppwriteModels/FrameworkList.swift @@ -11,11 +11,9 @@ open class FrameworkList: Codable { /// Total number of frameworks that matched your query. public let total: Int - /// List of frameworks. public let frameworks: [Framework] - init( total: Int, frameworks: [Framework] diff --git a/Sources/AppwriteModels/Function.swift b/Sources/AppwriteModels/Function.swift index 8df6078..05d4154 100644 --- a/Sources/AppwriteModels/Function.swift +++ b/Sources/AppwriteModels/Function.swift @@ -37,89 +37,61 @@ open class Function: Codable { /// Function ID. public let id: String - /// Function creation date in ISO 8601 format. public let createdAt: String - /// Function update date in ISO 8601 format. public let updatedAt: String - /// Execution permissions. public let execute: [String] - /// Function name. public let name: String - /// Function enabled. public let enabled: Bool - /// Is the function deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the function to update it with the latest configuration. public let live: Bool - /// When disabled, executions will exclude logs and errors, and will be slightly faster. public let logging: Bool - /// Function execution and build runtime. public let runtime: String - /// Function's active deployment ID. public let deploymentId: String - /// Active deployment creation date in ISO 8601 format. public let deploymentCreatedAt: String - /// Function's latest deployment ID. public let latestDeploymentId: String - /// Latest deployment creation date in ISO 8601 format. public let latestDeploymentCreatedAt: String - /// Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed". public let latestDeploymentStatus: String - /// Allowed permission scopes. public let scopes: [String] - /// Function variables. public let vars: [Variable] - /// Function trigger events. public let events: [String] - /// Function execution schedule in CRON format. public let schedule: String - /// Function execution timeout in seconds. public let timeout: Int - /// The entrypoint file used to execute the deployment. public let entrypoint: String - /// The build command used to build the deployment. public let commands: String - /// Version of Open Runtimes used for the function. public let version: String - /// Function VCS (Version Control System) installation id. public let installationId: String - /// VCS (Version Control System) Repository ID public let providerRepositoryId: String - /// VCS (Version Control System) branch name public let providerBranch: String - /// Path to function in VCS (Version Control System) repository public let providerRootDirectory: String - /// Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests public let providerSilentMode: Bool - /// Machine specification for builds and executions. public let specification: String - init( id: String, createdAt: String, diff --git a/Sources/AppwriteModels/FunctionList.swift b/Sources/AppwriteModels/FunctionList.swift index 33604a5..fefe177 100644 --- a/Sources/AppwriteModels/FunctionList.swift +++ b/Sources/AppwriteModels/FunctionList.swift @@ -11,11 +11,9 @@ open class FunctionList: Codable { /// Total number of functions that matched your query. public let total: Int - /// List of functions. public let functions: [Function] - init( total: Int, functions: [Function] diff --git a/Sources/AppwriteModels/Headers.swift b/Sources/AppwriteModels/Headers.swift index ae468e5..0d344fc 100644 --- a/Sources/AppwriteModels/Headers.swift +++ b/Sources/AppwriteModels/Headers.swift @@ -11,11 +11,9 @@ open class Headers: Codable { /// Header name. public let name: String - /// Header value. public let value: String - init( name: String, value: String diff --git a/Sources/AppwriteModels/HealthAntivirus.swift b/Sources/AppwriteModels/HealthAntivirus.swift index e92d47a..c0d7e37 100644 --- a/Sources/AppwriteModels/HealthAntivirus.swift +++ b/Sources/AppwriteModels/HealthAntivirus.swift @@ -12,11 +12,9 @@ open class HealthAntivirus: Codable { /// Antivirus version. public let version: String - /// Antivirus status. Possible values are: `disabled`, `offline`, `online` public let status: AppwriteEnums.HealthAntivirusStatus - init( version: String, status: AppwriteEnums.HealthAntivirusStatus diff --git a/Sources/AppwriteModels/HealthCertificate.swift b/Sources/AppwriteModels/HealthCertificate.swift index 1ef3837..7f61855 100644 --- a/Sources/AppwriteModels/HealthCertificate.swift +++ b/Sources/AppwriteModels/HealthCertificate.swift @@ -15,23 +15,17 @@ open class HealthCertificate: Codable { /// Certificate name public let name: String - /// Subject SN public let subjectSN: String - /// Issuer organisation public let issuerOrganisation: String - /// Valid from public let validFrom: String - /// Valid to public let validTo: String - /// Signature type SN public let signatureTypeSN: String - init( name: String, subjectSN: String, diff --git a/Sources/AppwriteModels/HealthQueue.swift b/Sources/AppwriteModels/HealthQueue.swift index 856a6d9..32cde48 100644 --- a/Sources/AppwriteModels/HealthQueue.swift +++ b/Sources/AppwriteModels/HealthQueue.swift @@ -11,7 +11,6 @@ open class HealthQueue: Codable { /// Amount of actions in the queue. public let size: Int - init( size: Int ) { diff --git a/Sources/AppwriteModels/HealthStatus.swift b/Sources/AppwriteModels/HealthStatus.swift index c7bdebd..0f61654 100644 --- a/Sources/AppwriteModels/HealthStatus.swift +++ b/Sources/AppwriteModels/HealthStatus.swift @@ -13,14 +13,11 @@ open class HealthStatus: Codable { /// Name of the service. public let name: String - /// Duration in milliseconds how long the health check took. public let ping: Int - /// Service status. Possible values are: `pass`, `fail` public let status: AppwriteEnums.HealthCheckStatus - init( name: String, ping: Int, diff --git a/Sources/AppwriteModels/HealthStatusList.swift b/Sources/AppwriteModels/HealthStatusList.swift new file mode 100644 index 0000000..9e746ac --- /dev/null +++ b/Sources/AppwriteModels/HealthStatusList.swift @@ -0,0 +1,52 @@ +import Foundation +import JSONCodable + +/// Status List +open class HealthStatusList: Codable { + + enum CodingKeys: String, CodingKey { + case total = "total" + case statuses = "statuses" + } + + /// Total number of statuses that matched your query. + public let total: Int + /// List of statuses. + public let statuses: [HealthStatus] + + init( + total: Int, + statuses: [HealthStatus] + ) { + self.total = total + self.statuses = statuses + } + + 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.statuses = try container.decode([HealthStatus].self, forKey: .statuses) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + + try container.encode(total, forKey: .total) + try container.encode(statuses, forKey: .statuses) + } + + public func toMap() -> [String: Any] { + return [ + "total": total as Any, + "statuses": statuses.map { $0.toMap() } as Any + ] + } + + public static func from(map: [String: Any] ) -> HealthStatusList { + return HealthStatusList( + total: map["total"] as! Int, + statuses: (map["statuses"] as! [[String: Any]]).map { HealthStatus.from(map: $0) } + ) + } +} diff --git a/Sources/AppwriteModels/HealthTime.swift b/Sources/AppwriteModels/HealthTime.swift index aab020b..50c0d80 100644 --- a/Sources/AppwriteModels/HealthTime.swift +++ b/Sources/AppwriteModels/HealthTime.swift @@ -12,14 +12,11 @@ open class HealthTime: Codable { /// Current unix timestamp on trustful remote server. public let remoteTime: Int - /// Current unix timestamp of local server where Appwrite runs. public let localTime: Int - /// Difference of unix remote and local timestamps in milliseconds. public let diff: Int - init( remoteTime: Int, localTime: Int, diff --git a/Sources/AppwriteModels/Identity.swift b/Sources/AppwriteModels/Identity.swift index f93035d..a0a565c 100644 --- a/Sources/AppwriteModels/Identity.swift +++ b/Sources/AppwriteModels/Identity.swift @@ -19,35 +19,25 @@ open class Identity: Codable { /// Identity ID. public let id: String - /// Identity creation date in ISO 8601 format. public let createdAt: String - /// Identity update date in ISO 8601 format. public let updatedAt: String - /// User ID. public let userId: String - /// Identity Provider. public let provider: String - /// ID of the User in the Identity Provider. public let providerUid: String - /// Email of the User in the Identity Provider. public let providerEmail: String - /// Identity Provider Access Token. public let providerAccessToken: String - /// The date of when the access token expires in ISO 8601 format. public let providerAccessTokenExpiry: String - /// Identity Provider Refresh Token. public let providerRefreshToken: String - init( id: String, createdAt: String, diff --git a/Sources/AppwriteModels/IdentityList.swift b/Sources/AppwriteModels/IdentityList.swift index abcc362..0ff998d 100644 --- a/Sources/AppwriteModels/IdentityList.swift +++ b/Sources/AppwriteModels/IdentityList.swift @@ -11,11 +11,9 @@ open class IdentityList: Codable { /// Total number of identities that matched your query. public let total: Int - /// List of identities. public let identities: [Identity] - init( total: Int, identities: [Identity] diff --git a/Sources/AppwriteModels/Index.swift b/Sources/AppwriteModels/Index.swift index 475b3c4..26767aa 100644 --- a/Sources/AppwriteModels/Index.swift +++ b/Sources/AppwriteModels/Index.swift @@ -20,35 +20,25 @@ open class Index: Codable { /// Index ID. public let id: String - /// Index creation date in ISO 8601 format. public let createdAt: String - /// Index update date in ISO 8601 format. public let updatedAt: String - /// Index key. public let key: String - /// Index type. public let type: String - /// Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` public let status: AppwriteEnums.IndexStatus - /// Error message. Displays error generated on failure of creating or deleting an index. public let error: String - /// Index attributes. public let attributes: [String] - /// Index attributes length. public let lengths: [Int] - /// Index orders. public let orders: [String]? - init( id: String, createdAt: String, diff --git a/Sources/AppwriteModels/IndexList.swift b/Sources/AppwriteModels/IndexList.swift index 52fa458..a31229e 100644 --- a/Sources/AppwriteModels/IndexList.swift +++ b/Sources/AppwriteModels/IndexList.swift @@ -11,11 +11,9 @@ open class IndexList: Codable { /// Total number of indexes that matched your query. public let total: Int - /// List of indexes. public let indexes: [Index] - init( total: Int, indexes: [Index] diff --git a/Sources/AppwriteModels/Jwt.swift b/Sources/AppwriteModels/Jwt.swift index fd7fb49..22c5be2 100644 --- a/Sources/AppwriteModels/Jwt.swift +++ b/Sources/AppwriteModels/Jwt.swift @@ -11,7 +11,6 @@ open class Jwt: Codable { /// JWT encoded string. public let jwt: String - init( jwt: String ) { diff --git a/Sources/AppwriteModels/Language.swift b/Sources/AppwriteModels/Language.swift index d1e1a15..6b12959 100644 --- a/Sources/AppwriteModels/Language.swift +++ b/Sources/AppwriteModels/Language.swift @@ -12,14 +12,11 @@ open class Language: Codable { /// Language name. public let name: String - /// Language two-character ISO 639-1 codes. public let code: String - /// Language native name. public let nativeName: String - init( name: String, code: String, diff --git a/Sources/AppwriteModels/LanguageList.swift b/Sources/AppwriteModels/LanguageList.swift index 2b1f03c..0d57fdd 100644 --- a/Sources/AppwriteModels/LanguageList.swift +++ b/Sources/AppwriteModels/LanguageList.swift @@ -11,11 +11,9 @@ open class LanguageList: Codable { /// Total number of languages that matched your query. public let total: Int - /// List of languages. public let languages: [Language] - init( total: Int, languages: [Language] diff --git a/Sources/AppwriteModels/Locale.swift b/Sources/AppwriteModels/Locale.swift index 4d034f4..c550fc9 100644 --- a/Sources/AppwriteModels/Locale.swift +++ b/Sources/AppwriteModels/Locale.swift @@ -16,26 +16,19 @@ open class Locale: Codable { /// User IP address. public let ip: String - /// Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format public let countryCode: String - /// Country name. This field support localization. public let country: String - /// Continent code. A two character continent code "AF" for Africa, "AN" for Antarctica, "AS" for Asia, "EU" for Europe, "NA" for North America, "OC" for Oceania, and "SA" for South America. public let continentCode: String - /// Continent name. This field support localization. public let continent: String - /// True if country is part of the European Union. public let eu: Bool - /// Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format public let currency: String - init( ip: String, countryCode: String, diff --git a/Sources/AppwriteModels/LocaleCode.swift b/Sources/AppwriteModels/LocaleCode.swift index d2678bb..f4ac0fc 100644 --- a/Sources/AppwriteModels/LocaleCode.swift +++ b/Sources/AppwriteModels/LocaleCode.swift @@ -11,11 +11,9 @@ open class LocaleCode: Codable { /// Locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) public let code: String - /// Locale name public let name: String - init( code: String, name: String diff --git a/Sources/AppwriteModels/LocaleCodeList.swift b/Sources/AppwriteModels/LocaleCodeList.swift index f1d1678..5a655bc 100644 --- a/Sources/AppwriteModels/LocaleCodeList.swift +++ b/Sources/AppwriteModels/LocaleCodeList.swift @@ -11,11 +11,9 @@ open class LocaleCodeList: Codable { /// Total number of localeCodes that matched your query. public let total: Int - /// List of localeCodes. public let localeCodes: [LocaleCode] - init( total: Int, localeCodes: [LocaleCode] diff --git a/Sources/AppwriteModels/Log.swift b/Sources/AppwriteModels/Log.swift index 16c27ef..ae5a3a5 100644 --- a/Sources/AppwriteModels/Log.swift +++ b/Sources/AppwriteModels/Log.swift @@ -30,68 +30,47 @@ open class Log: Codable { /// Event name. public let event: String - /// User ID. public let userId: String - /// User Email. public let userEmail: String - /// User Name. public let userName: String - /// API mode when event triggered. public let mode: String - /// IP session in use when the session was created. public let ip: String - /// Log creation date in ISO 8601 format. public let time: 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( event: String, userId: String, diff --git a/Sources/AppwriteModels/LogList.swift b/Sources/AppwriteModels/LogList.swift index ba76a8a..ac545e2 100644 --- a/Sources/AppwriteModels/LogList.swift +++ b/Sources/AppwriteModels/LogList.swift @@ -11,11 +11,9 @@ open class LogList: Codable { /// Total number of logs that matched your query. public let total: Int - /// List of logs. public let logs: [Log] - init( total: Int, logs: [Log] diff --git a/Sources/AppwriteModels/Membership.swift b/Sources/AppwriteModels/Membership.swift index 8d26766..8ff61ee 100644 --- a/Sources/AppwriteModels/Membership.swift +++ b/Sources/AppwriteModels/Membership.swift @@ -22,44 +22,31 @@ open class Membership: Codable { /// Membership ID. public let id: String - /// Membership creation date in ISO 8601 format. public let createdAt: String - /// Membership update date in ISO 8601 format. public let updatedAt: String - /// User ID. public let userId: String - /// User name. Hide this attribute by toggling membership privacy in the Console. public let userName: String - /// User email address. Hide this attribute by toggling membership privacy in the Console. public let userEmail: String - /// Team ID. public let teamId: String - /// Team name. public let teamName: String - /// Date, the user has been invited to join the team in ISO 8601 format. public let invited: String - /// Date, the user has accepted the invitation to join the team in ISO 8601 format. public let joined: String - /// User confirmation status, true if the user has joined the team or false otherwise. public let confirm: Bool - /// Multi factor authentication status, true if the user has MFA enabled or false otherwise. Hide this attribute by toggling membership privacy in the Console. public let mfa: Bool - /// User list of roles public let roles: [String] - init( id: String, createdAt: String, diff --git a/Sources/AppwriteModels/MembershipList.swift b/Sources/AppwriteModels/MembershipList.swift index 7d6ffd1..283abae 100644 --- a/Sources/AppwriteModels/MembershipList.swift +++ b/Sources/AppwriteModels/MembershipList.swift @@ -11,11 +11,9 @@ open class MembershipList: Codable { /// Total number of memberships that matched your query. public let total: Int - /// List of memberships. public let memberships: [Membership] - init( total: Int, memberships: [Membership] diff --git a/Sources/AppwriteModels/Message.swift b/Sources/AppwriteModels/Message.swift index c358c50..461354f 100644 --- a/Sources/AppwriteModels/Message.swift +++ b/Sources/AppwriteModels/Message.swift @@ -23,44 +23,31 @@ open class Message: Codable { /// Message ID. public let id: String - /// Message creation time in ISO 8601 format. public let createdAt: String - /// Message update date in ISO 8601 format. public let updatedAt: String - /// Message provider type. public let providerType: String - /// Topic IDs set as recipients. public let topics: [String] - /// User IDs set as recipients. public let users: [String] - /// Target IDs set as recipients. public let targets: [String] - /// The scheduled time for message. public let scheduledAt: String? - /// The time when the message was delivered. public let deliveredAt: String? - /// Delivery errors if any. public let deliveryErrors: [String]? - /// Number of recipients the message was delivered to. public let deliveredTotal: Int - /// Data of the message. public let data: [String: AnyCodable] - /// Status of delivery. public let status: AppwriteEnums.MessageStatus - init( id: String, createdAt: String, diff --git a/Sources/AppwriteModels/MessageList.swift b/Sources/AppwriteModels/MessageList.swift index 5030392..5fc5ac8 100644 --- a/Sources/AppwriteModels/MessageList.swift +++ b/Sources/AppwriteModels/MessageList.swift @@ -11,11 +11,9 @@ open class MessageList: Codable { /// Total number of messages that matched your query. public let total: Int - /// List of messages. public let messages: [Message] - init( total: Int, messages: [Message] diff --git a/Sources/AppwriteModels/MfaChallenge.swift b/Sources/AppwriteModels/MfaChallenge.swift index c6b77a5..55d82ab 100644 --- a/Sources/AppwriteModels/MfaChallenge.swift +++ b/Sources/AppwriteModels/MfaChallenge.swift @@ -13,17 +13,13 @@ open class MfaChallenge: Codable { /// Token ID. public let id: String - /// Token creation date in ISO 8601 format. public let createdAt: String - /// User ID. public let userId: String - /// Token expiration date in ISO 8601 format. public let expire: String - init( id: String, createdAt: String, diff --git a/Sources/AppwriteModels/MfaFactors.swift b/Sources/AppwriteModels/MfaFactors.swift index 4291fab..fb8f35c 100644 --- a/Sources/AppwriteModels/MfaFactors.swift +++ b/Sources/AppwriteModels/MfaFactors.swift @@ -13,17 +13,13 @@ open class MfaFactors: Codable { /// Can TOTP be used for MFA challenge for this account. public let totp: Bool - /// Can phone (SMS) be used for MFA challenge for this account. public let phone: Bool - /// Can email be used for MFA challenge for this account. public let email: Bool - /// Can recovery code be used for MFA challenge for this account. public let recoveryCode: Bool - init( totp: Bool, phone: Bool, diff --git a/Sources/AppwriteModels/MfaRecoveryCodes.swift b/Sources/AppwriteModels/MfaRecoveryCodes.swift index bd2968f..47c80ab 100644 --- a/Sources/AppwriteModels/MfaRecoveryCodes.swift +++ b/Sources/AppwriteModels/MfaRecoveryCodes.swift @@ -11,7 +11,6 @@ open class MfaRecoveryCodes: Codable { /// Recovery codes. public let recoveryCodes: [String] - init( recoveryCodes: [String] ) { diff --git a/Sources/AppwriteModels/MfaType.swift b/Sources/AppwriteModels/MfaType.swift index 8646385..2aaca85 100644 --- a/Sources/AppwriteModels/MfaType.swift +++ b/Sources/AppwriteModels/MfaType.swift @@ -11,11 +11,9 @@ open class MfaType: Codable { /// Secret token used for TOTP factor. public let secret: String - /// URI for authenticator apps. public let uri: String - init( secret: String, uri: String diff --git a/Sources/AppwriteModels/Phone.swift b/Sources/AppwriteModels/Phone.swift index fc90d49..41f6818 100644 --- a/Sources/AppwriteModels/Phone.swift +++ b/Sources/AppwriteModels/Phone.swift @@ -12,14 +12,11 @@ open class Phone: Codable { /// Phone code. public let code: String - /// Country two-character ISO 3166-1 alpha code. public let countryCode: String - /// Country name. public let countryName: String - init( code: String, countryCode: String, diff --git a/Sources/AppwriteModels/PhoneList.swift b/Sources/AppwriteModels/PhoneList.swift index f09d239..5a824e1 100644 --- a/Sources/AppwriteModels/PhoneList.swift +++ b/Sources/AppwriteModels/PhoneList.swift @@ -11,11 +11,9 @@ open class PhoneList: Codable { /// Total number of phones that matched your query. public let total: Int - /// List of phones. public let phones: [Phone] - init( total: Int, phones: [Phone] diff --git a/Sources/AppwriteModels/Provider.swift b/Sources/AppwriteModels/Provider.swift index 50e50d2..fd91b4c 100644 --- a/Sources/AppwriteModels/Provider.swift +++ b/Sources/AppwriteModels/Provider.swift @@ -18,32 +18,23 @@ open class Provider: Codable { /// Provider ID. public let id: String - /// Provider creation time in ISO 8601 format. public let createdAt: String - /// Provider update date in ISO 8601 format. public let updatedAt: String - /// The name for the provider instance. public let name: String - /// The name of the provider service. public let provider: String - /// Is provider enabled? public let enabled: Bool - /// Type of provider. public let type: String - /// Provider credentials. public let credentials: [String: AnyCodable] - /// Provider options. public let options: [String: AnyCodable]? - init( id: String, createdAt: String, diff --git a/Sources/AppwriteModels/ProviderList.swift b/Sources/AppwriteModels/ProviderList.swift index feefae6..a4ae399 100644 --- a/Sources/AppwriteModels/ProviderList.swift +++ b/Sources/AppwriteModels/ProviderList.swift @@ -11,11 +11,9 @@ open class ProviderList: Codable { /// Total number of providers that matched your query. public let total: Int - /// List of providers. public let providers: [Provider] - init( total: Int, providers: [Provider] diff --git a/Sources/AppwriteModels/ResourceToken.swift b/Sources/AppwriteModels/ResourceToken.swift index a3badb6..de5496e 100644 --- a/Sources/AppwriteModels/ResourceToken.swift +++ b/Sources/AppwriteModels/ResourceToken.swift @@ -16,26 +16,19 @@ open class ResourceToken: Codable { /// Token ID. public let id: String - /// Token creation date in ISO 8601 format. public let createdAt: String - /// Resource ID. public let resourceId: String - /// Resource type. public let resourceType: String - /// Token expiration date in ISO 8601 format. public let expire: String - /// JWT encoded string. public let secret: String - /// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. public let accessedAt: String - init( id: String, createdAt: String, diff --git a/Sources/AppwriteModels/ResourceTokenList.swift b/Sources/AppwriteModels/ResourceTokenList.swift index 938c1f8..284f440 100644 --- a/Sources/AppwriteModels/ResourceTokenList.swift +++ b/Sources/AppwriteModels/ResourceTokenList.swift @@ -11,11 +11,9 @@ open class ResourceTokenList: Codable { /// Total number of tokens that matched your query. public let total: Int - /// List of tokens. public let tokens: [ResourceToken] - init( total: Int, tokens: [ResourceToken] diff --git a/Sources/AppwriteModels/Row.swift b/Sources/AppwriteModels/Row.swift index 5c6a215..44f3859 100644 --- a/Sources/AppwriteModels/Row.swift +++ b/Sources/AppwriteModels/Row.swift @@ -17,25 +17,18 @@ open class Row: Codable { /// Row ID. public let id: String - /// Row automatically incrementing ID. public let sequence: Int - /// Table ID. public let tableId: String - /// Database ID. public let databaseId: String - /// Row creation date in ISO 8601 format. public let createdAt: String - /// Row update date in ISO 8601 format. public let updatedAt: String - /// Row permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). public let permissions: [String] - /// Additional properties public let data: T diff --git a/Sources/AppwriteModels/RowList.swift b/Sources/AppwriteModels/RowList.swift index c14c83b..8562ef2 100644 --- a/Sources/AppwriteModels/RowList.swift +++ b/Sources/AppwriteModels/RowList.swift @@ -11,11 +11,9 @@ open class RowList: Codable { /// Total number of rows that matched your query. public let total: Int - /// List of rows. public let rows: [Row] - init( total: Int, rows: [Row] diff --git a/Sources/AppwriteModels/Runtime.swift b/Sources/AppwriteModels/Runtime.swift index f8e6950..9f2a048 100644 --- a/Sources/AppwriteModels/Runtime.swift +++ b/Sources/AppwriteModels/Runtime.swift @@ -17,29 +17,21 @@ open class Runtime: Codable { /// Runtime ID. public let id: String - /// Parent runtime key. public let key: String - /// Runtime Name. public let name: String - /// Runtime version. public let version: String - /// Base Docker image used to build the runtime. public let base: String - /// Image name of Docker Hub. public let image: String - /// Name of the logo image. public let logo: String - /// List of supported architectures. public let supports: [String] - init( id: String, key: String, diff --git a/Sources/AppwriteModels/RuntimeList.swift b/Sources/AppwriteModels/RuntimeList.swift index 26e9be6..cdf6f13 100644 --- a/Sources/AppwriteModels/RuntimeList.swift +++ b/Sources/AppwriteModels/RuntimeList.swift @@ -11,11 +11,9 @@ open class RuntimeList: Codable { /// Total number of runtimes that matched your query. public let total: Int - /// List of runtimes. public let runtimes: [Runtime] - init( total: Int, runtimes: [Runtime] diff --git a/Sources/AppwriteModels/Session.swift b/Sources/AppwriteModels/Session.swift index b5c25a6..1da34cc 100644 --- a/Sources/AppwriteModels/Session.swift +++ b/Sources/AppwriteModels/Session.swift @@ -38,92 +38,63 @@ open class Session: Codable { /// Session ID. public let id: String - /// Session creation date in ISO 8601 format. public let createdAt: String - /// Session update date in ISO 8601 format. public let updatedAt: String - /// User ID. public let userId: String - /// Session expiration date in ISO 8601 format. public let expire: String - /// Session Provider. public let provider: String - /// Session Provider User ID. public let providerUid: String - /// Session Provider Access Token. public let providerAccessToken: String - /// The date of when the access token expires in ISO 8601 format. public let providerAccessTokenExpiry: String - /// Session Provider Refresh Token. public let providerRefreshToken: String - /// IP in use when the session was created. public let ip: 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 - /// Returns true if this the current user session. public let current: Bool - /// Returns a list of active session factors. public let factors: [String] - /// Secret used to authenticate the user. Only included if the request was made with an API key public let secret: String - /// Most recent date in ISO 8601 format when the session successfully passed MFA challenge. public let mfaUpdatedAt: String - init( id: String, createdAt: String, diff --git a/Sources/AppwriteModels/SessionList.swift b/Sources/AppwriteModels/SessionList.swift index c9c8394..81e9d1a 100644 --- a/Sources/AppwriteModels/SessionList.swift +++ b/Sources/AppwriteModels/SessionList.swift @@ -11,11 +11,9 @@ open class SessionList: Codable { /// Total number of sessions that matched your query. public let total: Int - /// List of sessions. public let sessions: [Session] - init( total: Int, sessions: [Session] diff --git a/Sources/AppwriteModels/Site.swift b/Sources/AppwriteModels/Site.swift index ef79e4a..de6dd3f 100644 --- a/Sources/AppwriteModels/Site.swift +++ b/Sources/AppwriteModels/Site.swift @@ -38,92 +38,63 @@ open class Site: Codable { /// Site ID. public let id: String - /// Site creation date in ISO 8601 format. public let createdAt: String - /// Site update date in ISO 8601 format. public let updatedAt: String - /// Site name. public let name: String - /// Site enabled. public let enabled: Bool - /// Is the site deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the site to update it with the latest configuration. public let live: Bool - /// When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. public let logging: Bool - /// Site framework. public let framework: String - /// Site's active deployment ID. public let deploymentId: String - /// Active deployment creation date in ISO 8601 format. public let deploymentCreatedAt: String - /// Screenshot of active deployment with light theme preference file ID. public let deploymentScreenshotLight: String - /// Screenshot of active deployment with dark theme preference file ID. public let deploymentScreenshotDark: String - /// Site's latest deployment ID. public let latestDeploymentId: String - /// Latest deployment creation date in ISO 8601 format. public let latestDeploymentCreatedAt: String - /// Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed". public let latestDeploymentStatus: String - /// Site variables. public let vars: [Variable] - /// Site request timeout in seconds. public let timeout: Int - /// The install command used to install the site dependencies. public let installCommand: String - /// The build command used to build the site. public let buildCommand: String - /// The directory where the site build output is located. public let outputDirectory: String - /// Site VCS (Version Control System) installation id. public let installationId: String - /// VCS (Version Control System) Repository ID public let providerRepositoryId: String - /// VCS (Version Control System) branch name public let providerBranch: String - /// Path to site in VCS (Version Control System) repository public let providerRootDirectory: String - /// Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests public let providerSilentMode: Bool - /// Machine specification for builds and executions. public let specification: String - /// Site build runtime. public let buildRuntime: String - /// Site framework adapter. public let adapter: String - /// Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed. public let fallbackFile: String - init( id: String, createdAt: String, diff --git a/Sources/AppwriteModels/SiteList.swift b/Sources/AppwriteModels/SiteList.swift index 60c1d89..0a18d70 100644 --- a/Sources/AppwriteModels/SiteList.swift +++ b/Sources/AppwriteModels/SiteList.swift @@ -11,11 +11,9 @@ open class SiteList: Codable { /// Total number of sites that matched your query. public let total: Int - /// List of sites. public let sites: [Site] - init( total: Int, sites: [Site] diff --git a/Sources/AppwriteModels/Specification.swift b/Sources/AppwriteModels/Specification.swift index a84f617..20bfb9d 100644 --- a/Sources/AppwriteModels/Specification.swift +++ b/Sources/AppwriteModels/Specification.swift @@ -13,17 +13,13 @@ open class Specification: Codable { /// Memory size in MB. public let memory: Int - /// Number of CPUs. public let cpus: Double - /// Is size enabled. public let enabled: Bool - /// Size slug. public let slug: String - init( memory: Int, cpus: Double, diff --git a/Sources/AppwriteModels/SpecificationList.swift b/Sources/AppwriteModels/SpecificationList.swift index fc13cd3..8d0457d 100644 --- a/Sources/AppwriteModels/SpecificationList.swift +++ b/Sources/AppwriteModels/SpecificationList.swift @@ -11,11 +11,9 @@ open class SpecificationList: Codable { /// Total number of specifications that matched your query. public let total: Int - /// List of specifications. public let specifications: [Specification] - init( total: Int, specifications: [Specification] diff --git a/Sources/AppwriteModels/Subscriber.swift b/Sources/AppwriteModels/Subscriber.swift index ad6fa5d..8dc1c13 100644 --- a/Sources/AppwriteModels/Subscriber.swift +++ b/Sources/AppwriteModels/Subscriber.swift @@ -18,32 +18,23 @@ open class Subscriber: Codable { /// Subscriber ID. public let id: String - /// Subscriber creation time in ISO 8601 format. public let createdAt: String - /// Subscriber update date in ISO 8601 format. public let updatedAt: String - /// Target ID. public let targetId: String - /// Target. public let target: Target - /// Topic ID. public let userId: String - /// User Name. public let userName: String - /// Topic ID. public let topicId: String - /// The target provider type. Can be one of the following: `email`, `sms` or `push`. public let providerType: String - init( id: String, createdAt: String, diff --git a/Sources/AppwriteModels/SubscriberList.swift b/Sources/AppwriteModels/SubscriberList.swift index 8d82866..0556467 100644 --- a/Sources/AppwriteModels/SubscriberList.swift +++ b/Sources/AppwriteModels/SubscriberList.swift @@ -11,11 +11,9 @@ open class SubscriberList: Codable { /// Total number of subscribers that matched your query. public let total: Int - /// List of subscribers. public let subscribers: [Subscriber] - init( total: Int, subscribers: [Subscriber] diff --git a/Sources/AppwriteModels/Table.swift b/Sources/AppwriteModels/Table.swift index 82bdd3d..bdb674d 100644 --- a/Sources/AppwriteModels/Table.swift +++ b/Sources/AppwriteModels/Table.swift @@ -19,35 +19,25 @@ open class Table: Codable { /// Table ID. public let id: String - /// Table creation date in ISO 8601 format. public let createdAt: String - /// Table update date in ISO 8601 format. public let updatedAt: String - /// Table permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). public let permissions: [String] - /// Database ID. public let databaseId: String - /// Table name. public let name: String - /// Table enabled. Can be 'enabled' or 'disabled'. When disabled, the table is inaccessible to users, but remains accessible to Server SDKs using API keys. public let enabled: Bool - /// Whether row-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). public let rowSecurity: Bool - /// Table columns. public let columns: [AnyCodable] - /// Table indexes. public let indexes: [ColumnIndex] - init( id: String, createdAt: String, diff --git a/Sources/AppwriteModels/TableList.swift b/Sources/AppwriteModels/TableList.swift index d0c8059..3d2d97e 100644 --- a/Sources/AppwriteModels/TableList.swift +++ b/Sources/AppwriteModels/TableList.swift @@ -11,11 +11,9 @@ open class TableList: Codable { /// Total number of tables that matched your query. public let total: Int - /// List of tables. public let tables: [Table] - init( total: Int, tables: [Table] diff --git a/Sources/AppwriteModels/Target.swift b/Sources/AppwriteModels/Target.swift index 0581a61..4be8f67 100644 --- a/Sources/AppwriteModels/Target.swift +++ b/Sources/AppwriteModels/Target.swift @@ -18,32 +18,23 @@ open class Target: Codable { /// Target ID. public let id: String - /// Target creation time in ISO 8601 format. public let createdAt: String - /// Target update date in ISO 8601 format. public let updatedAt: String - /// Target Name. public let name: String - /// User ID. public let userId: String - /// Provider ID. public let providerId: String? - /// The target provider type. Can be one of the following: `email`, `sms` or `push`. public let providerType: String - /// The target identifier. public let identifier: String - /// Is the target expired. public let expired: Bool - init( id: String, createdAt: String, diff --git a/Sources/AppwriteModels/TargetList.swift b/Sources/AppwriteModels/TargetList.swift index cc5557d..ed99223 100644 --- a/Sources/AppwriteModels/TargetList.swift +++ b/Sources/AppwriteModels/TargetList.swift @@ -11,11 +11,9 @@ open class TargetList: Codable { /// Total number of targets that matched your query. public let total: Int - /// List of targets. public let targets: [Target] - init( total: Int, targets: [Target] diff --git a/Sources/AppwriteModels/Team.swift b/Sources/AppwriteModels/Team.swift index 9ca7307..232f36c 100644 --- a/Sources/AppwriteModels/Team.swift +++ b/Sources/AppwriteModels/Team.swift @@ -15,23 +15,17 @@ open class Team: Codable { /// Team ID. public let id: String - /// Team creation date in ISO 8601 format. public let createdAt: String - /// Team update date in ISO 8601 format. public let updatedAt: String - /// Team name. public let name: String - /// Total number of team members. public let total: Int - /// Team preferences as a key-value object public let prefs: Preferences - init( id: String, createdAt: String, diff --git a/Sources/AppwriteModels/TeamList.swift b/Sources/AppwriteModels/TeamList.swift index 2b789d9..60dfaf3 100644 --- a/Sources/AppwriteModels/TeamList.swift +++ b/Sources/AppwriteModels/TeamList.swift @@ -11,11 +11,9 @@ open class TeamList: Codable { /// Total number of teams that matched your query. public let total: Int - /// List of teams. public let teams: [Team] - init( total: Int, teams: [Team] diff --git a/Sources/AppwriteModels/Token.swift b/Sources/AppwriteModels/Token.swift index f832402..e6716cd 100644 --- a/Sources/AppwriteModels/Token.swift +++ b/Sources/AppwriteModels/Token.swift @@ -15,23 +15,17 @@ open class Token: Codable { /// Token ID. public let id: String - /// Token creation date in ISO 8601 format. public let createdAt: String - /// User ID. public let userId: String - /// Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. public let secret: String - /// Token expiration date in ISO 8601 format. public let expire: String - /// Security phrase of a token. Empty if security phrase was not requested when creating a token. It includes randomly generated phrase which is also sent in the external resource such as email. public let phrase: String - init( id: String, createdAt: String, diff --git a/Sources/AppwriteModels/Topic.swift b/Sources/AppwriteModels/Topic.swift index 4489abb..cde8e8f 100644 --- a/Sources/AppwriteModels/Topic.swift +++ b/Sources/AppwriteModels/Topic.swift @@ -17,29 +17,21 @@ open class Topic: Codable { /// Topic ID. public let id: String - /// Topic creation time in ISO 8601 format. public let createdAt: String - /// Topic update date in ISO 8601 format. public let updatedAt: String - /// The name of the topic. public let name: String - /// Total count of email subscribers subscribed to the topic. public let emailTotal: Int - /// Total count of SMS subscribers subscribed to the topic. public let smsTotal: Int - /// Total count of push subscribers subscribed to the topic. public let pushTotal: Int - /// Subscribe permissions. public let subscribe: [String] - init( id: String, createdAt: String, diff --git a/Sources/AppwriteModels/TopicList.swift b/Sources/AppwriteModels/TopicList.swift index 53cfd49..24730da 100644 --- a/Sources/AppwriteModels/TopicList.swift +++ b/Sources/AppwriteModels/TopicList.swift @@ -11,11 +11,9 @@ open class TopicList: Codable { /// Total number of topics that matched your query. public let total: Int - /// List of topics. public let topics: [Topic] - init( total: Int, topics: [Topic] diff --git a/Sources/AppwriteModels/Transaction.swift b/Sources/AppwriteModels/Transaction.swift index 584c4c3..fcc7f0d 100644 --- a/Sources/AppwriteModels/Transaction.swift +++ b/Sources/AppwriteModels/Transaction.swift @@ -15,23 +15,17 @@ open class Transaction: Codable { /// Transaction ID. public let id: String - /// Transaction creation time in ISO 8601 format. public let createdAt: String - /// Transaction update date in ISO 8601 format. public let updatedAt: String - /// Current status of the transaction. One of: pending, committing, committed, rolled_back, failed. public let status: String - /// Number of operations in the transaction. public let operations: Int - /// Expiration time in ISO 8601 format. public let expiresAt: String - init( id: String, createdAt: String, diff --git a/Sources/AppwriteModels/TransactionList.swift b/Sources/AppwriteModels/TransactionList.swift index 49a976a..93915a9 100644 --- a/Sources/AppwriteModels/TransactionList.swift +++ b/Sources/AppwriteModels/TransactionList.swift @@ -11,11 +11,9 @@ open class TransactionList: Codable { /// Total number of transactions that matched your query. public let total: Int - /// List of transactions. public let transactions: [Transaction] - init( total: Int, transactions: [Transaction] diff --git a/Sources/AppwriteModels/User.swift b/Sources/AppwriteModels/User.swift index 6e972d3..186da68 100644 --- a/Sources/AppwriteModels/User.swift +++ b/Sources/AppwriteModels/User.swift @@ -28,62 +28,43 @@ open class User: Codable { /// User ID. public let id: String - /// User creation date in ISO 8601 format. public let createdAt: String - /// User update date in ISO 8601 format. public let updatedAt: String - /// User name. public let name: String - /// Hashed user password. public let password: String? - /// Password hashing algorithm. public let hash: String? - /// Password hashing algorithm configuration. public let hashOptions: [String: AnyCodable]? - /// User registration date in ISO 8601 format. public let registration: String - /// User status. Pass `true` for enabled and `false` for disabled. public let status: Bool - /// Labels for the user. public let labels: [String] - /// Password update time in ISO 8601 format. public let passwordUpdate: String - /// User email address. public let email: String - /// User phone number in E.164 format. public let phone: String - /// Email verification status. public let emailVerification: Bool - /// Phone verification status. public let phoneVerification: Bool - /// Multi factor authentication status. public let mfa: Bool - /// User preferences as a key-value object public let prefs: Preferences - /// A user-owned message receiver. A single user may have multiple e.g. emails, phones, and a browser. Each target is registered with a single provider. public let targets: [Target] - /// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. public let accessedAt: String - init( id: String, createdAt: String, diff --git a/Sources/AppwriteModels/UserList.swift b/Sources/AppwriteModels/UserList.swift index 445e9c9..9fb6025 100644 --- a/Sources/AppwriteModels/UserList.swift +++ b/Sources/AppwriteModels/UserList.swift @@ -11,11 +11,9 @@ open class UserList: Codable { /// Total number of users that matched your query. public let total: Int - /// List of users. public let users: [User] - init( total: Int, users: [User] diff --git a/Sources/AppwriteModels/Variable.swift b/Sources/AppwriteModels/Variable.swift index 662e7a3..0d6cae4 100644 --- a/Sources/AppwriteModels/Variable.swift +++ b/Sources/AppwriteModels/Variable.swift @@ -17,29 +17,21 @@ open class Variable: Codable { /// Variable ID. public let id: String - /// Variable creation date in ISO 8601 format. public let createdAt: String - /// Variable creation date in ISO 8601 format. public let updatedAt: String - /// Variable key. public let key: String - /// Variable value. public let value: String - /// Variable secret flag. Secret variables can only be updated or deleted, but never read. public let secret: Bool - /// Service to which the variable belongs. Possible values are "project", "function" public let resourceType: String - /// ID of resource to which the variable belongs. If resourceType is "project", it is empty. If resourceType is "function", it is ID of the function. public let resourceId: String - init( id: String, createdAt: String, diff --git a/Sources/AppwriteModels/VariableList.swift b/Sources/AppwriteModels/VariableList.swift index b97b1d0..a05ae85 100644 --- a/Sources/AppwriteModels/VariableList.swift +++ b/Sources/AppwriteModels/VariableList.swift @@ -11,11 +11,9 @@ open class VariableList: Codable { /// Total number of variables that matched your query. public let total: Int - /// List of variables. public let variables: [Variable] - init( total: Int, variables: [Variable] diff --git a/Sources/JSONCodable/Codable+JSON.swift b/Sources/JSONCodable/Codable+JSON.swift index c9b8711..e08de62 100644 --- a/Sources/JSONCodable/Codable+JSON.swift +++ b/Sources/JSONCodable/Codable+JSON.swift @@ -121,7 +121,6 @@ extension AnyCodable: ExpressibleByStringLiteral {} extension AnyCodable: ExpressibleByArrayLiteral {} extension AnyCodable: ExpressibleByDictionaryLiteral {} - extension AnyCodable: Hashable { public func hash(into hasher: inout Hasher) { switch value { diff --git a/docs/examples/account/create-jwt.md b/docs/examples/account/create-jwt.md index f4bb73d..5490c93 100644 --- a/docs/examples/account/create-jwt.md +++ b/docs/examples/account/create-jwt.md @@ -7,5 +7,7 @@ let client = Client() let account = Account(client) -let jwt = try await account.createJWT() +let jwt = try await account.createJWT( + duration: 0 // optional +) diff --git a/docs/examples/avatars/get-screenshot.md b/docs/examples/avatars/get-screenshot.md index 91e08d9..fe42d0e 100644 --- a/docs/examples/avatars/get-screenshot.md +++ b/docs/examples/avatars/get-screenshot.md @@ -17,20 +17,20 @@ let bytes = try await avatars.getScreenshot( viewportWidth: 1920, // optional viewportHeight: 1080, // optional scale: 2, // optional - theme: .light, // optional + theme: .dark, // optional userAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15", // optional fullpage: true, // optional locale: "en-US", // optional - timezone: .africaAbidjan, // optional + timezone: .americaNewYork, // optional latitude: 37.7749, // optional longitude: -122.4194, // optional accuracy: 100, // optional touch: true, // optional - permissions: ["geolocation","notifications"], // optional + permissions: [.geolocation, .notifications], // optional sleep: 3, // optional width: 800, // optional height: 600, // optional quality: 85, // optional - output: .jpg // optional + output: .jpeg // optional ) diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index 7e9a620..1ded383 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -14,7 +14,7 @@ let index = try await databases.createIndex( key: "", type: .key, attributes: [], - orders: [], // optional + orders: [.asc], // optional lengths: [] // optional ) diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md index 30cd0c8..0b010a3 100644 --- a/docs/examples/databases/get-attribute.md +++ b/docs/examples/databases/get-attribute.md @@ -7,7 +7,7 @@ let client = Client() let databases = Databases(client) -let result = try await databases.getAttribute( +let attributeBoolean = try await databases.getAttribute( databaseId: "", collectionId: "", key: "" diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md index d26fbdc..e8313dc 100644 --- a/docs/examples/databases/update-collection.md +++ b/docs/examples/databases/update-collection.md @@ -10,7 +10,7 @@ let databases = Databases(client) let collection = try await databases.updateCollection( databaseId: "", collectionId: "", - name: "", + name: "", // optional permissions: [Permission.read(Role.any())], // optional documentSecurity: false, // optional enabled: false // optional diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index dbb954f..7c23e26 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -11,7 +11,13 @@ let document = try await databases.updateDocument( databaseId: "", collectionId: "", documentId: "", - data: [:], // optional + data: [ + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": false + ], // optional permissions: [Permission.read(Role.any())], // optional transactionId: "" // optional ) diff --git a/docs/examples/databases/update-documents.md b/docs/examples/databases/update-documents.md index f1fb34a..2326f5f 100644 --- a/docs/examples/databases/update-documents.md +++ b/docs/examples/databases/update-documents.md @@ -10,7 +10,13 @@ let databases = Databases(client) let documentList = try await databases.updateDocuments( databaseId: "", collectionId: "", - data: [:], // optional + data: [ + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": false + ], // optional queries: [], // optional transactionId: "" // optional ) diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md index 07f5062..54870f9 100644 --- a/docs/examples/databases/update.md +++ b/docs/examples/databases/update.md @@ -9,7 +9,7 @@ let databases = Databases(client) let database = try await databases.update( databaseId: "", - name: "", + name: "", // optional enabled: false // optional ) diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md index 1873d5e..ae57ac5 100644 --- a/docs/examples/databases/upsert-document.md +++ b/docs/examples/databases/upsert-document.md @@ -11,7 +11,13 @@ let document = try await databases.upsertDocument( databaseId: "", collectionId: "", documentId: "", - data: [:], + data: [ + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 30, + "isAdmin": false + ], // optional permissions: [Permission.read(Role.any())], // optional transactionId: "" // optional ) diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index 6f17a65..9444195 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -20,7 +20,7 @@ let function = try await functions.create( logging: false, // optional entrypoint: "", // optional commands: "", // optional - scopes: [], // optional + scopes: [.sessionsWrite], // optional installationId: "", // optional providerRepositoryId: "", // optional providerBranch: "", // optional diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index ebb2828..d47852e 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -20,7 +20,7 @@ let function = try await functions.update( logging: false, // optional entrypoint: "", // optional commands: "", // optional - scopes: [], // optional + scopes: [.sessionsWrite], // optional installationId: "", // optional providerRepositoryId: "", // optional providerBranch: "", // optional diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md index a1c514b..fdfa27e 100644 --- a/docs/examples/health/get-cache.md +++ b/docs/examples/health/get-cache.md @@ -7,5 +7,5 @@ let client = Client() let health = Health(client) -let healthStatus = try await health.getCache() +let healthStatusList = try await health.getCache() diff --git a/docs/examples/health/get-db.md b/docs/examples/health/get-db.md index a6aeb12..2d2f059 100644 --- a/docs/examples/health/get-db.md +++ b/docs/examples/health/get-db.md @@ -7,5 +7,5 @@ let client = Client() let health = Health(client) -let healthStatus = try await health.getDB() +let healthStatusList = try await health.getDB() diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md index 9a7766c..cc5acc7 100644 --- a/docs/examples/health/get-pub-sub.md +++ b/docs/examples/health/get-pub-sub.md @@ -7,5 +7,5 @@ let client = Client() let health = Health(client) -let healthStatus = try await health.getPubSub() +let healthStatusList = try await health.getPubSub() diff --git a/docs/examples/health/get-queue-audits.md b/docs/examples/health/get-queue-audits.md new file mode 100644 index 0000000..271d4d0 --- /dev/null +++ b/docs/examples/health/get-queue-audits.md @@ -0,0 +1,13 @@ +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.getQueueAudits( + threshold: 0 // optional +) + diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md index 3620c62..40343d1 100644 --- a/docs/examples/tablesdb/create-index.md +++ b/docs/examples/tablesdb/create-index.md @@ -14,7 +14,7 @@ let columnIndex = try await tablesDB.createIndex( key: "", type: .key, columns: [], - orders: [], // optional + orders: [.asc], // optional lengths: [] // optional ) diff --git a/docs/examples/tablesdb/get-column.md b/docs/examples/tablesdb/get-column.md index 2d88b03..8cb697a 100644 --- a/docs/examples/tablesdb/get-column.md +++ b/docs/examples/tablesdb/get-column.md @@ -7,7 +7,7 @@ let client = Client() let tablesDB = TablesDB(client) -let result = try await tablesDB.getColumn( +let columnBoolean = try await tablesDB.getColumn( databaseId: "", tableId: "", key: "" diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md index d13df3a..c785b62 100644 --- a/docs/examples/tablesdb/update-row.md +++ b/docs/examples/tablesdb/update-row.md @@ -11,7 +11,13 @@ let row = try await tablesDB.updateRow( databaseId: "", tableId: "", rowId: "", - data: [:], // optional + data: [ + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": false + ], // optional permissions: [Permission.read(Role.any())], // optional transactionId: "" // optional ) diff --git a/docs/examples/tablesdb/update-rows.md b/docs/examples/tablesdb/update-rows.md index f18a2a3..035572c 100644 --- a/docs/examples/tablesdb/update-rows.md +++ b/docs/examples/tablesdb/update-rows.md @@ -10,7 +10,13 @@ let tablesDB = TablesDB(client) let rowList = try await tablesDB.updateRows( databaseId: "", tableId: "", - data: [:], // optional + data: [ + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": false + ], // optional queries: [], // optional transactionId: "" // optional ) diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md index 1f843b2..bfd397b 100644 --- a/docs/examples/tablesdb/update-table.md +++ b/docs/examples/tablesdb/update-table.md @@ -10,7 +10,7 @@ let tablesDB = TablesDB(client) let table = try await tablesDB.updateTable( databaseId: "", tableId: "", - name: "", + name: "", // optional permissions: [Permission.read(Role.any())], // optional rowSecurity: false, // optional enabled: false // optional diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md index 4a7dcc8..75aaf1f 100644 --- a/docs/examples/tablesdb/update.md +++ b/docs/examples/tablesdb/update.md @@ -9,7 +9,7 @@ let tablesDB = TablesDB(client) let database = try await tablesDB.update( databaseId: "", - name: "", + name: "", // optional enabled: false // optional ) diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md index e6fec83..fc7f454 100644 --- a/docs/examples/tablesdb/upsert-row.md +++ b/docs/examples/tablesdb/upsert-row.md @@ -11,7 +11,13 @@ let row = try await tablesDB.upsertRow( databaseId: "", tableId: "", rowId: "", - data: [:], // optional + data: [ + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": false + ], // optional permissions: [Permission.read(Role.any())], // optional transactionId: "" // optional ) diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index 9010372..cb21e9c 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -1,4 +1,5 @@ import Appwrite +import AppwriteEnums let client = Client() .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint @@ -9,7 +10,7 @@ let teams = Teams(client) let membership = try await teams.createMembership( teamId: "", - roles: [], + roles: [.admin], email: "email@example.com", // optional userId: "", // optional phone: "+12065550100", // optional diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md index 47f28e7..b2a85d0 100644 --- a/docs/examples/teams/update-membership.md +++ b/docs/examples/teams/update-membership.md @@ -1,4 +1,5 @@ import Appwrite +import AppwriteEnums let client = Client() .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint @@ -10,6 +11,6 @@ let teams = Teams(client) let membership = try await teams.updateMembership( teamId: "", membershipId: "", - roles: [] + roles: [.admin] )