-
Notifications
You must be signed in to change notification settings - Fork 30
feat: Android SDK update for version 14.0.0 #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
0ad33c7
40eeb4e
b199e60
42f44f1
df364dc
e7e784c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| ```java | ||
| import io.appwrite.Client; | ||
| import io.appwrite.coroutines.CoroutineCallback; | ||
| import io.appwrite.services.Databases; | ||
|
|
||
| Client client = new Client(context) | ||
| .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint | ||
| .setProject("<YOUR_PROJECT_ID>"); // Your project ID | ||
|
|
||
| Databases databases = new Databases(client); | ||
|
|
||
| databases.upsertDocuments( | ||
| "<DATABASE_ID>", // databaseId | ||
| "<COLLECTION_ID>", // collectionId | ||
| List.of(), // documents | ||
| "<TRANSACTION_ID>", // transactionId (optional) | ||
| new CoroutineCallback<>((result, error) -> { | ||
| if (error != null) { | ||
| error.printStackTrace(); | ||
| return; | ||
| } | ||
|
|
||
| Log.d("Appwrite", result.toString()); | ||
| }) | ||
| ); | ||
|
|
||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| ```java | ||
| import io.appwrite.Client; | ||
| import io.appwrite.coroutines.CoroutineCallback; | ||
| import io.appwrite.Permission; | ||
| import io.appwrite.Role; | ||
| import io.appwrite.services.DocumentsDB; | ||
|
|
||
| Client client = new Client(context) | ||
| .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint | ||
| .setProject("<YOUR_PROJECT_ID>"); // Your project ID | ||
|
|
||
| DocumentsDB documentsDB = new DocumentsDB(client); | ||
|
|
||
| documentsDB.createDocument( | ||
| "<DATABASE_ID>", // databaseId | ||
| "<COLLECTION_ID>", // collectionId | ||
| "<DOCUMENT_ID>", // documentId | ||
| Map.of( | ||
| "username", "walter.obrien", | ||
| "email", "walter.obrien@example.com", | ||
| "fullName", "Walter O'Brien", | ||
| "age", 30, | ||
| "isAdmin", false | ||
| ), // data | ||
| List.of(Permission.read(Role.any())), // permissions (optional) | ||
| new CoroutineCallback<>((result, error) -> { | ||
| if (error != null) { | ||
| error.printStackTrace(); | ||
| return; | ||
| } | ||
|
|
||
| Log.d("Appwrite", result.toString()); | ||
| }) | ||
| ); | ||
|
|
||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| ```java | ||
| import io.appwrite.Client; | ||
| import io.appwrite.coroutines.CoroutineCallback; | ||
| import io.appwrite.services.DocumentsDB; | ||
|
|
||
| Client client = new Client(context) | ||
| .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint | ||
| .setProject("<YOUR_PROJECT_ID>"); // Your project ID | ||
|
|
||
| DocumentsDB documentsDB = new DocumentsDB(client); | ||
|
|
||
| documentsDB.createDocuments( | ||
| "<DATABASE_ID>", // databaseId | ||
| "<COLLECTION_ID>", // collectionId | ||
| List.of(), // documents | ||
| new CoroutineCallback<>((result, error) -> { | ||
| if (error != null) { | ||
| error.printStackTrace(); | ||
| return; | ||
| } | ||
|
|
||
| Log.d("Appwrite", result.toString()); | ||
| }) | ||
| ); | ||
|
|
||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| ```java | ||
| import io.appwrite.Client; | ||
| import io.appwrite.coroutines.CoroutineCallback; | ||
| import io.appwrite.services.DocumentsDB; | ||
|
|
||
| Client client = new Client(context) | ||
| .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint | ||
| .setProject("<YOUR_PROJECT_ID>"); // Your project ID | ||
|
|
||
| DocumentsDB documentsDB = new DocumentsDB(client); | ||
|
|
||
| documentsDB.createOperations( | ||
| "<TRANSACTION_ID>", // transactionId | ||
| List.of(Map.of( | ||
| "action", "create", | ||
| "databaseId", "<DATABASE_ID>", | ||
| "collectionId", "<COLLECTION_ID>", | ||
| "documentId", "<DOCUMENT_ID>", | ||
| "data", Map.of( | ||
| "name", "Walter O'Brien" | ||
| ) | ||
| )), // operations (optional) | ||
| new CoroutineCallback<>((result, error) -> { | ||
| if (error != null) { | ||
| error.printStackTrace(); | ||
| return; | ||
| } | ||
|
|
||
| Log.d("Appwrite", result.toString()); | ||
| }) | ||
| ); | ||
|
|
||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| ```java | ||
| import io.appwrite.Client; | ||
| import io.appwrite.coroutines.CoroutineCallback; | ||
| import io.appwrite.services.DocumentsDB; | ||
|
|
||
| Client client = new Client(context) | ||
| .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint | ||
| .setProject("<YOUR_PROJECT_ID>"); // Your project ID | ||
|
|
||
| DocumentsDB documentsDB = new DocumentsDB(client); | ||
|
|
||
| documentsDB.createTransaction( | ||
| 60, // ttl (optional) | ||
| new CoroutineCallback<>((result, error) -> { | ||
| if (error != null) { | ||
| error.printStackTrace(); | ||
| return; | ||
| } | ||
|
|
||
| Log.d("Appwrite", result.toString()); | ||
| }) | ||
| ); | ||
|
|
||
| ``` | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,30 @@ | ||||||||||
| ```java | ||||||||||
| import io.appwrite.Client; | ||||||||||
| import io.appwrite.coroutines.CoroutineCallback; | ||||||||||
| import io.appwrite.services.DocumentsDB; | ||||||||||
|
|
||||||||||
| Client client = new Client(context) | ||||||||||
| .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint | ||||||||||
| .setProject("<YOUR_PROJECT_ID>"); // Your project ID | ||||||||||
|
|
||||||||||
| DocumentsDB documentsDB = new DocumentsDB(client); | ||||||||||
|
|
||||||||||
| documentsDB.decrementDocumentAttribute( | ||||||||||
| "<DATABASE_ID>", // databaseId | ||||||||||
| "<COLLECTION_ID>", // collectionId | ||||||||||
| "<DOCUMENT_ID>", // documentId | ||||||||||
| "", // attribute | ||||||||||
| 0, // value (optional) | ||||||||||
| 0, // min (optional) | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The The identical issue exists in
Suggested change
|
||||||||||
| "<TRANSACTION_ID>", // transactionId (optional) | ||||||||||
| new CoroutineCallback<>((result, error) -> { | ||||||||||
| if (error != null) { | ||||||||||
| error.printStackTrace(); | ||||||||||
| return; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| Log.d("Appwrite", result.toString()); | ||||||||||
| }) | ||||||||||
| ); | ||||||||||
|
|
||||||||||
| ``` | ||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| ```java | ||
| import io.appwrite.Client; | ||
| import io.appwrite.coroutines.CoroutineCallback; | ||
| import io.appwrite.services.DocumentsDB; | ||
|
|
||
| Client client = new Client(context) | ||
| .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint | ||
| .setProject("<YOUR_PROJECT_ID>"); // Your project ID | ||
|
|
||
| DocumentsDB documentsDB = new DocumentsDB(client); | ||
|
|
||
| documentsDB.deleteDocument( | ||
| "<DATABASE_ID>", // databaseId | ||
| "<COLLECTION_ID>", // collectionId | ||
| "<DOCUMENT_ID>", // documentId | ||
| "<TRANSACTION_ID>", // transactionId (optional) | ||
| new CoroutineCallback<>((result, error) -> { | ||
| if (error != null) { | ||
| error.printStackTrace(); | ||
| return; | ||
| } | ||
|
|
||
| Log.d("Appwrite", result.toString()); | ||
| }) | ||
| ); | ||
|
|
||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| ```java | ||
| import io.appwrite.Client; | ||
| import io.appwrite.coroutines.CoroutineCallback; | ||
| import io.appwrite.services.DocumentsDB; | ||
|
|
||
| Client client = new Client(context) | ||
| .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint | ||
| .setProject("<YOUR_PROJECT_ID>"); // Your project ID | ||
|
|
||
| DocumentsDB documentsDB = new DocumentsDB(client); | ||
|
|
||
| documentsDB.deleteTransaction( | ||
| "<TRANSACTION_ID>", // transactionId | ||
| new CoroutineCallback<>((result, error) -> { | ||
| if (error != null) { | ||
| error.printStackTrace(); | ||
| return; | ||
| } | ||
|
|
||
| Log.d("Appwrite", result.toString()); | ||
| }) | ||
| ); | ||
|
|
||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| ```java | ||
| import io.appwrite.Client; | ||
| import io.appwrite.coroutines.CoroutineCallback; | ||
| import io.appwrite.services.DocumentsDB; | ||
|
|
||
| Client client = new Client(context) | ||
| .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint | ||
| .setProject("<YOUR_PROJECT_ID>"); // Your project ID | ||
|
|
||
| DocumentsDB documentsDB = new DocumentsDB(client); | ||
|
|
||
| documentsDB.getDocument( | ||
| "<DATABASE_ID>", // databaseId | ||
| "<COLLECTION_ID>", // collectionId | ||
| "<DOCUMENT_ID>", // documentId | ||
| List.of(), // queries (optional) | ||
| "<TRANSACTION_ID>", // transactionId (optional) | ||
| new CoroutineCallback<>((result, error) -> { | ||
| if (error != null) { | ||
| error.printStackTrace(); | ||
| return; | ||
| } | ||
|
|
||
| Log.d("Appwrite", result.toString()); | ||
| }) | ||
| ); | ||
|
|
||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| ```java | ||
| import io.appwrite.Client; | ||
| import io.appwrite.coroutines.CoroutineCallback; | ||
| import io.appwrite.services.DocumentsDB; | ||
|
|
||
| Client client = new Client(context) | ||
| .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint | ||
| .setProject("<YOUR_PROJECT_ID>"); // Your project ID | ||
|
|
||
| DocumentsDB documentsDB = new DocumentsDB(client); | ||
|
|
||
| documentsDB.getTransaction( | ||
| "<TRANSACTION_ID>", // transactionId | ||
| new CoroutineCallback<>((result, error) -> { | ||
| if (error != null) { | ||
| error.printStackTrace(); | ||
| return; | ||
| } | ||
|
|
||
| Log.d("Appwrite", result.toString()); | ||
| }) | ||
| ); | ||
|
|
||
| ``` | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing import for The example uses 📦 Proposed fix to add the missing import ```java
import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.DocumentsDB;
+import android.util.Log;
Client client = new Client(context)🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| ```java | ||
| import io.appwrite.Client; | ||
| import io.appwrite.coroutines.CoroutineCallback; | ||
| import io.appwrite.services.DocumentsDB; | ||
|
|
||
| Client client = new Client(context) | ||
| .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint | ||
| .setProject("<YOUR_PROJECT_ID>"); // Your project ID | ||
|
|
||
| DocumentsDB documentsDB = new DocumentsDB(client); | ||
|
|
||
| documentsDB.incrementDocumentAttribute( | ||
| "<DATABASE_ID>", // databaseId | ||
| "<COLLECTION_ID>", // collectionId | ||
| "<DOCUMENT_ID>", // documentId | ||
| "", // attribute | ||
| 0, // value (optional) | ||
| 0, // max (optional) | ||
| "<TRANSACTION_ID>", // transactionId (optional) | ||
| new CoroutineCallback<>((result, error) -> { | ||
| if (error != null) { | ||
| error.printStackTrace(); | ||
| return; | ||
| } | ||
|
|
||
| Log.d("Appwrite", result.toString()); | ||
| }) | ||
| ); | ||
|
|
||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
intliteral passed forLong?parameter — Java compile errorThe
ttlparameter increateTransactionhas typeLong?in Kotlin, which compiles tojava.lang.Longon the JVM. In Java, the literal60has typeint. Java does not allow combining widening conversion (int→long) with boxing (long→Long) in a single method-invocation step, so this example will not compile.The same problem exists in
docs/examples/java/vectorsdb/create-transaction.md(line 13) and indocs/examples/java/documentsdb/list-documents.mdanddocs/examples/java/vectorsdb/list-documents.mdwherettl = 0is passed.