diff --git a/CHANGELOG.md b/CHANGELOG.md index 14a26e4..1ffcff2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 19.0.0 + +* Rename `VCSDeploymentType` enum to `VCSReferenceType` +* Change `createTemplateDeployment` method signature: replace `version` parameter with `type` (TemplateReferenceType) and `reference` parameters +* Add `Theme`, `Timezone` and `Output` enums + ## 18.0.1 * Fix `TablesDB` service to use correct file name diff --git a/docs/account.md b/docs/account.md index bad4bab..f7c0724 100644 --- a/docs/account.md +++ b/docs/account.md @@ -182,7 +182,7 @@ DELETE https://cloud.appwrite.io/v1/account/mfa/authenticators/{type} ```http request -POST https://cloud.appwrite.io/v1/account/mfa/challenge +POST https://cloud.appwrite.io/v1/account/mfa/challenges ``` ** Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. ** @@ -195,7 +195,7 @@ POST https://cloud.appwrite.io/v1/account/mfa/challenge ```http request -POST https://cloud.appwrite.io/v1/account/mfa/challenge +POST https://cloud.appwrite.io/v1/account/mfa/challenges ``` ** Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. ** @@ -208,7 +208,7 @@ POST https://cloud.appwrite.io/v1/account/mfa/challenge ```http request -PUT https://cloud.appwrite.io/v1/account/mfa/challenge +PUT https://cloud.appwrite.io/v1/account/mfa/challenges ``` ** Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. ** @@ -222,7 +222,7 @@ PUT https://cloud.appwrite.io/v1/account/mfa/challenge ```http request -PUT https://cloud.appwrite.io/v1/account/mfa/challenge +PUT https://cloud.appwrite.io/v1/account/mfa/challenges ``` ** Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. ** diff --git a/docs/examples/avatars/get-screenshot.md b/docs/examples/avatars/get-screenshot.md index b9dfd23..9f91a3f 100644 --- a/docs/examples/avatars/get-screenshot.md +++ b/docs/examples/avatars/get-screenshot.md @@ -15,23 +15,26 @@ $avatars = new Avatars($client); $result = $avatars->getScreenshot( url: 'https://example.com', - headers: [], // optional - viewportWidth: 1, // optional - viewportHeight: 1, // optional - scale: 0.1, // optional + headers: [ + 'Authorization' => 'Bearer token123', + 'X-Custom-Header' => 'value' + ], // optional + viewportWidth: 1920, // optional + viewportHeight: 1080, // optional + scale: 2, // optional theme: Theme::LIGHT(), // optional - userAgent: '', // optional - fullpage: false, // optional - locale: '', // optional + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15', // optional + fullpage: true, // optional + locale: 'en-US', // optional timezone: Timezone::AFRICAABIDJAN(), // optional - latitude: -90, // optional - longitude: -180, // optional - accuracy: 0, // optional - touch: false, // optional - permissions: [], // optional - sleep: 0, // optional - width: 0, // optional - height: 0, // optional - quality: -1, // optional + latitude: 37.7749, // optional + longitude: -122.4194, // optional + accuracy: 100, // optional + touch: true, // optional + permissions: ["geolocation","notifications"], // optional + sleep: 3, // optional + width: 800, // optional + height: 600, // optional + quality: 85, // optional output: Output::JPG() // optional ); \ No newline at end of file diff --git a/docs/examples/functions/create-template-deployment.md b/docs/examples/functions/create-template-deployment.md index 9d22bdc..a127252 100644 --- a/docs/examples/functions/create-template-deployment.md +++ b/docs/examples/functions/create-template-deployment.md @@ -2,6 +2,7 @@ use Appwrite\Client; use Appwrite\Services\Functions; +use Appwrite\Enums\TemplateReferenceType; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -15,6 +16,7 @@ $result = $functions->createTemplateDeployment( repository: '', owner: '', rootDirectory: '', - version: '', + type: TemplateReferenceType::COMMIT(), + reference: '', activate: false // optional ); \ No newline at end of file diff --git a/docs/examples/functions/create-vcs-deployment.md b/docs/examples/functions/create-vcs-deployment.md index bb4622e..f044219 100644 --- a/docs/examples/functions/create-vcs-deployment.md +++ b/docs/examples/functions/create-vcs-deployment.md @@ -2,7 +2,7 @@ use Appwrite\Client; use Appwrite\Services\Functions; -use Appwrite\Enums\VCSDeploymentType; +use Appwrite\Enums\VCSReferenceType; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -13,7 +13,7 @@ $functions = new Functions($client); $result = $functions->createVcsDeployment( functionId: '', - type: VCSDeploymentType::BRANCH(), + type: VCSReferenceType::BRANCH(), reference: '', activate: false // optional ); \ No newline at end of file diff --git a/docs/examples/sites/create-template-deployment.md b/docs/examples/sites/create-template-deployment.md index f2d1f3c..1661bbb 100644 --- a/docs/examples/sites/create-template-deployment.md +++ b/docs/examples/sites/create-template-deployment.md @@ -2,6 +2,7 @@ use Appwrite\Client; use Appwrite\Services\Sites; +use Appwrite\Enums\TemplateReferenceType; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -15,6 +16,7 @@ $result = $sites->createTemplateDeployment( repository: '', owner: '', rootDirectory: '', - version: '', + type: TemplateReferenceType::BRANCH(), + reference: '', activate: false // optional ); \ No newline at end of file diff --git a/docs/examples/sites/create-vcs-deployment.md b/docs/examples/sites/create-vcs-deployment.md index 7f63dff..015bf09 100644 --- a/docs/examples/sites/create-vcs-deployment.md +++ b/docs/examples/sites/create-vcs-deployment.md @@ -2,7 +2,7 @@ use Appwrite\Client; use Appwrite\Services\Sites; -use Appwrite\Enums\VCSDeploymentType; +use Appwrite\Enums\VCSReferenceType; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -13,7 +13,7 @@ $sites = new Sites($client); $result = $sites->createVcsDeployment( siteId: '', - type: VCSDeploymentType::BRANCH(), + type: VCSReferenceType::BRANCH(), reference: '', activate: 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 3d4f717..3184095 100644 --- a/docs/examples/storage/create-bucket.md +++ b/docs/examples/storage/create-bucket.md @@ -23,5 +23,6 @@ $result = $storage->createBucket( allowedFileExtensions: [], // optional compression: Compression::NONE(), // optional encryption: false, // optional - antivirus: false // optional + antivirus: false, // optional + transformations: 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 77f4262..1556257 100644 --- a/docs/examples/storage/update-bucket.md +++ b/docs/examples/storage/update-bucket.md @@ -23,5 +23,6 @@ $result = $storage->updateBucket( allowedFileExtensions: [], // optional compression: Compression::NONE(), // optional encryption: false, // optional - antivirus: false // optional + antivirus: false, // optional + transformations: false // optional ); \ No newline at end of file diff --git a/docs/functions.md b/docs/functions.md index 187d536..fbcc10c 100644 --- a/docs/functions.md +++ b/docs/functions.md @@ -198,7 +198,8 @@ Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/p | repository | string | Repository name of the template. | | | owner | string | The name of the owner of the template. | | | rootDirectory | string | Path to function code in the template repo. | | -| version | string | Version (tag) for the repo linked to the function template. | | +| type | string | Type for the reference provided. Can be commit, branch, or tag | | +| reference | string | Reference value, can be a commit hash, branch name, or release tag | | | activate | boolean | Automatically activate the deployment when it is finished building. | | diff --git a/docs/sites.md b/docs/sites.md index 2e22593..e277092 100644 --- a/docs/sites.md +++ b/docs/sites.md @@ -194,7 +194,8 @@ Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/p | repository | string | Repository name of the template. | | | owner | string | The name of the owner of the template. | | | rootDirectory | string | Path to site code in the template repo. | | -| version | string | Version (tag) for the repo linked to the site template. | | +| type | string | Type for the reference provided. Can be commit, branch, or tag | | +| reference | string | Reference value, can be a commit hash, branch name, or release tag | | | activate | boolean | Automatically activate the deployment when it is finished building. | | diff --git a/docs/storage.md b/docs/storage.md index 062c4c5..8654029 100644 --- a/docs/storage.md +++ b/docs/storage.md @@ -11,7 +11,7 @@ GET https://cloud.appwrite.io/v1/storage/buckets | 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: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus | [] | +| 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, transformations | [] | | 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 | @@ -36,6 +36,7 @@ POST https://cloud.appwrite.io/v1/storage/buckets | compression | string | Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled | none | | encryption | boolean | Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled | 1 | | antivirus | boolean | Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled | 1 | +| transformations | boolean | Are image transformations enabled? | 1 | ```http request @@ -71,6 +72,7 @@ PUT https://cloud.appwrite.io/v1/storage/buckets/{bucketId} | compression | string | Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled | none | | encryption | boolean | Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled | 1 | | antivirus | boolean | Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled | 1 | +| transformations | boolean | Are image transformations enabled? | 1 | ```http request diff --git a/docs/tablesdb.md b/docs/tablesdb.md index 1b75fe7..7005a2d 100644 --- a/docs/tablesdb.md +++ b/docs/tablesdb.md @@ -216,7 +216,7 @@ PUT https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId} | tableId | string | **Required** Table ID. | | | name | string | Table name. Max length: 128 chars. | | | permissions | array | An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | -| rowSecurity | boolean | Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| rowSecurity | boolean | Enables configuring permissions for individual rows. A user needs one of row or table-level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). | | | enabled | boolean | Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. | 1 | diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php index 28142f8..a829fd7 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/18.0.1 ()', + 'user-agent' => 'AppwritePHPSDK/19.0.0 ()', 'x-sdk-name'=> 'PHP', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'php', - 'x-sdk-version'=> '18.0.1', + 'x-sdk-version'=> '19.0.0', ]; /** diff --git a/src/Appwrite/Enums/BuildRuntime.php b/src/Appwrite/Enums/BuildRuntime.php index 4fea891..0806513 100644 --- a/src/Appwrite/Enums/BuildRuntime.php +++ b/src/Appwrite/Enums/BuildRuntime.php @@ -44,6 +44,7 @@ class BuildRuntime implements JsonSerializable private static BuildRuntime $DART33; private static BuildRuntime $DART35; private static BuildRuntime $DART38; + private static BuildRuntime $DART39; private static BuildRuntime $DOTNET60; private static BuildRuntime $DOTNET70; private static BuildRuntime $DOTNET80; @@ -71,6 +72,7 @@ class BuildRuntime implements JsonSerializable private static BuildRuntime $FLUTTER327; private static BuildRuntime $FLUTTER329; private static BuildRuntime $FLUTTER332; + private static BuildRuntime $FLUTTER335; private string $value; @@ -355,6 +357,13 @@ public static function DART38(): BuildRuntime } return self::$DART38; } + public static function DART39(): BuildRuntime + { + if (!isset(self::$DART39)) { + self::$DART39 = new BuildRuntime('dart-3.9'); + } + return self::$DART39; + } public static function DOTNET60(): BuildRuntime { if (!isset(self::$DOTNET60)) { @@ -544,4 +553,11 @@ public static function FLUTTER332(): BuildRuntime } return self::$FLUTTER332; } + public static function FLUTTER335(): BuildRuntime + { + if (!isset(self::$FLUTTER335)) { + self::$FLUTTER335 = new BuildRuntime('flutter-3.35'); + } + return self::$FLUTTER335; + } } \ No newline at end of file diff --git a/src/Appwrite/Enums/Runtime.php b/src/Appwrite/Enums/Runtime.php index a210be9..75e78e5 100644 --- a/src/Appwrite/Enums/Runtime.php +++ b/src/Appwrite/Enums/Runtime.php @@ -44,6 +44,7 @@ class Runtime implements JsonSerializable private static Runtime $DART33; private static Runtime $DART35; private static Runtime $DART38; + private static Runtime $DART39; private static Runtime $DOTNET60; private static Runtime $DOTNET70; private static Runtime $DOTNET80; @@ -71,6 +72,7 @@ class Runtime implements JsonSerializable private static Runtime $FLUTTER327; private static Runtime $FLUTTER329; private static Runtime $FLUTTER332; + private static Runtime $FLUTTER335; private string $value; @@ -355,6 +357,13 @@ public static function DART38(): Runtime } return self::$DART38; } + public static function DART39(): Runtime + { + if (!isset(self::$DART39)) { + self::$DART39 = new Runtime('dart-3.9'); + } + return self::$DART39; + } public static function DOTNET60(): Runtime { if (!isset(self::$DOTNET60)) { @@ -544,4 +553,11 @@ public static function FLUTTER332(): Runtime } return self::$FLUTTER332; } + public static function FLUTTER335(): Runtime + { + if (!isset(self::$FLUTTER335)) { + self::$FLUTTER335 = new Runtime('flutter-3.35'); + } + return self::$FLUTTER335; + } } \ No newline at end of file diff --git a/src/Appwrite/Enums/TemplateReferenceType.php b/src/Appwrite/Enums/TemplateReferenceType.php new file mode 100644 index 0000000..7d3e22f --- /dev/null +++ b/src/Appwrite/Enums/TemplateReferenceType.php @@ -0,0 +1,51 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function BRANCH(): TemplateReferenceType + { + if (!isset(self::$BRANCH)) { + self::$BRANCH = new TemplateReferenceType('branch'); + } + return self::$BRANCH; + } + public static function COMMIT(): TemplateReferenceType + { + if (!isset(self::$COMMIT)) { + self::$COMMIT = new TemplateReferenceType('commit'); + } + return self::$COMMIT; + } + public static function TAG(): TemplateReferenceType + { + if (!isset(self::$TAG)) { + self::$TAG = new TemplateReferenceType('tag'); + } + return self::$TAG; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/VCSDeploymentType.php b/src/Appwrite/Enums/VCSReferenceType.php similarity index 53% rename from src/Appwrite/Enums/VCSDeploymentType.php rename to src/Appwrite/Enums/VCSReferenceType.php index f5ec544..adeb723 100644 --- a/src/Appwrite/Enums/VCSDeploymentType.php +++ b/src/Appwrite/Enums/VCSReferenceType.php @@ -4,11 +4,11 @@ use JsonSerializable; -class VCSDeploymentType implements JsonSerializable +class VCSReferenceType implements JsonSerializable { - private static VCSDeploymentType $BRANCH; - private static VCSDeploymentType $COMMIT; - private static VCSDeploymentType $TAG; + private static VCSReferenceType $BRANCH; + private static VCSReferenceType $COMMIT; + private static VCSReferenceType $TAG; private string $value; @@ -27,24 +27,24 @@ public function jsonSerialize(): string return $this->value; } - public static function BRANCH(): VCSDeploymentType + public static function BRANCH(): VCSReferenceType { if (!isset(self::$BRANCH)) { - self::$BRANCH = new VCSDeploymentType('branch'); + self::$BRANCH = new VCSReferenceType('branch'); } return self::$BRANCH; } - public static function COMMIT(): VCSDeploymentType + public static function COMMIT(): VCSReferenceType { if (!isset(self::$COMMIT)) { - self::$COMMIT = new VCSDeploymentType('commit'); + self::$COMMIT = new VCSReferenceType('commit'); } return self::$COMMIT; } - public static function TAG(): VCSDeploymentType + public static function TAG(): VCSReferenceType { if (!isset(self::$TAG)) { - self::$TAG = new VCSDeploymentType('tag'); + self::$TAG = new VCSReferenceType('tag'); } return self::$TAG; } diff --git a/src/Appwrite/Services/Account.php b/src/Appwrite/Services/Account.php index 6d45d4f..cfb1b34 100644 --- a/src/Appwrite/Services/Account.php +++ b/src/Appwrite/Services/Account.php @@ -395,7 +395,7 @@ public function createMFAChallenge(AuthenticationFactor $factor): array $apiPath = str_replace( [], [], - '/account/mfa/challenge' + '/account/mfa/challenges' ); $apiParams = []; @@ -429,7 +429,7 @@ public function updateMFAChallenge(string $challengeId, string $otp): array $apiPath = str_replace( [], [], - '/account/mfa/challenge' + '/account/mfa/challenges' ); $apiParams = []; diff --git a/src/Appwrite/Services/Databases.php b/src/Appwrite/Services/Databases.php index 8fad8dc..5074468 100644 --- a/src/Appwrite/Services/Databases.php +++ b/src/Appwrite/Services/Databases.php @@ -476,10 +476,7 @@ public function createCollection(string $databaseId, string $collectionId, strin $apiParams['databaseId'] = $databaseId; $apiParams['collectionId'] = $collectionId; $apiParams['name'] = $name; - - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } + $apiParams['permissions'] = $permissions; if (!is_null($documentSecurity)) { $apiParams['documentSecurity'] = $documentSecurity; @@ -561,10 +558,7 @@ public function updateCollection(string $databaseId, string $collectionId, strin $apiParams['databaseId'] = $databaseId; $apiParams['collectionId'] = $collectionId; $apiParams['name'] = $name; - - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } + $apiParams['permissions'] = $permissions; if (!is_null($documentSecurity)) { $apiParams['documentSecurity'] = $documentSecurity; @@ -692,10 +686,7 @@ public function createBooleanAttribute(string $databaseId, string $collectionId, $apiParams['collectionId'] = $collectionId; $apiParams['key'] = $key; $apiParams['required'] = $required; - - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } + $apiParams['default'] = $xdefault; if (!is_null($xarray)) { $apiParams['array'] = $xarray; @@ -742,10 +733,7 @@ public function updateBooleanAttribute(string $databaseId, string $collectionId, $apiParams['key'] = $key; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -786,10 +774,7 @@ public function createDatetimeAttribute(string $databaseId, string $collectionId $apiParams['collectionId'] = $collectionId; $apiParams['key'] = $key; $apiParams['required'] = $required; - - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } + $apiParams['default'] = $xdefault; if (!is_null($xarray)) { $apiParams['array'] = $xarray; @@ -836,10 +821,7 @@ public function updateDatetimeAttribute(string $databaseId, string $collectionId $apiParams['key'] = $key; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -881,10 +863,7 @@ public function createEmailAttribute(string $databaseId, string $collectionId, s $apiParams['collectionId'] = $collectionId; $apiParams['key'] = $key; $apiParams['required'] = $required; - - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } + $apiParams['default'] = $xdefault; if (!is_null($xarray)) { $apiParams['array'] = $xarray; @@ -932,10 +911,7 @@ public function updateEmailAttribute(string $databaseId, string $collectionId, s $apiParams['key'] = $key; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -980,10 +956,7 @@ public function createEnumAttribute(string $databaseId, string $collectionId, st $apiParams['key'] = $key; $apiParams['elements'] = $elements; $apiParams['required'] = $required; - - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } + $apiParams['default'] = $xdefault; if (!is_null($xarray)) { $apiParams['array'] = $xarray; @@ -1033,10 +1006,7 @@ public function updateEnumAttribute(string $databaseId, string $collectionId, st $apiParams['elements'] = $elements; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1081,18 +1051,9 @@ public function createFloatAttribute(string $databaseId, string $collectionId, s $apiParams['collectionId'] = $collectionId; $apiParams['key'] = $key; $apiParams['required'] = $required; - - if (!is_null($min)) { - $apiParams['min'] = $min; - } - - if (!is_null($max)) { - $apiParams['max'] = $max; - } - - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } + $apiParams['min'] = $min; + $apiParams['max'] = $max; + $apiParams['default'] = $xdefault; if (!is_null($xarray)) { $apiParams['array'] = $xarray; @@ -1142,18 +1103,9 @@ public function updateFloatAttribute(string $databaseId, string $collectionId, s $apiParams['key'] = $key; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($min)) { - $apiParams['min'] = $min; - } - - if (!is_null($max)) { - $apiParams['max'] = $max; - } - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['min'] = $min; + $apiParams['max'] = $max; + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1198,18 +1150,9 @@ public function createIntegerAttribute(string $databaseId, string $collectionId, $apiParams['collectionId'] = $collectionId; $apiParams['key'] = $key; $apiParams['required'] = $required; - - if (!is_null($min)) { - $apiParams['min'] = $min; - } - - if (!is_null($max)) { - $apiParams['max'] = $max; - } - - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } + $apiParams['min'] = $min; + $apiParams['max'] = $max; + $apiParams['default'] = $xdefault; if (!is_null($xarray)) { $apiParams['array'] = $xarray; @@ -1259,18 +1202,9 @@ public function updateIntegerAttribute(string $databaseId, string $collectionId, $apiParams['key'] = $key; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($min)) { - $apiParams['min'] = $min; - } - - if (!is_null($max)) { - $apiParams['max'] = $max; - } - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['min'] = $min; + $apiParams['max'] = $max; + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1312,10 +1246,7 @@ public function createIpAttribute(string $databaseId, string $collectionId, stri $apiParams['collectionId'] = $collectionId; $apiParams['key'] = $key; $apiParams['required'] = $required; - - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } + $apiParams['default'] = $xdefault; if (!is_null($xarray)) { $apiParams['array'] = $xarray; @@ -1363,10 +1294,7 @@ public function updateIpAttribute(string $databaseId, string $collectionId, stri $apiParams['key'] = $key; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1449,10 +1377,7 @@ public function updateLineAttribute(string $databaseId, string $collectionId, st $apiParams['key'] = $key; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1535,10 +1460,7 @@ public function updatePointAttribute(string $databaseId, string $collectionId, s $apiParams['key'] = $key; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1621,10 +1543,7 @@ public function updatePolygonAttribute(string $databaseId, string $collectionId, $apiParams['key'] = $key; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1673,14 +1592,8 @@ public function createRelationshipAttribute(string $databaseId, string $collecti if (!is_null($twoWay)) { $apiParams['twoWay'] = $twoWay; } - - if (!is_null($key)) { - $apiParams['key'] = $key; - } - - if (!is_null($twoWayKey)) { - $apiParams['twoWayKey'] = $twoWayKey; - } + $apiParams['key'] = $key; + $apiParams['twoWayKey'] = $twoWayKey; if (!is_null($onDelete)) { $apiParams['onDelete'] = $onDelete; @@ -1729,10 +1642,7 @@ public function createStringAttribute(string $databaseId, string $collectionId, $apiParams['key'] = $key; $apiParams['size'] = $size; $apiParams['required'] = $required; - - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } + $apiParams['default'] = $xdefault; if (!is_null($xarray)) { $apiParams['array'] = $xarray; @@ -1785,14 +1695,8 @@ public function updateStringAttribute(string $databaseId, string $collectionId, $apiParams['key'] = $key; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($size)) { - $apiParams['size'] = $size; - } - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['size'] = $size; + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1834,10 +1738,7 @@ public function createUrlAttribute(string $databaseId, string $collectionId, str $apiParams['collectionId'] = $collectionId; $apiParams['key'] = $key; $apiParams['required'] = $required; - - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } + $apiParams['default'] = $xdefault; if (!is_null($xarray)) { $apiParams['array'] = $xarray; @@ -1885,10 +1786,7 @@ public function updateUrlAttribute(string $databaseId, string $collectionId, str $apiParams['key'] = $key; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -2000,14 +1898,8 @@ public function updateRelationshipAttribute(string $databaseId, string $collecti $apiParams['databaseId'] = $databaseId; $apiParams['collectionId'] = $collectionId; $apiParams['key'] = $key; - - if (!is_null($onDelete)) { - $apiParams['onDelete'] = $onDelete; - } - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['onDelete'] = $onDelete; + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -2100,14 +1992,8 @@ public function createDocument(string $databaseId, string $collectionId, string $apiParams['collectionId'] = $collectionId; $apiParams['documentId'] = $documentId; $apiParams['data'] = $data; - - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } + $apiParams['permissions'] = $permissions; + $apiParams['transactionId'] = $transactionId; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -2148,10 +2034,7 @@ public function createDocuments(string $databaseId, string $collectionId, array $apiParams['databaseId'] = $databaseId; $apiParams['collectionId'] = $collectionId; $apiParams['documents'] = $documents; - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } + $apiParams['transactionId'] = $transactionId; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -2193,10 +2076,7 @@ public function upsertDocuments(string $databaseId, string $collectionId, array $apiParams['databaseId'] = $databaseId; $apiParams['collectionId'] = $collectionId; $apiParams['documents'] = $documents; - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } + $apiParams['transactionId'] = $transactionId; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -2244,10 +2124,7 @@ public function updateDocuments(string $databaseId, string $collectionId, ?array if (!is_null($queries)) { $apiParams['queries'] = $queries; } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } + $apiParams['transactionId'] = $transactionId; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -2289,10 +2166,7 @@ public function deleteDocuments(string $databaseId, string $collectionId, ?array if (!is_null($queries)) { $apiParams['queries'] = $queries; } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } + $apiParams['transactionId'] = $transactionId; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -2382,14 +2256,8 @@ public function upsertDocument(string $databaseId, string $collectionId, string $apiParams['collectionId'] = $collectionId; $apiParams['documentId'] = $documentId; $apiParams['data'] = $data; - - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } + $apiParams['permissions'] = $permissions; + $apiParams['transactionId'] = $transactionId; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -2434,14 +2302,8 @@ public function updateDocument(string $databaseId, string $collectionId, string if (!is_null($data)) { $apiParams['data'] = $data; } - - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } + $apiParams['permissions'] = $permissions; + $apiParams['transactionId'] = $transactionId; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -2479,10 +2341,7 @@ public function deleteDocument(string $databaseId, string $collectionId, string $apiParams['databaseId'] = $databaseId; $apiParams['collectionId'] = $collectionId; $apiParams['documentId'] = $documentId; - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } + $apiParams['transactionId'] = $transactionId; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -2528,14 +2387,8 @@ public function decrementDocumentAttribute(string $databaseId, string $collectio if (!is_null($value)) { $apiParams['value'] = $value; } - - if (!is_null($min)) { - $apiParams['min'] = $min; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } + $apiParams['min'] = $min; + $apiParams['transactionId'] = $transactionId; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -2581,14 +2434,8 @@ public function incrementDocumentAttribute(string $databaseId, string $collectio if (!is_null($value)) { $apiParams['value'] = $value; } - - if (!is_null($max)) { - $apiParams['max'] = $max; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } + $apiParams['max'] = $max; + $apiParams['transactionId'] = $transactionId; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; diff --git a/src/Appwrite/Services/Functions.php b/src/Appwrite/Services/Functions.php index 33f9b88..0279cb7 100644 --- a/src/Appwrite/Services/Functions.php +++ b/src/Appwrite/Services/Functions.php @@ -7,7 +7,8 @@ use Appwrite\Service; use Appwrite\InputFile; use Appwrite\Enums\Runtime; -use Appwrite\Enums\VCSDeploymentType; +use Appwrite\Enums\TemplateReferenceType; +use Appwrite\Enums\VCSReferenceType; use Appwrite\Enums\DeploymentDownloadType; use Appwrite\Enums\ExecutionMethod; @@ -632,12 +633,13 @@ public function createDuplicateDeployment(string $functionId, string $deployment * @param string $repository * @param string $owner * @param string $rootDirectory - * @param string $version + * @param TemplateReferenceType $type + * @param string $reference * @param ?bool $activate * @throws AppwriteException * @return array */ - public function createTemplateDeployment(string $functionId, string $repository, string $owner, string $rootDirectory, string $version, ?bool $activate = null): array + public function createTemplateDeployment(string $functionId, string $repository, string $owner, string $rootDirectory, TemplateReferenceType $type, string $reference, ?bool $activate = null): array { $apiPath = str_replace( ['{functionId}'], @@ -650,7 +652,8 @@ public function createTemplateDeployment(string $functionId, string $repository, $apiParams['repository'] = $repository; $apiParams['owner'] = $owner; $apiParams['rootDirectory'] = $rootDirectory; - $apiParams['version'] = $version; + $apiParams['type'] = $type; + $apiParams['reference'] = $reference; if (!is_null($activate)) { $apiParams['activate'] = $activate; @@ -673,13 +676,13 @@ public function createTemplateDeployment(string $functionId, string $repository, * This endpoint lets you create deployment from a branch, commit, or a tag. * * @param string $functionId - * @param VCSDeploymentType $type + * @param VCSReferenceType $type * @param string $reference * @param ?bool $activate * @throws AppwriteException * @return array */ - public function createVcsDeployment(string $functionId, VCSDeploymentType $type, string $reference, ?bool $activate = null): array + public function createVcsDeployment(string $functionId, VCSReferenceType $type, string $reference, ?bool $activate = null): array { $apiPath = str_replace( ['{functionId}'], @@ -925,10 +928,7 @@ public function createExecution(string $functionId, ?string $body = null, ?bool if (!is_null($headers)) { $apiParams['headers'] = $headers; } - - if (!is_null($scheduledAt)) { - $apiParams['scheduledAt'] = $scheduledAt; - } + $apiParams['scheduledAt'] = $scheduledAt; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1122,14 +1122,8 @@ public function updateVariable(string $functionId, string $variableId, string $k $apiParams['functionId'] = $functionId; $apiParams['variableId'] = $variableId; $apiParams['key'] = $key; - - if (!is_null($value)) { - $apiParams['value'] = $value; - } - - if (!is_null($secret)) { - $apiParams['secret'] = $secret; - } + $apiParams['value'] = $value; + $apiParams['secret'] = $secret; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; diff --git a/src/Appwrite/Services/Messaging.php b/src/Appwrite/Services/Messaging.php index f18430d..df72407 100644 --- a/src/Appwrite/Services/Messaging.php +++ b/src/Appwrite/Services/Messaging.php @@ -119,10 +119,7 @@ public function createEmail(string $messageId, string $subject, string $content, if (!is_null($html)) { $apiParams['html'] = $html; } - - if (!is_null($scheduledAt)) { - $apiParams['scheduledAt'] = $scheduledAt; - } + $apiParams['scheduledAt'] = $scheduledAt; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -166,50 +163,17 @@ public function updateEmail(string $messageId, ?array $topics = null, ?array $us $apiParams = []; $apiParams['messageId'] = $messageId; - - if (!is_null($topics)) { - $apiParams['topics'] = $topics; - } - - if (!is_null($users)) { - $apiParams['users'] = $users; - } - - if (!is_null($targets)) { - $apiParams['targets'] = $targets; - } - - if (!is_null($subject)) { - $apiParams['subject'] = $subject; - } - - if (!is_null($content)) { - $apiParams['content'] = $content; - } - - if (!is_null($draft)) { - $apiParams['draft'] = $draft; - } - - if (!is_null($html)) { - $apiParams['html'] = $html; - } - - if (!is_null($cc)) { - $apiParams['cc'] = $cc; - } - - if (!is_null($bcc)) { - $apiParams['bcc'] = $bcc; - } - - if (!is_null($scheduledAt)) { - $apiParams['scheduledAt'] = $scheduledAt; - } - - if (!is_null($attachments)) { - $apiParams['attachments'] = $attachments; - } + $apiParams['topics'] = $topics; + $apiParams['users'] = $users; + $apiParams['targets'] = $targets; + $apiParams['subject'] = $subject; + $apiParams['content'] = $content; + $apiParams['draft'] = $draft; + $apiParams['html'] = $html; + $apiParams['cc'] = $cc; + $apiParams['bcc'] = $bcc; + $apiParams['scheduledAt'] = $scheduledAt; + $apiParams['attachments'] = $attachments; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -277,10 +241,7 @@ public function createPush(string $messageId, ?string $title = null, ?string $bo if (!is_null($targets)) { $apiParams['targets'] = $targets; } - - if (!is_null($data)) { - $apiParams['data'] = $data; - } + $apiParams['data'] = $data; if (!is_null($action)) { $apiParams['action'] = $action; @@ -313,10 +274,7 @@ public function createPush(string $messageId, ?string $title = null, ?string $bo if (!is_null($draft)) { $apiParams['draft'] = $draft; } - - if (!is_null($scheduledAt)) { - $apiParams['scheduledAt'] = $scheduledAt; - } + $apiParams['scheduledAt'] = $scheduledAt; if (!is_null($contentAvailable)) { $apiParams['contentAvailable'] = $contentAvailable; @@ -379,78 +337,24 @@ public function updatePush(string $messageId, ?array $topics = null, ?array $use $apiParams = []; $apiParams['messageId'] = $messageId; - - if (!is_null($topics)) { - $apiParams['topics'] = $topics; - } - - if (!is_null($users)) { - $apiParams['users'] = $users; - } - - if (!is_null($targets)) { - $apiParams['targets'] = $targets; - } - - if (!is_null($title)) { - $apiParams['title'] = $title; - } - - if (!is_null($body)) { - $apiParams['body'] = $body; - } - - if (!is_null($data)) { - $apiParams['data'] = $data; - } - - if (!is_null($action)) { - $apiParams['action'] = $action; - } - - if (!is_null($image)) { - $apiParams['image'] = $image; - } - - if (!is_null($icon)) { - $apiParams['icon'] = $icon; - } - - if (!is_null($sound)) { - $apiParams['sound'] = $sound; - } - - if (!is_null($color)) { - $apiParams['color'] = $color; - } - - if (!is_null($tag)) { - $apiParams['tag'] = $tag; - } - - if (!is_null($badge)) { - $apiParams['badge'] = $badge; - } - - if (!is_null($draft)) { - $apiParams['draft'] = $draft; - } - - if (!is_null($scheduledAt)) { - $apiParams['scheduledAt'] = $scheduledAt; - } - - if (!is_null($contentAvailable)) { - $apiParams['contentAvailable'] = $contentAvailable; - } - - if (!is_null($critical)) { - $apiParams['critical'] = $critical; - } - - if (!is_null($priority)) { - $apiParams['priority'] = $priority; - } + $apiParams['topics'] = $topics; + $apiParams['users'] = $users; + $apiParams['targets'] = $targets; + $apiParams['title'] = $title; + $apiParams['body'] = $body; + $apiParams['data'] = $data; + $apiParams['action'] = $action; + $apiParams['image'] = $image; + $apiParams['icon'] = $icon; + $apiParams['sound'] = $sound; + $apiParams['color'] = $color; + $apiParams['tag'] = $tag; + $apiParams['badge'] = $badge; + $apiParams['draft'] = $draft; + $apiParams['scheduledAt'] = $scheduledAt; + $apiParams['contentAvailable'] = $contentAvailable; + $apiParams['critical'] = $critical; + $apiParams['priority'] = $priority; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -503,10 +407,7 @@ public function createSMS(string $messageId, string $content, ?array $topics = n if (!is_null($draft)) { $apiParams['draft'] = $draft; } - - if (!is_null($scheduledAt)) { - $apiParams['scheduledAt'] = $scheduledAt; - } + $apiParams['scheduledAt'] = $scheduledAt; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -545,30 +446,12 @@ public function updateSMS(string $messageId, ?array $topics = null, ?array $user $apiParams = []; $apiParams['messageId'] = $messageId; - - if (!is_null($topics)) { - $apiParams['topics'] = $topics; - } - - if (!is_null($users)) { - $apiParams['users'] = $users; - } - - if (!is_null($targets)) { - $apiParams['targets'] = $targets; - } - - if (!is_null($content)) { - $apiParams['content'] = $content; - } - - if (!is_null($draft)) { - $apiParams['draft'] = $draft; - } - - if (!is_null($scheduledAt)) { - $apiParams['scheduledAt'] = $scheduledAt; - } + $apiParams['topics'] = $topics; + $apiParams['users'] = $users; + $apiParams['targets'] = $targets; + $apiParams['content'] = $content; + $apiParams['draft'] = $draft; + $apiParams['scheduledAt'] = $scheduledAt; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -802,10 +685,7 @@ public function createAPNSProvider(string $providerId, string $name, ?string $au if (!is_null($sandbox)) { $apiParams['sandbox'] = $sandbox; } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } + $apiParams['enabled'] = $enabled; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -846,10 +726,7 @@ public function updateAPNSProvider(string $providerId, ?string $name = null, ?bo if (!is_null($name)) { $apiParams['name'] = $name; } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } + $apiParams['enabled'] = $enabled; if (!is_null($authKey)) { $apiParams['authKey'] = $authKey; @@ -866,10 +743,7 @@ public function updateAPNSProvider(string $providerId, ?string $name = null, ?bo if (!is_null($bundleId)) { $apiParams['bundleId'] = $bundleId; } - - if (!is_null($sandbox)) { - $apiParams['sandbox'] = $sandbox; - } + $apiParams['sandbox'] = $sandbox; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -903,14 +777,8 @@ public function createFCMProvider(string $providerId, string $name, ?array $serv $apiParams = []; $apiParams['providerId'] = $providerId; $apiParams['name'] = $name; - - if (!is_null($serviceAccountJSON)) { - $apiParams['serviceAccountJSON'] = $serviceAccountJSON; - } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } + $apiParams['serviceAccountJSON'] = $serviceAccountJSON; + $apiParams['enabled'] = $enabled; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -947,14 +815,8 @@ public function updateFCMProvider(string $providerId, ?string $name = null, ?boo if (!is_null($name)) { $apiParams['name'] = $name; } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - - if (!is_null($serviceAccountJSON)) { - $apiParams['serviceAccountJSON'] = $serviceAccountJSON; - } + $apiParams['enabled'] = $enabled; + $apiParams['serviceAccountJSON'] = $serviceAccountJSON; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1002,10 +864,7 @@ public function createMailgunProvider(string $providerId, string $name, ?string if (!is_null($domain)) { $apiParams['domain'] = $domain; } - - if (!is_null($isEuRegion)) { - $apiParams['isEuRegion'] = $isEuRegion; - } + $apiParams['isEuRegion'] = $isEuRegion; if (!is_null($fromName)) { $apiParams['fromName'] = $fromName; @@ -1022,10 +881,7 @@ public function createMailgunProvider(string $providerId, string $name, ?string if (!is_null($replyToEmail)) { $apiParams['replyToEmail'] = $replyToEmail; } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } + $apiParams['enabled'] = $enabled; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1076,14 +932,8 @@ public function updateMailgunProvider(string $providerId, ?string $name = null, if (!is_null($domain)) { $apiParams['domain'] = $domain; } - - if (!is_null($isEuRegion)) { - $apiParams['isEuRegion'] = $isEuRegion; - } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } + $apiParams['isEuRegion'] = $isEuRegion; + $apiParams['enabled'] = $enabled; if (!is_null($fromName)) { $apiParams['fromName'] = $fromName; @@ -1147,10 +997,7 @@ public function createMsg91Provider(string $providerId, string $name, ?string $t if (!is_null($authKey)) { $apiParams['authKey'] = $authKey; } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } + $apiParams['enabled'] = $enabled; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1189,10 +1036,7 @@ public function updateMsg91Provider(string $providerId, ?string $name = null, ?b if (!is_null($name)) { $apiParams['name'] = $name; } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } + $apiParams['enabled'] = $enabled; if (!is_null($templateId)) { $apiParams['templateId'] = $templateId; @@ -1262,10 +1106,7 @@ public function createResendProvider(string $providerId, string $name, ?string $ if (!is_null($replyToEmail)) { $apiParams['replyToEmail'] = $replyToEmail; } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } + $apiParams['enabled'] = $enabled; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1306,10 +1147,7 @@ public function updateResendProvider(string $providerId, ?string $name = null, ? if (!is_null($name)) { $apiParams['name'] = $name; } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } + $apiParams['enabled'] = $enabled; if (!is_null($apiKey)) { $apiParams['apiKey'] = $apiKey; @@ -1387,10 +1225,7 @@ public function createSendgridProvider(string $providerId, string $name, ?string if (!is_null($replyToEmail)) { $apiParams['replyToEmail'] = $replyToEmail; } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } + $apiParams['enabled'] = $enabled; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1431,10 +1266,7 @@ public function updateSendgridProvider(string $providerId, ?string $name = null, if (!is_null($name)) { $apiParams['name'] = $name; } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } + $apiParams['enabled'] = $enabled; if (!is_null($apiKey)) { $apiParams['apiKey'] = $apiKey; @@ -1539,10 +1371,7 @@ public function createSMTPProvider(string $providerId, string $name, string $hos if (!is_null($replyToEmail)) { $apiParams['replyToEmail'] = $replyToEmail; } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } + $apiParams['enabled'] = $enabled; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1593,10 +1422,7 @@ public function updateSMTPProvider(string $providerId, ?string $name = null, ?st if (!is_null($host)) { $apiParams['host'] = $host; } - - if (!is_null($port)) { - $apiParams['port'] = $port; - } + $apiParams['port'] = $port; if (!is_null($username)) { $apiParams['username'] = $username; @@ -1609,10 +1435,7 @@ public function updateSMTPProvider(string $providerId, ?string $name = null, ?st if (!is_null($encryption)) { $apiParams['encryption'] = $encryption; } - - if (!is_null($autoTLS)) { - $apiParams['autoTLS'] = $autoTLS; - } + $apiParams['autoTLS'] = $autoTLS; if (!is_null($mailer)) { $apiParams['mailer'] = $mailer; @@ -1633,10 +1456,7 @@ public function updateSMTPProvider(string $providerId, ?string $name = null, ?st if (!is_null($replyToEmail)) { $apiParams['replyToEmail'] = $replyToEmail; } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } + $apiParams['enabled'] = $enabled; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1684,10 +1504,7 @@ public function createTelesignProvider(string $providerId, string $name, ?string if (!is_null($apiKey)) { $apiParams['apiKey'] = $apiKey; } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } + $apiParams['enabled'] = $enabled; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1726,10 +1543,7 @@ public function updateTelesignProvider(string $providerId, ?string $name = null, if (!is_null($name)) { $apiParams['name'] = $name; } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } + $apiParams['enabled'] = $enabled; if (!is_null($customerId)) { $apiParams['customerId'] = $customerId; @@ -1789,10 +1603,7 @@ public function createTextmagicProvider(string $providerId, string $name, ?strin if (!is_null($apiKey)) { $apiParams['apiKey'] = $apiKey; } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } + $apiParams['enabled'] = $enabled; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1831,10 +1642,7 @@ public function updateTextmagicProvider(string $providerId, ?string $name = null if (!is_null($name)) { $apiParams['name'] = $name; } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } + $apiParams['enabled'] = $enabled; if (!is_null($username)) { $apiParams['username'] = $username; @@ -1894,10 +1702,7 @@ public function createTwilioProvider(string $providerId, string $name, ?string $ if (!is_null($authToken)) { $apiParams['authToken'] = $authToken; } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } + $apiParams['enabled'] = $enabled; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1936,10 +1741,7 @@ public function updateTwilioProvider(string $providerId, ?string $name = null, ? if (!is_null($name)) { $apiParams['name'] = $name; } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } + $apiParams['enabled'] = $enabled; if (!is_null($accountSid)) { $apiParams['accountSid'] = $accountSid; @@ -1999,10 +1801,7 @@ public function createVonageProvider(string $providerId, string $name, ?string $ if (!is_null($apiSecret)) { $apiParams['apiSecret'] = $apiSecret; } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } + $apiParams['enabled'] = $enabled; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -2041,10 +1840,7 @@ public function updateVonageProvider(string $providerId, ?string $name = null, ? if (!is_null($name)) { $apiParams['name'] = $name; } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } + $apiParams['enabled'] = $enabled; if (!is_null($apiKey)) { $apiParams['apiKey'] = $apiKey; @@ -2329,14 +2125,8 @@ public function updateTopic(string $topicId, ?string $name = null, ?array $subsc $apiParams = []; $apiParams['topicId'] = $topicId; - - if (!is_null($name)) { - $apiParams['name'] = $name; - } - - if (!is_null($subscribe)) { - $apiParams['subscribe'] = $subscribe; - } + $apiParams['name'] = $name; + $apiParams['subscribe'] = $subscribe; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; diff --git a/src/Appwrite/Services/Sites.php b/src/Appwrite/Services/Sites.php index e94ac0e..cabd1a6 100644 --- a/src/Appwrite/Services/Sites.php +++ b/src/Appwrite/Services/Sites.php @@ -9,7 +9,8 @@ use Appwrite\Enums\Framework; use Appwrite\Enums\BuildRuntime; use Appwrite\Enums\Adapter; -use Appwrite\Enums\VCSDeploymentType; +use Appwrite\Enums\TemplateReferenceType; +use Appwrite\Enums\VCSReferenceType; use Appwrite\Enums\DeploymentDownloadType; class Sites extends Service @@ -621,12 +622,13 @@ public function createDuplicateDeployment(string $siteId, string $deploymentId): * @param string $repository * @param string $owner * @param string $rootDirectory - * @param string $version + * @param TemplateReferenceType $type + * @param string $reference * @param ?bool $activate * @throws AppwriteException * @return array */ - public function createTemplateDeployment(string $siteId, string $repository, string $owner, string $rootDirectory, string $version, ?bool $activate = null): array + public function createTemplateDeployment(string $siteId, string $repository, string $owner, string $rootDirectory, TemplateReferenceType $type, string $reference, ?bool $activate = null): array { $apiPath = str_replace( ['{siteId}'], @@ -639,7 +641,8 @@ public function createTemplateDeployment(string $siteId, string $repository, str $apiParams['repository'] = $repository; $apiParams['owner'] = $owner; $apiParams['rootDirectory'] = $rootDirectory; - $apiParams['version'] = $version; + $apiParams['type'] = $type; + $apiParams['reference'] = $reference; if (!is_null($activate)) { $apiParams['activate'] = $activate; @@ -662,13 +665,13 @@ public function createTemplateDeployment(string $siteId, string $repository, str * This endpoint lets you create deployment from a branch, commit, or a tag. * * @param string $siteId - * @param VCSDeploymentType $type + * @param VCSReferenceType $type * @param string $reference * @param ?bool $activate * @throws AppwriteException * @return array */ - public function createVcsDeployment(string $siteId, VCSDeploymentType $type, string $reference, ?bool $activate = null): array + public function createVcsDeployment(string $siteId, VCSReferenceType $type, string $reference, ?bool $activate = null): array { $apiPath = str_replace( ['{siteId}'], @@ -1049,14 +1052,8 @@ public function updateVariable(string $siteId, string $variableId, string $key, $apiParams['siteId'] = $siteId; $apiParams['variableId'] = $variableId; $apiParams['key'] = $key; - - if (!is_null($value)) { - $apiParams['value'] = $value; - } - - if (!is_null($secret)) { - $apiParams['secret'] = $secret; - } + $apiParams['value'] = $value; + $apiParams['secret'] = $secret; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; diff --git a/src/Appwrite/Services/Storage.php b/src/Appwrite/Services/Storage.php index 0da05c1..67a7611 100644 --- a/src/Appwrite/Services/Storage.php +++ b/src/Appwrite/Services/Storage.php @@ -72,10 +72,11 @@ public function listBuckets(?array $queries = null, ?string $search = null, ?boo * @param ?Compression $compression * @param ?bool $encryption * @param ?bool $antivirus + * @param ?bool $transformations * @throws AppwriteException * @return array */ - public function createBucket(string $bucketId, string $name, ?array $permissions = null, ?bool $fileSecurity = null, ?bool $enabled = null, ?int $maximumFileSize = null, ?array $allowedFileExtensions = null, ?Compression $compression = null, ?bool $encryption = null, ?bool $antivirus = null): array + public function createBucket(string $bucketId, string $name, ?array $permissions = null, ?bool $fileSecurity = null, ?bool $enabled = null, ?int $maximumFileSize = null, ?array $allowedFileExtensions = null, ?Compression $compression = null, ?bool $encryption = null, ?bool $antivirus = null, ?bool $transformations = null): array { $apiPath = str_replace( [], @@ -86,10 +87,7 @@ public function createBucket(string $bucketId, string $name, ?array $permissions $apiParams = []; $apiParams['bucketId'] = $bucketId; $apiParams['name'] = $name; - - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } + $apiParams['permissions'] = $permissions; if (!is_null($fileSecurity)) { $apiParams['fileSecurity'] = $fileSecurity; @@ -119,6 +117,10 @@ public function createBucket(string $bucketId, string $name, ?array $permissions $apiParams['antivirus'] = $antivirus; } + if (!is_null($transformations)) { + $apiParams['transformations'] = $transformations; + } + $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -172,10 +174,11 @@ public function getBucket(string $bucketId): array * @param ?Compression $compression * @param ?bool $encryption * @param ?bool $antivirus + * @param ?bool $transformations * @throws AppwriteException * @return array */ - public function updateBucket(string $bucketId, string $name, ?array $permissions = null, ?bool $fileSecurity = null, ?bool $enabled = null, ?int $maximumFileSize = null, ?array $allowedFileExtensions = null, ?Compression $compression = null, ?bool $encryption = null, ?bool $antivirus = null): array + public function updateBucket(string $bucketId, string $name, ?array $permissions = null, ?bool $fileSecurity = null, ?bool $enabled = null, ?int $maximumFileSize = null, ?array $allowedFileExtensions = null, ?Compression $compression = null, ?bool $encryption = null, ?bool $antivirus = null, ?bool $transformations = null): array { $apiPath = str_replace( ['{bucketId}'], @@ -186,10 +189,7 @@ public function updateBucket(string $bucketId, string $name, ?array $permissions $apiParams = []; $apiParams['bucketId'] = $bucketId; $apiParams['name'] = $name; - - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } + $apiParams['permissions'] = $permissions; if (!is_null($fileSecurity)) { $apiParams['fileSecurity'] = $fileSecurity; @@ -219,6 +219,10 @@ public function updateBucket(string $bucketId, string $name, ?array $permissions $apiParams['antivirus'] = $antivirus; } + if (!is_null($transformations)) { + $apiParams['transformations'] = $transformations; + } + $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -481,14 +485,8 @@ public function updateFile(string $bucketId, string $fileId, ?string $name = nul $apiParams = []; $apiParams['bucketId'] = $bucketId; $apiParams['fileId'] = $fileId; - - if (!is_null($name)) { - $apiParams['name'] = $name; - } - - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } + $apiParams['name'] = $name; + $apiParams['permissions'] = $permissions; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; diff --git a/src/Appwrite/Services/TablesDB.php b/src/Appwrite/Services/TablesDB.php index a0d9a89..6ef4f47 100644 --- a/src/Appwrite/Services/TablesDB.php +++ b/src/Appwrite/Services/TablesDB.php @@ -455,10 +455,7 @@ public function createTable(string $databaseId, string $tableId, string $name, ? $apiParams['databaseId'] = $databaseId; $apiParams['tableId'] = $tableId; $apiParams['name'] = $name; - - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } + $apiParams['permissions'] = $permissions; if (!is_null($rowSecurity)) { $apiParams['rowSecurity'] = $rowSecurity; @@ -534,10 +531,7 @@ public function updateTable(string $databaseId, string $tableId, string $name, ? $apiParams['databaseId'] = $databaseId; $apiParams['tableId'] = $tableId; $apiParams['name'] = $name; - - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } + $apiParams['permissions'] = $permissions; if (!is_null($rowSecurity)) { $apiParams['rowSecurity'] = $rowSecurity; @@ -656,10 +650,7 @@ public function createBooleanColumn(string $databaseId, string $tableId, string $apiParams['tableId'] = $tableId; $apiParams['key'] = $key; $apiParams['required'] = $required; - - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } + $apiParams['default'] = $xdefault; if (!is_null($xarray)) { $apiParams['array'] = $xarray; @@ -703,10 +694,7 @@ public function updateBooleanColumn(string $databaseId, string $tableId, string $apiParams['key'] = $key; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -744,10 +732,7 @@ public function createDatetimeColumn(string $databaseId, string $tableId, string $apiParams['tableId'] = $tableId; $apiParams['key'] = $key; $apiParams['required'] = $required; - - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } + $apiParams['default'] = $xdefault; if (!is_null($xarray)) { $apiParams['array'] = $xarray; @@ -791,10 +776,7 @@ public function updateDatetimeColumn(string $databaseId, string $tableId, string $apiParams['key'] = $key; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -833,10 +815,7 @@ public function createEmailColumn(string $databaseId, string $tableId, string $k $apiParams['tableId'] = $tableId; $apiParams['key'] = $key; $apiParams['required'] = $required; - - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } + $apiParams['default'] = $xdefault; if (!is_null($xarray)) { $apiParams['array'] = $xarray; @@ -881,10 +860,7 @@ public function updateEmailColumn(string $databaseId, string $tableId, string $k $apiParams['key'] = $key; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -925,10 +901,7 @@ public function createEnumColumn(string $databaseId, string $tableId, string $ke $apiParams['key'] = $key; $apiParams['elements'] = $elements; $apiParams['required'] = $required; - - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } + $apiParams['default'] = $xdefault; if (!is_null($xarray)) { $apiParams['array'] = $xarray; @@ -975,10 +948,7 @@ public function updateEnumColumn(string $databaseId, string $tableId, string $ke $apiParams['elements'] = $elements; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1020,18 +990,9 @@ public function createFloatColumn(string $databaseId, string $tableId, string $k $apiParams['tableId'] = $tableId; $apiParams['key'] = $key; $apiParams['required'] = $required; - - if (!is_null($min)) { - $apiParams['min'] = $min; - } - - if (!is_null($max)) { - $apiParams['max'] = $max; - } - - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } + $apiParams['min'] = $min; + $apiParams['max'] = $max; + $apiParams['default'] = $xdefault; if (!is_null($xarray)) { $apiParams['array'] = $xarray; @@ -1078,18 +1039,9 @@ public function updateFloatColumn(string $databaseId, string $tableId, string $k $apiParams['key'] = $key; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($min)) { - $apiParams['min'] = $min; - } - - if (!is_null($max)) { - $apiParams['max'] = $max; - } - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['min'] = $min; + $apiParams['max'] = $max; + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1131,18 +1083,9 @@ public function createIntegerColumn(string $databaseId, string $tableId, string $apiParams['tableId'] = $tableId; $apiParams['key'] = $key; $apiParams['required'] = $required; - - if (!is_null($min)) { - $apiParams['min'] = $min; - } - - if (!is_null($max)) { - $apiParams['max'] = $max; - } - - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } + $apiParams['min'] = $min; + $apiParams['max'] = $max; + $apiParams['default'] = $xdefault; if (!is_null($xarray)) { $apiParams['array'] = $xarray; @@ -1189,18 +1132,9 @@ public function updateIntegerColumn(string $databaseId, string $tableId, string $apiParams['key'] = $key; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($min)) { - $apiParams['min'] = $min; - } - - if (!is_null($max)) { - $apiParams['max'] = $max; - } - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['min'] = $min; + $apiParams['max'] = $max; + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1239,10 +1173,7 @@ public function createIpColumn(string $databaseId, string $tableId, string $key, $apiParams['tableId'] = $tableId; $apiParams['key'] = $key; $apiParams['required'] = $required; - - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } + $apiParams['default'] = $xdefault; if (!is_null($xarray)) { $apiParams['array'] = $xarray; @@ -1287,10 +1218,7 @@ public function updateIpColumn(string $databaseId, string $tableId, string $key, $apiParams['key'] = $key; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1367,10 +1295,7 @@ public function updateLineColumn(string $databaseId, string $tableId, string $ke $apiParams['key'] = $key; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1447,10 +1372,7 @@ public function updatePointColumn(string $databaseId, string $tableId, string $k $apiParams['key'] = $key; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1527,10 +1449,7 @@ public function updatePolygonColumn(string $databaseId, string $tableId, string $apiParams['key'] = $key; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1576,14 +1495,8 @@ public function createRelationshipColumn(string $databaseId, string $tableId, st if (!is_null($twoWay)) { $apiParams['twoWay'] = $twoWay; } - - if (!is_null($key)) { - $apiParams['key'] = $key; - } - - if (!is_null($twoWayKey)) { - $apiParams['twoWayKey'] = $twoWayKey; - } + $apiParams['key'] = $key; + $apiParams['twoWayKey'] = $twoWayKey; if (!is_null($onDelete)) { $apiParams['onDelete'] = $onDelete; @@ -1629,10 +1542,7 @@ public function createStringColumn(string $databaseId, string $tableId, string $ $apiParams['key'] = $key; $apiParams['size'] = $size; $apiParams['required'] = $required; - - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } + $apiParams['default'] = $xdefault; if (!is_null($xarray)) { $apiParams['array'] = $xarray; @@ -1682,14 +1592,8 @@ public function updateStringColumn(string $databaseId, string $tableId, string $ $apiParams['key'] = $key; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($size)) { - $apiParams['size'] = $size; - } - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['size'] = $size; + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1728,10 +1632,7 @@ public function createUrlColumn(string $databaseId, string $tableId, string $key $apiParams['tableId'] = $tableId; $apiParams['key'] = $key; $apiParams['required'] = $required; - - if (!is_null($xdefault)) { - $apiParams['default'] = $xdefault; - } + $apiParams['default'] = $xdefault; if (!is_null($xarray)) { $apiParams['array'] = $xarray; @@ -1776,10 +1677,7 @@ public function updateUrlColumn(string $databaseId, string $tableId, string $key $apiParams['key'] = $key; $apiParams['required'] = $required; $apiParams['default'] = $xdefault; - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1882,14 +1780,8 @@ public function updateRelationshipColumn(string $databaseId, string $tableId, st $apiParams['databaseId'] = $databaseId; $apiParams['tableId'] = $tableId; $apiParams['key'] = $key; - - if (!is_null($onDelete)) { - $apiParams['onDelete'] = $onDelete; - } - - if (!is_null($newKey)) { - $apiParams['newKey'] = $newKey; - } + $apiParams['onDelete'] = $onDelete; + $apiParams['newKey'] = $newKey; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -2130,14 +2022,8 @@ public function createRow(string $databaseId, string $tableId, string $rowId, ar $apiParams['tableId'] = $tableId; $apiParams['rowId'] = $rowId; $apiParams['data'] = $data; - - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } + $apiParams['permissions'] = $permissions; + $apiParams['transactionId'] = $transactionId; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -2175,10 +2061,7 @@ public function createRows(string $databaseId, string $tableId, array $rows, ?st $apiParams['databaseId'] = $databaseId; $apiParams['tableId'] = $tableId; $apiParams['rows'] = $rows; - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } + $apiParams['transactionId'] = $transactionId; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -2217,10 +2100,7 @@ public function upsertRows(string $databaseId, string $tableId, array $rows, ?st $apiParams['databaseId'] = $databaseId; $apiParams['tableId'] = $tableId; $apiParams['rows'] = $rows; - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } + $apiParams['transactionId'] = $transactionId; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -2264,10 +2144,7 @@ public function updateRows(string $databaseId, string $tableId, ?array $data = n if (!is_null($queries)) { $apiParams['queries'] = $queries; } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } + $apiParams['transactionId'] = $transactionId; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -2306,10 +2183,7 @@ public function deleteRows(string $databaseId, string $tableId, ?array $queries if (!is_null($queries)) { $apiParams['queries'] = $queries; } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } + $apiParams['transactionId'] = $transactionId; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -2396,14 +2270,8 @@ public function upsertRow(string $databaseId, string $tableId, string $rowId, ?a if (!is_null($data)) { $apiParams['data'] = $data; } - - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } + $apiParams['permissions'] = $permissions; + $apiParams['transactionId'] = $transactionId; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -2445,14 +2313,8 @@ public function updateRow(string $databaseId, string $tableId, string $rowId, ?a if (!is_null($data)) { $apiParams['data'] = $data; } - - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } + $apiParams['permissions'] = $permissions; + $apiParams['transactionId'] = $transactionId; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -2487,10 +2349,7 @@ public function deleteRow(string $databaseId, string $tableId, string $rowId, ?s $apiParams['databaseId'] = $databaseId; $apiParams['tableId'] = $tableId; $apiParams['rowId'] = $rowId; - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } + $apiParams['transactionId'] = $transactionId; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -2533,14 +2392,8 @@ public function decrementRowColumn(string $databaseId, string $tableId, string $ if (!is_null($value)) { $apiParams['value'] = $value; } - - if (!is_null($min)) { - $apiParams['min'] = $min; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } + $apiParams['min'] = $min; + $apiParams['transactionId'] = $transactionId; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -2583,14 +2436,8 @@ public function incrementRowColumn(string $databaseId, string $tableId, string $ if (!is_null($value)) { $apiParams['value'] = $value; } - - if (!is_null($max)) { - $apiParams['max'] = $max; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } + $apiParams['max'] = $max; + $apiParams['transactionId'] = $transactionId; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; diff --git a/src/Appwrite/Services/Users.php b/src/Appwrite/Services/Users.php index 10e6bb0..992bb0e 100644 --- a/src/Appwrite/Services/Users.php +++ b/src/Appwrite/Services/Users.php @@ -80,14 +80,8 @@ public function create(string $userId, ?string $email = null, ?string $phone = n $apiParams = []; $apiParams['userId'] = $userId; - - if (!is_null($email)) { - $apiParams['email'] = $email; - } - - if (!is_null($phone)) { - $apiParams['phone'] = $phone; - } + $apiParams['email'] = $email; + $apiParams['phone'] = $phone; if (!is_null($password)) { $apiParams['password'] = $password; diff --git a/tests/Appwrite/Services/FunctionsTest.php b/tests/Appwrite/Services/FunctionsTest.php index 23ed641..9d034cf 100644 --- a/tests/Appwrite/Services/FunctionsTest.php +++ b/tests/Appwrite/Services/FunctionsTest.php @@ -411,7 +411,8 @@ public function testMethodCreateTemplateDeployment(): void { "", "", "", - "" + "commit", + "" ); $this->assertSame($data, $response); diff --git a/tests/Appwrite/Services/SitesTest.php b/tests/Appwrite/Services/SitesTest.php index 6a9d15a..831d7bb 100644 --- a/tests/Appwrite/Services/SitesTest.php +++ b/tests/Appwrite/Services/SitesTest.php @@ -417,7 +417,8 @@ public function testMethodCreateTemplateDeployment(): void { "", "", "", - "" + "branch", + "" ); $this->assertSame($data, $response); diff --git a/tests/Appwrite/Services/StorageTest.php b/tests/Appwrite/Services/StorageTest.php index e6b1923..0f2ce53 100644 --- a/tests/Appwrite/Services/StorageTest.php +++ b/tests/Appwrite/Services/StorageTest.php @@ -47,7 +47,8 @@ public function testMethodCreateBucket(): void { "allowedFileExtensions" => array(), "compression" => "gzip", "encryption" => true, - "antivirus" => true,); + "antivirus" => true, + "transformations" => true,); $this->client @@ -76,7 +77,8 @@ public function testMethodGetBucket(): void { "allowedFileExtensions" => array(), "compression" => "gzip", "encryption" => true, - "antivirus" => true,); + "antivirus" => true, + "transformations" => true,); $this->client @@ -104,7 +106,8 @@ public function testMethodUpdateBucket(): void { "allowedFileExtensions" => array(), "compression" => "gzip", "encryption" => true, - "antivirus" => true,); + "antivirus" => true, + "transformations" => true,); $this->client