Skip to content

fix: pong response & chunked upload #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
4 changes: 4 additions & 0 deletions docs/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -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 |
Expand Down
2 changes: 1 addition & 1 deletion docs/messaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/Appwrite/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];

/**
Expand Down
8 changes: 8 additions & 0 deletions src/Appwrite/Enums/ImageFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions src/Appwrite/Services/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
[],
Expand Down
14 changes: 13 additions & 1 deletion src/Appwrite/Services/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
]);
}
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Appwrite/Services/Messaging.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 5 additions & 7 deletions src/Appwrite/Services/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down Expand Up @@ -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'],
]);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Appwrite/Services/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}'],
Expand Down
31 changes: 30 additions & 1 deletion tests/Appwrite/Services/AccountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 1 addition & 17 deletions tests/Appwrite/Services/UsersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy