- 
                Notifications
    You must be signed in to change notification settings 
- Fork 63
feat: Web SDK update for version 21.2.0 #143
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 all commits
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,24 @@ | ||
| import { Client, Databases } from "appwrite"; | ||
|  | ||
| const client = new Client() | ||
| .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint | ||
| .setProject('<YOUR_PROJECT_ID>'); // Your project ID | ||
|  | ||
| const databases = new Databases(client); | ||
|  | ||
| const result = await databases.createOperations({ | ||
| transactionId: '<TRANSACTION_ID>', | ||
| operations: [ | ||
| { | ||
| "action": "create", | ||
| "databaseId": "<DATABASE_ID>", | ||
| "collectionId": "<COLLECTION_ID>", | ||
| "documentId": "<DOCUMENT_ID>", | ||
| "data": { | ||
| "name": "Walter O'Brien" | ||
| } | ||
| } | ||
| ] // optional | ||
| }); | ||
|  | ||
| console.log(result); | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { Client, Databases } from "appwrite"; | ||
|  | ||
| const client = new Client() | ||
| .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint | ||
| .setProject('<YOUR_PROJECT_ID>'); // Your project ID | ||
|  | ||
| const databases = new Databases(client); | ||
|  | ||
| const result = await databases.createTransaction({ | ||
| ttl: 60 // optional | ||
| }); | ||
|  | ||
| console.log(result); | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { Client, Databases } from "appwrite"; | ||
|  | ||
| const client = new Client() | ||
| .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint | ||
| .setProject('<YOUR_PROJECT_ID>'); // Your project ID | ||
|  | ||
| const databases = new Databases(client); | ||
|  | ||
| const result = await databases.deleteTransaction({ | ||
| transactionId: '<TRANSACTION_ID>' | ||
| }); | ||
|  | ||
| console.log(result); | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { Client, Databases } from "appwrite"; | ||
|  | ||
| const client = new Client() | ||
| .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint | ||
| .setProject('<YOUR_PROJECT_ID>'); // Your project ID | ||
|  | ||
| const databases = new Databases(client); | ||
|  | ||
| const result = await databases.getTransaction({ | ||
| transactionId: '<TRANSACTION_ID>' | ||
| }); | ||
|  | ||
| console.log(result); | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { Client, Databases } from "appwrite"; | ||
|  | ||
| const client = new Client() | ||
| .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint | ||
| .setProject('<YOUR_PROJECT_ID>'); // Your project ID | ||
|  | ||
| const databases = new Databases(client); | ||
|  | ||
| const result = await databases.listTransactions({ | ||
| queries: [] // optional | ||
| }); | ||
|  | ||
| console.log(result); | 
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|  | @@ -11,7 +11,8 @@ const result = await databases.updateDocument({ | |||||||||
| collectionId: '<COLLECTION_ID>', | ||||||||||
| documentId: '<DOCUMENT_ID>', | ||||||||||
| data: {}, // optional | ||||||||||
| permissions: ["read("any")"] // optional | ||||||||||
| permissions: ["read("any")"], // optional | ||||||||||
| transactionId: '<TRANSACTION_ID>' // optional | ||||||||||
| 
      Comment on lines
    
      +14
     to 
      +15
    
   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. Use valid quoting for the permissions entry. The example currently reads  -    permissions: ["read("any")"], // optional
+    permissions: ['read("any")'], // optional📝 Committable suggestion
 
        Suggested change
       
 🤖 Prompt for AI Agents | ||||||||||
| }); | ||||||||||
|  | ||||||||||
| console.log(result); | ||||||||||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { Client, Databases } from "appwrite"; | ||
|  | ||
| const client = new Client() | ||
| .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint | ||
| .setProject('<YOUR_PROJECT_ID>'); // Your project ID | ||
|  | ||
| const databases = new Databases(client); | ||
|  | ||
| const result = await databases.updateTransaction({ | ||
| transactionId: '<TRANSACTION_ID>', | ||
| commit: false, // optional | ||
| rollback: false // optional | ||
| }); | ||
|  | ||
| console.log(result); | 
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|  | @@ -11,7 +11,8 @@ const result = await databases.upsertDocument({ | |||||||||
| collectionId: '<COLLECTION_ID>', | ||||||||||
| documentId: '<DOCUMENT_ID>', | ||||||||||
| data: {}, | ||||||||||
| permissions: ["read("any")"] // optional | ||||||||||
| permissions: ["read("any")"], // optional | ||||||||||
| transactionId: '<TRANSACTION_ID>' // optional | ||||||||||
| 
      Comment on lines
    
      +14
     to 
      +15
    
   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. Repair the permissions string literal. 
 -    permissions: ["read("any")"], // optional
+    permissions: ['read("any")'], // optional📝 Committable suggestion
 
        Suggested change
       
 🤖 Prompt for AI Agents | ||||||||||
| }); | ||||||||||
|  | ||||||||||
| console.log(result); | ||||||||||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { Client, TablesDB } from "appwrite"; | ||
|  | ||
| const client = new Client() | ||
| .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint | ||
| .setProject('<YOUR_PROJECT_ID>'); // Your project ID | ||
|  | ||
| const tablesDB = new TablesDB(client); | ||
|  | ||
| const result = await tablesDB.createOperations({ | ||
| transactionId: '<TRANSACTION_ID>', | ||
| operations: [ | ||
| { | ||
| "action": "create", | ||
| "databaseId": "<DATABASE_ID>", | ||
| "tableId": "<TABLE_ID>", | ||
| "rowId": "<ROW_ID>", | ||
| "data": { | ||
| "name": "Walter O'Brien" | ||
| } | ||
| } | ||
| ] // optional | ||
| }); | ||
|  | ||
| console.log(result); | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -17,7 +17,8 @@ const result = await tablesDB.createRow({ | |
| "age": 30, | ||
| "isAdmin": false | ||
| }, | ||
| permissions: ["read("any")"] // optional | ||
| permissions: ["read("any")"], // optional | ||
| transactionId: '<TRANSACTION_ID>' // optional | ||
| 
      Comment on lines
    
      +20
     to 
      +21
    
   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. Fix the permissions string literal. 
 🤖 Prompt for AI Agents | ||
| }); | ||
|  | ||
| console.log(result); | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { Client, TablesDB } from "appwrite"; | ||
|  | ||
| const client = new Client() | ||
| .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint | ||
| .setProject('<YOUR_PROJECT_ID>'); // Your project ID | ||
|  | ||
| const tablesDB = new TablesDB(client); | ||
|  | ||
| const result = await tablesDB.createTransaction({ | ||
| ttl: 60 // optional | ||
| }); | ||
|  | ||
| console.log(result); | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { Client, TablesDB } from "appwrite"; | ||
|  | ||
| const client = new Client() | ||
| .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint | ||
| .setProject('<YOUR_PROJECT_ID>'); // Your project ID | ||
|  | ||
| const tablesDB = new TablesDB(client); | ||
|  | ||
| const result = await tablesDB.deleteTransaction({ | ||
| transactionId: '<TRANSACTION_ID>' | ||
| }); | ||
|  | ||
| console.log(result); | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -10,7 +10,8 @@ const result = await tablesDB.getRow({ | |
| databaseId: '<DATABASE_ID>', | ||
| tableId: '<TABLE_ID>', | ||
| rowId: '<ROW_ID>', | ||
| queries: [] // optional | ||
| queries: [], // optional | ||
| transactionId: '<TRANSACTION_ID>' // optional | ||
| 
      Comment on lines
    
      +13
     to 
      +14
    
   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. Remove unsupported  
 🤖 Prompt for AI Agents | ||
| }); | ||
|  | ||
| console.log(result); | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { Client, TablesDB } from "appwrite"; | ||
|  | ||
| const client = new Client() | ||
| .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint | ||
| .setProject('<YOUR_PROJECT_ID>'); // Your project ID | ||
|  | ||
| const tablesDB = new TablesDB(client); | ||
|  | ||
| const result = await tablesDB.getTransaction({ | ||
| transactionId: '<TRANSACTION_ID>' | ||
| }); | ||
|  | ||
| console.log(result); | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { Client, TablesDB } from "appwrite"; | ||
|  | ||
| const client = new Client() | ||
| .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint | ||
| .setProject('<YOUR_PROJECT_ID>'); // Your project ID | ||
|  | ||
| const tablesDB = new TablesDB(client); | ||
|  | ||
| const result = await tablesDB.listTransactions({ | ||
| queries: [] // optional | ||
| }); | ||
|  | ||
| console.log(result); | 
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|  | @@ -11,7 +11,8 @@ const result = await tablesDB.updateRow({ | |||||||||
| tableId: '<TABLE_ID>', | ||||||||||
| rowId: '<ROW_ID>', | ||||||||||
| data: {}, // optional | ||||||||||
| permissions: ["read("any")"] // optional | ||||||||||
| permissions: ["read("any")"], // optional | ||||||||||
| transactionId: '<TRANSACTION_ID>' // optional | ||||||||||
| 
      Comment on lines
    
      +14
     to 
      +15
    
   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. Fix invalid string quoting in permissions example. 
 -    permissions: ["read("any")"], // optional
+    permissions: ['read("any")'], // optional📝 Committable suggestion
 
        Suggested change
       
 🤖 Prompt for AI Agents | ||||||||||
| }); | ||||||||||
|  | ||||||||||
| console.log(result); | ||||||||||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { Client, TablesDB } from "appwrite"; | ||
|  | ||
| const client = new Client() | ||
| .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint | ||
| .setProject('<YOUR_PROJECT_ID>'); // Your project ID | ||
|  | ||
| const tablesDB = new TablesDB(client); | ||
|  | ||
| const result = await tablesDB.updateTransaction({ | ||
| transactionId: '<TRANSACTION_ID>', | ||
| commit: false, // optional | ||
| rollback: false // optional | ||
| }); | ||
|  | ||
| console.log(result); | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -11,7 +11,8 @@ const result = await tablesDB.upsertRow({ | |
| tableId: '<TABLE_ID>', | ||
| rowId: '<ROW_ID>', | ||
| data: {}, // optional | ||
| permissions: ["read("any")"] // optional | ||
| permissions: ["read("any")"], // 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. Fix malformed string literal in  
 🤖 Prompt for AI Agents | ||
| transactionId: '<TRANSACTION_ID>' // optional | ||
| }); | ||
|  | ||
| console.log(result); | ||
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.
Correct the permissions string literal.
["read("any")"]breaks due to unescaped quotes. Update the example so it’s valid JavaScript.📝 Committable suggestion
🤖 Prompt for AI Agents