diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e5e810..6e8d4d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 17.5.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 +* Add `createResendProvider` and `updateResendProvider` methods to `Messaging` service + ## 17.4.1 * Add transaction support for Databases and TablesDB diff --git a/docs/account.md b/docs/account.md index 4007dd3..bad4bab 100644 --- a/docs/account.md +++ b/docs/account.md @@ -51,6 +51,7 @@ GET https://cloud.appwrite.io/v1/account/identities | Field Name | Type | Description | Default | | --- | --- | --- | --- | | queries | array | 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 | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -84,6 +85,7 @@ GET https://cloud.appwrite.io/v1/account/logs | Field Name | Type | Description | Default | | --- | --- | --- | --- | | queries | array | 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 | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request diff --git a/docs/databases.md b/docs/databases.md index 35d4e4d..c1ae38e 100644 --- a/docs/databases.md +++ b/docs/databases.md @@ -13,6 +13,7 @@ GET https://cloud.appwrite.io/v1/databases | --- | --- | --- | --- | | queries | array | 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 | [] | | search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -166,6 +167,7 @@ GET https://cloud.appwrite.io/v1/databases/{databaseId}/collections | databaseId | string | **Required** Database ID. | | | queries | array | 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 | [] | | search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -245,6 +247,7 @@ GET https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionI | databaseId | string | **Required** Database ID. | | | collectionId | string | **Required** Collection ID. | | | queries | array | 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 | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -787,6 +790,7 @@ GET https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionI | collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | | queries | array | 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. | [] | | transactionId | string | Transaction ID to read uncommitted changes within the transaction. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -993,6 +997,7 @@ GET https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionI | databaseId | string | **Required** Database ID. | | | collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | | queries | array | 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 | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md index a7d0a85..b75a64c 100644 --- a/docs/examples/account/list-identities.md +++ b/docs/examples/account/list-identities.md @@ -11,5 +11,6 @@ $client = (new Client()) $account = new Account($client); $result = $account->listIdentities( - queries: [] // optional + queries: [], // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md index cc7a173..deddc9e 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -11,5 +11,6 @@ $client = (new Client()) $account = new Account($client); $result = $account->listLogs( - queries: [] // optional + queries: [], // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md index 700d971..9ac9e36 100644 --- a/docs/examples/databases/create-collection.md +++ b/docs/examples/databases/create-collection.md @@ -2,6 +2,8 @@ use Appwrite\Client; use Appwrite\Services\Databases; +use Appwrite\Permission; +use Appwrite\Role; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -14,7 +16,7 @@ $result = $databases->createCollection( databaseId: '', collectionId: '', name: '', - permissions: ["read("any")"], // optional + permissions: [Permission::read(Role::any())], // optional documentSecurity: false, // optional enabled: false // optional ); \ No newline at end of file diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 19d3cfb..39fb26f 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -2,6 +2,8 @@ use Appwrite\Client; use Appwrite\Services\Databases; +use Appwrite\Permission; +use Appwrite\Role; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -21,6 +23,6 @@ $result = $databases->createDocument( 'age' => 30, 'isAdmin' => false ], - permissions: ["read("any")"], // optional + permissions: [Permission::read(Role::any())], // optional transactionId: '' // optional ); \ No newline at end of file diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md index 3105fc4..e770292 100644 --- a/docs/examples/databases/list-attributes.md +++ b/docs/examples/databases/list-attributes.md @@ -13,5 +13,6 @@ $databases = new Databases($client); $result = $databases->listAttributes( databaseId: '', collectionId: '', - queries: [] // optional + queries: [], // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md index 533b26a..c71866b 100644 --- a/docs/examples/databases/list-collections.md +++ b/docs/examples/databases/list-collections.md @@ -13,5 +13,6 @@ $databases = new Databases($client); $result = $databases->listCollections( databaseId: '', queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index 10dcc82..8713327 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -14,5 +14,6 @@ $result = $databases->listDocuments( databaseId: '', collectionId: '', queries: [], // optional - transactionId: '' // optional + transactionId: '', // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md index 65b45da..a26ff7c 100644 --- a/docs/examples/databases/list-indexes.md +++ b/docs/examples/databases/list-indexes.md @@ -13,5 +13,6 @@ $databases = new Databases($client); $result = $databases->listIndexes( databaseId: '', collectionId: '', - queries: [] // optional + queries: [], // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md index 6bba74d..f5baccc 100644 --- a/docs/examples/databases/list.md +++ b/docs/examples/databases/list.md @@ -12,5 +12,6 @@ $databases = new Databases($client); $result = $databases->list( queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md index dd030c0..d37f6e2 100644 --- a/docs/examples/databases/update-collection.md +++ b/docs/examples/databases/update-collection.md @@ -2,6 +2,8 @@ use Appwrite\Client; use Appwrite\Services\Databases; +use Appwrite\Permission; +use Appwrite\Role; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -14,7 +16,7 @@ $result = $databases->updateCollection( databaseId: '', collectionId: '', name: '', - permissions: ["read("any")"], // optional + permissions: [Permission::read(Role::any())], // optional documentSecurity: false, // optional enabled: false // optional ); \ No newline at end of file diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index d903252..2aaada2 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -2,6 +2,8 @@ use Appwrite\Client; use Appwrite\Services\Databases; +use Appwrite\Permission; +use Appwrite\Role; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -15,6 +17,6 @@ $result = $databases->updateDocument( collectionId: '', documentId: '', data: [], // optional - permissions: ["read("any")"], // optional + permissions: [Permission::read(Role::any())], // optional transactionId: '' // optional ); \ No newline at end of file diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md index 6db7462..8e9d2c9 100644 --- a/docs/examples/databases/upsert-document.md +++ b/docs/examples/databases/upsert-document.md @@ -2,6 +2,8 @@ use Appwrite\Client; use Appwrite\Services\Databases; +use Appwrite\Permission; +use Appwrite\Role; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -15,6 +17,6 @@ $result = $databases->upsertDocument( collectionId: '', documentId: '', data: [], - permissions: ["read("any")"], // optional + permissions: [Permission::read(Role::any())], // optional transactionId: '' // optional ); \ No newline at end of file diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md index 7bbaa0e..bf90318 100644 --- a/docs/examples/functions/list-deployments.md +++ b/docs/examples/functions/list-deployments.md @@ -13,5 +13,6 @@ $functions = new Functions($client); $result = $functions->listDeployments( functionId: '', queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index 77a8ba7..4a7c79c 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -12,5 +12,6 @@ $functions = new Functions($client); $result = $functions->listExecutions( functionId: '', - queries: [] // optional + queries: [], // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md index de914af..1646a06 100644 --- a/docs/examples/functions/list.md +++ b/docs/examples/functions/list.md @@ -12,5 +12,6 @@ $functions = new Functions($client); $result = $functions->list( queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/messaging/create-resend-provider.md b/docs/examples/messaging/create-resend-provider.md new file mode 100644 index 0000000..e66b0b8 --- /dev/null +++ b/docs/examples/messaging/create-resend-provider.md @@ -0,0 +1,22 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createResendProvider( + providerId: '', + name: '', + apiKey: '', // optional + fromName: '', // optional + fromEmail: 'email@example.com', // optional + replyToName: '', // optional + replyToEmail: 'email@example.com', // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md index 0323137..4e0ab3e 100644 --- a/docs/examples/messaging/list-message-logs.md +++ b/docs/examples/messaging/list-message-logs.md @@ -12,5 +12,6 @@ $messaging = new Messaging($client); $result = $messaging->listMessageLogs( messageId: '', - queries: [] // optional + queries: [], // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md index 965fe08..d66c64f 100644 --- a/docs/examples/messaging/list-messages.md +++ b/docs/examples/messaging/list-messages.md @@ -12,5 +12,6 @@ $messaging = new Messaging($client); $result = $messaging->listMessages( queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md index 761bb96..8c8d7f1 100644 --- a/docs/examples/messaging/list-provider-logs.md +++ b/docs/examples/messaging/list-provider-logs.md @@ -12,5 +12,6 @@ $messaging = new Messaging($client); $result = $messaging->listProviderLogs( providerId: '', - queries: [] // optional + queries: [], // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md index 614e9c5..da0910e 100644 --- a/docs/examples/messaging/list-providers.md +++ b/docs/examples/messaging/list-providers.md @@ -12,5 +12,6 @@ $messaging = new Messaging($client); $result = $messaging->listProviders( queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md index c710575..9e453a2 100644 --- a/docs/examples/messaging/list-subscriber-logs.md +++ b/docs/examples/messaging/list-subscriber-logs.md @@ -12,5 +12,6 @@ $messaging = new Messaging($client); $result = $messaging->listSubscriberLogs( subscriberId: '', - queries: [] // optional + queries: [], // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md index d2625cd..f21c788 100644 --- a/docs/examples/messaging/list-subscribers.md +++ b/docs/examples/messaging/list-subscribers.md @@ -13,5 +13,6 @@ $messaging = new Messaging($client); $result = $messaging->listSubscribers( topicId: '', queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md index 1112d28..03ffdbb 100644 --- a/docs/examples/messaging/list-targets.md +++ b/docs/examples/messaging/list-targets.md @@ -12,5 +12,6 @@ $messaging = new Messaging($client); $result = $messaging->listTargets( messageId: '', - queries: [] // optional + queries: [], // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md index 3bbb35a..fae8eec 100644 --- a/docs/examples/messaging/list-topic-logs.md +++ b/docs/examples/messaging/list-topic-logs.md @@ -12,5 +12,6 @@ $messaging = new Messaging($client); $result = $messaging->listTopicLogs( topicId: '', - queries: [] // optional + queries: [], // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md index debb363..b5d4c54 100644 --- a/docs/examples/messaging/list-topics.md +++ b/docs/examples/messaging/list-topics.md @@ -12,5 +12,6 @@ $messaging = new Messaging($client); $result = $messaging->listTopics( queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/messaging/update-resend-provider.md b/docs/examples/messaging/update-resend-provider.md new file mode 100644 index 0000000..b3f1d1f --- /dev/null +++ b/docs/examples/messaging/update-resend-provider.md @@ -0,0 +1,22 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateResendProvider( + providerId: '', + name: '', // optional + enabled: false, // optional + apiKey: '', // optional + fromName: '', // optional + fromEmail: 'email@example.com', // optional + replyToName: '', // optional + replyToEmail: '' // optional +); \ No newline at end of file diff --git a/docs/examples/sites/list-deployments.md b/docs/examples/sites/list-deployments.md index 4d687ec..bb49a5a 100644 --- a/docs/examples/sites/list-deployments.md +++ b/docs/examples/sites/list-deployments.md @@ -13,5 +13,6 @@ $sites = new Sites($client); $result = $sites->listDeployments( siteId: '', queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/sites/list-logs.md b/docs/examples/sites/list-logs.md index 5674e98..3bc4540 100644 --- a/docs/examples/sites/list-logs.md +++ b/docs/examples/sites/list-logs.md @@ -12,5 +12,6 @@ $sites = new Sites($client); $result = $sites->listLogs( siteId: '', - queries: [] // optional + queries: [], // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/sites/list.md b/docs/examples/sites/list.md index 4e16c69..d056e8d 100644 --- a/docs/examples/sites/list.md +++ b/docs/examples/sites/list.md @@ -12,5 +12,6 @@ $sites = new Sites($client); $result = $sites->list( queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md index cd17ffe..2e7cc1d 100644 --- a/docs/examples/storage/create-bucket.md +++ b/docs/examples/storage/create-bucket.md @@ -2,6 +2,8 @@ use Appwrite\Client; use Appwrite\Services\Storage; +use Appwrite\Permission; +use Appwrite\Role; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -13,7 +15,7 @@ $storage = new Storage($client); $result = $storage->createBucket( bucketId: '', name: '', - permissions: ["read("any")"], // optional + permissions: [Permission::read(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 2d13305..33bef04 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -3,6 +3,8 @@ use Appwrite\Client; use Appwrite\InputFile; use Appwrite\Services\Storage; +use Appwrite\Permission; +use Appwrite\Role; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -15,5 +17,5 @@ $result = $storage->createFile( bucketId: '', fileId: '', file: InputFile::withPath('file.png'), - permissions: ["read("any")"] // optional + permissions: [Permission::read(Role::any())] // optional ); \ No newline at end of file diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md index a4538c6..8b84a8b 100644 --- a/docs/examples/storage/list-buckets.md +++ b/docs/examples/storage/list-buckets.md @@ -12,5 +12,6 @@ $storage = new Storage($client); $result = $storage->listBuckets( queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index ede0e7c..309c87c 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -13,5 +13,6 @@ $storage = new Storage($client); $result = $storage->listFiles( bucketId: '', queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md index 1517e36..819798c 100644 --- a/docs/examples/storage/update-bucket.md +++ b/docs/examples/storage/update-bucket.md @@ -2,6 +2,8 @@ use Appwrite\Client; use Appwrite\Services\Storage; +use Appwrite\Permission; +use Appwrite\Role; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -13,7 +15,7 @@ $storage = new Storage($client); $result = $storage->updateBucket( bucketId: '', name: '', - permissions: ["read("any")"], // optional + permissions: [Permission::read(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 7b467ac..fc84f59 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -2,6 +2,8 @@ use Appwrite\Client; use Appwrite\Services\Storage; +use Appwrite\Permission; +use Appwrite\Role; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -14,5 +16,5 @@ $result = $storage->updateFile( bucketId: '', fileId: '', name: '', // optional - permissions: ["read("any")"] // optional + permissions: [Permission::read(Role::any())] // optional ); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md index 873ecaf..70666d5 100644 --- a/docs/examples/tablesdb/create-row.md +++ b/docs/examples/tablesdb/create-row.md @@ -2,6 +2,8 @@ use Appwrite\Client; use Appwrite\Services\TablesDB; +use Appwrite\Permission; +use Appwrite\Role; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -21,6 +23,6 @@ $result = $tablesDB->createRow( 'age' => 30, 'isAdmin' => false ], - permissions: ["read("any")"], // optional + permissions: [Permission::read(Role::any())], // optional transactionId: '' // optional ); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-table.md b/docs/examples/tablesdb/create-table.md index 46cf388..aff821c 100644 --- a/docs/examples/tablesdb/create-table.md +++ b/docs/examples/tablesdb/create-table.md @@ -2,6 +2,8 @@ use Appwrite\Client; use Appwrite\Services\TablesDB; +use Appwrite\Permission; +use Appwrite\Role; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -14,7 +16,7 @@ $result = $tablesDB->createTable( databaseId: '', tableId: '', name: '', - permissions: ["read("any")"], // optional + permissions: [Permission::read(Role::any())], // optional rowSecurity: false, // optional enabled: false // optional ); \ No newline at end of file diff --git a/docs/examples/tablesdb/list-columns.md b/docs/examples/tablesdb/list-columns.md index d12d52d..49b4eba 100644 --- a/docs/examples/tablesdb/list-columns.md +++ b/docs/examples/tablesdb/list-columns.md @@ -13,5 +13,6 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->listColumns( databaseId: '', tableId: '', - queries: [] // optional + queries: [], // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/tablesdb/list-indexes.md b/docs/examples/tablesdb/list-indexes.md index cb51dbb..ac466c7 100644 --- a/docs/examples/tablesdb/list-indexes.md +++ b/docs/examples/tablesdb/list-indexes.md @@ -13,5 +13,6 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->listIndexes( databaseId: '', tableId: '', - queries: [] // optional + queries: [], // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md index 5f8c9aa..cdcc796 100644 --- a/docs/examples/tablesdb/list-rows.md +++ b/docs/examples/tablesdb/list-rows.md @@ -14,5 +14,6 @@ $result = $tablesDB->listRows( databaseId: '', tableId: '', queries: [], // optional - transactionId: '' // optional + transactionId: '', // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/tablesdb/list-tables.md b/docs/examples/tablesdb/list-tables.md index 05f044b..b14e28c 100644 --- a/docs/examples/tablesdb/list-tables.md +++ b/docs/examples/tablesdb/list-tables.md @@ -13,5 +13,6 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->listTables( databaseId: '', queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/tablesdb/list.md b/docs/examples/tablesdb/list.md index c3f97c2..3d74dde 100644 --- a/docs/examples/tablesdb/list.md +++ b/docs/examples/tablesdb/list.md @@ -12,5 +12,6 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->list( queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md index c01eba8..d92ab78 100644 --- a/docs/examples/tablesdb/update-row.md +++ b/docs/examples/tablesdb/update-row.md @@ -2,6 +2,8 @@ use Appwrite\Client; use Appwrite\Services\TablesDB; +use Appwrite\Permission; +use Appwrite\Role; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -15,6 +17,6 @@ $result = $tablesDB->updateRow( tableId: '', rowId: '', data: [], // optional - permissions: ["read("any")"], // optional + permissions: [Permission::read(Role::any())], // optional transactionId: '' // optional ); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md index 294d8d6..22f1523 100644 --- a/docs/examples/tablesdb/update-table.md +++ b/docs/examples/tablesdb/update-table.md @@ -2,6 +2,8 @@ use Appwrite\Client; use Appwrite\Services\TablesDB; +use Appwrite\Permission; +use Appwrite\Role; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -14,7 +16,7 @@ $result = $tablesDB->updateTable( databaseId: '', tableId: '', name: '', - permissions: ["read("any")"], // optional + permissions: [Permission::read(Role::any())], // optional rowSecurity: false, // optional enabled: false // optional ); \ No newline at end of file diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md index bec3c0a..192463e 100644 --- a/docs/examples/tablesdb/upsert-row.md +++ b/docs/examples/tablesdb/upsert-row.md @@ -2,6 +2,8 @@ use Appwrite\Client; use Appwrite\Services\TablesDB; +use Appwrite\Permission; +use Appwrite\Role; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -15,6 +17,6 @@ $result = $tablesDB->upsertRow( tableId: '', rowId: '', data: [], // optional - permissions: ["read("any")"], // optional + permissions: [Permission::read(Role::any())], // optional transactionId: '' // optional ); \ No newline at end of file diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index 817ea7f..5ff4736 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -13,5 +13,6 @@ $teams = new Teams($client); $result = $teams->listMemberships( teamId: '', queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index 99d9895..144b50d 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -12,5 +12,6 @@ $teams = new Teams($client); $result = $teams->list( queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/tokens/list.md b/docs/examples/tokens/list.md index b89420b..212a443 100644 --- a/docs/examples/tokens/list.md +++ b/docs/examples/tokens/list.md @@ -13,5 +13,6 @@ $tokens = new Tokens($client); $result = $tokens->list( bucketId: '', fileId: '', - queries: [] // optional + queries: [], // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md index fd15b7b..9cdc5bc 100644 --- a/docs/examples/users/list-identities.md +++ b/docs/examples/users/list-identities.md @@ -12,5 +12,6 @@ $users = new Users($client); $result = $users->listIdentities( queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md index 7aea2dc..7015526 100644 --- a/docs/examples/users/list-logs.md +++ b/docs/examples/users/list-logs.md @@ -12,5 +12,6 @@ $users = new Users($client); $result = $users->listLogs( userId: '', - queries: [] // optional + queries: [], // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md index 53c4b1b..9a37fea 100644 --- a/docs/examples/users/list-memberships.md +++ b/docs/examples/users/list-memberships.md @@ -13,5 +13,6 @@ $users = new Users($client); $result = $users->listMemberships( userId: '', queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md index bdbd0e5..e657aa2 100644 --- a/docs/examples/users/list-sessions.md +++ b/docs/examples/users/list-sessions.md @@ -11,5 +11,6 @@ $client = (new Client()) $users = new Users($client); $result = $users->listSessions( - userId: '' + userId: '', + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md index 005d51a..435dbde 100644 --- a/docs/examples/users/list-targets.md +++ b/docs/examples/users/list-targets.md @@ -12,5 +12,6 @@ $users = new Users($client); $result = $users->listTargets( userId: '', - queries: [] // optional + queries: [], // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md index 0421736..6494f07 100644 --- a/docs/examples/users/list.md +++ b/docs/examples/users/list.md @@ -12,5 +12,6 @@ $users = new Users($client); $result = $users->list( queries: [], // optional - search: '' // optional + search: '', // optional + total: false // optional ); \ No newline at end of file diff --git a/docs/functions.md b/docs/functions.md index a122c03..187d536 100644 --- a/docs/functions.md +++ b/docs/functions.md @@ -13,6 +13,7 @@ GET https://cloud.appwrite.io/v1/functions | --- | --- | --- | --- | | queries | array | 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 | [] | | search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -42,7 +43,7 @@ POST https://cloud.appwrite.io/v1/functions | providerBranch | string | Production branch for the repo linked to the function. | | | providerSilentMode | boolean | Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. | | | providerRootDirectory | string | Path to function code in the linked repo. | | -| specification | string | Runtime specification for the function and builds. | s-1vcpu-512mb | +| specification | string | Runtime specification for the function and builds. | [] | ```http request @@ -99,7 +100,7 @@ PUT https://cloud.appwrite.io/v1/functions/{functionId} | providerBranch | string | Production branch for the repo linked to the function | | | providerSilentMode | boolean | Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. | | | providerRootDirectory | string | Path to function code in the linked repo. | | -| specification | string | Runtime specification for the function and builds. | s-1vcpu-512mb | +| specification | string | Runtime specification for the function and builds. | [] | ```http request @@ -142,6 +143,7 @@ GET https://cloud.appwrite.io/v1/functions/{functionId}/deployments | functionId | string | **Required** Function ID. | | | queries | array | 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 | [] | | search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -287,6 +289,7 @@ GET https://cloud.appwrite.io/v1/functions/{functionId}/executions | --- | --- | --- | --- | | functionId | string | **Required** Function ID. | | | queries | array | 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 | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request diff --git a/docs/messaging.md b/docs/messaging.md index 1cc5298..fa1be09 100644 --- a/docs/messaging.md +++ b/docs/messaging.md @@ -13,6 +13,7 @@ GET https://cloud.appwrite.io/v1/messaging/messages | --- | --- | --- | --- | | queries | array | 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 | [] | | search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -244,6 +245,7 @@ GET https://cloud.appwrite.io/v1/messaging/messages/{messageId}/logs | --- | --- | --- | --- | | messageId | string | **Required** Message ID. | | | queries | array | 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 | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -258,6 +260,7 @@ GET https://cloud.appwrite.io/v1/messaging/messages/{messageId}/targets | --- | --- | --- | --- | | messageId | string | **Required** Message ID. | | | queries | array | 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 | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -272,6 +275,7 @@ GET https://cloud.appwrite.io/v1/messaging/providers | --- | --- | --- | --- | | queries | array | 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 | [] | | search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -498,6 +502,46 @@ PATCH https://cloud.appwrite.io/v1/messaging/providers/msg91/{providerId} | authKey | string | Msg91 auth key. | | +```http request +POST https://cloud.appwrite.io/v1/messaging/providers/resend +``` + +** Create a new Resend provider. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| providerId | string | 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. | | +| name | string | Provider name. | | +| apiKey | string | Resend API key. | | +| fromName | string | Sender Name. | | +| fromEmail | string | Sender email address. | | +| replyToName | string | Name set in the reply to field for the mail. Default value is sender name. | | +| replyToEmail | string | Email set in the reply to field for the mail. Default value is sender email. | | +| enabled | boolean | Set as enabled. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/messaging/providers/resend/{providerId} +``` + +** Update a Resend provider by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| providerId | string | **Required** Provider ID. | | +| name | string | Provider name. | | +| enabled | boolean | Set as enabled. | | +| apiKey | string | Resend API key. | | +| fromName | string | Sender Name. | | +| fromEmail | string | Sender email address. | | +| replyToName | string | Name set in the Reply To field for the mail. Default value is Sender Name. | | +| replyToEmail | string | Email set in the Reply To field for the mail. Default value is Sender Email. | | + + ```http request POST https://cloud.appwrite.io/v1/messaging/providers/sendgrid ``` @@ -825,6 +869,7 @@ GET https://cloud.appwrite.io/v1/messaging/providers/{providerId}/logs | --- | --- | --- | --- | | providerId | string | **Required** Provider ID. | | | queries | array | 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 | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -839,6 +884,7 @@ GET https://cloud.appwrite.io/v1/messaging/subscribers/{subscriberId}/logs | --- | --- | --- | --- | | subscriberId | string | **Required** Subscriber ID. | | | queries | array | 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 | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -853,6 +899,7 @@ GET https://cloud.appwrite.io/v1/messaging/topics | --- | --- | --- | --- | | queries | array | 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 | [] | | search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -925,6 +972,7 @@ GET https://cloud.appwrite.io/v1/messaging/topics/{topicId}/logs | --- | --- | --- | --- | | topicId | string | **Required** Topic ID. | | | queries | array | 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 | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -940,6 +988,7 @@ GET https://cloud.appwrite.io/v1/messaging/topics/{topicId}/subscribers | topicId | string | **Required** Topic ID. The topic ID subscribed to. | | | queries | array | 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 | [] | | search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request diff --git a/docs/sites.md b/docs/sites.md index cf9fc74..d829aae 100644 --- a/docs/sites.md +++ b/docs/sites.md @@ -13,6 +13,7 @@ GET https://cloud.appwrite.io/v1/sites | --- | --- | --- | --- | | queries | array | 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 | [] | | search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -42,7 +43,7 @@ POST https://cloud.appwrite.io/v1/sites | providerBranch | string | Production branch for the repo linked to the site. | | | providerSilentMode | boolean | Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. | | | providerRootDirectory | string | Path to site code in the linked repo. | | -| specification | string | Framework specification for the site and builds. | s-1vcpu-512mb | +| specification | string | Framework specification for the site and builds. | [] | ```http request @@ -99,7 +100,7 @@ PUT https://cloud.appwrite.io/v1/sites/{siteId} | providerBranch | string | Production branch for the repo linked to the site. | | | providerSilentMode | boolean | Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. | | | providerRootDirectory | string | Path to site code in the linked repo. | | -| specification | string | Framework specification for the site and builds. | s-1vcpu-512mb | +| specification | string | Framework specification for the site and builds. | [] | ```http request @@ -142,6 +143,7 @@ GET https://cloud.appwrite.io/v1/sites/{siteId}/deployments | siteId | string | **Required** Site ID. | | | queries | array | 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 | [] | | search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -283,6 +285,7 @@ GET https://cloud.appwrite.io/v1/sites/{siteId}/logs | --- | --- | --- | --- | | siteId | string | **Required** Site ID. | | | queries | array | 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 | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request diff --git a/docs/storage.md b/docs/storage.md index 790718c..062c4c5 100644 --- a/docs/storage.md +++ b/docs/storage.md @@ -13,6 +13,7 @@ GET https://cloud.appwrite.io/v1/storage/buckets | --- | --- | --- | --- | | queries | array | 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 | [] | | search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -98,6 +99,7 @@ GET https://cloud.appwrite.io/v1/storage/buckets/{bucketId}/files | bucketId | string | **Required** Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). | | | queries | array | 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 | [] | | search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request diff --git a/docs/tablesdb.md b/docs/tablesdb.md index a155d3e..1b75fe7 100644 --- a/docs/tablesdb.md +++ b/docs/tablesdb.md @@ -13,6 +13,7 @@ GET https://cloud.appwrite.io/v1/tablesdb | --- | --- | --- | --- | | queries | array | 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 | [] | | search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -166,6 +167,7 @@ GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables | databaseId | string | **Required** Database ID. | | | queries | array | 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 | [] | | search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -245,6 +247,7 @@ GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns | databaseId | string | **Required** Database ID. | | | tableId | string | **Required** Table ID. | | | queries | array | 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 | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -785,6 +788,7 @@ GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/indexes | databaseId | string | **Required** Database ID. | | | tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). | | | queries | array | 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 | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -851,6 +855,7 @@ GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows | tableId | string | **Required** Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table). | | | queries | array | 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. | [] | | transactionId | string | Transaction ID to read uncommitted changes within the transaction. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request diff --git a/docs/teams.md b/docs/teams.md index 5661af4..8d98f24 100644 --- a/docs/teams.md +++ b/docs/teams.md @@ -13,6 +13,7 @@ GET https://cloud.appwrite.io/v1/teams | --- | --- | --- | --- | | queries | array | 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 | [] | | search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -83,6 +84,7 @@ GET https://cloud.appwrite.io/v1/teams/{teamId}/memberships | teamId | string | **Required** Team ID. | | | queries | array | 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 | [] | | search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request diff --git a/docs/tokens.md b/docs/tokens.md index ca3d831..f474d1c 100644 --- a/docs/tokens.md +++ b/docs/tokens.md @@ -14,6 +14,7 @@ GET https://cloud.appwrite.io/v1/tokens/buckets/{bucketId}/files/{fileId} | bucketId | string | **Required** Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). | | | fileId | string | **Required** File unique ID. | | | queries | array | 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 | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request diff --git a/docs/users.md b/docs/users.md index cf39ee4..284239e 100644 --- a/docs/users.md +++ b/docs/users.md @@ -13,6 +13,7 @@ GET https://cloud.appwrite.io/v1/users | --- | --- | --- | --- | | queries | array | 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 | [] | | search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -76,6 +77,7 @@ GET https://cloud.appwrite.io/v1/users/identities | --- | --- | --- | --- | | queries | array | 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 | [] | | search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -263,6 +265,7 @@ GET https://cloud.appwrite.io/v1/users/{userId}/logs | --- | --- | --- | --- | | userId | string | **Required** User ID. | | | queries | array | 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 | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -278,6 +281,7 @@ GET https://cloud.appwrite.io/v1/users/{userId}/memberships | userId | string | **Required** User ID. | | | queries | array | 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 | [] | | search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -520,6 +524,7 @@ GET https://cloud.appwrite.io/v1/users/{userId}/sessions | Field Name | Type | Description | Default | | --- | --- | --- | --- | | userId | string | **Required** User ID. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -590,6 +595,7 @@ GET https://cloud.appwrite.io/v1/users/{userId}/targets | --- | --- | --- | --- | | userId | string | **Required** User ID. | | | queries | array | 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 | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php index 58435e6..3fb42cb 100644 --- a/src/Appwrite/Client.php +++ b/src/Appwrite/Client.php @@ -37,11 +37,11 @@ class Client */ protected array $headers = [ 'content-type' => '', - 'user-agent' => 'AppwritePHPSDK/17.4.1 ()', + 'user-agent' => 'AppwritePHPSDK/17.5.0 ()', 'x-sdk-name'=> 'PHP', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'php', - 'x-sdk-version'=> '17.4.1', + 'x-sdk-version'=> '17.5.0', ]; /** diff --git a/src/Appwrite/Enums/ExecutionStatus.php b/src/Appwrite/Enums/ExecutionStatus.php index 127d19b..a5999aa 100644 --- a/src/Appwrite/Enums/ExecutionStatus.php +++ b/src/Appwrite/Enums/ExecutionStatus.php @@ -10,6 +10,7 @@ class ExecutionStatus implements JsonSerializable private static ExecutionStatus $PROCESSING; private static ExecutionStatus $COMPLETED; private static ExecutionStatus $FAILED; + private static ExecutionStatus $SCHEDULED; private string $value; @@ -56,4 +57,11 @@ public static function FAILED(): ExecutionStatus } return self::$FAILED; } + public static function SCHEDULED(): ExecutionStatus + { + if (!isset(self::$SCHEDULED)) { + self::$SCHEDULED = new ExecutionStatus('scheduled'); + } + return self::$SCHEDULED; + } } \ No newline at end of file diff --git a/src/Appwrite/Enums/Framework.php b/src/Appwrite/Enums/Framework.php index 642506e..9b5104c 100644 --- a/src/Appwrite/Enums/Framework.php +++ b/src/Appwrite/Enums/Framework.php @@ -14,6 +14,7 @@ class Framework implements JsonSerializable private static Framework $VUE; private static Framework $SVELTEKIT; private static Framework $ASTRO; + private static Framework $TANSTACKSTART; private static Framework $REMIX; private static Framework $LYNX; private static Framework $FLUTTER; @@ -94,6 +95,13 @@ public static function ASTRO(): Framework } return self::$ASTRO; } + public static function TANSTACKSTART(): Framework + { + if (!isset(self::$TANSTACKSTART)) { + self::$TANSTACKSTART = new Framework('tanstack-start'); + } + return self::$TANSTACKSTART; + } public static function REMIX(): Framework { if (!isset(self::$REMIX)) { diff --git a/src/Appwrite/Operator.php b/src/Appwrite/Operator.php new file mode 100644 index 0000000..ad3c961 --- /dev/null +++ b/src/Appwrite/Operator.php @@ -0,0 +1,331 @@ +method = $method; + + if (is_null($values) || is_array($values)) { + $this->values = $values; + } else { + $this->values = [$values]; + } + } + + public function __toString(): string + { + return json_encode($this); + } + + public function jsonSerialize(): mixed + { + return [ + 'method' => $this->method, + 'values' => $this->values + ]; + } + + /** + * Increment + * + * @param int|float $value + * @param int|float|null $max + * @return string + */ + public static function increment(int|float $value = 1, int|float|null $max = null): string + { + if (is_nan($value) || is_infinite($value)) { + throw new \InvalidArgumentException('Value cannot be NaN or Infinity'); + } + if ($max !== null && (is_nan($max) || is_infinite($max))) { + throw new \InvalidArgumentException('Max cannot be NaN or Infinity'); + } + $values = [$value]; + if ($max !== null) { + $values[] = $max; + } + return (new Operator('increment', $values))->__toString(); + } + + /** + * Decrement + * + * @param int|float $value + * @param int|float|null $min + * @return string + */ + public static function decrement(int|float $value = 1, int|float|null $min = null): string + { + if (is_nan($value) || is_infinite($value)) { + throw new \InvalidArgumentException('Value cannot be NaN or Infinity'); + } + if ($min !== null && (is_nan($min) || is_infinite($min))) { + throw new \InvalidArgumentException('Min cannot be NaN or Infinity'); + } + $values = [$value]; + if ($min !== null) { + $values[] = $min; + } + return (new Operator('decrement', $values))->__toString(); + } + + /** + * Multiply + * + * @param int|float $factor + * @param int|float|null $max + * @return string + */ + public static function multiply(int|float $factor, int|float|null $max = null): string + { + if (is_nan($factor) || is_infinite($factor)) { + throw new \InvalidArgumentException('Factor cannot be NaN or Infinity'); + } + if ($max !== null && (is_nan($max) || is_infinite($max))) { + throw new \InvalidArgumentException('Max cannot be NaN or Infinity'); + } + $values = [$factor]; + if ($max !== null) { + $values[] = $max; + } + return (new Operator('multiply', $values))->__toString(); + } + + /** + * Divide + * + * @param int|float $divisor + * @param int|float|null $min + * @return string + */ + public static function divide(int|float $divisor, int|float|null $min = null): string + { + if (is_nan($divisor) || is_infinite($divisor)) { + throw new \InvalidArgumentException('Divisor cannot be NaN or Infinity'); + } + if ($min !== null && (is_nan($min) || is_infinite($min))) { + throw new \InvalidArgumentException('Min cannot be NaN or Infinity'); + } + if ($divisor === 0 || $divisor === 0.0) { + throw new \InvalidArgumentException('Divisor cannot be zero'); + } + $values = [$divisor]; + if ($min !== null) { + $values[] = $min; + } + return (new Operator('divide', $values))->__toString(); + } + + /** + * Modulo + * + * @param int|float $divisor + * @return string + */ + public static function modulo(int|float $divisor): string + { + if (is_nan($divisor) || is_infinite($divisor)) { + throw new \InvalidArgumentException('Divisor cannot be NaN or Infinity'); + } + if ($divisor === 0 || $divisor === 0.0) { + throw new \InvalidArgumentException('Divisor cannot be zero'); + } + return (new Operator('modulo', [$divisor]))->__toString(); + } + + /** + * Power + * + * @param int|float $exponent + * @param int|float|null $max + * @return string + */ + public static function power(int|float $exponent, int|float|null $max = null): string + { + if (is_nan($exponent) || is_infinite($exponent)) { + throw new \InvalidArgumentException('Exponent cannot be NaN or Infinity'); + } + if ($max !== null && (is_nan($max) || is_infinite($max))) { + throw new \InvalidArgumentException('Max cannot be NaN or Infinity'); + } + $values = [$exponent]; + if ($max !== null) { + $values[] = $max; + } + return (new Operator('power', $values))->__toString(); + } + + /** + * Array Append + * + * @param array $values + * @return string + */ + public static function arrayAppend(array $values): string + { + return (new Operator('arrayAppend', $values))->__toString(); + } + + /** + * Array Prepend + * + * @param array $values + * @return string + */ + public static function arrayPrepend(array $values): string + { + return (new Operator('arrayPrepend', $values))->__toString(); + } + + /** + * Array Insert + * + * @param int $index + * @param mixed $value + * @return string + */ + public static function arrayInsert(int $index, mixed $value): string + { + return (new Operator('arrayInsert', [$index, $value]))->__toString(); + } + + /** + * Array Remove + * + * @param mixed $value + * @return string + */ + public static function arrayRemove(mixed $value): string + { + return (new Operator('arrayRemove', [$value]))->__toString(); + } + + /** + * Array Unique + * + * @return string + */ + public static function arrayUnique(): string + { + return (new Operator('arrayUnique', []))->__toString(); + } + + /** + * Array Intersect + * + * @param array $values + * @return string + */ + public static function arrayIntersect(array $values): string + { + return (new Operator('arrayIntersect', $values))->__toString(); + } + + /** + * Array Diff + * + * @param array $values + * @return string + */ + public static function arrayDiff(array $values): string + { + return (new Operator('arrayDiff', $values))->__toString(); + } + + /** + * Array Filter + * + * @param string $condition + * @param mixed $value + * @return string + */ + public static function arrayFilter(string $condition, mixed $value = null): string + { + $values = [$condition, $value]; + return (new Operator('arrayFilter', $values))->__toString(); + } + + /** + * Concat + * + * @param mixed $value + * @return string + */ + public static function stringConcat(mixed $value): string + { + return (new Operator('stringConcat', [$value]))->__toString(); + } + + /** + * Replace + * + * @param string $search + * @param string $replace + * @return string + */ + public static function stringReplace(string $search, string $replace): string + { + return (new Operator('stringReplace', [$search, $replace]))->__toString(); + } + + /** + * Toggle + * + * @return string + */ + public static function toggle(): string + { + return (new Operator('toggle', []))->__toString(); + } + + /** + * Date Add Days + * + * @param int $days + * @return string + */ + public static function dateAddDays(int $days): string + { + return (new Operator('dateAddDays', [$days]))->__toString(); + } + + /** + * Date Subtract Days + * + * @param int $days + * @return string + */ + public static function dateSubDays(int $days): string + { + return (new Operator('dateSubDays', [$days]))->__toString(); + } + + /** + * Date Set Now + * + * @return string + */ + public static function dateSetNow(): string + { + return (new Operator('dateSetNow', []))->__toString(); + } +} diff --git a/src/Appwrite/Query.php b/src/Appwrite/Query.php index 51dd712..cb1b838 100644 --- a/src/Appwrite/Query.php +++ b/src/Appwrite/Query.php @@ -346,7 +346,7 @@ public static function notEndsWith(string $attribute, string $value): string */ public static function createdBefore(string $value): string { - return (new Query('createdBefore', null, $value))->__toString(); + return self::lessThan('$createdAt', $value); } /** @@ -357,7 +357,7 @@ public static function createdBefore(string $value): string */ public static function createdAfter(string $value): string { - return (new Query('createdAfter', null, $value))->__toString(); + return self::greaterThan('$createdAt', $value); } /** @@ -369,7 +369,7 @@ public static function createdAfter(string $value): string */ public static function createdBetween(string $start, string $end): string { - return (new Query('createdBetween', null, [$start, $end]))->__toString(); + return self::between('$createdAt', $start, $end); } /** @@ -380,7 +380,7 @@ public static function createdBetween(string $start, string $end): string */ public static function updatedBefore(string $value): string { - return (new Query('updatedBefore', null, $value))->__toString(); + return self::lessThan('$updatedAt', $value); } /** @@ -391,7 +391,7 @@ public static function updatedBefore(string $value): string */ public static function updatedAfter(string $value): string { - return (new Query('updatedAfter', null, $value))->__toString(); + return self::greaterThan('$updatedAt', $value); } /** @@ -403,7 +403,7 @@ public static function updatedAfter(string $value): string */ public static function updatedBetween(string $start, string $end): string { - return (new Query('updatedBetween', null, [$start, $end]))->__toString(); + return self::between('$updatedAt', $start, $end); } /** diff --git a/src/Appwrite/Services/Account.php b/src/Appwrite/Services/Account.php index 23f1b08..bff0a00 100644 --- a/src/Appwrite/Services/Account.php +++ b/src/Appwrite/Services/Account.php @@ -129,10 +129,11 @@ public function updateEmail(string $email, string $password): array * Get the list of identities for the currently logged in user. * * @param ?array $queries + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listIdentities(?array $queries = null): array + public function listIdentities(?array $queries = null, ?bool $total = null): array { $apiPath = str_replace( [], @@ -146,6 +147,10 @@ public function listIdentities(?array $queries = null): array $apiParams['queries'] = $queries; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -221,10 +226,11 @@ public function createJWT(): array * user. Each log returns user IP address, location and date and time of log. * * @param ?array $queries + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listLogs(?array $queries = null): array + public function listLogs(?array $queries = null, ?bool $total = null): array { $apiPath = str_replace( [], @@ -238,6 +244,10 @@ public function listLogs(?array $queries = null): array $apiParams['queries'] = $queries; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( diff --git a/src/Appwrite/Services/Databases.php b/src/Appwrite/Services/Databases.php index 7ecebe3..8fad8dc 100644 --- a/src/Appwrite/Services/Databases.php +++ b/src/Appwrite/Services/Databases.php @@ -23,13 +23,14 @@ public function __construct(Client $client) * * @param ?array $queries * @param ?string $search + * @param ?bool $total * @throws AppwriteException * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `list` instead. * @see TablesDB::list */ - public function list(?array $queries = null, ?string $search = null): array + public function list(?array $queries = null, ?string $search = null, ?bool $total = null): array { $apiPath = str_replace( [], @@ -47,6 +48,10 @@ public function list(?array $queries = null, ?string $search = null): array $apiParams['search'] = $search; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -401,13 +406,14 @@ public function delete(string $databaseId): string * @param string $databaseId * @param ?array $queries * @param ?string $search + * @param ?bool $total * @throws AppwriteException * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `listTables` instead. * @see TablesDB::listTables */ - public function listCollections(string $databaseId, ?array $queries = null, ?string $search = null): array + public function listCollections(string $databaseId, ?array $queries = null, ?string $search = null, ?bool $total = null): array { $apiPath = str_replace( ['{databaseId}'], @@ -426,6 +432,10 @@ public function listCollections(string $databaseId, ?array $queries = null, ?str $apiParams['search'] = $search; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -616,13 +626,14 @@ public function deleteCollection(string $databaseId, string $collectionId): stri * @param string $databaseId * @param string $collectionId * @param ?array $queries + * @param ?bool $total * @throws AppwriteException * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `listColumns` instead. * @see TablesDB::listColumns */ - public function listAttributes(string $databaseId, string $collectionId, ?array $queries = null): array + public function listAttributes(string $databaseId, string $collectionId, ?array $queries = null, ?bool $total = null): array { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -638,6 +649,10 @@ public function listAttributes(string $databaseId, string $collectionId, ?array $apiParams['queries'] = $queries; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -2013,13 +2028,14 @@ public function updateRelationshipAttribute(string $databaseId, string $collecti * @param string $collectionId * @param ?array $queries * @param ?string $transactionId + * @param ?bool $total * @throws AppwriteException * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `listRows` instead. * @see TablesDB::listRows */ - public function listDocuments(string $databaseId, string $collectionId, ?array $queries = null, ?string $transactionId = null): array + public function listDocuments(string $databaseId, string $collectionId, ?array $queries = null, ?string $transactionId = null, ?bool $total = null): array { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -2039,6 +2055,10 @@ public function listDocuments(string $databaseId, string $collectionId, ?array $ $apiParams['transactionId'] = $transactionId; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -2587,13 +2607,14 @@ public function incrementDocumentAttribute(string $databaseId, string $collectio * @param string $databaseId * @param string $collectionId * @param ?array $queries + * @param ?bool $total * @throws AppwriteException * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `listIndexes` instead. * @see TablesDB::listIndexes */ - public function listIndexes(string $databaseId, string $collectionId, ?array $queries = null): array + public function listIndexes(string $databaseId, string $collectionId, ?array $queries = null, ?bool $total = null): array { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -2609,6 +2630,10 @@ public function listIndexes(string $databaseId, string $collectionId, ?array $qu $apiParams['queries'] = $queries; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( diff --git a/src/Appwrite/Services/Functions.php b/src/Appwrite/Services/Functions.php index a8fb292..33f9b88 100644 --- a/src/Appwrite/Services/Functions.php +++ b/src/Appwrite/Services/Functions.php @@ -24,10 +24,11 @@ public function __construct(Client $client) * * @param ?array $queries * @param ?string $search + * @param ?bool $total * @throws AppwriteException * @return array */ - public function list(?array $queries = null, ?string $search = null): array + public function list(?array $queries = null, ?string $search = null, ?bool $total = null): array { $apiPath = str_replace( [], @@ -45,6 +46,10 @@ public function list(?array $queries = null, ?string $search = null): array $apiParams['search'] = $search; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -422,10 +427,11 @@ public function updateFunctionDeployment(string $functionId, string $deploymentI * @param string $functionId * @param ?array $queries * @param ?string $search + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listDeployments(string $functionId, ?array $queries = null, ?string $search = null): array + public function listDeployments(string $functionId, ?array $queries = null, ?string $search = null, ?bool $total = null): array { $apiPath = str_replace( ['{functionId}'], @@ -444,6 +450,10 @@ public function listDeployments(string $functionId, ?array $queries = null, ?str $apiParams['search'] = $search; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -836,10 +846,11 @@ public function updateDeploymentStatus(string $functionId, string $deploymentId) * * @param string $functionId * @param ?array $queries + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listExecutions(string $functionId, ?array $queries = null): array + public function listExecutions(string $functionId, ?array $queries = null, ?bool $total = null): array { $apiPath = str_replace( ['{functionId}'], @@ -854,6 +865,10 @@ public function listExecutions(string $functionId, ?array $queries = null): arra $apiParams['queries'] = $queries; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( diff --git a/src/Appwrite/Services/Messaging.php b/src/Appwrite/Services/Messaging.php index 3fbebd2..beaafc8 100644 --- a/src/Appwrite/Services/Messaging.php +++ b/src/Appwrite/Services/Messaging.php @@ -21,10 +21,11 @@ public function __construct(Client $client) * * @param ?array $queries * @param ?string $search + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listMessages(?array $queries = null, ?string $search = null): array + public function listMessages(?array $queries = null, ?string $search = null, ?bool $total = null): array { $apiPath = str_replace( [], @@ -42,6 +43,10 @@ public function listMessages(?array $queries = null, ?string $search = null): ar $apiParams['search'] = $search; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -764,10 +769,11 @@ public function delete(string $messageId): string * * @param string $messageId * @param ?array $queries + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listMessageLogs(string $messageId, ?array $queries = null): array + public function listMessageLogs(string $messageId, ?array $queries = null, ?bool $total = null): array { $apiPath = str_replace( ['{messageId}'], @@ -782,6 +788,10 @@ public function listMessageLogs(string $messageId, ?array $queries = null): arra $apiParams['queries'] = $queries; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -797,10 +807,11 @@ public function listMessageLogs(string $messageId, ?array $queries = null): arra * * @param string $messageId * @param ?array $queries + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listTargets(string $messageId, ?array $queries = null): array + public function listTargets(string $messageId, ?array $queries = null, ?bool $total = null): array { $apiPath = str_replace( ['{messageId}'], @@ -815,6 +826,10 @@ public function listTargets(string $messageId, ?array $queries = null): array $apiParams['queries'] = $queries; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -830,10 +845,11 @@ public function listTargets(string $messageId, ?array $queries = null): array * * @param ?array $queries * @param ?string $search + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listProviders(?array $queries = null, ?string $search = null): array + public function listProviders(?array $queries = null, ?string $search = null, ?bool $total = null): array { $apiPath = str_replace( [], @@ -851,6 +867,10 @@ public function listProviders(?array $queries = null, ?string $search = null): a $apiParams['search'] = $search; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -1543,6 +1563,131 @@ public function updateMsg91Provider(string $providerId, ?string $name = null, ?b ); } + /** + * Create a new Resend provider. + * + * @param string $providerId + * @param string $name + * @param ?string $apiKey + * @param ?string $fromName + * @param ?string $fromEmail + * @param ?string $replyToName + * @param ?string $replyToEmail + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function createResendProvider(string $providerId, string $name, ?string $apiKey = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + [], + [], + '/messaging/providers/resend' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + $apiParams['name'] = $name; + + if (!is_null($apiKey)) { + $apiParams['apiKey'] = $apiKey; + } + + if (!is_null($fromName)) { + $apiParams['fromName'] = $fromName; + } + + if (!is_null($fromEmail)) { + $apiParams['fromEmail'] = $fromEmail; + } + + if (!is_null($replyToName)) { + $apiParams['replyToName'] = $replyToName; + } + + if (!is_null($replyToEmail)) { + $apiParams['replyToEmail'] = $replyToEmail; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a Resend provider by its unique ID. + * + * @param string $providerId + * @param ?string $name + * @param ?bool $enabled + * @param ?string $apiKey + * @param ?string $fromName + * @param ?string $fromEmail + * @param ?string $replyToName + * @param ?string $replyToEmail + * @throws AppwriteException + * @return array + */ + public function updateResendProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $apiKey = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null): array + { + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/resend/{providerId}' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($apiKey)) { + $apiParams['apiKey'] = $apiKey; + } + + if (!is_null($fromName)) { + $apiParams['fromName'] = $fromName; + } + + if (!is_null($fromEmail)) { + $apiParams['fromEmail'] = $fromEmail; + } + + if (!is_null($replyToName)) { + $apiParams['replyToName'] = $replyToName; + } + + if (!is_null($replyToEmail)) { + $apiParams['replyToEmail'] = $replyToEmail; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Create a new Sendgrid provider. * @@ -2521,10 +2666,11 @@ public function deleteProvider(string $providerId): string * * @param string $providerId * @param ?array $queries + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listProviderLogs(string $providerId, ?array $queries = null): array + public function listProviderLogs(string $providerId, ?array $queries = null, ?bool $total = null): array { $apiPath = str_replace( ['{providerId}'], @@ -2539,6 +2685,10 @@ public function listProviderLogs(string $providerId, ?array $queries = null): ar $apiParams['queries'] = $queries; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -2554,10 +2704,11 @@ public function listProviderLogs(string $providerId, ?array $queries = null): ar * * @param string $subscriberId * @param ?array $queries + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listSubscriberLogs(string $subscriberId, ?array $queries = null): array + public function listSubscriberLogs(string $subscriberId, ?array $queries = null, ?bool $total = null): array { $apiPath = str_replace( ['{subscriberId}'], @@ -2572,6 +2723,10 @@ public function listSubscriberLogs(string $subscriberId, ?array $queries = null) $apiParams['queries'] = $queries; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -2587,10 +2742,11 @@ public function listSubscriberLogs(string $subscriberId, ?array $queries = null) * * @param ?array $queries * @param ?string $search + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listTopics(?array $queries = null, ?string $search = null): array + public function listTopics(?array $queries = null, ?string $search = null, ?bool $total = null): array { $apiPath = str_replace( [], @@ -2608,6 +2764,10 @@ public function listTopics(?array $queries = null, ?string $search = null): arra $apiParams['search'] = $search; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -2757,10 +2917,11 @@ public function deleteTopic(string $topicId): string * * @param string $topicId * @param ?array $queries + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listTopicLogs(string $topicId, ?array $queries = null): array + public function listTopicLogs(string $topicId, ?array $queries = null, ?bool $total = null): array { $apiPath = str_replace( ['{topicId}'], @@ -2775,6 +2936,10 @@ public function listTopicLogs(string $topicId, ?array $queries = null): array $apiParams['queries'] = $queries; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -2791,10 +2956,11 @@ public function listTopicLogs(string $topicId, ?array $queries = null): array * @param string $topicId * @param ?array $queries * @param ?string $search + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listSubscribers(string $topicId, ?array $queries = null, ?string $search = null): array + public function listSubscribers(string $topicId, ?array $queries = null, ?string $search = null, ?bool $total = null): array { $apiPath = str_replace( ['{topicId}'], @@ -2813,6 +2979,10 @@ public function listSubscribers(string $topicId, ?array $queries = null, ?string $apiParams['search'] = $search; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( diff --git a/src/Appwrite/Services/Sites.php b/src/Appwrite/Services/Sites.php index 3052c2a..93f5bfc 100644 --- a/src/Appwrite/Services/Sites.php +++ b/src/Appwrite/Services/Sites.php @@ -25,10 +25,11 @@ public function __construct(Client $client) * * @param ?array $queries * @param ?string $search + * @param ?bool $total * @throws AppwriteException * @return array */ - public function list(?array $queries = null, ?string $search = null): array + public function list(?array $queries = null, ?string $search = null, ?bool $total = null): array { $apiPath = str_replace( [], @@ -46,6 +47,10 @@ public function list(?array $queries = null, ?string $search = null): array $apiParams['search'] = $search; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -418,10 +423,11 @@ public function updateSiteDeployment(string $siteId, string $deploymentId): arra * @param string $siteId * @param ?array $queries * @param ?string $search + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listDeployments(string $siteId, ?array $queries = null, ?string $search = null): array + public function listDeployments(string $siteId, ?array $queries = null, ?string $search = null, ?bool $total = null): array { $apiPath = str_replace( ['{siteId}'], @@ -440,6 +446,10 @@ public function listDeployments(string $siteId, ?array $queries = null, ?string $apiParams['search'] = $search; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -825,10 +835,11 @@ public function updateDeploymentStatus(string $siteId, string $deploymentId): ar * * @param string $siteId * @param ?array $queries + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listLogs(string $siteId, ?array $queries = null): array + public function listLogs(string $siteId, ?array $queries = null, ?bool $total = null): array { $apiPath = str_replace( ['{siteId}'], @@ -843,6 +854,10 @@ public function listLogs(string $siteId, ?array $queries = null): array $apiParams['queries'] = $queries; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( diff --git a/src/Appwrite/Services/Storage.php b/src/Appwrite/Services/Storage.php index 8f24c1d..0da05c1 100644 --- a/src/Appwrite/Services/Storage.php +++ b/src/Appwrite/Services/Storage.php @@ -23,10 +23,11 @@ public function __construct(Client $client) * * @param ?array $queries * @param ?string $search + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listBuckets(?array $queries = null, ?string $search = null): array + public function listBuckets(?array $queries = null, ?string $search = null, ?bool $total = null): array { $apiPath = str_replace( [], @@ -44,6 +45,10 @@ public function listBuckets(?array $queries = null, ?string $search = null): arr $apiParams['search'] = $search; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -261,10 +266,11 @@ public function deleteBucket(string $bucketId): string * @param string $bucketId * @param ?array $queries * @param ?string $search + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listFiles(string $bucketId, ?array $queries = null, ?string $search = null): array + public function listFiles(string $bucketId, ?array $queries = null, ?string $search = null, ?bool $total = null): array { $apiPath = str_replace( ['{bucketId}'], @@ -283,6 +289,10 @@ public function listFiles(string $bucketId, ?array $queries = null, ?string $sea $apiParams['search'] = $search; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( diff --git a/src/Appwrite/Services/TablesDb.php b/src/Appwrite/Services/TablesDb.php index 6a18ec4..a0d9a89 100644 --- a/src/Appwrite/Services/TablesDb.php +++ b/src/Appwrite/Services/TablesDb.php @@ -23,10 +23,11 @@ public function __construct(Client $client) * * @param ?array $queries * @param ?string $search + * @param ?bool $total * @throws AppwriteException * @return array */ - public function list(?array $queries = null, ?string $search = null): array + public function list(?array $queries = null, ?string $search = null, ?bool $total = null): array { $apiPath = str_replace( [], @@ -44,6 +45,10 @@ public function list(?array $queries = null, ?string $search = null): array $apiParams['search'] = $search; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -386,10 +391,11 @@ public function delete(string $databaseId): string * @param string $databaseId * @param ?array $queries * @param ?string $search + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listTables(string $databaseId, ?array $queries = null, ?string $search = null): array + public function listTables(string $databaseId, ?array $queries = null, ?string $search = null, ?bool $total = null): array { $apiPath = str_replace( ['{databaseId}'], @@ -408,6 +414,10 @@ public function listTables(string $databaseId, ?array $queries = null, ?string $ $apiParams['search'] = $search; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -586,10 +596,11 @@ public function deleteTable(string $databaseId, string $tableId): string * @param string $databaseId * @param string $tableId * @param ?array $queries + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listColumns(string $databaseId, string $tableId, ?array $queries = null): array + public function listColumns(string $databaseId, string $tableId, ?array $queries = null, ?bool $total = null): array { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -605,6 +616,10 @@ public function listColumns(string $databaseId, string $tableId, ?array $queries $apiParams['queries'] = $queries; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -1893,10 +1908,11 @@ public function updateRelationshipColumn(string $databaseId, string $tableId, st * @param string $databaseId * @param string $tableId * @param ?array $queries + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listIndexes(string $databaseId, string $tableId, ?array $queries = null): array + public function listIndexes(string $databaseId, string $tableId, ?array $queries = null, ?bool $total = null): array { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -1912,6 +1928,10 @@ public function listIndexes(string $databaseId, string $tableId, ?array $queries $apiParams['queries'] = $queries; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -2044,10 +2064,11 @@ public function deleteIndex(string $databaseId, string $tableId, string $key): s * @param string $tableId * @param ?array $queries * @param ?string $transactionId + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listRows(string $databaseId, string $tableId, ?array $queries = null, ?string $transactionId = null): array + public function listRows(string $databaseId, string $tableId, ?array $queries = null, ?string $transactionId = null, ?bool $total = null): array { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -2067,6 +2088,10 @@ public function listRows(string $databaseId, string $tableId, ?array $queries = $apiParams['transactionId'] = $transactionId; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( diff --git a/src/Appwrite/Services/Teams.php b/src/Appwrite/Services/Teams.php index 489b525..3f3480e 100644 --- a/src/Appwrite/Services/Teams.php +++ b/src/Appwrite/Services/Teams.php @@ -20,10 +20,11 @@ public function __construct(Client $client) * * @param ?array $queries * @param ?string $search + * @param ?bool $total * @throws AppwriteException * @return array */ - public function list(?array $queries = null, ?string $search = null): array + public function list(?array $queries = null, ?string $search = null, ?bool $total = null): array { $apiPath = str_replace( [], @@ -41,6 +42,10 @@ public function list(?array $queries = null, ?string $search = null): array $apiParams['search'] = $search; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -186,10 +191,11 @@ public function delete(string $teamId): string * @param string $teamId * @param ?array $queries * @param ?string $search + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listMemberships(string $teamId, ?array $queries = null, ?string $search = null): array + public function listMemberships(string $teamId, ?array $queries = null, ?string $search = null, ?bool $total = null): array { $apiPath = str_replace( ['{teamId}'], @@ -208,6 +214,10 @@ public function listMemberships(string $teamId, ?array $queries = null, ?string $apiParams['search'] = $search; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( diff --git a/src/Appwrite/Services/Tokens.php b/src/Appwrite/Services/Tokens.php index 572321a..d004e4e 100644 --- a/src/Appwrite/Services/Tokens.php +++ b/src/Appwrite/Services/Tokens.php @@ -21,10 +21,11 @@ public function __construct(Client $client) * @param string $bucketId * @param string $fileId * @param ?array $queries + * @param ?bool $total * @throws AppwriteException * @return array */ - public function list(string $bucketId, string $fileId, ?array $queries = null): array + public function list(string $bucketId, string $fileId, ?array $queries = null, ?bool $total = null): array { $apiPath = str_replace( ['{bucketId}', '{fileId}'], @@ -40,6 +41,10 @@ public function list(string $bucketId, string $fileId, ?array $queries = null): $apiParams['queries'] = $queries; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( diff --git a/src/Appwrite/Services/Users.php b/src/Appwrite/Services/Users.php index f263049..6e3d8cf 100644 --- a/src/Appwrite/Services/Users.php +++ b/src/Appwrite/Services/Users.php @@ -23,10 +23,11 @@ public function __construct(Client $client) * * @param ?array $queries * @param ?string $search + * @param ?bool $total * @throws AppwriteException * @return array */ - public function list(?array $queries = null, ?string $search = null): array + public function list(?array $queries = null, ?string $search = null, ?bool $total = null): array { $apiPath = str_replace( [], @@ -44,6 +45,10 @@ public function list(?array $queries = null, ?string $search = null): array $apiParams['search'] = $search; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -190,10 +195,11 @@ public function createBcryptUser(string $userId, string $email, string $password * * @param ?array $queries * @param ?string $search + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listIdentities(?array $queries = null, ?string $search = null): array + public function listIdentities(?array $queries = null, ?string $search = null, ?bool $total = null): array { $apiPath = str_replace( [], @@ -211,6 +217,10 @@ public function listIdentities(?array $queries = null, ?string $search = null): $apiParams['search'] = $search; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -652,10 +662,11 @@ public function updateLabels(string $userId, array $labels): array * * @param string $userId * @param ?array $queries + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listLogs(string $userId, ?array $queries = null): array + public function listLogs(string $userId, ?array $queries = null, ?bool $total = null): array { $apiPath = str_replace( ['{userId}'], @@ -670,6 +681,10 @@ public function listLogs(string $userId, ?array $queries = null): array $apiParams['queries'] = $queries; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -686,10 +701,11 @@ public function listLogs(string $userId, ?array $queries = null): array * @param string $userId * @param ?array $queries * @param ?string $search + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listMemberships(string $userId, ?array $queries = null, ?string $search = null): array + public function listMemberships(string $userId, ?array $queries = null, ?string $search = null, ?bool $total = null): array { $apiPath = str_replace( ['{userId}'], @@ -708,6 +724,10 @@ public function listMemberships(string $userId, ?array $queries = null, ?string $apiParams['search'] = $search; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -1264,10 +1284,11 @@ public function updatePrefs(string $userId, array $prefs): array * Get the user sessions list by its unique ID. * * @param string $userId + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listSessions(string $userId): array + public function listSessions(string $userId, ?bool $total = null): array { $apiPath = str_replace( ['{userId}'], @@ -1278,6 +1299,10 @@ public function listSessions(string $userId): array $apiParams = []; $apiParams['userId'] = $userId; + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( @@ -1419,10 +1444,11 @@ public function updateStatus(string $userId, bool $status): array * * @param string $userId * @param ?array $queries + * @param ?bool $total * @throws AppwriteException * @return array */ - public function listTargets(string $userId, ?array $queries = null): array + public function listTargets(string $userId, ?array $queries = null, ?bool $total = null): array { $apiPath = str_replace( ['{userId}'], @@ -1437,6 +1463,10 @@ public function listTargets(string $userId, ?array $queries = null): array $apiParams['queries'] = $queries; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; return $this->client->call( diff --git a/tests/Appwrite/OperatorTest.php b/tests/Appwrite/OperatorTest.php new file mode 100644 index 0000000..d153348 --- /dev/null +++ b/tests/Appwrite/OperatorTest.php @@ -0,0 +1,92 @@ +assertSame('{"method":"increment","values":[1]}', Operator::increment()); + $this->assertSame('{"method":"increment","values":[5,100]}', Operator::increment(5, 100)); + } + + public function testDecrement(): void { + $this->assertSame('{"method":"decrement","values":[1]}', Operator::decrement()); + $this->assertSame('{"method":"decrement","values":[3,0]}', Operator::decrement(3, 0)); + } + + public function testMultiply(): void { + $this->assertSame('{"method":"multiply","values":[2]}', Operator::multiply(2)); + $this->assertSame('{"method":"multiply","values":[3,1000]}', Operator::multiply(3, 1000)); + } + + public function testDivide(): void { + $this->assertSame('{"method":"divide","values":[2]}', Operator::divide(2)); + $this->assertSame('{"method":"divide","values":[4,1]}', Operator::divide(4, 1)); + } + + public function testModulo(): void { + $this->assertSame('{"method":"modulo","values":[5]}', Operator::modulo(5)); + } + + public function testPower(): void { + $this->assertSame('{"method":"power","values":[2]}', Operator::power(2)); + $this->assertSame('{"method":"power","values":[3,100]}', Operator::power(3, 100)); + } + + public function testArrayAppend(): void { + $this->assertSame('{"method":"arrayAppend","values":["item1","item2"]}', Operator::arrayAppend(['item1', 'item2'])); + } + + public function testArrayPrepend(): void { + $this->assertSame('{"method":"arrayPrepend","values":["first","second"]}', Operator::arrayPrepend(['first', 'second'])); + } + + public function testArrayInsert(): void { + $this->assertSame('{"method":"arrayInsert","values":[0,"newItem"]}', Operator::arrayInsert(0, 'newItem')); + } + + public function testArrayRemove(): void { + $this->assertSame('{"method":"arrayRemove","values":["oldItem"]}', Operator::arrayRemove('oldItem')); + } + + public function testArrayUnique(): void { + $this->assertSame('{"method":"arrayUnique","values":[]}', Operator::arrayUnique()); + } + + public function testArrayIntersect(): void { + $this->assertSame('{"method":"arrayIntersect","values":["a","b","c"]}', Operator::arrayIntersect(['a', 'b', 'c'])); + } + + public function testArrayDiff(): void { + $this->assertSame('{"method":"arrayDiff","values":["x","y"]}', Operator::arrayDiff(['x', 'y'])); + } + + public function testArrayFilter(): void { + $this->assertSame('{"method":"arrayFilter","values":["equal","test"]}', Operator::arrayFilter(Condition::Equal, 'test')); + } + + public function testStringConcat(): void { + $this->assertSame('{"method":"stringConcat","values":["suffix"]}', Operator::stringConcat('suffix')); + } + + public function testStringReplace(): void { + $this->assertSame('{"method":"stringReplace","values":["old","new"]}', Operator::stringReplace('old', 'new')); + } + + public function testToggle(): void { + $this->assertSame('{"method":"toggle","values":[]}', Operator::toggle()); + } + + public function testDateAddDays(): void { + $this->assertSame('{"method":"dateAddDays","values":[7]}', Operator::dateAddDays(7)); + } + + public function testDateSubDays(): void { + $this->assertSame('{"method":"dateSubDays","values":[3]}', Operator::dateSubDays(3)); + } + + public function testDateSetNow(): void { + $this->assertSame('{"method":"dateSetNow","values":[]}', Operator::dateSetNow()); + } +} diff --git a/tests/Appwrite/QueryTest.php b/tests/Appwrite/QueryTest.php index 60bdaa6..283a867 100644 --- a/tests/Appwrite/QueryTest.php +++ b/tests/Appwrite/QueryTest.php @@ -180,26 +180,26 @@ public function testNotEndsWith(): void { } public function testCreatedBefore(): void { - $this->assertSame('createdBefore("2023-01-01")', Query::createdBefore('2023-01-01')); + $this->assertSame('lessThan("$createdAt", ["2023-01-01"])', Query::createdBefore('2023-01-01')); } public function testCreatedAfter(): void { - $this->assertSame('createdAfter("2023-01-01")', Query::createdAfter('2023-01-01')); + $this->assertSame('greaterThan("$createdAt", ["2023-01-01"])', Query::createdAfter('2023-01-01')); } public function testCreatedBetween(): void { - $this->assertSame('{"method":"createdBetween","values":["2023-01-01","2023-12-31"]}', Query::createdBetween('2023-01-01', '2023-12-31')); + $this->assertSame('between("$createdAt", ["2023-01-01","2023-12-31"])', Query::createdBetween('2023-01-01', '2023-12-31')); } public function testUpdatedBefore(): void { - $this->assertSame('updatedBefore("2023-01-01")', Query::updatedBefore('2023-01-01')); + $this->assertSame('lessThan("$updatedAt", ["2023-01-01"])', Query::updatedBefore('2023-01-01')); } public function testUpdatedAfter(): void { - $this->assertSame('updatedAfter("2023-01-01")', Query::updatedAfter('2023-01-01')); + $this->assertSame('greaterThan("$updatedAt", ["2023-01-01"])', Query::updatedAfter('2023-01-01')); } public function testUpdatedBetween(): void { - $this->assertSame('{"method":"updatedBetween","values":["2023-01-01","2023-12-31"]}', Query::updatedBetween('2023-01-01', '2023-12-31')); + $this->assertSame('between("$updatedAt", ["2023-01-01","2023-12-31"])', Query::updatedBetween('2023-01-01', '2023-12-31')); } } diff --git a/tests/Appwrite/Services/MessagingTest.php b/tests/Appwrite/Services/MessagingTest.php index 1c37cdf..b11882e 100644 --- a/tests/Appwrite/Services/MessagingTest.php +++ b/tests/Appwrite/Services/MessagingTest.php @@ -634,6 +634,55 @@ public function testMethodUpdateMsg91Provider(): void { $this->assertSame($data, $response); } + public function testMethodCreateResendProvider(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->createResendProvider( + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateResendProvider(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->updateResendProvider( + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodCreateSendgridProvider(): void { $data = array(