-
Notifications
You must be signed in to change notification settings - Fork 63
feat: Web SDK update for version 21.2.0 #137
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
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 | ||||||
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. operations is required; drop the “optional” comment. Marking the operations array as optional is inaccurate for this endpoint. Apply this diff: - ] // 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,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 | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -12,7 +12,8 @@ const result = await databases.decrementDocumentAttribute({ | |||||||||||||||
documentId: '<DOCUMENT_ID>', | ||||||||||||||||
attribute: '', | ||||||||||||||||
value: null, // optional | ||||||||||||||||
min: null // optional | ||||||||||||||||
min: null, // optional | ||||||||||||||||
transactionId: '<TRANSACTION_ID>' // optional | ||||||||||||||||
Comment on lines
14
to
+16
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. 🛠️ Refactor suggestion Use concrete numbers or omit fields instead of As above, - value: null, // optional
- min: null, // optional
+ value: 1, // optional; omit to use default decrement
+ // min: 0, // optional; omit if not bounding 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||
}); | ||||||||||||||||
|
||||||||||||||||
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 | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -10,7 +10,8 @@ const result = await databases.getDocument({ | |||||||
databaseId: '<DATABASE_ID>', | ||||||||
collectionId: '<COLLECTION_ID>', | ||||||||
documentId: '<DOCUMENT_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 queries from getDocument example.
Apply this diff: - queries: [], // optional
transactionId: '<TRANSACTION_ID>' // 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,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. Fix invalid string quoting in permissions example. Nested double quotes break the string. Use single quotes outside. Apply this diff: - 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
16
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
transactionId: '<TRANSACTION_ID>' // optional Optional (clearer, typed): // permissions: [Permission.read(Role.any())] 🤖 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
22
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
transactionId: '<TRANSACTION_ID>' // optional Optional (typed helpers): // permissions: [Permission.read(Role.any())] 🤖 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 |
---|---|---|
@@ -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 | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -12,7 +12,8 @@ const result = await tablesDB.incrementRowColumn({ | |||||||||||||||||||||||
rowId: '<ROW_ID>', | ||||||||||||||||||||||||
column: '', | ||||||||||||||||||||||||
value: null, // optional | ||||||||||||||||||||||||
max: null // optional | ||||||||||||||||||||||||
max: null, // optional | ||||||||||||||||||||||||
transactionId: '<TRANSACTION_ID>' // optional | ||||||||||||||||||||||||
}); | ||||||||||||||||||||||||
Comment on lines
13
to
17
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. 🛠️ Refactor suggestion Avoid sending APIs commonly reject - column: '',
- value: null, // optional
- max: null, // optional
+ column: '<COLUMN_NAME>',
+ value: 1, // optional; omit to use default increment
+ // max: 100, // optional; omit if not capping
transactionId: '<TRANSACTION_ID>' // 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,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. Nested double quotes break the string. Use single quotes outside. Apply this diff: - 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 | ||||||||||||||||
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 permissions syntax; use Permission/Role helpers.
Apply within the changed lines: - permissions: ["read("any")"], // optional
+ permissions: [Permission.read(Role.any())], // optional Also add the necessary imports at the top of this file (outside the changed range): -import { Client, TablesDB } from "appwrite";
+import { Client, TablesDB, Permission, Role } from "appwrite"; 📝 Committable suggestion
Suggested change
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||
}); | ||||||||||||||||
|
||||||||||||||||
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.
Fix invalid string quoting in permissions example.
Nested double quotes break the string. Use single quotes outside.
Apply this diff:
📝 Committable suggestion
🤖 Prompt for AI Agents