Skip to content

Commit ace022a

Browse files
committed
regen
1 parent fc75b19 commit ace022a

File tree

19 files changed

+3770
-1567
lines changed

19 files changed

+3770
-1567
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## 17.5.1
4+
5+
* Fix duplicate methods issue (e.g., `updateMFA` and `updateMfa`) causing build and runtime errors
6+
37
## 17.5.0
48

59
* Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
"url": "https://appwrite.io/support",
88
"email": "[email protected]"
99
},
10+
"scripts": {
11+
"test": "vendor/bin/phpunit"
12+
},
1013
"autoload": {
1114
"psr-4": {
1215
"Appwrite\\": "src/Appwrite"
@@ -19,7 +22,7 @@
1922
},
2023
"require-dev": {
2124
"phpunit/phpunit": "^10",
22-
"mockery/mockery": "^1.6.6"
25+
"mockery/mockery": "^1.6.12"
2326
},
2427
"minimum-stability": "dev"
2528
}

docs/avatars.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,39 @@ GET https://cloud.appwrite.io/v1/avatars/qr
128128
| margin | integer | Margin from edge. Pass an integer between 0 to 10. Defaults to 1. | 1 |
129129
| download | boolean | Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0. | |
130130

131+
132+
```http request
133+
GET https://cloud.appwrite.io/v1/avatars/screenshots
134+
```
135+
136+
** Use this endpoint to capture a screenshot of any website URL. This endpoint uses a headless browser to render the webpage and capture it as an image.
137+
138+
You can configure the browser viewport size, theme, user agent, geolocation, permissions, and more. Capture either just the viewport or the full page scroll.
139+
140+
When width and height are specified, the image is resized accordingly. If both dimensions are 0, the API provides an image at original size. If dimensions are not specified, the default viewport size is 1280x720px. **
141+
142+
### Parameters
143+
144+
| Field Name | Type | Description | Default |
145+
| --- | --- | --- | --- |
146+
| url | string | **Required** Website URL which you want to capture. | |
147+
| headers | object | HTTP headers to send with the browser request. Defaults to empty. | {} |
148+
| viewportWidth | integer | Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280. | 1280 |
149+
| viewportHeight | integer | Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720. | 720 |
150+
| scale | number | Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1. | 1 |
151+
| theme | string | Browser theme. Pass "light" or "dark". Defaults to "light". | light |
152+
| userAgent | string | Custom user agent string. Defaults to browser default. | |
153+
| fullpage | boolean | Capture full page scroll. Pass 0 for viewport only, or 1 for full page. Defaults to 0. | |
154+
| locale | string | Browser locale (e.g., "en-US", "fr-FR"). Defaults to browser default. | |
155+
| timezone | string | IANA timezone identifier (e.g., "America/New_York", "Europe/London"). Defaults to browser default. | |
156+
| latitude | number | Geolocation latitude. Pass a number between -90 to 90. Defaults to 0. | 0 |
157+
| longitude | number | Geolocation longitude. Pass a number between -180 to 180. Defaults to 0. | 0 |
158+
| accuracy | number | Geolocation accuracy in meters. Pass a number between 0 to 100000. Defaults to 0. | 0 |
159+
| touch | boolean | Enable touch support. Pass 0 for no touch, or 1 for touch enabled. Defaults to 0. | |
160+
| permissions | array | Browser permissions to grant. Pass an array of permission names like ["geolocation", "camera", "microphone"]. Defaults to empty. | [] |
161+
| sleep | integer | Wait time in seconds before taking the screenshot. Pass an integer between 0 to 10. Defaults to 0. | 0 |
162+
| width | integer | Output image width. Pass 0 to use original width, or an integer between 1 to 2000. Defaults to 0 (original width). | 0 |
163+
| height | integer | Output image height. Pass 0 to use original height, or an integer between 1 to 2000. Defaults to 0 (original height). | 0 |
164+
| quality | integer | Screenshot quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. | -1 |
165+
| output | string | Output format type (jpeg, jpg, png, gif and webp). | |
166+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
use Appwrite\Client;
4+
use Appwrite\Services\Avatars;
5+
6+
$client = (new Client())
7+
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
8+
->setProject('<YOUR_PROJECT_ID>') // Your project ID
9+
->setSession(''); // The user session to authenticate with
10+
11+
$avatars = new Avatars($client);
12+
13+
$result = $avatars->getScreenshot(
14+
url: 'https://example.com',
15+
headers: [], // optional
16+
viewportWidth: 1, // optional
17+
viewportHeight: 1, // optional
18+
scale: 0.1, // optional
19+
theme: ::LIGHT(), // optional
20+
userAgent: '<USER_AGENT>', // optional
21+
fullpage: false, // optional
22+
locale: '<LOCALE>', // optional
23+
timezone: ::AFRICAABIDJAN(), // optional
24+
latitude: -90, // optional
25+
longitude: -180, // optional
26+
accuracy: 0, // optional
27+
touch: false, // optional
28+
permissions: [], // optional
29+
sleep: 0, // optional
30+
width: 0, // optional
31+
height: 0, // optional
32+
quality: -1, // optional
33+
output: ::JPG() // optional
34+
);

docs/sites.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ GET https://cloud.appwrite.io/v1/sites/{siteId}/deployments
150150
POST https://cloud.appwrite.io/v1/sites/{siteId}/deployments
151151
```
152152

153-
** Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you&#039;ll need to update the function&#039;s deployment to use your new deployment ID. **
153+
** Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you&#039;ll need to update the site&#039;s deployment to use your new deployment ID. **
154154

155155
### Parameters
156156

phpunit.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0"?>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
5+
bootstrap="vendor/autoload.php"
6+
cacheDirectory=".phpunit.cache"
7+
colors="true"
8+
displayDetailsOnIncompleteTests="true"
9+
displayDetailsOnSkippedTests="true"
10+
displayDetailsOnTestsThatTriggerDeprecations="true"
11+
displayDetailsOnTestsThatTriggerErrors="true"
12+
displayDetailsOnTestsThatTriggerNotices="true"
13+
displayDetailsOnTestsThatTriggerWarnings="true"
14+
failOnDeprecation="true"
15+
failOnEmptyTestSuite="true"
16+
failOnIncomplete="true"
17+
failOnRisky="true"
18+
failOnSkipped="true"
19+
failOnWarning="true"
20+
>
21+
<testsuites>
22+
<testsuite name="Appwrite SDK Test Suite">
23+
<directory>./tests/</directory>
24+
</testsuite>
25+
</testsuites>
26+
27+
<source>
28+
<include>
29+
<directory suffix=".php">./src/Appwrite</directory>
30+
</include>
31+
</source>
32+
</phpunit>

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/17.5.0 ()',
40+
'user-agent' => 'AppwritePHPSDK/17.5.1 ()',
4141
'x-sdk-name'=> 'PHP',
4242
'x-sdk-platform'=> 'server',
4343
'x-sdk-language'=> 'php',
44-
'x-sdk-version'=> '17.5.0',
44+
'x-sdk-version'=> '17.5.1',
4545
];
4646

4747
/**

src/Appwrite/Enums/Output.php

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?php
2+
3+
namespace Appwrite\Enums;
4+
5+
use JsonSerializable;
6+
7+
class Output implements JsonSerializable
8+
{
9+
private static Output $JPG;
10+
private static Output $JPEG;
11+
private static Output $PNG;
12+
private static Output $WEBP;
13+
private static Output $HEIC;
14+
private static Output $AVIF;
15+
private static Output $GIF;
16+
17+
private string $value;
18+
19+
private function __construct(string $value)
20+
{
21+
$this->value = $value;
22+
}
23+
24+
public function __toString(): string
25+
{
26+
return $this->value;
27+
}
28+
29+
public function jsonSerialize(): string
30+
{
31+
return $this->value;
32+
}
33+
34+
public static function JPG(): Output
35+
{
36+
if (!isset(self::$JPG)) {
37+
self::$JPG = new Output('jpg');
38+
}
39+
return self::$JPG;
40+
}
41+
public static function JPEG(): Output
42+
{
43+
if (!isset(self::$JPEG)) {
44+
self::$JPEG = new Output('jpeg');
45+
}
46+
return self::$JPEG;
47+
}
48+
public static function PNG(): Output
49+
{
50+
if (!isset(self::$PNG)) {
51+
self::$PNG = new Output('png');
52+
}
53+
return self::$PNG;
54+
}
55+
public static function WEBP(): Output
56+
{
57+
if (!isset(self::$WEBP)) {
58+
self::$WEBP = new Output('webp');
59+
}
60+
return self::$WEBP;
61+
}
62+
public static function HEIC(): Output
63+
{
64+
if (!isset(self::$HEIC)) {
65+
self::$HEIC = new Output('heic');
66+
}
67+
return self::$HEIC;
68+
}
69+
public static function AVIF(): Output
70+
{
71+
if (!isset(self::$AVIF)) {
72+
self::$AVIF = new Output('avif');
73+
}
74+
return self::$AVIF;
75+
}
76+
public static function GIF(): Output
77+
{
78+
if (!isset(self::$GIF)) {
79+
self::$GIF = new Output('gif');
80+
}
81+
return self::$GIF;
82+
}
83+
}

src/Appwrite/Enums/Theme.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
namespace Appwrite\Enums;
4+
5+
use JsonSerializable;
6+
7+
class Theme implements JsonSerializable
8+
{
9+
private static Theme $LIGHT;
10+
private static Theme $DARK;
11+
12+
private string $value;
13+
14+
private function __construct(string $value)
15+
{
16+
$this->value = $value;
17+
}
18+
19+
public function __toString(): string
20+
{
21+
return $this->value;
22+
}
23+
24+
public function jsonSerialize(): string
25+
{
26+
return $this->value;
27+
}
28+
29+
public static function LIGHT(): Theme
30+
{
31+
if (!isset(self::$LIGHT)) {
32+
self::$LIGHT = new Theme('light');
33+
}
34+
return self::$LIGHT;
35+
}
36+
public static function DARK(): Theme
37+
{
38+
if (!isset(self::$DARK)) {
39+
self::$DARK = new Theme('dark');
40+
}
41+
return self::$DARK;
42+
}
43+
}

0 commit comments

Comments
 (0)