diff --git a/LICENSE b/LICENSE index 5479bb8..c1602fc 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2024 Appwrite (https://appwrite.io) and individual contributors. +Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/docs/functions.md b/docs/functions.md index 00b15ea..5317962 100644 --- a/docs/functions.md +++ b/docs/functions.md @@ -215,6 +215,8 @@ DELETE https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deployme POST https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deploymentId}/build ``` +** Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. ** + ### Parameters | Field Name | Type | Description | Default | @@ -229,6 +231,8 @@ POST https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deployment PATCH https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deploymentId}/build ``` +** Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. ** + ### Parameters | Field Name | Type | Description | Default | diff --git a/docs/messaging.md b/docs/messaging.md index 984c26b..556ee39 100644 --- a/docs/messaging.md +++ b/docs/messaging.md @@ -157,7 +157,7 @@ POST https://cloud.appwrite.io/v1/messaging/messages/sms PATCH https://cloud.appwrite.io/v1/messaging/messages/sms/{messageId} ``` -** Update an email message by its unique ID. +** Update an SMS message by its unique ID. ** ### Parameters diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php index 02421c7..68eefe7 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/12.2.0 ()', + 'user-agent' => 'AppwritePHPSDK/13.0.0 ()', 'x-sdk-name'=> 'PHP', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'php', - 'x-sdk-version'=> '12.2.0', + 'x-sdk-version'=> '13.0.0', ]; /** diff --git a/src/Appwrite/Enums/ImageFormat.php b/src/Appwrite/Enums/ImageFormat.php index 092d94d..9495e34 100644 --- a/src/Appwrite/Enums/ImageFormat.php +++ b/src/Appwrite/Enums/ImageFormat.php @@ -11,6 +11,7 @@ class ImageFormat implements JsonSerializable private static ImageFormat $GIF; private static ImageFormat $PNG; private static ImageFormat $WEBP; + private static ImageFormat $HEIC; private static ImageFormat $AVIF; private string $value; @@ -65,6 +66,13 @@ public static function WEBP(): ImageFormat } return self::$WEBP; } + public static function HEIC(): ImageFormat + { + if (!isset(self::$HEIC)) { + self::$HEIC = new ImageFormat('heic'); + } + return self::$HEIC; + } public static function AVIF(): ImageFormat { if (!isset(self::$AVIF)) { diff --git a/src/Appwrite/Services/Account.php b/src/Appwrite/Services/Account.php index 5b350da..2ea52db 100644 --- a/src/Appwrite/Services/Account.php +++ b/src/Appwrite/Services/Account.php @@ -441,9 +441,9 @@ public function createMfaChallenge(AuthenticationFactor $factor): array * @param string $challengeId * @param string $otp * @throws AppwriteException - * @return string + * @return array */ - public function updateMfaChallenge(string $challengeId, string $otp): string + public function updateMfaChallenge(string $challengeId, string $otp): array { $apiPath = str_replace( [], diff --git a/src/Appwrite/Services/Functions.php b/src/Appwrite/Services/Functions.php index 2e1d60f..94c107b 100644 --- a/src/Appwrite/Services/Functions.php +++ b/src/Appwrite/Services/Functions.php @@ -570,7 +570,7 @@ public function createDeployment(string $functionId, InputFile $code, bool $acti 'progress' => min(((($counter * Client::CHUNK_SIZE) + Client::CHUNK_SIZE)), $size) / $size * 100, 'sizeUploaded' => min($counter * Client::CHUNK_SIZE), 'chunksTotal' => $response['chunksTotal'], - 'chunksUploaded' => $response['chunksUploaded'], + 'chunksUploaded' => $response['chunksUploaded'], ]); } } @@ -685,6 +685,12 @@ public function deleteDeployment(string $functionId, string $deploymentId): stri /** * Rebuild deployment * + * Create a new build for an existing function deployment. This endpoint + * allows you to rebuild a deployment with the updated function configuration, + * including its entrypoint and build commands if they have been modified The + * build process will be queued and executed asynchronously. The original + * deployment's code will be preserved and used for the new build. + * * @param string $functionId * @param string $deploymentId * @param ?string $buildId @@ -721,6 +727,12 @@ public function createBuild(string $functionId, string $deploymentId, ?string $b /** * Cancel deployment * + * Cancel an ongoing function deployment build. If the build is already in + * progress, it will be stopped and marked as canceled. If the build hasn't + * started yet, it will be marked as canceled without executing. You cannot + * cancel builds that have already completed (status 'ready') or failed. The + * response includes the final build status and details. + * * @param string $functionId * @param string $deploymentId * @throws AppwriteException diff --git a/src/Appwrite/Services/Messaging.php b/src/Appwrite/Services/Messaging.php index cf90e70..b23647d 100644 --- a/src/Appwrite/Services/Messaging.php +++ b/src/Appwrite/Services/Messaging.php @@ -526,7 +526,7 @@ public function createSms(string $messageId, string $content, ?array $topics = n /** * Update SMS * - * Update an email message by its unique ID. + * Update an SMS message by its unique ID. * * * @param string $messageId diff --git a/src/Appwrite/Services/Storage.php b/src/Appwrite/Services/Storage.php index 27d5a64..9035248 100644 --- a/src/Appwrite/Services/Storage.php +++ b/src/Appwrite/Services/Storage.php @@ -385,12 +385,10 @@ public function createFile(string $bucketId, string $fileId, InputFile $file, ?a $id = ''; $counter = 0; - if($fileId != 'unique()') { - try { - $response = $this->client->call(Client::METHOD_GET, $apiPath . '/' . $fileId); - $counter = $response['chunksUploaded'] ?? 0; - } catch(\Exception $e) { - } + try { + $response = $this->client->call(Client::METHOD_GET, $apiPath . '/' . $fileId); + $counter = $response['chunksUploaded'] ?? 0; + } catch(\Exception $e) { } $apiHeaders = ['content-type' => 'multipart/form-data']; @@ -426,7 +424,7 @@ public function createFile(string $bucketId, string $fileId, InputFile $file, ?a 'progress' => min(((($counter * Client::CHUNK_SIZE) + Client::CHUNK_SIZE)), $size) / $size * 100, 'sizeUploaded' => min($counter * Client::CHUNK_SIZE), 'chunksTotal' => $response['chunksTotal'], - 'chunksUploaded' => $response['chunksUploaded'], + 'chunksUploaded' => $response['chunksUploaded'], ]); } } diff --git a/src/Appwrite/Services/Users.php b/src/Appwrite/Services/Users.php index d25e5c9..32df3d8 100644 --- a/src/Appwrite/Services/Users.php +++ b/src/Appwrite/Services/Users.php @@ -790,9 +790,9 @@ public function updateMfa(string $userId, bool $mfa): array * @param string $userId * @param AuthenticatorType $type * @throws AppwriteException - * @return array + * @return string */ - public function deleteMfaAuthenticator(string $userId, AuthenticatorType $type): array + public function deleteMfaAuthenticator(string $userId, AuthenticatorType $type): string { $apiPath = str_replace( ['{userId}', '{type}'], diff --git a/tests/Appwrite/Services/AccountTest.php b/tests/Appwrite/Services/AccountTest.php index 9c518a5..8419699 100644 --- a/tests/Appwrite/Services/AccountTest.php +++ b/tests/Appwrite/Services/AccountTest.php @@ -301,7 +301,36 @@ public function testMethodCreateMfaChallenge(): void { public function testMethodUpdateMfaChallenge(): void { - $data = ''; + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5bb8c16897e", + "expire" => "2020-10-15T06:38:00.000+00:00", + "provider" => "email", + "providerUid" => "user@example.com", + "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", + "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "ip" => "127.0.0.1", + "osCode" => "Mac", + "osName" => "Mac", + "osVersion" => "Mac", + "clientType" => "browser", + "clientCode" => "CM", + "clientName" => "Chrome Mobile iOS", + "clientVersion" => "84.0", + "clientEngine" => "WebKit", + "clientEngineVersion" => "605.1.15", + "deviceName" => "smartphone", + "deviceBrand" => "Google", + "deviceModel" => "Nexus 5", + "countryCode" => "US", + "countryName" => "United States", + "current" => true, + "factors" => array(), + "secret" => "5e5bb8c16897e", + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00",); $this->client diff --git a/tests/Appwrite/Services/UsersTest.php b/tests/Appwrite/Services/UsersTest.php index e686783..abbe31e 100644 --- a/tests/Appwrite/Services/UsersTest.php +++ b/tests/Appwrite/Services/UsersTest.php @@ -546,23 +546,7 @@ public function testMethodUpdateMfa(): void { public function testMethodDeleteMfaAuthenticator(): void { - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + $data = ''; $this->client