diff --git a/CHANGELOG.md b/CHANGELOG.md
index 90b3a91..83ed257 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
# Change Log
+## 21.4.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
+
## 21.3.0
* Add new `Realtime` service with methods for subscribing to channels and receiving messages
diff --git a/README.md b/README.md
index 0374158..a2f30ce 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,7 @@ import { Client, Account } from "appwrite";
To install with a CDN (content delivery network) add the following scripts to the bottom of your
tag, but before you use any Appwrite services:
```html
-
+
```
diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md
index 28cc409..22858c2 100644
--- a/docs/examples/account/list-identities.md
+++ b/docs/examples/account/list-identities.md
@@ -7,7 +7,8 @@ const client = new Client()
const account = new Account(client);
const result = await account.listIdentities({
- queries: [] // optional
+ queries: [], // optional
+ total: false // optional
});
console.log(result);
diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md
index ec763f9..3dc4f4d 100644
--- a/docs/examples/account/list-logs.md
+++ b/docs/examples/account/list-logs.md
@@ -7,7 +7,8 @@ const client = new Client()
const account = new Account(client);
const result = await account.listLogs({
- queries: [] // optional
+ queries: [], // optional
+ total: false // optional
});
console.log(result);
diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md
index 8417575..8c1b0ec 100644
--- a/docs/examples/databases/create-document.md
+++ b/docs/examples/databases/create-document.md
@@ -1,4 +1,4 @@
-import { Client, Databases } from "appwrite";
+import { Client, Databases, Permission, Role } from "appwrite";
const client = new Client()
.setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
@@ -17,7 +17,7 @@ const result = await databases.createDocument({
"age": 30,
"isAdmin": false
},
- permissions: ["read("any")"], // optional
+ permissions: [Permission.read(Role.any())], // optional
transactionId: '' // optional
});
diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md
index ece656a..a566c1e 100644
--- a/docs/examples/databases/list-documents.md
+++ b/docs/examples/databases/list-documents.md
@@ -10,7 +10,8 @@ const result = await databases.listDocuments({
databaseId: '',
collectionId: '',
queries: [], // optional
- transactionId: '' // optional
+ transactionId: '', // optional
+ total: false // optional
});
console.log(result);
diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md
index 33a6d73..b5d90fd 100644
--- a/docs/examples/databases/update-document.md
+++ b/docs/examples/databases/update-document.md
@@ -1,4 +1,4 @@
-import { Client, Databases } from "appwrite";
+import { Client, Databases, Permission, Role } from "appwrite";
const client = new Client()
.setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
@@ -11,7 +11,7 @@ const result = await databases.updateDocument({
collectionId: '',
documentId: '',
data: {}, // optional
- permissions: ["read("any")"], // optional
+ permissions: [Permission.read(Role.any())], // optional
transactionId: '' // optional
});
diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md
index e14ad5f..7af42d6 100644
--- a/docs/examples/databases/upsert-document.md
+++ b/docs/examples/databases/upsert-document.md
@@ -1,4 +1,4 @@
-import { Client, Databases } from "appwrite";
+import { Client, Databases, Permission, Role } from "appwrite";
const client = new Client()
.setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
@@ -11,7 +11,7 @@ const result = await databases.upsertDocument({
collectionId: '',
documentId: '',
data: {},
- permissions: ["read("any")"], // optional
+ permissions: [Permission.read(Role.any())], // optional
transactionId: '' // optional
});
diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md
index 159882c..daddf56 100644
--- a/docs/examples/functions/list-executions.md
+++ b/docs/examples/functions/list-executions.md
@@ -8,7 +8,8 @@ const functions = new Functions(client);
const result = await functions.listExecutions({
functionId: '',
- queries: [] // optional
+ queries: [], // optional
+ total: false // optional
});
console.log(result);
diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md
index 999fcb2..565f6ee 100644
--- a/docs/examples/storage/create-file.md
+++ b/docs/examples/storage/create-file.md
@@ -1,4 +1,4 @@
-import { Client, Storage } from "appwrite";
+import { Client, Storage, Permission, Role } from "appwrite";
const client = new Client()
.setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
@@ -10,7 +10,7 @@ const result = await storage.createFile({
bucketId: '',
fileId: '',
file: document.getElementById('uploader').files[0],
- permissions: ["read("any")"] // optional
+ permissions: [Permission.read(Role.any())] // optional
});
console.log(result);
diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md
index 154212d..70bc0e0 100644
--- a/docs/examples/storage/list-files.md
+++ b/docs/examples/storage/list-files.md
@@ -9,7 +9,8 @@ const storage = new Storage(client);
const result = await storage.listFiles({
bucketId: '',
queries: [], // optional
- search: '' // optional
+ search: '', // optional
+ total: false // optional
});
console.log(result);
diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md
index 96e1dc5..1f1c460 100644
--- a/docs/examples/storage/update-file.md
+++ b/docs/examples/storage/update-file.md
@@ -1,4 +1,4 @@
-import { Client, Storage } from "appwrite";
+import { Client, Storage, Permission, Role } from "appwrite";
const client = new Client()
.setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
@@ -10,7 +10,7 @@ const result = await storage.updateFile({
bucketId: '',
fileId: '',
name: '', // optional
- permissions: ["read("any")"] // optional
+ permissions: [Permission.read(Role.any())] // optional
});
console.log(result);
diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md
index 3bbcf89..2f786b7 100644
--- a/docs/examples/tablesdb/create-row.md
+++ b/docs/examples/tablesdb/create-row.md
@@ -1,4 +1,4 @@
-import { Client, TablesDB } from "appwrite";
+import { Client, TablesDB, Permission, Role } from "appwrite";
const client = new Client()
.setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
@@ -17,7 +17,7 @@ const result = await tablesDB.createRow({
"age": 30,
"isAdmin": false
},
- permissions: ["read("any")"], // optional
+ permissions: [Permission.read(Role.any())], // optional
transactionId: '' // optional
});
diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md
index c0efd84..8b1120c 100644
--- a/docs/examples/tablesdb/list-rows.md
+++ b/docs/examples/tablesdb/list-rows.md
@@ -10,7 +10,8 @@ const result = await tablesDB.listRows({
databaseId: '',
tableId: '',
queries: [], // optional
- transactionId: '' // optional
+ transactionId: '', // optional
+ total: false // optional
});
console.log(result);
diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md
index ecbcd4f..cda74ed 100644
--- a/docs/examples/tablesdb/update-row.md
+++ b/docs/examples/tablesdb/update-row.md
@@ -1,4 +1,4 @@
-import { Client, TablesDB } from "appwrite";
+import { Client, TablesDB, Permission, Role } from "appwrite";
const client = new Client()
.setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
@@ -11,7 +11,7 @@ const result = await tablesDB.updateRow({
tableId: '',
rowId: '',
data: {}, // optional
- permissions: ["read("any")"], // optional
+ permissions: [Permission.read(Role.any())], // optional
transactionId: '' // optional
});
diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md
index ddac9ff..c0cb973 100644
--- a/docs/examples/tablesdb/upsert-row.md
+++ b/docs/examples/tablesdb/upsert-row.md
@@ -1,4 +1,4 @@
-import { Client, TablesDB } from "appwrite";
+import { Client, TablesDB, Permission, Role } from "appwrite";
const client = new Client()
.setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint
@@ -11,7 +11,7 @@ const result = await tablesDB.upsertRow({
tableId: '',
rowId: '',
data: {}, // optional
- permissions: ["read("any")"], // optional
+ permissions: [Permission.read(Role.any())], // optional
transactionId: '' // optional
});
diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md
index d4e3420..588995b 100644
--- a/docs/examples/teams/list-memberships.md
+++ b/docs/examples/teams/list-memberships.md
@@ -9,7 +9,8 @@ const teams = new Teams(client);
const result = await teams.listMemberships({
teamId: '',
queries: [], // optional
- search: '' // optional
+ search: '', // optional
+ total: false // optional
});
console.log(result);
diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md
index df57f25..f18f5ba 100644
--- a/docs/examples/teams/list.md
+++ b/docs/examples/teams/list.md
@@ -8,7 +8,8 @@ const teams = new Teams(client);
const result = await teams.list({
queries: [], // optional
- search: '' // optional
+ search: '', // optional
+ total: false // optional
});
console.log(result);
diff --git a/package.json b/package.json
index a37763b..cea2835 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "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": "21.3.0",
+ "version": "21.4.0",
"license": "BSD-3-Clause",
"main": "dist/cjs/sdk.js",
"exports": {
diff --git a/src/client.ts b/src/client.ts
index afa25ba..80876e7 100644
--- a/src/client.ts
+++ b/src/client.ts
@@ -320,7 +320,7 @@ class Client {
'x-sdk-name': 'Web',
'x-sdk-platform': 'client',
'x-sdk-language': 'web',
- 'x-sdk-version': '21.3.0',
+ 'x-sdk-version': '21.4.0',
'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/index.ts b/src/index.ts
index d6b8acd..c44f3c3 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -22,6 +22,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';
@@ -31,3 +32,5 @@ export { Flag } from './enums/flag';
export { ExecutionMethod } from './enums/execution-method';
export { ImageGravity } from './enums/image-gravity';
export { ImageFormat } from './enums/image-format';
+export { ExecutionTrigger } from './enums/execution-trigger';
+export { ExecutionStatus } from './enums/execution-status';
diff --git a/src/models.ts b/src/models.ts
index d0c2d2a..945404d 100644
--- a/src/models.ts
+++ b/src/models.ts
@@ -1030,7 +1030,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 8495d9d..1d209b8 100644
--- a/src/services/account.ts
+++ b/src/services/account.ts
@@ -193,33 +193,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';
@@ -227,6 +232,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 } = {
@@ -320,33 +328,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';
@@ -354,6 +367,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 fc48bbf..bb0286b 100644
--- a/src/services/databases.ts
+++ b/src/services/databases.ts
@@ -350,11 +350,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.
*
@@ -362,25 +363,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
};
}
@@ -388,6 +391,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"');
@@ -404,6 +408,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 } = {
diff --git a/src/services/functions.ts b/src/services/functions.ts
index cee3d5a..d6c47b3 100644
--- a/src/services/functions.ts
+++ b/src/services/functions.ts
@@ -16,37 +16,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"');
@@ -57,6 +61,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/storage.ts b/src/services/storage.ts
index c0b6ac6..6074eca 100644
--- a/src/services/storage.ts
+++ b/src/services/storage.ts
@@ -18,40 +18,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"');
@@ -65,6 +69,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 53d86d3..5e7bd62 100644
--- a/src/services/tables-db.ts
+++ b/src/services/tables-db.ts
@@ -350,10 +350,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.
*
@@ -361,25 +362,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
};
}
@@ -387,6 +390,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"');
@@ -403,6 +407,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 01fe8a1..06b4bc4 100644
--- a/src/services/teams.ts
+++ b/src/services/teams.ts
@@ -15,37 +15,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';
@@ -56,6 +60,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 } = {
@@ -314,40 +321,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"');
@@ -361,6 +372,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 } = {