Skip to content
Merged

Dev #74

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
# Change Log
# 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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -31,7 +31,7 @@ Add the package to your `Package.swift` dependencies:

```swift
dependencies: [
.package(url: "[email protected]:appwrite/sdk-for-apple.git", from: "9.0.1"),
.package(url: "[email protected]:appwrite/sdk-for-apple.git", from: "10.0.0"),
],
```

Expand Down
4 changes: 2 additions & 2 deletions Sources/Appwrite/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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": "10.0.0",
"x-appwrite-response-format": "1.7.0"
]

internal var config: [String: String] = [:]
Expand Down
2 changes: 0 additions & 2 deletions Sources/Appwrite/Services/Databases.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 2 additions & 5 deletions Sources/Appwrite/Services/Functions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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] = [:]
Expand Down
23 changes: 18 additions & 5 deletions Sources/Appwrite/Services/Storage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
///
Expand All @@ -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)
Expand All @@ -298,6 +305,7 @@ open class Storage: Service {
"rotation": rotation,
"background": background,
"output": output,
"token": token,
"project": client.config["project"]
]

Expand All @@ -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",
Expand Down
1 change: 0 additions & 1 deletion Sources/AppwriteEnums/ImageFormat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Sources/AppwriteModels/Execution.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/create-anonymous-session.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Appwrite

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/create-email-password-session.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Appwrite

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/create-email-token.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Appwrite

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/create-j-w-t.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Appwrite

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/create-magic-u-r-l-token.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Appwrite

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/create-mfa-authenticator.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Appwrite
import AppwriteEnums

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/create-mfa-challenge.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Appwrite
import AppwriteEnums

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/create-mfa-recovery-codes.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Appwrite

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/create-o-auth2session.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Appwrite
import AppwriteEnums

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/create-o-auth2token.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Appwrite
import AppwriteEnums

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/create-phone-token.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Appwrite

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/create-phone-verification.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Appwrite

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/create-push-target.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Appwrite

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/create-recovery.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Appwrite

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/create-session.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Appwrite

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/create-verification.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Appwrite

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/create.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Appwrite

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/delete-identity.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Appwrite

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/delete-mfa-authenticator.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Appwrite
import AppwriteEnums

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/delete-push-target.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Appwrite

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/delete-session.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Appwrite

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/delete-sessions.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Appwrite

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/get-mfa-recovery-codes.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Appwrite

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/get-prefs.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Appwrite

let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID

let account = Account(client)
Expand Down
Loading