From 8d1f7f8405dea10d7797225a7f1a3da59edf0b04 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 3 Nov 2025 16:29:43 +1300 Subject: [PATCH 1/2] Add operators --- CHANGELOG.md | 5 + docs/examples/account/list-identities.md | 3 +- docs/examples/account/list-logs.md | 3 +- docs/examples/databases/create-collection.md | 2 +- docs/examples/databases/create-document.md | 2 +- docs/examples/databases/list-attributes.md | 3 +- docs/examples/databases/list-collections.md | 3 +- docs/examples/databases/list-documents.md | 3 +- docs/examples/databases/list-indexes.md | 3 +- docs/examples/databases/list.md | 3 +- docs/examples/databases/update-collection.md | 2 +- docs/examples/databases/update-document.md | 2 +- docs/examples/databases/upsert-document.md | 2 +- docs/examples/functions/list-deployments.md | 3 +- docs/examples/functions/list-executions.md | 3 +- docs/examples/functions/list.md | 3 +- .../messaging/create-resend-provider.md | 19 + docs/examples/messaging/list-message-logs.md | 3 +- docs/examples/messaging/list-messages.md | 3 +- docs/examples/messaging/list-provider-logs.md | 3 +- docs/examples/messaging/list-providers.md | 3 +- .../messaging/list-subscriber-logs.md | 3 +- docs/examples/messaging/list-subscribers.md | 3 +- docs/examples/messaging/list-targets.md | 3 +- docs/examples/messaging/list-topic-logs.md | 3 +- docs/examples/messaging/list-topics.md | 3 +- .../messaging/update-resend-provider.md | 19 + docs/examples/sites/list-deployments.md | 3 +- docs/examples/sites/list-logs.md | 3 +- docs/examples/sites/list.md | 3 +- docs/examples/storage/create-bucket.md | 2 +- docs/examples/storage/create-file.md | 2 +- docs/examples/storage/list-buckets.md | 3 +- docs/examples/storage/list-files.md | 3 +- docs/examples/storage/update-bucket.md | 2 +- docs/examples/storage/update-file.md | 2 +- docs/examples/tablesdb/create-row.md | 2 +- docs/examples/tablesdb/create-table.md | 2 +- docs/examples/tablesdb/list-columns.md | 3 +- docs/examples/tablesdb/list-indexes.md | 3 +- docs/examples/tablesdb/list-rows.md | 3 +- docs/examples/tablesdb/list-tables.md | 3 +- docs/examples/tablesdb/list.md | 3 +- docs/examples/tablesdb/update-row.md | 2 +- docs/examples/tablesdb/update-table.md | 2 +- docs/examples/tablesdb/upsert-row.md | 2 +- docs/examples/teams/list-memberships.md | 3 +- docs/examples/teams/list.md | 3 +- docs/examples/tokens/list.md | 3 +- docs/examples/users/list-identities.md | 3 +- docs/examples/users/list-logs.md | 3 +- docs/examples/users/list-memberships.md | 3 +- docs/examples/users/list-sessions.md | 3 +- docs/examples/users/list-targets.md | 3 +- docs/examples/users/list.md | 3 +- package.json | 2 +- src/client.ts | 4 +- src/enums/execution-status.ts | 1 + src/enums/framework.ts | 1 + src/index.ts | 1 + src/models.ts | 2 +- src/operator.ts | 308 ++++++++++++++ src/query.ts | 12 +- src/services/account.ts | 40 +- src/services/databases.ts | 105 +++-- src/services/functions.ts | 63 ++- src/services/messaging.ts | 399 +++++++++++++++--- src/services/sites.ts | 63 ++- src/services/storage.ts | 42 +- src/services/tables-db.ts | 105 +++-- src/services/teams.ts | 42 +- src/services/tokens.ts | 21 +- src/services/users.ts | 125 ++++-- 73 files changed, 1196 insertions(+), 325 deletions(-) create mode 100644 docs/examples/messaging/create-resend-provider.md create mode 100644 docs/examples/messaging/update-resend-provider.md create mode 100644 src/operator.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index bd21b95..a76aa98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 20.3.0 + +* Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance +* Add `Operator` class for atomic modification of rows via update, bulk update, upsert, and bulk upsert operations + ## 20.2.1 * Add transaction support for Databases and TablesDB diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md index b124065..b5541bf 100644 --- a/docs/examples/account/list-identities.md +++ b/docs/examples/account/list-identities.md @@ -8,5 +8,6 @@ const client = new sdk.Client() const account = new sdk.Account(client); const result = await account.listIdentities({ - queries: [] // optional + queries: [], // optional + total: false // optional }); diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md index ca47edd..06b36e5 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -8,5 +8,6 @@ const client = new sdk.Client() const account = new sdk.Account(client); const result = await account.listLogs({ - queries: [] // optional + queries: [], // optional + total: false // optional }); diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md index 8ad770d..9bc014b 100644 --- a/docs/examples/databases/create-collection.md +++ b/docs/examples/databases/create-collection.md @@ -11,7 +11,7 @@ const result = await databases.createCollection({ databaseId: '', collectionId: '', name: '', - permissions: ["read("any")"], // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional documentSecurity: false, // optional enabled: false // optional }); diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 6fe77c4..e6b9b49 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -18,6 +18,6 @@ const result = await databases.createDocument({ "age": 30, "isAdmin": false }, - permissions: ["read("any")"], // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional transactionId: '' // optional }); diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md index a69800c..2937e54 100644 --- a/docs/examples/databases/list-attributes.md +++ b/docs/examples/databases/list-attributes.md @@ -10,5 +10,6 @@ const databases = new sdk.Databases(client); const result = await databases.listAttributes({ databaseId: '', collectionId: '', - queries: [] // optional + queries: [], // optional + total: false // optional }); diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md index 933b53c..7e11fae 100644 --- a/docs/examples/databases/list-collections.md +++ b/docs/examples/databases/list-collections.md @@ -10,5 +10,6 @@ const databases = new sdk.Databases(client); const result = await databases.listCollections({ databaseId: '', queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional }); diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index 7405f3e..40fb680 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -11,5 +11,6 @@ const result = await databases.listDocuments({ databaseId: '', collectionId: '', queries: [], // optional - transactionId: '' // optional + transactionId: '', // optional + total: false // optional }); diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md index f48112f..ad3dbb3 100644 --- a/docs/examples/databases/list-indexes.md +++ b/docs/examples/databases/list-indexes.md @@ -10,5 +10,6 @@ const databases = new sdk.Databases(client); const result = await databases.listIndexes({ databaseId: '', collectionId: '', - queries: [] // optional + queries: [], // optional + total: false // optional }); diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md index 4ac7e47..0aee1a9 100644 --- a/docs/examples/databases/list.md +++ b/docs/examples/databases/list.md @@ -9,5 +9,6 @@ const databases = new sdk.Databases(client); const result = await databases.list({ queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional }); diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md index d0d25b7..4cdc3a2 100644 --- a/docs/examples/databases/update-collection.md +++ b/docs/examples/databases/update-collection.md @@ -11,7 +11,7 @@ const result = await databases.updateCollection({ databaseId: '', collectionId: '', name: '', - permissions: ["read("any")"], // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional documentSecurity: false, // optional enabled: false // optional }); diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index 3e95376..d33d78d 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -12,6 +12,6 @@ const result = await databases.updateDocument({ collectionId: '', documentId: '', data: {}, // optional - permissions: ["read("any")"], // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional transactionId: '' // optional }); diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md index 0aaec4e..8fe4b35 100644 --- a/docs/examples/databases/upsert-document.md +++ b/docs/examples/databases/upsert-document.md @@ -12,6 +12,6 @@ const result = await databases.upsertDocument({ collectionId: '', documentId: '', data: {}, - permissions: ["read("any")"], // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional transactionId: '' // optional }); diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md index e14c6d0..62f1155 100644 --- a/docs/examples/functions/list-deployments.md +++ b/docs/examples/functions/list-deployments.md @@ -10,5 +10,6 @@ const functions = new sdk.Functions(client); const result = await functions.listDeployments({ functionId: '', queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional }); diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index 0d1ceb7..8a9b93a 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -9,5 +9,6 @@ const functions = new sdk.Functions(client); const result = await functions.listExecutions({ functionId: '', - queries: [] // optional + queries: [], // optional + total: false // optional }); diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md index 847c345..3f88308 100644 --- a/docs/examples/functions/list.md +++ b/docs/examples/functions/list.md @@ -9,5 +9,6 @@ const functions = new sdk.Functions(client); const result = await functions.list({ queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional }); diff --git a/docs/examples/messaging/create-resend-provider.md b/docs/examples/messaging/create-resend-provider.md new file mode 100644 index 0000000..8f00367 --- /dev/null +++ b/docs/examples/messaging/create-resend-provider.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createResendProvider({ + providerId: '', + name: '', + apiKey: '', // optional + fromName: '', // optional + fromEmail: 'email@example.com', // optional + replyToName: '', // optional + replyToEmail: 'email@example.com', // optional + enabled: false // optional +}); diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md index c2d32f0..b7d0701 100644 --- a/docs/examples/messaging/list-message-logs.md +++ b/docs/examples/messaging/list-message-logs.md @@ -9,5 +9,6 @@ const messaging = new sdk.Messaging(client); const result = await messaging.listMessageLogs({ messageId: '', - queries: [] // optional + queries: [], // optional + total: false // optional }); diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md index 2edc75f..ecbaf74 100644 --- a/docs/examples/messaging/list-messages.md +++ b/docs/examples/messaging/list-messages.md @@ -9,5 +9,6 @@ const messaging = new sdk.Messaging(client); const result = await messaging.listMessages({ queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional }); diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md index 35fd2cf..e91c69c 100644 --- a/docs/examples/messaging/list-provider-logs.md +++ b/docs/examples/messaging/list-provider-logs.md @@ -9,5 +9,6 @@ const messaging = new sdk.Messaging(client); const result = await messaging.listProviderLogs({ providerId: '', - queries: [] // optional + queries: [], // optional + total: false // optional }); diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md index 2445597..1a05f22 100644 --- a/docs/examples/messaging/list-providers.md +++ b/docs/examples/messaging/list-providers.md @@ -9,5 +9,6 @@ const messaging = new sdk.Messaging(client); const result = await messaging.listProviders({ queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional }); diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md index 1da2c3b..a613829 100644 --- a/docs/examples/messaging/list-subscriber-logs.md +++ b/docs/examples/messaging/list-subscriber-logs.md @@ -9,5 +9,6 @@ const messaging = new sdk.Messaging(client); const result = await messaging.listSubscriberLogs({ subscriberId: '', - queries: [] // optional + queries: [], // optional + total: false // optional }); diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md index c2b594e..ba2cbc5 100644 --- a/docs/examples/messaging/list-subscribers.md +++ b/docs/examples/messaging/list-subscribers.md @@ -10,5 +10,6 @@ const messaging = new sdk.Messaging(client); const result = await messaging.listSubscribers({ topicId: '', queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional }); diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md index 75a4aa6..ceede50 100644 --- a/docs/examples/messaging/list-targets.md +++ b/docs/examples/messaging/list-targets.md @@ -9,5 +9,6 @@ const messaging = new sdk.Messaging(client); const result = await messaging.listTargets({ messageId: '', - queries: [] // optional + queries: [], // optional + total: false // optional }); diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md index eacf482..f4d0746 100644 --- a/docs/examples/messaging/list-topic-logs.md +++ b/docs/examples/messaging/list-topic-logs.md @@ -9,5 +9,6 @@ const messaging = new sdk.Messaging(client); const result = await messaging.listTopicLogs({ topicId: '', - queries: [] // optional + queries: [], // optional + total: false // optional }); diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md index 3ff5538..be321b9 100644 --- a/docs/examples/messaging/list-topics.md +++ b/docs/examples/messaging/list-topics.md @@ -9,5 +9,6 @@ const messaging = new sdk.Messaging(client); const result = await messaging.listTopics({ queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional }); diff --git a/docs/examples/messaging/update-resend-provider.md b/docs/examples/messaging/update-resend-provider.md new file mode 100644 index 0000000..ab96217 --- /dev/null +++ b/docs/examples/messaging/update-resend-provider.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateResendProvider({ + providerId: '', + name: '', // optional + enabled: false, // optional + apiKey: '', // optional + fromName: '', // optional + fromEmail: 'email@example.com', // optional + replyToName: '', // optional + replyToEmail: '' // optional +}); diff --git a/docs/examples/sites/list-deployments.md b/docs/examples/sites/list-deployments.md index 53a900e..4684938 100644 --- a/docs/examples/sites/list-deployments.md +++ b/docs/examples/sites/list-deployments.md @@ -10,5 +10,6 @@ const sites = new sdk.Sites(client); const result = await sites.listDeployments({ siteId: '', queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional }); diff --git a/docs/examples/sites/list-logs.md b/docs/examples/sites/list-logs.md index 17428d7..09791a4 100644 --- a/docs/examples/sites/list-logs.md +++ b/docs/examples/sites/list-logs.md @@ -9,5 +9,6 @@ const sites = new sdk.Sites(client); const result = await sites.listLogs({ siteId: '', - queries: [] // optional + queries: [], // optional + total: false // optional }); diff --git a/docs/examples/sites/list.md b/docs/examples/sites/list.md index 2f2f884..7066ca9 100644 --- a/docs/examples/sites/list.md +++ b/docs/examples/sites/list.md @@ -9,5 +9,6 @@ const sites = new sdk.Sites(client); const result = await sites.list({ queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional }); diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md index f1f0294..b47d2c8 100644 --- a/docs/examples/storage/create-bucket.md +++ b/docs/examples/storage/create-bucket.md @@ -10,7 +10,7 @@ const storage = new sdk.Storage(client); const result = await storage.createBucket({ bucketId: '', name: '', - permissions: ["read("any")"], // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional fileSecurity: false, // optional enabled: false, // optional maximumFileSize: 1, // optional diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index 628faf7..8dc1745 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -12,5 +12,5 @@ const result = await storage.createFile({ bucketId: '', fileId: '', file: InputFile.fromPath('/path/to/file', 'filename'), - permissions: ["read("any")"] // optional + permissions: [sdk.Permission.read(sdk.Role.any())] // optional }); diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md index a6dcf40..1ddc3da 100644 --- a/docs/examples/storage/list-buckets.md +++ b/docs/examples/storage/list-buckets.md @@ -9,5 +9,6 @@ const storage = new sdk.Storage(client); const result = await storage.listBuckets({ queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional }); diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index b22c1c1..a8e8480 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -10,5 +10,6 @@ const storage = new sdk.Storage(client); const result = await storage.listFiles({ bucketId: '', queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional }); diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md index 136ebaf..9535914 100644 --- a/docs/examples/storage/update-bucket.md +++ b/docs/examples/storage/update-bucket.md @@ -10,7 +10,7 @@ const storage = new sdk.Storage(client); const result = await storage.updateBucket({ bucketId: '', name: '', - permissions: ["read("any")"], // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional fileSecurity: false, // optional enabled: false, // optional maximumFileSize: 1, // optional diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md index 2d78d5f..1316821 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -11,5 +11,5 @@ const result = await storage.updateFile({ bucketId: '', fileId: '', name: '', // optional - permissions: ["read("any")"] // optional + permissions: [sdk.Permission.read(sdk.Role.any())] // optional }); diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md index 4468c16..d437501 100644 --- a/docs/examples/tablesdb/create-row.md +++ b/docs/examples/tablesdb/create-row.md @@ -18,6 +18,6 @@ const result = await tablesDB.createRow({ "age": 30, "isAdmin": false }, - permissions: ["read("any")"], // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional transactionId: '' // optional }); diff --git a/docs/examples/tablesdb/create-table.md b/docs/examples/tablesdb/create-table.md index 1b252f1..6a4c12d 100644 --- a/docs/examples/tablesdb/create-table.md +++ b/docs/examples/tablesdb/create-table.md @@ -11,7 +11,7 @@ const result = await tablesDB.createTable({ databaseId: '', tableId: '', name: '', - permissions: ["read("any")"], // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional rowSecurity: false, // optional enabled: false // optional }); diff --git a/docs/examples/tablesdb/list-columns.md b/docs/examples/tablesdb/list-columns.md index b756a3d..8f6c66b 100644 --- a/docs/examples/tablesdb/list-columns.md +++ b/docs/examples/tablesdb/list-columns.md @@ -10,5 +10,6 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.listColumns({ databaseId: '', tableId: '', - queries: [] // optional + queries: [], // optional + total: false // optional }); diff --git a/docs/examples/tablesdb/list-indexes.md b/docs/examples/tablesdb/list-indexes.md index 1c99bf9..7d8ab89 100644 --- a/docs/examples/tablesdb/list-indexes.md +++ b/docs/examples/tablesdb/list-indexes.md @@ -10,5 +10,6 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.listIndexes({ databaseId: '', tableId: '', - queries: [] // optional + queries: [], // optional + total: false // optional }); diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md index 3f29781..ed4fab2 100644 --- a/docs/examples/tablesdb/list-rows.md +++ b/docs/examples/tablesdb/list-rows.md @@ -11,5 +11,6 @@ const result = await tablesDB.listRows({ databaseId: '', tableId: '', queries: [], // optional - transactionId: '' // optional + transactionId: '', // optional + total: false // optional }); diff --git a/docs/examples/tablesdb/list-tables.md b/docs/examples/tablesdb/list-tables.md index f6d6608..602b41d 100644 --- a/docs/examples/tablesdb/list-tables.md +++ b/docs/examples/tablesdb/list-tables.md @@ -10,5 +10,6 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.listTables({ databaseId: '', queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional }); diff --git a/docs/examples/tablesdb/list.md b/docs/examples/tablesdb/list.md index 6648ea7..1b3fce7 100644 --- a/docs/examples/tablesdb/list.md +++ b/docs/examples/tablesdb/list.md @@ -9,5 +9,6 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.list({ queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional }); diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md index 58583af..d5d2ee3 100644 --- a/docs/examples/tablesdb/update-row.md +++ b/docs/examples/tablesdb/update-row.md @@ -12,6 +12,6 @@ const result = await tablesDB.updateRow({ tableId: '', rowId: '', data: {}, // optional - permissions: ["read("any")"], // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional transactionId: '' // optional }); diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md index b61fd6a..97483da 100644 --- a/docs/examples/tablesdb/update-table.md +++ b/docs/examples/tablesdb/update-table.md @@ -11,7 +11,7 @@ const result = await tablesDB.updateTable({ databaseId: '', tableId: '', name: '', - permissions: ["read("any")"], // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional rowSecurity: false, // optional enabled: false // optional }); diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md index bfb8333..f48b0da 100644 --- a/docs/examples/tablesdb/upsert-row.md +++ b/docs/examples/tablesdb/upsert-row.md @@ -12,6 +12,6 @@ const result = await tablesDB.upsertRow({ tableId: '', rowId: '', data: {}, // optional - permissions: ["read("any")"], // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional transactionId: '' // optional }); diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index 3a18bbb..228c997 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -10,5 +10,6 @@ const teams = new sdk.Teams(client); const result = await teams.listMemberships({ teamId: '', queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional }); diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index ef4ab51..1d1b714 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -9,5 +9,6 @@ const teams = new sdk.Teams(client); const result = await teams.list({ queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional }); diff --git a/docs/examples/tokens/list.md b/docs/examples/tokens/list.md index 41833b8..13699a3 100644 --- a/docs/examples/tokens/list.md +++ b/docs/examples/tokens/list.md @@ -10,5 +10,6 @@ const tokens = new sdk.Tokens(client); const result = await tokens.list({ bucketId: '', fileId: '', - queries: [] // optional + queries: [], // optional + total: false // optional }); diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md index 2ff959c..34414b4 100644 --- a/docs/examples/users/list-identities.md +++ b/docs/examples/users/list-identities.md @@ -9,5 +9,6 @@ const users = new sdk.Users(client); const result = await users.listIdentities({ queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional }); diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md index 345d736..a768eb1 100644 --- a/docs/examples/users/list-logs.md +++ b/docs/examples/users/list-logs.md @@ -9,5 +9,6 @@ const users = new sdk.Users(client); const result = await users.listLogs({ userId: '', - queries: [] // optional + queries: [], // optional + total: false // optional }); diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md index 4b2cc1f..9de178b 100644 --- a/docs/examples/users/list-memberships.md +++ b/docs/examples/users/list-memberships.md @@ -10,5 +10,6 @@ const users = new sdk.Users(client); const result = await users.listMemberships({ userId: '', queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional }); diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md index e1082c5..6f85fdd 100644 --- a/docs/examples/users/list-sessions.md +++ b/docs/examples/users/list-sessions.md @@ -8,5 +8,6 @@ const client = new sdk.Client() const users = new sdk.Users(client); const result = await users.listSessions({ - userId: '' + userId: '', + total: false // optional }); diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md index ded1bbe..8fa4033 100644 --- a/docs/examples/users/list-targets.md +++ b/docs/examples/users/list-targets.md @@ -9,5 +9,6 @@ const users = new sdk.Users(client); const result = await users.listTargets({ userId: '', - queries: [] // optional + queries: [], // optional + total: false // optional }); diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md index 74e72f5..0148c9e 100644 --- a/docs/examples/users/list.md +++ b/docs/examples/users/list.md @@ -9,5 +9,6 @@ const users = new sdk.Users(client); const result = await users.list({ queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional }); diff --git a/package.json b/package.json index d77cd68..f03f913 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "node-appwrite", "homepage": "https://appwrite.io/support", "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API", - "version": "20.2.1", + "version": "20.3.0", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", diff --git a/src/client.ts b/src/client.ts index 1e75bce..0e9d8e4 100644 --- a/src/client.ts +++ b/src/client.ts @@ -33,7 +33,7 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/20.2.1'; + let ua = 'AppwriteNodeJSSDK/20.3.0'; // `process` is a global in Node.js, but not fully available in all runtimes. const platform: string[] = []; @@ -82,7 +82,7 @@ class Client { 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '20.2.1', + 'x-sdk-version': '20.3.0', 'user-agent' : getUserAgent(), 'X-Appwrite-Response-Format': '1.8.0', }; diff --git a/src/enums/execution-status.ts b/src/enums/execution-status.ts index 1781e94..992d987 100644 --- a/src/enums/execution-status.ts +++ b/src/enums/execution-status.ts @@ -3,4 +3,5 @@ export enum ExecutionStatus { Processing = 'processing', Completed = 'completed', Failed = 'failed', + Scheduled = 'scheduled', } \ No newline at end of file diff --git a/src/enums/framework.ts b/src/enums/framework.ts index 497c1b2..7093da3 100644 --- a/src/enums/framework.ts +++ b/src/enums/framework.ts @@ -7,6 +7,7 @@ export enum Framework { Vue = 'vue', Sveltekit = 'sveltekit', Astro = 'astro', + Tanstackstart = 'tanstack-start', Remix = 'remix', Lynx = 'lynx', Flutter = 'flutter', diff --git a/src/index.ts b/src/index.ts index 83be68e..e29cca2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,6 +18,7 @@ export type { QueryTypes, QueryTypesList } from './query'; export { Permission } from './permission'; export { Role } from './role'; export { ID } from './id'; +export { Operator, Condition } from './operator'; export { AuthenticatorType } from './enums/authenticator-type'; export { AuthenticationFactor } from './enums/authentication-factor'; export { OAuthProvider } from './enums/o-auth-provider'; diff --git a/src/models.ts b/src/models.ts index 8779124..b168b24 100644 --- a/src/models.ts +++ b/src/models.ts @@ -3320,7 +3320,7 @@ export namespace Models { */ trigger: ExecutionTrigger; /** - * The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + * The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, `failed`, or `scheduled`. */ status: ExecutionStatus; /** diff --git a/src/operator.ts b/src/operator.ts new file mode 100644 index 0000000..2386a6c --- /dev/null +++ b/src/operator.ts @@ -0,0 +1,308 @@ +type OperatorValuesSingle = string | number | boolean; +export type OperatorValuesList = string[] | number[] | boolean[] | any[]; +export type OperatorValues = OperatorValuesSingle | OperatorValuesList; + +export enum Condition { + Equal = "equal", + NotEqual = "notEqual", + GreaterThan = "greaterThan", + GreaterThanEqual = "greaterThanEqual", + LessThan = "lessThan", + LessThanEqual = "lessThanEqual", + Contains = "contains", + IsNull = "isNull", + IsNotNull = "isNotNull", +} + +/** + * Helper class to generate operator strings for atomic operations. + */ +export class Operator { + method: string; + values: OperatorValuesList | undefined; + + /** + * Constructor for Operator class. + * + * @param {string} method + * @param {OperatorValues} values + */ + constructor( + method: string, + values?: OperatorValues + ) { + this.method = method; + + if (values !== undefined) { + if (Array.isArray(values)) { + this.values = values; + } else { + this.values = [values] as OperatorValuesList; + } + } + } + + /** + * Convert the operator object to a JSON string. + * + * @returns {string} + */ + toString(): string { + return JSON.stringify({ + method: this.method, + values: this.values, + }); + } + + /** + * Increment a numeric attribute by a specified value. + * + * @param {number} value + * @param {number} max + * @returns {string} + */ + static increment = (value: number = 1, max?: number): string => { + if (isNaN(value) || !isFinite(value)) { + throw new Error("Value cannot be NaN or Infinity"); + } + if (max !== undefined && (isNaN(max) || !isFinite(max))) { + throw new Error("Max cannot be NaN or Infinity"); + } + const values: any[] = [value]; + if (max !== undefined) { + values.push(max); + } + return new Operator("increment", values).toString(); + }; + + /** + * Decrement a numeric attribute by a specified value. + * + * @param {number} value + * @param {number} min + * @returns {string} + */ + static decrement = (value: number = 1, min?: number): string => { + if (isNaN(value) || !isFinite(value)) { + throw new Error("Value cannot be NaN or Infinity"); + } + if (min !== undefined && (isNaN(min) || !isFinite(min))) { + throw new Error("Min cannot be NaN or Infinity"); + } + const values: any[] = [value]; + if (min !== undefined) { + values.push(min); + } + return new Operator("decrement", values).toString(); + }; + + /** + * Multiply a numeric attribute by a specified factor. + * + * @param {number} factor + * @param {number} max + * @returns {string} + */ + static multiply = (factor: number, max?: number): string => { + if (isNaN(factor) || !isFinite(factor)) { + throw new Error("Factor cannot be NaN or Infinity"); + } + if (max !== undefined && (isNaN(max) || !isFinite(max))) { + throw new Error("Max cannot be NaN or Infinity"); + } + const values: any[] = [factor]; + if (max !== undefined) { + values.push(max); + } + return new Operator("multiply", values).toString(); + }; + + /** + * Divide a numeric attribute by a specified divisor. + * + * @param {number} divisor + * @param {number} min + * @returns {string} + */ + static divide = (divisor: number, min?: number): string => { + if (isNaN(divisor) || !isFinite(divisor)) { + throw new Error("Divisor cannot be NaN or Infinity"); + } + if (min !== undefined && (isNaN(min) || !isFinite(min))) { + throw new Error("Min cannot be NaN or Infinity"); + } + if (divisor === 0) { + throw new Error("Divisor cannot be zero"); + } + const values: any[] = [divisor]; + if (min !== undefined) { + values.push(min); + } + return new Operator("divide", values).toString(); + }; + + /** + * Apply modulo operation on a numeric attribute. + * + * @param {number} divisor + * @returns {string} + */ + static modulo = (divisor: number): string => { + if (isNaN(divisor) || !isFinite(divisor)) { + throw new Error("Divisor cannot be NaN or Infinity"); + } + if (divisor === 0) { + throw new Error("Divisor cannot be zero"); + } + return new Operator("modulo", [divisor]).toString(); + }; + + /** + * Raise a numeric attribute to a specified power. + * + * @param {number} exponent + * @param {number} max + * @returns {string} + */ + static power = (exponent: number, max?: number): string => { + if (isNaN(exponent) || !isFinite(exponent)) { + throw new Error("Exponent cannot be NaN or Infinity"); + } + if (max !== undefined && (isNaN(max) || !isFinite(max))) { + throw new Error("Max cannot be NaN or Infinity"); + } + const values: any[] = [exponent]; + if (max !== undefined) { + values.push(max); + } + return new Operator("power", values).toString(); + }; + + /** + * Append values to an array attribute. + * + * @param {any[]} values + * @returns {string} + */ + static arrayAppend = (values: any[]): string => + new Operator("arrayAppend", values).toString(); + + /** + * Prepend values to an array attribute. + * + * @param {any[]} values + * @returns {string} + */ + static arrayPrepend = (values: any[]): string => + new Operator("arrayPrepend", values).toString(); + + /** + * Insert a value at a specific index in an array attribute. + * + * @param {number} index + * @param {any} value + * @returns {string} + */ + static arrayInsert = (index: number, value: any): string => + new Operator("arrayInsert", [index, value]).toString(); + + /** + * Remove a value from an array attribute. + * + * @param {any} value + * @returns {string} + */ + static arrayRemove = (value: any): string => + new Operator("arrayRemove", [value]).toString(); + + /** + * Remove duplicate values from an array attribute. + * + * @returns {string} + */ + static arrayUnique = (): string => + new Operator("arrayUnique", []).toString(); + + /** + * Keep only values that exist in both the current array and the provided array. + * + * @param {any[]} values + * @returns {string} + */ + static arrayIntersect = (values: any[]): string => + new Operator("arrayIntersect", values).toString(); + + /** + * Remove values from the array that exist in the provided array. + * + * @param {any[]} values + * @returns {string} + */ + static arrayDiff = (values: any[]): string => + new Operator("arrayDiff", values).toString(); + + /** + * Filter array values based on a condition. + * + * @param {Condition} condition + * @param {any} value + * @returns {string} + */ + static arrayFilter = (condition: Condition, value?: any): string => { + const values: any[] = [condition as string, value === undefined ? null : value]; + return new Operator("arrayFilter", values).toString(); + }; + + /** + * Concatenate a value to a string or array attribute. + * + * @param {any} value + * @returns {string} + */ + static stringConcat = (value: any): string => + new Operator("stringConcat", [value]).toString(); + + /** + * Replace occurrences of a search string with a replacement string. + * + * @param {string} search + * @param {string} replace + * @returns {string} + */ + static stringReplace = (search: string, replace: string): string => + new Operator("stringReplace", [search, replace]).toString(); + + /** + * Toggle a boolean attribute. + * + * @returns {string} + */ + static toggle = (): string => + new Operator("toggle", []).toString(); + + /** + * Add days to a date attribute. + * + * @param {number} days + * @returns {string} + */ + static dateAddDays = (days: number): string => + new Operator("dateAddDays", [days]).toString(); + + /** + * Subtract days from a date attribute. + * + * @param {number} days + * @returns {string} + */ + static dateSubDays = (days: number): string => + new Operator("dateSubDays", [days]).toString(); + + /** + * Set a date attribute to the current date and time. + * + * @returns {string} + */ + static dateSetNow = (): string => + new Operator("dateSetNow", []).toString(); +} diff --git a/src/query.ts b/src/query.ts index 8b274f4..4ebd532 100644 --- a/src/query.ts +++ b/src/query.ts @@ -308,7 +308,7 @@ export class Query { * @returns {string} */ static createdBefore = (value: string): string => - new Query("createdBefore", undefined, value).toString(); + Query.lessThan("$createdAt", value); /** * Filter resources where document was created after date. @@ -317,7 +317,7 @@ export class Query { * @returns {string} */ static createdAfter = (value: string): string => - new Query("createdAfter", undefined, value).toString(); + Query.greaterThan("$createdAt", value); /** * Filter resources where document was created between dates. @@ -327,7 +327,7 @@ export class Query { * @returns {string} */ static createdBetween = (start: string, end: string): string => - new Query("createdBetween", undefined, [start, end] as QueryTypesList).toString(); + Query.between("$createdAt", start, end); /** * Filter resources where document was updated before date. @@ -336,7 +336,7 @@ export class Query { * @returns {string} */ static updatedBefore = (value: string): string => - new Query("updatedBefore", undefined, value).toString(); + Query.lessThan("$updatedAt", value); /** * Filter resources where document was updated after date. @@ -345,7 +345,7 @@ export class Query { * @returns {string} */ static updatedAfter = (value: string): string => - new Query("updatedAfter", undefined, value).toString(); + Query.greaterThan("$updatedAt", value); /** * Filter resources where document was updated between dates. @@ -355,7 +355,7 @@ export class Query { * @returns {string} */ static updatedBetween = (start: string, end: string): string => - new Query("updatedBetween", undefined, [start, end] as QueryTypesList).toString(); + Query.between("$updatedAt", start, end); /** * Combine multiple queries using logical OR operator. diff --git a/src/services/account.ts b/src/services/account.ts index 4636d4e..5731f61 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -192,33 +192,38 @@ export class Account { * Get the list of identities for the currently logged in user. * * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listIdentities(params?: { queries?: string[] }): Promise; + listIdentities(params?: { queries?: string[], total?: boolean }): Promise; /** * Get the list of identities for the currently logged in user. * * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listIdentities(queries?: string[]): Promise; + listIdentities(queries?: string[], total?: boolean): Promise; listIdentities( - paramsOrFirst?: { queries?: string[] } | string[] + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] ): Promise { - let params: { queries?: string[] }; + let params: { queries?: string[], total?: boolean }; if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[] }; + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; } else { params = { - queries: paramsOrFirst as string[] + queries: paramsOrFirst as string[], + total: rest[0] as boolean }; } const queries = params.queries; + const total = params.total; const apiPath = '/account/identities'; @@ -226,6 +231,9 @@ export class Account { if (typeof queries !== 'undefined') { payload['queries'] = queries; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -319,33 +327,38 @@ export class Account { * Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log. * * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listLogs(params?: { queries?: string[] }): Promise; + listLogs(params?: { queries?: string[], total?: boolean }): Promise; /** * Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log. * * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listLogs(queries?: string[]): Promise; + listLogs(queries?: string[], total?: boolean): Promise; listLogs( - paramsOrFirst?: { queries?: string[] } | string[] + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] ): Promise { - let params: { queries?: string[] }; + let params: { queries?: string[], total?: boolean }; if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[] }; + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; } else { params = { - queries: paramsOrFirst as string[] + queries: paramsOrFirst as string[], + total: rest[0] as boolean }; } const queries = params.queries; + const total = params.total; const apiPath = '/account/logs'; @@ -353,6 +366,9 @@ export class Account { if (typeof queries !== 'undefined') { payload['queries'] = queries; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/databases.ts b/src/services/databases.ts index c26c6ee..7852c55 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -17,38 +17,42 @@ export class Databases { * * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.list` instead. */ - list(params?: { queries?: string[], search?: string }): Promise; + list(params?: { queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. * * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - list(queries?: string[], search?: string): Promise; + list(queries?: string[], search?: string, total?: boolean): Promise; list( - paramsOrFirst?: { queries?: string[], search?: string } | string[], - ...rest: [(string)?] + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] ): Promise { - let params: { queries?: string[], search?: string }; + let params: { queries?: string[], search?: string, total?: boolean }; if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string }; + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; } else { params = { queries: paramsOrFirst as string[], - search: rest[0] as string + search: rest[0] as string, + total: rest[1] as boolean }; } const queries = params.queries; const search = params.search; + const total = params.total; const apiPath = '/databases'; @@ -59,6 +63,9 @@ export class Databases { if (typeof search !== 'undefined') { payload['search'] = search; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -663,41 +670,45 @@ export class Databases { * @param {string} params.databaseId - Database ID. * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, documentSecurity * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listTables` instead. */ - listCollections(params: { databaseId: string, queries?: string[], search?: string }): Promise; + listCollections(params: { databaseId: string, queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. * * @param {string} databaseId - Database ID. * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, documentSecurity * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listCollections(databaseId: string, queries?: string[], search?: string): Promise; + listCollections(databaseId: string, queries?: string[], search?: string, total?: boolean): Promise; listCollections( - paramsOrFirst: { databaseId: string, queries?: string[], search?: string } | string, - ...rest: [(string[])?, (string)?] + paramsOrFirst: { databaseId: string, queries?: string[], search?: string, total?: boolean } | string, + ...rest: [(string[])?, (string)?, (boolean)?] ): Promise { - let params: { databaseId: string, queries?: string[], search?: string }; + let params: { databaseId: string, queries?: string[], search?: string, total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, queries?: string[], search?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, queries?: string[], search?: string, total?: boolean }; } else { params = { databaseId: paramsOrFirst as string, queries: rest[0] as string[], - search: rest[1] as string + search: rest[1] as string, + total: rest[2] as boolean }; } const databaseId = params.databaseId; const queries = params.queries; const search = params.search; + const total = params.total; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -711,6 +722,9 @@ export class Databases { if (typeof search !== 'undefined') { payload['search'] = search; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1038,41 +1052,45 @@ export class Databases { * @param {string} params.databaseId - Database ID. * @param {string} params.collectionId - Collection ID. * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, size, required, array, status, error + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listColumns` instead. */ - listAttributes(params: { databaseId: string, collectionId: string, queries?: string[] }): Promise; + listAttributes(params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }): Promise; /** * List attributes in the collection. * * @param {string} databaseId - Database ID. * @param {string} collectionId - Collection ID. * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, size, required, array, status, error + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listAttributes(databaseId: string, collectionId: string, queries?: string[]): Promise; + listAttributes(databaseId: string, collectionId: string, queries?: string[], total?: boolean): Promise; listAttributes( - paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[] } | string, - ...rest: [(string)?, (string[])?] + paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string)?, (string[])?, (boolean)?] ): Promise { - let params: { databaseId: string, collectionId: string, queries?: string[] }; + let params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[] }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], total?: boolean }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, - queries: rest[1] as string[] + queries: rest[1] as string[], + total: rest[2] as boolean }; } const databaseId = params.databaseId; const collectionId = params.collectionId; const queries = params.queries; + const total = params.total; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1086,6 +1104,9 @@ export class Databases { if (typeof queries !== 'undefined') { payload['queries'] = queries; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -3816,11 +3837,12 @@ export class Databases { * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead. */ - listDocuments(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string }): Promise>; + listDocuments(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean }): Promise>; /** * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. * @@ -3828,25 +3850,27 @@ export class Databases { * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - listDocuments(databaseId: string, collectionId: string, queries?: string[], transactionId?: string): Promise>; + listDocuments(databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean): Promise>; listDocuments( - paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string[])?, (string)?] + paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean } | string, + ...rest: [(string)?, (string[])?, (string)?, (boolean)?] ): Promise> { - let params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string }; + let params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], transactionId?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, queries: rest[1] as string[], - transactionId: rest[2] as string + transactionId: rest[2] as string, + total: rest[3] as boolean }; } @@ -3854,6 +3878,7 @@ export class Databases { const collectionId = params.collectionId; const queries = params.queries; const transactionId = params.transactionId; + const total = params.total; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -3870,6 +3895,9 @@ export class Databases { if (typeof transactionId !== 'undefined') { payload['transactionId'] = transactionId; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -4828,41 +4856,45 @@ export class Databases { * @param {string} params.databaseId - Database ID. * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, status, attributes, error + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listIndexes` instead. */ - listIndexes(params: { databaseId: string, collectionId: string, queries?: string[] }): Promise; + listIndexes(params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }): Promise; /** * List indexes in the collection. * * @param {string} databaseId - Database ID. * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, status, attributes, error + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listIndexes(databaseId: string, collectionId: string, queries?: string[]): Promise; + listIndexes(databaseId: string, collectionId: string, queries?: string[], total?: boolean): Promise; listIndexes( - paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[] } | string, - ...rest: [(string)?, (string[])?] + paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string)?, (string[])?, (boolean)?] ): Promise { - let params: { databaseId: string, collectionId: string, queries?: string[] }; + let params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[] }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], total?: boolean }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, - queries: rest[1] as string[] + queries: rest[1] as string[], + total: rest[2] as boolean }; } const databaseId = params.databaseId; const collectionId = params.collectionId; const queries = params.queries; + const total = params.total; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -4876,6 +4908,9 @@ export class Databases { if (typeof queries !== 'undefined') { payload['queries'] = queries; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/functions.ts b/src/services/functions.ts index d379d26..18b6aba 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -18,37 +18,41 @@ export class Functions { * * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - list(params?: { queries?: string[], search?: string }): Promise; + list(params?: { queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all the project's functions. You can use the query params to filter your results. * * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - list(queries?: string[], search?: string): Promise; + list(queries?: string[], search?: string, total?: boolean): Promise; list( - paramsOrFirst?: { queries?: string[], search?: string } | string[], - ...rest: [(string)?] + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] ): Promise { - let params: { queries?: string[], search?: string }; + let params: { queries?: string[], search?: string, total?: boolean }; if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string }; + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; } else { params = { queries: paramsOrFirst as string[], - search: rest[0] as string + search: rest[0] as string, + total: rest[1] as boolean }; } const queries = params.queries; const search = params.search; + const total = params.total; const apiPath = '/functions'; @@ -59,6 +63,9 @@ export class Functions { if (typeof search !== 'undefined') { payload['search'] = search; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -646,40 +653,44 @@ export class Functions { * @param {string} params.functionId - Function ID. * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: buildSize, sourceSize, totalSize, buildDuration, status, activate, type * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listDeployments(params: { functionId: string, queries?: string[], search?: string }): Promise; + listDeployments(params: { functionId: string, queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all the function's code deployments. You can use the query params to filter your results. * * @param {string} functionId - Function ID. * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: buildSize, sourceSize, totalSize, buildDuration, status, activate, type * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listDeployments(functionId: string, queries?: string[], search?: string): Promise; + listDeployments(functionId: string, queries?: string[], search?: string, total?: boolean): Promise; listDeployments( - paramsOrFirst: { functionId: string, queries?: string[], search?: string } | string, - ...rest: [(string[])?, (string)?] + paramsOrFirst: { functionId: string, queries?: string[], search?: string, total?: boolean } | string, + ...rest: [(string[])?, (string)?, (boolean)?] ): Promise { - let params: { functionId: string, queries?: string[], search?: string }; + let params: { functionId: string, queries?: string[], search?: string, total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, queries?: string[], search?: string }; + params = (paramsOrFirst || {}) as { functionId: string, queries?: string[], search?: string, total?: boolean }; } else { params = { functionId: paramsOrFirst as string, queries: rest[0] as string[], - search: rest[1] as string + search: rest[1] as string, + total: rest[2] as boolean }; } const functionId = params.functionId; const queries = params.queries; const search = params.search; + const total = params.total; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); @@ -693,6 +704,9 @@ export class Functions { if (typeof search !== 'undefined') { payload['search'] = search; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1314,37 +1328,41 @@ export class Functions { * * @param {string} params.functionId - Function ID. * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listExecutions(params: { functionId: string, queries?: string[] }): Promise; + listExecutions(params: { functionId: string, queries?: string[], total?: boolean }): Promise; /** * Get a list of all the current user function execution logs. You can use the query params to filter your results. * * @param {string} functionId - Function ID. * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listExecutions(functionId: string, queries?: string[]): Promise; + listExecutions(functionId: string, queries?: string[], total?: boolean): Promise; listExecutions( - paramsOrFirst: { functionId: string, queries?: string[] } | string, - ...rest: [(string[])?] + paramsOrFirst: { functionId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] ): Promise { - let params: { functionId: string, queries?: string[] }; + let params: { functionId: string, queries?: string[], total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, queries?: string[] }; + params = (paramsOrFirst || {}) as { functionId: string, queries?: string[], total?: boolean }; } else { params = { functionId: paramsOrFirst as string, - queries: rest[0] as string[] + queries: rest[0] as string[], + total: rest[1] as boolean }; } const functionId = params.functionId; const queries = params.queries; + const total = params.total; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); @@ -1355,6 +1373,9 @@ export class Functions { if (typeof queries !== 'undefined') { payload['queries'] = queries; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/messaging.ts b/src/services/messaging.ts index 480bef4..c2cd63c 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -16,37 +16,41 @@ export class Messaging { * * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listMessages(params?: { queries?: string[], search?: string }): Promise; + listMessages(params?: { queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all messages from the current Appwrite project. * * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listMessages(queries?: string[], search?: string): Promise; + listMessages(queries?: string[], search?: string, total?: boolean): Promise; listMessages( - paramsOrFirst?: { queries?: string[], search?: string } | string[], - ...rest: [(string)?] + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] ): Promise { - let params: { queries?: string[], search?: string }; + let params: { queries?: string[], search?: string, total?: boolean }; if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string }; + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; } else { params = { queries: paramsOrFirst as string[], - search: rest[0] as string + search: rest[0] as string, + total: rest[1] as boolean }; } const queries = params.queries; const search = params.search; + const total = params.total; const apiPath = '/messaging/messages'; @@ -57,6 +61,9 @@ export class Messaging { if (typeof search !== 'undefined') { payload['search'] = search; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1212,37 +1219,41 @@ export class Messaging { * * @param {string} params.messageId - Message ID. * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listMessageLogs(params: { messageId: string, queries?: string[] }): Promise; + listMessageLogs(params: { messageId: string, queries?: string[], total?: boolean }): Promise; /** * Get the message activity logs listed by its unique ID. * * @param {string} messageId - Message ID. * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listMessageLogs(messageId: string, queries?: string[]): Promise; + listMessageLogs(messageId: string, queries?: string[], total?: boolean): Promise; listMessageLogs( - paramsOrFirst: { messageId: string, queries?: string[] } | string, - ...rest: [(string[])?] + paramsOrFirst: { messageId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] ): Promise { - let params: { messageId: string, queries?: string[] }; + let params: { messageId: string, queries?: string[], total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string, queries?: string[] }; + params = (paramsOrFirst || {}) as { messageId: string, queries?: string[], total?: boolean }; } else { params = { messageId: paramsOrFirst as string, - queries: rest[0] as string[] + queries: rest[0] as string[], + total: rest[1] as boolean }; } const messageId = params.messageId; const queries = params.queries; + const total = params.total; if (typeof messageId === 'undefined') { throw new AppwriteException('Missing required parameter: "messageId"'); @@ -1253,6 +1264,9 @@ export class Messaging { if (typeof queries !== 'undefined') { payload['queries'] = queries; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1271,37 +1285,41 @@ export class Messaging { * * @param {string} params.messageId - Message ID. * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, providerId, identifier, providerType + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listTargets(params: { messageId: string, queries?: string[] }): Promise; + listTargets(params: { messageId: string, queries?: string[], total?: boolean }): Promise; /** * Get a list of the targets associated with a message. * * @param {string} messageId - Message ID. * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, providerId, identifier, providerType + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listTargets(messageId: string, queries?: string[]): Promise; + listTargets(messageId: string, queries?: string[], total?: boolean): Promise; listTargets( - paramsOrFirst: { messageId: string, queries?: string[] } | string, - ...rest: [(string[])?] + paramsOrFirst: { messageId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] ): Promise { - let params: { messageId: string, queries?: string[] }; + let params: { messageId: string, queries?: string[], total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string, queries?: string[] }; + params = (paramsOrFirst || {}) as { messageId: string, queries?: string[], total?: boolean }; } else { params = { messageId: paramsOrFirst as string, - queries: rest[0] as string[] + queries: rest[0] as string[], + total: rest[1] as boolean }; } const messageId = params.messageId; const queries = params.queries; + const total = params.total; if (typeof messageId === 'undefined') { throw new AppwriteException('Missing required parameter: "messageId"'); @@ -1312,6 +1330,9 @@ export class Messaging { if (typeof queries !== 'undefined') { payload['queries'] = queries; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1330,37 +1351,41 @@ export class Messaging { * * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listProviders(params?: { queries?: string[], search?: string }): Promise; + listProviders(params?: { queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all providers from the current Appwrite project. * * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listProviders(queries?: string[], search?: string): Promise; + listProviders(queries?: string[], search?: string, total?: boolean): Promise; listProviders( - paramsOrFirst?: { queries?: string[], search?: string } | string[], - ...rest: [(string)?] + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] ): Promise { - let params: { queries?: string[], search?: string }; + let params: { queries?: string[], search?: string, total?: boolean }; if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string }; + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; } else { params = { queries: paramsOrFirst as string[], - search: rest[0] as string + search: rest[0] as string, + total: rest[1] as boolean }; } const queries = params.queries; const search = params.search; + const total = params.total; const apiPath = '/messaging/providers'; @@ -1371,6 +1396,9 @@ export class Messaging { if (typeof search !== 'undefined') { payload['search'] = search; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -2536,6 +2564,216 @@ export class Messaging { ); } + /** + * Create a new Resend provider. + * + * @param {string} params.providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Provider name. + * @param {string} params.apiKey - Resend API key. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise} + */ + createResendProvider(params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise; + /** + * Create a new Resend provider. + * + * @param {string} providerId - Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Provider name. + * @param {string} apiKey - Resend API key. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createResendProvider(providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise; + createResendProvider( + paramsOrFirst: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise { + let params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + apiKey: rest[1] as string, + fromName: rest[2] as string, + fromEmail: rest[3] as string, + replyToName: rest[4] as string, + replyToEmail: rest[5] as string, + enabled: rest[6] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const apiKey = params.apiKey; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/resend'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a Resend provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {string} params.apiKey - Resend API key. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. + * @param {string} params.replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateResendProvider(params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise; + /** + * Update a Resend provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {string} apiKey - Resend API key. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. + * @param {string} replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateResendProvider(providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise; + updateResendProvider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string } | string, + ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?] + ): Promise { + let params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + apiKey: rest[2] as string, + fromName: rest[3] as string, + fromEmail: rest[4] as string, + replyToName: rest[5] as string, + replyToEmail: rest[6] as string + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const apiKey = params.apiKey; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/resend/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + /** * Create a new Sendgrid provider. * @@ -4180,37 +4418,41 @@ export class Messaging { * * @param {string} params.providerId - Provider ID. * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listProviderLogs(params: { providerId: string, queries?: string[] }): Promise; + listProviderLogs(params: { providerId: string, queries?: string[], total?: boolean }): Promise; /** * Get the provider activity logs listed by its unique ID. * * @param {string} providerId - Provider ID. * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listProviderLogs(providerId: string, queries?: string[]): Promise; + listProviderLogs(providerId: string, queries?: string[], total?: boolean): Promise; listProviderLogs( - paramsOrFirst: { providerId: string, queries?: string[] } | string, - ...rest: [(string[])?] + paramsOrFirst: { providerId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] ): Promise { - let params: { providerId: string, queries?: string[] }; + let params: { providerId: string, queries?: string[], total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, queries?: string[] }; + params = (paramsOrFirst || {}) as { providerId: string, queries?: string[], total?: boolean }; } else { params = { providerId: paramsOrFirst as string, - queries: rest[0] as string[] + queries: rest[0] as string[], + total: rest[1] as boolean }; } const providerId = params.providerId; const queries = params.queries; + const total = params.total; if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); @@ -4221,6 +4463,9 @@ export class Messaging { if (typeof queries !== 'undefined') { payload['queries'] = queries; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -4239,37 +4484,41 @@ export class Messaging { * * @param {string} params.subscriberId - Subscriber ID. * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listSubscriberLogs(params: { subscriberId: string, queries?: string[] }): Promise; + listSubscriberLogs(params: { subscriberId: string, queries?: string[], total?: boolean }): Promise; /** * Get the subscriber activity logs listed by its unique ID. * * @param {string} subscriberId - Subscriber ID. * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listSubscriberLogs(subscriberId: string, queries?: string[]): Promise; + listSubscriberLogs(subscriberId: string, queries?: string[], total?: boolean): Promise; listSubscriberLogs( - paramsOrFirst: { subscriberId: string, queries?: string[] } | string, - ...rest: [(string[])?] + paramsOrFirst: { subscriberId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] ): Promise { - let params: { subscriberId: string, queries?: string[] }; + let params: { subscriberId: string, queries?: string[], total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { subscriberId: string, queries?: string[] }; + params = (paramsOrFirst || {}) as { subscriberId: string, queries?: string[], total?: boolean }; } else { params = { subscriberId: paramsOrFirst as string, - queries: rest[0] as string[] + queries: rest[0] as string[], + total: rest[1] as boolean }; } const subscriberId = params.subscriberId; const queries = params.queries; + const total = params.total; if (typeof subscriberId === 'undefined') { throw new AppwriteException('Missing required parameter: "subscriberId"'); @@ -4280,6 +4529,9 @@ export class Messaging { if (typeof queries !== 'undefined') { payload['queries'] = queries; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -4298,37 +4550,41 @@ export class Messaging { * * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, description, emailTotal, smsTotal, pushTotal * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listTopics(params?: { queries?: string[], search?: string }): Promise; + listTopics(params?: { queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all topics from the current Appwrite project. * * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, description, emailTotal, smsTotal, pushTotal * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listTopics(queries?: string[], search?: string): Promise; + listTopics(queries?: string[], search?: string, total?: boolean): Promise; listTopics( - paramsOrFirst?: { queries?: string[], search?: string } | string[], - ...rest: [(string)?] + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] ): Promise { - let params: { queries?: string[], search?: string }; + let params: { queries?: string[], search?: string, total?: boolean }; if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string }; + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; } else { params = { queries: paramsOrFirst as string[], - search: rest[0] as string + search: rest[0] as string, + total: rest[1] as boolean }; } const queries = params.queries; const search = params.search; + const total = params.total; const apiPath = '/messaging/topics'; @@ -4339,6 +4595,9 @@ export class Messaging { if (typeof search !== 'undefined') { payload['search'] = search; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -4604,37 +4863,41 @@ export class Messaging { * * @param {string} params.topicId - Topic ID. * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listTopicLogs(params: { topicId: string, queries?: string[] }): Promise; + listTopicLogs(params: { topicId: string, queries?: string[], total?: boolean }): Promise; /** * Get the topic activity logs listed by its unique ID. * * @param {string} topicId - Topic ID. * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listTopicLogs(topicId: string, queries?: string[]): Promise; + listTopicLogs(topicId: string, queries?: string[], total?: boolean): Promise; listTopicLogs( - paramsOrFirst: { topicId: string, queries?: string[] } | string, - ...rest: [(string[])?] + paramsOrFirst: { topicId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] ): Promise { - let params: { topicId: string, queries?: string[] }; + let params: { topicId: string, queries?: string[], total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { topicId: string, queries?: string[] }; + params = (paramsOrFirst || {}) as { topicId: string, queries?: string[], total?: boolean }; } else { params = { topicId: paramsOrFirst as string, - queries: rest[0] as string[] + queries: rest[0] as string[], + total: rest[1] as boolean }; } const topicId = params.topicId; const queries = params.queries; + const total = params.total; if (typeof topicId === 'undefined') { throw new AppwriteException('Missing required parameter: "topicId"'); @@ -4645,6 +4908,9 @@ export class Messaging { if (typeof queries !== 'undefined') { payload['queries'] = queries; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -4664,40 +4930,44 @@ export class Messaging { * @param {string} params.topicId - Topic ID. The topic ID subscribed to. * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listSubscribers(params: { topicId: string, queries?: string[], search?: string }): Promise; + listSubscribers(params: { topicId: string, queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all subscribers from the current Appwrite project. * * @param {string} topicId - Topic ID. The topic ID subscribed to. * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listSubscribers(topicId: string, queries?: string[], search?: string): Promise; + listSubscribers(topicId: string, queries?: string[], search?: string, total?: boolean): Promise; listSubscribers( - paramsOrFirst: { topicId: string, queries?: string[], search?: string } | string, - ...rest: [(string[])?, (string)?] + paramsOrFirst: { topicId: string, queries?: string[], search?: string, total?: boolean } | string, + ...rest: [(string[])?, (string)?, (boolean)?] ): Promise { - let params: { topicId: string, queries?: string[], search?: string }; + let params: { topicId: string, queries?: string[], search?: string, total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { topicId: string, queries?: string[], search?: string }; + params = (paramsOrFirst || {}) as { topicId: string, queries?: string[], search?: string, total?: boolean }; } else { params = { topicId: paramsOrFirst as string, queries: rest[0] as string[], - search: rest[1] as string + search: rest[1] as string, + total: rest[2] as boolean }; } const topicId = params.topicId; const queries = params.queries; const search = params.search; + const total = params.total; if (typeof topicId === 'undefined') { throw new AppwriteException('Missing required parameter: "topicId"'); @@ -4711,6 +4981,9 @@ export class Messaging { if (typeof search !== 'undefined') { payload['search'] = search; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/sites.ts b/src/services/sites.ts index 3236d1a..d12b122 100644 --- a/src/services/sites.ts +++ b/src/services/sites.ts @@ -19,37 +19,41 @@ export class Sites { * * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, framework, deploymentId, buildCommand, installCommand, outputDirectory, installationId * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - list(params?: { queries?: string[], search?: string }): Promise; + list(params?: { queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all the project's sites. You can use the query params to filter your results. * * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, framework, deploymentId, buildCommand, installCommand, outputDirectory, installationId * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - list(queries?: string[], search?: string): Promise; + list(queries?: string[], search?: string, total?: boolean): Promise; list( - paramsOrFirst?: { queries?: string[], search?: string } | string[], - ...rest: [(string)?] + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] ): Promise { - let params: { queries?: string[], search?: string }; + let params: { queries?: string[], search?: string, total?: boolean }; if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string }; + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; } else { params = { queries: paramsOrFirst as string[], - search: rest[0] as string + search: rest[0] as string, + total: rest[1] as boolean }; } const queries = params.queries; const search = params.search; + const total = params.total; const apiPath = '/sites'; @@ -60,6 +64,9 @@ export class Sites { if (typeof search !== 'undefined') { payload['search'] = search; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -653,40 +660,44 @@ export class Sites { * @param {string} params.siteId - Site ID. * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: buildSize, sourceSize, totalSize, buildDuration, status, activate, type * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listDeployments(params: { siteId: string, queries?: string[], search?: string }): Promise; + listDeployments(params: { siteId: string, queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all the site's code deployments. You can use the query params to filter your results. * * @param {string} siteId - Site ID. * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: buildSize, sourceSize, totalSize, buildDuration, status, activate, type * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listDeployments(siteId: string, queries?: string[], search?: string): Promise; + listDeployments(siteId: string, queries?: string[], search?: string, total?: boolean): Promise; listDeployments( - paramsOrFirst: { siteId: string, queries?: string[], search?: string } | string, - ...rest: [(string[])?, (string)?] + paramsOrFirst: { siteId: string, queries?: string[], search?: string, total?: boolean } | string, + ...rest: [(string[])?, (string)?, (boolean)?] ): Promise { - let params: { siteId: string, queries?: string[], search?: string }; + let params: { siteId: string, queries?: string[], search?: string, total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, queries?: string[], search?: string }; + params = (paramsOrFirst || {}) as { siteId: string, queries?: string[], search?: string, total?: boolean }; } else { params = { siteId: paramsOrFirst as string, queries: rest[0] as string[], - search: rest[1] as string + search: rest[1] as string, + total: rest[2] as boolean }; } const siteId = params.siteId; const queries = params.queries; const search = params.search; + const total = params.total; if (typeof siteId === 'undefined') { throw new AppwriteException('Missing required parameter: "siteId"'); @@ -700,6 +711,9 @@ export class Sites { if (typeof search !== 'undefined') { payload['search'] = search; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1313,37 +1327,41 @@ export class Sites { * * @param {string} params.siteId - Site ID. * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listLogs(params: { siteId: string, queries?: string[] }): Promise; + listLogs(params: { siteId: string, queries?: string[], total?: boolean }): Promise; /** * Get a list of all site logs. You can use the query params to filter your results. * * @param {string} siteId - Site ID. * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listLogs(siteId: string, queries?: string[]): Promise; + listLogs(siteId: string, queries?: string[], total?: boolean): Promise; listLogs( - paramsOrFirst: { siteId: string, queries?: string[] } | string, - ...rest: [(string[])?] + paramsOrFirst: { siteId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] ): Promise { - let params: { siteId: string, queries?: string[] }; + let params: { siteId: string, queries?: string[], total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, queries?: string[] }; + params = (paramsOrFirst || {}) as { siteId: string, queries?: string[], total?: boolean }; } else { params = { siteId: paramsOrFirst as string, - queries: rest[0] as string[] + queries: rest[0] as string[], + total: rest[1] as boolean }; } const siteId = params.siteId; const queries = params.queries; + const total = params.total; if (typeof siteId === 'undefined') { throw new AppwriteException('Missing required parameter: "siteId"'); @@ -1354,6 +1372,9 @@ export class Sites { if (typeof queries !== 'undefined') { payload['queries'] = queries; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/storage.ts b/src/services/storage.ts index c0f8377..4f44d25 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -17,37 +17,41 @@ export class Storage { * * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listBuckets(params?: { queries?: string[], search?: string }): Promise; + listBuckets(params?: { queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all the storage buckets. You can use the query params to filter your results. * * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listBuckets(queries?: string[], search?: string): Promise; + listBuckets(queries?: string[], search?: string, total?: boolean): Promise; listBuckets( - paramsOrFirst?: { queries?: string[], search?: string } | string[], - ...rest: [(string)?] + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] ): Promise { - let params: { queries?: string[], search?: string }; + let params: { queries?: string[], search?: string, total?: boolean }; if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string }; + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; } else { params = { queries: paramsOrFirst as string[], - search: rest[0] as string + search: rest[0] as string, + total: rest[1] as boolean }; } const queries = params.queries; const search = params.search; + const total = params.total; const apiPath = '/storage/buckets'; @@ -58,6 +62,9 @@ export class Storage { if (typeof search !== 'undefined') { payload['search'] = search; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -421,40 +428,44 @@ export class Storage { * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listFiles(params: { bucketId: string, queries?: string[], search?: string }): Promise; + listFiles(params: { bucketId: string, queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all the user files. You can use the query params to filter your results. * * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listFiles(bucketId: string, queries?: string[], search?: string): Promise; + listFiles(bucketId: string, queries?: string[], search?: string, total?: boolean): Promise; listFiles( - paramsOrFirst: { bucketId: string, queries?: string[], search?: string } | string, - ...rest: [(string[])?, (string)?] + paramsOrFirst: { bucketId: string, queries?: string[], search?: string, total?: boolean } | string, + ...rest: [(string[])?, (string)?, (boolean)?] ): Promise { - let params: { bucketId: string, queries?: string[], search?: string }; + let params: { bucketId: string, queries?: string[], search?: string, total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, queries?: string[], search?: string }; + params = (paramsOrFirst || {}) as { bucketId: string, queries?: string[], search?: string, total?: boolean }; } else { params = { bucketId: paramsOrFirst as string, queries: rest[0] as string[], - search: rest[1] as string + search: rest[1] as string, + total: rest[2] as boolean }; } const bucketId = params.bucketId; const queries = params.queries; const search = params.search; + const total = params.total; if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); @@ -468,6 +479,9 @@ export class Storage { if (typeof search !== 'undefined') { payload['search'] = search; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index e2c9c4a..e63cb91 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -17,37 +17,41 @@ export class TablesDB { * * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following columns: name * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - list(params?: { queries?: string[], search?: string }): Promise; + list(params?: { queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. * * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following columns: name * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - list(queries?: string[], search?: string): Promise; + list(queries?: string[], search?: string, total?: boolean): Promise; list( - paramsOrFirst?: { queries?: string[], search?: string } | string[], - ...rest: [(string)?] + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] ): Promise { - let params: { queries?: string[], search?: string }; + let params: { queries?: string[], search?: string, total?: boolean }; if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string }; + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; } else { params = { queries: paramsOrFirst as string[], - search: rest[0] as string + search: rest[0] as string, + total: rest[1] as boolean }; } const queries = params.queries; const search = params.search; + const total = params.total; const apiPath = '/tablesdb'; @@ -58,6 +62,9 @@ export class TablesDB { if (typeof search !== 'undefined') { payload['search'] = search; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -658,40 +665,44 @@ export class TablesDB { * @param {string} params.databaseId - Database ID. * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following columns: name, enabled, rowSecurity * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listTables(params: { databaseId: string, queries?: string[], search?: string }): Promise; + listTables(params: { databaseId: string, queries?: string[], search?: string, total?: boolean }): Promise; /** * Get a list of all tables that belong to the provided databaseId. You can use the search parameter to filter your results. * * @param {string} databaseId - Database ID. * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following columns: name, enabled, rowSecurity * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listTables(databaseId: string, queries?: string[], search?: string): Promise; + listTables(databaseId: string, queries?: string[], search?: string, total?: boolean): Promise; listTables( - paramsOrFirst: { databaseId: string, queries?: string[], search?: string } | string, - ...rest: [(string[])?, (string)?] + paramsOrFirst: { databaseId: string, queries?: string[], search?: string, total?: boolean } | string, + ...rest: [(string[])?, (string)?, (boolean)?] ): Promise { - let params: { databaseId: string, queries?: string[], search?: string }; + let params: { databaseId: string, queries?: string[], search?: string, total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, queries?: string[], search?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, queries?: string[], search?: string, total?: boolean }; } else { params = { databaseId: paramsOrFirst as string, queries: rest[0] as string[], - search: rest[1] as string + search: rest[1] as string, + total: rest[2] as boolean }; } const databaseId = params.databaseId; const queries = params.queries; const search = params.search; + const total = params.total; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -705,6 +716,9 @@ export class TablesDB { if (typeof search !== 'undefined') { payload['search'] = search; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1028,40 +1042,44 @@ export class TablesDB { * @param {string} params.databaseId - Database ID. * @param {string} params.tableId - Table ID. * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following columns: key, type, size, required, array, status, error + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listColumns(params: { databaseId: string, tableId: string, queries?: string[] }): Promise; + listColumns(params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }): Promise; /** * List columns in the table. * * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following columns: key, type, size, required, array, status, error + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listColumns(databaseId: string, tableId: string, queries?: string[]): Promise; + listColumns(databaseId: string, tableId: string, queries?: string[], total?: boolean): Promise; listColumns( - paramsOrFirst: { databaseId: string, tableId: string, queries?: string[] } | string, - ...rest: [(string)?, (string[])?] + paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string)?, (string[])?, (boolean)?] ): Promise { - let params: { databaseId: string, tableId: string, queries?: string[] }; + let params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[] }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], total?: boolean }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, - queries: rest[1] as string[] + queries: rest[1] as string[], + total: rest[2] as boolean }; } const databaseId = params.databaseId; const tableId = params.tableId; const queries = params.queries; + const total = params.total; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -1075,6 +1093,9 @@ export class TablesDB { if (typeof queries !== 'undefined') { payload['queries'] = queries; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -3774,40 +3795,44 @@ export class TablesDB { * @param {string} params.databaseId - Database ID. * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following columns: key, type, status, attributes, error + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listIndexes(params: { databaseId: string, tableId: string, queries?: string[] }): Promise; + listIndexes(params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }): Promise; /** * List indexes on the table. * * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following columns: key, type, status, attributes, error + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listIndexes(databaseId: string, tableId: string, queries?: string[]): Promise; + listIndexes(databaseId: string, tableId: string, queries?: string[], total?: boolean): Promise; listIndexes( - paramsOrFirst: { databaseId: string, tableId: string, queries?: string[] } | string, - ...rest: [(string)?, (string[])?] + paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string)?, (string[])?, (boolean)?] ): Promise { - let params: { databaseId: string, tableId: string, queries?: string[] }; + let params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[] }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], total?: boolean }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, - queries: rest[1] as string[] + queries: rest[1] as string[], + total: rest[2] as boolean }; } const databaseId = params.databaseId; const tableId = params.tableId; const queries = params.queries; + const total = params.total; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -3821,6 +3846,9 @@ export class TablesDB { if (typeof queries !== 'undefined') { payload['queries'] = queries; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -4080,10 +4108,11 @@ export class TablesDB { * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table). * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise>} */ - listRows(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string }): Promise>; + listRows(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean }): Promise>; /** * Get a list of all the user's rows in a given table. You can use the query params to filter your results. * @@ -4091,25 +4120,27 @@ export class TablesDB { * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table). * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - listRows(databaseId: string, tableId: string, queries?: string[], transactionId?: string): Promise>; + listRows(databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean): Promise>; listRows( - paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string[])?, (string)?] + paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean } | string, + ...rest: [(string)?, (string[])?, (string)?, (boolean)?] ): Promise> { - let params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string }; + let params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], transactionId?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, queries: rest[1] as string[], - transactionId: rest[2] as string + transactionId: rest[2] as string, + total: rest[3] as boolean }; } @@ -4117,6 +4148,7 @@ export class TablesDB { const tableId = params.tableId; const queries = params.queries; const transactionId = params.transactionId; + const total = params.total; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -4133,6 +4165,9 @@ export class TablesDB { if (typeof transactionId !== 'undefined') { payload['transactionId'] = transactionId; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/teams.ts b/src/services/teams.ts index 5db95e1..fe82b2f 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -14,37 +14,41 @@ export class Teams { * * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, total, billingPlan * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise>} */ - list(params?: { queries?: string[], search?: string }): Promise>; + list(params?: { queries?: string[], search?: string, total?: boolean }): Promise>; /** * Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results. * * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, total, billingPlan * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - list(queries?: string[], search?: string): Promise>; + list(queries?: string[], search?: string, total?: boolean): Promise>; list( - paramsOrFirst?: { queries?: string[], search?: string } | string[], - ...rest: [(string)?] + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] ): Promise> { - let params: { queries?: string[], search?: string }; + let params: { queries?: string[], search?: string, total?: boolean }; if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string }; + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; } else { params = { queries: paramsOrFirst as string[], - search: rest[0] as string + search: rest[0] as string, + total: rest[1] as boolean }; } const queries = params.queries; const search = params.search; + const total = params.total; const apiPath = '/teams'; @@ -55,6 +59,9 @@ export class Teams { if (typeof search !== 'undefined') { payload['search'] = search; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -313,40 +320,44 @@ export class Teams { * @param {string} params.teamId - Team ID. * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, teamId, invited, joined, confirm, roles * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listMemberships(params: { teamId: string, queries?: string[], search?: string }): Promise; + listMemberships(params: { teamId: string, queries?: string[], search?: string, total?: boolean }): Promise; /** * Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console. * * @param {string} teamId - Team ID. * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, teamId, invited, joined, confirm, roles * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listMemberships(teamId: string, queries?: string[], search?: string): Promise; + listMemberships(teamId: string, queries?: string[], search?: string, total?: boolean): Promise; listMemberships( - paramsOrFirst: { teamId: string, queries?: string[], search?: string } | string, - ...rest: [(string[])?, (string)?] + paramsOrFirst: { teamId: string, queries?: string[], search?: string, total?: boolean } | string, + ...rest: [(string[])?, (string)?, (boolean)?] ): Promise { - let params: { teamId: string, queries?: string[], search?: string }; + let params: { teamId: string, queries?: string[], search?: string, total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, queries?: string[], search?: string }; + params = (paramsOrFirst || {}) as { teamId: string, queries?: string[], search?: string, total?: boolean }; } else { params = { teamId: paramsOrFirst as string, queries: rest[0] as string[], - search: rest[1] as string + search: rest[1] as string, + total: rest[2] as boolean }; } const teamId = params.teamId; const queries = params.queries; const search = params.search; + const total = params.total; if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); @@ -360,6 +371,9 @@ export class Teams { if (typeof search !== 'undefined') { payload['search'] = search; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/tokens.ts b/src/services/tokens.ts index f021a0c..89fd73d 100644 --- a/src/services/tokens.ts +++ b/src/services/tokens.ts @@ -15,40 +15,44 @@ export class Tokens { * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). * @param {string} params.fileId - File unique ID. * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: expire + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - list(params: { bucketId: string, fileId: string, queries?: string[] }): Promise; + list(params: { bucketId: string, fileId: string, queries?: string[], total?: boolean }): Promise; /** * List all the tokens created for a specific file or bucket. You can use the query params to filter your results. * * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). * @param {string} fileId - File unique ID. * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: expire + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - list(bucketId: string, fileId: string, queries?: string[]): Promise; + list(bucketId: string, fileId: string, queries?: string[], total?: boolean): Promise; list( - paramsOrFirst: { bucketId: string, fileId: string, queries?: string[] } | string, - ...rest: [(string)?, (string[])?] + paramsOrFirst: { bucketId: string, fileId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string)?, (string[])?, (boolean)?] ): Promise { - let params: { bucketId: string, fileId: string, queries?: string[] }; + let params: { bucketId: string, fileId: string, queries?: string[], total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, queries?: string[] }; + params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, queries?: string[], total?: boolean }; } else { params = { bucketId: paramsOrFirst as string, fileId: rest[0] as string, - queries: rest[1] as string[] + queries: rest[1] as string[], + total: rest[2] as boolean }; } const bucketId = params.bucketId; const fileId = params.fileId; const queries = params.queries; + const total = params.total; if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); @@ -62,6 +66,9 @@ export class Tokens { if (typeof queries !== 'undefined') { payload['queries'] = queries; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/users.ts b/src/services/users.ts index eddfa40..29cb089 100644 --- a/src/services/users.ts +++ b/src/services/users.ts @@ -17,37 +17,41 @@ export class Users { * * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise>} */ - list(params?: { queries?: string[], search?: string }): Promise>; + list(params?: { queries?: string[], search?: string, total?: boolean }): Promise>; /** * Get a list of all the project's users. You can use the query params to filter your results. * * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - list(queries?: string[], search?: string): Promise>; + list(queries?: string[], search?: string, total?: boolean): Promise>; list( - paramsOrFirst?: { queries?: string[], search?: string } | string[], - ...rest: [(string)?] + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] ): Promise> { - let params: { queries?: string[], search?: string }; + let params: { queries?: string[], search?: string, total?: boolean }; if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string }; + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; } else { params = { queries: paramsOrFirst as string[], - search: rest[0] as string + search: rest[0] as string, + total: rest[1] as boolean }; } const queries = params.queries; const search = params.search; + const total = params.total; const apiPath = '/users'; @@ -58,6 +62,9 @@ export class Users { if (typeof search !== 'undefined') { payload['search'] = search; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -326,37 +333,41 @@ export class Users { * * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listIdentities(params?: { queries?: string[], search?: string }): Promise; + listIdentities(params?: { queries?: string[], search?: string, total?: boolean }): Promise; /** * Get identities for all users. * * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listIdentities(queries?: string[], search?: string): Promise; + listIdentities(queries?: string[], search?: string, total?: boolean): Promise; listIdentities( - paramsOrFirst?: { queries?: string[], search?: string } | string[], - ...rest: [(string)?] + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] ): Promise { - let params: { queries?: string[], search?: string }; + let params: { queries?: string[], search?: string, total?: boolean }; if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string }; + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; } else { params = { queries: paramsOrFirst as string[], - search: rest[0] as string + search: rest[0] as string, + total: rest[1] as boolean }; } const queries = params.queries; const search = params.search; + const total = params.total; const apiPath = '/users/identities'; @@ -367,6 +378,9 @@ export class Users { if (typeof search !== 'undefined') { payload['search'] = search; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1239,37 +1253,41 @@ export class Users { * * @param {string} params.userId - User ID. * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listLogs(params: { userId: string, queries?: string[] }): Promise; + listLogs(params: { userId: string, queries?: string[], total?: boolean }): Promise; /** * Get the user activity logs list by its unique ID. * * @param {string} userId - User ID. * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listLogs(userId: string, queries?: string[]): Promise; + listLogs(userId: string, queries?: string[], total?: boolean): Promise; listLogs( - paramsOrFirst: { userId: string, queries?: string[] } | string, - ...rest: [(string[])?] + paramsOrFirst: { userId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] ): Promise { - let params: { userId: string, queries?: string[] }; + let params: { userId: string, queries?: string[], total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, queries?: string[] }; + params = (paramsOrFirst || {}) as { userId: string, queries?: string[], total?: boolean }; } else { params = { userId: paramsOrFirst as string, - queries: rest[0] as string[] + queries: rest[0] as string[], + total: rest[1] as boolean }; } const userId = params.userId; const queries = params.queries; + const total = params.total; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -1280,6 +1298,9 @@ export class Users { if (typeof queries !== 'undefined') { payload['queries'] = queries; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1299,40 +1320,44 @@ export class Users { * @param {string} params.userId - User ID. * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, teamId, invited, joined, confirm, roles * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listMemberships(params: { userId: string, queries?: string[], search?: string }): Promise; + listMemberships(params: { userId: string, queries?: string[], search?: string, total?: boolean }): Promise; /** * Get the user membership list by its unique ID. * * @param {string} userId - User ID. * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, teamId, invited, joined, confirm, roles * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listMemberships(userId: string, queries?: string[], search?: string): Promise; + listMemberships(userId: string, queries?: string[], search?: string, total?: boolean): Promise; listMemberships( - paramsOrFirst: { userId: string, queries?: string[], search?: string } | string, - ...rest: [(string[])?, (string)?] + paramsOrFirst: { userId: string, queries?: string[], search?: string, total?: boolean } | string, + ...rest: [(string[])?, (string)?, (boolean)?] ): Promise { - let params: { userId: string, queries?: string[], search?: string }; + let params: { userId: string, queries?: string[], search?: string, total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, queries?: string[], search?: string }; + params = (paramsOrFirst || {}) as { userId: string, queries?: string[], search?: string, total?: boolean }; } else { params = { userId: paramsOrFirst as string, queries: rest[0] as string[], - search: rest[1] as string + search: rest[1] as string, + total: rest[2] as boolean }; } const userId = params.userId; const queries = params.queries; const search = params.search; + const total = params.total; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -1346,6 +1371,9 @@ export class Users { if (typeof search !== 'undefined') { payload['search'] = search; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -2330,33 +2358,38 @@ export class Users { * Get the user sessions list by its unique ID. * * @param {string} params.userId - User ID. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listSessions(params: { userId: string }): Promise; + listSessions(params: { userId: string, total?: boolean }): Promise; /** * Get the user sessions list by its unique ID. * * @param {string} userId - User ID. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listSessions(userId: string): Promise; + listSessions(userId: string, total?: boolean): Promise; listSessions( - paramsOrFirst: { userId: string } | string + paramsOrFirst: { userId: string, total?: boolean } | string, + ...rest: [(boolean)?] ): Promise { - let params: { userId: string }; + let params: { userId: string, total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; + params = (paramsOrFirst || {}) as { userId: string, total?: boolean }; } else { params = { - userId: paramsOrFirst as string + userId: paramsOrFirst as string, + total: rest[0] as boolean }; } const userId = params.userId; + const total = params.total; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -2364,6 +2397,9 @@ export class Users { const apiPath = '/users/{userId}/sessions'.replace('{userId}', userId); const payload: Payload = {}; + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -2613,37 +2649,41 @@ export class Users { * * @param {string} params.userId - User ID. * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, providerId, identifier, providerType + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listTargets(params: { userId: string, queries?: string[] }): Promise; + listTargets(params: { userId: string, queries?: string[], total?: boolean }): Promise; /** * List the messaging targets that are associated with a user. * * @param {string} userId - User ID. * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, providerId, identifier, providerType + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listTargets(userId: string, queries?: string[]): Promise; + listTargets(userId: string, queries?: string[], total?: boolean): Promise; listTargets( - paramsOrFirst: { userId: string, queries?: string[] } | string, - ...rest: [(string[])?] + paramsOrFirst: { userId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] ): Promise { - let params: { userId: string, queries?: string[] }; + let params: { userId: string, queries?: string[], total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, queries?: string[] }; + params = (paramsOrFirst || {}) as { userId: string, queries?: string[], total?: boolean }; } else { params = { userId: paramsOrFirst as string, - queries: rest[0] as string[] + queries: rest[0] as string[], + total: rest[1] as boolean }; } const userId = params.userId; const queries = params.queries; + const total = params.total; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -2654,6 +2694,9 @@ export class Users { if (typeof queries !== 'undefined') { payload['queries'] = queries; } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { From 3df38a7149723538a9d3abd3035ba5326c59a54a Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 3 Nov 2025 17:38:11 +1300 Subject: [PATCH 2/2] Update changelogs --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a76aa98..419b052 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance * Add `Operator` class for atomic modification of rows via update, bulk update, upsert, and bulk upsert operations +* Add `createResendProvider` and `updateResendProvider` methods to `Messaging` service ## 20.2.1