Skip to content
Merged
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
18 changes: 18 additions & 0 deletions examples/1.9.x/console-web/examples/console/suggest-queries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```javascript
import { Client, Console, Type } from "@appwrite.io/console";

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

const console = new Console(client);

const result = await console.suggestQueries({
type: Type.Activities,
input: '<INPUT>',
databaseId: '<DATABASE_ID>', // optional
tableId: '<TABLE_ID>' // optional
});

console.log(result);
Comment on lines +8 to +17
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 The local variable console shadows the built-in global console object. After const console = new Console(client), the identifier console refers to the Appwrite service instance, so console.log(result) will throw a TypeError: console.log is not a function at runtime.

Suggested change
const console = new Console(client);
const result = await console.suggestQueries({
type: Type.Activities,
input: '<INPUT>',
databaseId: '<DATABASE_ID>', // optional
tableId: '<TABLE_ID>' // optional
});
console.log(result);
const appwriteConsole = new Console(client);
const result = await appwriteConsole.suggestQueries({
type: Type.Activities,
input: '<INPUT>',
databaseId: '<DATABASE_ID>', // optional
tableId: '<TABLE_ID>' // optional
});
console.log(result);

```
10 changes: 8 additions & 2 deletions specs/1.9.x/open-api3-1.9.x-client.json
Original file line number Diff line number Diff line change
Expand Up @@ -9876,7 +9876,7 @@
"x-appwrite": {
"method": "createFile",
"group": "files",
"weight": 1186,
"weight": 1187,
"cookies": false,
"type": "upload",
"demo": "storage\/create-file.md",
Expand Down Expand Up @@ -12831,7 +12831,7 @@
"x-appwrite": {
"method": "deleteMembership",
"group": "memberships",
"weight": 1187,
"weight": 1188,
"cookies": false,
"type": "",
"demo": "teams\/delete-membership.md",
Expand Down Expand Up @@ -17089,6 +17089,12 @@
"description": "Your secret dev API key",
"in": "header"
},
"Cookie": {
"type": "apiKey",
"name": "Cookie",
"description": "The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes.",
"in": "header"
},
"ImpersonateUserId": {
"type": "apiKey",
"name": "X-Appwrite-Impersonate-User-Id",
Expand Down
Loading