Skip to content

Commit 981134a

Browse files
Merge pull request #7 from appwrite/dev
feat: update version
2 parents ae3686b + 17750ce commit 981134a

File tree

13 files changed

+142
-20
lines changed

13 files changed

+142
-20
lines changed

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
# Appwrite PHP SDK
22

33
![License](https://img.shields.io/github/license/appwrite/sdk-for-php.svg?style=flat-square&v=1)
4-
![Version](https://img.shields.io/badge/api%20version-0.8.0-blue.svg?style=flat-square&v=1)
4+
![Version](https://img.shields.io/badge/api%20version-0.9.0-blue.svg?style=flat-square&v=1)
5+
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
56
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite_io?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite_io)
67
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
78

8-
**This SDK is compatible with Appwrite server version 0.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-php/releases).**
9+
**This SDK is compatible with Appwrite server version 0.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-php/releases).**
910

10-
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way.
11-
Use the PHP SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
12-
For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
11+
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the PHP SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
1312

1413
![Appwrite](https://appwrite.io/images/github.png)
1514

@@ -25,7 +24,7 @@ composer require appwrite/appwrite
2524
## Getting Started
2625

2726
### Init your SDK
28-
Initialize your SDK code with your project ID which can be found in your project settings page and your new API secret Key from project's API keys section.
27+
Initialize your SDK with your Appwrite server API endpoint and project ID which can be found in your project settings page and your new API secret Key from project's API keys section.
2928

3029
```php
3130
$client = new Client();
@@ -39,7 +38,7 @@ $client
3938
```
4039

4140
### Make Your First Request
42-
Once your SDK object is set, create any of the Appwrite service objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section.
41+
Once your SDK object is set, create any of the Appwrite service objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the [API References](https://appwrite.io/docs) section.
4342

4443
```php
4544
$users = new Users($client);
@@ -80,7 +79,7 @@ try {
8079
```
8180

8281
### Learn more
83-
You can use followng resources to learn more and get help
82+
You can use following resources to learn more and get help
8483
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
8584
- 📜 [Appwrite Docs](https://appwrite.io/docs)
8685
- 💬 [Discord Community](https://appwrite.io/discord)

docs/account.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,20 @@ DELETE https://appwrite.io/v1/account/sessions
141141

142142
** Delete all sessions from the user account and remove any sessions cookies from the end client. **
143143

144+
## Get Session By ID
145+
146+
```http request
147+
GET https://appwrite.io/v1/account/sessions/{sessionId}
148+
```
149+
150+
** Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used. **
151+
152+
### Parameters
153+
154+
| Field Name | Type | Description | Default |
155+
| --- | --- | --- | --- |
156+
| sessionId | string | **Required** Session unique ID. Use the string 'current' to get the current device session. | |
157+
144158
## Delete Account Session
145159

146160
```http request
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
use Appwrite\Client;
4+
use Appwrite\Services\Account;
5+
6+
$client = new Client();
7+
8+
$client
9+
->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
10+
->setProject('5df5acd0d48c2') // Your project ID
11+
->setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
12+
;
13+
14+
$account = new Account($client);
15+
16+
$result = $account->getSession('[SESSION_ID]');

docs/examples/functions/create.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ $client
1313

1414
$functions = new Functions($client);
1515

16-
$result = $functions->create('[NAME]', [], 'dotnet-3.1');
16+
$result = $functions->create('[NAME]', [], 'java-11.0');
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
use Appwrite\Client;
4+
use Appwrite\Services\Users;
5+
6+
$client = new Client();
7+
8+
$client
9+
->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
10+
->setProject('5df5acd0d48c2') // Your project ID
11+
->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12+
;
13+
14+
$users = new Users($client);
15+
16+
$result = $users->updateVerification('[USER_ID]', false);

docs/functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ POST https://appwrite.io/v1/functions
3131
| --- | --- | --- | --- |
3232
| name | string | Function name. Max length: 128 chars. | |
3333
| execute | array | An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | |
34-
| env | string | Execution enviornment. | |
34+
| runtime | string | Execution runtime. | |
3535
| vars | object | Key-value JSON object. | {} |
3636
| events | array | Events list. | [] |
3737
| schedule | string | Schedule CRON syntax. | |

docs/storage.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,12 @@ GET https://appwrite.io/v1/storage/files/{fileId}/preview
106106
| fileId | string | **Required** File unique ID | |
107107
| width | integer | Resize preview image width, Pass an integer between 0 to 4000. | 0 |
108108
| height | integer | Resize preview image height, Pass an integer between 0 to 4000. | 0 |
109+
| gravity | string | Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right | center |
109110
| quality | integer | Preview image quality. Pass an integer between 0 to 100. Defaults to 100. | 100 |
110111
| borderWidth | integer | Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0. | 0 |
111112
| borderColor | string | Preview image border color. Use a valid HEX color, no # is needed for prefix. | |
112113
| borderRadius | integer | Preview image border radius in pixels. Pass an integer between 0 to 4000. | 0 |
113-
| opacity | integer | Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1. | 1 |
114+
| opacity | number | Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1. | 1 |
114115
| rotation | integer | Preview image rotation in degrees. Pass an integer between 0 and 360. | 0 |
115116
| background | string | Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix. | |
116117
| output | string | Output format type (jpeg, jpg, png, gif and webp). | |

docs/users.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,18 @@ PATCH https://appwrite.io/v1/users/{userId}/status
162162
| userId | string | **Required** User unique ID. | |
163163
| status | integer | User Status code. To activate the user pass 1, to block the user pass 2 and for disabling the user pass 0 | |
164164

165+
## Update Email Verification
166+
167+
```http request
168+
PATCH https://appwrite.io/v1/users/{userId}/verification
169+
```
170+
171+
** Update the user email verification status by its unique ID. **
172+
173+
### Parameters
174+
175+
| Field Name | Type | Description | Default |
176+
| --- | --- | --- | --- |
177+
| userId | string | **Required** User unique ID. | |
178+
| emailVerification | boolean | User Email Verification Status. | |
179+

src/Appwrite/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ class Client
3535
*/
3636
protected $headers = [
3737
'content-type' => '',
38-
'x-sdk-version' => 'appwrite:php:2.1.2',
38+
'x-sdk-version' => 'appwrite:php:2.2.0',
3939
];
4040

4141
/**
4242
* SDK constructor.
4343
*/
4444
public function __construct()
4545
{
46-
$this->headers['X-Appwrite-Response-Format'] = '0.8.0';
46+
$this->headers['X-Appwrite-Response-Format'] = '0.9.0';
4747

4848
}
4949

src/Appwrite/Services/Account.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,30 @@ public function deleteSessions(): array
358358
], $params);
359359
}
360360

361+
/**
362+
* Get Session By ID
363+
*
364+
* Use this endpoint to get a logged in user's session using a Session ID.
365+
* Inputting 'current' will return the current session being used.
366+
*
367+
* @param string $sessionId
368+
* @throws AppwriteException
369+
* @return array
370+
*/
371+
public function getSession(string $sessionId): array
372+
{
373+
if (empty($sessionId)) {
374+
throw new AppwriteException('Missing required parameter: "sessionId"');
375+
}
376+
377+
$path = str_replace(['{sessionId}'], [$sessionId], '/account/sessions/{sessionId}');
378+
$params = [];
379+
380+
return $this->client->call(Client::METHOD_GET, $path, [
381+
'content-type' => 'application/json',
382+
], $params);
383+
}
384+
361385
/**
362386
* Delete Account Session
363387
*

0 commit comments

Comments
 (0)