Skip to content

Commit

Permalink
Merge pull request #32 from appwrite/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
abnegate committed Jun 26, 2024
2 parents 17bb9d4 + af59393 commit 1d043f5
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Appwrite PHP SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-php.svg?style=flat-square&v=1)
![Version](https://img.shields.io/badge/api%20version-1.5.6-blue.svg?style=flat-square&v=1)
![Version](https://img.shields.io/badge/api%20version-1.5.7-blue.svg?style=flat-square&v=1)
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
Expand Down
11 changes: 9 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 $headers = [
'content-type' => '',
'user-agent' => 'AppwritePHPSDK/11.0.2 ()',
'user-agent' => 'AppwritePHPSDK/11.1.0 ()',
'x-sdk-name'=> 'PHP',
'x-sdk-platform'=> 'server',
'x-sdk-language'=> 'php',
'x-sdk-version'=> '11.0.2',
'x-sdk-version'=> '11.1.0',
];

/**
Expand Down Expand Up @@ -249,6 +249,13 @@ public function call($method, $path = '', $headers = array(), array $params = ar
$responseBody = curl_exec($ch);
$contentType = $responseHeaders['content-type'] ?? '';
$responseStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);

$warnings = $responseHeaders['x-appwrite-warning'] ?? '';
if ($warnings) {
foreach(explode(';', $warnings) as $warning) {
echo 'Warning: ' . $warning . PHP_EOL;
}
}

switch(substr($contentType, 0, strpos($contentType, ';'))) {
case 'application/json':
Expand Down
8 changes: 0 additions & 8 deletions src/Appwrite/Enums/Name.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class Name implements JsonSerializable
private static Name $V1BUILDS;
private static Name $V1MESSAGING;
private static Name $V1MIGRATIONS;
private static Name $HAMSTERV1;

private string $value;

Expand Down Expand Up @@ -121,11 +120,4 @@ public static function V1MIGRATIONS(): Name
}
return self::$V1MIGRATIONS;
}
public static function HAMSTERV1(): Name
{
if (!isset(self::$HAMSTERV1)) {
self::$HAMSTERV1 = new Name('hamsterv1');
}
return self::$HAMSTERV1;
}
}
24 changes: 24 additions & 0 deletions src/Appwrite/Enums/Runtime.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class Runtime implements JsonSerializable
private static Runtime $PYTHON311;
private static Runtime $PYTHON312;
private static Runtime $PYTHONML311;
private static Runtime $DENO121;
private static Runtime $DENO124;
private static Runtime $DENO135;
private static Runtime $DENO140;
private static Runtime $DART215;
private static Runtime $DART216;
Expand Down Expand Up @@ -209,6 +212,27 @@ public static function PYTHONML311(): Runtime
}
return self::$PYTHONML311;
}
public static function DENO121(): Runtime
{
if (!isset(self::$DENO121)) {
self::$DENO121 = new Runtime('deno-1.21');
}
return self::$DENO121;
}
public static function DENO124(): Runtime
{
if (!isset(self::$DENO124)) {
self::$DENO124 = new Runtime('deno-1.24');
}
return self::$DENO124;
}
public static function DENO135(): Runtime
{
if (!isset(self::$DENO135)) {
self::$DENO135 = new Runtime('deno-1.35');
}
return self::$DENO135;
}
public static function DENO140(): Runtime
{
if (!isset(self::$DENO140)) {
Expand Down
16 changes: 8 additions & 8 deletions src/Appwrite/Services/Databases.php
Original file line number Diff line number Diff line change
Expand Up @@ -876,15 +876,15 @@ public function updateEnumAttribute(string $databaseId, string $collectionId, st
* @param string $collectionId
* @param string $key
* @param bool $required
* @param int $min
* @param int $max
* @param int $xdefault
* @param float $min
* @param float $max
* @param float $xdefault
* @param bool $xarray
* @throws AppwriteException
* @return array
*/
public function createFloatAttribute(string $databaseId, string $collectionId, string $key, bool $required, int $min = null, int $max = null, int $xdefault = null, bool $xarray = null): array
public function createFloatAttribute(string $databaseId, string $collectionId, string $key, bool $required, float $min = null, float $max = null, float $xdefault = null, bool $xarray = null): array
{
$apiPath = str_replace(['{databaseId}', '{collectionId}'], [$databaseId, $collectionId], '/databases/{databaseId}/collections/{collectionId}/attributes/float');

Expand Down Expand Up @@ -940,14 +940,14 @@ public function createFloatAttribute(string $databaseId, string $collectionId, s
* @param string $collectionId
* @param string $key
* @param bool $required
* @param int $min
* @param int $max
* @param int $xdefault
* @param float $min
* @param float $max
* @param float $xdefault
* @throws AppwriteException
* @return array
*/
public function updateFloatAttribute(string $databaseId, string $collectionId, string $key, bool $required, int $min, int $max, int $xdefault): array
public function updateFloatAttribute(string $databaseId, string $collectionId, string $key, bool $required, float $min, float $max, float $xdefault): array
{
$apiPath = str_replace(['{databaseId}', '{collectionId}', '{key}'], [$databaseId, $collectionId, $key], '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}');

Expand Down
4 changes: 2 additions & 2 deletions src/Appwrite/Services/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -574,15 +574,15 @@ public function getFileDownload(string $bucketId, string $fileId): string
* @param int $borderWidth
* @param string $borderColor
* @param int $borderRadius
* @param int $opacity
* @param float $opacity
* @param int $rotation
* @param string $background
* @param ImageFormat $output
* @throws AppwriteException
* @return string
*/
public function getFilePreview(string $bucketId, string $fileId, int $width = null, int $height = null, ImageGravity $gravity = null, int $quality = null, int $borderWidth = null, string $borderColor = null, int $borderRadius = null, int $opacity = null, int $rotation = null, string $background = null, ImageFormat $output = null): string
public function getFilePreview(string $bucketId, string $fileId, int $width = null, int $height = null, ImageGravity $gravity = null, int $quality = null, int $borderWidth = null, string $borderColor = null, int $borderRadius = null, float $opacity = null, int $rotation = null, string $background = null, ImageFormat $output = null): string
{
$apiPath = str_replace(['{bucketId}', '{fileId}'], [$bucketId, $fileId], '/storage/buckets/{bucketId}/files/{fileId}/preview');

Expand Down

0 comments on commit 1d043f5

Please sign in to comment.