Skip to content
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
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Change Log

## 24.0.0

* Breaking: Renamed `AuthMethod` enum to `ProjectAuthMethodId`
* Breaking: Renamed `EmailTemplateType` to `ProjectEmailTemplateId` and `EmailTemplateLocale` to `ProjectEmailTemplateLocale`
* Breaking: Renamed `ServiceId` to `ProjectServiceId`, `ProtocolId` to `ProjectProtocolId`, `Secure` to `ProjectSMTPSecure`, `ProjectPolicy` to `ProjectPolicyId`
* Breaking: Replaced `Scopes` enum with `ProjectKeyScopes` for project key endpoints
* Breaking: Removed `updateDenyCanonicalEmailPolicy`; replaced with `updateDenyAliasedEmailPolicy`, `updateDenyDisposableEmailPolicy`, and `updateDenyFreeEmailPolicy`
* Breaking: Removed `AuthProvider` model; use new `ProjectOAuthProviderId` enum instead
* Added: `Project::get` method to fetch current project details
* Added: `Advisor`, `Presences`, and `Usage` services
* Added: `Insight`, `Presence`, `Report`, `UsageEvent`, and `UsageGauge` models with list variants
* Added: `ProjectAuthMethod`, `ProjectProtocol`, and `ProjectService` models
* Added: `ProjectOAuthProviderId` and `ProjectOAuth2GooglePrompt` enums
* Updated: `Project`, `Database`, and `OAuth2Google` model schemas
* Updated: `X-Appwrite-Response-Format` header to `1.9.5`

## 23.1.1

* Fixed: `Database` model `policies` and `archives` now hydrate as `BackupPolicy` / `BackupArchive` instead of `Index` / `Collection`
Expand Down
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.9.4-blue.svg?style=flat-square&v=1)
![Version](https://img.shields.io/badge/api%20version-1.9.5-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
76 changes: 76 additions & 0 deletions docs/advisor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Advisor Service


```http request
GET https://cloud.appwrite.io/v1/reports
```

** Get a list of all the project's analyzer reports. You can use the query params to filter your results.
**

### Parameters

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: appId, type, targetType, target, analyzedAt | [] |
| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 |


```http request
GET https://cloud.appwrite.io/v1/reports/{reportId}
```

** Get an analyzer report by its unique ID. The response includes the report's metadata and the nested insights it produced.
**

### Parameters

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| reportId | string | **Required** Report ID. | |


```http request
DELETE https://cloud.appwrite.io/v1/reports/{reportId}
```

** Delete an analyzer report by its unique ID. Nested insights and CTA metadata are removed asynchronously by the deletes worker.
**

### Parameters

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| reportId | string | **Required** Report ID. | |


```http request
GET https://cloud.appwrite.io/v1/reports/{reportId}/insights
```

** List the insights produced under a single analyzer report. You can use the query params to filter your results further.
**

### Parameters

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| reportId | string | **Required** Parent report ID. | |
| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: type, severity, status, resourceType, resourceId, parentResourceType, parentResourceId, analyzedAt, dismissedAt, dismissedBy | [] |
| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 |


```http request
GET https://cloud.appwrite.io/v1/reports/{reportId}/insights/{insightId}
```

** Get an insight by its unique ID, scoped to its parent report.
**

### Parameters

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| reportId | string | **Required** Parent report ID. | |
| insightId | string | **Required** Insight ID. | |

16 changes: 16 additions & 0 deletions docs/examples/advisor/delete-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Advisor;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setKey('<YOUR_API_KEY>'); // Your secret API key

$advisor = new Advisor($client);

$result = $advisor->deleteReport(
reportId: '<REPORT_ID>'
);```
17 changes: 17 additions & 0 deletions docs/examples/advisor/get-insight.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Advisor;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setSession(''); // The user session to authenticate with

$advisor = new Advisor($client);

$result = $advisor->getInsight(
reportId: '<REPORT_ID>',
insightId: '<INSIGHT_ID>'
);```
16 changes: 16 additions & 0 deletions docs/examples/advisor/get-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Advisor;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setSession(''); // The user session to authenticate with

$advisor = new Advisor($client);

$result = $advisor->getReport(
reportId: '<REPORT_ID>'
);```
18 changes: 18 additions & 0 deletions docs/examples/advisor/list-insights.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Advisor;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setSession(''); // The user session to authenticate with

$advisor = new Advisor($client);

$result = $advisor->listInsights(
reportId: '<REPORT_ID>',
queries: [], // optional
total: false // optional
);```
17 changes: 17 additions & 0 deletions docs/examples/advisor/list-reports.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Advisor;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setSession(''); // The user session to authenticate with

$advisor = new Advisor($client);

$result = $advisor->listReports(
queries: [], // optional
total: false // optional
);```
16 changes: 16 additions & 0 deletions docs/examples/presences/delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Presences;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setKey('<YOUR_API_KEY>'); // Your secret API key

$presences = new Presences($client);

$result = $presences->delete(
presenceId: '<PRESENCE_ID>'
);```
16 changes: 16 additions & 0 deletions docs/examples/presences/get.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Presences;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setKey('<YOUR_API_KEY>'); // Your secret API key

$presences = new Presences($client);

$result = $presences->get(
presenceId: '<PRESENCE_ID>'
);```
18 changes: 18 additions & 0 deletions docs/examples/presences/list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Presences;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setKey('<YOUR_API_KEY>'); // Your secret API key

$presences = new Presences($client);

$result = $presences->list(
queries: [], // optional
total: false, // optional
ttl: 0 // optional
);```
24 changes: 24 additions & 0 deletions docs/examples/presences/update-presence.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Presences;
use Appwrite\Permission;
use Appwrite\Role;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setKey('<YOUR_API_KEY>'); // Your secret API key

$presences = new Presences($client);

$result = $presences->updatePresence(
presenceId: '<PRESENCE_ID>',
userId: '<USER_ID>',
status: '<STATUS>', // optional
expiresAt: '2020-10-15T06:38:00.000+00:00', // optional
metadata: [], // optional
permissions: [Permission::read(Role::any())], // optional
purge: false // optional
);```
23 changes: 23 additions & 0 deletions docs/examples/presences/upsert.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Presences;
use Appwrite\Permission;
use Appwrite\Role;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setKey('<YOUR_API_KEY>'); // Your secret API key

$presences = new Presences($client);

$result = $presences->upsert(
presenceId: '<PRESENCE_ID>',
userId: '<USER_ID>',
status: '<STATUS>',
permissions: [Permission::read(Role::any())], // optional
expiresAt: '2020-10-15T06:38:00.000+00:00', // optional
metadata: [] // optional
);```
4 changes: 2 additions & 2 deletions docs/examples/project/create-ephemeral-key.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use Appwrite\Client;
use Appwrite\Services\Project;
use Appwrite\Enums\Scopes;
use Appwrite\Enums\ProjectKeyScopes;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -13,6 +13,6 @@ $client = (new Client())
$project = new Project($client);

$result = $project->createEphemeralKey(
scopes: [Scopes::PROJECTREAD()],
scopes: [ProjectKeyScopes::PROJECTREAD()],
duration: 600
);```
4 changes: 2 additions & 2 deletions docs/examples/project/create-key.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use Appwrite\Client;
use Appwrite\Services\Project;
use Appwrite\Enums\Scopes;
use Appwrite\Enums\ProjectKeyScopes;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -15,6 +15,6 @@ $project = new Project($client);
$result = $project->createKey(
keyId: '<KEY_ID>',
name: '<NAME>',
scopes: [Scopes::PROJECTREAD()],
scopes: [ProjectKeyScopes::PROJECTREAD()],
expire: '2020-10-15T06:38:00.000+00:00' // optional
);```
8 changes: 4 additions & 4 deletions docs/examples/project/get-email-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

use Appwrite\Client;
use Appwrite\Services\Project;
use Appwrite\Enums\EmailTemplateType;
use Appwrite\Enums\EmailTemplateLocale;
use Appwrite\Enums\ProjectEmailTemplateId;
use Appwrite\Enums\ProjectEmailTemplateLocale;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -14,6 +14,6 @@ $client = (new Client())
$project = new Project($client);

$result = $project->getEmailTemplate(
templateId: EmailTemplateType::VERIFICATION(),
locale: EmailTemplateLocale::AF() // optional
templateId: ProjectEmailTemplateId::VERIFICATION(),
locale: ProjectEmailTemplateLocale::AF() // optional
);```
4 changes: 2 additions & 2 deletions docs/examples/project/get-o-auth-2-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use Appwrite\Client;
use Appwrite\Services\Project;
use Appwrite\Enums\OAuthProvider;
use Appwrite\Enums\ProjectOAuthProviderId;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -13,5 +13,5 @@ $client = (new Client())
$project = new Project($client);

$result = $project->getOAuth2Provider(
providerId: OAuthProvider::AMAZON()
providerId: ProjectOAuthProviderId::AMAZON()
);```
4 changes: 2 additions & 2 deletions docs/examples/project/get-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use Appwrite\Client;
use Appwrite\Services\Project;
use Appwrite\Enums\ProjectPolicy;
use Appwrite\Enums\ProjectPolicyId;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -13,5 +13,5 @@ $client = (new Client())
$project = new Project($client);

$result = $project->getPolicy(
policyId: ProjectPolicy::PASSWORDDICTIONARY()
policyId: ProjectPolicyId::PASSWORDDICTIONARY()
);```
Loading