Merge pull request #10202 from appwrite/update-sdks-1.7.x

chore: update sdks 1.7.x
This commit is contained in:
Luke B. Silver 2025-07-27 14:28:18 +01:00 committed by GitHub
commit 5924434e1d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 913 additions and 122 deletions

2
.gitignore vendored
View file

@ -16,5 +16,5 @@ app/sdks
dev/yasd_init.php
.phpunit.result.cache
Makefile
appwrite.json
appwrite.config.json
/.zed/

View file

@ -11,7 +11,7 @@ return [
[
'key' => 'web',
'name' => 'Web',
'version' => '18.1.0',
'version' => '18.2.0',
'url' => 'https://github.com/appwrite/sdk-for-web',
'package' => 'https://www.npmjs.com/package/appwrite',
'enabled' => true,
@ -59,7 +59,7 @@ return [
[
'key' => 'flutter',
'name' => 'Flutter',
'version' => '17.0.2',
'version' => '17.1.0',
'url' => 'https://github.com/appwrite/sdk-for-flutter',
'package' => 'https://pub.dev/packages/appwrite',
'enabled' => true,
@ -77,7 +77,7 @@ return [
[
'key' => 'apple',
'name' => 'Apple',
'version' => '10.1.1',
'version' => '10.2.0',
'url' => 'https://github.com/appwrite/sdk-for-apple',
'package' => 'https://github.com/appwrite/sdk-for-apple',
'enabled' => true,
@ -112,7 +112,7 @@ return [
[
'key' => 'android',
'name' => 'Android',
'version' => '8.1.0',
'version' => '8.2.0',
'url' => 'https://github.com/appwrite/sdk-for-android',
'package' => 'https://search.maven.org/artifact/io.appwrite/sdk-for-android',
'enabled' => true,
@ -134,7 +134,7 @@ return [
[
'key' => 'react-native',
'name' => 'React Native',
'version' => '0.10.1',
'version' => '0.11.0',
'url' => 'https://github.com/appwrite/sdk-for-react-native',
'package' => 'https://npmjs.com/package/react-native-appwrite',
'enabled' => true,
@ -199,7 +199,7 @@ return [
[
'key' => 'web',
'name' => 'Console',
'version' => '1.7.0',
'version' => '1.9.0',
'url' => 'https://github.com/appwrite/sdk-for-console',
'package' => '',
'enabled' => true,
@ -217,7 +217,7 @@ return [
[
'key' => 'cli',
'name' => 'Command Line',
'version' => '8.2.2',
'version' => '8.3.0',
'url' => 'https://github.com/appwrite/sdk-for-cli',
'package' => 'https://www.npmjs.com/package/appwrite-cli',
'enabled' => true,
@ -251,7 +251,7 @@ return [
[
'key' => 'nodejs',
'name' => 'Node.js',
'version' => '17.1.0',
'version' => '17.2.0',
'url' => 'https://github.com/appwrite/sdk-for-node',
'package' => 'https://www.npmjs.com/package/node-appwrite',
'enabled' => true,
@ -269,7 +269,7 @@ return [
[
'key' => 'deno',
'name' => 'Deno',
'version' => '15.0.0',
'version' => '15.1.0',
'url' => 'https://github.com/appwrite/sdk-for-deno',
'package' => 'https://deno.land/x/appwrite',
'enabled' => true,
@ -287,7 +287,7 @@ return [
[
'key' => 'php',
'name' => 'PHP',
'version' => '15.0.0',
'version' => '15.1.0',
'url' => 'https://github.com/appwrite/sdk-for-php',
'package' => 'https://packagist.org/packages/appwrite/appwrite',
'enabled' => true,
@ -305,7 +305,7 @@ return [
[
'key' => 'python',
'name' => 'Python',
'version' => '11.0.0',
'version' => '11.1.0',
'url' => 'https://github.com/appwrite/sdk-for-python',
'package' => 'https://pypi.org/project/appwrite/',
'enabled' => true,
@ -323,7 +323,7 @@ return [
[
'key' => 'ruby',
'name' => 'Ruby',
'version' => '16.0.0',
'version' => '16.1.0',
'url' => 'https://github.com/appwrite/sdk-for-ruby',
'package' => 'https://rubygems.org/gems/appwrite',
'enabled' => true,
@ -341,7 +341,7 @@ return [
[
'key' => 'go',
'name' => 'Go',
'version' => '0.8.0',
'version' => '0.9.0',
'url' => 'https://github.com/appwrite/sdk-for-go',
'package' => 'https://github.com/appwrite/sdk-for-go',
'enabled' => true,
@ -359,7 +359,7 @@ return [
[
'key' => 'dotnet',
'name' => '.NET',
'version' => '0.14.0',
'version' => '0.14.1',
'url' => 'https://github.com/appwrite/sdk-for-dotnet',
'package' => 'https://www.nuget.org/packages/Appwrite',
'enabled' => true,
@ -377,7 +377,7 @@ return [
[
'key' => 'dart',
'name' => 'Dart',
'version' => '16.1.0',
'version' => '16.2.0',
'url' => 'https://github.com/appwrite/sdk-for-dart',
'package' => 'https://pub.dev/packages/dart_appwrite',
'enabled' => true,
@ -395,7 +395,7 @@ return [
[
'key' => 'kotlin',
'name' => 'Kotlin',
'version' => '9.0.0',
'version' => '9.1.0',
'url' => 'https://github.com/appwrite/sdk-for-kotlin',
'package' => 'https://search.maven.org/artifact/io.appwrite/sdk-for-kotlin',
'enabled' => true,
@ -417,7 +417,7 @@ return [
[
'key' => 'swift',
'name' => 'Swift',
'version' => '10.1.0',
'version' => '10.2.0',
'url' => 'https://github.com/appwrite/sdk-for-swift',
'package' => 'https://github.com/appwrite/sdk-for-swift',
'enabled' => true,

View file

@ -827,7 +827,7 @@ return [
],
[
'name' => '_APP_FUNCTIONS_TIMEOUT',
'description' => 'The maximum number of seconds allowed as a timeout value when creating a new function. The default value is 900 seconds. This is the global limit, timeout for individual functions are configured in the function\'s settings or in appwrite.json.',
'description' => 'The maximum number of seconds allowed as a timeout value when creating a new function. The default value is 900 seconds. This is the global limit, timeout for individual functions are configured in the function\'s settings or in appwrite.config.json.',
'introduction' => '0.7.0',
'default' => '900',
'required' => false,
@ -1070,7 +1070,7 @@ return [
'variables' => [
[
'name' => '_APP_SITES_TIMEOUT',
'description' => 'The maximum number of seconds allowed as a timeout value when creating a new site. The default value is 900 seconds. This is the global limit, timeout for individual functions are configured in the sites\'s settings or in appwrite.json.',
'description' => 'The maximum number of seconds allowed as a timeout value when creating a new site. The default value is 900 seconds. This is the global limit, timeout for individual functions are configured in the sites\'s settings or in appwrite.config.json.',
'introduction' => '1.7.0',
'default' => '900',
'required' => false,

12
composer.lock generated
View file

@ -4810,16 +4810,16 @@
"packages-dev": [
{
"name": "appwrite/sdk-generator",
"version": "0.41.19",
"version": "0.41.23",
"source": {
"type": "git",
"url": "https://github.com/appwrite/sdk-generator.git",
"reference": "ae6d44b373ae09f28d8b2dbb781ea3e2491b842d"
"reference": "188dff738ff7b9f1f9209b34ac2092b5456b1001"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/ae6d44b373ae09f28d8b2dbb781ea3e2491b842d",
"reference": "ae6d44b373ae09f28d8b2dbb781ea3e2491b842d",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/188dff738ff7b9f1f9209b34ac2092b5456b1001",
"reference": "188dff738ff7b9f1f9209b34ac2092b5456b1001",
"shasum": ""
},
"require": {
@ -4855,9 +4855,9 @@
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
"support": {
"issues": "https://github.com/appwrite/sdk-generator/issues",
"source": "https://github.com/appwrite/sdk-generator/tree/0.41.19"
"source": "https://github.com/appwrite/sdk-generator/tree/0.41.23"
},
"time": "2025-07-23T06:33:44+00:00"
"time": "2025-07-25T06:47:04+00:00"
},
{
"name": "doctrine/annotations",

View file

@ -1,8 +1,23 @@
# Change Log
## 8.2.0
* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service
* Add `gif` support to `ImageFormat` enum
* Add `sequence` support to `Document` model
## 8.1.0
* Add `devKeys` support to `Client` service
* Add `upsertDocument` support to `Databases` service
## 8.0.0
* Add `token` param to `getFilePreview` and `getFileView` for File tokens usage
* Update default `quality` for `getFilePreview` from 0 to -1
* Remove `Gif` from ImageFormat enum
* Remove `search` param from `listExecutions` method
* Remove `search` param from `listExecutions` method
## 7.0.1
* Fix requests failing by removing `Content-Type` header from `GET` and `HEAD` requests

View file

@ -18,7 +18,7 @@ In order to capture the Appwrite OAuth callback url, the following activity need
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="appwrite-callback-[PROJECT_ID]" />
<data android:scheme="appwrite-callback-<PROJECT_ID>" />
</intent-filter>
</activity>
</application>
@ -34,8 +34,8 @@ import io.appwrite.Client
import io.appwrite.services.Account
val client = Client(context)
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setEndpoint("https://<HOSTNAME_OR_IP>/v1") // Your API Endpoint
.setProject("<PROJECT_ID>") // Your project ID
.setSelfSigned(true) // Remove in production
```
@ -66,8 +66,8 @@ import io.appwrite.services.Account
import io.appwrite.ID
val client = Client(context)
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setEndpoint("https://<HOSTNAME_OR_IP>/v1") // Your API Endpoint
.setProject("<PROJECT_ID>") // Your project ID
.setSelfSigned(true) // Remove in production
val account = Account(client)
@ -79,7 +79,134 @@ val user = account.create(
)
```
### Type Safety with Models
The Appwrite Android 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.
**Kotlin:**
```kotlin
data class Book(
val name: String,
val author: String,
val releaseYear: String? = null,
val category: String? = null,
val genre: List<String>? = null,
val isCheckedOut: Boolean
)
val databases = Databases(client)
try {
val documents = databases.listDocuments(
databaseId = "your-database-id",
collectionId = "your-collection-id",
nestedType = Book::class.java // Pass in your custom model type
)
for (book in documents.documents) {
Log.d("Appwrite", "Book: ${book.name} by ${book.author}") // Now you have full type safety
}
} catch (e: AppwriteException) {
Log.e("Appwrite", e.message ?: "Unknown error")
}
```
**Java:**
```java
public class Book {
private String name;
private String author;
private String releaseYear;
private String category;
private List<String> genre;
private boolean isCheckedOut;
// Constructor
public Book(String name, String author, boolean isCheckedOut) {
this.name = name;
this.author = author;
this.isCheckedOut = isCheckedOut;
}
// Getters and setters
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String getAuthor() { return author; }
public void setAuthor(String author) { this.author = author; }
public String getReleaseYear() { return releaseYear; }
public void setReleaseYear(String releaseYear) { this.releaseYear = releaseYear; }
public String getCategory() { return category; }
public void setCategory(String category) { this.category = category; }
public List<String> getGenre() { return genre; }
public void setGenre(List<String> genre) { this.genre = genre; }
public boolean isCheckedOut() { return isCheckedOut; }
public void setCheckedOut(boolean checkedOut) { isCheckedOut = checkedOut; }
}
Databases databases = new Databases(client);
try {
DocumentList<Book> documents = databases.listDocuments(
"your-database-id",
"your-collection-id",
Book.class // Pass in your custom model type
);
for (Book book : documents.getDocuments()) {
Log.d("Appwrite", "Book: " + book.getName() + " by " + book.getAuthor()); // Now you have full type safety
}
} catch (AppwriteException e) {
Log.e("Appwrite", e.getMessage() != null ? e.getMessage() : "Unknown error");
}
```
**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 Map format, useful for debugging or manual data manipulation:
```kotlin
val account = Account(client)
val user = account.get()
val userMap = user.toMap()
Log.d("Appwrite", userMap.toString()) // Prints all user properties as a Map
```
**`from(map:, nestedType:)`** - Creates a model instance from a Map, useful when working with raw data:
```kotlin
val userData: Map<String, Any> = mapOf(
"\$id" to "123",
"name" to "John",
"email" to "john@example.com"
)
val user = User.from(userData, User::class.java)
```
**JSON Serialization** - Models can be easily converted to/from JSON using Gson (which the SDK uses internally):
```kotlin
import com.google.gson.Gson
val account = Account(client)
val user = account.get()
// Convert to JSON
val gson = Gson()
val jsonString = gson.toJson(user)
Log.d("Appwrite", "User JSON: $jsonString")
// Convert from JSON
val userFromJson = gson.fromJson(jsonString, User::class.java)
```
### Error Handling
The Appwrite Android SDK raises an `AppwriteException` object with `message`, `code` and `response` properties. You can handle any errors by catching `AppwriteException` and present the `message` to the user or handle it yourself based on the provided error information. Below is an example.
```kotlin

View file

@ -1,8 +1,36 @@
# 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
* Remove `Content-Type`, `Content-Length` headers and body from websocket requests
## 10.1.1
* Adds warnings to bulk operation methods
* Fix select Queries by updating internal attributes like id, createdAt, updatedAt etc. to be optional in Document model.
* Fix querying datetime values by properly encoding URLs
## 10.1.0
* Add `devKeys` support to `Client` service
* Add `upsertDocument` support to `Databases` service
## 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
* Remove `Gif` from ImageFormat enum
## 9.0.1
* Fix requests failing by removing `Content-Type` header from `GET` and `HEAD` requests
## 9.0.0
* Remove redundant titles from method descriptions.
* Add `codable` models
* Ensure response attribute in `AppwriteException` is always string

View file

@ -113,6 +113,63 @@ func main() {
}
```
### Type Safety with Models
The Appwrite Apple 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 Apple 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.

View file

@ -1,5 +1,17 @@
# Change Log
## 8.3.0
* **Feat:** Add support for `appwrite.config.json` file
* All new projects will be initialized with this configuration file
* Resolves bundler conflicts (e.g., Vite) that incorrectly interpret `.json` files as library imports
* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service
* Type generation fixes:
* Fix relationships using the relatedCollection's id instead of name
* Update auto generated comment to show relative path instead of absolute path
> **Note:** The existing `appwrite.json` file remains fully supported for backward compatibility
## 8.2.2
* Fix object comparison logic when pushing settings

View file

@ -1,5 +1,11 @@
# Change Log
## 16.2.0
* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service
* Add `encrypt` support to string attribute model
* Add `sequence` support to `Document` model
## 16.1.0
* Add `gif` support to `ImageFormat` enum

View file

@ -1,62 +0,0 @@
# Examples
Init your Appwrite client:
```dart
Client client = Client();
client
.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint
.setProject('5e8cf4f46b5e8') // Your project ID
.setSelfSigned() // Remove in production
;
```
Create a new user:
```dart
Users users = Users(client);
User result = await users.create(
userId: ID.unique(),
email: "email@example.com",
phone: "+123456789",
password: "password",
name: "Walter O'Brien"
);
```
Fetch user profile:
```dart
Users users = Users(client);
User profile = await users.get(
userId: '[USER_ID]',
);
```
Upload File:
```dart
Storage storage = Storage(client);
InputFile file = InputFile(path: './path-to-file/image.jpg', filename: 'image.jpg');
storage.createFile(
bucketId: '[BUCKET_ID]',
fileId: '[FILE_ID]', // use 'unique()' to automatically generate a unique ID
file: file,
permissions: [
Permission.read(Role.any()),
],
)
.then((response) {
print(response); // File uploaded!
})
.catchError((error) {
print(error.response);
});
```
All examples and API features are available at the [official Appwrite docs](https://appwrite.io/docs)

View file

@ -1,5 +1,14 @@
# Change Log
## 15.1.0
* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service
* Add `gif` support to `ImageFormat` enum
* Add `dart38` and `flutter332` support to runtime models
* Add `encrypt` support to `StringAttribute` model
* Add `sequence` support to `Document` model
* Add `upsertDocument` support to `Databases` service
## 15.0.0
* Add `<REGION>` to doc examples due to the new multi region endpoints
@ -10,4 +19,4 @@
* Updates 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
* Removes `search` param from `listExecutions` method
* Removes `search` param from `listExecutions` method

View file

@ -1,6 +1,7 @@
## Getting Started
### Init your SDK
Initialize your SDK with your Appwrite server API endpoint and project ID which can be found in your project settings page and your new API secret Key from project's API keys section.
```typescript
@ -26,6 +27,7 @@ console.log(user);
```
### Full Example
```typescript
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
@ -44,6 +46,7 @@ console.log(user);
```
### Error Handling
The Appwrite Deno SDK raises `AppwriteException` object with `message`, `code` and `response` properties. You can handle any errors by catching `AppwriteException` and present the `message` to the user or handle it yourself based on the provided error information. Below is an example.
```typescript
@ -57,6 +60,7 @@ try {
```
### Learn more
You can use the following resources to learn more and get help
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
- 📜 [Appwrite Docs](https://appwrite.io/docs)

View file

@ -1,5 +1,11 @@
# Change Log
## 0.14.1
* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service
* Add `encrypt` support to `StringAttribute` model
* Add `sequence` support to `Document` model
## 0.14.0
* Refactor from Newtonsoft.Json to System.Text.Json for serialization/deserialization

View file

@ -1,5 +1,11 @@
# Change Log
## 17.1.0
* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service
* Add `gif` support to `ImageFormat` enum
* Add `sequence` support to `Document` model
## 17.0.2
* Add `gif` support to `ImageFormat` enum

View file

@ -1 +1,39 @@
# Change Log
# Change Log
## 0.9.0
* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service
* Add `upsertDocument` support to `Databases` service
* Update doc examples to use correct syntax
## 0.8.0
* Add `<REGION>` 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
## 0.7.0
* Version skipped
## 0.6.0
* Add bulk API methods: `createDocuments`, `deleteDocuments` etc.
## 0.5.0
* Fix requests failing by removing `Content-Type` header from `GET` and `HEAD` requests
## 0.4.0
* Fix pong response and chunked upload
## 0.3.0
* Add new push message parameters

View file

@ -1 +0,0 @@
# Change Log

View file

@ -1 +1,29 @@
# Change Log
# Change Log
## 9.1.0
* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service
* Add `dart38` and `flutter332` support to runtime models
* Add `gif` support to `ImageFormat` enum
* Add `encrypt` support to `StringAttribute` model
* Add `sequence` support to `Document` model
## 9.0.0
* Add `<REGION>` 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
## 8.0.0
* Fix requests failing by removing `Content-Type` header from `GET` and `HEAD` requests
## 7.0.0
* Fix pong response & chunked upload

View file

@ -57,6 +57,132 @@ suspend fun main() {
}
```
### Type Safety with Models
The Appwrite Kotlin 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.
**Kotlin:**
```kotlin
data class Book(
val name: String,
val author: String,
val releaseYear: String? = null,
val category: String? = null,
val genre: List<String>? = null,
val isCheckedOut: Boolean
)
val databases = Databases(client)
try {
val documents = databases.listDocuments(
databaseId = "your-database-id",
collectionId = "your-collection-id",
nestedType = Book::class.java // Pass in your custom model type
)
for (book in documents.documents) {
Log.d("Appwrite", "Book: ${book.name} by ${book.author}") // Now you have full type safety
}
} catch (e: AppwriteException) {
Log.e("Appwrite", e.message ?: "Unknown error")
}
```
**Java:**
```java
public class Book {
private String name;
private String author;
private String releaseYear;
private String category;
private List<String> genre;
private boolean isCheckedOut;
// Constructor
public Book(String name, String author, boolean isCheckedOut) {
this.name = name;
this.author = author;
this.isCheckedOut = isCheckedOut;
}
// Getters and setters
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String getAuthor() { return author; }
public void setAuthor(String author) { this.author = author; }
public String getReleaseYear() { return releaseYear; }
public void setReleaseYear(String releaseYear) { this.releaseYear = releaseYear; }
public String getCategory() { return category; }
public void setCategory(String category) { this.category = category; }
public List<String> getGenre() { return genre; }
public void setGenre(List<String> genre) { this.genre = genre; }
public boolean isCheckedOut() { return isCheckedOut; }
public void setCheckedOut(boolean checkedOut) { isCheckedOut = checkedOut; }
}
Databases databases = new Databases(client);
try {
DocumentList<Book> documents = databases.listDocuments(
"your-database-id",
"your-collection-id",
Book.class // Pass in your custom model type
);
for (Book book : documents.getDocuments()) {
Log.d("Appwrite", "Book: " + book.getName() + " by " + book.getAuthor()); // Now you have full type safety
}
} catch (AppwriteException e) {
Log.e("Appwrite", e.getMessage() != null ? e.getMessage() : "Unknown error");
}
```
**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 Map format, useful for debugging or manual data manipulation:
```kotlin
val account = Account(client)
val user = account.get()
val userMap = user.toMap()
Log.d("Appwrite", userMap.toString()) // Prints all user properties as a Map
```
**`from(map:, nestedType:)`** - Creates a model instance from a Map, useful when working with raw data:
```kotlin
val userData: Map<String, Any> = mapOf(
"\$id" to "123",
"name" to "John",
"email" to "john@example.com"
)
val user = User.from(userData, User::class.java)
```
**JSON Serialization** - Models can be easily converted to/from JSON using Gson (which the SDK uses internally):
```kotlin
import com.google.gson.Gson
val account = Account(client)
val user = account.get()
// Convert to JSON
val gson = Gson()
val jsonString = gson.toJson(user)
Log.d("Appwrite", "User JSON: $jsonString")
// Convert from JSON
val userFromJson = gson.fromJson(jsonString, User::class.java)
```
### Error Handling
The Appwrite Kotlin SDK raises `AppwriteException` object with `message`, `code` and `response` properties. You can handle any errors by catching `AppwriteException` and present the `message` to the user or handle it yourself based on the provided error information. Below is an example.

View file

@ -1,5 +1,10 @@
# Change Log
## 17.2.0
* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service
* Fix autocompletion not working for `Document` model even when generic is passed
## 17.1.0
* Add `upsertDocument` method

View file

@ -1,6 +1,7 @@
## Getting Started
### Init your SDK
Initialize your SDK with your Appwrite server API endpoint and project ID which can be found in your project settings page and your new API secret Key project API keys section.
```js
@ -17,6 +18,7 @@ client
```
### Make Your First Request
Once your SDK object is set, create any of the Appwrite service objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the [API References](https://appwrite.io/docs) section.
```js
@ -54,7 +56,70 @@ promise.then(function (response) {
});
```
### Type Safety with Models
The Appwrite Node SDK provides type safety when working with database documents through generic methods. Methods like `listDocuments`, `getDocument`, and others accept a generic type parameter that allows you to specify your custom model type for full type safety.
**TypeScript:**
```typescript
interface Book {
name: string;
author: string;
releaseYear?: string;
category?: string;
genre?: string[];
isCheckedOut: boolean;
}
const databases = new Databases(client);
try {
const documents = await databases.listDocuments<Book>(
'your-database-id',
'your-collection-id'
);
documents.documents.forEach(book => {
console.log(`Book: ${book.name} by ${book.author}`); // Now you have full type safety
});
} catch (error) {
console.error('Appwrite error:', error);
}
```
**JavaScript (with JSDoc for type hints):**
```javascript
/**
* @typedef {Object} Book
* @property {string} name
* @property {string} author
* @property {string} [releaseYear]
* @property {string} [category]
* @property {string[]} [genre]
* @property {boolean} isCheckedOut
*/
const databases = new Databases(client);
try {
/** @type {Models.DocumentList<Book>} */
const documents = await databases.listDocuments(
'your-database-id',
'your-collection-id'
);
documents.documents.forEach(book => {
console.log(`Book: ${book.name} by ${book.author}`); // Type hints available in IDE
});
} catch (error) {
console.error('Appwrite error:', error);
}
```
**Tip**: You can use the `appwrite types` command to automatically generate TypeScript interfaces based on your Appwrite database schema. Learn more about [type generation](https://appwrite.io/docs/products/databases/type-generation).
### Error Handling
The Appwrite Node SDK raises `AppwriteException` object with `message`, `code` and `response` properties. You can handle any errors by catching `AppwriteException` and present the `message` to the user or handle it yourself based on the provided error information. Below is an example.
```js

View file

@ -1 +1,9 @@
# Change Log
# Change Log
## 15.1.0
* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service
* Add `dart38` and `flutter332` support to runtime models
* Add `gif` support to `ImageFormat` enum
* Add `upsertDocument` support to `Databases` service
* Add `sequence` support to `Document` model

View file

@ -1 +1,28 @@
# Change Log
# Change Log
## 11.1.0
* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service
* Add `dart38` and `flutter332` support to runtime models
* Add `gif` support to `ImageFormat` enum
* Add `upsertDocument` support to `Databases` service
## 11.0.0
* Add `<REGION>` 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
## 10.0.0
* Fix requests failing by removing `Content-Type` header from `GET` and `HEAD` requests
## 9.0.3
* Update sdk to use Numpy-style docstrings

View file

@ -1,5 +1,11 @@
# Change log
## 0.11.0
* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service
* Add `sequence` support to `Document` model
* Fix autocompletion not working for `Document` model even when generic is passed
## 0.10.1
* Fix URL based methods like `getFileViewURL`, `getFilePreviewURL` etc. by adding the missing `projectId` to searchParams
@ -28,4 +34,4 @@
## 0.7.4
* Upgrade dependencies to resolve PlatformConstants error with Expo 53
* Update doc examples to use new multi-region endpoint
* Update doc examples to use new multi-region endpoint

View file

@ -1,12 +1,13 @@
## Getting Started
### Add your Platform
If this is your first time using Appwrite, create an account and create your first project.
Then, under **Add a platform**, add a **Android app** or a **Apple app**. You can skip optional steps.
#### iOS steps
Add your app **name** and **Bundle ID**. You can find your **Bundle Identifier** in the **General** tab for your app's primary target in XCode. For Expo projects you can set or find it on **app.json** file at your project's root directory.
#### Android steps
@ -24,6 +25,7 @@ import 'react-native-url-polyfill/auto'
> `cd ios && pod install && cd ..`
### Init your SDK
Initialize your SDK with your Appwrite server API endpoint and project ID which can be found in your project settings page.
```js
@ -39,6 +41,7 @@ client
```
### Make Your First Request
Once your SDK object is set, access any of the Appwrite services and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the [API References](https://appwrite.io/docs) section.
```js
@ -55,6 +58,7 @@ account.create(ID.unique(), 'me@example.com', 'password', 'Jane Doe')
```
### Full Example
```js
import { Client, Account } from 'react-native-appwrite';
// Init your React Native SDK
@ -77,9 +81,85 @@ account.create(ID.unique(), 'me@example.com', 'password', 'Jane Doe')
});
```
### Type Safety with Models
The Appwrite React Native SDK provides type safety when working with database documents through generic methods. Methods like `listDocuments`, `getDocument`, and others accept a generic type parameter that allows you to specify your custom model type for full type safety.
**TypeScript:**
```typescript
interface Book {
name: string;
author: string;
releaseYear?: string;
category?: string;
genre?: string[];
isCheckedOut: boolean;
}
const databases = new Databases(client);
try {
const documents = await databases.listDocuments<Book>(
'your-database-id',
'your-collection-id'
);
documents.documents.forEach(book => {
console.log(`Book: ${book.name} by ${book.author}`); // Now you have full type safety
});
} catch (error) {
console.error('Appwrite error:', error);
}
```
**JavaScript (with JSDoc for type hints):**
```javascript
/**
* @typedef {Object} Book
* @property {string} name
* @property {string} author
* @property {string} [releaseYear]
* @property {string} [category]
* @property {string[]} [genre]
* @property {boolean} isCheckedOut
*/
const databases = new Databases(client);
try {
/** @type {Models.DocumentList<Book>} */
const documents = await databases.listDocuments(
'your-database-id',
'your-collection-id'
);
documents.documents.forEach(book => {
console.log(`Book: ${book.name} by ${book.author}`); // Type hints available in IDE
});
} catch (error) {
console.error('Appwrite error:', error);
}
```
**Tip**: You can use the `appwrite types` command to automatically generate TypeScript interfaces based on your Appwrite database schema. Learn more about [type generation](https://appwrite.io/docs/products/databases/type-generation).
### Error Handling
The Appwrite React Native SDK raises an `AppwriteException` object with `message`, `code` and `response` properties. You can handle any errors by catching the exception and present the `message` to the user or handle it yourself based on the provided error information. Below is an example.
```javascript
try {
const user = await account.create(ID.unique(), "email@example.com", "password", "Walter O'Brien");
console.log('User created:', user);
} catch (error) {
console.error('Appwrite error:', error.message);
}
```
### Learn more
You can use the following resources to learn more and get help
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/quick-starts/react-native)
- 📜 [Appwrite Docs](https://appwrite.io/docs)
- 💬 [Discord Community](https://appwrite.io/discord)
- 🚂 [Appwrite React Native Playground](https://github.com/appwrite/playground-for-react-native)
- 🚂 [Appwrite React Native Playground](https://github.com/appwrite/playground-for-react-native)

View file

@ -1 +1,30 @@
# Change Log
# Change Log
## 16.1.0
* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service
* Add `dart38` and `flutter332` support to runtime models
* Add `gif` support to `ImageFormat` enum
* Add `encrypt` support to `StringAttribute` model
* Add `sequence` support to `Document` model
* Add `upsertDocument` support to `Databases` service
## 16.0.0
* Add `<REGION>` 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
## 15.0.0
* Fix requests failing by removing `Content-Type` header from `GET` and `HEAD` requests
## 14.0.0
* Fix pong response & chunked upload

View file

@ -1 +1,45 @@
# Change Log
# 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 `<REGION>` 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

View file

@ -66,6 +66,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.

View file

@ -1 +0,0 @@
# Change Log

View file

@ -1,5 +1,12 @@
# Change Log
## 18.2.0
* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service
* Add `gif` support to `ImageFormat` enum
* Fix undefined `fileParam` error in `chunkedUpload` method
* Fix autocompletion not working for `Document` model even when generic is passed
## 18.1.1
* Fix using `devKeys` resulting in an error by conditionally removing credentials

View file

@ -1,11 +1,13 @@
## Getting Started
### Add your Web Platform
For you to init your SDK and interact with Appwrite services you need to add a web platform to your project. To add a new platform, go to your Appwrite console, choose the project you created in the step before and click the 'Add Platform' button.
From the options, choose to add a **Web** platform and add your client app hostname. By adding your hostname to your project platform you are allowing cross-domain communication between your project and the Appwrite API.
### Init your SDK
Initialize your SDK with your Appwrite server API endpoint and project ID which can be found in your project settings page.
```js
@ -19,6 +21,7 @@ client
```
### Make Your First Request
Once your SDK object is set, access any of the Appwrite services and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the [API References](https://appwrite.io/docs) section.
```js
@ -35,6 +38,7 @@ account.create(ID.unique(), "email@example.com", "password", "Walter O'Brien")
```
### Full Example
```js
// Init your Web SDK
const client = new Client();
@ -55,7 +59,83 @@ account.create(ID.unique(), "email@example.com", "password", "Walter O'Brien")
});
```
### Type Safety with Models
The Appwrite Web SDK provides type safety when working with database documents through generic methods. Methods like `listDocuments`, `getDocument`, and others accept a generic type parameter that allows you to specify your custom model type for full type safety.
**TypeScript:**
```typescript
interface Book {
name: string;
author: string;
releaseYear?: string;
category?: string;
genre?: string[];
isCheckedOut: boolean;
}
const databases = new Databases(client);
try {
const documents = await databases.listDocuments<Book>(
'your-database-id',
'your-collection-id'
);
documents.documents.forEach(book => {
console.log(`Book: ${book.name} by ${book.author}`); // Now you have full type safety
});
} catch (error) {
console.error('Appwrite error:', error);
}
```
**JavaScript (with JSDoc for type hints):**
```javascript
/**
* @typedef {Object} Book
* @property {string} name
* @property {string} author
* @property {string} [releaseYear]
* @property {string} [category]
* @property {string[]} [genre]
* @property {boolean} isCheckedOut
*/
const databases = new Databases(client);
try {
/** @type {Models.DocumentList<Book>} */
const documents = await databases.listDocuments(
'your-database-id',
'your-collection-id'
);
documents.documents.forEach(book => {
console.log(`Book: ${book.name} by ${book.author}`); // Type hints available in IDE
});
} catch (error) {
console.error('Appwrite error:', error);
}
```
**Tip**: You can use the `appwrite types` command to automatically generate TypeScript interfaces based on your Appwrite database schema. Learn more about [type generation](https://appwrite.io/docs/products/databases/type-generation).
### Error Handling
The Appwrite Web SDK raises an `AppwriteException` object with `message`, `code` and `response` properties. You can handle any errors by catching the exception and present the `message` to the user or handle it yourself based on the provided error information. Below is an example.
```javascript
try {
const user = await account.create(ID.unique(), "email@example.com", "password", "Walter O'Brien");
console.log('User created:', user);
} catch (error) {
console.error('Appwrite error:', error.message);
}
```
### Learn more
You can use the following resources to learn more and get help
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-web)
- 📜 [Appwrite Docs](https://appwrite.io/docs)

View file

@ -1,15 +0,0 @@
## Getting Started
Initialise the Appwrite SDK in your code, and setup your API credentials:
```js
// Init your Web SDK
var appwrite = new Appwrite();
appwrite
.setEndpoint('http://localhost/v1') // Set only when using self-hosted solution
.setProject('455x34dfkj') // Your Appwrite Project UID
;
```