From ba04ea9e450cad6e83058c9a7996093b160ac56a Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Sun, 18 May 2025 00:02:34 +1200 Subject: [PATCH 1/4] Add support for 1.7 --- README.md | 6 +- Sources/Appwrite/Client.swift | 4 +- Sources/Appwrite/Services/Databases.swift | 70 ++++++++++++++++++- Sources/Appwrite/Services/Functions.swift | 7 +- Sources/Appwrite/Services/Storage.swift | 23 ++++-- Sources/AppwriteEnums/ImageFormat.swift | 1 - Sources/AppwriteModels/Execution.swift | 2 +- .../account/create-anonymous-session.md | 2 +- .../account/create-email-password-session.md | 2 +- docs/examples/account/create-email-token.md | 2 +- docs/examples/account/create-j-w-t.md | 2 +- .../account/create-magic-u-r-l-token.md | 2 +- .../account/create-mfa-authenticator.md | 2 +- docs/examples/account/create-mfa-challenge.md | 2 +- .../account/create-mfa-recovery-codes.md | 2 +- .../examples/account/create-o-auth2session.md | 2 +- docs/examples/account/create-o-auth2token.md | 2 +- docs/examples/account/create-phone-token.md | 2 +- .../account/create-phone-verification.md | 2 +- docs/examples/account/create-push-target.md | 2 +- docs/examples/account/create-recovery.md | 2 +- docs/examples/account/create-session.md | 2 +- docs/examples/account/create-verification.md | 2 +- docs/examples/account/create.md | 2 +- docs/examples/account/delete-identity.md | 2 +- .../account/delete-mfa-authenticator.md | 2 +- docs/examples/account/delete-push-target.md | 2 +- docs/examples/account/delete-session.md | 2 +- docs/examples/account/delete-sessions.md | 2 +- .../account/get-mfa-recovery-codes.md | 2 +- docs/examples/account/get-prefs.md | 2 +- docs/examples/account/get-session.md | 2 +- docs/examples/account/get.md | 2 +- docs/examples/account/list-identities.md | 2 +- docs/examples/account/list-logs.md | 2 +- docs/examples/account/list-mfa-factors.md | 2 +- docs/examples/account/list-sessions.md | 2 +- docs/examples/account/update-email.md | 2 +- docs/examples/account/update-m-f-a.md | 2 +- .../account/update-magic-u-r-l-session.md | 2 +- .../account/update-mfa-authenticator.md | 2 +- docs/examples/account/update-mfa-challenge.md | 2 +- .../account/update-mfa-recovery-codes.md | 2 +- docs/examples/account/update-name.md | 2 +- docs/examples/account/update-password.md | 2 +- docs/examples/account/update-phone-session.md | 2 +- .../account/update-phone-verification.md | 2 +- docs/examples/account/update-phone.md | 2 +- docs/examples/account/update-prefs.md | 2 +- docs/examples/account/update-push-target.md | 2 +- docs/examples/account/update-recovery.md | 2 +- docs/examples/account/update-session.md | 2 +- docs/examples/account/update-status.md | 2 +- docs/examples/account/update-verification.md | 2 +- docs/examples/avatars/get-browser.md | 4 +- docs/examples/avatars/get-credit-card.md | 4 +- docs/examples/avatars/get-favicon.md | 2 +- docs/examples/avatars/get-flag.md | 4 +- docs/examples/avatars/get-image.md | 2 +- docs/examples/avatars/get-initials.md | 2 +- docs/examples/avatars/get-q-r.md | 2 +- docs/examples/databases/create-document.md | 6 +- docs/examples/databases/create-documents.md | 14 ++++ docs/examples/databases/delete-document.md | 2 +- docs/examples/databases/get-document.md | 2 +- docs/examples/databases/list-documents.md | 2 +- docs/examples/databases/update-document.md | 2 +- docs/examples/functions/create-execution.md | 2 +- docs/examples/functions/get-execution.md | 2 +- docs/examples/functions/list-executions.md | 5 +- docs/examples/graphql/mutation.md | 2 +- docs/examples/graphql/query.md | 2 +- docs/examples/locale/get.md | 2 +- docs/examples/locale/list-codes.md | 2 +- docs/examples/locale/list-continents.md | 2 +- docs/examples/locale/list-countries-e-u.md | 2 +- docs/examples/locale/list-countries-phones.md | 2 +- docs/examples/locale/list-countries.md | 2 +- docs/examples/locale/list-currencies.md | 2 +- docs/examples/locale/list-languages.md | 2 +- docs/examples/messaging/create-subscriber.md | 2 +- docs/examples/messaging/delete-subscriber.md | 2 +- docs/examples/storage/create-file.md | 2 +- docs/examples/storage/delete-file.md | 2 +- docs/examples/storage/get-file-download.md | 5 +- docs/examples/storage/get-file-preview.md | 7 +- docs/examples/storage/get-file-view.md | 5 +- docs/examples/storage/get-file.md | 2 +- docs/examples/storage/list-files.md | 2 +- docs/examples/storage/update-file.md | 2 +- docs/examples/teams/create-membership.md | 2 +- docs/examples/teams/create.md | 2 +- docs/examples/teams/delete-membership.md | 2 +- docs/examples/teams/delete.md | 2 +- docs/examples/teams/get-membership.md | 2 +- docs/examples/teams/get-prefs.md | 2 +- docs/examples/teams/get.md | 2 +- docs/examples/teams/list-memberships.md | 2 +- docs/examples/teams/list.md | 2 +- .../teams/update-membership-status.md | 2 +- docs/examples/teams/update-membership.md | 2 +- docs/examples/teams/update-name.md | 2 +- docs/examples/teams/update-prefs.md | 2 +- 103 files changed, 217 insertions(+), 124 deletions(-) create mode 100644 docs/examples/databases/create-documents.md diff --git a/README.md b/README.md index 7368b46..d600b57 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,12 @@ ![Swift Package Manager](https://img.shields.io/github/v/release/appwrite/sdk-for-apple.svg?color=green&style=flat-square) ![License](https://img.shields.io/github/license/appwrite/sdk-for-apple.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.6.2-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.7.0-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.6.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-apple/releases).** +**This SDK is compatible with Appwrite server version 1.7.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-apple/releases).** Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Apple SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) @@ -31,7 +31,7 @@ Add the package to your `Package.swift` dependencies: ```swift dependencies: [ - .package(url: "git@github.com:appwrite/sdk-for-apple.git", from: "9.0.1"), + .package(url: "git@github.com:appwrite/sdk-for-apple.git", from: "9.1.0"), ], ``` diff --git a/Sources/Appwrite/Client.swift b/Sources/Appwrite/Client.swift index daae34d..d3a07ad 100644 --- a/Sources/Appwrite/Client.swift +++ b/Sources/Appwrite/Client.swift @@ -23,8 +23,8 @@ open class Client { "x-sdk-name": "Apple", "x-sdk-platform": "client", "x-sdk-language": "apple", - "x-sdk-version": "9.0.1", - "x-appwrite-response-format": "1.6.0" + "x-sdk-version": "9.1.0", + "x-appwrite-response-format": "1.7.0" ] internal var config: [String: String] = [:] diff --git a/Sources/Appwrite/Services/Databases.swift b/Sources/Appwrite/Services/Databases.swift index 907d8cf..6b8b55f 100644 --- a/Sources/Appwrite/Services/Databases.swift +++ b/Sources/Appwrite/Services/Databases.swift @@ -75,7 +75,6 @@ open class Databases: Service { /// collection resource using either a [server /// integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) /// API or directly from your database console. - /// /// /// @param String databaseId /// @param String collectionId @@ -125,7 +124,6 @@ open class Databases: Service { /// collection resource using either a [server /// integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) /// API or directly from your database console. - /// /// /// @param String databaseId /// @param String collectionId @@ -152,6 +150,74 @@ open class Databases: Service { ) } + /// + /// Create new Documents. Before using this route, you should create a new + /// collection resource using either a [server + /// 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 + /// + open func createDocuments( + databaseId: String, + collectionId: String, + documents: [Any], + nestedType: T.Type + ) async throws -> AppwriteModels.DocumentList { + let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/documents" + .replacingOccurrences(of: "{databaseId}", with: databaseId) + .replacingOccurrences(of: "{collectionId}", with: collectionId) + + let apiParams: [String: Any?] = [ + "documents": documents + ] + + let apiHeaders: [String: String] = [ + "content-type": "application/json" + ] + + let converter: (Any) -> AppwriteModels.DocumentList = { response in + return AppwriteModels.DocumentList.from(map: response as! [String: Any]) + } + + return try await client.call( + method: "POST", + path: apiPath, + headers: apiHeaders, + params: apiParams, + converter: converter + ) + } + + /// + /// Create new Documents. Before using this route, you should create a new + /// collection resource using either a [server + /// 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 + /// + open func createDocuments( + databaseId: String, + collectionId: String, + documents: [Any] + ) async throws -> AppwriteModels.DocumentList<[String: AnyCodable]> { + return try await createDocuments( + databaseId: databaseId, + collectionId: collectionId, + documents: documents, + nestedType: [String: AnyCodable].self + ) + } + /// /// Get a document by its unique ID. This endpoint response returns a JSON /// object with the document data. diff --git a/Sources/Appwrite/Services/Functions.swift b/Sources/Appwrite/Services/Functions.swift index 5c8572e..0dc553c 100644 --- a/Sources/Appwrite/Services/Functions.swift +++ b/Sources/Appwrite/Services/Functions.swift @@ -14,21 +14,18 @@ open class Functions: Service { /// /// @param String functionId /// @param [String] queries - /// @param String search /// @throws Exception /// @return array /// open func listExecutions( functionId: String, - queries: [String]? = nil, - search: String? = nil + queries: [String]? = nil ) async throws -> AppwriteModels.ExecutionList { let apiPath: String = "/functions/{functionId}/executions" .replacingOccurrences(of: "{functionId}", with: functionId) let apiParams: [String: Any?] = [ - "queries": queries, - "search": search + "queries": queries ] let apiHeaders: [String: String] = [:] diff --git a/Sources/Appwrite/Services/Storage.swift b/Sources/Appwrite/Services/Storage.swift index 8cbbc04..3f6f382 100644 --- a/Sources/Appwrite/Services/Storage.swift +++ b/Sources/Appwrite/Services/Storage.swift @@ -224,18 +224,23 @@ open class Storage: Service { /// /// @param String bucketId /// @param String fileId + /// @param String token /// @throws Exception /// @return array /// open func getFileDownload( bucketId: String, - fileId: String + fileId: String, + token: String? = nil ) async throws -> ByteBuffer { let apiPath: String = "/storage/buckets/{bucketId}/files/{fileId}/download" .replacingOccurrences(of: "{bucketId}", with: bucketId) .replacingOccurrences(of: "{fileId}", with: fileId) - let apiParams: [String: Any] = [:] + let apiParams: [String: Any?] = [ + "token": token, + "project": client.config["project"] + ] return try await client.call( method: "GET", @@ -264,6 +269,7 @@ open class Storage: Service { /// @param Int rotation /// @param String background /// @param AppwriteEnums.ImageFormat output + /// @param String token /// @throws Exception /// @return array /// @@ -280,7 +286,8 @@ open class Storage: Service { opacity: Double? = nil, rotation: Int? = nil, background: String? = nil, - output: AppwriteEnums.ImageFormat? = nil + output: AppwriteEnums.ImageFormat? = nil, + token: String? = nil ) async throws -> ByteBuffer { let apiPath: String = "/storage/buckets/{bucketId}/files/{fileId}/preview" .replacingOccurrences(of: "{bucketId}", with: bucketId) @@ -298,6 +305,7 @@ open class Storage: Service { "rotation": rotation, "background": background, "output": output, + "token": token, "project": client.config["project"] ] @@ -315,18 +323,23 @@ open class Storage: Service { /// /// @param String bucketId /// @param String fileId + /// @param String token /// @throws Exception /// @return array /// open func getFileView( bucketId: String, - fileId: String + fileId: String, + token: String? = nil ) async throws -> ByteBuffer { let apiPath: String = "/storage/buckets/{bucketId}/files/{fileId}/view" .replacingOccurrences(of: "{bucketId}", with: bucketId) .replacingOccurrences(of: "{fileId}", with: fileId) - let apiParams: [String: Any] = [:] + let apiParams: [String: Any?] = [ + "token": token, + "project": client.config["project"] + ] return try await client.call( method: "GET", diff --git a/Sources/AppwriteEnums/ImageFormat.swift b/Sources/AppwriteEnums/ImageFormat.swift index c31fb47..70110ff 100644 --- a/Sources/AppwriteEnums/ImageFormat.swift +++ b/Sources/AppwriteEnums/ImageFormat.swift @@ -3,7 +3,6 @@ import Foundation public enum ImageFormat: String, CustomStringConvertible { case jpg = "jpg" case jpeg = "jpeg" - case gif = "gif" case png = "png" case webp = "webp" case heic = "heic" diff --git a/Sources/AppwriteModels/Execution.swift b/Sources/AppwriteModels/Execution.swift index f9a86e7..6e81532 100644 --- a/Sources/AppwriteModels/Execution.swift +++ b/Sources/AppwriteModels/Execution.swift @@ -69,7 +69,7 @@ open class Execution: Codable { /// Function errors. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. public let errors: String - /// Function execution duration in seconds. + /// Resource(function/site) execution duration in seconds. public let duration: Double /// The scheduled time for execution. If left empty, execution will be queued immediately. diff --git a/docs/examples/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md index f676bac..22020a1 100644 --- a/docs/examples/account/create-anonymous-session.md +++ b/docs/examples/account/create-anonymous-session.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create-email-password-session.md b/docs/examples/account/create-email-password-session.md index 1505182..5f541a8 100644 --- a/docs/examples/account/create-email-password-session.md +++ b/docs/examples/account/create-email-password-session.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create-email-token.md b/docs/examples/account/create-email-token.md index b9d39ff..cf82afd 100644 --- a/docs/examples/account/create-email-token.md +++ b/docs/examples/account/create-email-token.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create-j-w-t.md b/docs/examples/account/create-j-w-t.md index c1c0f22..fbcd504 100644 --- a/docs/examples/account/create-j-w-t.md +++ b/docs/examples/account/create-j-w-t.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create-magic-u-r-l-token.md b/docs/examples/account/create-magic-u-r-l-token.md index 83eb681..27bbe41 100644 --- a/docs/examples/account/create-magic-u-r-l-token.md +++ b/docs/examples/account/create-magic-u-r-l-token.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create-mfa-authenticator.md b/docs/examples/account/create-mfa-authenticator.md index 7b103e0..56799e3 100644 --- a/docs/examples/account/create-mfa-authenticator.md +++ b/docs/examples/account/create-mfa-authenticator.md @@ -2,7 +2,7 @@ import Appwrite import AppwriteEnums let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create-mfa-challenge.md b/docs/examples/account/create-mfa-challenge.md index 6d262d9..0b5d385 100644 --- a/docs/examples/account/create-mfa-challenge.md +++ b/docs/examples/account/create-mfa-challenge.md @@ -2,7 +2,7 @@ import Appwrite import AppwriteEnums let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create-mfa-recovery-codes.md b/docs/examples/account/create-mfa-recovery-codes.md index 1390b9d..c0ccb39 100644 --- a/docs/examples/account/create-mfa-recovery-codes.md +++ b/docs/examples/account/create-mfa-recovery-codes.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create-o-auth2session.md b/docs/examples/account/create-o-auth2session.md index 32da4a2..756112e 100644 --- a/docs/examples/account/create-o-auth2session.md +++ b/docs/examples/account/create-o-auth2session.md @@ -2,7 +2,7 @@ import Appwrite import AppwriteEnums let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create-o-auth2token.md b/docs/examples/account/create-o-auth2token.md index 7bbfe98..21b54e8 100644 --- a/docs/examples/account/create-o-auth2token.md +++ b/docs/examples/account/create-o-auth2token.md @@ -2,7 +2,7 @@ import Appwrite import AppwriteEnums let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create-phone-token.md b/docs/examples/account/create-phone-token.md index acb7a69..12b2d4b 100644 --- a/docs/examples/account/create-phone-token.md +++ b/docs/examples/account/create-phone-token.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create-phone-verification.md b/docs/examples/account/create-phone-verification.md index e0c4a21..f0eb94b 100644 --- a/docs/examples/account/create-phone-verification.md +++ b/docs/examples/account/create-phone-verification.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create-push-target.md b/docs/examples/account/create-push-target.md index 75d694b..ce2d194 100644 --- a/docs/examples/account/create-push-target.md +++ b/docs/examples/account/create-push-target.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md index 65536ee..ccfd5ac 100644 --- a/docs/examples/account/create-recovery.md +++ b/docs/examples/account/create-recovery.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create-session.md b/docs/examples/account/create-session.md index 3ea5119..2065692 100644 --- a/docs/examples/account/create-session.md +++ b/docs/examples/account/create-session.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md index 702c3c5..d3ca74c 100644 --- a/docs/examples/account/create-verification.md +++ b/docs/examples/account/create-verification.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md index cad7e44..79b4db6 100644 --- a/docs/examples/account/create.md +++ b/docs/examples/account/create.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md index 37ca520..04a3ee5 100644 --- a/docs/examples/account/delete-identity.md +++ b/docs/examples/account/delete-identity.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/delete-mfa-authenticator.md b/docs/examples/account/delete-mfa-authenticator.md index d9fe0ad..16cbbe3 100644 --- a/docs/examples/account/delete-mfa-authenticator.md +++ b/docs/examples/account/delete-mfa-authenticator.md @@ -2,7 +2,7 @@ import Appwrite import AppwriteEnums let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/delete-push-target.md b/docs/examples/account/delete-push-target.md index 660a9c0..a96a1b1 100644 --- a/docs/examples/account/delete-push-target.md +++ b/docs/examples/account/delete-push-target.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md index 59f89a9..ea353e8 100644 --- a/docs/examples/account/delete-session.md +++ b/docs/examples/account/delete-session.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md index bfce736..51a86bd 100644 --- a/docs/examples/account/delete-sessions.md +++ b/docs/examples/account/delete-sessions.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/get-mfa-recovery-codes.md b/docs/examples/account/get-mfa-recovery-codes.md index 79e3a2c..2f5d623 100644 --- a/docs/examples/account/get-mfa-recovery-codes.md +++ b/docs/examples/account/get-mfa-recovery-codes.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/get-prefs.md b/docs/examples/account/get-prefs.md index 0e7909b..65ce5f5 100644 --- a/docs/examples/account/get-prefs.md +++ b/docs/examples/account/get-prefs.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md index 3ed89fc..bd491ff 100644 --- a/docs/examples/account/get-session.md +++ b/docs/examples/account/get-session.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/get.md b/docs/examples/account/get.md index 2a0c2a5..1b1213e 100644 --- a/docs/examples/account/get.md +++ b/docs/examples/account/get.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md index 4d8c580..1d3a999 100644 --- a/docs/examples/account/list-identities.md +++ b/docs/examples/account/list-identities.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md index ecb5617..2c42307 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/list-mfa-factors.md b/docs/examples/account/list-mfa-factors.md index 3af3427..f6d7a6f 100644 --- a/docs/examples/account/list-mfa-factors.md +++ b/docs/examples/account/list-mfa-factors.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md index 8b9e165..99f6930 100644 --- a/docs/examples/account/list-sessions.md +++ b/docs/examples/account/list-sessions.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md index 4dbd335..0371332 100644 --- a/docs/examples/account/update-email.md +++ b/docs/examples/account/update-email.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-m-f-a.md b/docs/examples/account/update-m-f-a.md index eefcd79..fe2b04f 100644 --- a/docs/examples/account/update-m-f-a.md +++ b/docs/examples/account/update-m-f-a.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-magic-u-r-l-session.md b/docs/examples/account/update-magic-u-r-l-session.md index 8e0a26a..507006b 100644 --- a/docs/examples/account/update-magic-u-r-l-session.md +++ b/docs/examples/account/update-magic-u-r-l-session.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-mfa-authenticator.md b/docs/examples/account/update-mfa-authenticator.md index 8ef2b24..6a42fb9 100644 --- a/docs/examples/account/update-mfa-authenticator.md +++ b/docs/examples/account/update-mfa-authenticator.md @@ -2,7 +2,7 @@ import Appwrite import AppwriteEnums let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-mfa-challenge.md b/docs/examples/account/update-mfa-challenge.md index 1c5874f..db9753b 100644 --- a/docs/examples/account/update-mfa-challenge.md +++ b/docs/examples/account/update-mfa-challenge.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-mfa-recovery-codes.md b/docs/examples/account/update-mfa-recovery-codes.md index fb5ea5a..c3b8d41 100644 --- a/docs/examples/account/update-mfa-recovery-codes.md +++ b/docs/examples/account/update-mfa-recovery-codes.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md index 893d96c..7f8abf5 100644 --- a/docs/examples/account/update-name.md +++ b/docs/examples/account/update-name.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index 60737dc..7fa03ca 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-phone-session.md b/docs/examples/account/update-phone-session.md index 50a88cb..f6776d1 100644 --- a/docs/examples/account/update-phone-session.md +++ b/docs/examples/account/update-phone-session.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md index 045ba8d..0bf2db1 100644 --- a/docs/examples/account/update-phone-verification.md +++ b/docs/examples/account/update-phone-verification.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md index b43b975..604fc85 100644 --- a/docs/examples/account/update-phone.md +++ b/docs/examples/account/update-phone.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md index ea49c34..fea5273 100644 --- a/docs/examples/account/update-prefs.md +++ b/docs/examples/account/update-prefs.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-push-target.md b/docs/examples/account/update-push-target.md index 351801e..549c4d6 100644 --- a/docs/examples/account/update-push-target.md +++ b/docs/examples/account/update-push-target.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md index 1e50a14..536da69 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md index 5fe7116..8999b0a 100644 --- a/docs/examples/account/update-session.md +++ b/docs/examples/account/update-session.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-status.md b/docs/examples/account/update-status.md index a7f99c3..892858d 100644 --- a/docs/examples/account/update-status.md +++ b/docs/examples/account/update-status.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md index c17a787..094e10f 100644 --- a/docs/examples/account/update-verification.md +++ b/docs/examples/account/update-verification.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let account = Account(client) diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md index e18a2b2..ee0cc99 100644 --- a/docs/examples/avatars/get-browser.md +++ b/docs/examples/avatars/get-browser.md @@ -2,7 +2,7 @@ import Appwrite import AppwriteEnums let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let avatars = Avatars(client) @@ -11,6 +11,6 @@ let bytes = try await avatars.getBrowser( code: .avantBrowser, width: 0, // optional height: 0, // optional - quality: 0 // optional + quality: -1 // optional ) diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md index 94a7bf6..779fce3 100644 --- a/docs/examples/avatars/get-credit-card.md +++ b/docs/examples/avatars/get-credit-card.md @@ -2,7 +2,7 @@ import Appwrite import AppwriteEnums let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let avatars = Avatars(client) @@ -11,6 +11,6 @@ let bytes = try await avatars.getCreditCard( code: .americanExpress, width: 0, // optional height: 0, // optional - quality: 0 // optional + quality: -1 // optional ) diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md index 95af5f5..b7dc683 100644 --- a/docs/examples/avatars/get-favicon.md +++ b/docs/examples/avatars/get-favicon.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let avatars = Avatars(client) diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md index b79cf57..ba1d77b 100644 --- a/docs/examples/avatars/get-flag.md +++ b/docs/examples/avatars/get-flag.md @@ -2,7 +2,7 @@ import Appwrite import AppwriteEnums let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let avatars = Avatars(client) @@ -11,6 +11,6 @@ let bytes = try await avatars.getFlag( code: .afghanistan, width: 0, // optional height: 0, // optional - quality: 0 // optional + quality: -1 // optional ) diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md index f01e21b..0fe71e1 100644 --- a/docs/examples/avatars/get-image.md +++ b/docs/examples/avatars/get-image.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let avatars = Avatars(client) diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index 8593288..2bbfbe6 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let avatars = Avatars(client) diff --git a/docs/examples/avatars/get-q-r.md b/docs/examples/avatars/get-q-r.md index 370209a..3cc650c 100644 --- a/docs/examples/avatars/get-q-r.md +++ b/docs/examples/avatars/get-q-r.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let avatars = Avatars(client) diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 1dff362..6c2baee 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -1,8 +1,10 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .setProject("") // Your project ID + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setSession("") // The user session to authenticate with + .setKey("") // + .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 new file mode 100644 index 0000000..b47247a --- /dev/null +++ b/docs/examples/databases/create-documents.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setKey("") // + +let databases = Databases(client) + +let documentList = try await databases.createDocuments( + databaseId: "", + collectionId: "", + documents: [] +) + diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md index 80ca2eb..301203d 100644 --- a/docs/examples/databases/delete-document.md +++ b/docs/examples/databases/delete-document.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let databases = Databases(client) diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md index fa7aeb9..6e4dc55 100644 --- a/docs/examples/databases/get-document.md +++ b/docs/examples/databases/get-document.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let databases = Databases(client) diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index 6b2cbbc..0d624f3 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let databases = Databases(client) diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index 2260272..af224c8 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let databases = Databases(client) diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index 6d585ea..7470e9e 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -2,7 +2,7 @@ import Appwrite import AppwriteEnums let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let functions = Functions(client) diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md index dbf12e1..787f297 100644 --- a/docs/examples/functions/get-execution.md +++ b/docs/examples/functions/get-execution.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let functions = Functions(client) diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index 4eb2694..1636d96 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -1,14 +1,13 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let functions = Functions(client) let executionList = try await functions.listExecutions( functionId: "", - queries: [], // optional - search: "" // optional + queries: [] // optional ) diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md index 8e54971..6cd2e58 100644 --- a/docs/examples/graphql/mutation.md +++ b/docs/examples/graphql/mutation.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let graphql = Graphql(client) diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md index db93660..47e4c24 100644 --- a/docs/examples/graphql/query.md +++ b/docs/examples/graphql/query.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let graphql = Graphql(client) diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md index ec071cd..9c48317 100644 --- a/docs/examples/locale/get.md +++ b/docs/examples/locale/get.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let locale = Locale(client) diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md index adb3539..21d693a 100644 --- a/docs/examples/locale/list-codes.md +++ b/docs/examples/locale/list-codes.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let locale = Locale(client) diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md index 934b264..bd44915 100644 --- a/docs/examples/locale/list-continents.md +++ b/docs/examples/locale/list-continents.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let locale = Locale(client) diff --git a/docs/examples/locale/list-countries-e-u.md b/docs/examples/locale/list-countries-e-u.md index 393e523..2dc24e5 100644 --- a/docs/examples/locale/list-countries-e-u.md +++ b/docs/examples/locale/list-countries-e-u.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let locale = Locale(client) diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md index 840e904..f3ab6b1 100644 --- a/docs/examples/locale/list-countries-phones.md +++ b/docs/examples/locale/list-countries-phones.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let locale = Locale(client) diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md index e6adb9e..dadcd3e 100644 --- a/docs/examples/locale/list-countries.md +++ b/docs/examples/locale/list-countries.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let locale = Locale(client) diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md index b34a971..dc20ead 100644 --- a/docs/examples/locale/list-currencies.md +++ b/docs/examples/locale/list-currencies.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let locale = Locale(client) diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md index db41d39..92c1d7b 100644 --- a/docs/examples/locale/list-languages.md +++ b/docs/examples/locale/list-languages.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let locale = Locale(client) diff --git a/docs/examples/messaging/create-subscriber.md b/docs/examples/messaging/create-subscriber.md index 0e3793b..f85d5e6 100644 --- a/docs/examples/messaging/create-subscriber.md +++ b/docs/examples/messaging/create-subscriber.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let messaging = Messaging(client) diff --git a/docs/examples/messaging/delete-subscriber.md b/docs/examples/messaging/delete-subscriber.md index 3a8b7c4..f1cdda9 100644 --- a/docs/examples/messaging/delete-subscriber.md +++ b/docs/examples/messaging/delete-subscriber.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let messaging = Messaging(client) diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index 2e5b945..2db9b20 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let storage = Storage(client) diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md index caeb173..ca721a4 100644 --- a/docs/examples/storage/delete-file.md +++ b/docs/examples/storage/delete-file.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let storage = Storage(client) diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md index 3d8bf6b..9338958 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -1,13 +1,14 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let storage = Storage(client) let bytes = try await storage.getFileDownload( bucketId: "", - fileId: "" + fileId: "", + token: "" // optional ) diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index 17e42f9..1395d7e 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -2,7 +2,7 @@ import Appwrite import AppwriteEnums let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let storage = Storage(client) @@ -13,13 +13,14 @@ let bytes = try await storage.getFilePreview( width: 0, // optional height: 0, // optional gravity: .center, // optional - quality: 0, // optional + quality: -1, // optional borderWidth: 0, // optional borderColor: "", // optional borderRadius: 0, // optional opacity: 0, // optional rotation: -360, // optional background: "", // optional - output: .jpg // optional + output: .jpg, // optional + token: "" // optional ) diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index e62afb7..bc5ad02 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -1,13 +1,14 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let storage = Storage(client) let bytes = try await storage.getFileView( bucketId: "", - fileId: "" + fileId: "", + token: "" // optional ) diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md index 367fd39..2730b4d 100644 --- a/docs/examples/storage/get-file.md +++ b/docs/examples/storage/get-file.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let storage = Storage(client) diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index 3996ba7..48bd0d0 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let storage = Storage(client) diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md index 37a3001..adef969 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let storage = Storage(client) diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index e911b2a..3c6d093 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let teams = Teams(client) diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md index b355a63..b9f5ea4 100644 --- a/docs/examples/teams/create.md +++ b/docs/examples/teams/create.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let teams = Teams(client) diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md index 8252272..7c21410 100644 --- a/docs/examples/teams/delete-membership.md +++ b/docs/examples/teams/delete-membership.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let teams = Teams(client) diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md index 1caee83..1787b4c 100644 --- a/docs/examples/teams/delete.md +++ b/docs/examples/teams/delete.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let teams = Teams(client) diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md index 62e3a51..837a92d 100644 --- a/docs/examples/teams/get-membership.md +++ b/docs/examples/teams/get-membership.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let teams = Teams(client) diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md index 04ece54..b5b17a3 100644 --- a/docs/examples/teams/get-prefs.md +++ b/docs/examples/teams/get-prefs.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let teams = Teams(client) diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md index c5673bd..af358fb 100644 --- a/docs/examples/teams/get.md +++ b/docs/examples/teams/get.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let teams = Teams(client) diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index e85b11c..5c8669a 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let teams = Teams(client) diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index c5e7175..be81e9c 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let teams = Teams(client) diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md index c50ef0e..1f3cb39 100644 --- a/docs/examples/teams/update-membership-status.md +++ b/docs/examples/teams/update-membership-status.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let teams = Teams(client) diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md index c4500a3..eaa6179 100644 --- a/docs/examples/teams/update-membership.md +++ b/docs/examples/teams/update-membership.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let teams = Teams(client) diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md index 64e2cab..ce5188b 100644 --- a/docs/examples/teams/update-name.md +++ b/docs/examples/teams/update-name.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let teams = Teams(client) diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md index a69d485..e20ec2e 100644 --- a/docs/examples/teams/update-prefs.md +++ b/docs/examples/teams/update-prefs.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint .setProject("") // Your project ID let teams = Teams(client) From 4ac687e45c11a16fa0fb10104bc078d26df0495b Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Sun, 18 May 2025 02:03:33 +1200 Subject: [PATCH 2/4] Add 1.7 support --- Sources/Appwrite/Services/Databases.swift | 68 --------------------- docs/examples/databases/create-documents.md | 14 ----- 2 files changed, 82 deletions(-) delete mode 100644 docs/examples/databases/create-documents.md diff --git a/Sources/Appwrite/Services/Databases.swift b/Sources/Appwrite/Services/Databases.swift index 6b8b55f..d370f73 100644 --- a/Sources/Appwrite/Services/Databases.swift +++ b/Sources/Appwrite/Services/Databases.swift @@ -150,74 +150,6 @@ open class Databases: Service { ) } - /// - /// Create new Documents. Before using this route, you should create a new - /// collection resource using either a [server - /// 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 - /// - open func createDocuments( - databaseId: String, - collectionId: String, - documents: [Any], - nestedType: T.Type - ) async throws -> AppwriteModels.DocumentList { - let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/documents" - .replacingOccurrences(of: "{databaseId}", with: databaseId) - .replacingOccurrences(of: "{collectionId}", with: collectionId) - - let apiParams: [String: Any?] = [ - "documents": documents - ] - - let apiHeaders: [String: String] = [ - "content-type": "application/json" - ] - - let converter: (Any) -> AppwriteModels.DocumentList = { response in - return AppwriteModels.DocumentList.from(map: response as! [String: Any]) - } - - return try await client.call( - method: "POST", - path: apiPath, - headers: apiHeaders, - params: apiParams, - converter: converter - ) - } - - /// - /// Create new Documents. Before using this route, you should create a new - /// collection resource using either a [server - /// 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 - /// - open func createDocuments( - databaseId: String, - collectionId: String, - documents: [Any] - ) async throws -> AppwriteModels.DocumentList<[String: AnyCodable]> { - return try await createDocuments( - databaseId: databaseId, - collectionId: collectionId, - documents: documents, - nestedType: [String: AnyCodable].self - ) - } - /// /// Get a document by its unique ID. This endpoint response returns a JSON /// object with the document data. diff --git a/docs/examples/databases/create-documents.md b/docs/examples/databases/create-documents.md deleted file mode 100644 index b47247a..0000000 --- a/docs/examples/databases/create-documents.md +++ /dev/null @@ -1,14 +0,0 @@ -import Appwrite - -let client = Client() - .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint - .setKey("") // - -let databases = Databases(client) - -let documentList = try await databases.createDocuments( - databaseId: "", - collectionId: "", - documents: [] -) - From fe6a91833a99afe0440e6f22e0b89eb7fc894ec2 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 18 May 2025 07:48:34 +0000 Subject: [PATCH 3/4] chore: bump to next major versions --- README.md | 2 +- Sources/Appwrite/Client.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d600b57..93433a6 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Add the package to your `Package.swift` dependencies: ```swift dependencies: [ - .package(url: "git@github.com:appwrite/sdk-for-apple.git", from: "9.1.0"), + .package(url: "git@github.com:appwrite/sdk-for-apple.git", from: "10.0.0"), ], ``` diff --git a/Sources/Appwrite/Client.swift b/Sources/Appwrite/Client.swift index d3a07ad..8e8ad56 100644 --- a/Sources/Appwrite/Client.swift +++ b/Sources/Appwrite/Client.swift @@ -23,7 +23,7 @@ open class Client { "x-sdk-name": "Apple", "x-sdk-platform": "client", "x-sdk-language": "apple", - "x-sdk-version": "9.1.0", + "x-sdk-version": "10.0.0", "x-appwrite-response-format": "1.7.0" ] From 86bb4c30d095da717357c99b46a944906c6a8be3 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 18 May 2025 08:06:35 +0000 Subject: [PATCH 4/4] chore: add changelog --- CHANGELOG.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa4d35e..1048e7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,8 @@ -# Change Log \ No newline at end of file +# Change Log + +## 10.0.0 + +* Add `<REGION>` to doc examples due to the new multi region endpoints +* Add `token` param to `getFilePreview` and `getFileView` for File tokens usage +* Remove `search` param from `listExecutions` method +* Remove `Gif` from ImageFormat enum \ No newline at end of file