From 66559602d469b8f11b0dbdf119f0ef5fd31541eb Mon Sep 17 00:00:00 2001 From: root Date: Fri, 26 Sep 2025 09:10:22 +0000 Subject: [PATCH 1/3] chore: regenerate sdks --- README.md | 2 +- Sources/Appwrite/Client.swift | 2 +- Sources/Appwrite/Query.swift | 6 --- Sources/Appwrite/Services/Account.swift | 44 +++++++++---------- Sources/Appwrite/Services/Avatars.swift | 12 ++--- Sources/Appwrite/Services/Databases.swift | 16 +++---- Sources/Appwrite/Services/Functions.swift | 20 ++++----- Sources/Appwrite/Services/Health.swift | 4 +- Sources/Appwrite/Services/Messaging.swift | 24 +++++----- Sources/Appwrite/Services/Sites.swift | 32 +++++++------- Sources/Appwrite/Services/Storage.swift | 16 +++---- Sources/Appwrite/Services/TablesDb.swift | 16 +++---- Sources/Appwrite/Services/Users.swift | 20 ++++----- Sources/AppwriteEnums/AttributeStatus.swift | 13 ++++++ Sources/AppwriteEnums/DeploymentStatus.swift | 13 ++++++ Sources/AppwriteEnums/ExecutionStatus.swift | 12 +++++ Sources/AppwriteEnums/ExecutionTrigger.swift | 11 +++++ .../AppwriteEnums/HealthAntivirusStatus.swift | 11 +++++ Sources/AppwriteEnums/HealthCheckStatus.swift | 10 +++++ Sources/AppwriteEnums/IndexStatus.swift | 13 ++++++ Sources/AppwriteEnums/MessageStatus.swift | 13 ++++++ Sources/AppwriteModels/AttributeBoolean.swift | 13 +++--- .../AppwriteModels/AttributeDatetime.swift | 13 +++--- Sources/AppwriteModels/AttributeEmail.swift | 13 +++--- Sources/AppwriteModels/AttributeEnum.swift | 13 +++--- Sources/AppwriteModels/AttributeFloat.swift | 13 +++--- Sources/AppwriteModels/AttributeInteger.swift | 13 +++--- Sources/AppwriteModels/AttributeIp.swift | 13 +++--- Sources/AppwriteModels/AttributeLine.swift | 13 +++--- Sources/AppwriteModels/AttributePoint.swift | 13 +++--- Sources/AppwriteModels/AttributePolygon.swift | 13 +++--- .../AttributeRelationship.swift | 13 +++--- Sources/AppwriteModels/AttributeString.swift | 13 +++--- Sources/AppwriteModels/AttributeUrl.swift | 13 +++--- Sources/AppwriteModels/Deployment.swift | 13 +++--- Sources/AppwriteModels/Execution.swift | 25 ++++++----- Sources/AppwriteModels/HealthAntivirus.swift | 13 +++--- Sources/AppwriteModels/HealthStatus.swift | 13 +++--- Sources/AppwriteModels/Index.swift | 13 +++--- Sources/AppwriteModels/Message.swift | 13 +++--- 40 files changed, 339 insertions(+), 230 deletions(-) create mode 100644 Sources/AppwriteEnums/AttributeStatus.swift create mode 100644 Sources/AppwriteEnums/DeploymentStatus.swift create mode 100644 Sources/AppwriteEnums/ExecutionStatus.swift create mode 100644 Sources/AppwriteEnums/ExecutionTrigger.swift create mode 100644 Sources/AppwriteEnums/HealthAntivirusStatus.swift create mode 100644 Sources/AppwriteEnums/HealthCheckStatus.swift create mode 100644 Sources/AppwriteEnums/IndexStatus.swift create mode 100644 Sources/AppwriteEnums/MessageStatus.swift diff --git a/README.md b/README.md index 5b4b75c..b570ee7 100644 --- a/README.md +++ b/README.md @@ -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: "12.1.0"), + .package(url: "git@github.com:appwrite/sdk-for-swift.git", from: "12.2.0"), ], ``` diff --git a/Sources/Appwrite/Client.swift b/Sources/Appwrite/Client.swift index 74ef9fd..d588549 100644 --- a/Sources/Appwrite/Client.swift +++ b/Sources/Appwrite/Client.swift @@ -21,7 +21,7 @@ open class Client { "x-sdk-name": "Swift", "x-sdk-platform": "server", "x-sdk-language": "swift", - "x-sdk-version": "12.1.0", + "x-sdk-version": "12.2.0", "x-appwrite-response-format": "1.8.0" ] diff --git a/Sources/Appwrite/Query.swift b/Sources/Appwrite/Query.swift index e4f06b5..5af7f4a 100644 --- a/Sources/Appwrite/Query.swift +++ b/Sources/Appwrite/Query.swift @@ -280,12 +280,6 @@ public struct Query : Codable, CustomStringConvertible { ).description } - public static func orderRandom() -> String { - return Query( - method: "orderRandom" - ).description - } - public static func cursorBefore(_ id: String) -> String { return Query( method: "cursorBefore", diff --git a/Sources/Appwrite/Services/Account.swift b/Sources/Appwrite/Services/Account.swift index 2505dd3..de81dfa 100644 --- a/Sources/Appwrite/Services/Account.swift +++ b/Sources/Appwrite/Services/Account.swift @@ -387,13 +387,13 @@ open class Account: Service { /// method. /// /// - Parameters: - /// - type: AppwriteEnums.AuthenticatorType + /// - type: AuthenticatorType /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.MfaType /// @available(*, deprecated, message: "This API has been deprecated since 1.8.0. Please use `Account.createMFAAuthenticator` instead.") open func createMfaAuthenticator( - type: AppwriteEnums.AuthenticatorType + type: AuthenticatorType ) async throws -> AppwriteModels.MfaType { let apiPath: String = "/account/mfa/authenticators/{type}" .replacingOccurrences(of: "{type}", with: type.rawValue) @@ -424,12 +424,12 @@ open class Account: Service { /// method. /// /// - Parameters: - /// - type: AppwriteEnums.AuthenticatorType + /// - type: AuthenticatorType /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.MfaType /// open func createMFAAuthenticator( - type: AppwriteEnums.AuthenticatorType + type: AuthenticatorType ) async throws -> AppwriteModels.MfaType { let apiPath: String = "/account/mfa/authenticators/{type}" .replacingOccurrences(of: "{type}", with: type.rawValue) @@ -459,14 +459,14 @@ open class Account: Service { /// method. /// /// - Parameters: - /// - type: AppwriteEnums.AuthenticatorType + /// - type: AuthenticatorType /// - otp: String /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.User /// @available(*, deprecated, message: "This API has been deprecated since 1.8.0. Please use `Account.updateMFAAuthenticator` instead.") open func updateMfaAuthenticator( - type: AppwriteEnums.AuthenticatorType, + type: AuthenticatorType, otp: String, nestedType: T.Type ) async throws -> AppwriteModels.User { @@ -500,14 +500,14 @@ open class Account: Service { /// method. /// /// - Parameters: - /// - type: AppwriteEnums.AuthenticatorType + /// - type: AuthenticatorType /// - otp: String /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.User /// @available(*, deprecated, message: "This API has been deprecated since 1.8.0. Please use `Account.updateMFAAuthenticator` instead.") open func updateMfaAuthenticator( - type: AppwriteEnums.AuthenticatorType, + type: AuthenticatorType, otp: String ) async throws -> AppwriteModels.User<[String: AnyCodable]> { return try await updateMfaAuthenticator( @@ -523,13 +523,13 @@ open class Account: Service { /// method. /// /// - Parameters: - /// - type: AppwriteEnums.AuthenticatorType + /// - type: AuthenticatorType /// - otp: String /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.User /// open func updateMFAAuthenticator( - type: AppwriteEnums.AuthenticatorType, + type: AuthenticatorType, otp: String, nestedType: T.Type ) async throws -> AppwriteModels.User { @@ -563,13 +563,13 @@ open class Account: Service { /// method. /// /// - Parameters: - /// - type: AppwriteEnums.AuthenticatorType + /// - type: AuthenticatorType /// - otp: String /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.User /// open func updateMFAAuthenticator( - type: AppwriteEnums.AuthenticatorType, + type: AuthenticatorType, otp: String ) async throws -> AppwriteModels.User<[String: AnyCodable]> { return try await updateMFAAuthenticator( @@ -583,13 +583,13 @@ open class Account: Service { /// Delete an authenticator for a user by ID. /// /// - Parameters: - /// - type: AppwriteEnums.AuthenticatorType + /// - type: AuthenticatorType /// - Throws: Exception if the request fails /// - Returns: Any /// @available(*, deprecated, message: "This API has been deprecated since 1.8.0. Please use `Account.deleteMFAAuthenticator` instead.") open func deleteMfaAuthenticator( - type: AppwriteEnums.AuthenticatorType + type: AuthenticatorType ) async throws -> Any { let apiPath: String = "/account/mfa/authenticators/{type}" .replacingOccurrences(of: "{type}", with: type.rawValue) @@ -611,12 +611,12 @@ open class Account: Service { /// Delete an authenticator for a user by ID. /// /// - Parameters: - /// - type: AppwriteEnums.AuthenticatorType + /// - type: AuthenticatorType /// - Throws: Exception if the request fails /// - Returns: Any /// open func deleteMFAAuthenticator( - type: AppwriteEnums.AuthenticatorType + type: AuthenticatorType ) async throws -> Any { let apiPath: String = "/account/mfa/authenticators/{type}" .replacingOccurrences(of: "{type}", with: type.rawValue) @@ -640,13 +640,13 @@ open class Account: Service { /// method. /// /// - Parameters: - /// - factor: AppwriteEnums.AuthenticationFactor + /// - factor: AuthenticationFactor /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.MfaChallenge /// @available(*, deprecated, message: "This API has been deprecated since 1.8.0. Please use `Account.createMFAChallenge` instead.") open func createMfaChallenge( - factor: AppwriteEnums.AuthenticationFactor + factor: AuthenticationFactor ) async throws -> AppwriteModels.MfaChallenge { let apiPath: String = "/account/mfa/challenge" @@ -677,12 +677,12 @@ open class Account: Service { /// method. /// /// - Parameters: - /// - factor: AppwriteEnums.AuthenticationFactor + /// - factor: AuthenticationFactor /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.MfaChallenge /// open func createMFAChallenge( - factor: AppwriteEnums.AuthenticationFactor + factor: AuthenticationFactor ) async throws -> AppwriteModels.MfaChallenge { let apiPath: String = "/account/mfa/challenge" @@ -1927,7 +1927,7 @@ open class Account: Service { /// limits](https://appwrite.io/docs/authentication-security#limits). /// /// - Parameters: - /// - provider: AppwriteEnums.OAuthProvider + /// - provider: OAuthProvider /// - success: String (optional) /// - failure: String (optional) /// - scopes: [String] (optional) @@ -1935,7 +1935,7 @@ open class Account: Service { /// - Returns: String? /// open func createOAuth2Token( - provider: AppwriteEnums.OAuthProvider, + provider: OAuthProvider, success: String? = nil, failure: String? = nil, scopes: [String]? = nil diff --git a/Sources/Appwrite/Services/Avatars.swift b/Sources/Appwrite/Services/Avatars.swift index 24f4b07..0ca8695 100644 --- a/Sources/Appwrite/Services/Avatars.swift +++ b/Sources/Appwrite/Services/Avatars.swift @@ -21,7 +21,7 @@ open class Avatars: Service { /// of image returned is 100x100px. /// /// - Parameters: - /// - code: AppwriteEnums.Browser + /// - code: Browser /// - width: Int (optional) /// - height: Int (optional) /// - quality: Int (optional) @@ -29,7 +29,7 @@ open class Avatars: Service { /// - Returns: ByteBuffer /// open func getBrowser( - code: AppwriteEnums.Browser, + code: Browser, width: Int? = nil, height: Int? = nil, quality: Int? = nil @@ -66,7 +66,7 @@ open class Avatars: Service { /// /// /// - Parameters: - /// - code: AppwriteEnums.CreditCard + /// - code: CreditCard /// - width: Int (optional) /// - height: Int (optional) /// - quality: Int (optional) @@ -74,7 +74,7 @@ open class Avatars: Service { /// - Returns: ByteBuffer /// open func getCreditCard( - code: AppwriteEnums.CreditCard, + code: CreditCard, width: Int? = nil, height: Int? = nil, quality: Int? = nil @@ -143,7 +143,7 @@ open class Avatars: Service { /// /// /// - Parameters: - /// - code: AppwriteEnums.Flag + /// - code: Flag /// - width: Int (optional) /// - height: Int (optional) /// - quality: Int (optional) @@ -151,7 +151,7 @@ open class Avatars: Service { /// - Returns: ByteBuffer /// open func getFlag( - code: AppwriteEnums.Flag, + code: Flag, width: Int? = nil, height: Int? = nil, quality: Int? = nil diff --git a/Sources/Appwrite/Services/Databases.swift b/Sources/Appwrite/Services/Databases.swift index 03c7f4a..bc806a1 100644 --- a/Sources/Appwrite/Services/Databases.swift +++ b/Sources/Appwrite/Services/Databases.swift @@ -1494,11 +1494,11 @@ open class Databases: Service { /// - databaseId: String /// - collectionId: String /// - relatedCollectionId: String - /// - type: AppwriteEnums.RelationshipType + /// - type: RelationshipType /// - twoWay: Bool (optional) /// - key: String (optional) /// - twoWayKey: String (optional) - /// - onDelete: AppwriteEnums.RelationMutate (optional) + /// - onDelete: RelationMutate (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.AttributeRelationship /// @@ -1507,11 +1507,11 @@ open class Databases: Service { databaseId: String, collectionId: String, relatedCollectionId: String, - type: AppwriteEnums.RelationshipType, + type: RelationshipType, twoWay: Bool? = nil, key: String? = nil, twoWayKey: String? = nil, - onDelete: AppwriteEnums.RelationMutate? = nil + onDelete: RelationMutate? = nil ) async throws -> AppwriteModels.AttributeRelationship { let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/relationship" .replacingOccurrences(of: "{databaseId}", with: databaseId) @@ -1833,7 +1833,7 @@ open class Databases: Service { /// - databaseId: String /// - collectionId: String /// - key: String - /// - onDelete: AppwriteEnums.RelationMutate (optional) + /// - onDelete: RelationMutate (optional) /// - newKey: String (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.AttributeRelationship @@ -1843,7 +1843,7 @@ open class Databases: Service { databaseId: String, collectionId: String, key: String, - onDelete: AppwriteEnums.RelationMutate? = nil, + onDelete: RelationMutate? = nil, newKey: String? = nil ) async throws -> AppwriteModels.AttributeRelationship { let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship" @@ -2799,7 +2799,7 @@ open class Databases: Service { /// - databaseId: String /// - collectionId: String /// - key: String - /// - type: AppwriteEnums.IndexType + /// - type: IndexType /// - attributes: [String] /// - orders: [String] (optional) /// - lengths: [Int] (optional) @@ -2811,7 +2811,7 @@ open class Databases: Service { databaseId: String, collectionId: String, key: String, - type: AppwriteEnums.IndexType, + type: IndexType, attributes: [String], orders: [String]? = nil, lengths: [Int]? = nil diff --git a/Sources/Appwrite/Services/Functions.swift b/Sources/Appwrite/Services/Functions.swift index a26353f..2fef786 100644 --- a/Sources/Appwrite/Services/Functions.swift +++ b/Sources/Appwrite/Services/Functions.swift @@ -53,7 +53,7 @@ open class Functions: Service { /// - Parameters: /// - functionId: String /// - name: String - /// - runtime: AppwriteEnums.Runtime + /// - runtime: Runtime /// - execute: [String] (optional) /// - events: [String] (optional) /// - schedule: String (optional) @@ -75,7 +75,7 @@ open class Functions: Service { open func create( functionId: String, name: String, - runtime: AppwriteEnums.Runtime, + runtime: Runtime, execute: [String]? = nil, events: [String]? = nil, schedule: String? = nil, @@ -223,7 +223,7 @@ open class Functions: Service { /// - Parameters: /// - functionId: String /// - name: String - /// - runtime: AppwriteEnums.Runtime (optional) + /// - runtime: Runtime (optional) /// - execute: [String] (optional) /// - events: [String] (optional) /// - schedule: String (optional) @@ -245,7 +245,7 @@ open class Functions: Service { open func update( functionId: String, name: String, - runtime: AppwriteEnums.Runtime? = nil, + runtime: Runtime? = nil, execute: [String]? = nil, events: [String]? = nil, schedule: String? = nil, @@ -570,7 +570,7 @@ open class Functions: Service { /// /// - Parameters: /// - functionId: String - /// - type: AppwriteEnums.VCSDeploymentType + /// - type: VCSDeploymentType /// - reference: String /// - activate: Bool (optional) /// - Throws: Exception if the request fails @@ -578,7 +578,7 @@ open class Functions: Service { /// open func createVcsDeployment( functionId: String, - type: AppwriteEnums.VCSDeploymentType, + type: VCSDeploymentType, reference: String, activate: Bool? = nil ) async throws -> AppwriteModels.Deployment { @@ -680,14 +680,14 @@ open class Functions: Service { /// - Parameters: /// - functionId: String /// - deploymentId: String - /// - type: AppwriteEnums.DeploymentDownloadType (optional) + /// - type: DeploymentDownloadType (optional) /// - Throws: Exception if the request fails /// - Returns: ByteBuffer /// open func getDeploymentDownload( functionId: String, deploymentId: String, - type: AppwriteEnums.DeploymentDownloadType? = nil + type: DeploymentDownloadType? = nil ) async throws -> ByteBuffer { let apiPath: String = "/functions/{functionId}/deployments/{deploymentId}/download" .replacingOccurrences(of: "{functionId}", with: functionId) @@ -795,7 +795,7 @@ open class Functions: Service { /// - body: String (optional) /// - async: Bool (optional) /// - path: String (optional) - /// - method: AppwriteEnums.ExecutionMethod (optional) + /// - method: ExecutionMethod (optional) /// - headers: Any (optional) /// - scheduledAt: String (optional) /// - Throws: Exception if the request fails @@ -806,7 +806,7 @@ open class Functions: Service { body: String? = nil, async: Bool? = nil, path: String? = nil, - method: AppwriteEnums.ExecutionMethod? = nil, + method: ExecutionMethod? = nil, headers: Any? = nil, scheduledAt: String? = nil ) async throws -> AppwriteModels.Execution { diff --git a/Sources/Appwrite/Services/Health.swift b/Sources/Appwrite/Services/Health.swift index e0bab3d..3add80b 100644 --- a/Sources/Appwrite/Services/Health.swift +++ b/Sources/Appwrite/Services/Health.swift @@ -317,13 +317,13 @@ open class Health: Service { /// /// /// - Parameters: - /// - name: AppwriteEnums.Name + /// - name: Name /// - threshold: Int (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.HealthQueue /// open func getFailedJobs( - name: AppwriteEnums.Name, + name: Name, threshold: Int? = nil ) async throws -> AppwriteModels.HealthQueue { let apiPath: String = "/health/queue/failed/{name}" diff --git a/Sources/Appwrite/Services/Messaging.swift b/Sources/Appwrite/Services/Messaging.swift index 1b97c72..894bc42 100644 --- a/Sources/Appwrite/Services/Messaging.swift +++ b/Sources/Appwrite/Services/Messaging.swift @@ -202,7 +202,7 @@ open class Messaging: Service { /// - scheduledAt: String (optional) /// - contentAvailable: Bool (optional) /// - critical: Bool (optional) - /// - priority: AppwriteEnums.MessagePriority (optional) + /// - priority: MessagePriority (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.Message /// @@ -225,7 +225,7 @@ open class Messaging: Service { scheduledAt: String? = nil, contentAvailable: Bool? = nil, critical: Bool? = nil, - priority: AppwriteEnums.MessagePriority? = nil + priority: MessagePriority? = nil ) async throws -> AppwriteModels.Message { let apiPath: String = "/messaging/messages/push" @@ -293,7 +293,7 @@ open class Messaging: Service { /// - scheduledAt: String (optional) /// - contentAvailable: Bool (optional) /// - critical: Bool (optional) - /// - priority: AppwriteEnums.MessagePriority (optional) + /// - priority: MessagePriority (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.Message /// @@ -316,7 +316,7 @@ open class Messaging: Service { scheduledAt: String? = nil, contentAvailable: Bool? = nil, critical: Bool? = nil, - priority: AppwriteEnums.MessagePriority? = nil + priority: MessagePriority? = nil ) async throws -> AppwriteModels.Message { let apiPath: String = "/messaging/messages/push/{messageId}" .replacingOccurrences(of: "{messageId}", with: messageId) @@ -1476,7 +1476,7 @@ open class Messaging: Service { /// - port: Int (optional) /// - username: String (optional) /// - password: String (optional) - /// - encryption: AppwriteEnums.SmtpEncryption (optional) + /// - encryption: SmtpEncryption (optional) /// - autoTLS: Bool (optional) /// - mailer: String (optional) /// - fromName: String (optional) @@ -1495,7 +1495,7 @@ open class Messaging: Service { port: Int? = nil, username: String? = nil, password: String? = nil, - encryption: AppwriteEnums.SmtpEncryption? = nil, + encryption: SmtpEncryption? = nil, autoTLS: Bool? = nil, mailer: String? = nil, fromName: String? = nil, @@ -1550,7 +1550,7 @@ open class Messaging: Service { /// - port: Int (optional) /// - username: String (optional) /// - password: String (optional) - /// - encryption: AppwriteEnums.SmtpEncryption (optional) + /// - encryption: SmtpEncryption (optional) /// - autoTLS: Bool (optional) /// - mailer: String (optional) /// - fromName: String (optional) @@ -1568,7 +1568,7 @@ open class Messaging: Service { port: Int? = nil, username: String? = nil, password: String? = nil, - encryption: AppwriteEnums.SmtpEncryption? = nil, + encryption: SmtpEncryption? = nil, autoTLS: Bool? = nil, mailer: String? = nil, fromName: String? = nil, @@ -1623,7 +1623,7 @@ open class Messaging: Service { /// - port: Int (optional) /// - username: String (optional) /// - password: String (optional) - /// - encryption: AppwriteEnums.SmtpEncryption (optional) + /// - encryption: SmtpEncryption (optional) /// - autoTLS: Bool (optional) /// - mailer: String (optional) /// - fromName: String (optional) @@ -1642,7 +1642,7 @@ open class Messaging: Service { port: Int? = nil, username: String? = nil, password: String? = nil, - encryption: AppwriteEnums.SmtpEncryption? = nil, + encryption: SmtpEncryption? = nil, autoTLS: Bool? = nil, mailer: String? = nil, fromName: String? = nil, @@ -1697,7 +1697,7 @@ open class Messaging: Service { /// - port: Int (optional) /// - username: String (optional) /// - password: String (optional) - /// - encryption: AppwriteEnums.SmtpEncryption (optional) + /// - encryption: SmtpEncryption (optional) /// - autoTLS: Bool (optional) /// - mailer: String (optional) /// - fromName: String (optional) @@ -1715,7 +1715,7 @@ open class Messaging: Service { port: Int? = nil, username: String? = nil, password: String? = nil, - encryption: AppwriteEnums.SmtpEncryption? = nil, + encryption: SmtpEncryption? = nil, autoTLS: Bool? = nil, mailer: String? = nil, fromName: String? = nil, diff --git a/Sources/Appwrite/Services/Sites.swift b/Sources/Appwrite/Services/Sites.swift index 290e495..9e7a462 100644 --- a/Sources/Appwrite/Services/Sites.swift +++ b/Sources/Appwrite/Services/Sites.swift @@ -50,15 +50,15 @@ open class Sites: Service { /// - Parameters: /// - siteId: String /// - name: String - /// - framework: AppwriteEnums.Framework - /// - buildRuntime: AppwriteEnums.BuildRuntime + /// - framework: Framework + /// - buildRuntime: BuildRuntime /// - enabled: Bool (optional) /// - logging: Bool (optional) /// - timeout: Int (optional) /// - installCommand: String (optional) /// - buildCommand: String (optional) /// - outputDirectory: String (optional) - /// - adapter: AppwriteEnums.Adapter (optional) + /// - adapter: Adapter (optional) /// - installationId: String (optional) /// - fallbackFile: String (optional) /// - providerRepositoryId: String (optional) @@ -72,15 +72,15 @@ open class Sites: Service { open func create( siteId: String, name: String, - framework: AppwriteEnums.Framework, - buildRuntime: AppwriteEnums.BuildRuntime, + framework: Framework, + buildRuntime: BuildRuntime, enabled: Bool? = nil, logging: Bool? = nil, timeout: Int? = nil, installCommand: String? = nil, buildCommand: String? = nil, outputDirectory: String? = nil, - adapter: AppwriteEnums.Adapter? = nil, + adapter: Adapter? = nil, installationId: String? = nil, fallbackFile: String? = nil, providerRepositoryId: String? = nil, @@ -221,15 +221,15 @@ open class Sites: Service { /// - Parameters: /// - siteId: String /// - name: String - /// - framework: AppwriteEnums.Framework + /// - framework: Framework /// - enabled: Bool (optional) /// - logging: Bool (optional) /// - timeout: Int (optional) /// - installCommand: String (optional) /// - buildCommand: String (optional) /// - outputDirectory: String (optional) - /// - buildRuntime: AppwriteEnums.BuildRuntime (optional) - /// - adapter: AppwriteEnums.Adapter (optional) + /// - buildRuntime: BuildRuntime (optional) + /// - adapter: Adapter (optional) /// - fallbackFile: String (optional) /// - installationId: String (optional) /// - providerRepositoryId: String (optional) @@ -243,15 +243,15 @@ open class Sites: Service { open func update( siteId: String, name: String, - framework: AppwriteEnums.Framework, + framework: Framework, enabled: Bool? = nil, logging: Bool? = nil, timeout: Int? = nil, installCommand: String? = nil, buildCommand: String? = nil, outputDirectory: String? = nil, - buildRuntime: AppwriteEnums.BuildRuntime? = nil, - adapter: AppwriteEnums.Adapter? = nil, + buildRuntime: BuildRuntime? = nil, + adapter: Adapter? = nil, fallbackFile: String? = nil, installationId: String? = nil, providerRepositoryId: String? = nil, @@ -561,7 +561,7 @@ open class Sites: Service { /// /// - Parameters: /// - siteId: String - /// - type: AppwriteEnums.VCSDeploymentType + /// - type: VCSDeploymentType /// - reference: String /// - activate: Bool (optional) /// - Throws: Exception if the request fails @@ -569,7 +569,7 @@ open class Sites: Service { /// open func createVcsDeployment( siteId: String, - type: AppwriteEnums.VCSDeploymentType, + type: VCSDeploymentType, reference: String, activate: Bool? = nil ) async throws -> AppwriteModels.Deployment { @@ -671,14 +671,14 @@ open class Sites: Service { /// - Parameters: /// - siteId: String /// - deploymentId: String - /// - type: AppwriteEnums.DeploymentDownloadType (optional) + /// - type: DeploymentDownloadType (optional) /// - Throws: Exception if the request fails /// - Returns: ByteBuffer /// open func getDeploymentDownload( siteId: String, deploymentId: String, - type: AppwriteEnums.DeploymentDownloadType? = nil + type: DeploymentDownloadType? = nil ) async throws -> ByteBuffer { let apiPath: String = "/sites/{siteId}/deployments/{deploymentId}/download" .replacingOccurrences(of: "{siteId}", with: siteId) diff --git a/Sources/Appwrite/Services/Storage.swift b/Sources/Appwrite/Services/Storage.swift index 7852911..a3e0096 100644 --- a/Sources/Appwrite/Services/Storage.swift +++ b/Sources/Appwrite/Services/Storage.swift @@ -55,7 +55,7 @@ open class Storage: Service { /// - enabled: Bool (optional) /// - maximumFileSize: Int (optional) /// - allowedFileExtensions: [String] (optional) - /// - compression: AppwriteEnums.Compression (optional) + /// - compression: Compression (optional) /// - encryption: Bool (optional) /// - antivirus: Bool (optional) /// - Throws: Exception if the request fails @@ -69,7 +69,7 @@ open class Storage: Service { enabled: Bool? = nil, maximumFileSize: Int? = nil, allowedFileExtensions: [String]? = nil, - compression: AppwriteEnums.Compression? = nil, + compression: Compression? = nil, encryption: Bool? = nil, antivirus: Bool? = nil ) async throws -> AppwriteModels.Bucket { @@ -148,7 +148,7 @@ open class Storage: Service { /// - enabled: Bool (optional) /// - maximumFileSize: Int (optional) /// - allowedFileExtensions: [String] (optional) - /// - compression: AppwriteEnums.Compression (optional) + /// - compression: Compression (optional) /// - encryption: Bool (optional) /// - antivirus: Bool (optional) /// - Throws: Exception if the request fails @@ -162,7 +162,7 @@ open class Storage: Service { enabled: Bool? = nil, maximumFileSize: Int? = nil, allowedFileExtensions: [String]? = nil, - compression: AppwriteEnums.Compression? = nil, + compression: Compression? = nil, encryption: Bool? = nil, antivirus: Bool? = nil ) async throws -> AppwriteModels.Bucket { @@ -487,7 +487,7 @@ open class Storage: Service { /// - fileId: String /// - width: Int (optional) /// - height: Int (optional) - /// - gravity: AppwriteEnums.ImageGravity (optional) + /// - gravity: ImageGravity (optional) /// - quality: Int (optional) /// - borderWidth: Int (optional) /// - borderColor: String (optional) @@ -495,7 +495,7 @@ open class Storage: Service { /// - opacity: Double (optional) /// - rotation: Int (optional) /// - background: String (optional) - /// - output: AppwriteEnums.ImageFormat (optional) + /// - output: ImageFormat (optional) /// - token: String (optional) /// - Throws: Exception if the request fails /// - Returns: ByteBuffer @@ -505,7 +505,7 @@ open class Storage: Service { fileId: String, width: Int? = nil, height: Int? = nil, - gravity: AppwriteEnums.ImageGravity? = nil, + gravity: ImageGravity? = nil, quality: Int? = nil, borderWidth: Int? = nil, borderColor: String? = nil, @@ -513,7 +513,7 @@ open class Storage: Service { opacity: Double? = nil, rotation: Int? = nil, background: String? = nil, - output: AppwriteEnums.ImageFormat? = nil, + output: ImageFormat? = nil, token: String? = nil ) async throws -> ByteBuffer { let apiPath: String = "/storage/buckets/{bucketId}/files/{fileId}/preview" diff --git a/Sources/Appwrite/Services/TablesDb.swift b/Sources/Appwrite/Services/TablesDb.swift index 8bbbf4c..75535ea 100644 --- a/Sources/Appwrite/Services/TablesDb.swift +++ b/Sources/Appwrite/Services/TablesDb.swift @@ -1462,11 +1462,11 @@ open class TablesDB: Service { /// - databaseId: String /// - tableId: String /// - relatedTableId: String - /// - type: AppwriteEnums.RelationshipType + /// - type: RelationshipType /// - twoWay: Bool (optional) /// - key: String (optional) /// - twoWayKey: String (optional) - /// - onDelete: AppwriteEnums.RelationMutate (optional) + /// - onDelete: RelationMutate (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.ColumnRelationship /// @@ -1474,11 +1474,11 @@ open class TablesDB: Service { databaseId: String, tableId: String, relatedTableId: String, - type: AppwriteEnums.RelationshipType, + type: RelationshipType, twoWay: Bool? = nil, key: String? = nil, twoWayKey: String? = nil, - onDelete: AppwriteEnums.RelationMutate? = nil + onDelete: RelationMutate? = nil ) async throws -> AppwriteModels.ColumnRelationship { let apiPath: String = "/tablesdb/{databaseId}/tables/{tableId}/columns/relationship" .replacingOccurrences(of: "{databaseId}", with: databaseId) @@ -1794,7 +1794,7 @@ open class TablesDB: Service { /// - databaseId: String /// - tableId: String /// - key: String - /// - onDelete: AppwriteEnums.RelationMutate (optional) + /// - onDelete: RelationMutate (optional) /// - newKey: String (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.ColumnRelationship @@ -1803,7 +1803,7 @@ open class TablesDB: Service { databaseId: String, tableId: String, key: String, - onDelete: AppwriteEnums.RelationMutate? = nil, + onDelete: RelationMutate? = nil, newKey: String? = nil ) async throws -> AppwriteModels.ColumnRelationship { let apiPath: String = "/tablesdb/{databaseId}/tables/{tableId}/columns/{key}/relationship" @@ -1880,7 +1880,7 @@ open class TablesDB: Service { /// - databaseId: String /// - tableId: String /// - key: String - /// - type: AppwriteEnums.IndexType + /// - type: IndexType /// - columns: [String] /// - orders: [String] (optional) /// - lengths: [Int] (optional) @@ -1891,7 +1891,7 @@ open class TablesDB: Service { databaseId: String, tableId: String, key: String, - type: AppwriteEnums.IndexType, + type: IndexType, columns: [String], orders: [String]? = nil, lengths: [Int]? = nil diff --git a/Sources/Appwrite/Services/Users.swift b/Sources/Appwrite/Services/Users.swift index e1ea976..efc3bc5 100644 --- a/Sources/Appwrite/Services/Users.swift +++ b/Sources/Appwrite/Services/Users.swift @@ -720,7 +720,7 @@ open class Users: Service { /// - userId: String /// - email: String /// - password: String - /// - passwordVersion: AppwriteEnums.PasswordHash (optional) + /// - passwordVersion: PasswordHash (optional) /// - name: String (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.User @@ -729,7 +729,7 @@ open class Users: Service { userId: String, email: String, password: String, - passwordVersion: AppwriteEnums.PasswordHash? = nil, + passwordVersion: PasswordHash? = nil, name: String? = nil, nestedType: T.Type ) async throws -> AppwriteModels.User { @@ -770,7 +770,7 @@ open class Users: Service { /// - userId: String /// - email: String /// - password: String - /// - passwordVersion: AppwriteEnums.PasswordHash (optional) + /// - passwordVersion: PasswordHash (optional) /// - name: String (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.User @@ -779,7 +779,7 @@ open class Users: Service { userId: String, email: String, password: String, - passwordVersion: AppwriteEnums.PasswordHash? = nil, + passwordVersion: PasswordHash? = nil, name: String? = nil ) async throws -> AppwriteModels.User<[String: AnyCodable]> { return try await createSHAUser( @@ -1237,14 +1237,14 @@ open class Users: Service { /// /// - Parameters: /// - userId: String - /// - type: AppwriteEnums.AuthenticatorType + /// - type: AuthenticatorType /// - Throws: Exception if the request fails /// - Returns: Any /// @available(*, deprecated, message: "This API has been deprecated since 1.8.0. Please use `Users.deleteMFAAuthenticator` instead.") open func deleteMfaAuthenticator( userId: String, - type: AppwriteEnums.AuthenticatorType + type: AuthenticatorType ) async throws -> Any { let apiPath: String = "/users/{userId}/mfa/authenticators/{type}" .replacingOccurrences(of: "{userId}", with: userId) @@ -1268,13 +1268,13 @@ open class Users: Service { /// /// - Parameters: /// - userId: String - /// - type: AppwriteEnums.AuthenticatorType + /// - type: AuthenticatorType /// - Throws: Exception if the request fails /// - Returns: Any /// open func deleteMFAAuthenticator( userId: String, - type: AppwriteEnums.AuthenticatorType + type: AuthenticatorType ) async throws -> Any { let apiPath: String = "/users/{userId}/mfa/authenticators/{type}" .replacingOccurrences(of: "{userId}", with: userId) @@ -2083,7 +2083,7 @@ open class Users: Service { /// - Parameters: /// - userId: String /// - targetId: String - /// - providerType: AppwriteEnums.MessagingProviderType + /// - providerType: MessagingProviderType /// - identifier: String /// - providerId: String (optional) /// - name: String (optional) @@ -2093,7 +2093,7 @@ open class Users: Service { open func createTarget( userId: String, targetId: String, - providerType: AppwriteEnums.MessagingProviderType, + providerType: MessagingProviderType, identifier: String, providerId: String? = nil, name: String? = nil diff --git a/Sources/AppwriteEnums/AttributeStatus.swift b/Sources/AppwriteEnums/AttributeStatus.swift new file mode 100644 index 0000000..4c6544d --- /dev/null +++ b/Sources/AppwriteEnums/AttributeStatus.swift @@ -0,0 +1,13 @@ +import Foundation + +public enum AttributeStatus: String, CustomStringConvertible { + case available = "available" + case processing = "processing" + case deleting = "deleting" + case stuck = "stuck" + case failed = "failed" + + public var description: String { + return rawValue + } +} diff --git a/Sources/AppwriteEnums/DeploymentStatus.swift b/Sources/AppwriteEnums/DeploymentStatus.swift new file mode 100644 index 0000000..8d82e47 --- /dev/null +++ b/Sources/AppwriteEnums/DeploymentStatus.swift @@ -0,0 +1,13 @@ +import Foundation + +public enum DeploymentStatus: String, CustomStringConvertible { + case waiting = "waiting" + case processing = "processing" + case building = "building" + case ready = "ready" + case failed = "failed" + + public var description: String { + return rawValue + } +} diff --git a/Sources/AppwriteEnums/ExecutionStatus.swift b/Sources/AppwriteEnums/ExecutionStatus.swift new file mode 100644 index 0000000..2f167a9 --- /dev/null +++ b/Sources/AppwriteEnums/ExecutionStatus.swift @@ -0,0 +1,12 @@ +import Foundation + +public enum ExecutionStatus: String, CustomStringConvertible { + case waiting = "waiting" + case processing = "processing" + case completed = "completed" + case failed = "failed" + + public var description: String { + return rawValue + } +} diff --git a/Sources/AppwriteEnums/ExecutionTrigger.swift b/Sources/AppwriteEnums/ExecutionTrigger.swift new file mode 100644 index 0000000..8aecde3 --- /dev/null +++ b/Sources/AppwriteEnums/ExecutionTrigger.swift @@ -0,0 +1,11 @@ +import Foundation + +public enum ExecutionTrigger: String, CustomStringConvertible { + case http = "http" + case schedule = "schedule" + case event = "event" + + public var description: String { + return rawValue + } +} diff --git a/Sources/AppwriteEnums/HealthAntivirusStatus.swift b/Sources/AppwriteEnums/HealthAntivirusStatus.swift new file mode 100644 index 0000000..8b1a814 --- /dev/null +++ b/Sources/AppwriteEnums/HealthAntivirusStatus.swift @@ -0,0 +1,11 @@ +import Foundation + +public enum HealthAntivirusStatus: String, CustomStringConvertible { + case disabled = "disabled" + case offline = "offline" + case online = "online" + + public var description: String { + return rawValue + } +} diff --git a/Sources/AppwriteEnums/HealthCheckStatus.swift b/Sources/AppwriteEnums/HealthCheckStatus.swift new file mode 100644 index 0000000..551d951 --- /dev/null +++ b/Sources/AppwriteEnums/HealthCheckStatus.swift @@ -0,0 +1,10 @@ +import Foundation + +public enum HealthCheckStatus: String, CustomStringConvertible { + case pass = "pass" + case fail = "fail" + + public var description: String { + return rawValue + } +} diff --git a/Sources/AppwriteEnums/IndexStatus.swift b/Sources/AppwriteEnums/IndexStatus.swift new file mode 100644 index 0000000..cfeb3ff --- /dev/null +++ b/Sources/AppwriteEnums/IndexStatus.swift @@ -0,0 +1,13 @@ +import Foundation + +public enum IndexStatus: String, CustomStringConvertible { + case available = "available" + case processing = "processing" + case deleting = "deleting" + case stuck = "stuck" + case failed = "failed" + + public var description: String { + return rawValue + } +} diff --git a/Sources/AppwriteEnums/MessageStatus.swift b/Sources/AppwriteEnums/MessageStatus.swift new file mode 100644 index 0000000..b53e600 --- /dev/null +++ b/Sources/AppwriteEnums/MessageStatus.swift @@ -0,0 +1,13 @@ +import Foundation + +public enum MessageStatus: String, CustomStringConvertible { + case draft = "draft" + case processing = "processing" + case scheduled = "scheduled" + case sent = "sent" + case failed = "failed" + + public var description: String { + return rawValue + } +} diff --git a/Sources/AppwriteModels/AttributeBoolean.swift b/Sources/AppwriteModels/AttributeBoolean.swift index ffc9325..811ce62 100644 --- a/Sources/AppwriteModels/AttributeBoolean.swift +++ b/Sources/AppwriteModels/AttributeBoolean.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// AttributeBoolean open class AttributeBoolean: Codable { @@ -23,7 +24,7 @@ open class AttributeBoolean: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -47,7 +48,7 @@ open class AttributeBoolean: Codable { init( key: String, type: String, - status: String, + status: AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -71,7 +72,7 @@ open class AttributeBoolean: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -85,7 +86,7 @@ open class AttributeBoolean: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -98,7 +99,7 @@ open class AttributeBoolean: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -112,7 +113,7 @@ open class AttributeBoolean: Codable { return AttributeBoolean( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: AttributeStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/AttributeDatetime.swift b/Sources/AppwriteModels/AttributeDatetime.swift index 1aca4c2..74282bd 100644 --- a/Sources/AppwriteModels/AttributeDatetime.swift +++ b/Sources/AppwriteModels/AttributeDatetime.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// AttributeDatetime open class AttributeDatetime: Codable { @@ -24,7 +25,7 @@ open class AttributeDatetime: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -51,7 +52,7 @@ open class AttributeDatetime: Codable { init( key: String, type: String, - status: String, + status: AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -77,7 +78,7 @@ open class AttributeDatetime: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -92,7 +93,7 @@ open class AttributeDatetime: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -106,7 +107,7 @@ open class AttributeDatetime: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -121,7 +122,7 @@ open class AttributeDatetime: Codable { return AttributeDatetime( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: AttributeStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/AttributeEmail.swift b/Sources/AppwriteModels/AttributeEmail.swift index 1b8bd3f..3f3daf5 100644 --- a/Sources/AppwriteModels/AttributeEmail.swift +++ b/Sources/AppwriteModels/AttributeEmail.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// AttributeEmail open class AttributeEmail: Codable { @@ -24,7 +25,7 @@ open class AttributeEmail: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -51,7 +52,7 @@ open class AttributeEmail: Codable { init( key: String, type: String, - status: String, + status: AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -77,7 +78,7 @@ open class AttributeEmail: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -92,7 +93,7 @@ open class AttributeEmail: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -106,7 +107,7 @@ open class AttributeEmail: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -121,7 +122,7 @@ open class AttributeEmail: Codable { return AttributeEmail( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: AttributeStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/AttributeEnum.swift b/Sources/AppwriteModels/AttributeEnum.swift index 7de4bc0..3f2acfd 100644 --- a/Sources/AppwriteModels/AttributeEnum.swift +++ b/Sources/AppwriteModels/AttributeEnum.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// AttributeEnum open class AttributeEnum: Codable { @@ -25,7 +26,7 @@ open class AttributeEnum: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -55,7 +56,7 @@ open class AttributeEnum: Codable { init( key: String, type: String, - status: String, + status: AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -83,7 +84,7 @@ open class AttributeEnum: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -99,7 +100,7 @@ open class AttributeEnum: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -114,7 +115,7 @@ open class AttributeEnum: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -130,7 +131,7 @@ open class AttributeEnum: Codable { return AttributeEnum( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: AttributeStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/AttributeFloat.swift b/Sources/AppwriteModels/AttributeFloat.swift index e57a8c1..540d6b4 100644 --- a/Sources/AppwriteModels/AttributeFloat.swift +++ b/Sources/AppwriteModels/AttributeFloat.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// AttributeFloat open class AttributeFloat: Codable { @@ -25,7 +26,7 @@ open class AttributeFloat: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -55,7 +56,7 @@ open class AttributeFloat: Codable { init( key: String, type: String, - status: String, + status: AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -83,7 +84,7 @@ open class AttributeFloat: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -99,7 +100,7 @@ open class AttributeFloat: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -114,7 +115,7 @@ open class AttributeFloat: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -130,7 +131,7 @@ open class AttributeFloat: Codable { return AttributeFloat( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: AttributeStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/AttributeInteger.swift b/Sources/AppwriteModels/AttributeInteger.swift index f3251b7..4435497 100644 --- a/Sources/AppwriteModels/AttributeInteger.swift +++ b/Sources/AppwriteModels/AttributeInteger.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// AttributeInteger open class AttributeInteger: Codable { @@ -25,7 +26,7 @@ open class AttributeInteger: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -55,7 +56,7 @@ open class AttributeInteger: Codable { init( key: String, type: String, - status: String, + status: AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -83,7 +84,7 @@ open class AttributeInteger: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -99,7 +100,7 @@ open class AttributeInteger: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -114,7 +115,7 @@ open class AttributeInteger: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -130,7 +131,7 @@ open class AttributeInteger: Codable { return AttributeInteger( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: AttributeStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/AttributeIp.swift b/Sources/AppwriteModels/AttributeIp.swift index b4f628d..61ceefa 100644 --- a/Sources/AppwriteModels/AttributeIp.swift +++ b/Sources/AppwriteModels/AttributeIp.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// AttributeIP open class AttributeIp: Codable { @@ -24,7 +25,7 @@ open class AttributeIp: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -51,7 +52,7 @@ open class AttributeIp: Codable { init( key: String, type: String, - status: String, + status: AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -77,7 +78,7 @@ open class AttributeIp: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -92,7 +93,7 @@ open class AttributeIp: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -106,7 +107,7 @@ open class AttributeIp: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -121,7 +122,7 @@ open class AttributeIp: Codable { return AttributeIp( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: AttributeStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/AttributeLine.swift b/Sources/AppwriteModels/AttributeLine.swift index 8457304..8553459 100644 --- a/Sources/AppwriteModels/AttributeLine.swift +++ b/Sources/AppwriteModels/AttributeLine.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// AttributeLine open class AttributeLine: Codable { @@ -23,7 +24,7 @@ open class AttributeLine: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -47,7 +48,7 @@ open class AttributeLine: Codable { init( key: String, type: String, - status: String, + status: AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -71,7 +72,7 @@ open class AttributeLine: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -85,7 +86,7 @@ open class AttributeLine: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -98,7 +99,7 @@ open class AttributeLine: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -112,7 +113,7 @@ open class AttributeLine: Codable { return AttributeLine( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: AttributeStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/AttributePoint.swift b/Sources/AppwriteModels/AttributePoint.swift index 7c5fc2b..ce29847 100644 --- a/Sources/AppwriteModels/AttributePoint.swift +++ b/Sources/AppwriteModels/AttributePoint.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// AttributePoint open class AttributePoint: Codable { @@ -23,7 +24,7 @@ open class AttributePoint: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -47,7 +48,7 @@ open class AttributePoint: Codable { init( key: String, type: String, - status: String, + status: AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -71,7 +72,7 @@ open class AttributePoint: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -85,7 +86,7 @@ open class AttributePoint: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -98,7 +99,7 @@ open class AttributePoint: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -112,7 +113,7 @@ open class AttributePoint: Codable { return AttributePoint( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: AttributeStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/AttributePolygon.swift b/Sources/AppwriteModels/AttributePolygon.swift index 14cb7fd..07d3657 100644 --- a/Sources/AppwriteModels/AttributePolygon.swift +++ b/Sources/AppwriteModels/AttributePolygon.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// AttributePolygon open class AttributePolygon: Codable { @@ -23,7 +24,7 @@ open class AttributePolygon: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -47,7 +48,7 @@ open class AttributePolygon: Codable { init( key: String, type: String, - status: String, + status: AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -71,7 +72,7 @@ open class AttributePolygon: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -85,7 +86,7 @@ open class AttributePolygon: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -98,7 +99,7 @@ open class AttributePolygon: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -112,7 +113,7 @@ open class AttributePolygon: Codable { return AttributePolygon( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: AttributeStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/AttributeRelationship.swift b/Sources/AppwriteModels/AttributeRelationship.swift index 6a973aa..72d5585 100644 --- a/Sources/AppwriteModels/AttributeRelationship.swift +++ b/Sources/AppwriteModels/AttributeRelationship.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// AttributeRelationship open class AttributeRelationship: Codable { @@ -28,7 +29,7 @@ open class AttributeRelationship: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -67,7 +68,7 @@ open class AttributeRelationship: Codable { init( key: String, type: String, - status: String, + status: AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -101,7 +102,7 @@ open class AttributeRelationship: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -120,7 +121,7 @@ open class AttributeRelationship: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -138,7 +139,7 @@ open class AttributeRelationship: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -157,7 +158,7 @@ open class AttributeRelationship: Codable { return AttributeRelationship( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: AttributeStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/AttributeString.swift b/Sources/AppwriteModels/AttributeString.swift index b9d352b..7a6ab94 100644 --- a/Sources/AppwriteModels/AttributeString.swift +++ b/Sources/AppwriteModels/AttributeString.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// AttributeString open class AttributeString: Codable { @@ -25,7 +26,7 @@ open class AttributeString: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -55,7 +56,7 @@ open class AttributeString: Codable { init( key: String, type: String, - status: String, + status: AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -83,7 +84,7 @@ open class AttributeString: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -99,7 +100,7 @@ open class AttributeString: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -114,7 +115,7 @@ open class AttributeString: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -130,7 +131,7 @@ open class AttributeString: Codable { return AttributeString( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: AttributeStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/AttributeUrl.swift b/Sources/AppwriteModels/AttributeUrl.swift index b6a7a41..c2241d1 100644 --- a/Sources/AppwriteModels/AttributeUrl.swift +++ b/Sources/AppwriteModels/AttributeUrl.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// AttributeURL open class AttributeUrl: Codable { @@ -24,7 +25,7 @@ open class AttributeUrl: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -51,7 +52,7 @@ open class AttributeUrl: Codable { init( key: String, type: String, - status: String, + status: AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -77,7 +78,7 @@ open class AttributeUrl: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -92,7 +93,7 @@ open class AttributeUrl: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -106,7 +107,7 @@ open class AttributeUrl: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -121,7 +122,7 @@ open class AttributeUrl: Codable { return AttributeUrl( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: AttributeStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/Deployment.swift b/Sources/AppwriteModels/Deployment.swift index 888239f..73d5394 100644 --- a/Sources/AppwriteModels/Deployment.swift +++ b/Sources/AppwriteModels/Deployment.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// Deployment open class Deployment: Codable { @@ -77,7 +78,7 @@ open class Deployment: Codable { public let screenshotDark: String /// The deployment status. Possible values are "waiting", "processing", "building", "ready", and "failed". - public let status: String + public let status: DeploymentStatus /// The build logs. public let buildLogs: String @@ -131,7 +132,7 @@ open class Deployment: Codable { activate: Bool, screenshotLight: String, screenshotDark: String, - status: String, + status: DeploymentStatus, buildLogs: String, buildDuration: Int, providerRepositoryName: String, @@ -191,7 +192,7 @@ open class Deployment: Codable { self.activate = try container.decode(Bool.self, forKey: .activate) self.screenshotLight = try container.decode(String.self, forKey: .screenshotLight) self.screenshotDark = try container.decode(String.self, forKey: .screenshotDark) - self.status = try container.decode(String.self, forKey: .status) + self.status = DeploymentStatus(rawValue: try container.decode(String.self, forKey: .status))! self.buildLogs = try container.decode(String.self, forKey: .buildLogs) self.buildDuration = try container.decode(Int.self, forKey: .buildDuration) self.providerRepositoryName = try container.decode(String.self, forKey: .providerRepositoryName) @@ -223,7 +224,7 @@ open class Deployment: Codable { try container.encode(activate, forKey: .activate) try container.encode(screenshotLight, forKey: .screenshotLight) try container.encode(screenshotDark, forKey: .screenshotDark) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(buildLogs, forKey: .buildLogs) try container.encode(buildDuration, forKey: .buildDuration) try container.encode(providerRepositoryName, forKey: .providerRepositoryName) @@ -254,7 +255,7 @@ open class Deployment: Codable { "activate": activate as Any, "screenshotLight": screenshotLight as Any, "screenshotDark": screenshotDark as Any, - "status": status as Any, + "status": status.rawValue as Any, "buildLogs": buildLogs as Any, "buildDuration": buildDuration as Any, "providerRepositoryName": providerRepositoryName as Any, @@ -286,7 +287,7 @@ open class Deployment: Codable { activate: map["activate"] as! Bool, screenshotLight: map["screenshotLight"] as! String, screenshotDark: map["screenshotDark"] as! String, - status: map["status"] as! String, + status: DeploymentStatus(rawValue: map["status"] as! String)!, buildLogs: map["buildLogs"] as! String, buildDuration: map["buildDuration"] as! Int, providerRepositoryName: map["providerRepositoryName"] as! String, diff --git a/Sources/AppwriteModels/Execution.swift b/Sources/AppwriteModels/Execution.swift index 069264b..7972e32 100644 --- a/Sources/AppwriteModels/Execution.swift +++ b/Sources/AppwriteModels/Execution.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// Execution open class Execution: Codable { @@ -44,10 +45,10 @@ open class Execution: Codable { public let deploymentId: String /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. - public let trigger: String + public let trigger: ExecutionTrigger /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - public let status: String + public let status: ExecutionStatus /// HTTP request method type. public let requestMethod: String @@ -87,8 +88,8 @@ open class Execution: Codable { permissions: [String], functionId: String, deploymentId: String, - trigger: String, - status: String, + trigger: ExecutionTrigger, + status: ExecutionStatus, requestMethod: String, requestPath: String, requestHeaders: [Headers], @@ -129,8 +130,8 @@ open class Execution: Codable { self.permissions = try container.decode([String].self, forKey: .permissions) self.functionId = try container.decode(String.self, forKey: .functionId) self.deploymentId = try container.decode(String.self, forKey: .deploymentId) - self.trigger = try container.decode(String.self, forKey: .trigger) - self.status = try container.decode(String.self, forKey: .status) + self.trigger = ExecutionTrigger(rawValue: try container.decode(String.self, forKey: .trigger))! + self.status = ExecutionStatus(rawValue: try container.decode(String.self, forKey: .status))! self.requestMethod = try container.decode(String.self, forKey: .requestMethod) self.requestPath = try container.decode(String.self, forKey: .requestPath) self.requestHeaders = try container.decode([Headers].self, forKey: .requestHeaders) @@ -152,8 +153,8 @@ open class Execution: Codable { try container.encode(permissions, forKey: .permissions) try container.encode(functionId, forKey: .functionId) try container.encode(deploymentId, forKey: .deploymentId) - try container.encode(trigger, forKey: .trigger) - try container.encode(status, forKey: .status) + try container.encode(trigger.rawValue, forKey: .trigger) + try container.encode(status.rawValue, forKey: .status) try container.encode(requestMethod, forKey: .requestMethod) try container.encode(requestPath, forKey: .requestPath) try container.encode(requestHeaders, forKey: .requestHeaders) @@ -174,8 +175,8 @@ open class Execution: Codable { "$permissions": permissions as Any, "functionId": functionId as Any, "deploymentId": deploymentId as Any, - "trigger": trigger as Any, - "status": status as Any, + "trigger": trigger.rawValue as Any, + "status": status.rawValue as Any, "requestMethod": requestMethod as Any, "requestPath": requestPath as Any, "requestHeaders": requestHeaders.map { $0.toMap() } as Any, @@ -197,8 +198,8 @@ open class Execution: Codable { permissions: map["$permissions"] as! [String], functionId: map["functionId"] as! String, deploymentId: map["deploymentId"] as! String, - trigger: map["trigger"] as! String, - status: map["status"] as! String, + trigger: ExecutionTrigger(rawValue: map["trigger"] as! String)!, + status: ExecutionStatus(rawValue: map["status"] as! String)!, requestMethod: map["requestMethod"] as! String, requestPath: map["requestPath"] as! String, requestHeaders: (map["requestHeaders"] as! [[String: Any]]).map { Headers.from(map: $0) }, diff --git a/Sources/AppwriteModels/HealthAntivirus.swift b/Sources/AppwriteModels/HealthAntivirus.swift index 745f2f8..d610177 100644 --- a/Sources/AppwriteModels/HealthAntivirus.swift +++ b/Sources/AppwriteModels/HealthAntivirus.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// Health Antivirus open class HealthAntivirus: Codable { @@ -13,12 +14,12 @@ open class HealthAntivirus: Codable { public let version: String /// Antivirus status. Possible values are: `disabled`, `offline`, `online` - public let status: String + public let status: HealthAntivirusStatus init( version: String, - status: String + status: HealthAntivirusStatus ) { self.version = version self.status = status @@ -28,27 +29,27 @@ open class HealthAntivirus: Codable { let container = try decoder.container(keyedBy: CodingKeys.self) self.version = try container.decode(String.self, forKey: .version) - self.status = try container.decode(String.self, forKey: .status) + self.status = HealthAntivirusStatus(rawValue: try container.decode(String.self, forKey: .status))! } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(version, forKey: .version) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) } public func toMap() -> [String: Any] { return [ "version": version as Any, - "status": status as Any + "status": status.rawValue as Any ] } public static func from(map: [String: Any] ) -> HealthAntivirus { return HealthAntivirus( version: map["version"] as! String, - status: map["status"] as! String + status: HealthAntivirusStatus(rawValue: map["status"] as! String)! ) } } diff --git a/Sources/AppwriteModels/HealthStatus.swift b/Sources/AppwriteModels/HealthStatus.swift index 5a5f4b0..2b2325a 100644 --- a/Sources/AppwriteModels/HealthStatus.swift +++ b/Sources/AppwriteModels/HealthStatus.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// Health Status open class HealthStatus: Codable { @@ -17,13 +18,13 @@ open class HealthStatus: Codable { public let ping: Int /// Service status. Possible values are: `pass`, `fail` - public let status: String + public let status: HealthCheckStatus init( name: String, ping: Int, - status: String + status: HealthCheckStatus ) { self.name = name self.ping = ping @@ -35,7 +36,7 @@ open class HealthStatus: Codable { self.name = try container.decode(String.self, forKey: .name) self.ping = try container.decode(Int.self, forKey: .ping) - self.status = try container.decode(String.self, forKey: .status) + self.status = HealthCheckStatus(rawValue: try container.decode(String.self, forKey: .status))! } public func encode(to encoder: Encoder) throws { @@ -43,14 +44,14 @@ open class HealthStatus: Codable { try container.encode(name, forKey: .name) try container.encode(ping, forKey: .ping) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) } public func toMap() -> [String: Any] { return [ "name": name as Any, "ping": ping as Any, - "status": status as Any + "status": status.rawValue as Any ] } @@ -58,7 +59,7 @@ open class HealthStatus: Codable { return HealthStatus( name: map["name"] as! String, ping: map["ping"] as! Int, - status: map["status"] as! String + status: HealthCheckStatus(rawValue: map["status"] as! String)! ) } } diff --git a/Sources/AppwriteModels/Index.swift b/Sources/AppwriteModels/Index.swift index a2cc1c8..5873e47 100644 --- a/Sources/AppwriteModels/Index.swift +++ b/Sources/AppwriteModels/Index.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// Index open class Index: Codable { @@ -33,7 +34,7 @@ open class Index: Codable { public let type: String /// Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: IndexStatus /// Error message. Displays error generated on failure of creating or deleting an index. public let error: String @@ -54,7 +55,7 @@ open class Index: Codable { updatedAt: String, key: String, type: String, - status: String, + status: IndexStatus, error: String, attributes: [String], lengths: [Int], @@ -80,7 +81,7 @@ open class Index: Codable { self.updatedAt = try container.decode(String.self, forKey: .updatedAt) self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = IndexStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.attributes = try container.decode([String].self, forKey: .attributes) self.lengths = try container.decode([Int].self, forKey: .lengths) @@ -95,7 +96,7 @@ open class Index: Codable { try container.encode(updatedAt, forKey: .updatedAt) try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(attributes, forKey: .attributes) try container.encode(lengths, forKey: .lengths) @@ -109,7 +110,7 @@ open class Index: Codable { "$updatedAt": updatedAt as Any, "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "attributes": attributes as Any, "lengths": lengths as Any, @@ -124,7 +125,7 @@ open class Index: Codable { updatedAt: map["$updatedAt"] as! String, key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: IndexStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, attributes: map["attributes"] as! [String], lengths: map["lengths"] as! [Int], diff --git a/Sources/AppwriteModels/Message.swift b/Sources/AppwriteModels/Message.swift index 442d7c8..913b808 100644 --- a/Sources/AppwriteModels/Message.swift +++ b/Sources/AppwriteModels/Message.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// Message open class Message: Codable { @@ -57,7 +58,7 @@ open class Message: Codable { public let data: [String: AnyCodable] /// Status of delivery. - public let status: String + public let status: MessageStatus init( @@ -73,7 +74,7 @@ open class Message: Codable { deliveryErrors: [String]?, deliveredTotal: Int, data: [String: AnyCodable], - status: String + status: MessageStatus ) { self.id = id self.createdAt = createdAt @@ -105,7 +106,7 @@ open class Message: Codable { self.deliveryErrors = try container.decodeIfPresent([String].self, forKey: .deliveryErrors) self.deliveredTotal = try container.decode(Int.self, forKey: .deliveredTotal) self.data = try container.decode([String: AnyCodable].self, forKey: .data) - self.status = try container.decode(String.self, forKey: .status) + self.status = MessageStatus(rawValue: try container.decode(String.self, forKey: .status))! } public func encode(to encoder: Encoder) throws { @@ -123,7 +124,7 @@ open class Message: Codable { try container.encodeIfPresent(deliveryErrors, forKey: .deliveryErrors) try container.encode(deliveredTotal, forKey: .deliveredTotal) try container.encode(data, forKey: .data) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) } public func toMap() -> [String: Any] { @@ -140,7 +141,7 @@ open class Message: Codable { "deliveryErrors": deliveryErrors as Any, "deliveredTotal": deliveredTotal as Any, "data": data as Any, - "status": status as Any + "status": status.rawValue as Any ] } @@ -158,7 +159,7 @@ open class Message: Codable { deliveryErrors: map["deliveryErrors"] as? [String], deliveredTotal: map["deliveredTotal"] as! Int, data: map["data"] as! [String: AnyCodable], - status: map["status"] as! String + status: MessageStatus(rawValue: map["status"] as! String)! ) } } From 04571fbff09aed89b221e5a9257346dacb98894b Mon Sep 17 00:00:00 2001 From: root Date: Wed, 1 Oct 2025 04:38:40 +0000 Subject: [PATCH 2/3] regen --- Sources/Appwrite/Client.swift | 2 +- Sources/Appwrite/Query.swift | 6 +++ Sources/Appwrite/Services/Account.swift | 44 +++++++++---------- Sources/Appwrite/Services/Avatars.swift | 12 ++--- Sources/Appwrite/Services/Databases.swift | 16 +++---- Sources/Appwrite/Services/Functions.swift | 20 ++++----- Sources/Appwrite/Services/Health.swift | 4 +- Sources/Appwrite/Services/Messaging.swift | 24 +++++----- Sources/Appwrite/Services/Sites.swift | 32 +++++++------- Sources/Appwrite/Services/Storage.swift | 16 +++---- Sources/Appwrite/Services/TablesDb.swift | 16 +++---- Sources/Appwrite/Services/Users.swift | 20 ++++----- Sources/AppwriteModels/AttributeBoolean.swift | 6 +-- .../AppwriteModels/AttributeDatetime.swift | 6 +-- Sources/AppwriteModels/AttributeEmail.swift | 6 +-- Sources/AppwriteModels/AttributeEnum.swift | 6 +-- Sources/AppwriteModels/AttributeFloat.swift | 6 +-- Sources/AppwriteModels/AttributeInteger.swift | 6 +-- Sources/AppwriteModels/AttributeIp.swift | 6 +-- Sources/AppwriteModels/AttributeLine.swift | 6 +-- Sources/AppwriteModels/AttributePoint.swift | 6 +-- Sources/AppwriteModels/AttributePolygon.swift | 6 +-- .../AttributeRelationship.swift | 6 +-- Sources/AppwriteModels/AttributeString.swift | 6 +-- Sources/AppwriteModels/AttributeUrl.swift | 6 +-- Sources/AppwriteModels/Deployment.swift | 6 +-- Sources/AppwriteModels/Document.swift | 2 +- Sources/AppwriteModels/Execution.swift | 12 ++--- Sources/AppwriteModels/HealthAntivirus.swift | 6 +-- Sources/AppwriteModels/HealthStatus.swift | 6 +-- Sources/AppwriteModels/Index.swift | 6 +-- Sources/AppwriteModels/Message.swift | 6 +-- Sources/AppwriteModels/Preferences.swift | 2 +- Sources/AppwriteModels/Row.swift | 2 +- 34 files changed, 172 insertions(+), 166 deletions(-) diff --git a/Sources/Appwrite/Client.swift b/Sources/Appwrite/Client.swift index d588549..2390e67 100644 --- a/Sources/Appwrite/Client.swift +++ b/Sources/Appwrite/Client.swift @@ -415,7 +415,7 @@ open class Client { if let warning = response.headers["x-appwrite-warning"].first { warning.split(separator: ";").forEach { warning in - print("Warning: \(warning)") + fputs("Warning: \(warning)\n", stderr) } } diff --git a/Sources/Appwrite/Query.swift b/Sources/Appwrite/Query.swift index 5af7f4a..e4f06b5 100644 --- a/Sources/Appwrite/Query.swift +++ b/Sources/Appwrite/Query.swift @@ -280,6 +280,12 @@ public struct Query : Codable, CustomStringConvertible { ).description } + public static func orderRandom() -> String { + return Query( + method: "orderRandom" + ).description + } + public static func cursorBefore(_ id: String) -> String { return Query( method: "cursorBefore", diff --git a/Sources/Appwrite/Services/Account.swift b/Sources/Appwrite/Services/Account.swift index de81dfa..2505dd3 100644 --- a/Sources/Appwrite/Services/Account.swift +++ b/Sources/Appwrite/Services/Account.swift @@ -387,13 +387,13 @@ open class Account: Service { /// method. /// /// - Parameters: - /// - type: AuthenticatorType + /// - type: AppwriteEnums.AuthenticatorType /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.MfaType /// @available(*, deprecated, message: "This API has been deprecated since 1.8.0. Please use `Account.createMFAAuthenticator` instead.") open func createMfaAuthenticator( - type: AuthenticatorType + type: AppwriteEnums.AuthenticatorType ) async throws -> AppwriteModels.MfaType { let apiPath: String = "/account/mfa/authenticators/{type}" .replacingOccurrences(of: "{type}", with: type.rawValue) @@ -424,12 +424,12 @@ open class Account: Service { /// method. /// /// - Parameters: - /// - type: AuthenticatorType + /// - type: AppwriteEnums.AuthenticatorType /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.MfaType /// open func createMFAAuthenticator( - type: AuthenticatorType + type: AppwriteEnums.AuthenticatorType ) async throws -> AppwriteModels.MfaType { let apiPath: String = "/account/mfa/authenticators/{type}" .replacingOccurrences(of: "{type}", with: type.rawValue) @@ -459,14 +459,14 @@ open class Account: Service { /// method. /// /// - Parameters: - /// - type: AuthenticatorType + /// - type: AppwriteEnums.AuthenticatorType /// - otp: String /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.User /// @available(*, deprecated, message: "This API has been deprecated since 1.8.0. Please use `Account.updateMFAAuthenticator` instead.") open func updateMfaAuthenticator( - type: AuthenticatorType, + type: AppwriteEnums.AuthenticatorType, otp: String, nestedType: T.Type ) async throws -> AppwriteModels.User { @@ -500,14 +500,14 @@ open class Account: Service { /// method. /// /// - Parameters: - /// - type: AuthenticatorType + /// - type: AppwriteEnums.AuthenticatorType /// - otp: String /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.User /// @available(*, deprecated, message: "This API has been deprecated since 1.8.0. Please use `Account.updateMFAAuthenticator` instead.") open func updateMfaAuthenticator( - type: AuthenticatorType, + type: AppwriteEnums.AuthenticatorType, otp: String ) async throws -> AppwriteModels.User<[String: AnyCodable]> { return try await updateMfaAuthenticator( @@ -523,13 +523,13 @@ open class Account: Service { /// method. /// /// - Parameters: - /// - type: AuthenticatorType + /// - type: AppwriteEnums.AuthenticatorType /// - otp: String /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.User /// open func updateMFAAuthenticator( - type: AuthenticatorType, + type: AppwriteEnums.AuthenticatorType, otp: String, nestedType: T.Type ) async throws -> AppwriteModels.User { @@ -563,13 +563,13 @@ open class Account: Service { /// method. /// /// - Parameters: - /// - type: AuthenticatorType + /// - type: AppwriteEnums.AuthenticatorType /// - otp: String /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.User /// open func updateMFAAuthenticator( - type: AuthenticatorType, + type: AppwriteEnums.AuthenticatorType, otp: String ) async throws -> AppwriteModels.User<[String: AnyCodable]> { return try await updateMFAAuthenticator( @@ -583,13 +583,13 @@ open class Account: Service { /// Delete an authenticator for a user by ID. /// /// - Parameters: - /// - type: AuthenticatorType + /// - type: AppwriteEnums.AuthenticatorType /// - Throws: Exception if the request fails /// - Returns: Any /// @available(*, deprecated, message: "This API has been deprecated since 1.8.0. Please use `Account.deleteMFAAuthenticator` instead.") open func deleteMfaAuthenticator( - type: AuthenticatorType + type: AppwriteEnums.AuthenticatorType ) async throws -> Any { let apiPath: String = "/account/mfa/authenticators/{type}" .replacingOccurrences(of: "{type}", with: type.rawValue) @@ -611,12 +611,12 @@ open class Account: Service { /// Delete an authenticator for a user by ID. /// /// - Parameters: - /// - type: AuthenticatorType + /// - type: AppwriteEnums.AuthenticatorType /// - Throws: Exception if the request fails /// - Returns: Any /// open func deleteMFAAuthenticator( - type: AuthenticatorType + type: AppwriteEnums.AuthenticatorType ) async throws -> Any { let apiPath: String = "/account/mfa/authenticators/{type}" .replacingOccurrences(of: "{type}", with: type.rawValue) @@ -640,13 +640,13 @@ open class Account: Service { /// method. /// /// - Parameters: - /// - factor: AuthenticationFactor + /// - factor: AppwriteEnums.AuthenticationFactor /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.MfaChallenge /// @available(*, deprecated, message: "This API has been deprecated since 1.8.0. Please use `Account.createMFAChallenge` instead.") open func createMfaChallenge( - factor: AuthenticationFactor + factor: AppwriteEnums.AuthenticationFactor ) async throws -> AppwriteModels.MfaChallenge { let apiPath: String = "/account/mfa/challenge" @@ -677,12 +677,12 @@ open class Account: Service { /// method. /// /// - Parameters: - /// - factor: AuthenticationFactor + /// - factor: AppwriteEnums.AuthenticationFactor /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.MfaChallenge /// open func createMFAChallenge( - factor: AuthenticationFactor + factor: AppwriteEnums.AuthenticationFactor ) async throws -> AppwriteModels.MfaChallenge { let apiPath: String = "/account/mfa/challenge" @@ -1927,7 +1927,7 @@ open class Account: Service { /// limits](https://appwrite.io/docs/authentication-security#limits). /// /// - Parameters: - /// - provider: OAuthProvider + /// - provider: AppwriteEnums.OAuthProvider /// - success: String (optional) /// - failure: String (optional) /// - scopes: [String] (optional) @@ -1935,7 +1935,7 @@ open class Account: Service { /// - Returns: String? /// open func createOAuth2Token( - provider: OAuthProvider, + provider: AppwriteEnums.OAuthProvider, success: String? = nil, failure: String? = nil, scopes: [String]? = nil diff --git a/Sources/Appwrite/Services/Avatars.swift b/Sources/Appwrite/Services/Avatars.swift index 0ca8695..24f4b07 100644 --- a/Sources/Appwrite/Services/Avatars.swift +++ b/Sources/Appwrite/Services/Avatars.swift @@ -21,7 +21,7 @@ open class Avatars: Service { /// of image returned is 100x100px. /// /// - Parameters: - /// - code: Browser + /// - code: AppwriteEnums.Browser /// - width: Int (optional) /// - height: Int (optional) /// - quality: Int (optional) @@ -29,7 +29,7 @@ open class Avatars: Service { /// - Returns: ByteBuffer /// open func getBrowser( - code: Browser, + code: AppwriteEnums.Browser, width: Int? = nil, height: Int? = nil, quality: Int? = nil @@ -66,7 +66,7 @@ open class Avatars: Service { /// /// /// - Parameters: - /// - code: CreditCard + /// - code: AppwriteEnums.CreditCard /// - width: Int (optional) /// - height: Int (optional) /// - quality: Int (optional) @@ -74,7 +74,7 @@ open class Avatars: Service { /// - Returns: ByteBuffer /// open func getCreditCard( - code: CreditCard, + code: AppwriteEnums.CreditCard, width: Int? = nil, height: Int? = nil, quality: Int? = nil @@ -143,7 +143,7 @@ open class Avatars: Service { /// /// /// - Parameters: - /// - code: Flag + /// - code: AppwriteEnums.Flag /// - width: Int (optional) /// - height: Int (optional) /// - quality: Int (optional) @@ -151,7 +151,7 @@ open class Avatars: Service { /// - Returns: ByteBuffer /// open func getFlag( - code: Flag, + code: AppwriteEnums.Flag, width: Int? = nil, height: Int? = nil, quality: Int? = nil diff --git a/Sources/Appwrite/Services/Databases.swift b/Sources/Appwrite/Services/Databases.swift index bc806a1..03c7f4a 100644 --- a/Sources/Appwrite/Services/Databases.swift +++ b/Sources/Appwrite/Services/Databases.swift @@ -1494,11 +1494,11 @@ open class Databases: Service { /// - databaseId: String /// - collectionId: String /// - relatedCollectionId: String - /// - type: RelationshipType + /// - type: AppwriteEnums.RelationshipType /// - twoWay: Bool (optional) /// - key: String (optional) /// - twoWayKey: String (optional) - /// - onDelete: RelationMutate (optional) + /// - onDelete: AppwriteEnums.RelationMutate (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.AttributeRelationship /// @@ -1507,11 +1507,11 @@ open class Databases: Service { databaseId: String, collectionId: String, relatedCollectionId: String, - type: RelationshipType, + type: AppwriteEnums.RelationshipType, twoWay: Bool? = nil, key: String? = nil, twoWayKey: String? = nil, - onDelete: RelationMutate? = nil + onDelete: AppwriteEnums.RelationMutate? = nil ) async throws -> AppwriteModels.AttributeRelationship { let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/relationship" .replacingOccurrences(of: "{databaseId}", with: databaseId) @@ -1833,7 +1833,7 @@ open class Databases: Service { /// - databaseId: String /// - collectionId: String /// - key: String - /// - onDelete: RelationMutate (optional) + /// - onDelete: AppwriteEnums.RelationMutate (optional) /// - newKey: String (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.AttributeRelationship @@ -1843,7 +1843,7 @@ open class Databases: Service { databaseId: String, collectionId: String, key: String, - onDelete: RelationMutate? = nil, + onDelete: AppwriteEnums.RelationMutate? = nil, newKey: String? = nil ) async throws -> AppwriteModels.AttributeRelationship { let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship" @@ -2799,7 +2799,7 @@ open class Databases: Service { /// - databaseId: String /// - collectionId: String /// - key: String - /// - type: IndexType + /// - type: AppwriteEnums.IndexType /// - attributes: [String] /// - orders: [String] (optional) /// - lengths: [Int] (optional) @@ -2811,7 +2811,7 @@ open class Databases: Service { databaseId: String, collectionId: String, key: String, - type: IndexType, + type: AppwriteEnums.IndexType, attributes: [String], orders: [String]? = nil, lengths: [Int]? = nil diff --git a/Sources/Appwrite/Services/Functions.swift b/Sources/Appwrite/Services/Functions.swift index 2fef786..a26353f 100644 --- a/Sources/Appwrite/Services/Functions.swift +++ b/Sources/Appwrite/Services/Functions.swift @@ -53,7 +53,7 @@ open class Functions: Service { /// - Parameters: /// - functionId: String /// - name: String - /// - runtime: Runtime + /// - runtime: AppwriteEnums.Runtime /// - execute: [String] (optional) /// - events: [String] (optional) /// - schedule: String (optional) @@ -75,7 +75,7 @@ open class Functions: Service { open func create( functionId: String, name: String, - runtime: Runtime, + runtime: AppwriteEnums.Runtime, execute: [String]? = nil, events: [String]? = nil, schedule: String? = nil, @@ -223,7 +223,7 @@ open class Functions: Service { /// - Parameters: /// - functionId: String /// - name: String - /// - runtime: Runtime (optional) + /// - runtime: AppwriteEnums.Runtime (optional) /// - execute: [String] (optional) /// - events: [String] (optional) /// - schedule: String (optional) @@ -245,7 +245,7 @@ open class Functions: Service { open func update( functionId: String, name: String, - runtime: Runtime? = nil, + runtime: AppwriteEnums.Runtime? = nil, execute: [String]? = nil, events: [String]? = nil, schedule: String? = nil, @@ -570,7 +570,7 @@ open class Functions: Service { /// /// - Parameters: /// - functionId: String - /// - type: VCSDeploymentType + /// - type: AppwriteEnums.VCSDeploymentType /// - reference: String /// - activate: Bool (optional) /// - Throws: Exception if the request fails @@ -578,7 +578,7 @@ open class Functions: Service { /// open func createVcsDeployment( functionId: String, - type: VCSDeploymentType, + type: AppwriteEnums.VCSDeploymentType, reference: String, activate: Bool? = nil ) async throws -> AppwriteModels.Deployment { @@ -680,14 +680,14 @@ open class Functions: Service { /// - Parameters: /// - functionId: String /// - deploymentId: String - /// - type: DeploymentDownloadType (optional) + /// - type: AppwriteEnums.DeploymentDownloadType (optional) /// - Throws: Exception if the request fails /// - Returns: ByteBuffer /// open func getDeploymentDownload( functionId: String, deploymentId: String, - type: DeploymentDownloadType? = nil + type: AppwriteEnums.DeploymentDownloadType? = nil ) async throws -> ByteBuffer { let apiPath: String = "/functions/{functionId}/deployments/{deploymentId}/download" .replacingOccurrences(of: "{functionId}", with: functionId) @@ -795,7 +795,7 @@ open class Functions: Service { /// - body: String (optional) /// - async: Bool (optional) /// - path: String (optional) - /// - method: ExecutionMethod (optional) + /// - method: AppwriteEnums.ExecutionMethod (optional) /// - headers: Any (optional) /// - scheduledAt: String (optional) /// - Throws: Exception if the request fails @@ -806,7 +806,7 @@ open class Functions: Service { body: String? = nil, async: Bool? = nil, path: String? = nil, - method: ExecutionMethod? = nil, + method: AppwriteEnums.ExecutionMethod? = nil, headers: Any? = nil, scheduledAt: String? = nil ) async throws -> AppwriteModels.Execution { diff --git a/Sources/Appwrite/Services/Health.swift b/Sources/Appwrite/Services/Health.swift index 3add80b..e0bab3d 100644 --- a/Sources/Appwrite/Services/Health.swift +++ b/Sources/Appwrite/Services/Health.swift @@ -317,13 +317,13 @@ open class Health: Service { /// /// /// - Parameters: - /// - name: Name + /// - name: AppwriteEnums.Name /// - threshold: Int (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.HealthQueue /// open func getFailedJobs( - name: Name, + name: AppwriteEnums.Name, threshold: Int? = nil ) async throws -> AppwriteModels.HealthQueue { let apiPath: String = "/health/queue/failed/{name}" diff --git a/Sources/Appwrite/Services/Messaging.swift b/Sources/Appwrite/Services/Messaging.swift index 894bc42..1b97c72 100644 --- a/Sources/Appwrite/Services/Messaging.swift +++ b/Sources/Appwrite/Services/Messaging.swift @@ -202,7 +202,7 @@ open class Messaging: Service { /// - scheduledAt: String (optional) /// - contentAvailable: Bool (optional) /// - critical: Bool (optional) - /// - priority: MessagePriority (optional) + /// - priority: AppwriteEnums.MessagePriority (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.Message /// @@ -225,7 +225,7 @@ open class Messaging: Service { scheduledAt: String? = nil, contentAvailable: Bool? = nil, critical: Bool? = nil, - priority: MessagePriority? = nil + priority: AppwriteEnums.MessagePriority? = nil ) async throws -> AppwriteModels.Message { let apiPath: String = "/messaging/messages/push" @@ -293,7 +293,7 @@ open class Messaging: Service { /// - scheduledAt: String (optional) /// - contentAvailable: Bool (optional) /// - critical: Bool (optional) - /// - priority: MessagePriority (optional) + /// - priority: AppwriteEnums.MessagePriority (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.Message /// @@ -316,7 +316,7 @@ open class Messaging: Service { scheduledAt: String? = nil, contentAvailable: Bool? = nil, critical: Bool? = nil, - priority: MessagePriority? = nil + priority: AppwriteEnums.MessagePriority? = nil ) async throws -> AppwriteModels.Message { let apiPath: String = "/messaging/messages/push/{messageId}" .replacingOccurrences(of: "{messageId}", with: messageId) @@ -1476,7 +1476,7 @@ open class Messaging: Service { /// - port: Int (optional) /// - username: String (optional) /// - password: String (optional) - /// - encryption: SmtpEncryption (optional) + /// - encryption: AppwriteEnums.SmtpEncryption (optional) /// - autoTLS: Bool (optional) /// - mailer: String (optional) /// - fromName: String (optional) @@ -1495,7 +1495,7 @@ open class Messaging: Service { port: Int? = nil, username: String? = nil, password: String? = nil, - encryption: SmtpEncryption? = nil, + encryption: AppwriteEnums.SmtpEncryption? = nil, autoTLS: Bool? = nil, mailer: String? = nil, fromName: String? = nil, @@ -1550,7 +1550,7 @@ open class Messaging: Service { /// - port: Int (optional) /// - username: String (optional) /// - password: String (optional) - /// - encryption: SmtpEncryption (optional) + /// - encryption: AppwriteEnums.SmtpEncryption (optional) /// - autoTLS: Bool (optional) /// - mailer: String (optional) /// - fromName: String (optional) @@ -1568,7 +1568,7 @@ open class Messaging: Service { port: Int? = nil, username: String? = nil, password: String? = nil, - encryption: SmtpEncryption? = nil, + encryption: AppwriteEnums.SmtpEncryption? = nil, autoTLS: Bool? = nil, mailer: String? = nil, fromName: String? = nil, @@ -1623,7 +1623,7 @@ open class Messaging: Service { /// - port: Int (optional) /// - username: String (optional) /// - password: String (optional) - /// - encryption: SmtpEncryption (optional) + /// - encryption: AppwriteEnums.SmtpEncryption (optional) /// - autoTLS: Bool (optional) /// - mailer: String (optional) /// - fromName: String (optional) @@ -1642,7 +1642,7 @@ open class Messaging: Service { port: Int? = nil, username: String? = nil, password: String? = nil, - encryption: SmtpEncryption? = nil, + encryption: AppwriteEnums.SmtpEncryption? = nil, autoTLS: Bool? = nil, mailer: String? = nil, fromName: String? = nil, @@ -1697,7 +1697,7 @@ open class Messaging: Service { /// - port: Int (optional) /// - username: String (optional) /// - password: String (optional) - /// - encryption: SmtpEncryption (optional) + /// - encryption: AppwriteEnums.SmtpEncryption (optional) /// - autoTLS: Bool (optional) /// - mailer: String (optional) /// - fromName: String (optional) @@ -1715,7 +1715,7 @@ open class Messaging: Service { port: Int? = nil, username: String? = nil, password: String? = nil, - encryption: SmtpEncryption? = nil, + encryption: AppwriteEnums.SmtpEncryption? = nil, autoTLS: Bool? = nil, mailer: String? = nil, fromName: String? = nil, diff --git a/Sources/Appwrite/Services/Sites.swift b/Sources/Appwrite/Services/Sites.swift index 9e7a462..290e495 100644 --- a/Sources/Appwrite/Services/Sites.swift +++ b/Sources/Appwrite/Services/Sites.swift @@ -50,15 +50,15 @@ open class Sites: Service { /// - Parameters: /// - siteId: String /// - name: String - /// - framework: Framework - /// - buildRuntime: BuildRuntime + /// - framework: AppwriteEnums.Framework + /// - buildRuntime: AppwriteEnums.BuildRuntime /// - enabled: Bool (optional) /// - logging: Bool (optional) /// - timeout: Int (optional) /// - installCommand: String (optional) /// - buildCommand: String (optional) /// - outputDirectory: String (optional) - /// - adapter: Adapter (optional) + /// - adapter: AppwriteEnums.Adapter (optional) /// - installationId: String (optional) /// - fallbackFile: String (optional) /// - providerRepositoryId: String (optional) @@ -72,15 +72,15 @@ open class Sites: Service { open func create( siteId: String, name: String, - framework: Framework, - buildRuntime: BuildRuntime, + framework: AppwriteEnums.Framework, + buildRuntime: AppwriteEnums.BuildRuntime, enabled: Bool? = nil, logging: Bool? = nil, timeout: Int? = nil, installCommand: String? = nil, buildCommand: String? = nil, outputDirectory: String? = nil, - adapter: Adapter? = nil, + adapter: AppwriteEnums.Adapter? = nil, installationId: String? = nil, fallbackFile: String? = nil, providerRepositoryId: String? = nil, @@ -221,15 +221,15 @@ open class Sites: Service { /// - Parameters: /// - siteId: String /// - name: String - /// - framework: Framework + /// - framework: AppwriteEnums.Framework /// - enabled: Bool (optional) /// - logging: Bool (optional) /// - timeout: Int (optional) /// - installCommand: String (optional) /// - buildCommand: String (optional) /// - outputDirectory: String (optional) - /// - buildRuntime: BuildRuntime (optional) - /// - adapter: Adapter (optional) + /// - buildRuntime: AppwriteEnums.BuildRuntime (optional) + /// - adapter: AppwriteEnums.Adapter (optional) /// - fallbackFile: String (optional) /// - installationId: String (optional) /// - providerRepositoryId: String (optional) @@ -243,15 +243,15 @@ open class Sites: Service { open func update( siteId: String, name: String, - framework: Framework, + framework: AppwriteEnums.Framework, enabled: Bool? = nil, logging: Bool? = nil, timeout: Int? = nil, installCommand: String? = nil, buildCommand: String? = nil, outputDirectory: String? = nil, - buildRuntime: BuildRuntime? = nil, - adapter: Adapter? = nil, + buildRuntime: AppwriteEnums.BuildRuntime? = nil, + adapter: AppwriteEnums.Adapter? = nil, fallbackFile: String? = nil, installationId: String? = nil, providerRepositoryId: String? = nil, @@ -561,7 +561,7 @@ open class Sites: Service { /// /// - Parameters: /// - siteId: String - /// - type: VCSDeploymentType + /// - type: AppwriteEnums.VCSDeploymentType /// - reference: String /// - activate: Bool (optional) /// - Throws: Exception if the request fails @@ -569,7 +569,7 @@ open class Sites: Service { /// open func createVcsDeployment( siteId: String, - type: VCSDeploymentType, + type: AppwriteEnums.VCSDeploymentType, reference: String, activate: Bool? = nil ) async throws -> AppwriteModels.Deployment { @@ -671,14 +671,14 @@ open class Sites: Service { /// - Parameters: /// - siteId: String /// - deploymentId: String - /// - type: DeploymentDownloadType (optional) + /// - type: AppwriteEnums.DeploymentDownloadType (optional) /// - Throws: Exception if the request fails /// - Returns: ByteBuffer /// open func getDeploymentDownload( siteId: String, deploymentId: String, - type: DeploymentDownloadType? = nil + type: AppwriteEnums.DeploymentDownloadType? = nil ) async throws -> ByteBuffer { let apiPath: String = "/sites/{siteId}/deployments/{deploymentId}/download" .replacingOccurrences(of: "{siteId}", with: siteId) diff --git a/Sources/Appwrite/Services/Storage.swift b/Sources/Appwrite/Services/Storage.swift index a3e0096..7852911 100644 --- a/Sources/Appwrite/Services/Storage.swift +++ b/Sources/Appwrite/Services/Storage.swift @@ -55,7 +55,7 @@ open class Storage: Service { /// - enabled: Bool (optional) /// - maximumFileSize: Int (optional) /// - allowedFileExtensions: [String] (optional) - /// - compression: Compression (optional) + /// - compression: AppwriteEnums.Compression (optional) /// - encryption: Bool (optional) /// - antivirus: Bool (optional) /// - Throws: Exception if the request fails @@ -69,7 +69,7 @@ open class Storage: Service { enabled: Bool? = nil, maximumFileSize: Int? = nil, allowedFileExtensions: [String]? = nil, - compression: Compression? = nil, + compression: AppwriteEnums.Compression? = nil, encryption: Bool? = nil, antivirus: Bool? = nil ) async throws -> AppwriteModels.Bucket { @@ -148,7 +148,7 @@ open class Storage: Service { /// - enabled: Bool (optional) /// - maximumFileSize: Int (optional) /// - allowedFileExtensions: [String] (optional) - /// - compression: Compression (optional) + /// - compression: AppwriteEnums.Compression (optional) /// - encryption: Bool (optional) /// - antivirus: Bool (optional) /// - Throws: Exception if the request fails @@ -162,7 +162,7 @@ open class Storage: Service { enabled: Bool? = nil, maximumFileSize: Int? = nil, allowedFileExtensions: [String]? = nil, - compression: Compression? = nil, + compression: AppwriteEnums.Compression? = nil, encryption: Bool? = nil, antivirus: Bool? = nil ) async throws -> AppwriteModels.Bucket { @@ -487,7 +487,7 @@ open class Storage: Service { /// - fileId: String /// - width: Int (optional) /// - height: Int (optional) - /// - gravity: ImageGravity (optional) + /// - gravity: AppwriteEnums.ImageGravity (optional) /// - quality: Int (optional) /// - borderWidth: Int (optional) /// - borderColor: String (optional) @@ -495,7 +495,7 @@ open class Storage: Service { /// - opacity: Double (optional) /// - rotation: Int (optional) /// - background: String (optional) - /// - output: ImageFormat (optional) + /// - output: AppwriteEnums.ImageFormat (optional) /// - token: String (optional) /// - Throws: Exception if the request fails /// - Returns: ByteBuffer @@ -505,7 +505,7 @@ open class Storage: Service { fileId: String, width: Int? = nil, height: Int? = nil, - gravity: ImageGravity? = nil, + gravity: AppwriteEnums.ImageGravity? = nil, quality: Int? = nil, borderWidth: Int? = nil, borderColor: String? = nil, @@ -513,7 +513,7 @@ open class Storage: Service { opacity: Double? = nil, rotation: Int? = nil, background: String? = nil, - output: ImageFormat? = nil, + output: AppwriteEnums.ImageFormat? = nil, token: String? = nil ) async throws -> ByteBuffer { let apiPath: String = "/storage/buckets/{bucketId}/files/{fileId}/preview" diff --git a/Sources/Appwrite/Services/TablesDb.swift b/Sources/Appwrite/Services/TablesDb.swift index 75535ea..8bbbf4c 100644 --- a/Sources/Appwrite/Services/TablesDb.swift +++ b/Sources/Appwrite/Services/TablesDb.swift @@ -1462,11 +1462,11 @@ open class TablesDB: Service { /// - databaseId: String /// - tableId: String /// - relatedTableId: String - /// - type: RelationshipType + /// - type: AppwriteEnums.RelationshipType /// - twoWay: Bool (optional) /// - key: String (optional) /// - twoWayKey: String (optional) - /// - onDelete: RelationMutate (optional) + /// - onDelete: AppwriteEnums.RelationMutate (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.ColumnRelationship /// @@ -1474,11 +1474,11 @@ open class TablesDB: Service { databaseId: String, tableId: String, relatedTableId: String, - type: RelationshipType, + type: AppwriteEnums.RelationshipType, twoWay: Bool? = nil, key: String? = nil, twoWayKey: String? = nil, - onDelete: RelationMutate? = nil + onDelete: AppwriteEnums.RelationMutate? = nil ) async throws -> AppwriteModels.ColumnRelationship { let apiPath: String = "/tablesdb/{databaseId}/tables/{tableId}/columns/relationship" .replacingOccurrences(of: "{databaseId}", with: databaseId) @@ -1794,7 +1794,7 @@ open class TablesDB: Service { /// - databaseId: String /// - tableId: String /// - key: String - /// - onDelete: RelationMutate (optional) + /// - onDelete: AppwriteEnums.RelationMutate (optional) /// - newKey: String (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.ColumnRelationship @@ -1803,7 +1803,7 @@ open class TablesDB: Service { databaseId: String, tableId: String, key: String, - onDelete: RelationMutate? = nil, + onDelete: AppwriteEnums.RelationMutate? = nil, newKey: String? = nil ) async throws -> AppwriteModels.ColumnRelationship { let apiPath: String = "/tablesdb/{databaseId}/tables/{tableId}/columns/{key}/relationship" @@ -1880,7 +1880,7 @@ open class TablesDB: Service { /// - databaseId: String /// - tableId: String /// - key: String - /// - type: IndexType + /// - type: AppwriteEnums.IndexType /// - columns: [String] /// - orders: [String] (optional) /// - lengths: [Int] (optional) @@ -1891,7 +1891,7 @@ open class TablesDB: Service { databaseId: String, tableId: String, key: String, - type: IndexType, + type: AppwriteEnums.IndexType, columns: [String], orders: [String]? = nil, lengths: [Int]? = nil diff --git a/Sources/Appwrite/Services/Users.swift b/Sources/Appwrite/Services/Users.swift index efc3bc5..e1ea976 100644 --- a/Sources/Appwrite/Services/Users.swift +++ b/Sources/Appwrite/Services/Users.swift @@ -720,7 +720,7 @@ open class Users: Service { /// - userId: String /// - email: String /// - password: String - /// - passwordVersion: PasswordHash (optional) + /// - passwordVersion: AppwriteEnums.PasswordHash (optional) /// - name: String (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.User @@ -729,7 +729,7 @@ open class Users: Service { userId: String, email: String, password: String, - passwordVersion: PasswordHash? = nil, + passwordVersion: AppwriteEnums.PasswordHash? = nil, name: String? = nil, nestedType: T.Type ) async throws -> AppwriteModels.User { @@ -770,7 +770,7 @@ open class Users: Service { /// - userId: String /// - email: String /// - password: String - /// - passwordVersion: PasswordHash (optional) + /// - passwordVersion: AppwriteEnums.PasswordHash (optional) /// - name: String (optional) /// - Throws: Exception if the request fails /// - Returns: AppwriteModels.User @@ -779,7 +779,7 @@ open class Users: Service { userId: String, email: String, password: String, - passwordVersion: PasswordHash? = nil, + passwordVersion: AppwriteEnums.PasswordHash? = nil, name: String? = nil ) async throws -> AppwriteModels.User<[String: AnyCodable]> { return try await createSHAUser( @@ -1237,14 +1237,14 @@ open class Users: Service { /// /// - Parameters: /// - userId: String - /// - type: AuthenticatorType + /// - type: AppwriteEnums.AuthenticatorType /// - Throws: Exception if the request fails /// - Returns: Any /// @available(*, deprecated, message: "This API has been deprecated since 1.8.0. Please use `Users.deleteMFAAuthenticator` instead.") open func deleteMfaAuthenticator( userId: String, - type: AuthenticatorType + type: AppwriteEnums.AuthenticatorType ) async throws -> Any { let apiPath: String = "/users/{userId}/mfa/authenticators/{type}" .replacingOccurrences(of: "{userId}", with: userId) @@ -1268,13 +1268,13 @@ open class Users: Service { /// /// - Parameters: /// - userId: String - /// - type: AuthenticatorType + /// - type: AppwriteEnums.AuthenticatorType /// - Throws: Exception if the request fails /// - Returns: Any /// open func deleteMFAAuthenticator( userId: String, - type: AuthenticatorType + type: AppwriteEnums.AuthenticatorType ) async throws -> Any { let apiPath: String = "/users/{userId}/mfa/authenticators/{type}" .replacingOccurrences(of: "{userId}", with: userId) @@ -2083,7 +2083,7 @@ open class Users: Service { /// - Parameters: /// - userId: String /// - targetId: String - /// - providerType: MessagingProviderType + /// - providerType: AppwriteEnums.MessagingProviderType /// - identifier: String /// - providerId: String (optional) /// - name: String (optional) @@ -2093,7 +2093,7 @@ open class Users: Service { open func createTarget( userId: String, targetId: String, - providerType: MessagingProviderType, + providerType: AppwriteEnums.MessagingProviderType, identifier: String, providerId: String? = nil, name: String? = nil diff --git a/Sources/AppwriteModels/AttributeBoolean.swift b/Sources/AppwriteModels/AttributeBoolean.swift index 811ce62..c728671 100644 --- a/Sources/AppwriteModels/AttributeBoolean.swift +++ b/Sources/AppwriteModels/AttributeBoolean.swift @@ -24,7 +24,7 @@ open class AttributeBoolean: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: AttributeStatus + public let status: AppwriteEnums.AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -48,7 +48,7 @@ open class AttributeBoolean: Codable { init( key: String, type: String, - status: AttributeStatus, + status: AppwriteEnums.AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -72,7 +72,7 @@ open class AttributeBoolean: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! + self.status = AppwriteEnums.AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) diff --git a/Sources/AppwriteModels/AttributeDatetime.swift b/Sources/AppwriteModels/AttributeDatetime.swift index 74282bd..a21433b 100644 --- a/Sources/AppwriteModels/AttributeDatetime.swift +++ b/Sources/AppwriteModels/AttributeDatetime.swift @@ -25,7 +25,7 @@ open class AttributeDatetime: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: AttributeStatus + public let status: AppwriteEnums.AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -52,7 +52,7 @@ open class AttributeDatetime: Codable { init( key: String, type: String, - status: AttributeStatus, + status: AppwriteEnums.AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -78,7 +78,7 @@ open class AttributeDatetime: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! + self.status = AppwriteEnums.AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) diff --git a/Sources/AppwriteModels/AttributeEmail.swift b/Sources/AppwriteModels/AttributeEmail.swift index 3f3daf5..1815b3f 100644 --- a/Sources/AppwriteModels/AttributeEmail.swift +++ b/Sources/AppwriteModels/AttributeEmail.swift @@ -25,7 +25,7 @@ open class AttributeEmail: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: AttributeStatus + public let status: AppwriteEnums.AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -52,7 +52,7 @@ open class AttributeEmail: Codable { init( key: String, type: String, - status: AttributeStatus, + status: AppwriteEnums.AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -78,7 +78,7 @@ open class AttributeEmail: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! + self.status = AppwriteEnums.AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) diff --git a/Sources/AppwriteModels/AttributeEnum.swift b/Sources/AppwriteModels/AttributeEnum.swift index 3f2acfd..139308b 100644 --- a/Sources/AppwriteModels/AttributeEnum.swift +++ b/Sources/AppwriteModels/AttributeEnum.swift @@ -26,7 +26,7 @@ open class AttributeEnum: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: AttributeStatus + public let status: AppwriteEnums.AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -56,7 +56,7 @@ open class AttributeEnum: Codable { init( key: String, type: String, - status: AttributeStatus, + status: AppwriteEnums.AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -84,7 +84,7 @@ open class AttributeEnum: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! + self.status = AppwriteEnums.AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) diff --git a/Sources/AppwriteModels/AttributeFloat.swift b/Sources/AppwriteModels/AttributeFloat.swift index 540d6b4..3a41dff 100644 --- a/Sources/AppwriteModels/AttributeFloat.swift +++ b/Sources/AppwriteModels/AttributeFloat.swift @@ -26,7 +26,7 @@ open class AttributeFloat: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: AttributeStatus + public let status: AppwriteEnums.AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -56,7 +56,7 @@ open class AttributeFloat: Codable { init( key: String, type: String, - status: AttributeStatus, + status: AppwriteEnums.AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -84,7 +84,7 @@ open class AttributeFloat: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! + self.status = AppwriteEnums.AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) diff --git a/Sources/AppwriteModels/AttributeInteger.swift b/Sources/AppwriteModels/AttributeInteger.swift index 4435497..5d793e5 100644 --- a/Sources/AppwriteModels/AttributeInteger.swift +++ b/Sources/AppwriteModels/AttributeInteger.swift @@ -26,7 +26,7 @@ open class AttributeInteger: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: AttributeStatus + public let status: AppwriteEnums.AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -56,7 +56,7 @@ open class AttributeInteger: Codable { init( key: String, type: String, - status: AttributeStatus, + status: AppwriteEnums.AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -84,7 +84,7 @@ open class AttributeInteger: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! + self.status = AppwriteEnums.AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) diff --git a/Sources/AppwriteModels/AttributeIp.swift b/Sources/AppwriteModels/AttributeIp.swift index 61ceefa..4d27dce 100644 --- a/Sources/AppwriteModels/AttributeIp.swift +++ b/Sources/AppwriteModels/AttributeIp.swift @@ -25,7 +25,7 @@ open class AttributeIp: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: AttributeStatus + public let status: AppwriteEnums.AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -52,7 +52,7 @@ open class AttributeIp: Codable { init( key: String, type: String, - status: AttributeStatus, + status: AppwriteEnums.AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -78,7 +78,7 @@ open class AttributeIp: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! + self.status = AppwriteEnums.AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) diff --git a/Sources/AppwriteModels/AttributeLine.swift b/Sources/AppwriteModels/AttributeLine.swift index 8553459..74302bb 100644 --- a/Sources/AppwriteModels/AttributeLine.swift +++ b/Sources/AppwriteModels/AttributeLine.swift @@ -24,7 +24,7 @@ open class AttributeLine: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: AttributeStatus + public let status: AppwriteEnums.AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -48,7 +48,7 @@ open class AttributeLine: Codable { init( key: String, type: String, - status: AttributeStatus, + status: AppwriteEnums.AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -72,7 +72,7 @@ open class AttributeLine: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! + self.status = AppwriteEnums.AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) diff --git a/Sources/AppwriteModels/AttributePoint.swift b/Sources/AppwriteModels/AttributePoint.swift index ce29847..93835e5 100644 --- a/Sources/AppwriteModels/AttributePoint.swift +++ b/Sources/AppwriteModels/AttributePoint.swift @@ -24,7 +24,7 @@ open class AttributePoint: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: AttributeStatus + public let status: AppwriteEnums.AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -48,7 +48,7 @@ open class AttributePoint: Codable { init( key: String, type: String, - status: AttributeStatus, + status: AppwriteEnums.AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -72,7 +72,7 @@ open class AttributePoint: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! + self.status = AppwriteEnums.AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) diff --git a/Sources/AppwriteModels/AttributePolygon.swift b/Sources/AppwriteModels/AttributePolygon.swift index 07d3657..7e4e8ba 100644 --- a/Sources/AppwriteModels/AttributePolygon.swift +++ b/Sources/AppwriteModels/AttributePolygon.swift @@ -24,7 +24,7 @@ open class AttributePolygon: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: AttributeStatus + public let status: AppwriteEnums.AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -48,7 +48,7 @@ open class AttributePolygon: Codable { init( key: String, type: String, - status: AttributeStatus, + status: AppwriteEnums.AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -72,7 +72,7 @@ open class AttributePolygon: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! + self.status = AppwriteEnums.AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) diff --git a/Sources/AppwriteModels/AttributeRelationship.swift b/Sources/AppwriteModels/AttributeRelationship.swift index 72d5585..7e74095 100644 --- a/Sources/AppwriteModels/AttributeRelationship.swift +++ b/Sources/AppwriteModels/AttributeRelationship.swift @@ -29,7 +29,7 @@ open class AttributeRelationship: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: AttributeStatus + public let status: AppwriteEnums.AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -68,7 +68,7 @@ open class AttributeRelationship: Codable { init( key: String, type: String, - status: AttributeStatus, + status: AppwriteEnums.AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -102,7 +102,7 @@ open class AttributeRelationship: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! + self.status = AppwriteEnums.AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) diff --git a/Sources/AppwriteModels/AttributeString.swift b/Sources/AppwriteModels/AttributeString.swift index 7a6ab94..1289873 100644 --- a/Sources/AppwriteModels/AttributeString.swift +++ b/Sources/AppwriteModels/AttributeString.swift @@ -26,7 +26,7 @@ open class AttributeString: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: AttributeStatus + public let status: AppwriteEnums.AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -56,7 +56,7 @@ open class AttributeString: Codable { init( key: String, type: String, - status: AttributeStatus, + status: AppwriteEnums.AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -84,7 +84,7 @@ open class AttributeString: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! + self.status = AppwriteEnums.AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) diff --git a/Sources/AppwriteModels/AttributeUrl.swift b/Sources/AppwriteModels/AttributeUrl.swift index c2241d1..5996b4a 100644 --- a/Sources/AppwriteModels/AttributeUrl.swift +++ b/Sources/AppwriteModels/AttributeUrl.swift @@ -25,7 +25,7 @@ open class AttributeUrl: Codable { public let type: String /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: AttributeStatus + public let status: AppwriteEnums.AttributeStatus /// Error message. Displays error generated on failure of creating or deleting an attribute. public let error: String @@ -52,7 +52,7 @@ open class AttributeUrl: Codable { init( key: String, type: String, - status: AttributeStatus, + status: AppwriteEnums.AttributeStatus, error: String, `required`: Bool, array: Bool?, @@ -78,7 +78,7 @@ open class AttributeUrl: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! + self.status = AppwriteEnums.AttributeStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) diff --git a/Sources/AppwriteModels/Deployment.swift b/Sources/AppwriteModels/Deployment.swift index 73d5394..c6e22da 100644 --- a/Sources/AppwriteModels/Deployment.swift +++ b/Sources/AppwriteModels/Deployment.swift @@ -78,7 +78,7 @@ open class Deployment: Codable { public let screenshotDark: String /// The deployment status. Possible values are "waiting", "processing", "building", "ready", and "failed". - public let status: DeploymentStatus + public let status: AppwriteEnums.DeploymentStatus /// The build logs. public let buildLogs: String @@ -132,7 +132,7 @@ open class Deployment: Codable { activate: Bool, screenshotLight: String, screenshotDark: String, - status: DeploymentStatus, + status: AppwriteEnums.DeploymentStatus, buildLogs: String, buildDuration: Int, providerRepositoryName: String, @@ -192,7 +192,7 @@ open class Deployment: Codable { self.activate = try container.decode(Bool.self, forKey: .activate) self.screenshotLight = try container.decode(String.self, forKey: .screenshotLight) self.screenshotDark = try container.decode(String.self, forKey: .screenshotDark) - self.status = DeploymentStatus(rawValue: try container.decode(String.self, forKey: .status))! + self.status = AppwriteEnums.DeploymentStatus(rawValue: try container.decode(String.self, forKey: .status))! self.buildLogs = try container.decode(String.self, forKey: .buildLogs) self.buildDuration = try container.decode(Int.self, forKey: .buildDuration) self.providerRepositoryName = try container.decode(String.self, forKey: .providerRepositoryName) diff --git a/Sources/AppwriteModels/Document.swift b/Sources/AppwriteModels/Document.swift index f076cc5..763db10 100644 --- a/Sources/AppwriteModels/Document.swift +++ b/Sources/AppwriteModels/Document.swift @@ -107,7 +107,7 @@ open class Document: Codable { createdAt: map["$createdAt"] as? String ?? "", updatedAt: map["$updatedAt"] as? String ?? "", permissions: map["$permissions"] as? [String] ?? [], - data: try! JSONDecoder().decode(T.self, from: JSONSerialization.data(withJSONObject: map, options: [])) + data: try! JSONDecoder().decode(T.self, from: JSONSerialization.data(withJSONObject: map["data"] as? [String: Any] ?? map, options: [])) ) } } diff --git a/Sources/AppwriteModels/Execution.swift b/Sources/AppwriteModels/Execution.swift index 7972e32..47d7734 100644 --- a/Sources/AppwriteModels/Execution.swift +++ b/Sources/AppwriteModels/Execution.swift @@ -45,10 +45,10 @@ open class Execution: Codable { public let deploymentId: String /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. - public let trigger: ExecutionTrigger + public let trigger: AppwriteEnums.ExecutionTrigger /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. - public let status: ExecutionStatus + public let status: AppwriteEnums.ExecutionStatus /// HTTP request method type. public let requestMethod: String @@ -88,8 +88,8 @@ open class Execution: Codable { permissions: [String], functionId: String, deploymentId: String, - trigger: ExecutionTrigger, - status: ExecutionStatus, + trigger: AppwriteEnums.ExecutionTrigger, + status: AppwriteEnums.ExecutionStatus, requestMethod: String, requestPath: String, requestHeaders: [Headers], @@ -130,8 +130,8 @@ open class Execution: Codable { self.permissions = try container.decode([String].self, forKey: .permissions) self.functionId = try container.decode(String.self, forKey: .functionId) self.deploymentId = try container.decode(String.self, forKey: .deploymentId) - self.trigger = ExecutionTrigger(rawValue: try container.decode(String.self, forKey: .trigger))! - self.status = ExecutionStatus(rawValue: try container.decode(String.self, forKey: .status))! + self.trigger = AppwriteEnums.ExecutionTrigger(rawValue: try container.decode(String.self, forKey: .trigger))! + self.status = AppwriteEnums.ExecutionStatus(rawValue: try container.decode(String.self, forKey: .status))! self.requestMethod = try container.decode(String.self, forKey: .requestMethod) self.requestPath = try container.decode(String.self, forKey: .requestPath) self.requestHeaders = try container.decode([Headers].self, forKey: .requestHeaders) diff --git a/Sources/AppwriteModels/HealthAntivirus.swift b/Sources/AppwriteModels/HealthAntivirus.swift index d610177..e92d47a 100644 --- a/Sources/AppwriteModels/HealthAntivirus.swift +++ b/Sources/AppwriteModels/HealthAntivirus.swift @@ -14,12 +14,12 @@ open class HealthAntivirus: Codable { public let version: String /// Antivirus status. Possible values are: `disabled`, `offline`, `online` - public let status: HealthAntivirusStatus + public let status: AppwriteEnums.HealthAntivirusStatus init( version: String, - status: HealthAntivirusStatus + status: AppwriteEnums.HealthAntivirusStatus ) { self.version = version self.status = status @@ -29,7 +29,7 @@ open class HealthAntivirus: Codable { let container = try decoder.container(keyedBy: CodingKeys.self) self.version = try container.decode(String.self, forKey: .version) - self.status = HealthAntivirusStatus(rawValue: try container.decode(String.self, forKey: .status))! + self.status = AppwriteEnums.HealthAntivirusStatus(rawValue: try container.decode(String.self, forKey: .status))! } public func encode(to encoder: Encoder) throws { diff --git a/Sources/AppwriteModels/HealthStatus.swift b/Sources/AppwriteModels/HealthStatus.swift index 2b2325a..c7bdebd 100644 --- a/Sources/AppwriteModels/HealthStatus.swift +++ b/Sources/AppwriteModels/HealthStatus.swift @@ -18,13 +18,13 @@ open class HealthStatus: Codable { public let ping: Int /// Service status. Possible values are: `pass`, `fail` - public let status: HealthCheckStatus + public let status: AppwriteEnums.HealthCheckStatus init( name: String, ping: Int, - status: HealthCheckStatus + status: AppwriteEnums.HealthCheckStatus ) { self.name = name self.ping = ping @@ -36,7 +36,7 @@ open class HealthStatus: Codable { self.name = try container.decode(String.self, forKey: .name) self.ping = try container.decode(Int.self, forKey: .ping) - self.status = HealthCheckStatus(rawValue: try container.decode(String.self, forKey: .status))! + self.status = AppwriteEnums.HealthCheckStatus(rawValue: try container.decode(String.self, forKey: .status))! } public func encode(to encoder: Encoder) throws { diff --git a/Sources/AppwriteModels/Index.swift b/Sources/AppwriteModels/Index.swift index 5873e47..475b3c4 100644 --- a/Sources/AppwriteModels/Index.swift +++ b/Sources/AppwriteModels/Index.swift @@ -34,7 +34,7 @@ open class Index: Codable { public let type: String /// Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: IndexStatus + public let status: AppwriteEnums.IndexStatus /// Error message. Displays error generated on failure of creating or deleting an index. public let error: String @@ -55,7 +55,7 @@ open class Index: Codable { updatedAt: String, key: String, type: String, - status: IndexStatus, + status: AppwriteEnums.IndexStatus, error: String, attributes: [String], lengths: [Int], @@ -81,7 +81,7 @@ open class Index: Codable { self.updatedAt = try container.decode(String.self, forKey: .updatedAt) self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = IndexStatus(rawValue: try container.decode(String.self, forKey: .status))! + self.status = AppwriteEnums.IndexStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.attributes = try container.decode([String].self, forKey: .attributes) self.lengths = try container.decode([Int].self, forKey: .lengths) diff --git a/Sources/AppwriteModels/Message.swift b/Sources/AppwriteModels/Message.swift index 913b808..c358c50 100644 --- a/Sources/AppwriteModels/Message.swift +++ b/Sources/AppwriteModels/Message.swift @@ -58,7 +58,7 @@ open class Message: Codable { public let data: [String: AnyCodable] /// Status of delivery. - public let status: MessageStatus + public let status: AppwriteEnums.MessageStatus init( @@ -74,7 +74,7 @@ open class Message: Codable { deliveryErrors: [String]?, deliveredTotal: Int, data: [String: AnyCodable], - status: MessageStatus + status: AppwriteEnums.MessageStatus ) { self.id = id self.createdAt = createdAt @@ -106,7 +106,7 @@ open class Message: Codable { self.deliveryErrors = try container.decodeIfPresent([String].self, forKey: .deliveryErrors) self.deliveredTotal = try container.decode(Int.self, forKey: .deliveredTotal) self.data = try container.decode([String: AnyCodable].self, forKey: .data) - self.status = MessageStatus(rawValue: try container.decode(String.self, forKey: .status))! + self.status = AppwriteEnums.MessageStatus(rawValue: try container.decode(String.self, forKey: .status))! } public func encode(to encoder: Encoder) throws { diff --git a/Sources/AppwriteModels/Preferences.swift b/Sources/AppwriteModels/Preferences.swift index 41f94e6..aff6dfe 100644 --- a/Sources/AppwriteModels/Preferences.swift +++ b/Sources/AppwriteModels/Preferences.swift @@ -37,7 +37,7 @@ open class Preferences: Codable { public static func from(map: [String: Any] ) -> Preferences { return Preferences( - data: try! JSONDecoder().decode(T.self, from: JSONSerialization.data(withJSONObject: map, options: [])) + data: try! JSONDecoder().decode(T.self, from: JSONSerialization.data(withJSONObject: map["data"] as? [String: Any] ?? map, options: [])) ) } } diff --git a/Sources/AppwriteModels/Row.swift b/Sources/AppwriteModels/Row.swift index 6e94a9e..5c6a215 100644 --- a/Sources/AppwriteModels/Row.swift +++ b/Sources/AppwriteModels/Row.swift @@ -107,7 +107,7 @@ open class Row: Codable { createdAt: map["$createdAt"] as! String, updatedAt: map["$updatedAt"] as! String, permissions: map["$permissions"] as! [String], - data: try! JSONDecoder().decode(T.self, from: JSONSerialization.data(withJSONObject: map, options: [])) + data: try! JSONDecoder().decode(T.self, from: JSONSerialization.data(withJSONObject: map["data"] as? [String: Any] ?? map, options: [])) ) } } From a3f7cb38ffbbf7ad1f4bd79aafa2677a2227e48b Mon Sep 17 00:00:00 2001 From: root Date: Fri, 3 Oct 2025 03:11:20 +0000 Subject: [PATCH 3/3] chore: update title and desc --- README.md | 2 +- Sources/Appwrite/Client.swift | 2 +- Sources/AppwriteEnums/ColumnStatus.swift | 13 +++++++++++++ Sources/AppwriteEnums/DatabaseType.swift | 10 ++++++++++ Sources/AppwriteModels/ColumnBoolean.swift | 13 +++++++------ Sources/AppwriteModels/ColumnDatetime.swift | 13 +++++++------ Sources/AppwriteModels/ColumnEmail.swift | 13 +++++++------ Sources/AppwriteModels/ColumnEnum.swift | 13 +++++++------ Sources/AppwriteModels/ColumnFloat.swift | 13 +++++++------ Sources/AppwriteModels/ColumnInteger.swift | 13 +++++++------ Sources/AppwriteModels/ColumnIp.swift | 13 +++++++------ Sources/AppwriteModels/ColumnLine.swift | 13 +++++++------ Sources/AppwriteModels/ColumnPoint.swift | 13 +++++++------ Sources/AppwriteModels/ColumnPolygon.swift | 13 +++++++------ Sources/AppwriteModels/ColumnRelationship.swift | 13 +++++++------ Sources/AppwriteModels/ColumnString.swift | 13 +++++++------ Sources/AppwriteModels/ColumnUrl.swift | 13 +++++++------ Sources/AppwriteModels/Database.swift | 13 +++++++------ 18 files changed, 123 insertions(+), 86 deletions(-) create mode 100644 Sources/AppwriteEnums/ColumnStatus.swift create mode 100644 Sources/AppwriteEnums/DatabaseType.swift diff --git a/README.md b/README.md index b570ee7..354b98e 100644 --- a/README.md +++ b/README.md @@ -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: "12.2.0"), + .package(url: "git@github.com:appwrite/sdk-for-swift.git", from: "13.0.0"), ], ``` diff --git a/Sources/Appwrite/Client.swift b/Sources/Appwrite/Client.swift index 2390e67..45e3769 100644 --- a/Sources/Appwrite/Client.swift +++ b/Sources/Appwrite/Client.swift @@ -21,7 +21,7 @@ open class Client { "x-sdk-name": "Swift", "x-sdk-platform": "server", "x-sdk-language": "swift", - "x-sdk-version": "12.2.0", + "x-sdk-version": "13.0.0", "x-appwrite-response-format": "1.8.0" ] diff --git a/Sources/AppwriteEnums/ColumnStatus.swift b/Sources/AppwriteEnums/ColumnStatus.swift new file mode 100644 index 0000000..1422356 --- /dev/null +++ b/Sources/AppwriteEnums/ColumnStatus.swift @@ -0,0 +1,13 @@ +import Foundation + +public enum ColumnStatus: String, CustomStringConvertible { + case available = "available" + case processing = "processing" + case deleting = "deleting" + case stuck = "stuck" + case failed = "failed" + + public var description: String { + return rawValue + } +} diff --git a/Sources/AppwriteEnums/DatabaseType.swift b/Sources/AppwriteEnums/DatabaseType.swift new file mode 100644 index 0000000..664ccb4 --- /dev/null +++ b/Sources/AppwriteEnums/DatabaseType.swift @@ -0,0 +1,10 @@ +import Foundation + +public enum DatabaseType: String, CustomStringConvertible { + case legacy = "legacy" + case tablesdb = "tablesdb" + + public var description: String { + return rawValue + } +} diff --git a/Sources/AppwriteModels/ColumnBoolean.swift b/Sources/AppwriteModels/ColumnBoolean.swift index 8a73ca0..37a0601 100644 --- a/Sources/AppwriteModels/ColumnBoolean.swift +++ b/Sources/AppwriteModels/ColumnBoolean.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// ColumnBoolean open class ColumnBoolean: Codable { @@ -23,7 +24,7 @@ open class ColumnBoolean: Codable { public let type: String /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AppwriteEnums.ColumnStatus /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String @@ -47,7 +48,7 @@ open class ColumnBoolean: Codable { init( key: String, type: String, - status: String, + status: AppwriteEnums.ColumnStatus, error: String, `required`: Bool, array: Bool?, @@ -71,7 +72,7 @@ open class ColumnBoolean: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AppwriteEnums.ColumnStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -85,7 +86,7 @@ open class ColumnBoolean: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -98,7 +99,7 @@ open class ColumnBoolean: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -112,7 +113,7 @@ open class ColumnBoolean: Codable { return ColumnBoolean( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: ColumnStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/ColumnDatetime.swift b/Sources/AppwriteModels/ColumnDatetime.swift index 00cdc6d..8ef9867 100644 --- a/Sources/AppwriteModels/ColumnDatetime.swift +++ b/Sources/AppwriteModels/ColumnDatetime.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// ColumnDatetime open class ColumnDatetime: Codable { @@ -24,7 +25,7 @@ open class ColumnDatetime: Codable { public let type: String /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AppwriteEnums.ColumnStatus /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String @@ -51,7 +52,7 @@ open class ColumnDatetime: Codable { init( key: String, type: String, - status: String, + status: AppwriteEnums.ColumnStatus, error: String, `required`: Bool, array: Bool?, @@ -77,7 +78,7 @@ open class ColumnDatetime: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AppwriteEnums.ColumnStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -92,7 +93,7 @@ open class ColumnDatetime: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -106,7 +107,7 @@ open class ColumnDatetime: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -121,7 +122,7 @@ open class ColumnDatetime: Codable { return ColumnDatetime( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: ColumnStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/ColumnEmail.swift b/Sources/AppwriteModels/ColumnEmail.swift index 940062e..c6e52a4 100644 --- a/Sources/AppwriteModels/ColumnEmail.swift +++ b/Sources/AppwriteModels/ColumnEmail.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// ColumnEmail open class ColumnEmail: Codable { @@ -24,7 +25,7 @@ open class ColumnEmail: Codable { public let type: String /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AppwriteEnums.ColumnStatus /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String @@ -51,7 +52,7 @@ open class ColumnEmail: Codable { init( key: String, type: String, - status: String, + status: AppwriteEnums.ColumnStatus, error: String, `required`: Bool, array: Bool?, @@ -77,7 +78,7 @@ open class ColumnEmail: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AppwriteEnums.ColumnStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -92,7 +93,7 @@ open class ColumnEmail: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -106,7 +107,7 @@ open class ColumnEmail: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -121,7 +122,7 @@ open class ColumnEmail: Codable { return ColumnEmail( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: ColumnStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/ColumnEnum.swift b/Sources/AppwriteModels/ColumnEnum.swift index ef78f80..570dc87 100644 --- a/Sources/AppwriteModels/ColumnEnum.swift +++ b/Sources/AppwriteModels/ColumnEnum.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// ColumnEnum open class ColumnEnum: Codable { @@ -25,7 +26,7 @@ open class ColumnEnum: Codable { public let type: String /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AppwriteEnums.ColumnStatus /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String @@ -55,7 +56,7 @@ open class ColumnEnum: Codable { init( key: String, type: String, - status: String, + status: AppwriteEnums.ColumnStatus, error: String, `required`: Bool, array: Bool?, @@ -83,7 +84,7 @@ open class ColumnEnum: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AppwriteEnums.ColumnStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -99,7 +100,7 @@ open class ColumnEnum: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -114,7 +115,7 @@ open class ColumnEnum: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -130,7 +131,7 @@ open class ColumnEnum: Codable { return ColumnEnum( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: ColumnStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/ColumnFloat.swift b/Sources/AppwriteModels/ColumnFloat.swift index 6cdd019..23ed59e 100644 --- a/Sources/AppwriteModels/ColumnFloat.swift +++ b/Sources/AppwriteModels/ColumnFloat.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// ColumnFloat open class ColumnFloat: Codable { @@ -25,7 +26,7 @@ open class ColumnFloat: Codable { public let type: String /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AppwriteEnums.ColumnStatus /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String @@ -55,7 +56,7 @@ open class ColumnFloat: Codable { init( key: String, type: String, - status: String, + status: AppwriteEnums.ColumnStatus, error: String, `required`: Bool, array: Bool?, @@ -83,7 +84,7 @@ open class ColumnFloat: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AppwriteEnums.ColumnStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -99,7 +100,7 @@ open class ColumnFloat: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -114,7 +115,7 @@ open class ColumnFloat: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -130,7 +131,7 @@ open class ColumnFloat: Codable { return ColumnFloat( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: ColumnStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/ColumnInteger.swift b/Sources/AppwriteModels/ColumnInteger.swift index 4451550..8a43e93 100644 --- a/Sources/AppwriteModels/ColumnInteger.swift +++ b/Sources/AppwriteModels/ColumnInteger.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// ColumnInteger open class ColumnInteger: Codable { @@ -25,7 +26,7 @@ open class ColumnInteger: Codable { public let type: String /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AppwriteEnums.ColumnStatus /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String @@ -55,7 +56,7 @@ open class ColumnInteger: Codable { init( key: String, type: String, - status: String, + status: AppwriteEnums.ColumnStatus, error: String, `required`: Bool, array: Bool?, @@ -83,7 +84,7 @@ open class ColumnInteger: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AppwriteEnums.ColumnStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -99,7 +100,7 @@ open class ColumnInteger: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -114,7 +115,7 @@ open class ColumnInteger: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -130,7 +131,7 @@ open class ColumnInteger: Codable { return ColumnInteger( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: ColumnStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/ColumnIp.swift b/Sources/AppwriteModels/ColumnIp.swift index 43ddaee..a9dee8c 100644 --- a/Sources/AppwriteModels/ColumnIp.swift +++ b/Sources/AppwriteModels/ColumnIp.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// ColumnIP open class ColumnIp: Codable { @@ -24,7 +25,7 @@ open class ColumnIp: Codable { public let type: String /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AppwriteEnums.ColumnStatus /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String @@ -51,7 +52,7 @@ open class ColumnIp: Codable { init( key: String, type: String, - status: String, + status: AppwriteEnums.ColumnStatus, error: String, `required`: Bool, array: Bool?, @@ -77,7 +78,7 @@ open class ColumnIp: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AppwriteEnums.ColumnStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -92,7 +93,7 @@ open class ColumnIp: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -106,7 +107,7 @@ open class ColumnIp: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -121,7 +122,7 @@ open class ColumnIp: Codable { return ColumnIp( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: ColumnStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/ColumnLine.swift b/Sources/AppwriteModels/ColumnLine.swift index 09c0543..f375b35 100644 --- a/Sources/AppwriteModels/ColumnLine.swift +++ b/Sources/AppwriteModels/ColumnLine.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// ColumnLine open class ColumnLine: Codable { @@ -23,7 +24,7 @@ open class ColumnLine: Codable { public let type: String /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AppwriteEnums.ColumnStatus /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String @@ -47,7 +48,7 @@ open class ColumnLine: Codable { init( key: String, type: String, - status: String, + status: AppwriteEnums.ColumnStatus, error: String, `required`: Bool, array: Bool?, @@ -71,7 +72,7 @@ open class ColumnLine: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AppwriteEnums.ColumnStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -85,7 +86,7 @@ open class ColumnLine: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -98,7 +99,7 @@ open class ColumnLine: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -112,7 +113,7 @@ open class ColumnLine: Codable { return ColumnLine( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: ColumnStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/ColumnPoint.swift b/Sources/AppwriteModels/ColumnPoint.swift index 96b1f65..c3c13c4 100644 --- a/Sources/AppwriteModels/ColumnPoint.swift +++ b/Sources/AppwriteModels/ColumnPoint.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// ColumnPoint open class ColumnPoint: Codable { @@ -23,7 +24,7 @@ open class ColumnPoint: Codable { public let type: String /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AppwriteEnums.ColumnStatus /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String @@ -47,7 +48,7 @@ open class ColumnPoint: Codable { init( key: String, type: String, - status: String, + status: AppwriteEnums.ColumnStatus, error: String, `required`: Bool, array: Bool?, @@ -71,7 +72,7 @@ open class ColumnPoint: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AppwriteEnums.ColumnStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -85,7 +86,7 @@ open class ColumnPoint: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -98,7 +99,7 @@ open class ColumnPoint: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -112,7 +113,7 @@ open class ColumnPoint: Codable { return ColumnPoint( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: ColumnStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/ColumnPolygon.swift b/Sources/AppwriteModels/ColumnPolygon.swift index 0f64db7..d786d29 100644 --- a/Sources/AppwriteModels/ColumnPolygon.swift +++ b/Sources/AppwriteModels/ColumnPolygon.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// ColumnPolygon open class ColumnPolygon: Codable { @@ -23,7 +24,7 @@ open class ColumnPolygon: Codable { public let type: String /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AppwriteEnums.ColumnStatus /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String @@ -47,7 +48,7 @@ open class ColumnPolygon: Codable { init( key: String, type: String, - status: String, + status: AppwriteEnums.ColumnStatus, error: String, `required`: Bool, array: Bool?, @@ -71,7 +72,7 @@ open class ColumnPolygon: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AppwriteEnums.ColumnStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -85,7 +86,7 @@ open class ColumnPolygon: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -98,7 +99,7 @@ open class ColumnPolygon: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -112,7 +113,7 @@ open class ColumnPolygon: Codable { return ColumnPolygon( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: ColumnStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/ColumnRelationship.swift b/Sources/AppwriteModels/ColumnRelationship.swift index b4c388c..76076e0 100644 --- a/Sources/AppwriteModels/ColumnRelationship.swift +++ b/Sources/AppwriteModels/ColumnRelationship.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// ColumnRelationship open class ColumnRelationship: Codable { @@ -28,7 +29,7 @@ open class ColumnRelationship: Codable { public let type: String /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AppwriteEnums.ColumnStatus /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String @@ -67,7 +68,7 @@ open class ColumnRelationship: Codable { init( key: String, type: String, - status: String, + status: AppwriteEnums.ColumnStatus, error: String, `required`: Bool, array: Bool?, @@ -101,7 +102,7 @@ open class ColumnRelationship: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AppwriteEnums.ColumnStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -120,7 +121,7 @@ open class ColumnRelationship: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -138,7 +139,7 @@ open class ColumnRelationship: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -157,7 +158,7 @@ open class ColumnRelationship: Codable { return ColumnRelationship( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: ColumnStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/ColumnString.swift b/Sources/AppwriteModels/ColumnString.swift index 6dd146b..8cae67e 100644 --- a/Sources/AppwriteModels/ColumnString.swift +++ b/Sources/AppwriteModels/ColumnString.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// ColumnString open class ColumnString: Codable { @@ -25,7 +26,7 @@ open class ColumnString: Codable { public let type: String /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AppwriteEnums.ColumnStatus /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String @@ -55,7 +56,7 @@ open class ColumnString: Codable { init( key: String, type: String, - status: String, + status: AppwriteEnums.ColumnStatus, error: String, `required`: Bool, array: Bool?, @@ -83,7 +84,7 @@ open class ColumnString: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AppwriteEnums.ColumnStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -99,7 +100,7 @@ open class ColumnString: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -114,7 +115,7 @@ open class ColumnString: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -130,7 +131,7 @@ open class ColumnString: Codable { return ColumnString( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: ColumnStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/ColumnUrl.swift b/Sources/AppwriteModels/ColumnUrl.swift index 29ef440..ee54f27 100644 --- a/Sources/AppwriteModels/ColumnUrl.swift +++ b/Sources/AppwriteModels/ColumnUrl.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// ColumnURL open class ColumnUrl: Codable { @@ -24,7 +25,7 @@ open class ColumnUrl: Codable { public let type: String /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - public let status: String + public let status: AppwriteEnums.ColumnStatus /// Error message. Displays error generated on failure of creating or deleting an column. public let error: String @@ -51,7 +52,7 @@ open class ColumnUrl: Codable { init( key: String, type: String, - status: String, + status: AppwriteEnums.ColumnStatus, error: String, `required`: Bool, array: Bool?, @@ -77,7 +78,7 @@ open class ColumnUrl: Codable { self.key = try container.decode(String.self, forKey: .key) self.type = try container.decode(String.self, forKey: .type) - self.status = try container.decode(String.self, forKey: .status) + self.status = AppwriteEnums.ColumnStatus(rawValue: try container.decode(String.self, forKey: .status))! self.error = try container.decode(String.self, forKey: .error) self.`required` = try container.decode(Bool.self, forKey: .`required`) self.array = try container.decodeIfPresent(Bool.self, forKey: .array) @@ -92,7 +93,7 @@ open class ColumnUrl: Codable { try container.encode(key, forKey: .key) try container.encode(type, forKey: .type) - try container.encode(status, forKey: .status) + try container.encode(status.rawValue, forKey: .status) try container.encode(error, forKey: .error) try container.encode(`required`, forKey: .`required`) try container.encodeIfPresent(array, forKey: .array) @@ -106,7 +107,7 @@ open class ColumnUrl: Codable { return [ "key": key as Any, "type": type as Any, - "status": status as Any, + "status": status.rawValue as Any, "error": error as Any, "required": `required` as Any, "array": array as Any, @@ -121,7 +122,7 @@ open class ColumnUrl: Codable { return ColumnUrl( key: map["key"] as! String, type: map["type"] as! String, - status: map["status"] as! String, + status: ColumnStatus(rawValue: map["status"] as! String)!, error: map["error"] as! String, required: map["required"] as! Bool, array: map["array"] as? Bool, diff --git a/Sources/AppwriteModels/Database.swift b/Sources/AppwriteModels/Database.swift index c3e5a10..d23aa8f 100644 --- a/Sources/AppwriteModels/Database.swift +++ b/Sources/AppwriteModels/Database.swift @@ -1,5 +1,6 @@ import Foundation import JSONCodable +import AppwriteEnums /// Database open class Database: Codable { @@ -29,7 +30,7 @@ open class Database: Codable { public let enabled: Bool /// Database type. - public let type: String + public let type: AppwriteEnums.DatabaseType init( @@ -38,7 +39,7 @@ open class Database: Codable { createdAt: String, updatedAt: String, enabled: Bool, - type: String + type: AppwriteEnums.DatabaseType ) { self.id = id self.name = name @@ -56,7 +57,7 @@ open class Database: Codable { self.createdAt = try container.decode(String.self, forKey: .createdAt) self.updatedAt = try container.decode(String.self, forKey: .updatedAt) self.enabled = try container.decode(Bool.self, forKey: .enabled) - self.type = try container.decode(String.self, forKey: .type) + self.type = AppwriteEnums.DatabaseType(rawValue: try container.decode(String.self, forKey: .type))! } public func encode(to encoder: Encoder) throws { @@ -67,7 +68,7 @@ open class Database: Codable { try container.encode(createdAt, forKey: .createdAt) try container.encode(updatedAt, forKey: .updatedAt) try container.encode(enabled, forKey: .enabled) - try container.encode(type, forKey: .type) + try container.encode(type.rawValue, forKey: .type) } public func toMap() -> [String: Any] { @@ -77,7 +78,7 @@ open class Database: Codable { "$createdAt": createdAt as Any, "$updatedAt": updatedAt as Any, "enabled": enabled as Any, - "type": type as Any + "type": type.rawValue as Any ] } @@ -88,7 +89,7 @@ open class Database: Codable { createdAt: map["$createdAt"] as! String, updatedAt: map["$updatedAt"] as! String, enabled: map["enabled"] as! Bool, - type: map["type"] as! String + type: DatabaseType(rawValue: map["type"] as! String)! ) } }