Skip to content

Commit 1829c66

Browse files
authored
Merge pull request #39 from appwrite/dev
fix: pong response & chunked upload
2 parents d2486f8 + 44d6d33 commit 1829c66

File tree

12 files changed

+70
-35
lines changed

12 files changed

+70
-35
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2024 Appwrite (https://appwrite.io) and individual contributors.
1+
Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors.
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

docs/functions.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ DELETE https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deployme
215215
POST https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deploymentId}/build
216216
```
217217

218+
** 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. **
219+
218220
### Parameters
219221

220222
| Field Name | Type | Description | Default |
@@ -229,6 +231,8 @@ POST https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deployment
229231
PATCH https://cloud.appwrite.io/v1/functions/{functionId}/deployments/{deploymentId}/build
230232
```
231233

234+
** 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. **
235+
232236
### Parameters
233237

234238
| Field Name | Type | Description | Default |

docs/messaging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ POST https://cloud.appwrite.io/v1/messaging/messages/sms
157157
PATCH https://cloud.appwrite.io/v1/messaging/messages/sms/{messageId}
158158
```
159159

160-
** Update an email message by its unique ID.
160+
** Update an SMS message by its unique ID.
161161
**
162162

163163
### Parameters

src/Appwrite/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ class Client
3737
*/
3838
protected array $headers = [
3939
'content-type' => '',
40-
'user-agent' => 'AppwritePHPSDK/12.2.0 ()',
40+
'user-agent' => 'AppwritePHPSDK/13.0.0 ()',
4141
'x-sdk-name'=> 'PHP',
4242
'x-sdk-platform'=> 'server',
4343
'x-sdk-language'=> 'php',
44-
'x-sdk-version'=> '12.2.0',
44+
'x-sdk-version'=> '13.0.0',
4545
];
4646

4747
/**

src/Appwrite/Enums/ImageFormat.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class ImageFormat implements JsonSerializable
1111
private static ImageFormat $GIF;
1212
private static ImageFormat $PNG;
1313
private static ImageFormat $WEBP;
14+
private static ImageFormat $HEIC;
1415
private static ImageFormat $AVIF;
1516

1617
private string $value;
@@ -65,6 +66,13 @@ public static function WEBP(): ImageFormat
6566
}
6667
return self::$WEBP;
6768
}
69+
public static function HEIC(): ImageFormat
70+
{
71+
if (!isset(self::$HEIC)) {
72+
self::$HEIC = new ImageFormat('heic');
73+
}
74+
return self::$HEIC;
75+
}
6876
public static function AVIF(): ImageFormat
6977
{
7078
if (!isset(self::$AVIF)) {

src/Appwrite/Services/Account.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,9 @@ public function createMfaChallenge(AuthenticationFactor $factor): array
441441
* @param string $challengeId
442442
* @param string $otp
443443
* @throws AppwriteException
444-
* @return string
444+
* @return array
445445
*/
446-
public function updateMfaChallenge(string $challengeId, string $otp): string
446+
public function updateMfaChallenge(string $challengeId, string $otp): array
447447
{
448448
$apiPath = str_replace(
449449
[],

src/Appwrite/Services/Functions.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ public function createDeployment(string $functionId, InputFile $code, bool $acti
570570
'progress' => min(((($counter * Client::CHUNK_SIZE) + Client::CHUNK_SIZE)), $size) / $size * 100,
571571
'sizeUploaded' => min($counter * Client::CHUNK_SIZE),
572572
'chunksTotal' => $response['chunksTotal'],
573-
'chunksUploaded' => $response['chunksUploaded'],
573+
'chunksUploaded' => $response['chunksUploaded'],
574574
]);
575575
}
576576
}
@@ -685,6 +685,12 @@ public function deleteDeployment(string $functionId, string $deploymentId): stri
685685
/**
686686
* Rebuild deployment
687687
*
688+
* Create a new build for an existing function deployment. This endpoint
689+
* allows you to rebuild a deployment with the updated function configuration,
690+
* including its entrypoint and build commands if they have been modified The
691+
* build process will be queued and executed asynchronously. The original
692+
* deployment's code will be preserved and used for the new build.
693+
*
688694
* @param string $functionId
689695
* @param string $deploymentId
690696
* @param ?string $buildId
@@ -721,6 +727,12 @@ public function createBuild(string $functionId, string $deploymentId, ?string $b
721727
/**
722728
* Cancel deployment
723729
*
730+
* Cancel an ongoing function deployment build. If the build is already in
731+
* progress, it will be stopped and marked as canceled. If the build hasn't
732+
* started yet, it will be marked as canceled without executing. You cannot
733+
* cancel builds that have already completed (status 'ready') or failed. The
734+
* response includes the final build status and details.
735+
*
724736
* @param string $functionId
725737
* @param string $deploymentId
726738
* @throws AppwriteException

src/Appwrite/Services/Messaging.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ public function createSms(string $messageId, string $content, ?array $topics = n
526526
/**
527527
* Update SMS
528528
*
529-
* Update an email message by its unique ID.
529+
* Update an SMS message by its unique ID.
530530
*
531531
*
532532
* @param string $messageId

src/Appwrite/Services/Storage.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -385,12 +385,10 @@ public function createFile(string $bucketId, string $fileId, InputFile $file, ?a
385385
$id = '';
386386
$counter = 0;
387387

388-
if($fileId != 'unique()') {
389-
try {
390-
$response = $this->client->call(Client::METHOD_GET, $apiPath . '/' . $fileId);
391-
$counter = $response['chunksUploaded'] ?? 0;
392-
} catch(\Exception $e) {
393-
}
388+
try {
389+
$response = $this->client->call(Client::METHOD_GET, $apiPath . '/' . $fileId);
390+
$counter = $response['chunksUploaded'] ?? 0;
391+
} catch(\Exception $e) {
394392
}
395393

396394
$apiHeaders = ['content-type' => 'multipart/form-data'];
@@ -426,7 +424,7 @@ public function createFile(string $bucketId, string $fileId, InputFile $file, ?a
426424
'progress' => min(((($counter * Client::CHUNK_SIZE) + Client::CHUNK_SIZE)), $size) / $size * 100,
427425
'sizeUploaded' => min($counter * Client::CHUNK_SIZE),
428426
'chunksTotal' => $response['chunksTotal'],
429-
'chunksUploaded' => $response['chunksUploaded'],
427+
'chunksUploaded' => $response['chunksUploaded'],
430428
]);
431429
}
432430
}

src/Appwrite/Services/Users.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -790,9 +790,9 @@ public function updateMfa(string $userId, bool $mfa): array
790790
* @param string $userId
791791
* @param AuthenticatorType $type
792792
* @throws AppwriteException
793-
* @return array
793+
* @return string
794794
*/
795-
public function deleteMfaAuthenticator(string $userId, AuthenticatorType $type): array
795+
public function deleteMfaAuthenticator(string $userId, AuthenticatorType $type): string
796796
{
797797
$apiPath = str_replace(
798798
['{userId}', '{type}'],

tests/Appwrite/Services/AccountTest.php

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,36 @@ public function testMethodCreateMfaChallenge(): void {
301301

302302
public function testMethodUpdateMfaChallenge(): void {
303303

304-
$data = '';
304+
$data = array(
305+
"\$id" => "5e5ea5c16897e",
306+
"\$createdAt" => "2020-10-15T06:38:00.000+00:00",
307+
"\$updatedAt" => "2020-10-15T06:38:00.000+00:00",
308+
"userId" => "5e5bb8c16897e",
309+
"expire" => "2020-10-15T06:38:00.000+00:00",
310+
"provider" => "email",
311+
"providerUid" => "[email protected]",
312+
"providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3",
313+
"providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00",
314+
"providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3",
315+
"ip" => "127.0.0.1",
316+
"osCode" => "Mac",
317+
"osName" => "Mac",
318+
"osVersion" => "Mac",
319+
"clientType" => "browser",
320+
"clientCode" => "CM",
321+
"clientName" => "Chrome Mobile iOS",
322+
"clientVersion" => "84.0",
323+
"clientEngine" => "WebKit",
324+
"clientEngineVersion" => "605.1.15",
325+
"deviceName" => "smartphone",
326+
"deviceBrand" => "Google",
327+
"deviceModel" => "Nexus 5",
328+
"countryCode" => "US",
329+
"countryName" => "United States",
330+
"current" => true,
331+
"factors" => array(),
332+
"secret" => "5e5bb8c16897e",
333+
"mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00",);
305334

306335

307336
$this->client

tests/Appwrite/Services/UsersTest.php

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -546,23 +546,7 @@ public function testMethodUpdateMfa(): void {
546546

547547
public function testMethodDeleteMfaAuthenticator(): void {
548548

549-
$data = array(
550-
"\$id" => "5e5ea5c16897e",
551-
"\$createdAt" => "2020-10-15T06:38:00.000+00:00",
552-
"\$updatedAt" => "2020-10-15T06:38:00.000+00:00",
553-
"name" => "John Doe",
554-
"registration" => "2020-10-15T06:38:00.000+00:00",
555-
"status" => true,
556-
"labels" => array(),
557-
"passwordUpdate" => "2020-10-15T06:38:00.000+00:00",
558-
"email" => "[email protected]",
559-
"phone" => "+4930901820",
560-
"emailVerification" => true,
561-
"phoneVerification" => true,
562-
"mfa" => true,
563-
"prefs" => array(),
564-
"targets" => array(),
565-
"accessedAt" => "2020-10-15T06:38:00.000+00:00",);
549+
$data = '';
566550

567551

568552
$this->client

0 commit comments

Comments
 (0)