Skip to content

Commit

Permalink
implement realtime feature
Browse files Browse the repository at this point in the history
  • Loading branch information
TorstenDittmann committed Sep 2, 2021
1 parent 981134a commit 0932ca4
Show file tree
Hide file tree
Showing 18 changed files with 217 additions and 25 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# 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-0.9.0-blue.svg?style=flat-square&v=1)
![Version](https://img.shields.io/badge/api%20version-0.10.0-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_io?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite_io)
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)

**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).**
**This SDK is compatible with Appwrite server version 0.10.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-php/releases).**

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)

Expand Down Expand Up @@ -79,7 +79,7 @@ try {
```

### Learn more
You can use following resources to learn more and get help
You can use the following resources to learn more and get help
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
- 📜 [Appwrite Docs](https://appwrite.io/docs)
- 💬 [Discord Community](https://appwrite.io/discord)
Expand Down
4 changes: 2 additions & 2 deletions docs/account.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ POST https://appwrite.io/v1/account/recovery
| email | string | User email. | |
| url | string | URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. | |

## Complete Password Recovery
## Create Password Recovery (confirmation)

```http request
PUT https://appwrite.io/v1/account/recovery
Expand Down Expand Up @@ -186,7 +186,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
| --- | --- | --- | --- |
| url | string | URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. | |

## Complete Email Verification
## Create Email Verification (confirmation)

```http request
PUT https://appwrite.io/v1/account/verification
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/functions/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ $client

$functions = new Functions($client);

$result = $functions->create('[NAME]', [], 'java-11.0');
$result = $functions->create('[NAME]', [], 'dotnet-5.0');
16 changes: 16 additions & 0 deletions docs/examples/users/update-email.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Users;
$client = new Client();
$client
->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
->setProject('5df5acd0d48c2') // Your project ID
->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;

$users = new Users($client);

$result = $users->updateEmail('[USER_ID]', 'email@example.com');
16 changes: 16 additions & 0 deletions docs/examples/users/update-name.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Users;
$client = new Client();
$client
->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
->setProject('5df5acd0d48c2') // Your project ID
->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;

$users = new Users($client);

$result = $users->updateName('[USER_ID]', '[NAME]');
16 changes: 16 additions & 0 deletions docs/examples/users/update-password.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
use Appwrite\Client;
use Appwrite\Services\Users;
$client = new Client();
$client
->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
->setProject('5df5acd0d48c2') // Your project ID
->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;

$users = new Users($client);

$result = $users->updatePassword('[USER_ID]', 'password');
4 changes: 2 additions & 2 deletions docs/teams.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ GET https://appwrite.io/v1/teams/{teamId}/memberships
POST https://appwrite.io/v1/teams/{teamId}/memberships
```

** Use this endpoint to invite a new member to join your team. An email with a link to join the team will be sent to the new member email address if the member doesn&#039;t exist in the project it will be created automatically.
** Use this endpoint to invite a new member to join your team. If initiated from Client SDK, an email with a link to join the team will be sent to the new member&#039;s email address if the member doesn&#039;t exist in the project it will be created automatically. If initiated from server side SDKs, new member will automatically be added to the team.

Use the &#039;URL&#039; parameter to redirect the user from the invitation email back to your app. When the user is redirected, use the [Update Team Membership Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow the user to accept the invitation to the team.
Use the &#039;URL&#039; parameter to redirect the user from the invitation email back to your app. When the user is redirected, use the [Update Team Membership Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow the user to accept the invitation to the team. While calling from side SDKs the redirect url can be empty string.

Please note that in order to avoid a [Redirect Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URL&#039;s are the once from domains you have set when added your platforms in the console interface. **

Expand Down
45 changes: 45 additions & 0 deletions docs/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,21 @@ DELETE https://appwrite.io/v1/users/{userId}
| --- | --- | --- | --- |
| userId | string | **Required** User unique ID. | |

## Update Email

```http request
PATCH https://appwrite.io/v1/users/{userId}/email
```

** Update the user email by its unique ID. **

### Parameters

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| userId | string | **Required** User unique ID. | |
| email | string | User email. | |

## Get User Logs

```http request
Expand All @@ -75,6 +90,36 @@ GET https://appwrite.io/v1/users/{userId}/logs
| --- | --- | --- | --- |
| userId | string | **Required** User unique ID. | |

## Update Name

```http request
PATCH https://appwrite.io/v1/users/{userId}/name
```

** Update the user name by its unique ID. **

### Parameters

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| userId | string | **Required** User unique ID. | |
| name | string | User name. Max length: 128 chars. | |

## Update Password

```http request
PATCH https://appwrite.io/v1/users/{userId}/password
```

** Update the user password by its unique ID. **

### Parameters

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| userId | string | **Required** User unique ID. | |
| password | string | New user password. Must be between 6 to 32 chars. | |

## Get User Preferences

```http request
Expand Down
4 changes: 2 additions & 2 deletions src/Appwrite/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ class Client
*/
protected $headers = [
'content-type' => '',
'x-sdk-version' => 'appwrite:php:2.2.0',
'x-sdk-version' => 'appwrite:php:2.3.0',
];

/**
* SDK constructor.
*/
public function __construct()
{
$this->headers['X-Appwrite-Response-Format'] = '0.9.0';
$this->headers['X-Appwrite-Response-Format'] = '0.10.0';

}

Expand Down
6 changes: 3 additions & 3 deletions src/Appwrite/Services/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public function createRecovery(string $email, string $url): array
}

/**
* Complete Password Recovery
* Create Password Recovery (confirmation)
*
* Use this endpoint to complete the user account password reset. Both the
* **userId** and **secret** arguments will be passed as query parameters to
Expand Down Expand Up @@ -449,7 +449,7 @@ public function createVerification(string $url): array
}

/**
* Complete Email Verification
* Create Email Verification (confirmation)
*
* Use this endpoint to complete the user email verification process. Use both
* the **userId** and **secret** parameters that were attached to your app URL
Expand Down Expand Up @@ -486,4 +486,4 @@ public function updateVerification(string $userId, string $secret): array
'content-type' => 'application/json',
], $params);
}
}
}
2 changes: 1 addition & 1 deletion src/Appwrite/Services/Avatars.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,4 +292,4 @@ public function getQR(string $text, int $size = null, int $margin = null, bool $
'content-type' => 'application/json',
], $params);
}
}
}
2 changes: 1 addition & 1 deletion src/Appwrite/Services/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -425,4 +425,4 @@ public function deleteDocument(string $collectionId, string $documentId): array
'content-type' => 'application/json',
], $params);
}
}
}
2 changes: 1 addition & 1 deletion src/Appwrite/Services/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -509,4 +509,4 @@ public function deleteTag(string $functionId, string $tagId): array
'content-type' => 'application/json',
], $params);
}
}
}
2 changes: 1 addition & 1 deletion src/Appwrite/Services/Health.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,4 @@ public function getTime(): array
'content-type' => 'application/json',
], $params);
}
}
}
2 changes: 1 addition & 1 deletion src/Appwrite/Services/Locale.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,4 @@ public function getLanguages(): array
'content-type' => 'application/json',
], $params);
}
}
}
2 changes: 1 addition & 1 deletion src/Appwrite/Services/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,4 +307,4 @@ public function getFileView(string $fileId): string
'content-type' => 'application/json',
], $params);
}
}
}
13 changes: 8 additions & 5 deletions src/Appwrite/Services/Teams.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,17 @@ public function getMemberships(string $teamId, string $search = null, int $limit
/**
* Create Team Membership
*
* Use this endpoint to invite a new member to join your team. An email with a
* link to join the team will be sent to the new member email address if the
* member doesn't exist in the project it will be created automatically.
* Use this endpoint to invite a new member to join your team. If initiated
* from Client SDK, an email with a link to join the team will be sent to the
* new member's email address if the member doesn't exist in the project it
* will be created automatically. If initiated from server side SDKs, new
* member will automatically be added to the team.
*
* Use the 'URL' parameter to redirect the user from the invitation email back
* to your app. When the user is redirected, use the [Update Team Membership
* Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow
* the user to accept the invitation to the team.
* the user to accept the invitation to the team. While calling from side
* SDKs the redirect url can be empty string.
*
* Please note that in order to avoid a [Redirect
* Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
Expand Down Expand Up @@ -388,4 +391,4 @@ public function updateMembershipStatus(string $teamId, string $membershipId, str
'content-type' => 'application/json',
], $params);
}
}
}
Loading

0 comments on commit 0932ca4

Please sign in to comment.