diff --git a/CHANGELOG.md b/CHANGELOG.md index fa4d35e..6cb1cca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,45 @@ -# Change Log \ No newline at end of file +# Change Log + +## 10.2.0 + +* Update sdk to use swift-native doc comments instead of jsdoc styled comments as per [Swift Documentation Comments](https://github.com/swiftlang/swift/blob/main/docs/DocumentationComments.md) +* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service +* Add `gif` support to `ImageFormat` enum +* Add `sequence` support to `Document` model +* Add `dart38` and `flutter332` support to runtime models + +## 10.1.0 + +* Adds `upsertDocument` method +* Adds warnings to bulk operation methods +* Adds the new `encrypt` attribute +* Adds runtimes: `flutter332` and `dart38` +* Fix `select` Queries by updating internal attributes like `id`, `createdAt`, `updatedAt` etc. to be optional in `Document` model. +* Fix `listCollection` errors by updating `attributes` typing +* Fix querying datetime values by properly encoding URLs + +## 10.0.0 + +* Add `` to doc examples due to the new multi region endpoints +* Add doc examples and methods for bulk api transactions: `createDocuments`, `deleteDocuments` etc. +* Add doc examples, class and methods for new `Sites` service +* Add doc examples, class and methods for new `Tokens` service +* Add enums for `BuildRuntime `, `Adapter`, `Framework`, `DeploymentDownloadType` and `VCSDeploymentType` +* Update enum for `runtimes` with Pythonml312, Dart219, Flutter327 and Flutter329 +* Add `token` param to `getFilePreview` and `getFileView` for File tokens usage +* Add `queries` and `search` params to `listMemberships` method +* Remove `search` param from `listExecutions` method + +## 9.0.0 + +* Fix requests failing by removing `Content-Type` header from `GET` and `HEAD` requests + +## 8.0.0 + +* Remove redundant titles from method descriptions. +* Add `codable` models +* Ensure response attribute in `AppwriteException` is always string + +## 7.0.0 + +* Fix pong response & chunked upload diff --git a/README.md b/README.md index 7de6f65..f18bc63 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Appwrite is an open-source backend as a service server that abstract and simplif The Appwrite Swift SDK is available via Swift Package Manager. In order to use the Appwrite Swift SDK from Xcode, select File > **Add Packages** -In the dialog that appears, enter the Appwrite Swift SDK [package URL](git@github.com:appwrite/sdk-for-swift.git) in the search field. Once found, select `sdk-for-apple`. +In the dialog that appears, enter the Appwrite Swift SDK [package URL](git@github.com:appwrite/sdk-for-swift.git) in the search field. Once found, select `sdk-for-swift`. On the right, select your version rules and ensure your desired target is selected in the **Add to Project** field. @@ -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: "10.1.0"), + .package(url: "git@github.com:appwrite/sdk-for-swift.git", from: "10.2.0"), ], ``` @@ -118,6 +118,63 @@ func main() { } ``` +### Type Safety with Models + +The Appwrite Swift SDK provides type safety when working with database documents through generic methods. Methods like `listDocuments`, `getDocument`, and others accept a `nestedType` parameter that allows you to specify your custom model type for full type safety. + +```swift +struct Book: Codable { + let name: String + let author: String + let releaseYear: String? + let category: String? + let genre: [String]? + let isCheckedOut: Bool +} + +let databases = Databases(client) + +do { + let documents = try await databases.listDocuments( + databaseId: "your-database-id", + collectionId: "your-collection-id", + nestedType: Book.self // Pass in your custom model type + ) + + for book in documents.documents { + print("Book: \(book.name) by \(book.author)") // Now you have full type safety + } +} catch { + print(error.localizedDescription) +} +``` + +**Tip**: You can use the `appwrite types` command to automatically generate model definitions based on your Appwrite database schema. Learn more about [type generation](https://appwrite.io/docs/products/databases/type-generation). + +### Working with Model Methods + +All Appwrite models come with built-in methods for data conversion and manipulation: + +**`toMap()`** - Converts a model instance to a dictionary format, useful for debugging or manual data manipulation: +```swift +let user = try await account.get() +let userMap = user.toMap() +print(userMap) // Prints all user properties as a dictionary +``` + +**`from(map:)`** - Creates a model instance from a dictionary, useful when working with raw data: +```swift +let userData: [String: Any] = ["$id": "123", "name": "John", "email": "john@example.com"] +let user = User.from(map: userData) +``` + +**`encode(to:)`** - Encodes the model to JSON format (part of Swift's Codable protocol), useful for serialization: +```swift +let user = try await account.get() +let jsonData = try JSONEncoder().encode(user) +let jsonString = String(data: jsonData, encoding: .utf8) +``` + ### Error Handling When an error occurs, the Appwrite Swift SDK throws an `AppwriteError` object with `message` and `code` properties. You can handle any errors in a catch block and present the `message` or `localizedDescription` to the user or handle it yourself based on the provided error information. Below is an example. diff --git a/Sources/Appwrite/Client.swift b/Sources/Appwrite/Client.swift index 0436599..6a21d52 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": "10.1.0", + "x-sdk-version": "10.2.0", "x-appwrite-response-format": "1.7.0" ] diff --git a/Sources/Appwrite/Services/Account.swift b/Sources/Appwrite/Services/Account.swift index 629614a..8e93bc4 100644 --- a/Sources/Appwrite/Services/Account.swift +++ b/Sources/Appwrite/Services/Account.swift @@ -11,8 +11,8 @@ open class Account: Service { /// /// Get the currently logged in user. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func get( nestedType: T.Type @@ -39,8 +39,8 @@ open class Account: Service { /// /// Get the currently logged in user. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func get( ) async throws -> AppwriteModels.User<[String: AnyCodable]> { @@ -58,12 +58,13 @@ open class Account: Service { /// login to their new account, you need to create a new [account /// session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession). /// - /// @param String userId - /// @param String email - /// @param String password - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - email: String + /// - password: String + /// - name: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func create( userId: String, @@ -107,12 +108,13 @@ open class Account: Service { /// login to their new account, you need to create a new [account /// session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession). /// - /// @param String userId - /// @param String email - /// @param String password - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - email: String + /// - password: String + /// - name: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func create( userId: String, @@ -139,10 +141,11 @@ open class Account: Service { /// one, by passing an email address and a new password. /// /// - /// @param String email - /// @param String password - /// @throws Exception - /// @return array + /// - Parameters: + /// - email: String + /// - password: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updateEmail( email: String, @@ -183,10 +186,11 @@ open class Account: Service { /// one, by passing an email address and a new password. /// /// - /// @param String email - /// @param String password - /// @throws Exception - /// @return array + /// - Parameters: + /// - email: String + /// - password: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updateEmail( email: String, @@ -202,9 +206,10 @@ open class Account: Service { /// /// Get the list of identities for the currently logged in user. /// - /// @param [String] queries - /// @throws Exception - /// @return array + /// - Parameters: + /// - queries: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.IdentityList /// open func listIdentities( queries: [String]? = nil @@ -233,9 +238,10 @@ open class Account: Service { /// /// Delete an identity by its unique ID. /// - /// @param String identityId - /// @throws Exception - /// @return array + /// - Parameters: + /// - identityId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteIdentity( identityId: String @@ -263,8 +269,8 @@ open class Account: Service { /// from its creation and will be invalid if the user will logout in that time /// frame. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Jwt /// open func createJWT( ) async throws -> AppwriteModels.Jwt { @@ -293,9 +299,10 @@ open class Account: Service { /// Get the list of latest security activity logs for the currently logged in /// user. Each log returns user IP address, location and date and time of log. /// - /// @param [String] queries - /// @throws Exception - /// @return array + /// - Parameters: + /// - queries: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.LogList /// open func listLogs( queries: [String]? = nil @@ -324,9 +331,10 @@ open class Account: Service { /// /// Enable or disable MFA on an account. /// - /// @param Bool mfa - /// @throws Exception - /// @return array + /// - Parameters: + /// - mfa: Bool + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updateMFA( mfa: Bool, @@ -358,9 +366,10 @@ open class Account: Service { /// /// Enable or disable MFA on an account. /// - /// @param Bool mfa - /// @throws Exception - /// @return array + /// - Parameters: + /// - mfa: Bool + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updateMFA( mfa: Bool @@ -377,9 +386,10 @@ open class Account: Service { /// authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) /// method. /// - /// @param AppwriteEnums.AuthenticatorType type - /// @throws Exception - /// @return array + /// - Parameters: + /// - type: AppwriteEnums.AuthenticatorType + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.MfaType /// open func createMfaAuthenticator( type: AppwriteEnums.AuthenticatorType @@ -411,10 +421,11 @@ open class Account: Service { /// authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) /// method. /// - /// @param AppwriteEnums.AuthenticatorType type - /// @param String otp - /// @throws Exception - /// @return array + /// - Parameters: + /// - type: AppwriteEnums.AuthenticatorType + /// - otp: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updateMfaAuthenticator( type: AppwriteEnums.AuthenticatorType, @@ -450,10 +461,11 @@ open class Account: Service { /// authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) /// method. /// - /// @param AppwriteEnums.AuthenticatorType type - /// @param String otp - /// @throws Exception - /// @return array + /// - Parameters: + /// - type: AppwriteEnums.AuthenticatorType + /// - otp: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updateMfaAuthenticator( type: AppwriteEnums.AuthenticatorType, @@ -469,9 +481,10 @@ open class Account: Service { /// /// Delete an authenticator for a user by ID. /// - /// @param AppwriteEnums.AuthenticatorType type - /// @throws Exception - /// @return array + /// - Parameters: + /// - type: AppwriteEnums.AuthenticatorType + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteMfaAuthenticator( type: AppwriteEnums.AuthenticatorType @@ -497,9 +510,10 @@ open class Account: Service { /// [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) /// method. /// - /// @param AppwriteEnums.AuthenticationFactor factor - /// @throws Exception - /// @return array + /// - Parameters: + /// - factor: AppwriteEnums.AuthenticationFactor + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.MfaChallenge /// open func createMfaChallenge( factor: AppwriteEnums.AuthenticationFactor @@ -534,10 +548,11 @@ open class Account: Service { /// [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) /// method. /// - /// @param String challengeId - /// @param String otp - /// @throws Exception - /// @return array + /// - Parameters: + /// - challengeId: String + /// - otp: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Session /// open func updateMfaChallenge( challengeId: String, @@ -570,8 +585,8 @@ open class Account: Service { /// /// List the factors available on the account to be used as a MFA challange. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.MfaFactors /// open func listMfaFactors( ) async throws -> AppwriteModels.MfaFactors { @@ -600,8 +615,8 @@ open class Account: Service { /// [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) /// method. An OTP challenge is required to read recovery codes. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.MfaRecoveryCodes /// open func getMfaRecoveryCodes( ) async throws -> AppwriteModels.MfaRecoveryCodes { @@ -631,8 +646,8 @@ open class Account: Service { /// [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) /// method. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.MfaRecoveryCodes /// open func createMfaRecoveryCodes( ) async throws -> AppwriteModels.MfaRecoveryCodes { @@ -663,8 +678,8 @@ open class Account: Service { /// [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) /// method. An OTP challenge is required to regenreate recovery codes. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.MfaRecoveryCodes /// open func updateMfaRecoveryCodes( ) async throws -> AppwriteModels.MfaRecoveryCodes { @@ -692,9 +707,10 @@ open class Account: Service { /// /// Update currently logged in user account name. /// - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - name: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updateName( name: String, @@ -726,9 +742,10 @@ open class Account: Service { /// /// Update currently logged in user account name. /// - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - name: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updateName( name: String @@ -744,10 +761,11 @@ open class Account: Service { /// to pass in the new password, and the old password. For users created with /// OAuth, Team Invites and Magic URL, oldPassword is optional. /// - /// @param String password - /// @param String oldPassword - /// @throws Exception - /// @return array + /// - Parameters: + /// - password: String + /// - oldPassword: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updatePassword( password: String, @@ -783,10 +801,11 @@ open class Account: Service { /// to pass in the new password, and the old password. For users created with /// OAuth, Team Invites and Magic URL, oldPassword is optional. /// - /// @param String password - /// @param String oldPassword - /// @throws Exception - /// @return array + /// - Parameters: + /// - password: String + /// - oldPassword: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updatePassword( password: String, @@ -806,10 +825,11 @@ open class Account: Service { /// /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) /// endpoint to send a confirmation SMS. /// - /// @param String phone - /// @param String password - /// @throws Exception - /// @return array + /// - Parameters: + /// - phone: String + /// - password: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updatePhone( phone: String, @@ -847,10 +867,11 @@ open class Account: Service { /// /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) /// endpoint to send a confirmation SMS. /// - /// @param String phone - /// @param String password - /// @throws Exception - /// @return array + /// - Parameters: + /// - phone: String + /// - password: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updatePhone( phone: String, @@ -866,8 +887,8 @@ open class Account: Service { /// /// Get the preferences as a key-value object for the currently logged in user. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Preferences /// open func getPrefs( nestedType: T.Type @@ -894,8 +915,8 @@ open class Account: Service { /// /// Get the preferences as a key-value object for the currently logged in user. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Preferences /// open func getPrefs( ) async throws -> AppwriteModels.Preferences<[String: AnyCodable]> { @@ -909,9 +930,10 @@ open class Account: Service { /// stored as is, and replaces any previous value. The maximum allowed prefs /// size is 64kB and throws error if exceeded. /// - /// @param Any prefs - /// @throws Exception - /// @return array + /// - Parameters: + /// - prefs: Any + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updatePrefs( prefs: Any, @@ -945,9 +967,10 @@ open class Account: Service { /// stored as is, and replaces any previous value. The maximum allowed prefs /// size is 64kB and throws error if exceeded. /// - /// @param Any prefs - /// @throws Exception - /// @return array + /// - Parameters: + /// - prefs: Any + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updatePrefs( prefs: Any @@ -968,10 +991,11 @@ open class Account: Service { /// endpoint to complete the process. The verification link sent to the user's /// email address is valid for 1 hour. /// - /// @param String email - /// @param String url - /// @throws Exception - /// @return array + /// - Parameters: + /// - email: String + /// - url: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Token /// open func createRecovery( email: String, @@ -1013,11 +1037,12 @@ open class Account: Service { /// the only valid redirect URLs are the ones from domains you have set when /// adding your platforms in the console interface. /// - /// @param String userId - /// @param String secret - /// @param String password - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - secret: String + /// - password: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Token /// open func updateRecovery( userId: String, @@ -1053,8 +1078,8 @@ open class Account: Service { /// Get the list of active sessions across different devices for the currently /// logged in user. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.SessionList /// open func listSessions( ) async throws -> AppwriteModels.SessionList { @@ -1081,8 +1106,8 @@ open class Account: Service { /// Delete all sessions from the user account and remove any sessions cookies /// from the end client. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteSessions( ) async throws -> Any { @@ -1110,8 +1135,8 @@ open class Account: Service { /// or create an [OAuth2 /// session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session). /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Session /// open func createAnonymousSession( ) async throws -> AppwriteModels.Session { @@ -1144,10 +1169,11 @@ open class Account: Service { /// about session /// limits](https://appwrite.io/docs/authentication-security#limits). /// - /// @param String email - /// @param String password - /// @throws Exception - /// @return array + /// - Parameters: + /// - email: String + /// - password: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Session /// open func createEmailPasswordSession( email: String, @@ -1182,10 +1208,11 @@ open class Account: Service { /// and **secret** parameters from the successful response of authentication /// flows initiated by token creation. For example, magic URL and phone login. /// - /// @param String userId - /// @param String secret - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - secret: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Session /// open func updateMagicURLSession( userId: String, @@ -1220,10 +1247,11 @@ open class Account: Service { /// and **secret** parameters from the successful response of authentication /// flows initiated by token creation. For example, magic URL and phone login. /// - /// @param String userId - /// @param String secret - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - secret: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Session /// open func updatePhoneSession( userId: String, @@ -1258,10 +1286,11 @@ open class Account: Service { /// and **secret** parameters from the successful response of authentication /// flows initiated by token creation. For example, magic URL and phone login. /// - /// @param String userId - /// @param String secret - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - secret: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Session /// open func createSession( userId: String, @@ -1295,9 +1324,10 @@ open class Account: Service { /// Use this endpoint to get a logged in user's session using a Session ID. /// Inputting 'current' will return the current session being used. /// - /// @param String sessionId - /// @throws Exception - /// @return array + /// - Parameters: + /// - sessionId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Session /// open func getSession( sessionId: String @@ -1327,9 +1357,10 @@ open class Account: Service { /// useful when session expiry is short. If the session was created using an /// OAuth provider, this endpoint refreshes the access token from the provider. /// - /// @param String sessionId - /// @throws Exception - /// @return array + /// - Parameters: + /// - sessionId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Session /// open func updateSession( sessionId: String @@ -1363,9 +1394,10 @@ open class Account: Service { /// Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) /// instead. /// - /// @param String sessionId - /// @throws Exception - /// @return array + /// - Parameters: + /// - sessionId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteSession( sessionId: String @@ -1391,8 +1423,8 @@ open class Account: Service { /// record is not deleted but permanently blocked from any access. To /// completely delete a user, use the Users API instead. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updateStatus( nestedType: T.Type @@ -1423,8 +1455,8 @@ open class Account: Service { /// record is not deleted but permanently blocked from any access. To /// completely delete a user, use the Users API instead. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updateStatus( ) async throws -> AppwriteModels.User<[String: AnyCodable]> { @@ -1445,11 +1477,12 @@ open class Account: Service { /// about session /// limits](https://appwrite.io/docs/authentication-security#limits). /// - /// @param String userId - /// @param String email - /// @param Bool phrase - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - email: String + /// - phrase: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Token /// open func createEmailToken( userId: String, @@ -1497,12 +1530,13 @@ open class Account: Service { /// limits](https://appwrite.io/docs/authentication-security#limits). /// /// - /// @param String userId - /// @param String email - /// @param String url - /// @param Bool phrase - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - email: String + /// - url: String (optional) + /// - phrase: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Token /// open func createMagicURLToken( userId: String, @@ -1552,12 +1586,13 @@ open class Account: Service { /// about session /// limits](https://appwrite.io/docs/authentication-security#limits). /// - /// @param AppwriteEnums.OAuthProvider provider - /// @param String success - /// @param String failure - /// @param [String] scopes - /// @throws Exception - /// @return array + /// - Parameters: + /// - provider: AppwriteEnums.OAuthProvider + /// - success: String (optional) + /// - failure: String (optional) + /// - scopes: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: String? /// open func createOAuth2Token( provider: AppwriteEnums.OAuthProvider, @@ -1597,10 +1632,11 @@ open class Account: Service { /// about session /// limits](https://appwrite.io/docs/authentication-security#limits). /// - /// @param String userId - /// @param String phone - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - phone: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Token /// open func createPhoneToken( userId: String, @@ -1647,9 +1683,10 @@ open class Account: Service { /// adding your platforms in the console interface. /// /// - /// @param String url - /// @throws Exception - /// @return array + /// - Parameters: + /// - url: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Token /// open func createVerification( url: String @@ -1683,10 +1720,11 @@ open class Account: Service { /// to verify the user email ownership. If confirmed this route will return a /// 200 status code. /// - /// @param String userId - /// @param String secret - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - secret: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Token /// open func updateVerification( userId: String, @@ -1726,8 +1764,8 @@ open class Account: Service { /// The verification code sent to the user's phone number is valid for 15 /// minutes. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Token /// open func createPhoneVerification( ) async throws -> AppwriteModels.Token { @@ -1758,10 +1796,11 @@ open class Account: Service { /// verify the user email ownership. If confirmed this route will return a 200 /// status code. /// - /// @param String userId - /// @param String secret - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - secret: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Token /// open func updatePhoneVerification( userId: String, diff --git a/Sources/Appwrite/Services/Avatars.swift b/Sources/Appwrite/Services/Avatars.swift index 6c70f98..24f4b07 100644 --- a/Sources/Appwrite/Services/Avatars.swift +++ b/Sources/Appwrite/Services/Avatars.swift @@ -20,12 +20,13 @@ open class Avatars: Service { /// image at source quality. If dimensions are not specified, the default size /// of image returned is 100x100px. /// - /// @param AppwriteEnums.Browser code - /// @param Int width - /// @param Int height - /// @param Int quality - /// @throws Exception - /// @return array + /// - Parameters: + /// - code: AppwriteEnums.Browser + /// - width: Int (optional) + /// - height: Int (optional) + /// - quality: Int (optional) + /// - Throws: Exception if the request fails + /// - Returns: ByteBuffer /// open func getBrowser( code: AppwriteEnums.Browser, @@ -64,12 +65,13 @@ open class Avatars: Service { /// of image returned is 100x100px. /// /// - /// @param AppwriteEnums.CreditCard code - /// @param Int width - /// @param Int height - /// @param Int quality - /// @throws Exception - /// @return array + /// - Parameters: + /// - code: AppwriteEnums.CreditCard + /// - width: Int (optional) + /// - height: Int (optional) + /// - quality: Int (optional) + /// - Throws: Exception if the request fails + /// - Returns: ByteBuffer /// open func getCreditCard( code: AppwriteEnums.CreditCard, @@ -103,9 +105,10 @@ open class Avatars: Service { /// /// This endpoint does not follow HTTP redirects. /// - /// @param String url - /// @throws Exception - /// @return array + /// - Parameters: + /// - url: String + /// - Throws: Exception if the request fails + /// - Returns: ByteBuffer /// open func getFavicon( url: String @@ -139,12 +142,13 @@ open class Avatars: Service { /// of image returned is 100x100px. /// /// - /// @param AppwriteEnums.Flag code - /// @param Int width - /// @param Int height - /// @param Int quality - /// @throws Exception - /// @return array + /// - Parameters: + /// - code: AppwriteEnums.Flag + /// - width: Int (optional) + /// - height: Int (optional) + /// - quality: Int (optional) + /// - Throws: Exception if the request fails + /// - Returns: ByteBuffer /// open func getFlag( code: AppwriteEnums.Flag, @@ -185,11 +189,12 @@ open class Avatars: Service { /// /// This endpoint does not follow HTTP redirects. /// - /// @param String url - /// @param Int width - /// @param Int height - /// @throws Exception - /// @return array + /// - Parameters: + /// - url: String + /// - width: Int (optional) + /// - height: Int (optional) + /// - Throws: Exception if the request fails + /// - Returns: ByteBuffer /// open func getImage( url: String, @@ -233,12 +238,13 @@ open class Avatars: Service { /// of image returned is 100x100px. /// /// - /// @param String name - /// @param Int width - /// @param Int height - /// @param String background - /// @throws Exception - /// @return array + /// - Parameters: + /// - name: String (optional) + /// - width: Int (optional) + /// - height: Int (optional) + /// - background: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: ByteBuffer /// open func getInitials( name: String? = nil, @@ -271,12 +277,13 @@ open class Avatars: Service { /// parameters to change the size and style of the resulting image. /// /// - /// @param String text - /// @param Int size - /// @param Int margin - /// @param Bool download - /// @throws Exception - /// @return array + /// - Parameters: + /// - text: String + /// - size: Int (optional) + /// - margin: Int (optional) + /// - download: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: ByteBuffer /// open func getQR( text: String, diff --git a/Sources/Appwrite/Services/Databases.swift b/Sources/Appwrite/Services/Databases.swift index aae760f..86e8362 100644 --- a/Sources/Appwrite/Services/Databases.swift +++ b/Sources/Appwrite/Services/Databases.swift @@ -12,10 +12,11 @@ open class Databases: Service { /// Get a list of all databases from the current Appwrite project. You can use /// the search parameter to filter your results. /// - /// @param [String] queries - /// @param String search - /// @throws Exception - /// @return array + /// - Parameters: + /// - queries: [String] (optional) + /// - search: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.DatabaseList /// open func list( queries: [String]? = nil, @@ -47,11 +48,12 @@ open class Databases: Service { /// Create a new Database. /// /// - /// @param String databaseId - /// @param String name - /// @param Bool enabled - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - name: String + /// - enabled: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Database /// open func create( databaseId: String, @@ -87,9 +89,10 @@ open class Databases: Service { /// Get a database by its unique ID. This endpoint response returns a JSON /// object with the database metadata. /// - /// @param String databaseId - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Database /// open func get( databaseId: String @@ -117,11 +120,12 @@ open class Databases: Service { /// /// Update a database by its unique ID. /// - /// @param String databaseId - /// @param String name - /// @param Bool enabled - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - name: String + /// - enabled: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Database /// open func update( databaseId: String, @@ -157,9 +161,10 @@ open class Databases: Service { /// Delete a database by its unique ID. Only API keys with with databases.write /// scope can delete a database. /// - /// @param String databaseId - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func delete( databaseId: String @@ -184,11 +189,12 @@ open class Databases: Service { /// Get a list of all collections that belong to the provided databaseId. You /// can use the search parameter to filter your results. /// - /// @param String databaseId - /// @param [String] queries - /// @param String search - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - queries: [String] (optional) + /// - search: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.CollectionList /// open func listCollections( databaseId: String, @@ -224,14 +230,15 @@ open class Databases: Service { /// integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) /// API or directly from your database console. /// - /// @param String databaseId - /// @param String collectionId - /// @param String name - /// @param [String] permissions - /// @param Bool documentSecurity - /// @param Bool enabled - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - name: String + /// - permissions: [String] (optional) + /// - documentSecurity: Bool (optional) + /// - enabled: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Collection /// open func createCollection( databaseId: String, @@ -273,10 +280,11 @@ open class Databases: Service { /// Get a collection by its unique ID. This endpoint response returns a JSON /// object with the collection metadata. /// - /// @param String databaseId - /// @param String collectionId - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Collection /// open func getCollection( databaseId: String, @@ -306,14 +314,15 @@ open class Databases: Service { /// /// Update a collection by its unique ID. /// - /// @param String databaseId - /// @param String collectionId - /// @param String name - /// @param [String] permissions - /// @param Bool documentSecurity - /// @param Bool enabled - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - name: String + /// - permissions: [String] (optional) + /// - documentSecurity: Bool (optional) + /// - enabled: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Collection /// open func updateCollection( databaseId: String, @@ -355,10 +364,11 @@ open class Databases: Service { /// Delete a collection by its unique ID. Only users with write permissions /// have access to delete this resource. /// - /// @param String databaseId - /// @param String collectionId - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteCollection( databaseId: String, @@ -384,11 +394,12 @@ open class Databases: Service { /// /// List attributes in the collection. /// - /// @param String databaseId - /// @param String collectionId - /// @param [String] queries - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - queries: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.AttributeList /// open func listAttributes( databaseId: String, @@ -422,14 +433,15 @@ open class Databases: Service { /// Create a boolean attribute. /// /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @param Bool required - /// @param Bool default - /// @param Bool array - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - required: Bool + /// - default: Bool (optional) + /// - array: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.AttributeBoolean /// open func createBooleanAttribute( databaseId: String, @@ -471,14 +483,15 @@ open class Databases: Service { /// Update a boolean attribute. Changing the `default` value will not update /// already existing documents. /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @param Bool required - /// @param Bool default - /// @param String newKey - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - required: Bool + /// - default: Bool (optional) + /// - newKey: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.AttributeBoolean /// open func updateBooleanAttribute( databaseId: String, @@ -519,14 +532,15 @@ open class Databases: Service { /// /// Create a date time attribute according to the ISO 8601 standard. /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @param Bool required - /// @param String default - /// @param Bool array - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - required: Bool + /// - default: String (optional) + /// - array: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.AttributeDatetime /// open func createDatetimeAttribute( databaseId: String, @@ -568,14 +582,15 @@ open class Databases: Service { /// Update a date time attribute. Changing the `default` value will not update /// already existing documents. /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @param Bool required - /// @param String default - /// @param String newKey - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - required: Bool + /// - default: String (optional) + /// - newKey: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.AttributeDatetime /// open func updateDatetimeAttribute( databaseId: String, @@ -617,14 +632,15 @@ open class Databases: Service { /// Create an email attribute. /// /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @param Bool required - /// @param String default - /// @param Bool array - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - required: Bool + /// - default: String (optional) + /// - array: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.AttributeEmail /// open func createEmailAttribute( databaseId: String, @@ -667,14 +683,15 @@ open class Databases: Service { /// already existing documents. /// /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @param Bool required - /// @param String default - /// @param String newKey - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - required: Bool + /// - default: String (optional) + /// - newKey: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.AttributeEmail /// open func updateEmailAttribute( databaseId: String, @@ -717,15 +734,16 @@ open class Databases: Service { /// of accepted values for this attribute. /// /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @param [String] elements - /// @param Bool required - /// @param String default - /// @param Bool array - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - elements: [String] + /// - required: Bool + /// - default: String (optional) + /// - array: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.AttributeEnum /// open func createEnumAttribute( databaseId: String, @@ -770,15 +788,16 @@ open class Databases: Service { /// already existing documents. /// /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @param [String] elements - /// @param Bool required - /// @param String default - /// @param String newKey - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - elements: [String] + /// - required: Bool + /// - default: String (optional) + /// - newKey: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.AttributeEnum /// open func updateEnumAttribute( databaseId: String, @@ -823,16 +842,17 @@ open class Databases: Service { /// provided. /// /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @param Bool required - /// @param Double min - /// @param Double max - /// @param Double default - /// @param Bool array - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - required: Bool + /// - min: Double (optional) + /// - max: Double (optional) + /// - default: Double (optional) + /// - array: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.AttributeFloat /// open func createFloatAttribute( databaseId: String, @@ -879,16 +899,17 @@ open class Databases: Service { /// already existing documents. /// /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @param Bool required - /// @param Double default - /// @param Double min - /// @param Double max - /// @param String newKey - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - required: Bool + /// - default: Double (optional) + /// - min: Double (optional) + /// - max: Double (optional) + /// - newKey: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.AttributeFloat /// open func updateFloatAttribute( databaseId: String, @@ -935,16 +956,17 @@ open class Databases: Service { /// provided. /// /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @param Bool required - /// @param Int min - /// @param Int max - /// @param Int default - /// @param Bool array - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - required: Bool + /// - min: Int (optional) + /// - max: Int (optional) + /// - default: Int (optional) + /// - array: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.AttributeInteger /// open func createIntegerAttribute( databaseId: String, @@ -991,16 +1013,17 @@ open class Databases: Service { /// already existing documents. /// /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @param Bool required - /// @param Int default - /// @param Int min - /// @param Int max - /// @param String newKey - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - required: Bool + /// - default: Int (optional) + /// - min: Int (optional) + /// - max: Int (optional) + /// - newKey: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.AttributeInteger /// open func updateIntegerAttribute( databaseId: String, @@ -1046,14 +1069,15 @@ open class Databases: Service { /// Create IP address attribute. /// /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @param Bool required - /// @param String default - /// @param Bool array - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - required: Bool + /// - default: String (optional) + /// - array: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.AttributeIp /// open func createIpAttribute( databaseId: String, @@ -1096,14 +1120,15 @@ open class Databases: Service { /// already existing documents. /// /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @param Bool required - /// @param String default - /// @param String newKey - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - required: Bool + /// - default: String (optional) + /// - newKey: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.AttributeIp /// open func updateIpAttribute( databaseId: String, @@ -1146,16 +1171,17 @@ open class Databases: Service { /// attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). /// /// - /// @param String databaseId - /// @param String collectionId - /// @param String relatedCollectionId - /// @param AppwriteEnums.RelationshipType type - /// @param Bool twoWay - /// @param String key - /// @param String twoWayKey - /// @param AppwriteEnums.RelationMutate onDelete - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - relatedCollectionId: String + /// - type: AppwriteEnums.RelationshipType + /// - twoWay: Bool (optional) + /// - key: String (optional) + /// - twoWayKey: String (optional) + /// - onDelete: AppwriteEnums.RelationMutate (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.AttributeRelationship /// open func createRelationshipAttribute( databaseId: String, @@ -1201,16 +1227,17 @@ open class Databases: Service { /// Create a string attribute. /// /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @param Int size - /// @param Bool required - /// @param String default - /// @param Bool array - /// @param Bool encrypt - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - size: Int + /// - required: Bool + /// - default: String (optional) + /// - array: Bool (optional) + /// - encrypt: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.AttributeString /// open func createStringAttribute( databaseId: String, @@ -1257,15 +1284,16 @@ open class Databases: Service { /// already existing documents. /// /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @param Bool required - /// @param String default - /// @param Int size - /// @param String newKey - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - required: Bool + /// - default: String (optional) + /// - size: Int (optional) + /// - newKey: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.AttributeString /// open func updateStringAttribute( databaseId: String, @@ -1309,14 +1337,15 @@ open class Databases: Service { /// Create a URL attribute. /// /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @param Bool required - /// @param String default - /// @param Bool array - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - required: Bool + /// - default: String (optional) + /// - array: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.AttributeUrl /// open func createUrlAttribute( databaseId: String, @@ -1359,14 +1388,15 @@ open class Databases: Service { /// already existing documents. /// /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @param Bool required - /// @param String default - /// @param String newKey - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - required: Bool + /// - default: String (optional) + /// - newKey: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.AttributeUrl /// open func updateUrlAttribute( databaseId: String, @@ -1407,11 +1437,12 @@ open class Databases: Service { /// /// Get attribute by ID. /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func getAttribute( databaseId: String, @@ -1437,11 +1468,12 @@ open class Databases: Service { /// /// Deletes an attribute. /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteAttribute( databaseId: String, @@ -1471,13 +1503,14 @@ open class Databases: Service { /// attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). /// /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @param AppwriteEnums.RelationMutate onDelete - /// @param String newKey - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - onDelete: AppwriteEnums.RelationMutate (optional) + /// - newKey: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.AttributeRelationship /// open func updateRelationshipAttribute( databaseId: String, @@ -1517,11 +1550,12 @@ open class Databases: Service { /// Get a list of all the user's documents in a given collection. You can use /// the query params to filter your results. /// - /// @param String databaseId - /// @param String collectionId - /// @param [String] queries - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - queries: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.DocumentList /// open func listDocuments( databaseId: String, @@ -1556,11 +1590,12 @@ open class Databases: Service { /// Get a list of all the user's documents in a given collection. You can use /// the query params to filter your results. /// - /// @param String databaseId - /// @param String collectionId - /// @param [String] queries - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - queries: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.DocumentList /// open func listDocuments( databaseId: String, @@ -1581,13 +1616,14 @@ open class Databases: Service { /// integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) /// API or directly from your database console. /// - /// @param String databaseId - /// @param String collectionId - /// @param String documentId - /// @param Any data - /// @param [String] permissions - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - documentId: String + /// - data: Any + /// - permissions: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Document /// open func createDocument( databaseId: String, @@ -1630,13 +1666,14 @@ open class Databases: Service { /// integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) /// API or directly from your database console. /// - /// @param String databaseId - /// @param String collectionId - /// @param String documentId - /// @param Any data - /// @param [String] permissions - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - documentId: String + /// - data: Any + /// - permissions: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Document /// open func createDocument( databaseId: String, @@ -1665,11 +1702,12 @@ open class Databases: Service { /// integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) /// API or directly from your database console. /// - /// @param String databaseId - /// @param String collectionId - /// @param [Any] documents - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - documents: [Any] + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.DocumentList /// open func createDocuments( databaseId: String, @@ -1712,11 +1750,12 @@ open class Databases: Service { /// integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) /// API or directly from your database console. /// - /// @param String databaseId - /// @param String collectionId - /// @param [Any] documents - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - documents: [Any] + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.DocumentList /// open func createDocuments( databaseId: String, @@ -1742,16 +1781,17 @@ open class Databases: Service { /// API or directly from your database console. /// /// - /// @param String databaseId - /// @param String collectionId - /// @param [Any] documents - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - documents: [Any] + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.DocumentList /// open func upsertDocuments( databaseId: String, collectionId: String, - documents: [Any]? = nil, + documents: [Any], nestedType: T.Type ) async throws -> AppwriteModels.DocumentList { let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/documents" @@ -1790,16 +1830,17 @@ open class Databases: Service { /// API or directly from your database console. /// /// - /// @param String databaseId - /// @param String collectionId - /// @param [Any] documents - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - documents: [Any] + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.DocumentList /// open func upsertDocuments( databaseId: String, collectionId: String, - documents: [Any]? = nil + documents: [Any] ) async throws -> AppwriteModels.DocumentList<[String: AnyCodable]> { return try await upsertDocuments( databaseId: databaseId, @@ -1810,16 +1851,21 @@ open class Databases: Service { } /// + /// **WARNING: Experimental Feature** - This endpoint is experimental and not + /// yet officially supported. It may be subject to breaking changes or removal + /// in future versions. + /// /// Update all documents that match your queries, if no queries are submitted /// then all documents are updated. You can pass only specific fields to be /// updated. /// - /// @param String databaseId - /// @param String collectionId - /// @param Any data - /// @param [String] queries - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - data: Any (optional) + /// - queries: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.DocumentList /// open func updateDocuments( databaseId: String, @@ -1855,16 +1901,21 @@ open class Databases: Service { } /// + /// **WARNING: Experimental Feature** - This endpoint is experimental and not + /// yet officially supported. It may be subject to breaking changes or removal + /// in future versions. + /// /// Update all documents that match your queries, if no queries are submitted /// then all documents are updated. You can pass only specific fields to be /// updated. /// - /// @param String databaseId - /// @param String collectionId - /// @param Any data - /// @param [String] queries - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - data: Any (optional) + /// - queries: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.DocumentList /// open func updateDocuments( databaseId: String, @@ -1889,11 +1940,12 @@ open class Databases: Service { /// Bulk delete documents using queries, if no queries are passed then all /// documents are deleted. /// - /// @param String databaseId - /// @param String collectionId - /// @param [String] queries - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - queries: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.DocumentList /// open func deleteDocuments( databaseId: String, @@ -1934,11 +1986,12 @@ open class Databases: Service { /// Bulk delete documents using queries, if no queries are passed then all /// documents are deleted. /// - /// @param String databaseId - /// @param String collectionId - /// @param [String] queries - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - queries: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.DocumentList /// open func deleteDocuments( databaseId: String, @@ -1957,12 +2010,13 @@ open class Databases: Service { /// Get a document by its unique ID. This endpoint response returns a JSON /// object with the document data. /// - /// @param String databaseId - /// @param String collectionId - /// @param String documentId - /// @param [String] queries - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - documentId: String + /// - queries: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Document /// open func getDocument( databaseId: String, @@ -1999,12 +2053,13 @@ open class Databases: Service { /// Get a document by its unique ID. This endpoint response returns a JSON /// object with the document data. /// - /// @param String databaseId - /// @param String collectionId - /// @param String documentId - /// @param [String] queries - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - documentId: String + /// - queries: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Document /// open func getDocument( databaseId: String, @@ -2031,13 +2086,14 @@ open class Databases: Service { /// integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) /// API or directly from your database console. /// - /// @param String databaseId - /// @param String collectionId - /// @param String documentId - /// @param Any data - /// @param [String] permissions - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - documentId: String + /// - data: Any + /// - permissions: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Document /// open func upsertDocument( databaseId: String, @@ -2084,13 +2140,14 @@ open class Databases: Service { /// integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) /// API or directly from your database console. /// - /// @param String databaseId - /// @param String collectionId - /// @param String documentId - /// @param Any data - /// @param [String] permissions - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - documentId: String + /// - data: Any + /// - permissions: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Document /// open func upsertDocument( databaseId: String, @@ -2113,13 +2170,14 @@ open class Databases: Service { /// Update a document by its unique ID. Using the patch method you can pass /// only specific fields that will get updated. /// - /// @param String databaseId - /// @param String collectionId - /// @param String documentId - /// @param Any data - /// @param [String] permissions - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - documentId: String + /// - data: Any (optional) + /// - permissions: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Document /// open func updateDocument( databaseId: String, @@ -2160,13 +2218,14 @@ open class Databases: Service { /// Update a document by its unique ID. Using the patch method you can pass /// only specific fields that will get updated. /// - /// @param String databaseId - /// @param String collectionId - /// @param String documentId - /// @param Any data - /// @param [String] permissions - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - documentId: String + /// - data: Any (optional) + /// - permissions: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Document /// open func updateDocument( databaseId: String, @@ -2188,11 +2247,12 @@ open class Databases: Service { /// /// Delete a document by its unique ID. /// - /// @param String databaseId - /// @param String collectionId - /// @param String documentId - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - documentId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteDocument( databaseId: String, @@ -2217,14 +2277,179 @@ open class Databases: Service { params: apiParams ) } + /// + /// Decrement a specific attribute of a document by a given value. + /// + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - documentId: String + /// - attribute: String + /// - value: Double (optional) + /// - min: Double (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Document + /// + open func decrementDocumentAttribute( + databaseId: String, + collectionId: String, + documentId: String, + attribute: String, + value: Double? = nil, + min: Double? = nil, + nestedType: T.Type + ) async throws -> AppwriteModels.Document { + let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement" + .replacingOccurrences(of: "{databaseId}", with: databaseId) + .replacingOccurrences(of: "{collectionId}", with: collectionId) + .replacingOccurrences(of: "{documentId}", with: documentId) + .replacingOccurrences(of: "{attribute}", with: attribute) + + let apiParams: [String: Any?] = [ + "value": value, + "min": min + ] + + let apiHeaders: [String: String] = [ + "content-type": "application/json" + ] + + let converter: (Any) -> AppwriteModels.Document = { response in + return AppwriteModels.Document.from(map: response as! [String: Any]) + } + + return try await client.call( + method: "PATCH", + path: apiPath, + headers: apiHeaders, + params: apiParams, + converter: converter + ) + } + + /// + /// Decrement a specific attribute of a document by a given value. + /// + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - documentId: String + /// - attribute: String + /// - value: Double (optional) + /// - min: Double (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Document + /// + open func decrementDocumentAttribute( + databaseId: String, + collectionId: String, + documentId: String, + attribute: String, + value: Double? = nil, + min: Double? = nil + ) async throws -> AppwriteModels.Document<[String: AnyCodable]> { + return try await decrementDocumentAttribute( + databaseId: databaseId, + collectionId: collectionId, + documentId: documentId, + attribute: attribute, + value: value, + min: min, + nestedType: [String: AnyCodable].self + ) + } + + /// + /// Increment a specific attribute of a document by a given value. + /// + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - documentId: String + /// - attribute: String + /// - value: Double (optional) + /// - max: Double (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Document + /// + open func incrementDocumentAttribute( + databaseId: String, + collectionId: String, + documentId: String, + attribute: String, + value: Double? = nil, + max: Double? = nil, + nestedType: T.Type + ) async throws -> AppwriteModels.Document { + let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment" + .replacingOccurrences(of: "{databaseId}", with: databaseId) + .replacingOccurrences(of: "{collectionId}", with: collectionId) + .replacingOccurrences(of: "{documentId}", with: documentId) + .replacingOccurrences(of: "{attribute}", with: attribute) + + let apiParams: [String: Any?] = [ + "value": value, + "max": max + ] + + let apiHeaders: [String: String] = [ + "content-type": "application/json" + ] + + let converter: (Any) -> AppwriteModels.Document = { response in + return AppwriteModels.Document.from(map: response as! [String: Any]) + } + + return try await client.call( + method: "PATCH", + path: apiPath, + headers: apiHeaders, + params: apiParams, + converter: converter + ) + } + + /// + /// Increment a specific attribute of a document by a given value. + /// + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - documentId: String + /// - attribute: String + /// - value: Double (optional) + /// - max: Double (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Document + /// + open func incrementDocumentAttribute( + databaseId: String, + collectionId: String, + documentId: String, + attribute: String, + value: Double? = nil, + max: Double? = nil + ) async throws -> AppwriteModels.Document<[String: AnyCodable]> { + return try await incrementDocumentAttribute( + databaseId: databaseId, + collectionId: collectionId, + documentId: documentId, + attribute: attribute, + value: value, + max: max, + nestedType: [String: AnyCodable].self + ) + } + /// /// List indexes in the collection. /// - /// @param String databaseId - /// @param String collectionId - /// @param [String] queries - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - queries: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.IndexList /// open func listIndexes( databaseId: String, @@ -2259,15 +2484,16 @@ open class Databases: Service { /// the attributes you will query in a single request. /// Attributes can be `key`, `fulltext`, and `unique`. /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @param AppwriteEnums.IndexType type - /// @param [String] attributes - /// @param [String] orders - /// @param [Int] lengths - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - type: AppwriteEnums.IndexType + /// - attributes: [String] + /// - orders: [String] (optional) + /// - lengths: [Int] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Index /// open func createIndex( databaseId: String, @@ -2310,11 +2536,12 @@ open class Databases: Service { /// /// Get index by ID. /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Index /// open func getIndex( databaseId: String, @@ -2346,11 +2573,12 @@ open class Databases: Service { /// /// Delete an index. /// - /// @param String databaseId - /// @param String collectionId - /// @param String key - /// @throws Exception - /// @return array + /// - Parameters: + /// - databaseId: String + /// - collectionId: String + /// - key: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteIndex( databaseId: String, diff --git a/Sources/Appwrite/Services/Functions.swift b/Sources/Appwrite/Services/Functions.swift index 130e3d5..a26353f 100644 --- a/Sources/Appwrite/Services/Functions.swift +++ b/Sources/Appwrite/Services/Functions.swift @@ -12,10 +12,11 @@ open class Functions: Service { /// Get a list of all the project's functions. You can use the query params to /// filter your results. /// - /// @param [String] queries - /// @param String search - /// @throws Exception - /// @return array + /// - Parameters: + /// - queries: [String] (optional) + /// - search: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.FunctionList /// open func list( queries: [String]? = nil, @@ -49,26 +50,27 @@ open class Functions: Service { /// project users or team with access to execute the function using the client /// API. /// - /// @param String functionId - /// @param String name - /// @param AppwriteEnums.Runtime runtime - /// @param [String] execute - /// @param [String] events - /// @param String schedule - /// @param Int timeout - /// @param Bool enabled - /// @param Bool logging - /// @param String entrypoint - /// @param String commands - /// @param [String] scopes - /// @param String installationId - /// @param String providerRepositoryId - /// @param String providerBranch - /// @param Bool providerSilentMode - /// @param String providerRootDirectory - /// @param String specification - /// @throws Exception - /// @return array + /// - Parameters: + /// - functionId: String + /// - name: String + /// - runtime: AppwriteEnums.Runtime + /// - execute: [String] (optional) + /// - events: [String] (optional) + /// - schedule: String (optional) + /// - timeout: Int (optional) + /// - enabled: Bool (optional) + /// - logging: Bool (optional) + /// - entrypoint: String (optional) + /// - commands: String (optional) + /// - scopes: [String] (optional) + /// - installationId: String (optional) + /// - providerRepositoryId: String (optional) + /// - providerBranch: String (optional) + /// - providerSilentMode: Bool (optional) + /// - providerRootDirectory: String (optional) + /// - specification: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Function /// open func create( functionId: String, @@ -133,8 +135,8 @@ open class Functions: Service { /// /// Get a list of all runtimes that are currently active on your instance. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.RuntimeList /// open func listRuntimes( ) async throws -> AppwriteModels.RuntimeList { @@ -160,8 +162,8 @@ open class Functions: Service { /// /// List allowed function specifications for this instance. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.SpecificationList /// open func listSpecifications( ) async throws -> AppwriteModels.SpecificationList { @@ -187,9 +189,10 @@ open class Functions: Service { /// /// Get a function by its unique ID. /// - /// @param String functionId - /// @throws Exception - /// @return array + /// - Parameters: + /// - functionId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Function /// open func get( functionId: String @@ -217,26 +220,27 @@ open class Functions: Service { /// /// Update function by its unique ID. /// - /// @param String functionId - /// @param String name - /// @param AppwriteEnums.Runtime runtime - /// @param [String] execute - /// @param [String] events - /// @param String schedule - /// @param Int timeout - /// @param Bool enabled - /// @param Bool logging - /// @param String entrypoint - /// @param String commands - /// @param [String] scopes - /// @param String installationId - /// @param String providerRepositoryId - /// @param String providerBranch - /// @param Bool providerSilentMode - /// @param String providerRootDirectory - /// @param String specification - /// @throws Exception - /// @return array + /// - Parameters: + /// - functionId: String + /// - name: String + /// - runtime: AppwriteEnums.Runtime (optional) + /// - execute: [String] (optional) + /// - events: [String] (optional) + /// - schedule: String (optional) + /// - timeout: Int (optional) + /// - enabled: Bool (optional) + /// - logging: Bool (optional) + /// - entrypoint: String (optional) + /// - commands: String (optional) + /// - scopes: [String] (optional) + /// - installationId: String (optional) + /// - providerRepositoryId: String (optional) + /// - providerBranch: String (optional) + /// - providerSilentMode: Bool (optional) + /// - providerRootDirectory: String (optional) + /// - specification: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Function /// open func update( functionId: String, @@ -301,9 +305,10 @@ open class Functions: Service { /// /// Delete a function by its unique ID. /// - /// @param String functionId - /// @throws Exception - /// @return array + /// - Parameters: + /// - functionId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func delete( functionId: String @@ -328,10 +333,11 @@ open class Functions: Service { /// Update the function active deployment. Use this endpoint to switch the code /// deployment that should be used when visitor opens your function. /// - /// @param String functionId - /// @param String deploymentId - /// @throws Exception - /// @return array + /// - Parameters: + /// - functionId: String + /// - deploymentId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Function /// open func updateFunctionDeployment( functionId: String, @@ -365,11 +371,12 @@ open class Functions: Service { /// Get a list of all the function's code deployments. You can use the query /// params to filter your results. /// - /// @param String functionId - /// @param [String] queries - /// @param String search - /// @throws Exception - /// @return array + /// - Parameters: + /// - functionId: String + /// - queries: [String] (optional) + /// - search: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.DeploymentList /// open func listDeployments( functionId: String, @@ -411,13 +418,14 @@ open class Functions: Service { /// /// Use the "command" param to set the entrypoint used to execute your code. /// - /// @param String functionId - /// @param InputFile code - /// @param Bool activate - /// @param String entrypoint - /// @param String commands - /// @throws Exception - /// @return array + /// - Parameters: + /// - functionId: String + /// - code: InputFile + /// - activate: Bool + /// - entrypoint: String (optional) + /// - commands: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Deployment /// open func createDeployment( functionId: String, @@ -465,11 +473,12 @@ open class Functions: Service { /// build process will be queued and executed asynchronously. The original /// deployment's code will be preserved and used for the new build. /// - /// @param String functionId - /// @param String deploymentId - /// @param String buildId - /// @throws Exception - /// @return array + /// - Parameters: + /// - functionId: String + /// - deploymentId: String + /// - buildId: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Deployment /// open func createDuplicateDeployment( functionId: String, @@ -508,14 +517,15 @@ open class Functions: Service { /// [listTemplates](https://appwrite.io/docs/server/functions#listTemplates) to /// find the template details. /// - /// @param String functionId - /// @param String repository - /// @param String owner - /// @param String rootDirectory - /// @param String version - /// @param Bool activate - /// @throws Exception - /// @return array + /// - Parameters: + /// - functionId: String + /// - repository: String + /// - owner: String + /// - rootDirectory: String + /// - version: String + /// - activate: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Deployment /// open func createTemplateDeployment( functionId: String, @@ -558,12 +568,13 @@ open class Functions: Service { /// /// This endpoint lets you create deployment from a branch, commit, or a tag. /// - /// @param String functionId - /// @param AppwriteEnums.VCSDeploymentType type - /// @param String reference - /// @param Bool activate - /// @throws Exception - /// @return array + /// - Parameters: + /// - functionId: String + /// - type: AppwriteEnums.VCSDeploymentType + /// - reference: String + /// - activate: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Deployment /// open func createVcsDeployment( functionId: String, @@ -600,10 +611,11 @@ open class Functions: Service { /// /// Get a function deployment by its unique ID. /// - /// @param String functionId - /// @param String deploymentId - /// @throws Exception - /// @return array + /// - Parameters: + /// - functionId: String + /// - deploymentId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Deployment /// open func getDeployment( functionId: String, @@ -633,10 +645,11 @@ open class Functions: Service { /// /// Delete a code deployment by its unique ID. /// - /// @param String functionId - /// @param String deploymentId - /// @throws Exception - /// @return array + /// - Parameters: + /// - functionId: String + /// - deploymentId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteDeployment( functionId: String, @@ -664,11 +677,12 @@ open class Functions: Service { /// return with a 'Content-Disposition: attachment' header that tells the /// browser to start downloading the file to user downloads directory. /// - /// @param String functionId - /// @param String deploymentId - /// @param AppwriteEnums.DeploymentDownloadType type - /// @throws Exception - /// @return array + /// - Parameters: + /// - functionId: String + /// - deploymentId: String + /// - type: AppwriteEnums.DeploymentDownloadType (optional) + /// - Throws: Exception if the request fails + /// - Returns: ByteBuffer /// open func getDeploymentDownload( functionId: String, @@ -701,10 +715,11 @@ open class Functions: Service { /// cancel builds that have already completed (status 'ready') or failed. The /// response includes the final build status and details. /// - /// @param String functionId - /// @param String deploymentId - /// @throws Exception - /// @return array + /// - Parameters: + /// - functionId: String + /// - deploymentId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Deployment /// open func updateDeploymentStatus( functionId: String, @@ -737,10 +752,11 @@ open class Functions: Service { /// Get a list of all the current user function execution logs. You can use the /// query params to filter your results. /// - /// @param String functionId - /// @param [String] queries - /// @throws Exception - /// @return array + /// - Parameters: + /// - functionId: String + /// - queries: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.ExecutionList /// open func listExecutions( functionId: String, @@ -774,15 +790,16 @@ open class Functions: Service { /// updates on the current execution status. Once this endpoint is called, your /// function execution process will start asynchronously. /// - /// @param String functionId - /// @param String body - /// @param Bool async - /// @param String path - /// @param AppwriteEnums.ExecutionMethod method - /// @param Any headers - /// @param String scheduledAt - /// @throws Exception - /// @return array + /// - Parameters: + /// - functionId: String + /// - body: String (optional) + /// - async: Bool (optional) + /// - path: String (optional) + /// - method: AppwriteEnums.ExecutionMethod (optional) + /// - headers: Any (optional) + /// - scheduledAt: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Execution /// open func createExecution( functionId: String, @@ -825,10 +842,11 @@ open class Functions: Service { /// /// Get a function execution log by its unique ID. /// - /// @param String functionId - /// @param String executionId - /// @throws Exception - /// @return array + /// - Parameters: + /// - functionId: String + /// - executionId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Execution /// open func getExecution( functionId: String, @@ -858,10 +876,11 @@ open class Functions: Service { /// /// Delete a function execution by its unique ID. /// - /// @param String functionId - /// @param String executionId - /// @throws Exception - /// @return array + /// - Parameters: + /// - functionId: String + /// - executionId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteExecution( functionId: String, @@ -887,9 +906,10 @@ open class Functions: Service { /// /// Get a list of all variables of a specific function. /// - /// @param String functionId - /// @throws Exception - /// @return array + /// - Parameters: + /// - functionId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.VariableList /// open func listVariables( functionId: String @@ -918,12 +938,13 @@ open class Functions: Service { /// Create a new function environment variable. These variables can be accessed /// in the function at runtime as environment variables. /// - /// @param String functionId - /// @param String key - /// @param String value - /// @param Bool secret - /// @throws Exception - /// @return array + /// - Parameters: + /// - functionId: String + /// - key: String + /// - value: String + /// - secret: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Variable /// open func createVariable( functionId: String, @@ -960,10 +981,11 @@ open class Functions: Service { /// /// Get a variable by its unique ID. /// - /// @param String functionId - /// @param String variableId - /// @throws Exception - /// @return array + /// - Parameters: + /// - functionId: String + /// - variableId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Variable /// open func getVariable( functionId: String, @@ -993,13 +1015,14 @@ open class Functions: Service { /// /// Update variable by its unique ID. /// - /// @param String functionId - /// @param String variableId - /// @param String key - /// @param String value - /// @param Bool secret - /// @throws Exception - /// @return array + /// - Parameters: + /// - functionId: String + /// - variableId: String + /// - key: String + /// - value: String (optional) + /// - secret: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Variable /// open func updateVariable( functionId: String, @@ -1038,10 +1061,11 @@ open class Functions: Service { /// /// Delete a variable by its unique ID. /// - /// @param String functionId - /// @param String variableId - /// @throws Exception - /// @return array + /// - Parameters: + /// - functionId: String + /// - variableId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteVariable( functionId: String, diff --git a/Sources/Appwrite/Services/Graphql.swift b/Sources/Appwrite/Services/Graphql.swift index 68c326f..6089958 100644 --- a/Sources/Appwrite/Services/Graphql.swift +++ b/Sources/Appwrite/Services/Graphql.swift @@ -11,9 +11,10 @@ open class Graphql: Service { /// /// Execute a GraphQL mutation. /// - /// @param Any query - /// @throws Exception - /// @return array + /// - Parameters: + /// - query: Any + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func query( query: Any @@ -45,9 +46,10 @@ open class Graphql: Service { /// /// Execute a GraphQL mutation. /// - /// @param Any query - /// @throws Exception - /// @return array + /// - Parameters: + /// - query: Any + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func mutation( query: Any diff --git a/Sources/Appwrite/Services/Health.swift b/Sources/Appwrite/Services/Health.swift index f8103a4..e0bab3d 100644 --- a/Sources/Appwrite/Services/Health.swift +++ b/Sources/Appwrite/Services/Health.swift @@ -11,8 +11,8 @@ open class Health: Service { /// /// Check the Appwrite HTTP server is up and responsive. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.HealthStatus /// open func get( ) async throws -> AppwriteModels.HealthStatus { @@ -38,8 +38,8 @@ open class Health: Service { /// /// Check the Appwrite Antivirus server is up and connection is successful. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.HealthAntivirus /// open func getAntivirus( ) async throws -> AppwriteModels.HealthAntivirus { @@ -66,8 +66,8 @@ open class Health: Service { /// Check the Appwrite in-memory cache servers are up and connection is /// successful. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.HealthStatus /// open func getCache( ) async throws -> AppwriteModels.HealthStatus { @@ -93,9 +93,10 @@ open class Health: Service { /// /// Get the SSL certificate for a domain /// - /// @param String domain - /// @throws Exception - /// @return array + /// - Parameters: + /// - domain: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.HealthCertificate /// open func getCertificate( domain: String? = nil @@ -124,8 +125,8 @@ open class Health: Service { /// /// Check the Appwrite database servers are up and connection is successful. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.HealthStatus /// open func getDB( ) async throws -> AppwriteModels.HealthStatus { @@ -151,8 +152,8 @@ open class Health: Service { /// /// Check the Appwrite pub-sub servers are up and connection is successful. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.HealthStatus /// open func getPubSub( ) async throws -> AppwriteModels.HealthStatus { @@ -179,9 +180,10 @@ open class Health: Service { /// Get the number of builds that are waiting to be processed in the Appwrite /// internal queue server. /// - /// @param Int threshold - /// @throws Exception - /// @return array + /// - Parameters: + /// - threshold: Int (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.HealthQueue /// open func getQueueBuilds( threshold: Int? = nil @@ -212,9 +214,10 @@ open class Health: Service { /// [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue /// server. /// - /// @param Int threshold - /// @throws Exception - /// @return array + /// - Parameters: + /// - threshold: Int (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.HealthQueue /// open func getQueueCertificates( threshold: Int? = nil @@ -244,10 +247,11 @@ open class Health: Service { /// Get the number of database changes that are waiting to be processed in the /// Appwrite internal queue server. /// - /// @param String name - /// @param Int threshold - /// @throws Exception - /// @return array + /// - Parameters: + /// - name: String (optional) + /// - threshold: Int (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.HealthQueue /// open func getQueueDatabases( name: String? = nil, @@ -279,9 +283,10 @@ open class Health: Service { /// Get the number of background destructive changes that are waiting to be /// processed in the Appwrite internal queue server. /// - /// @param Int threshold - /// @throws Exception - /// @return array + /// - Parameters: + /// - threshold: Int (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.HealthQueue /// open func getQueueDeletes( threshold: Int? = nil @@ -311,10 +316,11 @@ open class Health: Service { /// Returns the amount of failed jobs in a given queue. /// /// - /// @param AppwriteEnums.Name name - /// @param Int threshold - /// @throws Exception - /// @return array + /// - Parameters: + /// - name: AppwriteEnums.Name + /// - threshold: Int (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.HealthQueue /// open func getFailedJobs( name: AppwriteEnums.Name, @@ -346,9 +352,10 @@ open class Health: Service { /// Get the number of function executions that are waiting to be processed in /// the Appwrite internal queue server. /// - /// @param Int threshold - /// @throws Exception - /// @return array + /// - Parameters: + /// - threshold: Int (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.HealthQueue /// open func getQueueFunctions( threshold: Int? = nil @@ -378,9 +385,10 @@ open class Health: Service { /// Get the number of logs that are waiting to be processed in the Appwrite /// internal queue server. /// - /// @param Int threshold - /// @throws Exception - /// @return array + /// - Parameters: + /// - threshold: Int (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.HealthQueue /// open func getQueueLogs( threshold: Int? = nil @@ -410,9 +418,10 @@ open class Health: Service { /// Get the number of mails that are waiting to be processed in the Appwrite /// internal queue server. /// - /// @param Int threshold - /// @throws Exception - /// @return array + /// - Parameters: + /// - threshold: Int (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.HealthQueue /// open func getQueueMails( threshold: Int? = nil @@ -442,9 +451,10 @@ open class Health: Service { /// Get the number of messages that are waiting to be processed in the Appwrite /// internal queue server. /// - /// @param Int threshold - /// @throws Exception - /// @return array + /// - Parameters: + /// - threshold: Int (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.HealthQueue /// open func getQueueMessaging( threshold: Int? = nil @@ -474,9 +484,10 @@ open class Health: Service { /// Get the number of migrations that are waiting to be processed in the /// Appwrite internal queue server. /// - /// @param Int threshold - /// @throws Exception - /// @return array + /// - Parameters: + /// - threshold: Int (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.HealthQueue /// open func getQueueMigrations( threshold: Int? = nil @@ -506,9 +517,10 @@ open class Health: Service { /// Get the number of metrics that are waiting to be processed in the Appwrite /// stats resources queue. /// - /// @param Int threshold - /// @throws Exception - /// @return array + /// - Parameters: + /// - threshold: Int (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.HealthQueue /// open func getQueueStatsResources( threshold: Int? = nil @@ -538,9 +550,10 @@ open class Health: Service { /// Get the number of metrics that are waiting to be processed in the Appwrite /// internal queue server. /// - /// @param Int threshold - /// @throws Exception - /// @return array + /// - Parameters: + /// - threshold: Int (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.HealthQueue /// open func getQueueUsage( threshold: Int? = nil @@ -570,9 +583,10 @@ open class Health: Service { /// Get the number of webhooks that are waiting to be processed in the Appwrite /// internal queue server. /// - /// @param Int threshold - /// @throws Exception - /// @return array + /// - Parameters: + /// - threshold: Int (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.HealthQueue /// open func getQueueWebhooks( threshold: Int? = nil @@ -601,8 +615,8 @@ open class Health: Service { /// /// Check the Appwrite storage device is up and connection is successful. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.HealthStatus /// open func getStorage( ) async throws -> AppwriteModels.HealthStatus { @@ -628,8 +642,8 @@ open class Health: Service { /// /// Check the Appwrite local storage device is up and connection is successful. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.HealthStatus /// open func getStorageLocal( ) async throws -> AppwriteModels.HealthStatus { @@ -661,8 +675,8 @@ open class Health: Service { /// clocks over the Internet. If your computer sets its own clock, it likely /// uses NTP. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.HealthTime /// open func getTime( ) async throws -> AppwriteModels.HealthTime { diff --git a/Sources/Appwrite/Services/Locale.swift b/Sources/Appwrite/Services/Locale.swift index b9d2682..87c64c7 100644 --- a/Sources/Appwrite/Services/Locale.swift +++ b/Sources/Appwrite/Services/Locale.swift @@ -16,8 +16,8 @@ open class Locale: Service { /// /// ([IP Geolocation by DB-IP](https://db-ip.com)) /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Locale /// open func get( ) async throws -> AppwriteModels.Locale { @@ -44,8 +44,8 @@ open class Locale: Service { /// List of all locale codes in [ISO /// 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.LocaleCodeList /// open func listCodes( ) async throws -> AppwriteModels.LocaleCodeList { @@ -72,8 +72,8 @@ open class Locale: Service { /// List of all continents. You can use the locale header to get the data in a /// supported language. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.ContinentList /// open func listContinents( ) async throws -> AppwriteModels.ContinentList { @@ -100,8 +100,8 @@ open class Locale: Service { /// List of all countries. You can use the locale header to get the data in a /// supported language. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.CountryList /// open func listCountries( ) async throws -> AppwriteModels.CountryList { @@ -128,8 +128,8 @@ open class Locale: Service { /// List of all countries that are currently members of the EU. You can use the /// locale header to get the data in a supported language. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.CountryList /// open func listCountriesEU( ) async throws -> AppwriteModels.CountryList { @@ -156,8 +156,8 @@ open class Locale: Service { /// List of all countries phone codes. You can use the locale header to get the /// data in a supported language. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.PhoneList /// open func listCountriesPhones( ) async throws -> AppwriteModels.PhoneList { @@ -185,8 +185,8 @@ open class Locale: Service { /// decimal digits for all major and minor currencies. You can use the locale /// header to get the data in a supported language. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.CurrencyList /// open func listCurrencies( ) async throws -> AppwriteModels.CurrencyList { @@ -213,8 +213,8 @@ open class Locale: Service { /// List of all languages classified by ISO 639-1 including 2-letter code, name /// in English, and name in the respective language. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.LanguageList /// open func listLanguages( ) async throws -> AppwriteModels.LanguageList { diff --git a/Sources/Appwrite/Services/Messaging.swift b/Sources/Appwrite/Services/Messaging.swift index 0ded4ce..5a97dfd 100644 --- a/Sources/Appwrite/Services/Messaging.swift +++ b/Sources/Appwrite/Services/Messaging.swift @@ -11,10 +11,11 @@ open class Messaging: Service { /// /// Get a list of all messages from the current Appwrite project. /// - /// @param [String] queries - /// @param String search - /// @throws Exception - /// @return array + /// - Parameters: + /// - queries: [String] (optional) + /// - search: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.MessageList /// open func listMessages( queries: [String]? = nil, @@ -45,20 +46,21 @@ open class Messaging: Service { /// /// Create a new email message. /// - /// @param String messageId - /// @param String subject - /// @param String content - /// @param [String] topics - /// @param [String] users - /// @param [String] targets - /// @param [String] cc - /// @param [String] bcc - /// @param [String] attachments - /// @param Bool draft - /// @param Bool html - /// @param String scheduledAt - /// @throws Exception - /// @return array + /// - Parameters: + /// - messageId: String + /// - subject: String + /// - content: String + /// - topics: [String] (optional) + /// - users: [String] (optional) + /// - targets: [String] (optional) + /// - cc: [String] (optional) + /// - bcc: [String] (optional) + /// - attachments: [String] (optional) + /// - draft: Bool (optional) + /// - html: Bool (optional) + /// - scheduledAt: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Message /// open func createEmail( messageId: String, @@ -114,20 +116,21 @@ open class Messaging: Service { /// sent, or failed cannot be updated. /// /// - /// @param String messageId - /// @param [String] topics - /// @param [String] users - /// @param [String] targets - /// @param String subject - /// @param String content - /// @param Bool draft - /// @param Bool html - /// @param [String] cc - /// @param [String] bcc - /// @param String scheduledAt - /// @param [String] attachments - /// @throws Exception - /// @return array + /// - Parameters: + /// - messageId: String + /// - topics: [String] (optional) + /// - users: [String] (optional) + /// - targets: [String] (optional) + /// - subject: String (optional) + /// - content: String (optional) + /// - draft: Bool (optional) + /// - html: Bool (optional) + /// - cc: [String] (optional) + /// - bcc: [String] (optional) + /// - scheduledAt: String (optional) + /// - attachments: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Message /// open func updateEmail( messageId: String, @@ -180,27 +183,28 @@ open class Messaging: Service { /// /// Create a new push notification. /// - /// @param String messageId - /// @param String title - /// @param String body - /// @param [String] topics - /// @param [String] users - /// @param [String] targets - /// @param Any data - /// @param String action - /// @param String image - /// @param String icon - /// @param String sound - /// @param String color - /// @param String tag - /// @param Int badge - /// @param Bool draft - /// @param String scheduledAt - /// @param Bool contentAvailable - /// @param Bool critical - /// @param AppwriteEnums.MessagePriority priority - /// @throws Exception - /// @return array + /// - Parameters: + /// - messageId: String + /// - title: String (optional) + /// - body: String (optional) + /// - topics: [String] (optional) + /// - users: [String] (optional) + /// - targets: [String] (optional) + /// - data: Any (optional) + /// - action: String (optional) + /// - image: String (optional) + /// - icon: String (optional) + /// - sound: String (optional) + /// - color: String (optional) + /// - tag: String (optional) + /// - badge: Int (optional) + /// - draft: Bool (optional) + /// - scheduledAt: String (optional) + /// - contentAvailable: Bool (optional) + /// - critical: Bool (optional) + /// - priority: AppwriteEnums.MessagePriority (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Message /// open func createPush( messageId: String, @@ -270,27 +274,28 @@ open class Messaging: Service { /// sent, or failed cannot be updated. /// /// - /// @param String messageId - /// @param [String] topics - /// @param [String] users - /// @param [String] targets - /// @param String title - /// @param String body - /// @param Any data - /// @param String action - /// @param String image - /// @param String icon - /// @param String sound - /// @param String color - /// @param String tag - /// @param Int badge - /// @param Bool draft - /// @param String scheduledAt - /// @param Bool contentAvailable - /// @param Bool critical - /// @param AppwriteEnums.MessagePriority priority - /// @throws Exception - /// @return array + /// - Parameters: + /// - messageId: String + /// - topics: [String] (optional) + /// - users: [String] (optional) + /// - targets: [String] (optional) + /// - title: String (optional) + /// - body: String (optional) + /// - data: Any (optional) + /// - action: String (optional) + /// - image: String (optional) + /// - icon: String (optional) + /// - sound: String (optional) + /// - color: String (optional) + /// - tag: String (optional) + /// - badge: Int (optional) + /// - draft: Bool (optional) + /// - scheduledAt: String (optional) + /// - contentAvailable: Bool (optional) + /// - critical: Bool (optional) + /// - priority: AppwriteEnums.MessagePriority (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Message /// open func updatePush( messageId: String, @@ -357,15 +362,16 @@ open class Messaging: Service { /// /// Create a new SMS message. /// - /// @param String messageId - /// @param String content - /// @param [String] topics - /// @param [String] users - /// @param [String] targets - /// @param Bool draft - /// @param String scheduledAt - /// @throws Exception - /// @return array + /// - Parameters: + /// - messageId: String + /// - content: String + /// - topics: [String] (optional) + /// - users: [String] (optional) + /// - targets: [String] (optional) + /// - draft: Bool (optional) + /// - scheduledAt: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Message /// open func createSms( messageId: String, @@ -411,15 +417,16 @@ open class Messaging: Service { /// sent, or failed cannot be updated. /// /// - /// @param String messageId - /// @param [String] topics - /// @param [String] users - /// @param [String] targets - /// @param String content - /// @param Bool draft - /// @param String scheduledAt - /// @throws Exception - /// @return array + /// - Parameters: + /// - messageId: String + /// - topics: [String] (optional) + /// - users: [String] (optional) + /// - targets: [String] (optional) + /// - content: String (optional) + /// - draft: Bool (optional) + /// - scheduledAt: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Message /// open func updateSms( messageId: String, @@ -463,9 +470,10 @@ open class Messaging: Service { /// Get a message by its unique ID. /// /// - /// @param String messageId - /// @throws Exception - /// @return array + /// - Parameters: + /// - messageId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Message /// open func getMessage( messageId: String @@ -494,9 +502,10 @@ open class Messaging: Service { /// Delete a message. If the message is not a draft or scheduled, but has been /// sent, this will not recall the message. /// - /// @param String messageId - /// @throws Exception - /// @return array + /// - Parameters: + /// - messageId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func delete( messageId: String @@ -520,10 +529,11 @@ open class Messaging: Service { /// /// Get the message activity logs listed by its unique ID. /// - /// @param String messageId - /// @param [String] queries - /// @throws Exception - /// @return array + /// - Parameters: + /// - messageId: String + /// - queries: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.LogList /// open func listMessageLogs( messageId: String, @@ -554,10 +564,11 @@ open class Messaging: Service { /// /// Get a list of the targets associated with a message. /// - /// @param String messageId - /// @param [String] queries - /// @throws Exception - /// @return array + /// - Parameters: + /// - messageId: String + /// - queries: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.TargetList /// open func listTargets( messageId: String, @@ -588,10 +599,11 @@ open class Messaging: Service { /// /// Get a list of all providers from the current Appwrite project. /// - /// @param [String] queries - /// @param String search - /// @throws Exception - /// @return array + /// - Parameters: + /// - queries: [String] (optional) + /// - search: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.ProviderList /// open func listProviders( queries: [String]? = nil, @@ -622,16 +634,17 @@ open class Messaging: Service { /// /// Create a new Apple Push Notification service provider. /// - /// @param String providerId - /// @param String name - /// @param String authKey - /// @param String authKeyId - /// @param String teamId - /// @param String bundleId - /// @param Bool sandbox - /// @param Bool enabled - /// @throws Exception - /// @return array + /// - Parameters: + /// - providerId: String + /// - name: String + /// - authKey: String (optional) + /// - authKeyId: String (optional) + /// - teamId: String (optional) + /// - bundleId: String (optional) + /// - sandbox: Bool (optional) + /// - enabled: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Provider /// open func createApnsProvider( providerId: String, @@ -676,16 +689,17 @@ open class Messaging: Service { /// /// Update a Apple Push Notification service provider by its unique ID. /// - /// @param String providerId - /// @param String name - /// @param Bool enabled - /// @param String authKey - /// @param String authKeyId - /// @param String teamId - /// @param String bundleId - /// @param Bool sandbox - /// @throws Exception - /// @return array + /// - Parameters: + /// - providerId: String + /// - name: String (optional) + /// - enabled: Bool (optional) + /// - authKey: String (optional) + /// - authKeyId: String (optional) + /// - teamId: String (optional) + /// - bundleId: String (optional) + /// - sandbox: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Provider /// open func updateApnsProvider( providerId: String, @@ -730,12 +744,13 @@ open class Messaging: Service { /// /// Create a new Firebase Cloud Messaging provider. /// - /// @param String providerId - /// @param String name - /// @param Any serviceAccountJSON - /// @param Bool enabled - /// @throws Exception - /// @return array + /// - Parameters: + /// - providerId: String + /// - name: String + /// - serviceAccountJSON: Any (optional) + /// - enabled: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Provider /// open func createFcmProvider( providerId: String, @@ -772,12 +787,13 @@ open class Messaging: Service { /// /// Update a Firebase Cloud Messaging provider by its unique ID. /// - /// @param String providerId - /// @param String name - /// @param Bool enabled - /// @param Any serviceAccountJSON - /// @throws Exception - /// @return array + /// - Parameters: + /// - providerId: String + /// - name: String (optional) + /// - enabled: Bool (optional) + /// - serviceAccountJSON: Any (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Provider /// open func updateFcmProvider( providerId: String, @@ -814,18 +830,19 @@ open class Messaging: Service { /// /// Create a new Mailgun provider. /// - /// @param String providerId - /// @param String name - /// @param String apiKey - /// @param String domain - /// @param Bool isEuRegion - /// @param String fromName - /// @param String fromEmail - /// @param String replyToName - /// @param String replyToEmail - /// @param Bool enabled - /// @throws Exception - /// @return array + /// - Parameters: + /// - providerId: String + /// - name: String + /// - apiKey: String (optional) + /// - domain: String (optional) + /// - isEuRegion: Bool (optional) + /// - fromName: String (optional) + /// - fromEmail: String (optional) + /// - replyToName: String (optional) + /// - replyToEmail: String (optional) + /// - enabled: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Provider /// open func createMailgunProvider( providerId: String, @@ -874,18 +891,19 @@ open class Messaging: Service { /// /// Update a Mailgun provider by its unique ID. /// - /// @param String providerId - /// @param String name - /// @param String apiKey - /// @param String domain - /// @param Bool isEuRegion - /// @param Bool enabled - /// @param String fromName - /// @param String fromEmail - /// @param String replyToName - /// @param String replyToEmail - /// @throws Exception - /// @return array + /// - Parameters: + /// - providerId: String + /// - name: String (optional) + /// - apiKey: String (optional) + /// - domain: String (optional) + /// - isEuRegion: Bool (optional) + /// - enabled: Bool (optional) + /// - fromName: String (optional) + /// - fromEmail: String (optional) + /// - replyToName: String (optional) + /// - replyToEmail: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Provider /// open func updateMailgunProvider( providerId: String, @@ -934,14 +952,15 @@ open class Messaging: Service { /// /// Create a new MSG91 provider. /// - /// @param String providerId - /// @param String name - /// @param String templateId - /// @param String senderId - /// @param String authKey - /// @param Bool enabled - /// @throws Exception - /// @return array + /// - Parameters: + /// - providerId: String + /// - name: String + /// - templateId: String (optional) + /// - senderId: String (optional) + /// - authKey: String (optional) + /// - enabled: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Provider /// open func createMsg91Provider( providerId: String, @@ -982,14 +1001,15 @@ open class Messaging: Service { /// /// Update a MSG91 provider by its unique ID. /// - /// @param String providerId - /// @param String name - /// @param Bool enabled - /// @param String templateId - /// @param String senderId - /// @param String authKey - /// @throws Exception - /// @return array + /// - Parameters: + /// - providerId: String + /// - name: String (optional) + /// - enabled: Bool (optional) + /// - templateId: String (optional) + /// - senderId: String (optional) + /// - authKey: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Provider /// open func updateMsg91Provider( providerId: String, @@ -1030,16 +1050,17 @@ open class Messaging: Service { /// /// Create a new Sendgrid provider. /// - /// @param String providerId - /// @param String name - /// @param String apiKey - /// @param String fromName - /// @param String fromEmail - /// @param String replyToName - /// @param String replyToEmail - /// @param Bool enabled - /// @throws Exception - /// @return array + /// - Parameters: + /// - providerId: String + /// - name: String + /// - apiKey: String (optional) + /// - fromName: String (optional) + /// - fromEmail: String (optional) + /// - replyToName: String (optional) + /// - replyToEmail: String (optional) + /// - enabled: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Provider /// open func createSendgridProvider( providerId: String, @@ -1084,16 +1105,17 @@ open class Messaging: Service { /// /// Update a Sendgrid provider by its unique ID. /// - /// @param String providerId - /// @param String name - /// @param Bool enabled - /// @param String apiKey - /// @param String fromName - /// @param String fromEmail - /// @param String replyToName - /// @param String replyToEmail - /// @throws Exception - /// @return array + /// - Parameters: + /// - providerId: String + /// - name: String (optional) + /// - enabled: Bool (optional) + /// - apiKey: String (optional) + /// - fromName: String (optional) + /// - fromEmail: String (optional) + /// - replyToName: String (optional) + /// - replyToEmail: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Provider /// open func updateSendgridProvider( providerId: String, @@ -1138,22 +1160,23 @@ open class Messaging: Service { /// /// Create a new SMTP provider. /// - /// @param String providerId - /// @param String name - /// @param String host - /// @param Int port - /// @param String username - /// @param String password - /// @param AppwriteEnums.SmtpEncryption encryption - /// @param Bool autoTLS - /// @param String mailer - /// @param String fromName - /// @param String fromEmail - /// @param String replyToName - /// @param String replyToEmail - /// @param Bool enabled - /// @throws Exception - /// @return array + /// - Parameters: + /// - providerId: String + /// - name: String + /// - host: String + /// - port: Int (optional) + /// - username: String (optional) + /// - password: String (optional) + /// - encryption: AppwriteEnums.SmtpEncryption (optional) + /// - autoTLS: Bool (optional) + /// - mailer: String (optional) + /// - fromName: String (optional) + /// - fromEmail: String (optional) + /// - replyToName: String (optional) + /// - replyToEmail: String (optional) + /// - enabled: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Provider /// open func createSmtpProvider( providerId: String, @@ -1210,22 +1233,23 @@ open class Messaging: Service { /// /// Update a SMTP provider by its unique ID. /// - /// @param String providerId - /// @param String name - /// @param String host - /// @param Int port - /// @param String username - /// @param String password - /// @param AppwriteEnums.SmtpEncryption encryption - /// @param Bool autoTLS - /// @param String mailer - /// @param String fromName - /// @param String fromEmail - /// @param String replyToName - /// @param String replyToEmail - /// @param Bool enabled - /// @throws Exception - /// @return array + /// - Parameters: + /// - providerId: String + /// - name: String (optional) + /// - host: String (optional) + /// - port: Int (optional) + /// - username: String (optional) + /// - password: String (optional) + /// - encryption: AppwriteEnums.SmtpEncryption (optional) + /// - autoTLS: Bool (optional) + /// - mailer: String (optional) + /// - fromName: String (optional) + /// - fromEmail: String (optional) + /// - replyToName: String (optional) + /// - replyToEmail: String (optional) + /// - enabled: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Provider /// open func updateSmtpProvider( providerId: String, @@ -1282,14 +1306,15 @@ open class Messaging: Service { /// /// Create a new Telesign provider. /// - /// @param String providerId - /// @param String name - /// @param String from - /// @param String customerId - /// @param String apiKey - /// @param Bool enabled - /// @throws Exception - /// @return array + /// - Parameters: + /// - providerId: String + /// - name: String + /// - from: String (optional) + /// - customerId: String (optional) + /// - apiKey: String (optional) + /// - enabled: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Provider /// open func createTelesignProvider( providerId: String, @@ -1330,14 +1355,15 @@ open class Messaging: Service { /// /// Update a Telesign provider by its unique ID. /// - /// @param String providerId - /// @param String name - /// @param Bool enabled - /// @param String customerId - /// @param String apiKey - /// @param String from - /// @throws Exception - /// @return array + /// - Parameters: + /// - providerId: String + /// - name: String (optional) + /// - enabled: Bool (optional) + /// - customerId: String (optional) + /// - apiKey: String (optional) + /// - from: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Provider /// open func updateTelesignProvider( providerId: String, @@ -1378,14 +1404,15 @@ open class Messaging: Service { /// /// Create a new Textmagic provider. /// - /// @param String providerId - /// @param String name - /// @param String from - /// @param String username - /// @param String apiKey - /// @param Bool enabled - /// @throws Exception - /// @return array + /// - Parameters: + /// - providerId: String + /// - name: String + /// - from: String (optional) + /// - username: String (optional) + /// - apiKey: String (optional) + /// - enabled: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Provider /// open func createTextmagicProvider( providerId: String, @@ -1426,14 +1453,15 @@ open class Messaging: Service { /// /// Update a Textmagic provider by its unique ID. /// - /// @param String providerId - /// @param String name - /// @param Bool enabled - /// @param String username - /// @param String apiKey - /// @param String from - /// @throws Exception - /// @return array + /// - Parameters: + /// - providerId: String + /// - name: String (optional) + /// - enabled: Bool (optional) + /// - username: String (optional) + /// - apiKey: String (optional) + /// - from: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Provider /// open func updateTextmagicProvider( providerId: String, @@ -1474,14 +1502,15 @@ open class Messaging: Service { /// /// Create a new Twilio provider. /// - /// @param String providerId - /// @param String name - /// @param String from - /// @param String accountSid - /// @param String authToken - /// @param Bool enabled - /// @throws Exception - /// @return array + /// - Parameters: + /// - providerId: String + /// - name: String + /// - from: String (optional) + /// - accountSid: String (optional) + /// - authToken: String (optional) + /// - enabled: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Provider /// open func createTwilioProvider( providerId: String, @@ -1522,14 +1551,15 @@ open class Messaging: Service { /// /// Update a Twilio provider by its unique ID. /// - /// @param String providerId - /// @param String name - /// @param Bool enabled - /// @param String accountSid - /// @param String authToken - /// @param String from - /// @throws Exception - /// @return array + /// - Parameters: + /// - providerId: String + /// - name: String (optional) + /// - enabled: Bool (optional) + /// - accountSid: String (optional) + /// - authToken: String (optional) + /// - from: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Provider /// open func updateTwilioProvider( providerId: String, @@ -1570,14 +1600,15 @@ open class Messaging: Service { /// /// Create a new Vonage provider. /// - /// @param String providerId - /// @param String name - /// @param String from - /// @param String apiKey - /// @param String apiSecret - /// @param Bool enabled - /// @throws Exception - /// @return array + /// - Parameters: + /// - providerId: String + /// - name: String + /// - from: String (optional) + /// - apiKey: String (optional) + /// - apiSecret: String (optional) + /// - enabled: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Provider /// open func createVonageProvider( providerId: String, @@ -1618,14 +1649,15 @@ open class Messaging: Service { /// /// Update a Vonage provider by its unique ID. /// - /// @param String providerId - /// @param String name - /// @param Bool enabled - /// @param String apiKey - /// @param String apiSecret - /// @param String from - /// @throws Exception - /// @return array + /// - Parameters: + /// - providerId: String + /// - name: String (optional) + /// - enabled: Bool (optional) + /// - apiKey: String (optional) + /// - apiSecret: String (optional) + /// - from: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Provider /// open func updateVonageProvider( providerId: String, @@ -1667,9 +1699,10 @@ open class Messaging: Service { /// Get a provider by its unique ID. /// /// - /// @param String providerId - /// @throws Exception - /// @return array + /// - Parameters: + /// - providerId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Provider /// open func getProvider( providerId: String @@ -1697,9 +1730,10 @@ open class Messaging: Service { /// /// Delete a provider by its unique ID. /// - /// @param String providerId - /// @throws Exception - /// @return array + /// - Parameters: + /// - providerId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteProvider( providerId: String @@ -1723,10 +1757,11 @@ open class Messaging: Service { /// /// Get the provider activity logs listed by its unique ID. /// - /// @param String providerId - /// @param [String] queries - /// @throws Exception - /// @return array + /// - Parameters: + /// - providerId: String + /// - queries: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.LogList /// open func listProviderLogs( providerId: String, @@ -1757,10 +1792,11 @@ open class Messaging: Service { /// /// Get the subscriber activity logs listed by its unique ID. /// - /// @param String subscriberId - /// @param [String] queries - /// @throws Exception - /// @return array + /// - Parameters: + /// - subscriberId: String + /// - queries: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.LogList /// open func listSubscriberLogs( subscriberId: String, @@ -1791,10 +1827,11 @@ open class Messaging: Service { /// /// Get a list of all topics from the current Appwrite project. /// - /// @param [String] queries - /// @param String search - /// @throws Exception - /// @return array + /// - Parameters: + /// - queries: [String] (optional) + /// - search: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.TopicList /// open func listTopics( queries: [String]? = nil, @@ -1825,11 +1862,12 @@ open class Messaging: Service { /// /// Create a new topic. /// - /// @param String topicId - /// @param String name - /// @param [String] subscribe - /// @throws Exception - /// @return array + /// - Parameters: + /// - topicId: String + /// - name: String + /// - subscribe: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Topic /// open func createTopic( topicId: String, @@ -1865,9 +1903,10 @@ open class Messaging: Service { /// Get a topic by its unique ID. /// /// - /// @param String topicId - /// @throws Exception - /// @return array + /// - Parameters: + /// - topicId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Topic /// open func getTopic( topicId: String @@ -1896,11 +1935,12 @@ open class Messaging: Service { /// Update a topic by its unique ID. /// /// - /// @param String topicId - /// @param String name - /// @param [String] subscribe - /// @throws Exception - /// @return array + /// - Parameters: + /// - topicId: String + /// - name: String (optional) + /// - subscribe: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Topic /// open func updateTopic( topicId: String, @@ -1935,9 +1975,10 @@ open class Messaging: Service { /// /// Delete a topic by its unique ID. /// - /// @param String topicId - /// @throws Exception - /// @return array + /// - Parameters: + /// - topicId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteTopic( topicId: String @@ -1961,10 +2002,11 @@ open class Messaging: Service { /// /// Get the topic activity logs listed by its unique ID. /// - /// @param String topicId - /// @param [String] queries - /// @throws Exception - /// @return array + /// - Parameters: + /// - topicId: String + /// - queries: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.LogList /// open func listTopicLogs( topicId: String, @@ -1995,11 +2037,12 @@ open class Messaging: Service { /// /// Get a list of all subscribers from the current Appwrite project. /// - /// @param String topicId - /// @param [String] queries - /// @param String search - /// @throws Exception - /// @return array + /// - Parameters: + /// - topicId: String + /// - queries: [String] (optional) + /// - search: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.SubscriberList /// open func listSubscribers( topicId: String, @@ -2032,11 +2075,12 @@ open class Messaging: Service { /// /// Create a new subscriber. /// - /// @param String topicId - /// @param String subscriberId - /// @param String targetId - /// @throws Exception - /// @return array + /// - Parameters: + /// - topicId: String + /// - subscriberId: String + /// - targetId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Subscriber /// open func createSubscriber( topicId: String, @@ -2072,10 +2116,11 @@ open class Messaging: Service { /// Get a subscriber by its unique ID. /// /// - /// @param String topicId - /// @param String subscriberId - /// @throws Exception - /// @return array + /// - Parameters: + /// - topicId: String + /// - subscriberId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Subscriber /// open func getSubscriber( topicId: String, @@ -2105,10 +2150,11 @@ open class Messaging: Service { /// /// Delete a subscriber by its unique ID. /// - /// @param String topicId - /// @param String subscriberId - /// @throws Exception - /// @return array + /// - Parameters: + /// - topicId: String + /// - subscriberId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteSubscriber( topicId: String, diff --git a/Sources/Appwrite/Services/Sites.swift b/Sources/Appwrite/Services/Sites.swift index deae24b..290e495 100644 --- a/Sources/Appwrite/Services/Sites.swift +++ b/Sources/Appwrite/Services/Sites.swift @@ -12,10 +12,11 @@ open class Sites: Service { /// Get a list of all the project's sites. You can use the query params to /// filter your results. /// - /// @param [String] queries - /// @param String search - /// @throws Exception - /// @return array + /// - Parameters: + /// - queries: [String] (optional) + /// - search: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.SiteList /// open func list( queries: [String]? = nil, @@ -46,26 +47,27 @@ open class Sites: Service { /// /// Create a new site. /// - /// @param String siteId - /// @param String name - /// @param AppwriteEnums.Framework framework - /// @param AppwriteEnums.BuildRuntime buildRuntime - /// @param Bool enabled - /// @param Bool logging - /// @param Int timeout - /// @param String installCommand - /// @param String buildCommand - /// @param String outputDirectory - /// @param AppwriteEnums.Adapter adapter - /// @param String installationId - /// @param String fallbackFile - /// @param String providerRepositoryId - /// @param String providerBranch - /// @param Bool providerSilentMode - /// @param String providerRootDirectory - /// @param String specification - /// @throws Exception - /// @return array + /// - Parameters: + /// - siteId: String + /// - name: String + /// - 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: AppwriteEnums.Adapter (optional) + /// - installationId: String (optional) + /// - fallbackFile: String (optional) + /// - providerRepositoryId: String (optional) + /// - providerBranch: String (optional) + /// - providerSilentMode: Bool (optional) + /// - providerRootDirectory: String (optional) + /// - specification: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Site /// open func create( siteId: String, @@ -131,8 +133,8 @@ open class Sites: Service { /// Get a list of all frameworks that are currently available on the server /// instance. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.FrameworkList /// open func listFrameworks( ) async throws -> AppwriteModels.FrameworkList { @@ -158,8 +160,8 @@ open class Sites: Service { /// /// List allowed site specifications for this instance. /// - /// @throws Exception - /// @return array + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.SpecificationList /// open func listSpecifications( ) async throws -> AppwriteModels.SpecificationList { @@ -185,9 +187,10 @@ open class Sites: Service { /// /// Get a site by its unique ID. /// - /// @param String siteId - /// @throws Exception - /// @return array + /// - Parameters: + /// - siteId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Site /// open func get( siteId: String @@ -215,26 +218,27 @@ open class Sites: Service { /// /// Update site by its unique ID. /// - /// @param String siteId - /// @param String name - /// @param AppwriteEnums.Framework framework - /// @param Bool enabled - /// @param Bool logging - /// @param Int timeout - /// @param String installCommand - /// @param String buildCommand - /// @param String outputDirectory - /// @param AppwriteEnums.BuildRuntime buildRuntime - /// @param AppwriteEnums.Adapter adapter - /// @param String fallbackFile - /// @param String installationId - /// @param String providerRepositoryId - /// @param String providerBranch - /// @param Bool providerSilentMode - /// @param String providerRootDirectory - /// @param String specification - /// @throws Exception - /// @return array + /// - Parameters: + /// - siteId: String + /// - name: String + /// - framework: AppwriteEnums.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) + /// - fallbackFile: String (optional) + /// - installationId: String (optional) + /// - providerRepositoryId: String (optional) + /// - providerBranch: String (optional) + /// - providerSilentMode: Bool (optional) + /// - providerRootDirectory: String (optional) + /// - specification: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Site /// open func update( siteId: String, @@ -299,9 +303,10 @@ open class Sites: Service { /// /// Delete a site by its unique ID. /// - /// @param String siteId - /// @throws Exception - /// @return array + /// - Parameters: + /// - siteId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func delete( siteId: String @@ -326,10 +331,11 @@ open class Sites: Service { /// Update the site active deployment. Use this endpoint to switch the code /// deployment that should be used when visitor opens your site. /// - /// @param String siteId - /// @param String deploymentId - /// @throws Exception - /// @return array + /// - Parameters: + /// - siteId: String + /// - deploymentId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Site /// open func updateSiteDeployment( siteId: String, @@ -363,11 +369,12 @@ open class Sites: Service { /// Get a list of all the site's code deployments. You can use the query params /// to filter your results. /// - /// @param String siteId - /// @param [String] queries - /// @param String search - /// @throws Exception - /// @return array + /// - Parameters: + /// - siteId: String + /// - queries: [String] (optional) + /// - search: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.DeploymentList /// open func listDeployments( siteId: String, @@ -402,14 +409,15 @@ open class Sites: Service { /// version of your site code. To activate your newly uploaded code, you'll /// need to update the function's deployment to use your new deployment ID. /// - /// @param String siteId - /// @param InputFile code - /// @param Bool activate - /// @param String installCommand - /// @param String buildCommand - /// @param String outputDirectory - /// @throws Exception - /// @return array + /// - Parameters: + /// - siteId: String + /// - code: InputFile + /// - activate: Bool + /// - installCommand: String (optional) + /// - buildCommand: String (optional) + /// - outputDirectory: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Deployment /// open func createDeployment( siteId: String, @@ -459,10 +467,11 @@ open class Sites: Service { /// process will be queued and executed asynchronously. The original /// deployment's code will be preserved and used for the new build. /// - /// @param String siteId - /// @param String deploymentId - /// @throws Exception - /// @return array + /// - Parameters: + /// - siteId: String + /// - deploymentId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Deployment /// open func createDuplicateDeployment( siteId: String, @@ -499,14 +508,15 @@ open class Sites: Service { /// [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to /// find the template details. /// - /// @param String siteId - /// @param String repository - /// @param String owner - /// @param String rootDirectory - /// @param String version - /// @param Bool activate - /// @throws Exception - /// @return array + /// - Parameters: + /// - siteId: String + /// - repository: String + /// - owner: String + /// - rootDirectory: String + /// - version: String + /// - activate: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Deployment /// open func createTemplateDeployment( siteId: String, @@ -549,12 +559,13 @@ open class Sites: Service { /// /// This endpoint lets you create deployment from a branch, commit, or a tag. /// - /// @param String siteId - /// @param AppwriteEnums.VCSDeploymentType type - /// @param String reference - /// @param Bool activate - /// @throws Exception - /// @return array + /// - Parameters: + /// - siteId: String + /// - type: AppwriteEnums.VCSDeploymentType + /// - reference: String + /// - activate: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Deployment /// open func createVcsDeployment( siteId: String, @@ -591,10 +602,11 @@ open class Sites: Service { /// /// Get a site deployment by its unique ID. /// - /// @param String siteId - /// @param String deploymentId - /// @throws Exception - /// @return array + /// - Parameters: + /// - siteId: String + /// - deploymentId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Deployment /// open func getDeployment( siteId: String, @@ -624,10 +636,11 @@ open class Sites: Service { /// /// Delete a site deployment by its unique ID. /// - /// @param String siteId - /// @param String deploymentId - /// @throws Exception - /// @return array + /// - Parameters: + /// - siteId: String + /// - deploymentId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteDeployment( siteId: String, @@ -655,11 +668,12 @@ open class Sites: Service { /// return with a 'Content-Disposition: attachment' header that tells the /// browser to start downloading the file to user downloads directory. /// - /// @param String siteId - /// @param String deploymentId - /// @param AppwriteEnums.DeploymentDownloadType type - /// @throws Exception - /// @return array + /// - Parameters: + /// - siteId: String + /// - deploymentId: String + /// - type: AppwriteEnums.DeploymentDownloadType (optional) + /// - Throws: Exception if the request fails + /// - Returns: ByteBuffer /// open func getDeploymentDownload( siteId: String, @@ -692,10 +706,11 @@ open class Sites: Service { /// cancel builds that have already completed (status 'ready') or failed. The /// response includes the final build status and details. /// - /// @param String siteId - /// @param String deploymentId - /// @throws Exception - /// @return array + /// - Parameters: + /// - siteId: String + /// - deploymentId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Deployment /// open func updateDeploymentStatus( siteId: String, @@ -728,10 +743,11 @@ open class Sites: Service { /// Get a list of all site logs. You can use the query params to filter your /// results. /// - /// @param String siteId - /// @param [String] queries - /// @throws Exception - /// @return array + /// - Parameters: + /// - siteId: String + /// - queries: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.ExecutionList /// open func listLogs( siteId: String, @@ -762,10 +778,11 @@ open class Sites: Service { /// /// Get a site request log by its unique ID. /// - /// @param String siteId - /// @param String logId - /// @throws Exception - /// @return array + /// - Parameters: + /// - siteId: String + /// - logId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Execution /// open func getLog( siteId: String, @@ -795,10 +812,11 @@ open class Sites: Service { /// /// Delete a site log by its unique ID. /// - /// @param String siteId - /// @param String logId - /// @throws Exception - /// @return array + /// - Parameters: + /// - siteId: String + /// - logId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteLog( siteId: String, @@ -824,9 +842,10 @@ open class Sites: Service { /// /// Get a list of all variables of a specific site. /// - /// @param String siteId - /// @throws Exception - /// @return array + /// - Parameters: + /// - siteId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.VariableList /// open func listVariables( siteId: String @@ -855,12 +874,13 @@ open class Sites: Service { /// Create a new site variable. These variables can be accessed during build /// and runtime (server-side rendering) as environment variables. /// - /// @param String siteId - /// @param String key - /// @param String value - /// @param Bool secret - /// @throws Exception - /// @return array + /// - Parameters: + /// - siteId: String + /// - key: String + /// - value: String + /// - secret: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Variable /// open func createVariable( siteId: String, @@ -897,10 +917,11 @@ open class Sites: Service { /// /// Get a variable by its unique ID. /// - /// @param String siteId - /// @param String variableId - /// @throws Exception - /// @return array + /// - Parameters: + /// - siteId: String + /// - variableId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Variable /// open func getVariable( siteId: String, @@ -930,13 +951,14 @@ open class Sites: Service { /// /// Update variable by its unique ID. /// - /// @param String siteId - /// @param String variableId - /// @param String key - /// @param String value - /// @param Bool secret - /// @throws Exception - /// @return array + /// - Parameters: + /// - siteId: String + /// - variableId: String + /// - key: String + /// - value: String (optional) + /// - secret: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Variable /// open func updateVariable( siteId: String, @@ -975,10 +997,11 @@ open class Sites: Service { /// /// Delete a variable by its unique ID. /// - /// @param String siteId - /// @param String variableId - /// @throws Exception - /// @return array + /// - Parameters: + /// - siteId: String + /// - variableId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteVariable( siteId: String, diff --git a/Sources/Appwrite/Services/Storage.swift b/Sources/Appwrite/Services/Storage.swift index 29976dd..7852911 100644 --- a/Sources/Appwrite/Services/Storage.swift +++ b/Sources/Appwrite/Services/Storage.swift @@ -12,10 +12,11 @@ open class Storage: Service { /// Get a list of all the storage buckets. You can use the query params to /// filter your results. /// - /// @param [String] queries - /// @param String search - /// @throws Exception - /// @return array + /// - Parameters: + /// - queries: [String] (optional) + /// - search: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.BucketList /// open func listBuckets( queries: [String]? = nil, @@ -46,18 +47,19 @@ open class Storage: Service { /// /// Create a new storage bucket. /// - /// @param String bucketId - /// @param String name - /// @param [String] permissions - /// @param Bool fileSecurity - /// @param Bool enabled - /// @param Int maximumFileSize - /// @param [String] allowedFileExtensions - /// @param AppwriteEnums.Compression compression - /// @param Bool encryption - /// @param Bool antivirus - /// @throws Exception - /// @return array + /// - Parameters: + /// - bucketId: String + /// - name: String + /// - permissions: [String] (optional) + /// - fileSecurity: Bool (optional) + /// - enabled: Bool (optional) + /// - maximumFileSize: Int (optional) + /// - allowedFileExtensions: [String] (optional) + /// - compression: AppwriteEnums.Compression (optional) + /// - encryption: Bool (optional) + /// - antivirus: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Bucket /// open func createBucket( bucketId: String, @@ -107,9 +109,10 @@ open class Storage: Service { /// Get a storage bucket by its unique ID. This endpoint response returns a /// JSON object with the storage bucket metadata. /// - /// @param String bucketId - /// @throws Exception - /// @return array + /// - Parameters: + /// - bucketId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Bucket /// open func getBucket( bucketId: String @@ -137,18 +140,19 @@ open class Storage: Service { /// /// Update a storage bucket by its unique ID. /// - /// @param String bucketId - /// @param String name - /// @param [String] permissions - /// @param Bool fileSecurity - /// @param Bool enabled - /// @param Int maximumFileSize - /// @param [String] allowedFileExtensions - /// @param AppwriteEnums.Compression compression - /// @param Bool encryption - /// @param Bool antivirus - /// @throws Exception - /// @return array + /// - Parameters: + /// - bucketId: String + /// - name: String + /// - permissions: [String] (optional) + /// - fileSecurity: Bool (optional) + /// - enabled: Bool (optional) + /// - maximumFileSize: Int (optional) + /// - allowedFileExtensions: [String] (optional) + /// - compression: AppwriteEnums.Compression (optional) + /// - encryption: Bool (optional) + /// - antivirus: Bool (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Bucket /// open func updateBucket( bucketId: String, @@ -197,9 +201,10 @@ open class Storage: Service { /// /// Delete a storage bucket by its unique ID. /// - /// @param String bucketId - /// @throws Exception - /// @return array + /// - Parameters: + /// - bucketId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteBucket( bucketId: String @@ -224,11 +229,12 @@ open class Storage: Service { /// Get a list of all the user files. You can use the query params to filter /// your results. /// - /// @param String bucketId - /// @param [String] queries - /// @param String search - /// @throws Exception - /// @return array + /// - Parameters: + /// - bucketId: String + /// - queries: [String] (optional) + /// - search: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.FileList /// open func listFiles( bucketId: String, @@ -278,12 +284,13 @@ open class Storage: Service { /// chunking logic will be managed by the SDK internally. /// /// - /// @param String bucketId - /// @param String fileId - /// @param InputFile file - /// @param [String] permissions - /// @throws Exception - /// @return array + /// - Parameters: + /// - bucketId: String + /// - fileId: String + /// - file: InputFile + /// - permissions: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.File /// open func createFile( bucketId: String, @@ -326,10 +333,11 @@ open class Storage: Service { /// Get a file by its unique ID. This endpoint response returns a JSON object /// with the file metadata. /// - /// @param String bucketId - /// @param String fileId - /// @throws Exception - /// @return array + /// - Parameters: + /// - bucketId: String + /// - fileId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.File /// open func getFile( bucketId: String, @@ -360,12 +368,13 @@ open class Storage: Service { /// Update a file by its unique ID. Only users with write permissions have /// access to update this resource. /// - /// @param String bucketId - /// @param String fileId - /// @param String name - /// @param [String] permissions - /// @throws Exception - /// @return array + /// - Parameters: + /// - bucketId: String + /// - fileId: String + /// - name: String (optional) + /// - permissions: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.File /// open func updateFile( bucketId: String, @@ -403,10 +412,11 @@ open class Storage: Service { /// Delete a file by its unique ID. Only users with write permissions have /// access to delete this resource. /// - /// @param String bucketId - /// @param String fileId - /// @throws Exception - /// @return array + /// - Parameters: + /// - bucketId: String + /// - fileId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteFile( bucketId: String, @@ -434,11 +444,12 @@ open class Storage: Service { /// 'Content-Disposition: attachment' header that tells the browser to start /// downloading the file to user downloads directory. /// - /// @param String bucketId - /// @param String fileId - /// @param String token - /// @throws Exception - /// @return array + /// - Parameters: + /// - bucketId: String + /// - fileId: String + /// - token: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: ByteBuffer /// open func getFileDownload( bucketId: String, @@ -471,22 +482,23 @@ open class Storage: Service { /// string arguments for cutting and resizing your preview image. Preview is /// supported only for image files smaller than 10MB. /// - /// @param String bucketId - /// @param String fileId - /// @param Int width - /// @param Int height - /// @param AppwriteEnums.ImageGravity gravity - /// @param Int quality - /// @param Int borderWidth - /// @param String borderColor - /// @param Int borderRadius - /// @param Double opacity - /// @param Int rotation - /// @param String background - /// @param AppwriteEnums.ImageFormat output - /// @param String token - /// @throws Exception - /// @return array + /// - Parameters: + /// - bucketId: String + /// - fileId: String + /// - width: Int (optional) + /// - height: Int (optional) + /// - gravity: AppwriteEnums.ImageGravity (optional) + /// - quality: Int (optional) + /// - borderWidth: Int (optional) + /// - borderColor: String (optional) + /// - borderRadius: Int (optional) + /// - opacity: Double (optional) + /// - rotation: Int (optional) + /// - background: String (optional) + /// - output: AppwriteEnums.ImageFormat (optional) + /// - token: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: ByteBuffer /// open func getFilePreview( bucketId: String, @@ -539,11 +551,12 @@ open class Storage: Service { /// download method but returns with no 'Content-Disposition: attachment' /// header. /// - /// @param String bucketId - /// @param String fileId - /// @param String token - /// @throws Exception - /// @return array + /// - Parameters: + /// - bucketId: String + /// - fileId: String + /// - token: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: ByteBuffer /// open func getFileView( bucketId: String, diff --git a/Sources/Appwrite/Services/Teams.swift b/Sources/Appwrite/Services/Teams.swift index 6b410ee..5441073 100644 --- a/Sources/Appwrite/Services/Teams.swift +++ b/Sources/Appwrite/Services/Teams.swift @@ -12,10 +12,11 @@ open class Teams: Service { /// Get a list of all the teams in which the current user is a member. You can /// use the parameters to filter your results. /// - /// @param [String] queries - /// @param String search - /// @throws Exception - /// @return array + /// - Parameters: + /// - queries: [String] (optional) + /// - search: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.TeamList /// open func list( queries: [String]? = nil, @@ -48,10 +49,11 @@ open class Teams: Service { /// Get a list of all the teams in which the current user is a member. You can /// use the parameters to filter your results. /// - /// @param [String] queries - /// @param String search - /// @throws Exception - /// @return array + /// - Parameters: + /// - queries: [String] (optional) + /// - search: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.TeamList /// open func list( queries: [String]? = nil, @@ -69,11 +71,12 @@ open class Teams: Service { /// assigned as the owner of the team. Only the users with the owner role can /// invite new members, add new owners and delete or update the team. /// - /// @param String teamId - /// @param String name - /// @param [String] roles - /// @throws Exception - /// @return array + /// - Parameters: + /// - teamId: String + /// - name: String + /// - roles: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Team /// open func create( teamId: String, @@ -111,11 +114,12 @@ open class Teams: Service { /// assigned as the owner of the team. Only the users with the owner role can /// invite new members, add new owners and delete or update the team. /// - /// @param String teamId - /// @param String name - /// @param [String] roles - /// @throws Exception - /// @return array + /// - Parameters: + /// - teamId: String + /// - name: String + /// - roles: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Team /// open func create( teamId: String, @@ -133,9 +137,10 @@ open class Teams: Service { /// /// Get a team by its ID. All team members have read access for this resource. /// - /// @param String teamId - /// @throws Exception - /// @return array + /// - Parameters: + /// - teamId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Team /// open func get( teamId: String, @@ -164,9 +169,10 @@ open class Teams: Service { /// /// Get a team by its ID. All team members have read access for this resource. /// - /// @param String teamId - /// @throws Exception - /// @return array + /// - Parameters: + /// - teamId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Team /// open func get( teamId: String @@ -180,10 +186,11 @@ open class Teams: Service { /// /// Update the team's name by its unique ID. /// - /// @param String teamId - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - teamId: String + /// - name: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Team /// open func updateName( teamId: String, @@ -217,10 +224,11 @@ open class Teams: Service { /// /// Update the team's name by its unique ID. /// - /// @param String teamId - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - teamId: String + /// - name: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Team /// open func updateName( teamId: String, @@ -237,9 +245,10 @@ open class Teams: Service { /// Delete a team using its ID. Only team members with the owner role can /// delete the team. /// - /// @param String teamId - /// @throws Exception - /// @return array + /// - Parameters: + /// - teamId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func delete( teamId: String @@ -265,11 +274,12 @@ open class Teams: Service { /// members have read access to this endpoint. Hide sensitive attributes from /// the response by toggling membership privacy in the Console. /// - /// @param String teamId - /// @param [String] queries - /// @param String search - /// @throws Exception - /// @return array + /// - Parameters: + /// - teamId: String + /// - queries: [String] (optional) + /// - search: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.MembershipList /// open func listMemberships( teamId: String, @@ -322,15 +332,16 @@ open class Teams: Service { /// added as a platform on the Appwrite Console. /// /// - /// @param String teamId - /// @param [String] roles - /// @param String email - /// @param String userId - /// @param String phone - /// @param String url - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - teamId: String + /// - roles: [String] + /// - email: String (optional) + /// - userId: String (optional) + /// - phone: String (optional) + /// - url: String (optional) + /// - name: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Membership /// open func createMembership( teamId: String, @@ -375,10 +386,11 @@ open class Teams: Service { /// access for this resource. Hide sensitive attributes from the response by /// toggling membership privacy in the Console. /// - /// @param String teamId - /// @param String membershipId - /// @throws Exception - /// @return array + /// - Parameters: + /// - teamId: String + /// - membershipId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Membership /// open func getMembership( teamId: String, @@ -411,11 +423,12 @@ open class Teams: Service { /// permissions](https://appwrite.io/docs/permissions). /// /// - /// @param String teamId - /// @param String membershipId - /// @param [String] roles - /// @throws Exception - /// @return array + /// - Parameters: + /// - teamId: String + /// - membershipId: String + /// - roles: [String] + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Membership /// open func updateMembership( teamId: String, @@ -452,10 +465,11 @@ open class Teams: Service { /// the membership of any other team member. You can also use this endpoint to /// delete a user membership even if it is not accepted. /// - /// @param String teamId - /// @param String membershipId - /// @throws Exception - /// @return array + /// - Parameters: + /// - teamId: String + /// - membershipId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteMembership( teamId: String, @@ -487,12 +501,13 @@ open class Teams: Service { /// created. /// /// - /// @param String teamId - /// @param String membershipId - /// @param String userId - /// @param String secret - /// @throws Exception - /// @return array + /// - Parameters: + /// - teamId: String + /// - membershipId: String + /// - userId: String + /// - secret: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Membership /// open func updateMembershipStatus( teamId: String, @@ -531,9 +546,10 @@ open class Teams: Service { /// need to be shared by all team members, prefer storing them in [user /// preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). /// - /// @param String teamId - /// @throws Exception - /// @return array + /// - Parameters: + /// - teamId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Preferences /// open func getPrefs( teamId: String, @@ -564,9 +580,10 @@ open class Teams: Service { /// need to be shared by all team members, prefer storing them in [user /// preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). /// - /// @param String teamId - /// @throws Exception - /// @return array + /// - Parameters: + /// - teamId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Preferences /// open func getPrefs( teamId: String @@ -582,10 +599,11 @@ open class Teams: Service { /// stored as is and replaces any previous value. The maximum allowed prefs /// size is 64kB and throws an error if exceeded. /// - /// @param String teamId - /// @param Any prefs - /// @throws Exception - /// @return array + /// - Parameters: + /// - teamId: String + /// - prefs: Any + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Preferences /// open func updatePrefs( teamId: String, @@ -621,10 +639,11 @@ open class Teams: Service { /// stored as is and replaces any previous value. The maximum allowed prefs /// size is 64kB and throws an error if exceeded. /// - /// @param String teamId - /// @param Any prefs - /// @throws Exception - /// @return array + /// - Parameters: + /// - teamId: String + /// - prefs: Any + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Preferences /// open func updatePrefs( teamId: String, diff --git a/Sources/Appwrite/Services/Tokens.swift b/Sources/Appwrite/Services/Tokens.swift index b579e0f..02dbc4c 100644 --- a/Sources/Appwrite/Services/Tokens.swift +++ b/Sources/Appwrite/Services/Tokens.swift @@ -12,11 +12,12 @@ open class Tokens: Service { /// List all the tokens created for a specific file or bucket. You can use the /// query params to filter your results. /// - /// @param String bucketId - /// @param String fileId - /// @param [String] queries - /// @throws Exception - /// @return array + /// - Parameters: + /// - bucketId: String + /// - fileId: String + /// - queries: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.ResourceTokenList /// open func list( bucketId: String, @@ -50,11 +51,12 @@ open class Tokens: Service { /// Create a new token. A token is linked to a file. Token can be passed as a /// request URL search parameter. /// - /// @param String bucketId - /// @param String fileId - /// @param String expire - /// @throws Exception - /// @return array + /// - Parameters: + /// - bucketId: String + /// - fileId: String + /// - expire: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.ResourceToken /// open func createFileToken( bucketId: String, @@ -89,9 +91,10 @@ open class Tokens: Service { /// /// Get a token by its unique ID. /// - /// @param String tokenId - /// @throws Exception - /// @return array + /// - Parameters: + /// - tokenId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.ResourceToken /// open func get( tokenId: String @@ -120,10 +123,11 @@ open class Tokens: Service { /// Update a token by its unique ID. Use this endpoint to update a token's /// expiry date. /// - /// @param String tokenId - /// @param String expire - /// @throws Exception - /// @return array + /// - Parameters: + /// - tokenId: String + /// - expire: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.ResourceToken /// open func update( tokenId: String, @@ -156,9 +160,10 @@ open class Tokens: Service { /// /// Delete a token by its unique ID. /// - /// @param String tokenId - /// @throws Exception - /// @return array + /// - Parameters: + /// - tokenId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func delete( tokenId: String diff --git a/Sources/Appwrite/Services/Users.swift b/Sources/Appwrite/Services/Users.swift index 02505e6..a2d3d6b 100644 --- a/Sources/Appwrite/Services/Users.swift +++ b/Sources/Appwrite/Services/Users.swift @@ -12,10 +12,11 @@ open class Users: Service { /// Get a list of all the project's users. You can use the query params to /// filter your results. /// - /// @param [String] queries - /// @param String search - /// @throws Exception - /// @return array + /// - Parameters: + /// - queries: [String] (optional) + /// - search: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.UserList /// open func list( queries: [String]? = nil, @@ -48,10 +49,11 @@ open class Users: Service { /// Get a list of all the project's users. You can use the query params to /// filter your results. /// - /// @param [String] queries - /// @param String search - /// @throws Exception - /// @return array + /// - Parameters: + /// - queries: [String] (optional) + /// - search: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.UserList /// open func list( queries: [String]? = nil, @@ -67,13 +69,14 @@ open class Users: Service { /// /// Create a new user. /// - /// @param String userId - /// @param String email - /// @param String phone - /// @param String password - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - email: String (optional) + /// - phone: String (optional) + /// - password: String (optional) + /// - name: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func create( userId: String, @@ -113,13 +116,14 @@ open class Users: Service { /// /// Create a new user. /// - /// @param String userId - /// @param String email - /// @param String phone - /// @param String password - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - email: String (optional) + /// - phone: String (optional) + /// - password: String (optional) + /// - name: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func create( userId: String, @@ -144,12 +148,13 @@ open class Users: Service { /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. /// - /// @param String userId - /// @param String email - /// @param String password - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - email: String + /// - password: String + /// - name: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func createArgon2User( userId: String, @@ -190,12 +195,13 @@ open class Users: Service { /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. /// - /// @param String userId - /// @param String email - /// @param String password - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - email: String + /// - password: String + /// - name: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func createArgon2User( userId: String, @@ -218,12 +224,13 @@ open class Users: Service { /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. /// - /// @param String userId - /// @param String email - /// @param String password - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - email: String + /// - password: String + /// - name: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func createBcryptUser( userId: String, @@ -264,12 +271,13 @@ open class Users: Service { /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. /// - /// @param String userId - /// @param String email - /// @param String password - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - email: String + /// - password: String + /// - name: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func createBcryptUser( userId: String, @@ -289,10 +297,11 @@ open class Users: Service { /// /// Get identities for all users. /// - /// @param [String] queries - /// @param String search - /// @throws Exception - /// @return array + /// - Parameters: + /// - queries: [String] (optional) + /// - search: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.IdentityList /// open func listIdentities( queries: [String]? = nil, @@ -323,9 +332,10 @@ open class Users: Service { /// /// Delete an identity by its unique ID. /// - /// @param String identityId - /// @throws Exception - /// @return array + /// - Parameters: + /// - identityId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteIdentity( identityId: String @@ -352,12 +362,13 @@ open class Users: Service { /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. /// - /// @param String userId - /// @param String email - /// @param String password - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - email: String + /// - password: String + /// - name: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func createMD5User( userId: String, @@ -398,12 +409,13 @@ open class Users: Service { /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. /// - /// @param String userId - /// @param String email - /// @param String password - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - email: String + /// - password: String + /// - name: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func createMD5User( userId: String, @@ -426,12 +438,13 @@ open class Users: Service { /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. /// - /// @param String userId - /// @param String email - /// @param String password - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - email: String + /// - password: String + /// - name: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func createPHPassUser( userId: String, @@ -472,12 +485,13 @@ open class Users: Service { /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. /// - /// @param String userId - /// @param String email - /// @param String password - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - email: String + /// - password: String + /// - name: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func createPHPassUser( userId: String, @@ -500,17 +514,18 @@ open class Users: Service { /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. /// - /// @param String userId - /// @param String email - /// @param String password - /// @param String passwordSalt - /// @param Int passwordCpu - /// @param Int passwordMemory - /// @param Int passwordParallel - /// @param Int passwordLength - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - email: String + /// - password: String + /// - passwordSalt: String + /// - passwordCpu: Int + /// - passwordMemory: Int + /// - passwordParallel: Int + /// - passwordLength: Int + /// - name: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func createScryptUser( userId: String, @@ -561,17 +576,18 @@ open class Users: Service { /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. /// - /// @param String userId - /// @param String email - /// @param String password - /// @param String passwordSalt - /// @param Int passwordCpu - /// @param Int passwordMemory - /// @param Int passwordParallel - /// @param Int passwordLength - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - email: String + /// - password: String + /// - passwordSalt: String + /// - passwordCpu: Int + /// - passwordMemory: Int + /// - passwordParallel: Int + /// - passwordLength: Int + /// - name: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func createScryptUser( userId: String, @@ -605,15 +621,16 @@ open class Users: Service { /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. /// - /// @param String userId - /// @param String email - /// @param String password - /// @param String passwordSalt - /// @param String passwordSaltSeparator - /// @param String passwordSignerKey - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - email: String + /// - password: String + /// - passwordSalt: String + /// - passwordSaltSeparator: String + /// - passwordSignerKey: String + /// - name: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func createScryptModifiedUser( userId: String, @@ -661,15 +678,16 @@ open class Users: Service { /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. /// - /// @param String userId - /// @param String email - /// @param String password - /// @param String passwordSalt - /// @param String passwordSaltSeparator - /// @param String passwordSignerKey - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - email: String + /// - password: String + /// - passwordSalt: String + /// - passwordSaltSeparator: String + /// - passwordSignerKey: String + /// - name: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func createScryptModifiedUser( userId: String, @@ -698,13 +716,14 @@ open class Users: Service { /// the [POST /users](https://appwrite.io/docs/server/users#usersCreate) /// endpoint to create users with a plain text password. /// - /// @param String userId - /// @param String email - /// @param String password - /// @param AppwriteEnums.PasswordHash passwordVersion - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - email: String + /// - password: String + /// - passwordVersion: AppwriteEnums.PasswordHash (optional) + /// - name: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func createSHAUser( userId: String, @@ -747,13 +766,14 @@ open class Users: Service { /// the [POST /users](https://appwrite.io/docs/server/users#usersCreate) /// endpoint to create users with a plain text password. /// - /// @param String userId - /// @param String email - /// @param String password - /// @param AppwriteEnums.PasswordHash passwordVersion - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - email: String + /// - password: String + /// - passwordVersion: AppwriteEnums.PasswordHash (optional) + /// - name: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func createSHAUser( userId: String, @@ -775,9 +795,10 @@ open class Users: Service { /// /// Get a user by its unique ID. /// - /// @param String userId - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func get( userId: String, @@ -806,9 +827,10 @@ open class Users: Service { /// /// Get a user by its unique ID. /// - /// @param String userId - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func get( userId: String @@ -827,9 +849,10 @@ open class Users: Service { /// [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) /// endpoint instead. /// - /// @param String userId - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func delete( userId: String @@ -853,10 +876,11 @@ open class Users: Service { /// /// Update the user email by its unique ID. /// - /// @param String userId - /// @param String email - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - email: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updateEmail( userId: String, @@ -890,10 +914,11 @@ open class Users: Service { /// /// Update the user email by its unique ID. /// - /// @param String userId - /// @param String email - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - email: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updateEmail( userId: String, @@ -911,11 +936,12 @@ open class Users: Service { /// can use the resulting JWT to authenticate on behalf of the user. The JWT /// secret will become invalid if the session it uses gets deleted. /// - /// @param String userId - /// @param String sessionId - /// @param Int duration - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - sessionId: String (optional) + /// - duration: Int (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Jwt /// open func createJWT( userId: String, @@ -955,10 +981,11 @@ open class Users: Service { /// developer to grant access without an invitation. See the [Permissions /// docs](https://appwrite.io/docs/permissions) for more info. /// - /// @param String userId - /// @param [String] labels - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - labels: [String] + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updateLabels( userId: String, @@ -997,10 +1024,11 @@ open class Users: Service { /// developer to grant access without an invitation. See the [Permissions /// docs](https://appwrite.io/docs/permissions) for more info. /// - /// @param String userId - /// @param [String] labels - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - labels: [String] + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updateLabels( userId: String, @@ -1016,10 +1044,11 @@ open class Users: Service { /// /// Get the user activity logs list by its unique ID. /// - /// @param String userId - /// @param [String] queries - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - queries: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.LogList /// open func listLogs( userId: String, @@ -1050,11 +1079,12 @@ open class Users: Service { /// /// Get the user membership list by its unique ID. /// - /// @param String userId - /// @param [String] queries - /// @param String search - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - queries: [String] (optional) + /// - search: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.MembershipList /// open func listMemberships( userId: String, @@ -1087,10 +1117,11 @@ open class Users: Service { /// /// Enable or disable MFA on a user account. /// - /// @param String userId - /// @param Bool mfa - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - mfa: Bool + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updateMfa( userId: String, @@ -1124,10 +1155,11 @@ open class Users: Service { /// /// Enable or disable MFA on a user account. /// - /// @param String userId - /// @param Bool mfa - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - mfa: Bool + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updateMfa( userId: String, @@ -1143,10 +1175,11 @@ open class Users: Service { /// /// Delete an authenticator app. /// - /// @param String userId - /// @param AppwriteEnums.AuthenticatorType type - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - type: AppwriteEnums.AuthenticatorType + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteMfaAuthenticator( userId: String, @@ -1172,9 +1205,10 @@ open class Users: Service { /// /// List the factors available on the account to be used as a MFA challange. /// - /// @param String userId - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.MfaFactors /// open func listMfaFactors( userId: String @@ -1205,9 +1239,10 @@ open class Users: Service { /// [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) /// method. /// - /// @param String userId - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.MfaRecoveryCodes /// open func getMfaRecoveryCodes( userId: String @@ -1238,9 +1273,10 @@ open class Users: Service { /// [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) /// method. /// - /// @param String userId - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.MfaRecoveryCodes /// open func updateMfaRecoveryCodes( userId: String @@ -1273,9 +1309,10 @@ open class Users: Service { /// [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) /// method by client SDK. /// - /// @param String userId - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.MfaRecoveryCodes /// open func createMfaRecoveryCodes( userId: String @@ -1305,10 +1342,11 @@ open class Users: Service { /// /// Update the user name by its unique ID. /// - /// @param String userId - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - name: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updateName( userId: String, @@ -1342,10 +1380,11 @@ open class Users: Service { /// /// Update the user name by its unique ID. /// - /// @param String userId - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - name: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updateName( userId: String, @@ -1361,10 +1400,11 @@ open class Users: Service { /// /// Update the user password by its unique ID. /// - /// @param String userId - /// @param String password - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - password: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updatePassword( userId: String, @@ -1398,10 +1438,11 @@ open class Users: Service { /// /// Update the user password by its unique ID. /// - /// @param String userId - /// @param String password - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - password: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updatePassword( userId: String, @@ -1417,10 +1458,11 @@ open class Users: Service { /// /// Update the user phone by its unique ID. /// - /// @param String userId - /// @param String number - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - number: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updatePhone( userId: String, @@ -1454,10 +1496,11 @@ open class Users: Service { /// /// Update the user phone by its unique ID. /// - /// @param String userId - /// @param String number - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - number: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updatePhone( userId: String, @@ -1473,9 +1516,10 @@ open class Users: Service { /// /// Get the user preferences by its unique ID. /// - /// @param String userId - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Preferences /// open func getPrefs( userId: String, @@ -1504,9 +1548,10 @@ open class Users: Service { /// /// Get the user preferences by its unique ID. /// - /// @param String userId - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Preferences /// open func getPrefs( userId: String @@ -1522,10 +1567,11 @@ open class Users: Service { /// as is, and replaces any previous value. The maximum allowed prefs size is /// 64kB and throws error if exceeded. /// - /// @param String userId - /// @param Any prefs - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - prefs: Any + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Preferences /// open func updatePrefs( userId: String, @@ -1561,10 +1607,11 @@ open class Users: Service { /// as is, and replaces any previous value. The maximum allowed prefs size is /// 64kB and throws error if exceeded. /// - /// @param String userId - /// @param Any prefs - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - prefs: Any + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Preferences /// open func updatePrefs( userId: String, @@ -1580,9 +1627,10 @@ open class Users: Service { /// /// Get the user sessions list by its unique ID. /// - /// @param String userId - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.SessionList /// open func listSessions( userId: String @@ -1615,9 +1663,10 @@ open class Users: Service { /// /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) /// endpoint. /// - /// @param String userId - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Session /// open func createSession( userId: String @@ -1647,9 +1696,10 @@ open class Users: Service { /// /// Delete all user's sessions by using the user's unique ID. /// - /// @param String userId - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteSessions( userId: String @@ -1673,10 +1723,11 @@ open class Users: Service { /// /// Delete a user sessions by its unique ID. /// - /// @param String userId - /// @param String sessionId - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - sessionId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteSession( userId: String, @@ -1703,10 +1754,11 @@ open class Users: Service { /// Update the user status by its unique ID. Use this endpoint as an /// alternative to deleting a user if you want to keep user's ID reserved. /// - /// @param String userId - /// @param Bool status - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - status: Bool + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updateStatus( userId: String, @@ -1741,10 +1793,11 @@ open class Users: Service { /// Update the user status by its unique ID. Use this endpoint as an /// alternative to deleting a user if you want to keep user's ID reserved. /// - /// @param String userId - /// @param Bool status - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - status: Bool + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updateStatus( userId: String, @@ -1760,10 +1813,11 @@ open class Users: Service { /// /// List the messaging targets that are associated with a user. /// - /// @param String userId - /// @param [String] queries - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - queries: [String] (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.TargetList /// open func listTargets( userId: String, @@ -1794,14 +1848,15 @@ open class Users: Service { /// /// Create a messaging target. /// - /// @param String userId - /// @param String targetId - /// @param AppwriteEnums.MessagingProviderType providerType - /// @param String identifier - /// @param String providerId - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - targetId: String + /// - providerType: AppwriteEnums.MessagingProviderType + /// - identifier: String + /// - providerId: String (optional) + /// - name: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Target /// open func createTarget( userId: String, @@ -1842,10 +1897,11 @@ open class Users: Service { /// /// Get a user's push notification target by ID. /// - /// @param String userId - /// @param String targetId - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - targetId: String + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Target /// open func getTarget( userId: String, @@ -1875,13 +1931,14 @@ open class Users: Service { /// /// Update a messaging target. /// - /// @param String userId - /// @param String targetId - /// @param String identifier - /// @param String providerId - /// @param String name - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - targetId: String + /// - identifier: String (optional) + /// - providerId: String (optional) + /// - name: String (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Target /// open func updateTarget( userId: String, @@ -1920,10 +1977,11 @@ open class Users: Service { /// /// Delete a messaging target. /// - /// @param String userId - /// @param String targetId - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - targetId: String + /// - Throws: Exception if the request fails + /// - Returns: Any /// open func deleteTarget( userId: String, @@ -1953,11 +2011,12 @@ open class Users: Service { /// endpoint to complete the login process. /// /// - /// @param String userId - /// @param Int length - /// @param Int expire - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - length: Int (optional) + /// - expire: Int (optional) + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.Token /// open func createToken( userId: String, @@ -1992,10 +2051,11 @@ open class Users: Service { /// /// Update the user email verification status by its unique ID. /// - /// @param String userId - /// @param Bool emailVerification - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - emailVerification: Bool + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updateEmailVerification( userId: String, @@ -2029,10 +2089,11 @@ open class Users: Service { /// /// Update the user email verification status by its unique ID. /// - /// @param String userId - /// @param Bool emailVerification - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - emailVerification: Bool + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updateEmailVerification( userId: String, @@ -2048,10 +2109,11 @@ open class Users: Service { /// /// Update the user phone verification status by its unique ID. /// - /// @param String userId - /// @param Bool phoneVerification - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - phoneVerification: Bool + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updatePhoneVerification( userId: String, @@ -2085,10 +2147,11 @@ open class Users: Service { /// /// Update the user phone verification status by its unique ID. /// - /// @param String userId - /// @param Bool phoneVerification - /// @throws Exception - /// @return array + /// - Parameters: + /// - userId: String + /// - phoneVerification: Bool + /// - Throws: Exception if the request fails + /// - Returns: AppwriteModels.User /// open func updatePhoneVerification( userId: String, diff --git a/Sources/AppwriteEnums/BuildRuntime.swift b/Sources/AppwriteEnums/BuildRuntime.swift index 90ca969..dc9b179 100644 --- a/Sources/AppwriteEnums/BuildRuntime.swift +++ b/Sources/AppwriteEnums/BuildRuntime.swift @@ -38,6 +38,7 @@ public enum BuildRuntime: String, CustomStringConvertible { case dart31 = "dart-3.1" case dart33 = "dart-3.3" case dart35 = "dart-3.5" + case dart38 = "dart-3.8" case dotnet60 = "dotnet-6.0" case dotnet70 = "dotnet-7.0" case dotnet80 = "dotnet-8.0" @@ -64,6 +65,7 @@ public enum BuildRuntime: String, CustomStringConvertible { case flutter324 = "flutter-3.24" case flutter327 = "flutter-3.27" case flutter329 = "flutter-3.29" + case flutter332 = "flutter-3.32" public var description: String { return rawValue diff --git a/Sources/AppwriteEnums/ImageFormat.swift b/Sources/AppwriteEnums/ImageFormat.swift index 70110ff..c1a6694 100644 --- a/Sources/AppwriteEnums/ImageFormat.swift +++ b/Sources/AppwriteEnums/ImageFormat.swift @@ -7,6 +7,7 @@ public enum ImageFormat: String, CustomStringConvertible { case webp = "webp" case heic = "heic" case avif = "avif" + case gif = "gif" public var description: String { return rawValue diff --git a/Sources/AppwriteEnums/Runtime.swift b/Sources/AppwriteEnums/Runtime.swift index 5a6cccf..a461f31 100644 --- a/Sources/AppwriteEnums/Runtime.swift +++ b/Sources/AppwriteEnums/Runtime.swift @@ -38,6 +38,7 @@ public enum Runtime: String, CustomStringConvertible { case dart31 = "dart-3.1" case dart33 = "dart-3.3" case dart35 = "dart-3.5" + case dart38 = "dart-3.8" case dotnet60 = "dotnet-6.0" case dotnet70 = "dotnet-7.0" case dotnet80 = "dotnet-8.0" @@ -64,6 +65,7 @@ public enum Runtime: String, CustomStringConvertible { case flutter324 = "flutter-3.24" case flutter327 = "flutter-3.27" case flutter329 = "flutter-3.29" + case flutter332 = "flutter-3.32" public var description: String { return rawValue diff --git a/Sources/AppwriteModels/AttributeBoolean.swift b/Sources/AppwriteModels/AttributeBoolean.swift index 31522c2..feb0462 100644 --- a/Sources/AppwriteModels/AttributeBoolean.swift +++ b/Sources/AppwriteModels/AttributeBoolean.swift @@ -114,11 +114,11 @@ open class AttributeBoolean: Codable { type: map["type"] as! String, status: map["status"] as! String, error: map["error"] as! String, - `required`: map["required"] as! Bool, + required: map["required"] as! Bool, array: map["array"] as? Bool, createdAt: map["$createdAt"] as! String, updatedAt: map["$updatedAt"] as! String, - `default`: map["default"] as? Bool + default: map["default"] as? Bool ) } } diff --git a/Sources/AppwriteModels/AttributeDatetime.swift b/Sources/AppwriteModels/AttributeDatetime.swift index ac80231..6922821 100644 --- a/Sources/AppwriteModels/AttributeDatetime.swift +++ b/Sources/AppwriteModels/AttributeDatetime.swift @@ -123,12 +123,12 @@ open class AttributeDatetime: Codable { type: map["type"] as! String, status: map["status"] as! String, error: map["error"] as! String, - `required`: map["required"] as! Bool, + required: map["required"] as! Bool, array: map["array"] as? Bool, createdAt: map["$createdAt"] as! String, updatedAt: map["$updatedAt"] as! String, format: map["format"] as! String, - `default`: map["default"] as? String + default: map["default"] as? String ) } } diff --git a/Sources/AppwriteModels/AttributeEmail.swift b/Sources/AppwriteModels/AttributeEmail.swift index 8e57b2c..a8aa6d2 100644 --- a/Sources/AppwriteModels/AttributeEmail.swift +++ b/Sources/AppwriteModels/AttributeEmail.swift @@ -123,12 +123,12 @@ open class AttributeEmail: Codable { type: map["type"] as! String, status: map["status"] as! String, error: map["error"] as! String, - `required`: map["required"] as! Bool, + required: map["required"] as! Bool, array: map["array"] as? Bool, createdAt: map["$createdAt"] as! String, updatedAt: map["$updatedAt"] as! String, format: map["format"] as! String, - `default`: map["default"] as? String + default: map["default"] as? String ) } } diff --git a/Sources/AppwriteModels/AttributeEnum.swift b/Sources/AppwriteModels/AttributeEnum.swift index e232869..e5f3482 100644 --- a/Sources/AppwriteModels/AttributeEnum.swift +++ b/Sources/AppwriteModels/AttributeEnum.swift @@ -132,13 +132,13 @@ open class AttributeEnum: Codable { type: map["type"] as! String, status: map["status"] as! String, error: map["error"] as! String, - `required`: map["required"] as! Bool, + required: map["required"] as! Bool, array: map["array"] as? Bool, createdAt: map["$createdAt"] as! String, updatedAt: map["$updatedAt"] as! String, elements: map["elements"] as! [String], format: map["format"] as! String, - `default`: map["default"] as? String + default: map["default"] as? String ) } } diff --git a/Sources/AppwriteModels/AttributeFloat.swift b/Sources/AppwriteModels/AttributeFloat.swift index 676f317..fceef5f 100644 --- a/Sources/AppwriteModels/AttributeFloat.swift +++ b/Sources/AppwriteModels/AttributeFloat.swift @@ -132,13 +132,13 @@ open class AttributeFloat: Codable { type: map["type"] as! String, status: map["status"] as! String, error: map["error"] as! String, - `required`: map["required"] as! Bool, + required: map["required"] as! Bool, array: map["array"] as? Bool, createdAt: map["$createdAt"] as! String, updatedAt: map["$updatedAt"] as! String, min: map["min"] as? Double, max: map["max"] as? Double, - `default`: map["default"] as? Double + default: map["default"] as? Double ) } } diff --git a/Sources/AppwriteModels/AttributeInteger.swift b/Sources/AppwriteModels/AttributeInteger.swift index 06d3a69..acb5d36 100644 --- a/Sources/AppwriteModels/AttributeInteger.swift +++ b/Sources/AppwriteModels/AttributeInteger.swift @@ -132,13 +132,13 @@ open class AttributeInteger: Codable { type: map["type"] as! String, status: map["status"] as! String, error: map["error"] as! String, - `required`: map["required"] as! Bool, + required: map["required"] as! Bool, array: map["array"] as? Bool, createdAt: map["$createdAt"] as! String, updatedAt: map["$updatedAt"] as! String, min: map["min"] as? Int, max: map["max"] as? Int, - `default`: map["default"] as? Int + default: map["default"] as? Int ) } } diff --git a/Sources/AppwriteModels/AttributeIp.swift b/Sources/AppwriteModels/AttributeIp.swift index 7904155..47b46de 100644 --- a/Sources/AppwriteModels/AttributeIp.swift +++ b/Sources/AppwriteModels/AttributeIp.swift @@ -123,12 +123,12 @@ open class AttributeIp: Codable { type: map["type"] as! String, status: map["status"] as! String, error: map["error"] as! String, - `required`: map["required"] as! Bool, + required: map["required"] as! Bool, array: map["array"] as? Bool, createdAt: map["$createdAt"] as! String, updatedAt: map["$updatedAt"] as! String, format: map["format"] as! String, - `default`: map["default"] as? String + default: map["default"] as? String ) } } diff --git a/Sources/AppwriteModels/AttributeRelationship.swift b/Sources/AppwriteModels/AttributeRelationship.swift index a1f8cd7..c7c38d7 100644 --- a/Sources/AppwriteModels/AttributeRelationship.swift +++ b/Sources/AppwriteModels/AttributeRelationship.swift @@ -159,7 +159,7 @@ open class AttributeRelationship: Codable { type: map["type"] as! String, status: map["status"] as! String, error: map["error"] as! String, - `required`: map["required"] as! Bool, + required: map["required"] as! Bool, array: map["array"] as? Bool, createdAt: map["$createdAt"] as! String, updatedAt: map["$updatedAt"] as! String, diff --git a/Sources/AppwriteModels/AttributeString.swift b/Sources/AppwriteModels/AttributeString.swift index 9ed9acc..b7da6a8 100644 --- a/Sources/AppwriteModels/AttributeString.swift +++ b/Sources/AppwriteModels/AttributeString.swift @@ -132,12 +132,12 @@ open class AttributeString: Codable { type: map["type"] as! String, status: map["status"] as! String, error: map["error"] as! String, - `required`: map["required"] as! Bool, + required: map["required"] as! Bool, array: map["array"] as? Bool, createdAt: map["$createdAt"] as! String, updatedAt: map["$updatedAt"] as! String, size: map["size"] as! Int, - `default`: map["default"] as? String, + default: map["default"] as? String, encrypt: map["encrypt"] as? Bool ) } diff --git a/Sources/AppwriteModels/AttributeUrl.swift b/Sources/AppwriteModels/AttributeUrl.swift index cfbeac5..b45607b 100644 --- a/Sources/AppwriteModels/AttributeUrl.swift +++ b/Sources/AppwriteModels/AttributeUrl.swift @@ -123,12 +123,12 @@ open class AttributeUrl: Codable { type: map["type"] as! String, status: map["status"] as! String, error: map["error"] as! String, - `required`: map["required"] as! Bool, + required: map["required"] as! Bool, array: map["array"] as? Bool, createdAt: map["$createdAt"] as! String, updatedAt: map["$updatedAt"] as! String, format: map["format"] as! String, - `default`: map["default"] as? String + default: map["default"] as? String ) } } diff --git a/Sources/AppwriteModels/Document.swift b/Sources/AppwriteModels/Document.swift index 744a03e..f076cc5 100644 --- a/Sources/AppwriteModels/Document.swift +++ b/Sources/AppwriteModels/Document.swift @@ -6,6 +6,7 @@ open class Document: Codable { enum CodingKeys: String, CodingKey { case id = "$id" + case sequence = "$sequence" case collectionId = "$collectionId" case databaseId = "$databaseId" case createdAt = "$createdAt" @@ -17,6 +18,9 @@ open class Document: Codable { /// Document ID. public let id: String + /// Document automatically incrementing ID. + public let sequence: Int + /// Collection ID. public let collectionId: String @@ -37,6 +41,7 @@ open class Document: Codable { init( id: String, + sequence: Int, collectionId: String, databaseId: String, createdAt: String, @@ -45,6 +50,7 @@ open class Document: Codable { data: T ) { self.id = id + self.sequence = sequence self.collectionId = collectionId self.databaseId = databaseId self.createdAt = createdAt @@ -57,6 +63,7 @@ open class Document: Codable { let container = try decoder.container(keyedBy: CodingKeys.self) self.id = try container.decode(String.self, forKey: .id) + self.sequence = try container.decode(Int.self, forKey: .sequence) self.collectionId = try container.decode(String.self, forKey: .collectionId) self.databaseId = try container.decode(String.self, forKey: .databaseId) self.createdAt = try container.decode(String.self, forKey: .createdAt) @@ -69,6 +76,7 @@ open class Document: Codable { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(id, forKey: .id) + try container.encode(sequence, forKey: .sequence) try container.encode(collectionId, forKey: .collectionId) try container.encode(databaseId, forKey: .databaseId) try container.encode(createdAt, forKey: .createdAt) @@ -80,6 +88,7 @@ open class Document: Codable { public func toMap() -> [String: Any] { return [ "$id": id as Any, + "$sequence": sequence as Any, "$collectionId": collectionId as Any, "$databaseId": databaseId as Any, "$createdAt": createdAt as Any, @@ -92,6 +101,7 @@ open class Document: Codable { public static func from(map: [String: Any] ) -> Document { return Document( id: map["$id"] as? String ?? "", + sequence: map["$sequence"] as? Int ?? 0, collectionId: map["$collectionId"] as? String ?? "", databaseId: map["$databaseId"] as? String ?? "", createdAt: map["$createdAt"] as? String ?? "", diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 4ee2104..daeaf14 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -2,9 +2,8 @@ import Appwrite let client = Client() .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID .setSession("") // The user session to authenticate with - .setKey("") // Your secret API key - .setJWT("") // Your secret JSON Web Token let databases = Databases(client) diff --git a/docs/examples/databases/create-documents.md b/docs/examples/databases/create-documents.md index 39a58ab..2e992d9 100644 --- a/docs/examples/databases/create-documents.md +++ b/docs/examples/databases/create-documents.md @@ -2,6 +2,7 @@ import Appwrite let client = Client() .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID .setKey("") // Your secret API key let databases = Databases(client) diff --git a/docs/examples/databases/decrement-document-attribute.md b/docs/examples/databases/decrement-document-attribute.md new file mode 100644 index 0000000..88ba9ae --- /dev/null +++ b/docs/examples/databases/decrement-document-attribute.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +let databases = Databases(client) + +let document = try await databases.decrementDocumentAttribute( + databaseId: "", + collectionId: "", + documentId: "", + attribute: "", + value: 0, // optional + min: 0 // optional +) + diff --git a/docs/examples/databases/increment-document-attribute.md b/docs/examples/databases/increment-document-attribute.md new file mode 100644 index 0000000..452b200 --- /dev/null +++ b/docs/examples/databases/increment-document-attribute.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + .setKey("") // Your secret API key + +let databases = Databases(client) + +let document = try await databases.incrementDocumentAttribute( + databaseId: "", + collectionId: "", + documentId: "", + attribute: "", + value: 0, // optional + max: 0 // optional +) + diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md index 353cc5c..544f02f 100644 --- a/docs/examples/databases/upsert-documents.md +++ b/docs/examples/databases/upsert-documents.md @@ -10,6 +10,6 @@ let databases = Databases(client) let documentList = try await databases.upsertDocuments( databaseId: "", collectionId: "", - documents: [] // optional + documents: [] )