From d0053534ac7691fde97dfc41ed8b91ff1090a78a Mon Sep 17 00:00:00 2001 From: root Date: Mon, 18 May 2026 12:01:06 +0000 Subject: [PATCH 1/2] chore: update PHP SDK to 24.0.0 --- CHANGELOG.md | 23 + README.md | 2 +- docs/advisor.md | 76 + docs/examples/advisor/delete-report.md | 16 + docs/examples/advisor/get-insight.md | 17 + docs/examples/advisor/get-report.md | 16 + docs/examples/advisor/list-insights.md | 18 + docs/examples/advisor/list-reports.md | 17 + docs/examples/presences/delete.md | 16 + docs/examples/presences/get.md | 16 + docs/examples/presences/list.md | 18 + docs/examples/presences/update-presence.md | 24 + docs/examples/presences/upsert.md | 23 + docs/examples/project/create-ephemeral-key.md | 4 +- docs/examples/project/create-key.md | 4 +- docs/examples/project/get-email-template.md | 8 +- .../examples/project/get-o-auth-2-provider.md | 4 +- docs/examples/project/get-policy.md | 4 +- docs/examples/project/get.md | 15 + docs/examples/project/update-auth-method.md | 4 +- .../update-deny-aliased-email-policy.md | 16 + .../update-deny-disposable-email-policy.md | 16 + .../project/update-deny-free-email-policy.md | 16 + .../examples/project/update-email-template.md | 8 +- docs/examples/project/update-key.md | 4 +- .../project/update-o-auth-2-google.md | 2 + docs/examples/project/update-protocol.md | 4 +- docs/examples/project/update-service.md | 4 +- docs/examples/project/update-smtp.md | 4 +- docs/examples/usage/list-events.md | 17 + docs/examples/usage/list-gauges.md | 17 + docs/presences.md | 85 + docs/project.md | 131 +- docs/usage.md | 30 + src/Appwrite/Client.php | 6 +- src/Appwrite/Enums/EmailTemplateLocale.php | 1213 ---------- src/Appwrite/Enums/OAuth2GooglePrompt.php | 61 + src/Appwrite/Enums/OAuthProvider.php | 18 - ...AuthMethod.php => ProjectAuthMethodId.php} | 46 +- ...ateType.php => ProjectEmailTemplateId.php} | 46 +- .../Enums/ProjectEmailTemplateLocale.php | 1213 ++++++++++ src/Appwrite/Enums/ProjectKeyScopes.php | 880 +++++++ .../Enums/ProjectOAuth2GooglePrompt.php | 61 + src/Appwrite/Enums/ProjectOAuthProviderId.php | 439 ++++ ...{ProjectPolicy.php => ProjectPolicyId.php} | 58 +- .../{ProtocolId.php => ProjectProtocolId.php} | 22 +- .../{Secure.php => ProjectSMTPSecure.php} | 16 +- src/Appwrite/Enums/ProjectServiceId.php | 196 ++ src/Appwrite/Enums/Scopes.php | 63 + src/Appwrite/Enums/ServiceId.php | 187 -- src/Appwrite/Models/AuthProvider.php | 75 - src/Appwrite/Models/Database.php | 8 +- src/Appwrite/Models/Insight.php | 155 ++ src/Appwrite/Models/InsightCTA.php | 68 + src/Appwrite/Models/InsightList.php | 59 + src/Appwrite/Models/OAuth2Google.php | 20 +- src/Appwrite/Models/Presence.php | 113 + src/Appwrite/Models/PresenceList.php | 59 + src/Appwrite/Models/Project.php | 451 +--- src/Appwrite/Models/ProjectAuthMethod.php | 56 + src/Appwrite/Models/ProjectProtocol.php | 56 + src/Appwrite/Models/ProjectService.php | 56 + src/Appwrite/Models/Report.php | 126 + src/Appwrite/Models/ReportList.php | 59 + src/Appwrite/Models/UsageEvent.php | 110 + src/Appwrite/Models/UsageEventList.php | 59 + src/Appwrite/Models/UsageGauge.php | 61 + src/Appwrite/Models/UsageGaugeList.php | 59 + src/Appwrite/Services/Advisor.php | 217 ++ src/Appwrite/Services/Presences.php | 256 ++ src/Appwrite/Services/Project.php | 203 +- src/Appwrite/Services/Usage.php | 123 + tests/Appwrite/Services/AdvisorTest.php | 221 ++ tests/Appwrite/Services/DatabasesTest.php | 160 +- tests/Appwrite/Services/PresencesTest.php | 130 ++ tests/Appwrite/Services/ProjectTest.php | 2062 +++++------------ tests/Appwrite/Services/TablesDBTest.php | 160 +- tests/Appwrite/Services/UsageTest.php | 72 + 78 files changed, 6704 insertions(+), 3754 deletions(-) create mode 100644 docs/advisor.md create mode 100644 docs/examples/advisor/delete-report.md create mode 100644 docs/examples/advisor/get-insight.md create mode 100644 docs/examples/advisor/get-report.md create mode 100644 docs/examples/advisor/list-insights.md create mode 100644 docs/examples/advisor/list-reports.md create mode 100644 docs/examples/presences/delete.md create mode 100644 docs/examples/presences/get.md create mode 100644 docs/examples/presences/list.md create mode 100644 docs/examples/presences/update-presence.md create mode 100644 docs/examples/presences/upsert.md create mode 100644 docs/examples/project/get.md create mode 100644 docs/examples/project/update-deny-aliased-email-policy.md create mode 100644 docs/examples/project/update-deny-disposable-email-policy.md create mode 100644 docs/examples/project/update-deny-free-email-policy.md create mode 100644 docs/examples/usage/list-events.md create mode 100644 docs/examples/usage/list-gauges.md create mode 100644 docs/presences.md create mode 100644 docs/usage.md delete mode 100644 src/Appwrite/Enums/EmailTemplateLocale.php create mode 100644 src/Appwrite/Enums/OAuth2GooglePrompt.php rename src/Appwrite/Enums/{AuthMethod.php => ProjectAuthMethodId.php} (52%) rename src/Appwrite/Enums/{EmailTemplateType.php => ProjectEmailTemplateId.php} (51%) create mode 100644 src/Appwrite/Enums/ProjectEmailTemplateLocale.php create mode 100644 src/Appwrite/Enums/ProjectKeyScopes.php create mode 100644 src/Appwrite/Enums/ProjectOAuth2GooglePrompt.php create mode 100644 src/Appwrite/Enums/ProjectOAuthProviderId.php rename src/Appwrite/Enums/{ProjectPolicy.php => ProjectPolicyId.php} (54%) rename src/Appwrite/Enums/{ProtocolId.php => ProjectProtocolId.php} (60%) rename src/Appwrite/Enums/{Secure.php => ProjectSMTPSecure.php} (65%) create mode 100644 src/Appwrite/Enums/ProjectServiceId.php delete mode 100644 src/Appwrite/Enums/ServiceId.php delete mode 100644 src/Appwrite/Models/AuthProvider.php create mode 100644 src/Appwrite/Models/Insight.php create mode 100644 src/Appwrite/Models/InsightCTA.php create mode 100644 src/Appwrite/Models/InsightList.php create mode 100644 src/Appwrite/Models/Presence.php create mode 100644 src/Appwrite/Models/PresenceList.php create mode 100644 src/Appwrite/Models/ProjectAuthMethod.php create mode 100644 src/Appwrite/Models/ProjectProtocol.php create mode 100644 src/Appwrite/Models/ProjectService.php create mode 100644 src/Appwrite/Models/Report.php create mode 100644 src/Appwrite/Models/ReportList.php create mode 100644 src/Appwrite/Models/UsageEvent.php create mode 100644 src/Appwrite/Models/UsageEventList.php create mode 100644 src/Appwrite/Models/UsageGauge.php create mode 100644 src/Appwrite/Models/UsageGaugeList.php create mode 100644 src/Appwrite/Services/Advisor.php create mode 100644 src/Appwrite/Services/Presences.php create mode 100644 src/Appwrite/Services/Usage.php create mode 100644 tests/Appwrite/Services/AdvisorTest.php create mode 100644 tests/Appwrite/Services/PresencesTest.php create mode 100644 tests/Appwrite/Services/UsageTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 8514a50..0480702 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,28 @@ # 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` +* Added: `prompt` parameter to `Project::updateOAuth2Google` and `prompt` field on the `OAuth2Google` model, backed by the new `OAuth2GooglePrompt` enum +* Added: `Project::updateDenyCanonicalEmailPolicy`, `Project::updateDenyDisposableEmailPolicy`, and `Project::updateDenyFreeEmailPolicy` +* Updated: `BuildRuntime` and `Runtime` enums with `deno-1.21`, `deno-1.24`, and `deno-1.35` + ## 23.1.0 * Added: Introduced `bigint` create/update APIs for legacy Databases attributes diff --git a/README.md b/README.md index b7b02aa..a47ec4c 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/docs/advisor.md b/docs/advisor.md new file mode 100644 index 0000000..e292c93 --- /dev/null +++ b/docs/advisor.md @@ -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. | | + diff --git a/docs/examples/advisor/delete-report.md b/docs/examples/advisor/delete-report.md new file mode 100644 index 0000000..997fd5e --- /dev/null +++ b/docs/examples/advisor/delete-report.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$advisor = new Advisor($client); + +$result = $advisor->deleteReport( + reportId: '' +);``` diff --git a/docs/examples/advisor/get-insight.md b/docs/examples/advisor/get-insight.md new file mode 100644 index 0000000..79412e7 --- /dev/null +++ b/docs/examples/advisor/get-insight.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$advisor = new Advisor($client); + +$result = $advisor->getInsight( + reportId: '', + insightId: '' +);``` diff --git a/docs/examples/advisor/get-report.md b/docs/examples/advisor/get-report.md new file mode 100644 index 0000000..93e4d71 --- /dev/null +++ b/docs/examples/advisor/get-report.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$advisor = new Advisor($client); + +$result = $advisor->getReport( + reportId: '' +);``` diff --git a/docs/examples/advisor/list-insights.md b/docs/examples/advisor/list-insights.md new file mode 100644 index 0000000..241075b --- /dev/null +++ b/docs/examples/advisor/list-insights.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$advisor = new Advisor($client); + +$result = $advisor->listInsights( + reportId: '', + queries: [], // optional + total: false // optional +);``` diff --git a/docs/examples/advisor/list-reports.md b/docs/examples/advisor/list-reports.md new file mode 100644 index 0000000..91f3c2d --- /dev/null +++ b/docs/examples/advisor/list-reports.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$advisor = new Advisor($client); + +$result = $advisor->listReports( + queries: [], // optional + total: false // optional +);``` diff --git a/docs/examples/presences/delete.md b/docs/examples/presences/delete.md new file mode 100644 index 0000000..225ee6c --- /dev/null +++ b/docs/examples/presences/delete.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$presences = new Presences($client); + +$result = $presences->delete( + presenceId: '' +);``` diff --git a/docs/examples/presences/get.md b/docs/examples/presences/get.md new file mode 100644 index 0000000..c019698 --- /dev/null +++ b/docs/examples/presences/get.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$presences = new Presences($client); + +$result = $presences->get( + presenceId: '' +);``` diff --git a/docs/examples/presences/list.md b/docs/examples/presences/list.md new file mode 100644 index 0000000..6162029 --- /dev/null +++ b/docs/examples/presences/list.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$presences = new Presences($client); + +$result = $presences->list( + queries: [], // optional + total: false, // optional + ttl: 0 // optional +);``` diff --git a/docs/examples/presences/update-presence.md b/docs/examples/presences/update-presence.md new file mode 100644 index 0000000..d017a13 --- /dev/null +++ b/docs/examples/presences/update-presence.md @@ -0,0 +1,24 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$presences = new Presences($client); + +$result = $presences->updatePresence( + presenceId: '', + userId: '', + status: '', // optional + expiresAt: '2020-10-15T06:38:00.000+00:00', // optional + metadata: [], // optional + permissions: [Permission::read(Role::any())], // optional + purge: false // optional +);``` diff --git a/docs/examples/presences/upsert.md b/docs/examples/presences/upsert.md new file mode 100644 index 0000000..f6d34e2 --- /dev/null +++ b/docs/examples/presences/upsert.md @@ -0,0 +1,23 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$presences = new Presences($client); + +$result = $presences->upsert( + presenceId: '', + userId: '', + status: '', + permissions: [Permission::read(Role::any())], // optional + expiresAt: '2020-10-15T06:38:00.000+00:00', // optional + metadata: [] // optional +);``` diff --git a/docs/examples/project/create-ephemeral-key.md b/docs/examples/project/create-ephemeral-key.md index fbbac30..29a813a 100644 --- a/docs/examples/project/create-ephemeral-key.md +++ b/docs/examples/project/create-ephemeral-key.md @@ -3,7 +3,7 @@ use Appwrite\Client; use Appwrite\Services\Project; -use Appwrite\Enums\Scopes; +use Appwrite\Enums\ProjectKeyScopes; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -13,6 +13,6 @@ $client = (new Client()) $project = new Project($client); $result = $project->createEphemeralKey( - scopes: [Scopes::PROJECTREAD()], + scopes: [ProjectKeyScopes::PROJECTREAD()], duration: 600 );``` diff --git a/docs/examples/project/create-key.md b/docs/examples/project/create-key.md index 9157fce..cd3dbfd 100644 --- a/docs/examples/project/create-key.md +++ b/docs/examples/project/create-key.md @@ -3,7 +3,7 @@ use Appwrite\Client; use Appwrite\Services\Project; -use Appwrite\Enums\Scopes; +use Appwrite\Enums\ProjectKeyScopes; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -15,6 +15,6 @@ $project = new Project($client); $result = $project->createKey( keyId: '', name: '', - scopes: [Scopes::PROJECTREAD()], + scopes: [ProjectKeyScopes::PROJECTREAD()], expire: '2020-10-15T06:38:00.000+00:00' // optional );``` diff --git a/docs/examples/project/get-email-template.md b/docs/examples/project/get-email-template.md index 409933d..f06e1c3 100644 --- a/docs/examples/project/get-email-template.md +++ b/docs/examples/project/get-email-template.md @@ -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://.cloud.appwrite.io/v1') // Your API Endpoint @@ -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 );``` diff --git a/docs/examples/project/get-o-auth-2-provider.md b/docs/examples/project/get-o-auth-2-provider.md index 1805a34..ded92e1 100644 --- a/docs/examples/project/get-o-auth-2-provider.md +++ b/docs/examples/project/get-o-auth-2-provider.md @@ -3,7 +3,7 @@ use Appwrite\Client; use Appwrite\Services\Project; -use Appwrite\Enums\OAuthProvider; +use Appwrite\Enums\ProjectOAuthProviderId; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -13,5 +13,5 @@ $client = (new Client()) $project = new Project($client); $result = $project->getOAuth2Provider( - providerId: OAuthProvider::AMAZON() + providerId: ProjectOAuthProviderId::AMAZON() );``` diff --git a/docs/examples/project/get-policy.md b/docs/examples/project/get-policy.md index 231d75b..5f60c81 100644 --- a/docs/examples/project/get-policy.md +++ b/docs/examples/project/get-policy.md @@ -3,7 +3,7 @@ use Appwrite\Client; use Appwrite\Services\Project; -use Appwrite\Enums\ProjectPolicy; +use Appwrite\Enums\ProjectPolicyId; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -13,5 +13,5 @@ $client = (new Client()) $project = new Project($client); $result = $project->getPolicy( - policyId: ProjectPolicy::PASSWORDDICTIONARY() + policyId: ProjectPolicyId::PASSWORDDICTIONARY() );``` diff --git a/docs/examples/project/get.md b/docs/examples/project/get.md new file mode 100644 index 0000000..4e90450 --- /dev/null +++ b/docs/examples/project/get.md @@ -0,0 +1,15 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$project = new Project($client); + +$result = $project->get(); +``` diff --git a/docs/examples/project/update-auth-method.md b/docs/examples/project/update-auth-method.md index 1946c40..3633f13 100644 --- a/docs/examples/project/update-auth-method.md +++ b/docs/examples/project/update-auth-method.md @@ -3,7 +3,7 @@ use Appwrite\Client; use Appwrite\Services\Project; -use Appwrite\Enums\AuthMethod; +use Appwrite\Enums\ProjectAuthMethodId; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -13,6 +13,6 @@ $client = (new Client()) $project = new Project($client); $result = $project->updateAuthMethod( - methodId: AuthMethod::EMAILPASSWORD(), + methodId: ProjectAuthMethodId::EMAILPASSWORD(), enabled: false );``` diff --git a/docs/examples/project/update-deny-aliased-email-policy.md b/docs/examples/project/update-deny-aliased-email-policy.md new file mode 100644 index 0000000..3ddc159 --- /dev/null +++ b/docs/examples/project/update-deny-aliased-email-policy.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$project = new Project($client); + +$result = $project->updateDenyAliasedEmailPolicy( + enabled: false +);``` diff --git a/docs/examples/project/update-deny-disposable-email-policy.md b/docs/examples/project/update-deny-disposable-email-policy.md new file mode 100644 index 0000000..6733b20 --- /dev/null +++ b/docs/examples/project/update-deny-disposable-email-policy.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$project = new Project($client); + +$result = $project->updateDenyDisposableEmailPolicy( + enabled: false +);``` diff --git a/docs/examples/project/update-deny-free-email-policy.md b/docs/examples/project/update-deny-free-email-policy.md new file mode 100644 index 0000000..1b8d30f --- /dev/null +++ b/docs/examples/project/update-deny-free-email-policy.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$project = new Project($client); + +$result = $project->updateDenyFreeEmailPolicy( + enabled: false +);``` diff --git a/docs/examples/project/update-email-template.md b/docs/examples/project/update-email-template.md index 442d2c1..ac92777 100644 --- a/docs/examples/project/update-email-template.md +++ b/docs/examples/project/update-email-template.md @@ -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://.cloud.appwrite.io/v1') // Your API Endpoint @@ -14,8 +14,8 @@ $client = (new Client()) $project = new Project($client); $result = $project->updateEmailTemplate( - templateId: EmailTemplateType::VERIFICATION(), - locale: EmailTemplateLocale::AF(), // optional + templateId: ProjectEmailTemplateId::VERIFICATION(), + locale: ProjectEmailTemplateLocale::AF(), // optional subject: '', // optional message: '', // optional senderName: '', // optional diff --git a/docs/examples/project/update-key.md b/docs/examples/project/update-key.md index 1d1e6fd..1a1e100 100644 --- a/docs/examples/project/update-key.md +++ b/docs/examples/project/update-key.md @@ -3,7 +3,7 @@ use Appwrite\Client; use Appwrite\Services\Project; -use Appwrite\Enums\Scopes; +use Appwrite\Enums\ProjectKeyScopes; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -15,6 +15,6 @@ $project = new Project($client); $result = $project->updateKey( keyId: '', name: '', - scopes: [Scopes::PROJECTREAD()], + scopes: [ProjectKeyScopes::PROJECTREAD()], expire: '2020-10-15T06:38:00.000+00:00' // optional );``` diff --git a/docs/examples/project/update-o-auth-2-google.md b/docs/examples/project/update-o-auth-2-google.md index 06fc6b6..63466c4 100644 --- a/docs/examples/project/update-o-auth-2-google.md +++ b/docs/examples/project/update-o-auth-2-google.md @@ -3,6 +3,7 @@ use Appwrite\Client; use Appwrite\Services\Project; +use Appwrite\Enums\ProjectOAuth2GooglePrompt; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -14,5 +15,6 @@ $project = new Project($client); $result = $project->updateOAuth2Google( clientId: '', // optional clientSecret: '', // optional + prompt: [ProjectOAuth2GooglePrompt::NONE()], // optional enabled: false // optional );``` diff --git a/docs/examples/project/update-protocol.md b/docs/examples/project/update-protocol.md index 0b64857..e87fc30 100644 --- a/docs/examples/project/update-protocol.md +++ b/docs/examples/project/update-protocol.md @@ -3,7 +3,7 @@ use Appwrite\Client; use Appwrite\Services\Project; -use Appwrite\Enums\ProtocolId; +use Appwrite\Enums\ProjectProtocolId; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -13,6 +13,6 @@ $client = (new Client()) $project = new Project($client); $result = $project->updateProtocol( - protocolId: ProtocolId::REST(), + protocolId: ProjectProtocolId::REST(), enabled: false );``` diff --git a/docs/examples/project/update-service.md b/docs/examples/project/update-service.md index ba8b90e..88e90ea 100644 --- a/docs/examples/project/update-service.md +++ b/docs/examples/project/update-service.md @@ -3,7 +3,7 @@ use Appwrite\Client; use Appwrite\Services\Project; -use Appwrite\Enums\ServiceId; +use Appwrite\Enums\ProjectServiceId; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -13,6 +13,6 @@ $client = (new Client()) $project = new Project($client); $result = $project->updateService( - serviceId: ServiceId::ACCOUNT(), + serviceId: ProjectServiceId::ACCOUNT(), enabled: false );``` diff --git a/docs/examples/project/update-smtp.md b/docs/examples/project/update-smtp.md index 164230d..452a3d8 100644 --- a/docs/examples/project/update-smtp.md +++ b/docs/examples/project/update-smtp.md @@ -3,7 +3,7 @@ use Appwrite\Client; use Appwrite\Services\Project; -use Appwrite\Enums\Secure; +use Appwrite\Enums\ProjectSMTPSecure; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -21,6 +21,6 @@ $result = $project->updateSMTP( senderName: '', // optional replyToEmail: 'email@example.com', // optional replyToName: '', // optional - secure: Secure::TLS(), // optional + secure: ProjectSMTPSecure::TLS(), // optional enabled: false // optional );``` diff --git a/docs/examples/usage/list-events.md b/docs/examples/usage/list-events.md new file mode 100644 index 0000000..41a62fe --- /dev/null +++ b/docs/examples/usage/list-events.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$usage = new Usage($client); + +$result = $usage->listEvents( + queries: [], // optional + total: false // optional +);``` diff --git a/docs/examples/usage/list-gauges.md b/docs/examples/usage/list-gauges.md new file mode 100644 index 0000000..9dc822b --- /dev/null +++ b/docs/examples/usage/list-gauges.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$usage = new Usage($client); + +$result = $usage->listGauges( + queries: [], // optional + total: false // optional +);``` diff --git a/docs/presences.md b/docs/presences.md new file mode 100644 index 0000000..a7977ba --- /dev/null +++ b/docs/presences.md @@ -0,0 +1,85 @@ +# Presences Service + + +```http request +GET https://cloud.appwrite.io/v1/presences +``` + +** List presence logs. Expired entries are filtered out automatically. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| queries | array | Array of query strings generated using the Query class provided by the SDK. | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | +| ttl | integer | TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). | 0 | + + +```http request +GET https://cloud.appwrite.io/v1/presences/{presenceId} +``` + +** Get a presence log by its unique ID. Entries whose `expiresAt` is in the past are treated as not found. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| presenceId | string | **Required** Presence unique ID. | | + + +```http request +PUT https://cloud.appwrite.io/v1/presences/{presenceId} +``` + +** Create or update a presence log by its user ID. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| presenceId | string | **Required** Presence unique ID. | | +| userId | string | User ID. | | +| status | string | Presence status. | | +| permissions | array | An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| expiresAt | string | Presence expiry datetime. | | +| metadata | object | Presence metadata object. | {} | + + +```http request +PATCH https://cloud.appwrite.io/v1/presences/{presenceId} +``` + +** Update a presence log by its unique ID. Using the patch method you can pass only specific fields that will get updated. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| presenceId | string | **Required** Presence unique ID. | | +| userId | string | User ID. | | +| status | string | Presence status. | | +| expiresAt | string | Presence expiry datetime. | | +| metadata | object | Presence metadata object. | {} | +| permissions | array | An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| purge | boolean | When true, purge cached responses used by list presences endpoint. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/presences/{presenceId} +``` + +** Delete a presence log by its unique ID. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| presenceId | string | **Required** Presence unique ID. | | + diff --git a/docs/project.md b/docs/project.md index ef41a70..81f603c 100644 --- a/docs/project.md +++ b/docs/project.md @@ -1,6 +1,13 @@ # Project Service +```http request +GET https://cloud.appwrite.io/v1/project +``` + +** Get a project. ** + + ```http request DELETE https://cloud.appwrite.io/v1/project ``` @@ -218,7 +225,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/amazon | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Amazon OAuth2 app. For example: amzn1.application-oa2-client.87400c00000000000000000000063d5b2 | | -| clientSecret | string | 'Client Secret' of Amazon OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret' of Amazon OAuth2 app. For example: 79ffe4000000000000000000000000000000000000000000000000000002de55 | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -250,7 +257,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/auth0 | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq | | -| clientSecret | string | 'Client Secret' of Auth0 OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret' of Auth0 OAuth2 app. For example: zXz0000-00000000000000000000000000000-00000000000000000000PJafnF | | | endpoint | string | Domain of Auth0 instance. For example: example.us.auth0.com | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -266,7 +273,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/authentik | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Authentik OAuth2 app. For example: dTKOPa0000000000000000000000000000e7G8hv | | -| clientSecret | string | 'Client Secret' of Authentik OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret' of Authentik OAuth2 app. For example: ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK | | | endpoint | string | Domain of Authentik instance. For example: example.authentik.com | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -282,7 +289,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/autodesk | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Autodesk OAuth2 app. For example: 5zw90v00000000000000000000kVYXN7 | | -| clientSecret | string | 'Client Secret' of Autodesk OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret' of Autodesk OAuth2 app. For example: 7I000000000000MW | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -297,7 +304,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/bitbucket | Field Name | Type | Description | Default | | --- | --- | --- | --- | | key | string | 'Key' of Bitbucket OAuth2 app. For example: Knt70000000000ByRc | | -| secret | string | 'Secret' of Bitbucket OAuth2 app. For example: | | +| secret | string | 'Secret' of Bitbucket OAuth2 app. For example: NMfLZJ00000000000000000000TLQdDx | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -312,7 +319,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/bitly | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Bitly OAuth2 app. For example: d95151000000000000000000000000000067af9b | | -| clientSecret | string | 'Client Secret' of Bitly OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret' of Bitly OAuth2 app. For example: a13e250000000000000000000000000000d73095 | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -327,7 +334,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/box | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Box OAuth2 app. For example: deglcs00000000000000000000x2og6y | | -| clientSecret | string | 'Client Secret' of Box OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret' of Box OAuth2 app. For example: OKM1f100000000000000000000eshEif | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -342,7 +349,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/dailymotion | Field Name | Type | Description | Default | | --- | --- | --- | --- | | apiKey | string | 'API Key' of Dailymotion OAuth2 app. For example: 07a9000000000000067f | | -| apiSecret | string | 'API Secret' of Dailymotion OAuth2 app. For example: | | +| apiSecret | string | 'API Secret' of Dailymotion OAuth2 app. For example: a399a90000000000000000000000000000d90639 | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -357,7 +364,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/discord | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Discord OAuth2 app. For example: 950722000000343754 | | -| clientSecret | string | 'Client Secret' of Discord OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret' of Discord OAuth2 app. For example: YmPXnM000000000000000000002zFg5D | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -372,7 +379,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/disqus | Field Name | Type | Description | Default | | --- | --- | --- | --- | | publicKey | string | 'Public Key, also known as API Key' of Disqus OAuth2 app. For example: cgegH70000000000000000000000000000000000000000000000000000Hr1nYX | | -| secretKey | string | 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: | | +| secretKey | string | 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: W7Bykj00000000000000000000000000000000000000000000000000003o43w9 | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -387,7 +394,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/dropbox | Field Name | Type | Description | Default | | --- | --- | --- | --- | | appKey | string | 'App Key' of Dropbox OAuth2 app. For example: jl000000000009t | | -| appSecret | string | 'App Secret' of Dropbox OAuth2 app. For example: | | +| appSecret | string | 'App Secret' of Dropbox OAuth2 app. For example: g200000000000vw | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -402,7 +409,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/etsy | Field Name | Type | Description | Default | | --- | --- | --- | --- | | keyString | string | 'Keystring' of Etsy OAuth2 app. For example: nsgzxh0000000000008j85a2 | | -| sharedSecret | string | 'Shared Secret' of Etsy OAuth2 app. For example: | | +| sharedSecret | string | 'Shared Secret' of Etsy OAuth2 app. For example: tp000000ru | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -417,7 +424,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/facebook | Field Name | Type | Description | Default | | --- | --- | --- | --- | | appId | string | 'App ID' of Facebook OAuth2 app. For example: 260600000007694 | | -| appSecret | string | 'App Secret' of Facebook OAuth2 app. For example: | | +| appSecret | string | 'App Secret' of Facebook OAuth2 app. For example: 2d0b2800000000000000000000d38af4 | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -432,7 +439,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/figma | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Figma OAuth2 app. For example: byay5H0000000000VtiI40 | | -| clientSecret | string | 'Client Secret' of Figma OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret' of Figma OAuth2 app. For example: yEpOYn0000000000000000004iIsU5 | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -447,7 +454,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/fusionauth | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of FusionAuth OAuth2 app. For example: b2222c00-0000-0000-0000-000000862097 | | -| clientSecret | string | 'Client Secret' of FusionAuth OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret' of FusionAuth OAuth2 app. For example: Jx4s0C0000000000000000000000000000000wGqLsc | | | endpoint | string | Domain of FusionAuth instance. For example: example.fusionauth.io | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -463,7 +470,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/github | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'OAuth2 app Client ID, or App ID' of GitHub OAuth2 app. For example: e4d87900000000540733. Example of wrong value: 370006 | | -| clientSecret | string | 'Client Secret' of GitHub OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret' of GitHub OAuth2 app. For example: 5e07c00000000000000000000000000000198bcc | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -478,7 +485,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/gitlab | Field Name | Type | Description | Default | | --- | --- | --- | --- | | applicationId | string | 'Application ID' of Gitlab OAuth2 app. For example: d41ffe0000000000000000000000000000000000000000000000000000d5e252 | | -| secret | string | 'Secret' of Gitlab OAuth2 app. For example: | | +| secret | string | 'Secret' of Gitlab OAuth2 app. For example: gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38 | | | endpoint | string | Endpoint URL of self-hosted GitLab instance. For example: https://gitlab.com | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -494,7 +501,8 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/google | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com | | -| clientSecret | string | 'Client Secret' of Google OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret' of Google OAuth2 app. For example: GOCSPX-2k8gsR0000000000000000VNahJj | | +| prompt | array | Array of Google OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. Must not be specified with other values. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -509,7 +517,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/keycloak | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Keycloak OAuth2 app. For example: appwrite-o0000000st-app | | -| clientSecret | string | 'Client Secret' of Keycloak OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret' of Keycloak OAuth2 app. For example: jdjrJd00000000000000000000HUsaZO | | | endpoint | string | Domain of Keycloak instance. For example: keycloak.example.com | | | realmName | string | Keycloak realm name. For example: appwrite-realm | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -526,7 +534,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/kick | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Kick OAuth2 app. For example: 01KQ7C00000000000001MFHS32 | | -| clientSecret | string | 'Client Secret' of Kick OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret' of Kick OAuth2 app. For example: 34ac5600000000000000000000000000000000000000000000000000e830c8b | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -541,7 +549,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/linkedin | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Linkedin OAuth2 app. For example: 770000000000dv | | -| primaryClientSecret | string | 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: | | +| primaryClientSecret | string | 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: WPL_AP1.2Bf0000000000000./HtlYw== | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -556,7 +564,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/microsoft | Field Name | Type | Description | Default | | --- | --- | --- | --- | | applicationId | string | 'Entra ID Application ID, also known as Client ID' of Microsoft OAuth2 app. For example: 00001111-aaaa-2222-bbbb-3333cccc4444 | | -| applicationSecret | string | 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: | | +| applicationSecret | string | 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u | | | tenant | string | Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. For example: common | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -572,7 +580,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/notion | Field Name | Type | Description | Default | | --- | --- | --- | --- | | oauthClientId | string | 'OAuth Client ID' of Notion OAuth2 app. For example: 341d8700-0000-0000-0000-000000446ee3 | | -| oauthClientSecret | string | 'OAuth Client Secret' of Notion OAuth2 app. For example: | | +| oauthClientSecret | string | 'OAuth Client Secret' of Notion OAuth2 app. For example: secret_dLUr4b000000000000000000000000000000lFHAa9 | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -587,7 +595,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/oidc | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Oidc OAuth2 app. For example: qibI2x0000000000000000000000000006L2YFoG | | -| clientSecret | string | 'Client Secret' of Oidc OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret' of Oidc OAuth2 app. For example: Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV | | | wellKnownURL | string | OpenID Connect well-known configuration URL. When provided, authorization, token, and user info endpoints can be discovered automatically. For example: https://myoauth.com/.well-known/openid-configuration | | | authorizationURL | string | OpenID Connect authorization endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/authorize | | | tokenURL | string | OpenID Connect token endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/token | | @@ -606,7 +614,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/okta | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Okta OAuth2 app. For example: 0oa00000000000000698 | | -| clientSecret | string | 'Client Secret' of Okta OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret' of Okta OAuth2 app. For example: Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV | | | domain | string | Okta company domain. Required when enabling the provider. For example: trial-6400025.okta.com. Example of wrong value: trial-6400025-admin.okta.com, or https://trial-6400025.okta.com/ | | | authorizationServerId | string | Custom Authorization Servers. Optional, can be left empty or unconfigured. For example: aus000000000000000h7z | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -623,7 +631,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/paypal | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Paypal OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB | | -| secretKey | string | 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: | | +| secretKey | string | 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -638,7 +646,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/paypalSandbox | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of PaypalSandbox OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB | | -| secretKey | string | 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: | | +| secretKey | string | 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -653,7 +661,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/podio | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Podio OAuth2 app. For example: appwrite-o0000000st-app | | -| clientSecret | string | 'Client Secret' of Podio OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret' of Podio OAuth2 app. For example: Rn247T0000000000000000000000000000000000000000000000000000W2zWTN | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -668,7 +676,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/salesforce | Field Name | Type | Description | Default | | --- | --- | --- | --- | | customerKey | string | 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq | | -| customerSecret | string | 'Consumer Secret' of Salesforce OAuth2 app. For example: | | +| customerSecret | string | 'Consumer Secret' of Salesforce OAuth2 app. For example: 3w000000000000e2 | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -683,7 +691,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/slack | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Slack OAuth2 app. For example: 23000000089.15000000000023 | | -| clientSecret | string | 'Client Secret' of Slack OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret' of Slack OAuth2 app. For example: 81656000000000000000000000f3d2fd | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -698,7 +706,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/spotify | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Spotify OAuth2 app. For example: 6ec271000000000000000000009beace | | -| clientSecret | string | 'Client Secret' of Spotify OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret' of Spotify OAuth2 app. For example: db068a000000000000000000008b5b9f | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -713,7 +721,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/stripe | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Stripe OAuth2 app. For example: ca_UKibXX0000000000000000000006byvR | | -| apiSecretKey | string | 'API Secret Key' of Stripe OAuth2 app. For example: | | +| apiSecretKey | string | 'API Secret Key' of Stripe OAuth2 app. For example: sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -728,7 +736,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/tradeshift | Field Name | Type | Description | Default | | --- | --- | --- | --- | | oauth2ClientId | string | 'OAuth2 Client ID' of Tradeshift OAuth2 app. For example: appwrite-tes00000.0000000000est-app | | -| oauth2ClientSecret | string | 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: | | +| oauth2ClientSecret | string | 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -743,7 +751,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/tradeshiftBox | Field Name | Type | Description | Default | | --- | --- | --- | --- | | oauth2ClientId | string | 'OAuth2 Client ID' of Tradeshift Sandbox OAuth2 app. For example: appwrite-tes00000.0000000000est-app | | -| oauth2ClientSecret | string | 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: | | +| oauth2ClientSecret | string | 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -758,7 +766,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/twitch | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Twitch OAuth2 app. For example: vvi0in000000000000000000ikmt9p | | -| clientSecret | string | 'Client Secret' of Twitch OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret' of Twitch OAuth2 app. For example: pmapue000000000000000000zylw3v | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -773,7 +781,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/wordpress | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of WordPress OAuth2 app. For example: 130005 | | -| clientSecret | string | 'Client Secret' of WordPress OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret' of WordPress OAuth2 app. For example: PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -788,7 +796,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/x | Field Name | Type | Description | Default | | --- | --- | --- | --- | | customerKey | string | 'Customer Key' of X OAuth2 app. For example: slzZV0000000000000NFLaWT | | -| secretKey | string | 'Secret Key' of X OAuth2 app. For example: | | +| secretKey | string | 'Secret Key' of X OAuth2 app. For example: tkEPkp00000000000000000000000000000000000000FTxbI9 | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -803,7 +811,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/yahoo | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID, also known as Customer Key' of Yahoo OAuth2 app. For example: dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm | | -| clientSecret | string | 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: cf978f0000000000000000000000000000c5e2e9 | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -818,7 +826,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/yandex | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Yandex OAuth2 app. For example: 6a8a6a0000000000000000000091483c | | -| clientSecret | string | 'Client Secret' of Yandex OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret' of Yandex OAuth2 app. For example: bbf98500000000000000000000c75a63 | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -833,7 +841,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/zoho | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Zoho OAuth2 app. For example: 1000.83C178000000000000000000RPNX0B | | -| clientSecret | string | 'Client Secret' of Zoho OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret' of Zoho OAuth2 app. For example: fb5cac000000000000000000000000000000a68f6e | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -848,7 +856,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/zoom | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Zoom OAuth2 app. For example: QMAC00000000000000w0AQ | | -| clientSecret | string | 'Client Secret' of Zoom OAuth2 app. For example: | | +| clientSecret | string | 'Client Secret' of Zoom OAuth2 app. For example: GAWsG4000000000000000000007U01ON | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -1069,6 +1077,45 @@ GET https://cloud.appwrite.io/v1/project/policies | total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | +```http request +PATCH https://cloud.appwrite.io/v1/project/policies/deny-aliased-email +``` + +** Configures if aliased emails such as subaddresses and emails with suffixes are denied during new users sign-ups and email updates. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| enabled | boolean | Set whether or not to block aliased emails during signup and email updates. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/policies/deny-disposable-email +``` + +** Configures if disposable emails from known temporary domains are denied during new users sign-ups and email updates. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| enabled | boolean | Set whether or not to block disposable email addresses during signup and email updates. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/policies/deny-free-email +``` + +** Configures if emails from free providers such as Gmail or Yahoo are denied during new users sign-ups and email updates. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| enabled | boolean | Set whether or not to block free email addresses during signup and email updates. | | + + ```http request PATCH https://cloud.appwrite.io/v1/project/policies/membership-privacy ``` @@ -1229,7 +1276,7 @@ PATCH https://cloud.appwrite.io/v1/project/services/{serviceId} | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| serviceId | string | **Required** Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging | | +| serviceId | string | **Required** Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging, advisor | | | enabled | boolean | Service status. | | diff --git a/docs/usage.md b/docs/usage.md new file mode 100644 index 0000000..41f907c --- /dev/null +++ b/docs/usage.md @@ -0,0 +1,30 @@ +# Usage Service + + +```http request +GET https://cloud.appwrite.io/v1/usage/events +``` + +** Query usage event metrics from the usage database. Returns individual event rows with full metadata. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, path, method, status, resource, resourceId, country, userAgent, time (these match the underlying column names — note that the response surfaces `resource` as `resourceType` and `country` as `countryCode`). When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| queries | array | Array of query strings as JSON. Supported: equal("metric", [...]), equal("path", [...]), equal("method", [...]), equal("status", [...]), equal("resource", [...]), equal("resourceId", [...]), equal("country", [...]), equal("userAgent", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). | [] | +| 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/usage/gauges +``` + +** Query usage gauge metrics (point-in-time resource snapshots) from the usage database. Returns individual gauge snapshots with metric, value, and timestamp. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, time. Use `orderDesc("time"), limit(1)` to fetch the most recent snapshot. When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| queries | array | Array of query strings as JSON. Supported: equal("metric", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | + diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php index 6c99d17..09df9b9 100644 --- a/src/Appwrite/Client.php +++ b/src/Appwrite/Client.php @@ -37,11 +37,11 @@ class Client */ protected array $headers = [ 'content-type' => '', - 'user-agent' => 'AppwritePHPSDK/23.1.0 ()', + 'user-agent' => 'AppwritePHPSDK/24.0.0 ()', 'x-sdk-name'=> 'PHP', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'php', - 'x-sdk-version'=> '23.1.0', + 'x-sdk-version'=> '24.0.0', ]; /** @@ -63,7 +63,7 @@ class Client */ public function __construct() { - $this->headers['X-Appwrite-Response-Format'] = '1.9.4'; + $this->headers['X-Appwrite-Response-Format'] = '1.9.5'; } diff --git a/src/Appwrite/Enums/EmailTemplateLocale.php b/src/Appwrite/Enums/EmailTemplateLocale.php deleted file mode 100644 index a851b56..0000000 --- a/src/Appwrite/Enums/EmailTemplateLocale.php +++ /dev/null @@ -1,1213 +0,0 @@ -value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function AF(): EmailTemplateLocale - { - if (!isset(self::$AF)) { - self::$AF = new EmailTemplateLocale('af'); - } - return self::$AF; - } - public static function ARAE(): EmailTemplateLocale - { - if (!isset(self::$ARAE)) { - self::$ARAE = new EmailTemplateLocale('ar-ae'); - } - return self::$ARAE; - } - public static function ARBH(): EmailTemplateLocale - { - if (!isset(self::$ARBH)) { - self::$ARBH = new EmailTemplateLocale('ar-bh'); - } - return self::$ARBH; - } - public static function ARDZ(): EmailTemplateLocale - { - if (!isset(self::$ARDZ)) { - self::$ARDZ = new EmailTemplateLocale('ar-dz'); - } - return self::$ARDZ; - } - public static function AREG(): EmailTemplateLocale - { - if (!isset(self::$AREG)) { - self::$AREG = new EmailTemplateLocale('ar-eg'); - } - return self::$AREG; - } - public static function ARIQ(): EmailTemplateLocale - { - if (!isset(self::$ARIQ)) { - self::$ARIQ = new EmailTemplateLocale('ar-iq'); - } - return self::$ARIQ; - } - public static function ARJO(): EmailTemplateLocale - { - if (!isset(self::$ARJO)) { - self::$ARJO = new EmailTemplateLocale('ar-jo'); - } - return self::$ARJO; - } - public static function ARKW(): EmailTemplateLocale - { - if (!isset(self::$ARKW)) { - self::$ARKW = new EmailTemplateLocale('ar-kw'); - } - return self::$ARKW; - } - public static function ARLB(): EmailTemplateLocale - { - if (!isset(self::$ARLB)) { - self::$ARLB = new EmailTemplateLocale('ar-lb'); - } - return self::$ARLB; - } - public static function ARLY(): EmailTemplateLocale - { - if (!isset(self::$ARLY)) { - self::$ARLY = new EmailTemplateLocale('ar-ly'); - } - return self::$ARLY; - } - public static function ARMA(): EmailTemplateLocale - { - if (!isset(self::$ARMA)) { - self::$ARMA = new EmailTemplateLocale('ar-ma'); - } - return self::$ARMA; - } - public static function AROM(): EmailTemplateLocale - { - if (!isset(self::$AROM)) { - self::$AROM = new EmailTemplateLocale('ar-om'); - } - return self::$AROM; - } - public static function ARQA(): EmailTemplateLocale - { - if (!isset(self::$ARQA)) { - self::$ARQA = new EmailTemplateLocale('ar-qa'); - } - return self::$ARQA; - } - public static function ARSA(): EmailTemplateLocale - { - if (!isset(self::$ARSA)) { - self::$ARSA = new EmailTemplateLocale('ar-sa'); - } - return self::$ARSA; - } - public static function ARSY(): EmailTemplateLocale - { - if (!isset(self::$ARSY)) { - self::$ARSY = new EmailTemplateLocale('ar-sy'); - } - return self::$ARSY; - } - public static function ARTN(): EmailTemplateLocale - { - if (!isset(self::$ARTN)) { - self::$ARTN = new EmailTemplateLocale('ar-tn'); - } - return self::$ARTN; - } - public static function ARYE(): EmailTemplateLocale - { - if (!isset(self::$ARYE)) { - self::$ARYE = new EmailTemplateLocale('ar-ye'); - } - return self::$ARYE; - } - public static function AS(): EmailTemplateLocale - { - if (!isset(self::$AS)) { - self::$AS = new EmailTemplateLocale('as'); - } - return self::$AS; - } - public static function AZ(): EmailTemplateLocale - { - if (!isset(self::$AZ)) { - self::$AZ = new EmailTemplateLocale('az'); - } - return self::$AZ; - } - public static function BE(): EmailTemplateLocale - { - if (!isset(self::$BE)) { - self::$BE = new EmailTemplateLocale('be'); - } - return self::$BE; - } - public static function BG(): EmailTemplateLocale - { - if (!isset(self::$BG)) { - self::$BG = new EmailTemplateLocale('bg'); - } - return self::$BG; - } - public static function BH(): EmailTemplateLocale - { - if (!isset(self::$BH)) { - self::$BH = new EmailTemplateLocale('bh'); - } - return self::$BH; - } - public static function BN(): EmailTemplateLocale - { - if (!isset(self::$BN)) { - self::$BN = new EmailTemplateLocale('bn'); - } - return self::$BN; - } - public static function BS(): EmailTemplateLocale - { - if (!isset(self::$BS)) { - self::$BS = new EmailTemplateLocale('bs'); - } - return self::$BS; - } - public static function CA(): EmailTemplateLocale - { - if (!isset(self::$CA)) { - self::$CA = new EmailTemplateLocale('ca'); - } - return self::$CA; - } - public static function CS(): EmailTemplateLocale - { - if (!isset(self::$CS)) { - self::$CS = new EmailTemplateLocale('cs'); - } - return self::$CS; - } - public static function CY(): EmailTemplateLocale - { - if (!isset(self::$CY)) { - self::$CY = new EmailTemplateLocale('cy'); - } - return self::$CY; - } - public static function DA(): EmailTemplateLocale - { - if (!isset(self::$DA)) { - self::$DA = new EmailTemplateLocale('da'); - } - return self::$DA; - } - public static function DE(): EmailTemplateLocale - { - if (!isset(self::$DE)) { - self::$DE = new EmailTemplateLocale('de'); - } - return self::$DE; - } - public static function DEAT(): EmailTemplateLocale - { - if (!isset(self::$DEAT)) { - self::$DEAT = new EmailTemplateLocale('de-at'); - } - return self::$DEAT; - } - public static function DECH(): EmailTemplateLocale - { - if (!isset(self::$DECH)) { - self::$DECH = new EmailTemplateLocale('de-ch'); - } - return self::$DECH; - } - public static function DELI(): EmailTemplateLocale - { - if (!isset(self::$DELI)) { - self::$DELI = new EmailTemplateLocale('de-li'); - } - return self::$DELI; - } - public static function DELU(): EmailTemplateLocale - { - if (!isset(self::$DELU)) { - self::$DELU = new EmailTemplateLocale('de-lu'); - } - return self::$DELU; - } - public static function EL(): EmailTemplateLocale - { - if (!isset(self::$EL)) { - self::$EL = new EmailTemplateLocale('el'); - } - return self::$EL; - } - public static function EN(): EmailTemplateLocale - { - if (!isset(self::$EN)) { - self::$EN = new EmailTemplateLocale('en'); - } - return self::$EN; - } - public static function ENAU(): EmailTemplateLocale - { - if (!isset(self::$ENAU)) { - self::$ENAU = new EmailTemplateLocale('en-au'); - } - return self::$ENAU; - } - public static function ENBZ(): EmailTemplateLocale - { - if (!isset(self::$ENBZ)) { - self::$ENBZ = new EmailTemplateLocale('en-bz'); - } - return self::$ENBZ; - } - public static function ENCA(): EmailTemplateLocale - { - if (!isset(self::$ENCA)) { - self::$ENCA = new EmailTemplateLocale('en-ca'); - } - return self::$ENCA; - } - public static function ENGB(): EmailTemplateLocale - { - if (!isset(self::$ENGB)) { - self::$ENGB = new EmailTemplateLocale('en-gb'); - } - return self::$ENGB; - } - public static function ENIE(): EmailTemplateLocale - { - if (!isset(self::$ENIE)) { - self::$ENIE = new EmailTemplateLocale('en-ie'); - } - return self::$ENIE; - } - public static function ENJM(): EmailTemplateLocale - { - if (!isset(self::$ENJM)) { - self::$ENJM = new EmailTemplateLocale('en-jm'); - } - return self::$ENJM; - } - public static function ENNZ(): EmailTemplateLocale - { - if (!isset(self::$ENNZ)) { - self::$ENNZ = new EmailTemplateLocale('en-nz'); - } - return self::$ENNZ; - } - public static function ENTT(): EmailTemplateLocale - { - if (!isset(self::$ENTT)) { - self::$ENTT = new EmailTemplateLocale('en-tt'); - } - return self::$ENTT; - } - public static function ENUS(): EmailTemplateLocale - { - if (!isset(self::$ENUS)) { - self::$ENUS = new EmailTemplateLocale('en-us'); - } - return self::$ENUS; - } - public static function ENZA(): EmailTemplateLocale - { - if (!isset(self::$ENZA)) { - self::$ENZA = new EmailTemplateLocale('en-za'); - } - return self::$ENZA; - } - public static function EO(): EmailTemplateLocale - { - if (!isset(self::$EO)) { - self::$EO = new EmailTemplateLocale('eo'); - } - return self::$EO; - } - public static function ES(): EmailTemplateLocale - { - if (!isset(self::$ES)) { - self::$ES = new EmailTemplateLocale('es'); - } - return self::$ES; - } - public static function ESAR(): EmailTemplateLocale - { - if (!isset(self::$ESAR)) { - self::$ESAR = new EmailTemplateLocale('es-ar'); - } - return self::$ESAR; - } - public static function ESBO(): EmailTemplateLocale - { - if (!isset(self::$ESBO)) { - self::$ESBO = new EmailTemplateLocale('es-bo'); - } - return self::$ESBO; - } - public static function ESCL(): EmailTemplateLocale - { - if (!isset(self::$ESCL)) { - self::$ESCL = new EmailTemplateLocale('es-cl'); - } - return self::$ESCL; - } - public static function ESCO(): EmailTemplateLocale - { - if (!isset(self::$ESCO)) { - self::$ESCO = new EmailTemplateLocale('es-co'); - } - return self::$ESCO; - } - public static function ESCR(): EmailTemplateLocale - { - if (!isset(self::$ESCR)) { - self::$ESCR = new EmailTemplateLocale('es-cr'); - } - return self::$ESCR; - } - public static function ESDO(): EmailTemplateLocale - { - if (!isset(self::$ESDO)) { - self::$ESDO = new EmailTemplateLocale('es-do'); - } - return self::$ESDO; - } - public static function ESEC(): EmailTemplateLocale - { - if (!isset(self::$ESEC)) { - self::$ESEC = new EmailTemplateLocale('es-ec'); - } - return self::$ESEC; - } - public static function ESGT(): EmailTemplateLocale - { - if (!isset(self::$ESGT)) { - self::$ESGT = new EmailTemplateLocale('es-gt'); - } - return self::$ESGT; - } - public static function ESHN(): EmailTemplateLocale - { - if (!isset(self::$ESHN)) { - self::$ESHN = new EmailTemplateLocale('es-hn'); - } - return self::$ESHN; - } - public static function ESMX(): EmailTemplateLocale - { - if (!isset(self::$ESMX)) { - self::$ESMX = new EmailTemplateLocale('es-mx'); - } - return self::$ESMX; - } - public static function ESNI(): EmailTemplateLocale - { - if (!isset(self::$ESNI)) { - self::$ESNI = new EmailTemplateLocale('es-ni'); - } - return self::$ESNI; - } - public static function ESPA(): EmailTemplateLocale - { - if (!isset(self::$ESPA)) { - self::$ESPA = new EmailTemplateLocale('es-pa'); - } - return self::$ESPA; - } - public static function ESPE(): EmailTemplateLocale - { - if (!isset(self::$ESPE)) { - self::$ESPE = new EmailTemplateLocale('es-pe'); - } - return self::$ESPE; - } - public static function ESPR(): EmailTemplateLocale - { - if (!isset(self::$ESPR)) { - self::$ESPR = new EmailTemplateLocale('es-pr'); - } - return self::$ESPR; - } - public static function ESPY(): EmailTemplateLocale - { - if (!isset(self::$ESPY)) { - self::$ESPY = new EmailTemplateLocale('es-py'); - } - return self::$ESPY; - } - public static function ESSV(): EmailTemplateLocale - { - if (!isset(self::$ESSV)) { - self::$ESSV = new EmailTemplateLocale('es-sv'); - } - return self::$ESSV; - } - public static function ESUY(): EmailTemplateLocale - { - if (!isset(self::$ESUY)) { - self::$ESUY = new EmailTemplateLocale('es-uy'); - } - return self::$ESUY; - } - public static function ESVE(): EmailTemplateLocale - { - if (!isset(self::$ESVE)) { - self::$ESVE = new EmailTemplateLocale('es-ve'); - } - return self::$ESVE; - } - public static function ET(): EmailTemplateLocale - { - if (!isset(self::$ET)) { - self::$ET = new EmailTemplateLocale('et'); - } - return self::$ET; - } - public static function EU(): EmailTemplateLocale - { - if (!isset(self::$EU)) { - self::$EU = new EmailTemplateLocale('eu'); - } - return self::$EU; - } - public static function FA(): EmailTemplateLocale - { - if (!isset(self::$FA)) { - self::$FA = new EmailTemplateLocale('fa'); - } - return self::$FA; - } - public static function FI(): EmailTemplateLocale - { - if (!isset(self::$FI)) { - self::$FI = new EmailTemplateLocale('fi'); - } - return self::$FI; - } - public static function FO(): EmailTemplateLocale - { - if (!isset(self::$FO)) { - self::$FO = new EmailTemplateLocale('fo'); - } - return self::$FO; - } - public static function FR(): EmailTemplateLocale - { - if (!isset(self::$FR)) { - self::$FR = new EmailTemplateLocale('fr'); - } - return self::$FR; - } - public static function FRBE(): EmailTemplateLocale - { - if (!isset(self::$FRBE)) { - self::$FRBE = new EmailTemplateLocale('fr-be'); - } - return self::$FRBE; - } - public static function FRCA(): EmailTemplateLocale - { - if (!isset(self::$FRCA)) { - self::$FRCA = new EmailTemplateLocale('fr-ca'); - } - return self::$FRCA; - } - public static function FRCH(): EmailTemplateLocale - { - if (!isset(self::$FRCH)) { - self::$FRCH = new EmailTemplateLocale('fr-ch'); - } - return self::$FRCH; - } - public static function FRLU(): EmailTemplateLocale - { - if (!isset(self::$FRLU)) { - self::$FRLU = new EmailTemplateLocale('fr-lu'); - } - return self::$FRLU; - } - public static function GA(): EmailTemplateLocale - { - if (!isset(self::$GA)) { - self::$GA = new EmailTemplateLocale('ga'); - } - return self::$GA; - } - public static function GD(): EmailTemplateLocale - { - if (!isset(self::$GD)) { - self::$GD = new EmailTemplateLocale('gd'); - } - return self::$GD; - } - public static function HE(): EmailTemplateLocale - { - if (!isset(self::$HE)) { - self::$HE = new EmailTemplateLocale('he'); - } - return self::$HE; - } - public static function HI(): EmailTemplateLocale - { - if (!isset(self::$HI)) { - self::$HI = new EmailTemplateLocale('hi'); - } - return self::$HI; - } - public static function HR(): EmailTemplateLocale - { - if (!isset(self::$HR)) { - self::$HR = new EmailTemplateLocale('hr'); - } - return self::$HR; - } - public static function HU(): EmailTemplateLocale - { - if (!isset(self::$HU)) { - self::$HU = new EmailTemplateLocale('hu'); - } - return self::$HU; - } - public static function ID(): EmailTemplateLocale - { - if (!isset(self::$ID)) { - self::$ID = new EmailTemplateLocale('id'); - } - return self::$ID; - } - public static function IS(): EmailTemplateLocale - { - if (!isset(self::$IS)) { - self::$IS = new EmailTemplateLocale('is'); - } - return self::$IS; - } - public static function IT(): EmailTemplateLocale - { - if (!isset(self::$IT)) { - self::$IT = new EmailTemplateLocale('it'); - } - return self::$IT; - } - public static function ITCH(): EmailTemplateLocale - { - if (!isset(self::$ITCH)) { - self::$ITCH = new EmailTemplateLocale('it-ch'); - } - return self::$ITCH; - } - public static function JA(): EmailTemplateLocale - { - if (!isset(self::$JA)) { - self::$JA = new EmailTemplateLocale('ja'); - } - return self::$JA; - } - public static function JI(): EmailTemplateLocale - { - if (!isset(self::$JI)) { - self::$JI = new EmailTemplateLocale('ji'); - } - return self::$JI; - } - public static function KO(): EmailTemplateLocale - { - if (!isset(self::$KO)) { - self::$KO = new EmailTemplateLocale('ko'); - } - return self::$KO; - } - public static function KU(): EmailTemplateLocale - { - if (!isset(self::$KU)) { - self::$KU = new EmailTemplateLocale('ku'); - } - return self::$KU; - } - public static function LT(): EmailTemplateLocale - { - if (!isset(self::$LT)) { - self::$LT = new EmailTemplateLocale('lt'); - } - return self::$LT; - } - public static function LV(): EmailTemplateLocale - { - if (!isset(self::$LV)) { - self::$LV = new EmailTemplateLocale('lv'); - } - return self::$LV; - } - public static function MK(): EmailTemplateLocale - { - if (!isset(self::$MK)) { - self::$MK = new EmailTemplateLocale('mk'); - } - return self::$MK; - } - public static function ML(): EmailTemplateLocale - { - if (!isset(self::$ML)) { - self::$ML = new EmailTemplateLocale('ml'); - } - return self::$ML; - } - public static function MS(): EmailTemplateLocale - { - if (!isset(self::$MS)) { - self::$MS = new EmailTemplateLocale('ms'); - } - return self::$MS; - } - public static function MT(): EmailTemplateLocale - { - if (!isset(self::$MT)) { - self::$MT = new EmailTemplateLocale('mt'); - } - return self::$MT; - } - public static function NB(): EmailTemplateLocale - { - if (!isset(self::$NB)) { - self::$NB = new EmailTemplateLocale('nb'); - } - return self::$NB; - } - public static function NE(): EmailTemplateLocale - { - if (!isset(self::$NE)) { - self::$NE = new EmailTemplateLocale('ne'); - } - return self::$NE; - } - public static function NL(): EmailTemplateLocale - { - if (!isset(self::$NL)) { - self::$NL = new EmailTemplateLocale('nl'); - } - return self::$NL; - } - public static function NLBE(): EmailTemplateLocale - { - if (!isset(self::$NLBE)) { - self::$NLBE = new EmailTemplateLocale('nl-be'); - } - return self::$NLBE; - } - public static function NN(): EmailTemplateLocale - { - if (!isset(self::$NN)) { - self::$NN = new EmailTemplateLocale('nn'); - } - return self::$NN; - } - public static function NO(): EmailTemplateLocale - { - if (!isset(self::$NO)) { - self::$NO = new EmailTemplateLocale('no'); - } - return self::$NO; - } - public static function PA(): EmailTemplateLocale - { - if (!isset(self::$PA)) { - self::$PA = new EmailTemplateLocale('pa'); - } - return self::$PA; - } - public static function PL(): EmailTemplateLocale - { - if (!isset(self::$PL)) { - self::$PL = new EmailTemplateLocale('pl'); - } - return self::$PL; - } - public static function PT(): EmailTemplateLocale - { - if (!isset(self::$PT)) { - self::$PT = new EmailTemplateLocale('pt'); - } - return self::$PT; - } - public static function PTBR(): EmailTemplateLocale - { - if (!isset(self::$PTBR)) { - self::$PTBR = new EmailTemplateLocale('pt-br'); - } - return self::$PTBR; - } - public static function RM(): EmailTemplateLocale - { - if (!isset(self::$RM)) { - self::$RM = new EmailTemplateLocale('rm'); - } - return self::$RM; - } - public static function RO(): EmailTemplateLocale - { - if (!isset(self::$RO)) { - self::$RO = new EmailTemplateLocale('ro'); - } - return self::$RO; - } - public static function ROMD(): EmailTemplateLocale - { - if (!isset(self::$ROMD)) { - self::$ROMD = new EmailTemplateLocale('ro-md'); - } - return self::$ROMD; - } - public static function RU(): EmailTemplateLocale - { - if (!isset(self::$RU)) { - self::$RU = new EmailTemplateLocale('ru'); - } - return self::$RU; - } - public static function RUMD(): EmailTemplateLocale - { - if (!isset(self::$RUMD)) { - self::$RUMD = new EmailTemplateLocale('ru-md'); - } - return self::$RUMD; - } - public static function SB(): EmailTemplateLocale - { - if (!isset(self::$SB)) { - self::$SB = new EmailTemplateLocale('sb'); - } - return self::$SB; - } - public static function SK(): EmailTemplateLocale - { - if (!isset(self::$SK)) { - self::$SK = new EmailTemplateLocale('sk'); - } - return self::$SK; - } - public static function SL(): EmailTemplateLocale - { - if (!isset(self::$SL)) { - self::$SL = new EmailTemplateLocale('sl'); - } - return self::$SL; - } - public static function SQ(): EmailTemplateLocale - { - if (!isset(self::$SQ)) { - self::$SQ = new EmailTemplateLocale('sq'); - } - return self::$SQ; - } - public static function SR(): EmailTemplateLocale - { - if (!isset(self::$SR)) { - self::$SR = new EmailTemplateLocale('sr'); - } - return self::$SR; - } - public static function SV(): EmailTemplateLocale - { - if (!isset(self::$SV)) { - self::$SV = new EmailTemplateLocale('sv'); - } - return self::$SV; - } - public static function SVFI(): EmailTemplateLocale - { - if (!isset(self::$SVFI)) { - self::$SVFI = new EmailTemplateLocale('sv-fi'); - } - return self::$SVFI; - } - public static function TH(): EmailTemplateLocale - { - if (!isset(self::$TH)) { - self::$TH = new EmailTemplateLocale('th'); - } - return self::$TH; - } - public static function TN(): EmailTemplateLocale - { - if (!isset(self::$TN)) { - self::$TN = new EmailTemplateLocale('tn'); - } - return self::$TN; - } - public static function TR(): EmailTemplateLocale - { - if (!isset(self::$TR)) { - self::$TR = new EmailTemplateLocale('tr'); - } - return self::$TR; - } - public static function TS(): EmailTemplateLocale - { - if (!isset(self::$TS)) { - self::$TS = new EmailTemplateLocale('ts'); - } - return self::$TS; - } - public static function UA(): EmailTemplateLocale - { - if (!isset(self::$UA)) { - self::$UA = new EmailTemplateLocale('ua'); - } - return self::$UA; - } - public static function UR(): EmailTemplateLocale - { - if (!isset(self::$UR)) { - self::$UR = new EmailTemplateLocale('ur'); - } - return self::$UR; - } - public static function VE(): EmailTemplateLocale - { - if (!isset(self::$VE)) { - self::$VE = new EmailTemplateLocale('ve'); - } - return self::$VE; - } - public static function VI(): EmailTemplateLocale - { - if (!isset(self::$VI)) { - self::$VI = new EmailTemplateLocale('vi'); - } - return self::$VI; - } - public static function XH(): EmailTemplateLocale - { - if (!isset(self::$XH)) { - self::$XH = new EmailTemplateLocale('xh'); - } - return self::$XH; - } - public static function ZHCN(): EmailTemplateLocale - { - if (!isset(self::$ZHCN)) { - self::$ZHCN = new EmailTemplateLocale('zh-cn'); - } - return self::$ZHCN; - } - public static function ZHHK(): EmailTemplateLocale - { - if (!isset(self::$ZHHK)) { - self::$ZHHK = new EmailTemplateLocale('zh-hk'); - } - return self::$ZHHK; - } - public static function ZHSG(): EmailTemplateLocale - { - if (!isset(self::$ZHSG)) { - self::$ZHSG = new EmailTemplateLocale('zh-sg'); - } - return self::$ZHSG; - } - public static function ZHTW(): EmailTemplateLocale - { - if (!isset(self::$ZHTW)) { - self::$ZHTW = new EmailTemplateLocale('zh-tw'); - } - return self::$ZHTW; - } - public static function ZU(): EmailTemplateLocale - { - if (!isset(self::$ZU)) { - self::$ZU = new EmailTemplateLocale('zu'); - } - return self::$ZU; - } - - public static function from(string $value): self - { - return match ($value) { - 'af' => self::AF(), - 'ar-ae' => self::ARAE(), - 'ar-bh' => self::ARBH(), - 'ar-dz' => self::ARDZ(), - 'ar-eg' => self::AREG(), - 'ar-iq' => self::ARIQ(), - 'ar-jo' => self::ARJO(), - 'ar-kw' => self::ARKW(), - 'ar-lb' => self::ARLB(), - 'ar-ly' => self::ARLY(), - 'ar-ma' => self::ARMA(), - 'ar-om' => self::AROM(), - 'ar-qa' => self::ARQA(), - 'ar-sa' => self::ARSA(), - 'ar-sy' => self::ARSY(), - 'ar-tn' => self::ARTN(), - 'ar-ye' => self::ARYE(), - 'as' => self::AS(), - 'az' => self::AZ(), - 'be' => self::BE(), - 'bg' => self::BG(), - 'bh' => self::BH(), - 'bn' => self::BN(), - 'bs' => self::BS(), - 'ca' => self::CA(), - 'cs' => self::CS(), - 'cy' => self::CY(), - 'da' => self::DA(), - 'de' => self::DE(), - 'de-at' => self::DEAT(), - 'de-ch' => self::DECH(), - 'de-li' => self::DELI(), - 'de-lu' => self::DELU(), - 'el' => self::EL(), - 'en' => self::EN(), - 'en-au' => self::ENAU(), - 'en-bz' => self::ENBZ(), - 'en-ca' => self::ENCA(), - 'en-gb' => self::ENGB(), - 'en-ie' => self::ENIE(), - 'en-jm' => self::ENJM(), - 'en-nz' => self::ENNZ(), - 'en-tt' => self::ENTT(), - 'en-us' => self::ENUS(), - 'en-za' => self::ENZA(), - 'eo' => self::EO(), - 'es' => self::ES(), - 'es-ar' => self::ESAR(), - 'es-bo' => self::ESBO(), - 'es-cl' => self::ESCL(), - 'es-co' => self::ESCO(), - 'es-cr' => self::ESCR(), - 'es-do' => self::ESDO(), - 'es-ec' => self::ESEC(), - 'es-gt' => self::ESGT(), - 'es-hn' => self::ESHN(), - 'es-mx' => self::ESMX(), - 'es-ni' => self::ESNI(), - 'es-pa' => self::ESPA(), - 'es-pe' => self::ESPE(), - 'es-pr' => self::ESPR(), - 'es-py' => self::ESPY(), - 'es-sv' => self::ESSV(), - 'es-uy' => self::ESUY(), - 'es-ve' => self::ESVE(), - 'et' => self::ET(), - 'eu' => self::EU(), - 'fa' => self::FA(), - 'fi' => self::FI(), - 'fo' => self::FO(), - 'fr' => self::FR(), - 'fr-be' => self::FRBE(), - 'fr-ca' => self::FRCA(), - 'fr-ch' => self::FRCH(), - 'fr-lu' => self::FRLU(), - 'ga' => self::GA(), - 'gd' => self::GD(), - 'he' => self::HE(), - 'hi' => self::HI(), - 'hr' => self::HR(), - 'hu' => self::HU(), - 'id' => self::ID(), - 'is' => self::IS(), - 'it' => self::IT(), - 'it-ch' => self::ITCH(), - 'ja' => self::JA(), - 'ji' => self::JI(), - 'ko' => self::KO(), - 'ku' => self::KU(), - 'lt' => self::LT(), - 'lv' => self::LV(), - 'mk' => self::MK(), - 'ml' => self::ML(), - 'ms' => self::MS(), - 'mt' => self::MT(), - 'nb' => self::NB(), - 'ne' => self::NE(), - 'nl' => self::NL(), - 'nl-be' => self::NLBE(), - 'nn' => self::NN(), - 'no' => self::NO(), - 'pa' => self::PA(), - 'pl' => self::PL(), - 'pt' => self::PT(), - 'pt-br' => self::PTBR(), - 'rm' => self::RM(), - 'ro' => self::RO(), - 'ro-md' => self::ROMD(), - 'ru' => self::RU(), - 'ru-md' => self::RUMD(), - 'sb' => self::SB(), - 'sk' => self::SK(), - 'sl' => self::SL(), - 'sq' => self::SQ(), - 'sr' => self::SR(), - 'sv' => self::SV(), - 'sv-fi' => self::SVFI(), - 'th' => self::TH(), - 'tn' => self::TN(), - 'tr' => self::TR(), - 'ts' => self::TS(), - 'ua' => self::UA(), - 'ur' => self::UR(), - 've' => self::VE(), - 'vi' => self::VI(), - 'xh' => self::XH(), - 'zh-cn' => self::ZHCN(), - 'zh-hk' => self::ZHHK(), - 'zh-sg' => self::ZHSG(), - 'zh-tw' => self::ZHTW(), - 'zu' => self::ZU(), - default => throw new \InvalidArgumentException('Unknown EmailTemplateLocale value: ' . $value), - }; - } -} diff --git a/src/Appwrite/Enums/OAuth2GooglePrompt.php b/src/Appwrite/Enums/OAuth2GooglePrompt.php new file mode 100644 index 0000000..f6a6e87 --- /dev/null +++ b/src/Appwrite/Enums/OAuth2GooglePrompt.php @@ -0,0 +1,61 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function NONE(): OAuth2GooglePrompt + { + if (!isset(self::$NONE)) { + self::$NONE = new OAuth2GooglePrompt('none'); + } + return self::$NONE; + } + public static function CONSENT(): OAuth2GooglePrompt + { + if (!isset(self::$CONSENT)) { + self::$CONSENT = new OAuth2GooglePrompt('consent'); + } + return self::$CONSENT; + } + public static function SELECTACCOUNT(): OAuth2GooglePrompt + { + if (!isset(self::$SELECTACCOUNT)) { + self::$SELECTACCOUNT = new OAuth2GooglePrompt('select_account'); + } + return self::$SELECTACCOUNT; + } + + public static function from(string $value): self + { + return match ($value) { + 'none' => self::NONE(), + 'consent' => self::CONSENT(), + 'select_account' => self::SELECTACCOUNT(), + default => throw new \InvalidArgumentException('Unknown OAuth2GooglePrompt value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/OAuthProvider.php b/src/Appwrite/Enums/OAuthProvider.php index f1fed10..4763c08 100644 --- a/src/Appwrite/Enums/OAuthProvider.php +++ b/src/Appwrite/Enums/OAuthProvider.php @@ -49,8 +49,6 @@ class OAuthProvider implements JsonSerializable private static OAuthProvider $YANDEX; private static OAuthProvider $ZOHO; private static OAuthProvider $ZOOM; - private static OAuthProvider $GITHUBIMAGINE; - private static OAuthProvider $GOOGLEIMAGINE; private string $value; @@ -370,20 +368,6 @@ public static function ZOOM(): OAuthProvider } return self::$ZOOM; } - public static function GITHUBIMAGINE(): OAuthProvider - { - if (!isset(self::$GITHUBIMAGINE)) { - self::$GITHUBIMAGINE = new OAuthProvider('githubImagine'); - } - return self::$GITHUBIMAGINE; - } - public static function GOOGLEIMAGINE(): OAuthProvider - { - if (!isset(self::$GOOGLEIMAGINE)) { - self::$GOOGLEIMAGINE = new OAuthProvider('googleImagine'); - } - return self::$GOOGLEIMAGINE; - } public static function from(string $value): self { @@ -431,8 +415,6 @@ public static function from(string $value): self 'yandex' => self::YANDEX(), 'zoho' => self::ZOHO(), 'zoom' => self::ZOOM(), - 'githubImagine' => self::GITHUBIMAGINE(), - 'googleImagine' => self::GOOGLEIMAGINE(), default => throw new \InvalidArgumentException('Unknown OAuthProvider value: ' . $value), }; } diff --git a/src/Appwrite/Enums/AuthMethod.php b/src/Appwrite/Enums/ProjectAuthMethodId.php similarity index 52% rename from src/Appwrite/Enums/AuthMethod.php rename to src/Appwrite/Enums/ProjectAuthMethodId.php index b50e8a1..c45572d 100644 --- a/src/Appwrite/Enums/AuthMethod.php +++ b/src/Appwrite/Enums/ProjectAuthMethodId.php @@ -4,15 +4,15 @@ use JsonSerializable; -class AuthMethod implements JsonSerializable +class ProjectAuthMethodId implements JsonSerializable { - private static AuthMethod $EMAILPASSWORD; - private static AuthMethod $MAGICURL; - private static AuthMethod $EMAILOTP; - private static AuthMethod $ANONYMOUS; - private static AuthMethod $INVITES; - private static AuthMethod $JWT; - private static AuthMethod $PHONE; + private static ProjectAuthMethodId $EMAILPASSWORD; + private static ProjectAuthMethodId $MAGICURL; + private static ProjectAuthMethodId $EMAILOTP; + private static ProjectAuthMethodId $ANONYMOUS; + private static ProjectAuthMethodId $INVITES; + private static ProjectAuthMethodId $JWT; + private static ProjectAuthMethodId $PHONE; private string $value; @@ -31,52 +31,52 @@ public function jsonSerialize(): string return $this->value; } - public static function EMAILPASSWORD(): AuthMethod + public static function EMAILPASSWORD(): ProjectAuthMethodId { if (!isset(self::$EMAILPASSWORD)) { - self::$EMAILPASSWORD = new AuthMethod('email-password'); + self::$EMAILPASSWORD = new ProjectAuthMethodId('email-password'); } return self::$EMAILPASSWORD; } - public static function MAGICURL(): AuthMethod + public static function MAGICURL(): ProjectAuthMethodId { if (!isset(self::$MAGICURL)) { - self::$MAGICURL = new AuthMethod('magic-url'); + self::$MAGICURL = new ProjectAuthMethodId('magic-url'); } return self::$MAGICURL; } - public static function EMAILOTP(): AuthMethod + public static function EMAILOTP(): ProjectAuthMethodId { if (!isset(self::$EMAILOTP)) { - self::$EMAILOTP = new AuthMethod('email-otp'); + self::$EMAILOTP = new ProjectAuthMethodId('email-otp'); } return self::$EMAILOTP; } - public static function ANONYMOUS(): AuthMethod + public static function ANONYMOUS(): ProjectAuthMethodId { if (!isset(self::$ANONYMOUS)) { - self::$ANONYMOUS = new AuthMethod('anonymous'); + self::$ANONYMOUS = new ProjectAuthMethodId('anonymous'); } return self::$ANONYMOUS; } - public static function INVITES(): AuthMethod + public static function INVITES(): ProjectAuthMethodId { if (!isset(self::$INVITES)) { - self::$INVITES = new AuthMethod('invites'); + self::$INVITES = new ProjectAuthMethodId('invites'); } return self::$INVITES; } - public static function JWT(): AuthMethod + public static function JWT(): ProjectAuthMethodId { if (!isset(self::$JWT)) { - self::$JWT = new AuthMethod('jwt'); + self::$JWT = new ProjectAuthMethodId('jwt'); } return self::$JWT; } - public static function PHONE(): AuthMethod + public static function PHONE(): ProjectAuthMethodId { if (!isset(self::$PHONE)) { - self::$PHONE = new AuthMethod('phone'); + self::$PHONE = new ProjectAuthMethodId('phone'); } return self::$PHONE; } @@ -91,7 +91,7 @@ public static function from(string $value): self 'invites' => self::INVITES(), 'jwt' => self::JWT(), 'phone' => self::PHONE(), - default => throw new \InvalidArgumentException('Unknown AuthMethod value: ' . $value), + default => throw new \InvalidArgumentException('Unknown ProjectAuthMethodId value: ' . $value), }; } } diff --git a/src/Appwrite/Enums/EmailTemplateType.php b/src/Appwrite/Enums/ProjectEmailTemplateId.php similarity index 51% rename from src/Appwrite/Enums/EmailTemplateType.php rename to src/Appwrite/Enums/ProjectEmailTemplateId.php index 21086ce..58b14bd 100644 --- a/src/Appwrite/Enums/EmailTemplateType.php +++ b/src/Appwrite/Enums/ProjectEmailTemplateId.php @@ -4,15 +4,15 @@ use JsonSerializable; -class EmailTemplateType implements JsonSerializable +class ProjectEmailTemplateId implements JsonSerializable { - private static EmailTemplateType $VERIFICATION; - private static EmailTemplateType $MAGICSESSION; - private static EmailTemplateType $RECOVERY; - private static EmailTemplateType $INVITATION; - private static EmailTemplateType $MFACHALLENGE; - private static EmailTemplateType $SESSIONALERT; - private static EmailTemplateType $OTPSESSION; + private static ProjectEmailTemplateId $VERIFICATION; + private static ProjectEmailTemplateId $MAGICSESSION; + private static ProjectEmailTemplateId $RECOVERY; + private static ProjectEmailTemplateId $INVITATION; + private static ProjectEmailTemplateId $MFACHALLENGE; + private static ProjectEmailTemplateId $SESSIONALERT; + private static ProjectEmailTemplateId $OTPSESSION; private string $value; @@ -31,52 +31,52 @@ public function jsonSerialize(): string return $this->value; } - public static function VERIFICATION(): EmailTemplateType + public static function VERIFICATION(): ProjectEmailTemplateId { if (!isset(self::$VERIFICATION)) { - self::$VERIFICATION = new EmailTemplateType('verification'); + self::$VERIFICATION = new ProjectEmailTemplateId('verification'); } return self::$VERIFICATION; } - public static function MAGICSESSION(): EmailTemplateType + public static function MAGICSESSION(): ProjectEmailTemplateId { if (!isset(self::$MAGICSESSION)) { - self::$MAGICSESSION = new EmailTemplateType('magicSession'); + self::$MAGICSESSION = new ProjectEmailTemplateId('magicSession'); } return self::$MAGICSESSION; } - public static function RECOVERY(): EmailTemplateType + public static function RECOVERY(): ProjectEmailTemplateId { if (!isset(self::$RECOVERY)) { - self::$RECOVERY = new EmailTemplateType('recovery'); + self::$RECOVERY = new ProjectEmailTemplateId('recovery'); } return self::$RECOVERY; } - public static function INVITATION(): EmailTemplateType + public static function INVITATION(): ProjectEmailTemplateId { if (!isset(self::$INVITATION)) { - self::$INVITATION = new EmailTemplateType('invitation'); + self::$INVITATION = new ProjectEmailTemplateId('invitation'); } return self::$INVITATION; } - public static function MFACHALLENGE(): EmailTemplateType + public static function MFACHALLENGE(): ProjectEmailTemplateId { if (!isset(self::$MFACHALLENGE)) { - self::$MFACHALLENGE = new EmailTemplateType('mfaChallenge'); + self::$MFACHALLENGE = new ProjectEmailTemplateId('mfaChallenge'); } return self::$MFACHALLENGE; } - public static function SESSIONALERT(): EmailTemplateType + public static function SESSIONALERT(): ProjectEmailTemplateId { if (!isset(self::$SESSIONALERT)) { - self::$SESSIONALERT = new EmailTemplateType('sessionAlert'); + self::$SESSIONALERT = new ProjectEmailTemplateId('sessionAlert'); } return self::$SESSIONALERT; } - public static function OTPSESSION(): EmailTemplateType + public static function OTPSESSION(): ProjectEmailTemplateId { if (!isset(self::$OTPSESSION)) { - self::$OTPSESSION = new EmailTemplateType('otpSession'); + self::$OTPSESSION = new ProjectEmailTemplateId('otpSession'); } return self::$OTPSESSION; } @@ -91,7 +91,7 @@ public static function from(string $value): self 'mfaChallenge' => self::MFACHALLENGE(), 'sessionAlert' => self::SESSIONALERT(), 'otpSession' => self::OTPSESSION(), - default => throw new \InvalidArgumentException('Unknown EmailTemplateType value: ' . $value), + default => throw new \InvalidArgumentException('Unknown ProjectEmailTemplateId value: ' . $value), }; } } diff --git a/src/Appwrite/Enums/ProjectEmailTemplateLocale.php b/src/Appwrite/Enums/ProjectEmailTemplateLocale.php new file mode 100644 index 0000000..31971bb --- /dev/null +++ b/src/Appwrite/Enums/ProjectEmailTemplateLocale.php @@ -0,0 +1,1213 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function AF(): ProjectEmailTemplateLocale + { + if (!isset(self::$AF)) { + self::$AF = new ProjectEmailTemplateLocale('af'); + } + return self::$AF; + } + public static function ARAE(): ProjectEmailTemplateLocale + { + if (!isset(self::$ARAE)) { + self::$ARAE = new ProjectEmailTemplateLocale('ar-ae'); + } + return self::$ARAE; + } + public static function ARBH(): ProjectEmailTemplateLocale + { + if (!isset(self::$ARBH)) { + self::$ARBH = new ProjectEmailTemplateLocale('ar-bh'); + } + return self::$ARBH; + } + public static function ARDZ(): ProjectEmailTemplateLocale + { + if (!isset(self::$ARDZ)) { + self::$ARDZ = new ProjectEmailTemplateLocale('ar-dz'); + } + return self::$ARDZ; + } + public static function AREG(): ProjectEmailTemplateLocale + { + if (!isset(self::$AREG)) { + self::$AREG = new ProjectEmailTemplateLocale('ar-eg'); + } + return self::$AREG; + } + public static function ARIQ(): ProjectEmailTemplateLocale + { + if (!isset(self::$ARIQ)) { + self::$ARIQ = new ProjectEmailTemplateLocale('ar-iq'); + } + return self::$ARIQ; + } + public static function ARJO(): ProjectEmailTemplateLocale + { + if (!isset(self::$ARJO)) { + self::$ARJO = new ProjectEmailTemplateLocale('ar-jo'); + } + return self::$ARJO; + } + public static function ARKW(): ProjectEmailTemplateLocale + { + if (!isset(self::$ARKW)) { + self::$ARKW = new ProjectEmailTemplateLocale('ar-kw'); + } + return self::$ARKW; + } + public static function ARLB(): ProjectEmailTemplateLocale + { + if (!isset(self::$ARLB)) { + self::$ARLB = new ProjectEmailTemplateLocale('ar-lb'); + } + return self::$ARLB; + } + public static function ARLY(): ProjectEmailTemplateLocale + { + if (!isset(self::$ARLY)) { + self::$ARLY = new ProjectEmailTemplateLocale('ar-ly'); + } + return self::$ARLY; + } + public static function ARMA(): ProjectEmailTemplateLocale + { + if (!isset(self::$ARMA)) { + self::$ARMA = new ProjectEmailTemplateLocale('ar-ma'); + } + return self::$ARMA; + } + public static function AROM(): ProjectEmailTemplateLocale + { + if (!isset(self::$AROM)) { + self::$AROM = new ProjectEmailTemplateLocale('ar-om'); + } + return self::$AROM; + } + public static function ARQA(): ProjectEmailTemplateLocale + { + if (!isset(self::$ARQA)) { + self::$ARQA = new ProjectEmailTemplateLocale('ar-qa'); + } + return self::$ARQA; + } + public static function ARSA(): ProjectEmailTemplateLocale + { + if (!isset(self::$ARSA)) { + self::$ARSA = new ProjectEmailTemplateLocale('ar-sa'); + } + return self::$ARSA; + } + public static function ARSY(): ProjectEmailTemplateLocale + { + if (!isset(self::$ARSY)) { + self::$ARSY = new ProjectEmailTemplateLocale('ar-sy'); + } + return self::$ARSY; + } + public static function ARTN(): ProjectEmailTemplateLocale + { + if (!isset(self::$ARTN)) { + self::$ARTN = new ProjectEmailTemplateLocale('ar-tn'); + } + return self::$ARTN; + } + public static function ARYE(): ProjectEmailTemplateLocale + { + if (!isset(self::$ARYE)) { + self::$ARYE = new ProjectEmailTemplateLocale('ar-ye'); + } + return self::$ARYE; + } + public static function AS(): ProjectEmailTemplateLocale + { + if (!isset(self::$AS)) { + self::$AS = new ProjectEmailTemplateLocale('as'); + } + return self::$AS; + } + public static function AZ(): ProjectEmailTemplateLocale + { + if (!isset(self::$AZ)) { + self::$AZ = new ProjectEmailTemplateLocale('az'); + } + return self::$AZ; + } + public static function BE(): ProjectEmailTemplateLocale + { + if (!isset(self::$BE)) { + self::$BE = new ProjectEmailTemplateLocale('be'); + } + return self::$BE; + } + public static function BG(): ProjectEmailTemplateLocale + { + if (!isset(self::$BG)) { + self::$BG = new ProjectEmailTemplateLocale('bg'); + } + return self::$BG; + } + public static function BH(): ProjectEmailTemplateLocale + { + if (!isset(self::$BH)) { + self::$BH = new ProjectEmailTemplateLocale('bh'); + } + return self::$BH; + } + public static function BN(): ProjectEmailTemplateLocale + { + if (!isset(self::$BN)) { + self::$BN = new ProjectEmailTemplateLocale('bn'); + } + return self::$BN; + } + public static function BS(): ProjectEmailTemplateLocale + { + if (!isset(self::$BS)) { + self::$BS = new ProjectEmailTemplateLocale('bs'); + } + return self::$BS; + } + public static function CA(): ProjectEmailTemplateLocale + { + if (!isset(self::$CA)) { + self::$CA = new ProjectEmailTemplateLocale('ca'); + } + return self::$CA; + } + public static function CS(): ProjectEmailTemplateLocale + { + if (!isset(self::$CS)) { + self::$CS = new ProjectEmailTemplateLocale('cs'); + } + return self::$CS; + } + public static function CY(): ProjectEmailTemplateLocale + { + if (!isset(self::$CY)) { + self::$CY = new ProjectEmailTemplateLocale('cy'); + } + return self::$CY; + } + public static function DA(): ProjectEmailTemplateLocale + { + if (!isset(self::$DA)) { + self::$DA = new ProjectEmailTemplateLocale('da'); + } + return self::$DA; + } + public static function DE(): ProjectEmailTemplateLocale + { + if (!isset(self::$DE)) { + self::$DE = new ProjectEmailTemplateLocale('de'); + } + return self::$DE; + } + public static function DEAT(): ProjectEmailTemplateLocale + { + if (!isset(self::$DEAT)) { + self::$DEAT = new ProjectEmailTemplateLocale('de-at'); + } + return self::$DEAT; + } + public static function DECH(): ProjectEmailTemplateLocale + { + if (!isset(self::$DECH)) { + self::$DECH = new ProjectEmailTemplateLocale('de-ch'); + } + return self::$DECH; + } + public static function DELI(): ProjectEmailTemplateLocale + { + if (!isset(self::$DELI)) { + self::$DELI = new ProjectEmailTemplateLocale('de-li'); + } + return self::$DELI; + } + public static function DELU(): ProjectEmailTemplateLocale + { + if (!isset(self::$DELU)) { + self::$DELU = new ProjectEmailTemplateLocale('de-lu'); + } + return self::$DELU; + } + public static function EL(): ProjectEmailTemplateLocale + { + if (!isset(self::$EL)) { + self::$EL = new ProjectEmailTemplateLocale('el'); + } + return self::$EL; + } + public static function EN(): ProjectEmailTemplateLocale + { + if (!isset(self::$EN)) { + self::$EN = new ProjectEmailTemplateLocale('en'); + } + return self::$EN; + } + public static function ENAU(): ProjectEmailTemplateLocale + { + if (!isset(self::$ENAU)) { + self::$ENAU = new ProjectEmailTemplateLocale('en-au'); + } + return self::$ENAU; + } + public static function ENBZ(): ProjectEmailTemplateLocale + { + if (!isset(self::$ENBZ)) { + self::$ENBZ = new ProjectEmailTemplateLocale('en-bz'); + } + return self::$ENBZ; + } + public static function ENCA(): ProjectEmailTemplateLocale + { + if (!isset(self::$ENCA)) { + self::$ENCA = new ProjectEmailTemplateLocale('en-ca'); + } + return self::$ENCA; + } + public static function ENGB(): ProjectEmailTemplateLocale + { + if (!isset(self::$ENGB)) { + self::$ENGB = new ProjectEmailTemplateLocale('en-gb'); + } + return self::$ENGB; + } + public static function ENIE(): ProjectEmailTemplateLocale + { + if (!isset(self::$ENIE)) { + self::$ENIE = new ProjectEmailTemplateLocale('en-ie'); + } + return self::$ENIE; + } + public static function ENJM(): ProjectEmailTemplateLocale + { + if (!isset(self::$ENJM)) { + self::$ENJM = new ProjectEmailTemplateLocale('en-jm'); + } + return self::$ENJM; + } + public static function ENNZ(): ProjectEmailTemplateLocale + { + if (!isset(self::$ENNZ)) { + self::$ENNZ = new ProjectEmailTemplateLocale('en-nz'); + } + return self::$ENNZ; + } + public static function ENTT(): ProjectEmailTemplateLocale + { + if (!isset(self::$ENTT)) { + self::$ENTT = new ProjectEmailTemplateLocale('en-tt'); + } + return self::$ENTT; + } + public static function ENUS(): ProjectEmailTemplateLocale + { + if (!isset(self::$ENUS)) { + self::$ENUS = new ProjectEmailTemplateLocale('en-us'); + } + return self::$ENUS; + } + public static function ENZA(): ProjectEmailTemplateLocale + { + if (!isset(self::$ENZA)) { + self::$ENZA = new ProjectEmailTemplateLocale('en-za'); + } + return self::$ENZA; + } + public static function EO(): ProjectEmailTemplateLocale + { + if (!isset(self::$EO)) { + self::$EO = new ProjectEmailTemplateLocale('eo'); + } + return self::$EO; + } + public static function ES(): ProjectEmailTemplateLocale + { + if (!isset(self::$ES)) { + self::$ES = new ProjectEmailTemplateLocale('es'); + } + return self::$ES; + } + public static function ESAR(): ProjectEmailTemplateLocale + { + if (!isset(self::$ESAR)) { + self::$ESAR = new ProjectEmailTemplateLocale('es-ar'); + } + return self::$ESAR; + } + public static function ESBO(): ProjectEmailTemplateLocale + { + if (!isset(self::$ESBO)) { + self::$ESBO = new ProjectEmailTemplateLocale('es-bo'); + } + return self::$ESBO; + } + public static function ESCL(): ProjectEmailTemplateLocale + { + if (!isset(self::$ESCL)) { + self::$ESCL = new ProjectEmailTemplateLocale('es-cl'); + } + return self::$ESCL; + } + public static function ESCO(): ProjectEmailTemplateLocale + { + if (!isset(self::$ESCO)) { + self::$ESCO = new ProjectEmailTemplateLocale('es-co'); + } + return self::$ESCO; + } + public static function ESCR(): ProjectEmailTemplateLocale + { + if (!isset(self::$ESCR)) { + self::$ESCR = new ProjectEmailTemplateLocale('es-cr'); + } + return self::$ESCR; + } + public static function ESDO(): ProjectEmailTemplateLocale + { + if (!isset(self::$ESDO)) { + self::$ESDO = new ProjectEmailTemplateLocale('es-do'); + } + return self::$ESDO; + } + public static function ESEC(): ProjectEmailTemplateLocale + { + if (!isset(self::$ESEC)) { + self::$ESEC = new ProjectEmailTemplateLocale('es-ec'); + } + return self::$ESEC; + } + public static function ESGT(): ProjectEmailTemplateLocale + { + if (!isset(self::$ESGT)) { + self::$ESGT = new ProjectEmailTemplateLocale('es-gt'); + } + return self::$ESGT; + } + public static function ESHN(): ProjectEmailTemplateLocale + { + if (!isset(self::$ESHN)) { + self::$ESHN = new ProjectEmailTemplateLocale('es-hn'); + } + return self::$ESHN; + } + public static function ESMX(): ProjectEmailTemplateLocale + { + if (!isset(self::$ESMX)) { + self::$ESMX = new ProjectEmailTemplateLocale('es-mx'); + } + return self::$ESMX; + } + public static function ESNI(): ProjectEmailTemplateLocale + { + if (!isset(self::$ESNI)) { + self::$ESNI = new ProjectEmailTemplateLocale('es-ni'); + } + return self::$ESNI; + } + public static function ESPA(): ProjectEmailTemplateLocale + { + if (!isset(self::$ESPA)) { + self::$ESPA = new ProjectEmailTemplateLocale('es-pa'); + } + return self::$ESPA; + } + public static function ESPE(): ProjectEmailTemplateLocale + { + if (!isset(self::$ESPE)) { + self::$ESPE = new ProjectEmailTemplateLocale('es-pe'); + } + return self::$ESPE; + } + public static function ESPR(): ProjectEmailTemplateLocale + { + if (!isset(self::$ESPR)) { + self::$ESPR = new ProjectEmailTemplateLocale('es-pr'); + } + return self::$ESPR; + } + public static function ESPY(): ProjectEmailTemplateLocale + { + if (!isset(self::$ESPY)) { + self::$ESPY = new ProjectEmailTemplateLocale('es-py'); + } + return self::$ESPY; + } + public static function ESSV(): ProjectEmailTemplateLocale + { + if (!isset(self::$ESSV)) { + self::$ESSV = new ProjectEmailTemplateLocale('es-sv'); + } + return self::$ESSV; + } + public static function ESUY(): ProjectEmailTemplateLocale + { + if (!isset(self::$ESUY)) { + self::$ESUY = new ProjectEmailTemplateLocale('es-uy'); + } + return self::$ESUY; + } + public static function ESVE(): ProjectEmailTemplateLocale + { + if (!isset(self::$ESVE)) { + self::$ESVE = new ProjectEmailTemplateLocale('es-ve'); + } + return self::$ESVE; + } + public static function ET(): ProjectEmailTemplateLocale + { + if (!isset(self::$ET)) { + self::$ET = new ProjectEmailTemplateLocale('et'); + } + return self::$ET; + } + public static function EU(): ProjectEmailTemplateLocale + { + if (!isset(self::$EU)) { + self::$EU = new ProjectEmailTemplateLocale('eu'); + } + return self::$EU; + } + public static function FA(): ProjectEmailTemplateLocale + { + if (!isset(self::$FA)) { + self::$FA = new ProjectEmailTemplateLocale('fa'); + } + return self::$FA; + } + public static function FI(): ProjectEmailTemplateLocale + { + if (!isset(self::$FI)) { + self::$FI = new ProjectEmailTemplateLocale('fi'); + } + return self::$FI; + } + public static function FO(): ProjectEmailTemplateLocale + { + if (!isset(self::$FO)) { + self::$FO = new ProjectEmailTemplateLocale('fo'); + } + return self::$FO; + } + public static function FR(): ProjectEmailTemplateLocale + { + if (!isset(self::$FR)) { + self::$FR = new ProjectEmailTemplateLocale('fr'); + } + return self::$FR; + } + public static function FRBE(): ProjectEmailTemplateLocale + { + if (!isset(self::$FRBE)) { + self::$FRBE = new ProjectEmailTemplateLocale('fr-be'); + } + return self::$FRBE; + } + public static function FRCA(): ProjectEmailTemplateLocale + { + if (!isset(self::$FRCA)) { + self::$FRCA = new ProjectEmailTemplateLocale('fr-ca'); + } + return self::$FRCA; + } + public static function FRCH(): ProjectEmailTemplateLocale + { + if (!isset(self::$FRCH)) { + self::$FRCH = new ProjectEmailTemplateLocale('fr-ch'); + } + return self::$FRCH; + } + public static function FRLU(): ProjectEmailTemplateLocale + { + if (!isset(self::$FRLU)) { + self::$FRLU = new ProjectEmailTemplateLocale('fr-lu'); + } + return self::$FRLU; + } + public static function GA(): ProjectEmailTemplateLocale + { + if (!isset(self::$GA)) { + self::$GA = new ProjectEmailTemplateLocale('ga'); + } + return self::$GA; + } + public static function GD(): ProjectEmailTemplateLocale + { + if (!isset(self::$GD)) { + self::$GD = new ProjectEmailTemplateLocale('gd'); + } + return self::$GD; + } + public static function HE(): ProjectEmailTemplateLocale + { + if (!isset(self::$HE)) { + self::$HE = new ProjectEmailTemplateLocale('he'); + } + return self::$HE; + } + public static function HI(): ProjectEmailTemplateLocale + { + if (!isset(self::$HI)) { + self::$HI = new ProjectEmailTemplateLocale('hi'); + } + return self::$HI; + } + public static function HR(): ProjectEmailTemplateLocale + { + if (!isset(self::$HR)) { + self::$HR = new ProjectEmailTemplateLocale('hr'); + } + return self::$HR; + } + public static function HU(): ProjectEmailTemplateLocale + { + if (!isset(self::$HU)) { + self::$HU = new ProjectEmailTemplateLocale('hu'); + } + return self::$HU; + } + public static function ID(): ProjectEmailTemplateLocale + { + if (!isset(self::$ID)) { + self::$ID = new ProjectEmailTemplateLocale('id'); + } + return self::$ID; + } + public static function IS(): ProjectEmailTemplateLocale + { + if (!isset(self::$IS)) { + self::$IS = new ProjectEmailTemplateLocale('is'); + } + return self::$IS; + } + public static function IT(): ProjectEmailTemplateLocale + { + if (!isset(self::$IT)) { + self::$IT = new ProjectEmailTemplateLocale('it'); + } + return self::$IT; + } + public static function ITCH(): ProjectEmailTemplateLocale + { + if (!isset(self::$ITCH)) { + self::$ITCH = new ProjectEmailTemplateLocale('it-ch'); + } + return self::$ITCH; + } + public static function JA(): ProjectEmailTemplateLocale + { + if (!isset(self::$JA)) { + self::$JA = new ProjectEmailTemplateLocale('ja'); + } + return self::$JA; + } + public static function JI(): ProjectEmailTemplateLocale + { + if (!isset(self::$JI)) { + self::$JI = new ProjectEmailTemplateLocale('ji'); + } + return self::$JI; + } + public static function KO(): ProjectEmailTemplateLocale + { + if (!isset(self::$KO)) { + self::$KO = new ProjectEmailTemplateLocale('ko'); + } + return self::$KO; + } + public static function KU(): ProjectEmailTemplateLocale + { + if (!isset(self::$KU)) { + self::$KU = new ProjectEmailTemplateLocale('ku'); + } + return self::$KU; + } + public static function LT(): ProjectEmailTemplateLocale + { + if (!isset(self::$LT)) { + self::$LT = new ProjectEmailTemplateLocale('lt'); + } + return self::$LT; + } + public static function LV(): ProjectEmailTemplateLocale + { + if (!isset(self::$LV)) { + self::$LV = new ProjectEmailTemplateLocale('lv'); + } + return self::$LV; + } + public static function MK(): ProjectEmailTemplateLocale + { + if (!isset(self::$MK)) { + self::$MK = new ProjectEmailTemplateLocale('mk'); + } + return self::$MK; + } + public static function ML(): ProjectEmailTemplateLocale + { + if (!isset(self::$ML)) { + self::$ML = new ProjectEmailTemplateLocale('ml'); + } + return self::$ML; + } + public static function MS(): ProjectEmailTemplateLocale + { + if (!isset(self::$MS)) { + self::$MS = new ProjectEmailTemplateLocale('ms'); + } + return self::$MS; + } + public static function MT(): ProjectEmailTemplateLocale + { + if (!isset(self::$MT)) { + self::$MT = new ProjectEmailTemplateLocale('mt'); + } + return self::$MT; + } + public static function NB(): ProjectEmailTemplateLocale + { + if (!isset(self::$NB)) { + self::$NB = new ProjectEmailTemplateLocale('nb'); + } + return self::$NB; + } + public static function NE(): ProjectEmailTemplateLocale + { + if (!isset(self::$NE)) { + self::$NE = new ProjectEmailTemplateLocale('ne'); + } + return self::$NE; + } + public static function NL(): ProjectEmailTemplateLocale + { + if (!isset(self::$NL)) { + self::$NL = new ProjectEmailTemplateLocale('nl'); + } + return self::$NL; + } + public static function NLBE(): ProjectEmailTemplateLocale + { + if (!isset(self::$NLBE)) { + self::$NLBE = new ProjectEmailTemplateLocale('nl-be'); + } + return self::$NLBE; + } + public static function NN(): ProjectEmailTemplateLocale + { + if (!isset(self::$NN)) { + self::$NN = new ProjectEmailTemplateLocale('nn'); + } + return self::$NN; + } + public static function NO(): ProjectEmailTemplateLocale + { + if (!isset(self::$NO)) { + self::$NO = new ProjectEmailTemplateLocale('no'); + } + return self::$NO; + } + public static function PA(): ProjectEmailTemplateLocale + { + if (!isset(self::$PA)) { + self::$PA = new ProjectEmailTemplateLocale('pa'); + } + return self::$PA; + } + public static function PL(): ProjectEmailTemplateLocale + { + if (!isset(self::$PL)) { + self::$PL = new ProjectEmailTemplateLocale('pl'); + } + return self::$PL; + } + public static function PT(): ProjectEmailTemplateLocale + { + if (!isset(self::$PT)) { + self::$PT = new ProjectEmailTemplateLocale('pt'); + } + return self::$PT; + } + public static function PTBR(): ProjectEmailTemplateLocale + { + if (!isset(self::$PTBR)) { + self::$PTBR = new ProjectEmailTemplateLocale('pt-br'); + } + return self::$PTBR; + } + public static function RM(): ProjectEmailTemplateLocale + { + if (!isset(self::$RM)) { + self::$RM = new ProjectEmailTemplateLocale('rm'); + } + return self::$RM; + } + public static function RO(): ProjectEmailTemplateLocale + { + if (!isset(self::$RO)) { + self::$RO = new ProjectEmailTemplateLocale('ro'); + } + return self::$RO; + } + public static function ROMD(): ProjectEmailTemplateLocale + { + if (!isset(self::$ROMD)) { + self::$ROMD = new ProjectEmailTemplateLocale('ro-md'); + } + return self::$ROMD; + } + public static function RU(): ProjectEmailTemplateLocale + { + if (!isset(self::$RU)) { + self::$RU = new ProjectEmailTemplateLocale('ru'); + } + return self::$RU; + } + public static function RUMD(): ProjectEmailTemplateLocale + { + if (!isset(self::$RUMD)) { + self::$RUMD = new ProjectEmailTemplateLocale('ru-md'); + } + return self::$RUMD; + } + public static function SB(): ProjectEmailTemplateLocale + { + if (!isset(self::$SB)) { + self::$SB = new ProjectEmailTemplateLocale('sb'); + } + return self::$SB; + } + public static function SK(): ProjectEmailTemplateLocale + { + if (!isset(self::$SK)) { + self::$SK = new ProjectEmailTemplateLocale('sk'); + } + return self::$SK; + } + public static function SL(): ProjectEmailTemplateLocale + { + if (!isset(self::$SL)) { + self::$SL = new ProjectEmailTemplateLocale('sl'); + } + return self::$SL; + } + public static function SQ(): ProjectEmailTemplateLocale + { + if (!isset(self::$SQ)) { + self::$SQ = new ProjectEmailTemplateLocale('sq'); + } + return self::$SQ; + } + public static function SR(): ProjectEmailTemplateLocale + { + if (!isset(self::$SR)) { + self::$SR = new ProjectEmailTemplateLocale('sr'); + } + return self::$SR; + } + public static function SV(): ProjectEmailTemplateLocale + { + if (!isset(self::$SV)) { + self::$SV = new ProjectEmailTemplateLocale('sv'); + } + return self::$SV; + } + public static function SVFI(): ProjectEmailTemplateLocale + { + if (!isset(self::$SVFI)) { + self::$SVFI = new ProjectEmailTemplateLocale('sv-fi'); + } + return self::$SVFI; + } + public static function TH(): ProjectEmailTemplateLocale + { + if (!isset(self::$TH)) { + self::$TH = new ProjectEmailTemplateLocale('th'); + } + return self::$TH; + } + public static function TN(): ProjectEmailTemplateLocale + { + if (!isset(self::$TN)) { + self::$TN = new ProjectEmailTemplateLocale('tn'); + } + return self::$TN; + } + public static function TR(): ProjectEmailTemplateLocale + { + if (!isset(self::$TR)) { + self::$TR = new ProjectEmailTemplateLocale('tr'); + } + return self::$TR; + } + public static function TS(): ProjectEmailTemplateLocale + { + if (!isset(self::$TS)) { + self::$TS = new ProjectEmailTemplateLocale('ts'); + } + return self::$TS; + } + public static function UA(): ProjectEmailTemplateLocale + { + if (!isset(self::$UA)) { + self::$UA = new ProjectEmailTemplateLocale('ua'); + } + return self::$UA; + } + public static function UR(): ProjectEmailTemplateLocale + { + if (!isset(self::$UR)) { + self::$UR = new ProjectEmailTemplateLocale('ur'); + } + return self::$UR; + } + public static function VE(): ProjectEmailTemplateLocale + { + if (!isset(self::$VE)) { + self::$VE = new ProjectEmailTemplateLocale('ve'); + } + return self::$VE; + } + public static function VI(): ProjectEmailTemplateLocale + { + if (!isset(self::$VI)) { + self::$VI = new ProjectEmailTemplateLocale('vi'); + } + return self::$VI; + } + public static function XH(): ProjectEmailTemplateLocale + { + if (!isset(self::$XH)) { + self::$XH = new ProjectEmailTemplateLocale('xh'); + } + return self::$XH; + } + public static function ZHCN(): ProjectEmailTemplateLocale + { + if (!isset(self::$ZHCN)) { + self::$ZHCN = new ProjectEmailTemplateLocale('zh-cn'); + } + return self::$ZHCN; + } + public static function ZHHK(): ProjectEmailTemplateLocale + { + if (!isset(self::$ZHHK)) { + self::$ZHHK = new ProjectEmailTemplateLocale('zh-hk'); + } + return self::$ZHHK; + } + public static function ZHSG(): ProjectEmailTemplateLocale + { + if (!isset(self::$ZHSG)) { + self::$ZHSG = new ProjectEmailTemplateLocale('zh-sg'); + } + return self::$ZHSG; + } + public static function ZHTW(): ProjectEmailTemplateLocale + { + if (!isset(self::$ZHTW)) { + self::$ZHTW = new ProjectEmailTemplateLocale('zh-tw'); + } + return self::$ZHTW; + } + public static function ZU(): ProjectEmailTemplateLocale + { + if (!isset(self::$ZU)) { + self::$ZU = new ProjectEmailTemplateLocale('zu'); + } + return self::$ZU; + } + + public static function from(string $value): self + { + return match ($value) { + 'af' => self::AF(), + 'ar-ae' => self::ARAE(), + 'ar-bh' => self::ARBH(), + 'ar-dz' => self::ARDZ(), + 'ar-eg' => self::AREG(), + 'ar-iq' => self::ARIQ(), + 'ar-jo' => self::ARJO(), + 'ar-kw' => self::ARKW(), + 'ar-lb' => self::ARLB(), + 'ar-ly' => self::ARLY(), + 'ar-ma' => self::ARMA(), + 'ar-om' => self::AROM(), + 'ar-qa' => self::ARQA(), + 'ar-sa' => self::ARSA(), + 'ar-sy' => self::ARSY(), + 'ar-tn' => self::ARTN(), + 'ar-ye' => self::ARYE(), + 'as' => self::AS(), + 'az' => self::AZ(), + 'be' => self::BE(), + 'bg' => self::BG(), + 'bh' => self::BH(), + 'bn' => self::BN(), + 'bs' => self::BS(), + 'ca' => self::CA(), + 'cs' => self::CS(), + 'cy' => self::CY(), + 'da' => self::DA(), + 'de' => self::DE(), + 'de-at' => self::DEAT(), + 'de-ch' => self::DECH(), + 'de-li' => self::DELI(), + 'de-lu' => self::DELU(), + 'el' => self::EL(), + 'en' => self::EN(), + 'en-au' => self::ENAU(), + 'en-bz' => self::ENBZ(), + 'en-ca' => self::ENCA(), + 'en-gb' => self::ENGB(), + 'en-ie' => self::ENIE(), + 'en-jm' => self::ENJM(), + 'en-nz' => self::ENNZ(), + 'en-tt' => self::ENTT(), + 'en-us' => self::ENUS(), + 'en-za' => self::ENZA(), + 'eo' => self::EO(), + 'es' => self::ES(), + 'es-ar' => self::ESAR(), + 'es-bo' => self::ESBO(), + 'es-cl' => self::ESCL(), + 'es-co' => self::ESCO(), + 'es-cr' => self::ESCR(), + 'es-do' => self::ESDO(), + 'es-ec' => self::ESEC(), + 'es-gt' => self::ESGT(), + 'es-hn' => self::ESHN(), + 'es-mx' => self::ESMX(), + 'es-ni' => self::ESNI(), + 'es-pa' => self::ESPA(), + 'es-pe' => self::ESPE(), + 'es-pr' => self::ESPR(), + 'es-py' => self::ESPY(), + 'es-sv' => self::ESSV(), + 'es-uy' => self::ESUY(), + 'es-ve' => self::ESVE(), + 'et' => self::ET(), + 'eu' => self::EU(), + 'fa' => self::FA(), + 'fi' => self::FI(), + 'fo' => self::FO(), + 'fr' => self::FR(), + 'fr-be' => self::FRBE(), + 'fr-ca' => self::FRCA(), + 'fr-ch' => self::FRCH(), + 'fr-lu' => self::FRLU(), + 'ga' => self::GA(), + 'gd' => self::GD(), + 'he' => self::HE(), + 'hi' => self::HI(), + 'hr' => self::HR(), + 'hu' => self::HU(), + 'id' => self::ID(), + 'is' => self::IS(), + 'it' => self::IT(), + 'it-ch' => self::ITCH(), + 'ja' => self::JA(), + 'ji' => self::JI(), + 'ko' => self::KO(), + 'ku' => self::KU(), + 'lt' => self::LT(), + 'lv' => self::LV(), + 'mk' => self::MK(), + 'ml' => self::ML(), + 'ms' => self::MS(), + 'mt' => self::MT(), + 'nb' => self::NB(), + 'ne' => self::NE(), + 'nl' => self::NL(), + 'nl-be' => self::NLBE(), + 'nn' => self::NN(), + 'no' => self::NO(), + 'pa' => self::PA(), + 'pl' => self::PL(), + 'pt' => self::PT(), + 'pt-br' => self::PTBR(), + 'rm' => self::RM(), + 'ro' => self::RO(), + 'ro-md' => self::ROMD(), + 'ru' => self::RU(), + 'ru-md' => self::RUMD(), + 'sb' => self::SB(), + 'sk' => self::SK(), + 'sl' => self::SL(), + 'sq' => self::SQ(), + 'sr' => self::SR(), + 'sv' => self::SV(), + 'sv-fi' => self::SVFI(), + 'th' => self::TH(), + 'tn' => self::TN(), + 'tr' => self::TR(), + 'ts' => self::TS(), + 'ua' => self::UA(), + 'ur' => self::UR(), + 've' => self::VE(), + 'vi' => self::VI(), + 'xh' => self::XH(), + 'zh-cn' => self::ZHCN(), + 'zh-hk' => self::ZHHK(), + 'zh-sg' => self::ZHSG(), + 'zh-tw' => self::ZHTW(), + 'zu' => self::ZU(), + default => throw new \InvalidArgumentException('Unknown ProjectEmailTemplateLocale value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/ProjectKeyScopes.php b/src/Appwrite/Enums/ProjectKeyScopes.php new file mode 100644 index 0000000..c60216d --- /dev/null +++ b/src/Appwrite/Enums/ProjectKeyScopes.php @@ -0,0 +1,880 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function PROJECTREAD(): ProjectKeyScopes + { + if (!isset(self::$PROJECTREAD)) { + self::$PROJECTREAD = new ProjectKeyScopes('project.read'); + } + return self::$PROJECTREAD; + } + public static function PROJECTWRITE(): ProjectKeyScopes + { + if (!isset(self::$PROJECTWRITE)) { + self::$PROJECTWRITE = new ProjectKeyScopes('project.write'); + } + return self::$PROJECTWRITE; + } + public static function KEYSREAD(): ProjectKeyScopes + { + if (!isset(self::$KEYSREAD)) { + self::$KEYSREAD = new ProjectKeyScopes('keys.read'); + } + return self::$KEYSREAD; + } + public static function KEYSWRITE(): ProjectKeyScopes + { + if (!isset(self::$KEYSWRITE)) { + self::$KEYSWRITE = new ProjectKeyScopes('keys.write'); + } + return self::$KEYSWRITE; + } + public static function PLATFORMSREAD(): ProjectKeyScopes + { + if (!isset(self::$PLATFORMSREAD)) { + self::$PLATFORMSREAD = new ProjectKeyScopes('platforms.read'); + } + return self::$PLATFORMSREAD; + } + public static function PLATFORMSWRITE(): ProjectKeyScopes + { + if (!isset(self::$PLATFORMSWRITE)) { + self::$PLATFORMSWRITE = new ProjectKeyScopes('platforms.write'); + } + return self::$PLATFORMSWRITE; + } + public static function MOCKSREAD(): ProjectKeyScopes + { + if (!isset(self::$MOCKSREAD)) { + self::$MOCKSREAD = new ProjectKeyScopes('mocks.read'); + } + return self::$MOCKSREAD; + } + public static function MOCKSWRITE(): ProjectKeyScopes + { + if (!isset(self::$MOCKSWRITE)) { + self::$MOCKSWRITE = new ProjectKeyScopes('mocks.write'); + } + return self::$MOCKSWRITE; + } + public static function POLICIESREAD(): ProjectKeyScopes + { + if (!isset(self::$POLICIESREAD)) { + self::$POLICIESREAD = new ProjectKeyScopes('policies.read'); + } + return self::$POLICIESREAD; + } + public static function POLICIESWRITE(): ProjectKeyScopes + { + if (!isset(self::$POLICIESWRITE)) { + self::$POLICIESWRITE = new ProjectKeyScopes('policies.write'); + } + return self::$POLICIESWRITE; + } + public static function PROJECTPOLICIESREAD(): ProjectKeyScopes + { + if (!isset(self::$PROJECTPOLICIESREAD)) { + self::$PROJECTPOLICIESREAD = new ProjectKeyScopes('project.policies.read'); + } + return self::$PROJECTPOLICIESREAD; + } + public static function PROJECTPOLICIESWRITE(): ProjectKeyScopes + { + if (!isset(self::$PROJECTPOLICIESWRITE)) { + self::$PROJECTPOLICIESWRITE = new ProjectKeyScopes('project.policies.write'); + } + return self::$PROJECTPOLICIESWRITE; + } + public static function TEMPLATESREAD(): ProjectKeyScopes + { + if (!isset(self::$TEMPLATESREAD)) { + self::$TEMPLATESREAD = new ProjectKeyScopes('templates.read'); + } + return self::$TEMPLATESREAD; + } + public static function TEMPLATESWRITE(): ProjectKeyScopes + { + if (!isset(self::$TEMPLATESWRITE)) { + self::$TEMPLATESWRITE = new ProjectKeyScopes('templates.write'); + } + return self::$TEMPLATESWRITE; + } + public static function OAUTH2READ(): ProjectKeyScopes + { + if (!isset(self::$OAUTH2READ)) { + self::$OAUTH2READ = new ProjectKeyScopes('oauth2.read'); + } + return self::$OAUTH2READ; + } + public static function OAUTH2WRITE(): ProjectKeyScopes + { + if (!isset(self::$OAUTH2WRITE)) { + self::$OAUTH2WRITE = new ProjectKeyScopes('oauth2.write'); + } + return self::$OAUTH2WRITE; + } + public static function USERSREAD(): ProjectKeyScopes + { + if (!isset(self::$USERSREAD)) { + self::$USERSREAD = new ProjectKeyScopes('users.read'); + } + return self::$USERSREAD; + } + public static function USERSWRITE(): ProjectKeyScopes + { + if (!isset(self::$USERSWRITE)) { + self::$USERSWRITE = new ProjectKeyScopes('users.write'); + } + return self::$USERSWRITE; + } + public static function SESSIONSREAD(): ProjectKeyScopes + { + if (!isset(self::$SESSIONSREAD)) { + self::$SESSIONSREAD = new ProjectKeyScopes('sessions.read'); + } + return self::$SESSIONSREAD; + } + public static function SESSIONSWRITE(): ProjectKeyScopes + { + if (!isset(self::$SESSIONSWRITE)) { + self::$SESSIONSWRITE = new ProjectKeyScopes('sessions.write'); + } + return self::$SESSIONSWRITE; + } + public static function TEAMSREAD(): ProjectKeyScopes + { + if (!isset(self::$TEAMSREAD)) { + self::$TEAMSREAD = new ProjectKeyScopes('teams.read'); + } + return self::$TEAMSREAD; + } + public static function TEAMSWRITE(): ProjectKeyScopes + { + if (!isset(self::$TEAMSWRITE)) { + self::$TEAMSWRITE = new ProjectKeyScopes('teams.write'); + } + return self::$TEAMSWRITE; + } + public static function DATABASESREAD(): ProjectKeyScopes + { + if (!isset(self::$DATABASESREAD)) { + self::$DATABASESREAD = new ProjectKeyScopes('databases.read'); + } + return self::$DATABASESREAD; + } + public static function DATABASESWRITE(): ProjectKeyScopes + { + if (!isset(self::$DATABASESWRITE)) { + self::$DATABASESWRITE = new ProjectKeyScopes('databases.write'); + } + return self::$DATABASESWRITE; + } + public static function TABLESREAD(): ProjectKeyScopes + { + if (!isset(self::$TABLESREAD)) { + self::$TABLESREAD = new ProjectKeyScopes('tables.read'); + } + return self::$TABLESREAD; + } + public static function TABLESWRITE(): ProjectKeyScopes + { + if (!isset(self::$TABLESWRITE)) { + self::$TABLESWRITE = new ProjectKeyScopes('tables.write'); + } + return self::$TABLESWRITE; + } + public static function COLUMNSREAD(): ProjectKeyScopes + { + if (!isset(self::$COLUMNSREAD)) { + self::$COLUMNSREAD = new ProjectKeyScopes('columns.read'); + } + return self::$COLUMNSREAD; + } + public static function COLUMNSWRITE(): ProjectKeyScopes + { + if (!isset(self::$COLUMNSWRITE)) { + self::$COLUMNSWRITE = new ProjectKeyScopes('columns.write'); + } + return self::$COLUMNSWRITE; + } + public static function INDEXESREAD(): ProjectKeyScopes + { + if (!isset(self::$INDEXESREAD)) { + self::$INDEXESREAD = new ProjectKeyScopes('indexes.read'); + } + return self::$INDEXESREAD; + } + public static function INDEXESWRITE(): ProjectKeyScopes + { + if (!isset(self::$INDEXESWRITE)) { + self::$INDEXESWRITE = new ProjectKeyScopes('indexes.write'); + } + return self::$INDEXESWRITE; + } + public static function ROWSREAD(): ProjectKeyScopes + { + if (!isset(self::$ROWSREAD)) { + self::$ROWSREAD = new ProjectKeyScopes('rows.read'); + } + return self::$ROWSREAD; + } + public static function ROWSWRITE(): ProjectKeyScopes + { + if (!isset(self::$ROWSWRITE)) { + self::$ROWSWRITE = new ProjectKeyScopes('rows.write'); + } + return self::$ROWSWRITE; + } + public static function COLLECTIONSREAD(): ProjectKeyScopes + { + if (!isset(self::$COLLECTIONSREAD)) { + self::$COLLECTIONSREAD = new ProjectKeyScopes('collections.read'); + } + return self::$COLLECTIONSREAD; + } + public static function COLLECTIONSWRITE(): ProjectKeyScopes + { + if (!isset(self::$COLLECTIONSWRITE)) { + self::$COLLECTIONSWRITE = new ProjectKeyScopes('collections.write'); + } + return self::$COLLECTIONSWRITE; + } + public static function ATTRIBUTESREAD(): ProjectKeyScopes + { + if (!isset(self::$ATTRIBUTESREAD)) { + self::$ATTRIBUTESREAD = new ProjectKeyScopes('attributes.read'); + } + return self::$ATTRIBUTESREAD; + } + public static function ATTRIBUTESWRITE(): ProjectKeyScopes + { + if (!isset(self::$ATTRIBUTESWRITE)) { + self::$ATTRIBUTESWRITE = new ProjectKeyScopes('attributes.write'); + } + return self::$ATTRIBUTESWRITE; + } + public static function DOCUMENTSREAD(): ProjectKeyScopes + { + if (!isset(self::$DOCUMENTSREAD)) { + self::$DOCUMENTSREAD = new ProjectKeyScopes('documents.read'); + } + return self::$DOCUMENTSREAD; + } + public static function DOCUMENTSWRITE(): ProjectKeyScopes + { + if (!isset(self::$DOCUMENTSWRITE)) { + self::$DOCUMENTSWRITE = new ProjectKeyScopes('documents.write'); + } + return self::$DOCUMENTSWRITE; + } + public static function BUCKETSREAD(): ProjectKeyScopes + { + if (!isset(self::$BUCKETSREAD)) { + self::$BUCKETSREAD = new ProjectKeyScopes('buckets.read'); + } + return self::$BUCKETSREAD; + } + public static function BUCKETSWRITE(): ProjectKeyScopes + { + if (!isset(self::$BUCKETSWRITE)) { + self::$BUCKETSWRITE = new ProjectKeyScopes('buckets.write'); + } + return self::$BUCKETSWRITE; + } + public static function FILESREAD(): ProjectKeyScopes + { + if (!isset(self::$FILESREAD)) { + self::$FILESREAD = new ProjectKeyScopes('files.read'); + } + return self::$FILESREAD; + } + public static function FILESWRITE(): ProjectKeyScopes + { + if (!isset(self::$FILESWRITE)) { + self::$FILESWRITE = new ProjectKeyScopes('files.write'); + } + return self::$FILESWRITE; + } + public static function TOKENSREAD(): ProjectKeyScopes + { + if (!isset(self::$TOKENSREAD)) { + self::$TOKENSREAD = new ProjectKeyScopes('tokens.read'); + } + return self::$TOKENSREAD; + } + public static function TOKENSWRITE(): ProjectKeyScopes + { + if (!isset(self::$TOKENSWRITE)) { + self::$TOKENSWRITE = new ProjectKeyScopes('tokens.write'); + } + return self::$TOKENSWRITE; + } + public static function FUNCTIONSREAD(): ProjectKeyScopes + { + if (!isset(self::$FUNCTIONSREAD)) { + self::$FUNCTIONSREAD = new ProjectKeyScopes('functions.read'); + } + return self::$FUNCTIONSREAD; + } + public static function FUNCTIONSWRITE(): ProjectKeyScopes + { + if (!isset(self::$FUNCTIONSWRITE)) { + self::$FUNCTIONSWRITE = new ProjectKeyScopes('functions.write'); + } + return self::$FUNCTIONSWRITE; + } + public static function EXECUTIONSREAD(): ProjectKeyScopes + { + if (!isset(self::$EXECUTIONSREAD)) { + self::$EXECUTIONSREAD = new ProjectKeyScopes('executions.read'); + } + return self::$EXECUTIONSREAD; + } + public static function EXECUTIONSWRITE(): ProjectKeyScopes + { + if (!isset(self::$EXECUTIONSWRITE)) { + self::$EXECUTIONSWRITE = new ProjectKeyScopes('executions.write'); + } + return self::$EXECUTIONSWRITE; + } + public static function EXECUTIONREAD(): ProjectKeyScopes + { + if (!isset(self::$EXECUTIONREAD)) { + self::$EXECUTIONREAD = new ProjectKeyScopes('execution.read'); + } + return self::$EXECUTIONREAD; + } + public static function EXECUTIONWRITE(): ProjectKeyScopes + { + if (!isset(self::$EXECUTIONWRITE)) { + self::$EXECUTIONWRITE = new ProjectKeyScopes('execution.write'); + } + return self::$EXECUTIONWRITE; + } + public static function SITESREAD(): ProjectKeyScopes + { + if (!isset(self::$SITESREAD)) { + self::$SITESREAD = new ProjectKeyScopes('sites.read'); + } + return self::$SITESREAD; + } + public static function SITESWRITE(): ProjectKeyScopes + { + if (!isset(self::$SITESWRITE)) { + self::$SITESWRITE = new ProjectKeyScopes('sites.write'); + } + return self::$SITESWRITE; + } + public static function LOGREAD(): ProjectKeyScopes + { + if (!isset(self::$LOGREAD)) { + self::$LOGREAD = new ProjectKeyScopes('log.read'); + } + return self::$LOGREAD; + } + public static function LOGWRITE(): ProjectKeyScopes + { + if (!isset(self::$LOGWRITE)) { + self::$LOGWRITE = new ProjectKeyScopes('log.write'); + } + return self::$LOGWRITE; + } + public static function PROVIDERSREAD(): ProjectKeyScopes + { + if (!isset(self::$PROVIDERSREAD)) { + self::$PROVIDERSREAD = new ProjectKeyScopes('providers.read'); + } + return self::$PROVIDERSREAD; + } + public static function PROVIDERSWRITE(): ProjectKeyScopes + { + if (!isset(self::$PROVIDERSWRITE)) { + self::$PROVIDERSWRITE = new ProjectKeyScopes('providers.write'); + } + return self::$PROVIDERSWRITE; + } + public static function TOPICSREAD(): ProjectKeyScopes + { + if (!isset(self::$TOPICSREAD)) { + self::$TOPICSREAD = new ProjectKeyScopes('topics.read'); + } + return self::$TOPICSREAD; + } + public static function TOPICSWRITE(): ProjectKeyScopes + { + if (!isset(self::$TOPICSWRITE)) { + self::$TOPICSWRITE = new ProjectKeyScopes('topics.write'); + } + return self::$TOPICSWRITE; + } + public static function SUBSCRIBERSREAD(): ProjectKeyScopes + { + if (!isset(self::$SUBSCRIBERSREAD)) { + self::$SUBSCRIBERSREAD = new ProjectKeyScopes('subscribers.read'); + } + return self::$SUBSCRIBERSREAD; + } + public static function SUBSCRIBERSWRITE(): ProjectKeyScopes + { + if (!isset(self::$SUBSCRIBERSWRITE)) { + self::$SUBSCRIBERSWRITE = new ProjectKeyScopes('subscribers.write'); + } + return self::$SUBSCRIBERSWRITE; + } + public static function TARGETSREAD(): ProjectKeyScopes + { + if (!isset(self::$TARGETSREAD)) { + self::$TARGETSREAD = new ProjectKeyScopes('targets.read'); + } + return self::$TARGETSREAD; + } + public static function TARGETSWRITE(): ProjectKeyScopes + { + if (!isset(self::$TARGETSWRITE)) { + self::$TARGETSWRITE = new ProjectKeyScopes('targets.write'); + } + return self::$TARGETSWRITE; + } + public static function MESSAGESREAD(): ProjectKeyScopes + { + if (!isset(self::$MESSAGESREAD)) { + self::$MESSAGESREAD = new ProjectKeyScopes('messages.read'); + } + return self::$MESSAGESREAD; + } + public static function MESSAGESWRITE(): ProjectKeyScopes + { + if (!isset(self::$MESSAGESWRITE)) { + self::$MESSAGESWRITE = new ProjectKeyScopes('messages.write'); + } + return self::$MESSAGESWRITE; + } + public static function RULESREAD(): ProjectKeyScopes + { + if (!isset(self::$RULESREAD)) { + self::$RULESREAD = new ProjectKeyScopes('rules.read'); + } + return self::$RULESREAD; + } + public static function RULESWRITE(): ProjectKeyScopes + { + if (!isset(self::$RULESWRITE)) { + self::$RULESWRITE = new ProjectKeyScopes('rules.write'); + } + return self::$RULESWRITE; + } + public static function WEBHOOKSREAD(): ProjectKeyScopes + { + if (!isset(self::$WEBHOOKSREAD)) { + self::$WEBHOOKSREAD = new ProjectKeyScopes('webhooks.read'); + } + return self::$WEBHOOKSREAD; + } + public static function WEBHOOKSWRITE(): ProjectKeyScopes + { + if (!isset(self::$WEBHOOKSWRITE)) { + self::$WEBHOOKSWRITE = new ProjectKeyScopes('webhooks.write'); + } + return self::$WEBHOOKSWRITE; + } + public static function LOCALEREAD(): ProjectKeyScopes + { + if (!isset(self::$LOCALEREAD)) { + self::$LOCALEREAD = new ProjectKeyScopes('locale.read'); + } + return self::$LOCALEREAD; + } + public static function AVATARSREAD(): ProjectKeyScopes + { + if (!isset(self::$AVATARSREAD)) { + self::$AVATARSREAD = new ProjectKeyScopes('avatars.read'); + } + return self::$AVATARSREAD; + } + public static function HEALTHREAD(): ProjectKeyScopes + { + if (!isset(self::$HEALTHREAD)) { + self::$HEALTHREAD = new ProjectKeyScopes('health.read'); + } + return self::$HEALTHREAD; + } + public static function ASSISTANTREAD(): ProjectKeyScopes + { + if (!isset(self::$ASSISTANTREAD)) { + self::$ASSISTANTREAD = new ProjectKeyScopes('assistant.read'); + } + return self::$ASSISTANTREAD; + } + public static function MIGRATIONSREAD(): ProjectKeyScopes + { + if (!isset(self::$MIGRATIONSREAD)) { + self::$MIGRATIONSREAD = new ProjectKeyScopes('migrations.read'); + } + return self::$MIGRATIONSREAD; + } + public static function MIGRATIONSWRITE(): ProjectKeyScopes + { + if (!isset(self::$MIGRATIONSWRITE)) { + self::$MIGRATIONSWRITE = new ProjectKeyScopes('migrations.write'); + } + return self::$MIGRATIONSWRITE; + } + public static function SCHEDULESREAD(): ProjectKeyScopes + { + if (!isset(self::$SCHEDULESREAD)) { + self::$SCHEDULESREAD = new ProjectKeyScopes('schedules.read'); + } + return self::$SCHEDULESREAD; + } + public static function SCHEDULESWRITE(): ProjectKeyScopes + { + if (!isset(self::$SCHEDULESWRITE)) { + self::$SCHEDULESWRITE = new ProjectKeyScopes('schedules.write'); + } + return self::$SCHEDULESWRITE; + } + public static function VCSREAD(): ProjectKeyScopes + { + if (!isset(self::$VCSREAD)) { + self::$VCSREAD = new ProjectKeyScopes('vcs.read'); + } + return self::$VCSREAD; + } + public static function VCSWRITE(): ProjectKeyScopes + { + if (!isset(self::$VCSWRITE)) { + self::$VCSWRITE = new ProjectKeyScopes('vcs.write'); + } + return self::$VCSWRITE; + } + public static function INSIGHTSREAD(): ProjectKeyScopes + { + if (!isset(self::$INSIGHTSREAD)) { + self::$INSIGHTSREAD = new ProjectKeyScopes('insights.read'); + } + return self::$INSIGHTSREAD; + } + public static function INSIGHTSWRITE(): ProjectKeyScopes + { + if (!isset(self::$INSIGHTSWRITE)) { + self::$INSIGHTSWRITE = new ProjectKeyScopes('insights.write'); + } + return self::$INSIGHTSWRITE; + } + public static function REPORTSREAD(): ProjectKeyScopes + { + if (!isset(self::$REPORTSREAD)) { + self::$REPORTSREAD = new ProjectKeyScopes('reports.read'); + } + return self::$REPORTSREAD; + } + public static function REPORTSWRITE(): ProjectKeyScopes + { + if (!isset(self::$REPORTSWRITE)) { + self::$REPORTSWRITE = new ProjectKeyScopes('reports.write'); + } + return self::$REPORTSWRITE; + } + public static function PRESENCESREAD(): ProjectKeyScopes + { + if (!isset(self::$PRESENCESREAD)) { + self::$PRESENCESREAD = new ProjectKeyScopes('presences.read'); + } + return self::$PRESENCESREAD; + } + public static function PRESENCESWRITE(): ProjectKeyScopes + { + if (!isset(self::$PRESENCESWRITE)) { + self::$PRESENCESWRITE = new ProjectKeyScopes('presences.write'); + } + return self::$PRESENCESWRITE; + } + public static function BACKUPSPOLICIESREAD(): ProjectKeyScopes + { + if (!isset(self::$BACKUPSPOLICIESREAD)) { + self::$BACKUPSPOLICIESREAD = new ProjectKeyScopes('backups.policies.read'); + } + return self::$BACKUPSPOLICIESREAD; + } + public static function BACKUPSPOLICIESWRITE(): ProjectKeyScopes + { + if (!isset(self::$BACKUPSPOLICIESWRITE)) { + self::$BACKUPSPOLICIESWRITE = new ProjectKeyScopes('backups.policies.write'); + } + return self::$BACKUPSPOLICIESWRITE; + } + public static function ARCHIVESREAD(): ProjectKeyScopes + { + if (!isset(self::$ARCHIVESREAD)) { + self::$ARCHIVESREAD = new ProjectKeyScopes('archives.read'); + } + return self::$ARCHIVESREAD; + } + public static function ARCHIVESWRITE(): ProjectKeyScopes + { + if (!isset(self::$ARCHIVESWRITE)) { + self::$ARCHIVESWRITE = new ProjectKeyScopes('archives.write'); + } + return self::$ARCHIVESWRITE; + } + public static function RESTORATIONSREAD(): ProjectKeyScopes + { + if (!isset(self::$RESTORATIONSREAD)) { + self::$RESTORATIONSREAD = new ProjectKeyScopes('restorations.read'); + } + return self::$RESTORATIONSREAD; + } + public static function RESTORATIONSWRITE(): ProjectKeyScopes + { + if (!isset(self::$RESTORATIONSWRITE)) { + self::$RESTORATIONSWRITE = new ProjectKeyScopes('restorations.write'); + } + return self::$RESTORATIONSWRITE; + } + public static function DOMAINSREAD(): ProjectKeyScopes + { + if (!isset(self::$DOMAINSREAD)) { + self::$DOMAINSREAD = new ProjectKeyScopes('domains.read'); + } + return self::$DOMAINSREAD; + } + public static function DOMAINSWRITE(): ProjectKeyScopes + { + if (!isset(self::$DOMAINSWRITE)) { + self::$DOMAINSWRITE = new ProjectKeyScopes('domains.write'); + } + return self::$DOMAINSWRITE; + } + public static function EVENTSREAD(): ProjectKeyScopes + { + if (!isset(self::$EVENTSREAD)) { + self::$EVENTSREAD = new ProjectKeyScopes('events.read'); + } + return self::$EVENTSREAD; + } + public static function USAGEREAD(): ProjectKeyScopes + { + if (!isset(self::$USAGEREAD)) { + self::$USAGEREAD = new ProjectKeyScopes('usage.read'); + } + return self::$USAGEREAD; + } + + public static function from(string $value): self + { + return match ($value) { + 'project.read' => self::PROJECTREAD(), + 'project.write' => self::PROJECTWRITE(), + 'keys.read' => self::KEYSREAD(), + 'keys.write' => self::KEYSWRITE(), + 'platforms.read' => self::PLATFORMSREAD(), + 'platforms.write' => self::PLATFORMSWRITE(), + 'mocks.read' => self::MOCKSREAD(), + 'mocks.write' => self::MOCKSWRITE(), + 'policies.read' => self::POLICIESREAD(), + 'policies.write' => self::POLICIESWRITE(), + 'project.policies.read' => self::PROJECTPOLICIESREAD(), + 'project.policies.write' => self::PROJECTPOLICIESWRITE(), + 'templates.read' => self::TEMPLATESREAD(), + 'templates.write' => self::TEMPLATESWRITE(), + 'oauth2.read' => self::OAUTH2READ(), + 'oauth2.write' => self::OAUTH2WRITE(), + 'users.read' => self::USERSREAD(), + 'users.write' => self::USERSWRITE(), + 'sessions.read' => self::SESSIONSREAD(), + 'sessions.write' => self::SESSIONSWRITE(), + 'teams.read' => self::TEAMSREAD(), + 'teams.write' => self::TEAMSWRITE(), + 'databases.read' => self::DATABASESREAD(), + 'databases.write' => self::DATABASESWRITE(), + 'tables.read' => self::TABLESREAD(), + 'tables.write' => self::TABLESWRITE(), + 'columns.read' => self::COLUMNSREAD(), + 'columns.write' => self::COLUMNSWRITE(), + 'indexes.read' => self::INDEXESREAD(), + 'indexes.write' => self::INDEXESWRITE(), + 'rows.read' => self::ROWSREAD(), + 'rows.write' => self::ROWSWRITE(), + 'collections.read' => self::COLLECTIONSREAD(), + 'collections.write' => self::COLLECTIONSWRITE(), + 'attributes.read' => self::ATTRIBUTESREAD(), + 'attributes.write' => self::ATTRIBUTESWRITE(), + 'documents.read' => self::DOCUMENTSREAD(), + 'documents.write' => self::DOCUMENTSWRITE(), + 'buckets.read' => self::BUCKETSREAD(), + 'buckets.write' => self::BUCKETSWRITE(), + 'files.read' => self::FILESREAD(), + 'files.write' => self::FILESWRITE(), + 'tokens.read' => self::TOKENSREAD(), + 'tokens.write' => self::TOKENSWRITE(), + 'functions.read' => self::FUNCTIONSREAD(), + 'functions.write' => self::FUNCTIONSWRITE(), + 'executions.read' => self::EXECUTIONSREAD(), + 'executions.write' => self::EXECUTIONSWRITE(), + 'execution.read' => self::EXECUTIONREAD(), + 'execution.write' => self::EXECUTIONWRITE(), + 'sites.read' => self::SITESREAD(), + 'sites.write' => self::SITESWRITE(), + 'log.read' => self::LOGREAD(), + 'log.write' => self::LOGWRITE(), + 'providers.read' => self::PROVIDERSREAD(), + 'providers.write' => self::PROVIDERSWRITE(), + 'topics.read' => self::TOPICSREAD(), + 'topics.write' => self::TOPICSWRITE(), + 'subscribers.read' => self::SUBSCRIBERSREAD(), + 'subscribers.write' => self::SUBSCRIBERSWRITE(), + 'targets.read' => self::TARGETSREAD(), + 'targets.write' => self::TARGETSWRITE(), + 'messages.read' => self::MESSAGESREAD(), + 'messages.write' => self::MESSAGESWRITE(), + 'rules.read' => self::RULESREAD(), + 'rules.write' => self::RULESWRITE(), + 'webhooks.read' => self::WEBHOOKSREAD(), + 'webhooks.write' => self::WEBHOOKSWRITE(), + 'locale.read' => self::LOCALEREAD(), + 'avatars.read' => self::AVATARSREAD(), + 'health.read' => self::HEALTHREAD(), + 'assistant.read' => self::ASSISTANTREAD(), + 'migrations.read' => self::MIGRATIONSREAD(), + 'migrations.write' => self::MIGRATIONSWRITE(), + 'schedules.read' => self::SCHEDULESREAD(), + 'schedules.write' => self::SCHEDULESWRITE(), + 'vcs.read' => self::VCSREAD(), + 'vcs.write' => self::VCSWRITE(), + 'insights.read' => self::INSIGHTSREAD(), + 'insights.write' => self::INSIGHTSWRITE(), + 'reports.read' => self::REPORTSREAD(), + 'reports.write' => self::REPORTSWRITE(), + 'presences.read' => self::PRESENCESREAD(), + 'presences.write' => self::PRESENCESWRITE(), + 'backups.policies.read' => self::BACKUPSPOLICIESREAD(), + 'backups.policies.write' => self::BACKUPSPOLICIESWRITE(), + 'archives.read' => self::ARCHIVESREAD(), + 'archives.write' => self::ARCHIVESWRITE(), + 'restorations.read' => self::RESTORATIONSREAD(), + 'restorations.write' => self::RESTORATIONSWRITE(), + 'domains.read' => self::DOMAINSREAD(), + 'domains.write' => self::DOMAINSWRITE(), + 'events.read' => self::EVENTSREAD(), + 'usage.read' => self::USAGEREAD(), + default => throw new \InvalidArgumentException('Unknown ProjectKeyScopes value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/ProjectOAuth2GooglePrompt.php b/src/Appwrite/Enums/ProjectOAuth2GooglePrompt.php new file mode 100644 index 0000000..d9e8349 --- /dev/null +++ b/src/Appwrite/Enums/ProjectOAuth2GooglePrompt.php @@ -0,0 +1,61 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function NONE(): ProjectOAuth2GooglePrompt + { + if (!isset(self::$NONE)) { + self::$NONE = new ProjectOAuth2GooglePrompt('none'); + } + return self::$NONE; + } + public static function CONSENT(): ProjectOAuth2GooglePrompt + { + if (!isset(self::$CONSENT)) { + self::$CONSENT = new ProjectOAuth2GooglePrompt('consent'); + } + return self::$CONSENT; + } + public static function SELECTACCOUNT(): ProjectOAuth2GooglePrompt + { + if (!isset(self::$SELECTACCOUNT)) { + self::$SELECTACCOUNT = new ProjectOAuth2GooglePrompt('select_account'); + } + return self::$SELECTACCOUNT; + } + + public static function from(string $value): self + { + return match ($value) { + 'none' => self::NONE(), + 'consent' => self::CONSENT(), + 'select_account' => self::SELECTACCOUNT(), + default => throw new \InvalidArgumentException('Unknown ProjectOAuth2GooglePrompt value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/ProjectOAuthProviderId.php b/src/Appwrite/Enums/ProjectOAuthProviderId.php new file mode 100644 index 0000000..206ed4b --- /dev/null +++ b/src/Appwrite/Enums/ProjectOAuthProviderId.php @@ -0,0 +1,439 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function AMAZON(): ProjectOAuthProviderId + { + if (!isset(self::$AMAZON)) { + self::$AMAZON = new ProjectOAuthProviderId('amazon'); + } + return self::$AMAZON; + } + public static function APPLE(): ProjectOAuthProviderId + { + if (!isset(self::$APPLE)) { + self::$APPLE = new ProjectOAuthProviderId('apple'); + } + return self::$APPLE; + } + public static function AUTH0(): ProjectOAuthProviderId + { + if (!isset(self::$AUTH0)) { + self::$AUTH0 = new ProjectOAuthProviderId('auth0'); + } + return self::$AUTH0; + } + public static function AUTHENTIK(): ProjectOAuthProviderId + { + if (!isset(self::$AUTHENTIK)) { + self::$AUTHENTIK = new ProjectOAuthProviderId('authentik'); + } + return self::$AUTHENTIK; + } + public static function AUTODESK(): ProjectOAuthProviderId + { + if (!isset(self::$AUTODESK)) { + self::$AUTODESK = new ProjectOAuthProviderId('autodesk'); + } + return self::$AUTODESK; + } + public static function BITBUCKET(): ProjectOAuthProviderId + { + if (!isset(self::$BITBUCKET)) { + self::$BITBUCKET = new ProjectOAuthProviderId('bitbucket'); + } + return self::$BITBUCKET; + } + public static function BITLY(): ProjectOAuthProviderId + { + if (!isset(self::$BITLY)) { + self::$BITLY = new ProjectOAuthProviderId('bitly'); + } + return self::$BITLY; + } + public static function BOX(): ProjectOAuthProviderId + { + if (!isset(self::$BOX)) { + self::$BOX = new ProjectOAuthProviderId('box'); + } + return self::$BOX; + } + public static function DAILYMOTION(): ProjectOAuthProviderId + { + if (!isset(self::$DAILYMOTION)) { + self::$DAILYMOTION = new ProjectOAuthProviderId('dailymotion'); + } + return self::$DAILYMOTION; + } + public static function DISCORD(): ProjectOAuthProviderId + { + if (!isset(self::$DISCORD)) { + self::$DISCORD = new ProjectOAuthProviderId('discord'); + } + return self::$DISCORD; + } + public static function DISQUS(): ProjectOAuthProviderId + { + if (!isset(self::$DISQUS)) { + self::$DISQUS = new ProjectOAuthProviderId('disqus'); + } + return self::$DISQUS; + } + public static function DROPBOX(): ProjectOAuthProviderId + { + if (!isset(self::$DROPBOX)) { + self::$DROPBOX = new ProjectOAuthProviderId('dropbox'); + } + return self::$DROPBOX; + } + public static function ETSY(): ProjectOAuthProviderId + { + if (!isset(self::$ETSY)) { + self::$ETSY = new ProjectOAuthProviderId('etsy'); + } + return self::$ETSY; + } + public static function FACEBOOK(): ProjectOAuthProviderId + { + if (!isset(self::$FACEBOOK)) { + self::$FACEBOOK = new ProjectOAuthProviderId('facebook'); + } + return self::$FACEBOOK; + } + public static function FIGMA(): ProjectOAuthProviderId + { + if (!isset(self::$FIGMA)) { + self::$FIGMA = new ProjectOAuthProviderId('figma'); + } + return self::$FIGMA; + } + public static function FUSIONAUTH(): ProjectOAuthProviderId + { + if (!isset(self::$FUSIONAUTH)) { + self::$FUSIONAUTH = new ProjectOAuthProviderId('fusionauth'); + } + return self::$FUSIONAUTH; + } + public static function GITHUB(): ProjectOAuthProviderId + { + if (!isset(self::$GITHUB)) { + self::$GITHUB = new ProjectOAuthProviderId('github'); + } + return self::$GITHUB; + } + public static function GITLAB(): ProjectOAuthProviderId + { + if (!isset(self::$GITLAB)) { + self::$GITLAB = new ProjectOAuthProviderId('gitlab'); + } + return self::$GITLAB; + } + public static function GOOGLE(): ProjectOAuthProviderId + { + if (!isset(self::$GOOGLE)) { + self::$GOOGLE = new ProjectOAuthProviderId('google'); + } + return self::$GOOGLE; + } + public static function KEYCLOAK(): ProjectOAuthProviderId + { + if (!isset(self::$KEYCLOAK)) { + self::$KEYCLOAK = new ProjectOAuthProviderId('keycloak'); + } + return self::$KEYCLOAK; + } + public static function KICK(): ProjectOAuthProviderId + { + if (!isset(self::$KICK)) { + self::$KICK = new ProjectOAuthProviderId('kick'); + } + return self::$KICK; + } + public static function LINKEDIN(): ProjectOAuthProviderId + { + if (!isset(self::$LINKEDIN)) { + self::$LINKEDIN = new ProjectOAuthProviderId('linkedin'); + } + return self::$LINKEDIN; + } + public static function MICROSOFT(): ProjectOAuthProviderId + { + if (!isset(self::$MICROSOFT)) { + self::$MICROSOFT = new ProjectOAuthProviderId('microsoft'); + } + return self::$MICROSOFT; + } + public static function NOTION(): ProjectOAuthProviderId + { + if (!isset(self::$NOTION)) { + self::$NOTION = new ProjectOAuthProviderId('notion'); + } + return self::$NOTION; + } + public static function OIDC(): ProjectOAuthProviderId + { + if (!isset(self::$OIDC)) { + self::$OIDC = new ProjectOAuthProviderId('oidc'); + } + return self::$OIDC; + } + public static function OKTA(): ProjectOAuthProviderId + { + if (!isset(self::$OKTA)) { + self::$OKTA = new ProjectOAuthProviderId('okta'); + } + return self::$OKTA; + } + public static function PAYPAL(): ProjectOAuthProviderId + { + if (!isset(self::$PAYPAL)) { + self::$PAYPAL = new ProjectOAuthProviderId('paypal'); + } + return self::$PAYPAL; + } + public static function PAYPALSANDBOX(): ProjectOAuthProviderId + { + if (!isset(self::$PAYPALSANDBOX)) { + self::$PAYPALSANDBOX = new ProjectOAuthProviderId('paypalSandbox'); + } + return self::$PAYPALSANDBOX; + } + public static function PODIO(): ProjectOAuthProviderId + { + if (!isset(self::$PODIO)) { + self::$PODIO = new ProjectOAuthProviderId('podio'); + } + return self::$PODIO; + } + public static function SALESFORCE(): ProjectOAuthProviderId + { + if (!isset(self::$SALESFORCE)) { + self::$SALESFORCE = new ProjectOAuthProviderId('salesforce'); + } + return self::$SALESFORCE; + } + public static function SLACK(): ProjectOAuthProviderId + { + if (!isset(self::$SLACK)) { + self::$SLACK = new ProjectOAuthProviderId('slack'); + } + return self::$SLACK; + } + public static function SPOTIFY(): ProjectOAuthProviderId + { + if (!isset(self::$SPOTIFY)) { + self::$SPOTIFY = new ProjectOAuthProviderId('spotify'); + } + return self::$SPOTIFY; + } + public static function STRIPE(): ProjectOAuthProviderId + { + if (!isset(self::$STRIPE)) { + self::$STRIPE = new ProjectOAuthProviderId('stripe'); + } + return self::$STRIPE; + } + public static function TRADESHIFT(): ProjectOAuthProviderId + { + if (!isset(self::$TRADESHIFT)) { + self::$TRADESHIFT = new ProjectOAuthProviderId('tradeshift'); + } + return self::$TRADESHIFT; + } + public static function TRADESHIFTBOX(): ProjectOAuthProviderId + { + if (!isset(self::$TRADESHIFTBOX)) { + self::$TRADESHIFTBOX = new ProjectOAuthProviderId('tradeshiftBox'); + } + return self::$TRADESHIFTBOX; + } + public static function TWITCH(): ProjectOAuthProviderId + { + if (!isset(self::$TWITCH)) { + self::$TWITCH = new ProjectOAuthProviderId('twitch'); + } + return self::$TWITCH; + } + public static function WORDPRESS(): ProjectOAuthProviderId + { + if (!isset(self::$WORDPRESS)) { + self::$WORDPRESS = new ProjectOAuthProviderId('wordpress'); + } + return self::$WORDPRESS; + } + public static function X(): ProjectOAuthProviderId + { + if (!isset(self::$X)) { + self::$X = new ProjectOAuthProviderId('x'); + } + return self::$X; + } + public static function YAHOO(): ProjectOAuthProviderId + { + if (!isset(self::$YAHOO)) { + self::$YAHOO = new ProjectOAuthProviderId('yahoo'); + } + return self::$YAHOO; + } + public static function YAMMER(): ProjectOAuthProviderId + { + if (!isset(self::$YAMMER)) { + self::$YAMMER = new ProjectOAuthProviderId('yammer'); + } + return self::$YAMMER; + } + public static function YANDEX(): ProjectOAuthProviderId + { + if (!isset(self::$YANDEX)) { + self::$YANDEX = new ProjectOAuthProviderId('yandex'); + } + return self::$YANDEX; + } + public static function ZOHO(): ProjectOAuthProviderId + { + if (!isset(self::$ZOHO)) { + self::$ZOHO = new ProjectOAuthProviderId('zoho'); + } + return self::$ZOHO; + } + public static function ZOOM(): ProjectOAuthProviderId + { + if (!isset(self::$ZOOM)) { + self::$ZOOM = new ProjectOAuthProviderId('zoom'); + } + return self::$ZOOM; + } + public static function GITHUBIMAGINE(): ProjectOAuthProviderId + { + if (!isset(self::$GITHUBIMAGINE)) { + self::$GITHUBIMAGINE = new ProjectOAuthProviderId('githubImagine'); + } + return self::$GITHUBIMAGINE; + } + public static function GOOGLEIMAGINE(): ProjectOAuthProviderId + { + if (!isset(self::$GOOGLEIMAGINE)) { + self::$GOOGLEIMAGINE = new ProjectOAuthProviderId('googleImagine'); + } + return self::$GOOGLEIMAGINE; + } + + public static function from(string $value): self + { + return match ($value) { + 'amazon' => self::AMAZON(), + 'apple' => self::APPLE(), + 'auth0' => self::AUTH0(), + 'authentik' => self::AUTHENTIK(), + 'autodesk' => self::AUTODESK(), + 'bitbucket' => self::BITBUCKET(), + 'bitly' => self::BITLY(), + 'box' => self::BOX(), + 'dailymotion' => self::DAILYMOTION(), + 'discord' => self::DISCORD(), + 'disqus' => self::DISQUS(), + 'dropbox' => self::DROPBOX(), + 'etsy' => self::ETSY(), + 'facebook' => self::FACEBOOK(), + 'figma' => self::FIGMA(), + 'fusionauth' => self::FUSIONAUTH(), + 'github' => self::GITHUB(), + 'gitlab' => self::GITLAB(), + 'google' => self::GOOGLE(), + 'keycloak' => self::KEYCLOAK(), + 'kick' => self::KICK(), + 'linkedin' => self::LINKEDIN(), + 'microsoft' => self::MICROSOFT(), + 'notion' => self::NOTION(), + 'oidc' => self::OIDC(), + 'okta' => self::OKTA(), + 'paypal' => self::PAYPAL(), + 'paypalSandbox' => self::PAYPALSANDBOX(), + 'podio' => self::PODIO(), + 'salesforce' => self::SALESFORCE(), + 'slack' => self::SLACK(), + 'spotify' => self::SPOTIFY(), + 'stripe' => self::STRIPE(), + 'tradeshift' => self::TRADESHIFT(), + 'tradeshiftBox' => self::TRADESHIFTBOX(), + 'twitch' => self::TWITCH(), + 'wordpress' => self::WORDPRESS(), + 'x' => self::X(), + 'yahoo' => self::YAHOO(), + 'yammer' => self::YAMMER(), + 'yandex' => self::YANDEX(), + 'zoho' => self::ZOHO(), + 'zoom' => self::ZOOM(), + 'githubImagine' => self::GITHUBIMAGINE(), + 'googleImagine' => self::GOOGLEIMAGINE(), + default => throw new \InvalidArgumentException('Unknown ProjectOAuthProviderId value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/ProjectPolicy.php b/src/Appwrite/Enums/ProjectPolicyId.php similarity index 54% rename from src/Appwrite/Enums/ProjectPolicy.php rename to src/Appwrite/Enums/ProjectPolicyId.php index 76f139b..b2bfdee 100644 --- a/src/Appwrite/Enums/ProjectPolicy.php +++ b/src/Appwrite/Enums/ProjectPolicyId.php @@ -4,17 +4,17 @@ use JsonSerializable; -class ProjectPolicy implements JsonSerializable +class ProjectPolicyId implements JsonSerializable { - private static ProjectPolicy $PASSWORDDICTIONARY; - private static ProjectPolicy $PASSWORDHISTORY; - private static ProjectPolicy $PASSWORDPERSONALDATA; - private static ProjectPolicy $SESSIONALERT; - private static ProjectPolicy $SESSIONDURATION; - private static ProjectPolicy $SESSIONINVALIDATION; - private static ProjectPolicy $SESSIONLIMIT; - private static ProjectPolicy $USERLIMIT; - private static ProjectPolicy $MEMBERSHIPPRIVACY; + private static ProjectPolicyId $PASSWORDDICTIONARY; + private static ProjectPolicyId $PASSWORDHISTORY; + private static ProjectPolicyId $PASSWORDPERSONALDATA; + private static ProjectPolicyId $SESSIONALERT; + private static ProjectPolicyId $SESSIONDURATION; + private static ProjectPolicyId $SESSIONINVALIDATION; + private static ProjectPolicyId $SESSIONLIMIT; + private static ProjectPolicyId $USERLIMIT; + private static ProjectPolicyId $MEMBERSHIPPRIVACY; private string $value; @@ -33,66 +33,66 @@ public function jsonSerialize(): string return $this->value; } - public static function PASSWORDDICTIONARY(): ProjectPolicy + public static function PASSWORDDICTIONARY(): ProjectPolicyId { if (!isset(self::$PASSWORDDICTIONARY)) { - self::$PASSWORDDICTIONARY = new ProjectPolicy('password-dictionary'); + self::$PASSWORDDICTIONARY = new ProjectPolicyId('password-dictionary'); } return self::$PASSWORDDICTIONARY; } - public static function PASSWORDHISTORY(): ProjectPolicy + public static function PASSWORDHISTORY(): ProjectPolicyId { if (!isset(self::$PASSWORDHISTORY)) { - self::$PASSWORDHISTORY = new ProjectPolicy('password-history'); + self::$PASSWORDHISTORY = new ProjectPolicyId('password-history'); } return self::$PASSWORDHISTORY; } - public static function PASSWORDPERSONALDATA(): ProjectPolicy + public static function PASSWORDPERSONALDATA(): ProjectPolicyId { if (!isset(self::$PASSWORDPERSONALDATA)) { - self::$PASSWORDPERSONALDATA = new ProjectPolicy('password-personal-data'); + self::$PASSWORDPERSONALDATA = new ProjectPolicyId('password-personal-data'); } return self::$PASSWORDPERSONALDATA; } - public static function SESSIONALERT(): ProjectPolicy + public static function SESSIONALERT(): ProjectPolicyId { if (!isset(self::$SESSIONALERT)) { - self::$SESSIONALERT = new ProjectPolicy('session-alert'); + self::$SESSIONALERT = new ProjectPolicyId('session-alert'); } return self::$SESSIONALERT; } - public static function SESSIONDURATION(): ProjectPolicy + public static function SESSIONDURATION(): ProjectPolicyId { if (!isset(self::$SESSIONDURATION)) { - self::$SESSIONDURATION = new ProjectPolicy('session-duration'); + self::$SESSIONDURATION = new ProjectPolicyId('session-duration'); } return self::$SESSIONDURATION; } - public static function SESSIONINVALIDATION(): ProjectPolicy + public static function SESSIONINVALIDATION(): ProjectPolicyId { if (!isset(self::$SESSIONINVALIDATION)) { - self::$SESSIONINVALIDATION = new ProjectPolicy('session-invalidation'); + self::$SESSIONINVALIDATION = new ProjectPolicyId('session-invalidation'); } return self::$SESSIONINVALIDATION; } - public static function SESSIONLIMIT(): ProjectPolicy + public static function SESSIONLIMIT(): ProjectPolicyId { if (!isset(self::$SESSIONLIMIT)) { - self::$SESSIONLIMIT = new ProjectPolicy('session-limit'); + self::$SESSIONLIMIT = new ProjectPolicyId('session-limit'); } return self::$SESSIONLIMIT; } - public static function USERLIMIT(): ProjectPolicy + public static function USERLIMIT(): ProjectPolicyId { if (!isset(self::$USERLIMIT)) { - self::$USERLIMIT = new ProjectPolicy('user-limit'); + self::$USERLIMIT = new ProjectPolicyId('user-limit'); } return self::$USERLIMIT; } - public static function MEMBERSHIPPRIVACY(): ProjectPolicy + public static function MEMBERSHIPPRIVACY(): ProjectPolicyId { if (!isset(self::$MEMBERSHIPPRIVACY)) { - self::$MEMBERSHIPPRIVACY = new ProjectPolicy('membership-privacy'); + self::$MEMBERSHIPPRIVACY = new ProjectPolicyId('membership-privacy'); } return self::$MEMBERSHIPPRIVACY; } @@ -109,7 +109,7 @@ public static function from(string $value): self 'session-limit' => self::SESSIONLIMIT(), 'user-limit' => self::USERLIMIT(), 'membership-privacy' => self::MEMBERSHIPPRIVACY(), - default => throw new \InvalidArgumentException('Unknown ProjectPolicy value: ' . $value), + default => throw new \InvalidArgumentException('Unknown ProjectPolicyId value: ' . $value), }; } } diff --git a/src/Appwrite/Enums/ProtocolId.php b/src/Appwrite/Enums/ProjectProtocolId.php similarity index 60% rename from src/Appwrite/Enums/ProtocolId.php rename to src/Appwrite/Enums/ProjectProtocolId.php index 476aec7..c6d340c 100644 --- a/src/Appwrite/Enums/ProtocolId.php +++ b/src/Appwrite/Enums/ProjectProtocolId.php @@ -4,11 +4,11 @@ use JsonSerializable; -class ProtocolId implements JsonSerializable +class ProjectProtocolId implements JsonSerializable { - private static ProtocolId $REST; - private static ProtocolId $GRAPHQL; - private static ProtocolId $WEBSOCKET; + private static ProjectProtocolId $REST; + private static ProjectProtocolId $GRAPHQL; + private static ProjectProtocolId $WEBSOCKET; private string $value; @@ -27,24 +27,24 @@ public function jsonSerialize(): string return $this->value; } - public static function REST(): ProtocolId + public static function REST(): ProjectProtocolId { if (!isset(self::$REST)) { - self::$REST = new ProtocolId('rest'); + self::$REST = new ProjectProtocolId('rest'); } return self::$REST; } - public static function GRAPHQL(): ProtocolId + public static function GRAPHQL(): ProjectProtocolId { if (!isset(self::$GRAPHQL)) { - self::$GRAPHQL = new ProtocolId('graphql'); + self::$GRAPHQL = new ProjectProtocolId('graphql'); } return self::$GRAPHQL; } - public static function WEBSOCKET(): ProtocolId + public static function WEBSOCKET(): ProjectProtocolId { if (!isset(self::$WEBSOCKET)) { - self::$WEBSOCKET = new ProtocolId('websocket'); + self::$WEBSOCKET = new ProjectProtocolId('websocket'); } return self::$WEBSOCKET; } @@ -55,7 +55,7 @@ public static function from(string $value): self 'rest' => self::REST(), 'graphql' => self::GRAPHQL(), 'websocket' => self::WEBSOCKET(), - default => throw new \InvalidArgumentException('Unknown ProtocolId value: ' . $value), + default => throw new \InvalidArgumentException('Unknown ProjectProtocolId value: ' . $value), }; } } diff --git a/src/Appwrite/Enums/Secure.php b/src/Appwrite/Enums/ProjectSMTPSecure.php similarity index 65% rename from src/Appwrite/Enums/Secure.php rename to src/Appwrite/Enums/ProjectSMTPSecure.php index 4e15981..b53c934 100644 --- a/src/Appwrite/Enums/Secure.php +++ b/src/Appwrite/Enums/ProjectSMTPSecure.php @@ -4,10 +4,10 @@ use JsonSerializable; -class Secure implements JsonSerializable +class ProjectSMTPSecure implements JsonSerializable { - private static Secure $TLS; - private static Secure $SSL; + private static ProjectSMTPSecure $TLS; + private static ProjectSMTPSecure $SSL; private string $value; @@ -26,17 +26,17 @@ public function jsonSerialize(): string return $this->value; } - public static function TLS(): Secure + public static function TLS(): ProjectSMTPSecure { if (!isset(self::$TLS)) { - self::$TLS = new Secure('tls'); + self::$TLS = new ProjectSMTPSecure('tls'); } return self::$TLS; } - public static function SSL(): Secure + public static function SSL(): ProjectSMTPSecure { if (!isset(self::$SSL)) { - self::$SSL = new Secure('ssl'); + self::$SSL = new ProjectSMTPSecure('ssl'); } return self::$SSL; } @@ -46,7 +46,7 @@ public static function from(string $value): self return match ($value) { 'tls' => self::TLS(), 'ssl' => self::SSL(), - default => throw new \InvalidArgumentException('Unknown Secure value: ' . $value), + default => throw new \InvalidArgumentException('Unknown ProjectSMTPSecure value: ' . $value), }; } } diff --git a/src/Appwrite/Enums/ProjectServiceId.php b/src/Appwrite/Enums/ProjectServiceId.php new file mode 100644 index 0000000..fa3e947 --- /dev/null +++ b/src/Appwrite/Enums/ProjectServiceId.php @@ -0,0 +1,196 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function ACCOUNT(): ProjectServiceId + { + if (!isset(self::$ACCOUNT)) { + self::$ACCOUNT = new ProjectServiceId('account'); + } + return self::$ACCOUNT; + } + public static function AVATARS(): ProjectServiceId + { + if (!isset(self::$AVATARS)) { + self::$AVATARS = new ProjectServiceId('avatars'); + } + return self::$AVATARS; + } + public static function DATABASES(): ProjectServiceId + { + if (!isset(self::$DATABASES)) { + self::$DATABASES = new ProjectServiceId('databases'); + } + return self::$DATABASES; + } + public static function TABLESDB(): ProjectServiceId + { + if (!isset(self::$TABLESDB)) { + self::$TABLESDB = new ProjectServiceId('tablesdb'); + } + return self::$TABLESDB; + } + public static function LOCALE(): ProjectServiceId + { + if (!isset(self::$LOCALE)) { + self::$LOCALE = new ProjectServiceId('locale'); + } + return self::$LOCALE; + } + public static function HEALTH(): ProjectServiceId + { + if (!isset(self::$HEALTH)) { + self::$HEALTH = new ProjectServiceId('health'); + } + return self::$HEALTH; + } + public static function PROJECT(): ProjectServiceId + { + if (!isset(self::$PROJECT)) { + self::$PROJECT = new ProjectServiceId('project'); + } + return self::$PROJECT; + } + public static function STORAGE(): ProjectServiceId + { + if (!isset(self::$STORAGE)) { + self::$STORAGE = new ProjectServiceId('storage'); + } + return self::$STORAGE; + } + public static function TEAMS(): ProjectServiceId + { + if (!isset(self::$TEAMS)) { + self::$TEAMS = new ProjectServiceId('teams'); + } + return self::$TEAMS; + } + public static function USERS(): ProjectServiceId + { + if (!isset(self::$USERS)) { + self::$USERS = new ProjectServiceId('users'); + } + return self::$USERS; + } + public static function VCS(): ProjectServiceId + { + if (!isset(self::$VCS)) { + self::$VCS = new ProjectServiceId('vcs'); + } + return self::$VCS; + } + public static function SITES(): ProjectServiceId + { + if (!isset(self::$SITES)) { + self::$SITES = new ProjectServiceId('sites'); + } + return self::$SITES; + } + public static function FUNCTIONS(): ProjectServiceId + { + if (!isset(self::$FUNCTIONS)) { + self::$FUNCTIONS = new ProjectServiceId('functions'); + } + return self::$FUNCTIONS; + } + public static function PROXY(): ProjectServiceId + { + if (!isset(self::$PROXY)) { + self::$PROXY = new ProjectServiceId('proxy'); + } + return self::$PROXY; + } + public static function GRAPHQL(): ProjectServiceId + { + if (!isset(self::$GRAPHQL)) { + self::$GRAPHQL = new ProjectServiceId('graphql'); + } + return self::$GRAPHQL; + } + public static function MIGRATIONS(): ProjectServiceId + { + if (!isset(self::$MIGRATIONS)) { + self::$MIGRATIONS = new ProjectServiceId('migrations'); + } + return self::$MIGRATIONS; + } + public static function MESSAGING(): ProjectServiceId + { + if (!isset(self::$MESSAGING)) { + self::$MESSAGING = new ProjectServiceId('messaging'); + } + return self::$MESSAGING; + } + public static function ADVISOR(): ProjectServiceId + { + if (!isset(self::$ADVISOR)) { + self::$ADVISOR = new ProjectServiceId('advisor'); + } + return self::$ADVISOR; + } + + public static function from(string $value): self + { + return match ($value) { + 'account' => self::ACCOUNT(), + 'avatars' => self::AVATARS(), + 'databases' => self::DATABASES(), + 'tablesdb' => self::TABLESDB(), + 'locale' => self::LOCALE(), + 'health' => self::HEALTH(), + 'project' => self::PROJECT(), + 'storage' => self::STORAGE(), + 'teams' => self::TEAMS(), + 'users' => self::USERS(), + 'vcs' => self::VCS(), + 'sites' => self::SITES(), + 'functions' => self::FUNCTIONS(), + 'proxy' => self::PROXY(), + 'graphql' => self::GRAPHQL(), + 'migrations' => self::MIGRATIONS(), + 'messaging' => self::MESSAGING(), + 'advisor' => self::ADVISOR(), + default => throw new \InvalidArgumentException('Unknown ProjectServiceId value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/Scopes.php b/src/Appwrite/Enums/Scopes.php index 2330b46..493c2e1 100644 --- a/src/Appwrite/Enums/Scopes.php +++ b/src/Appwrite/Enums/Scopes.php @@ -84,6 +84,12 @@ class Scopes implements JsonSerializable private static Scopes $SCHEDULESWRITE; private static Scopes $VCSREAD; private static Scopes $VCSWRITE; + private static Scopes $INSIGHTSREAD; + private static Scopes $INSIGHTSWRITE; + private static Scopes $REPORTSREAD; + private static Scopes $REPORTSWRITE; + private static Scopes $PRESENCESREAD; + private static Scopes $PRESENCESWRITE; private static Scopes $BACKUPSPOLICIESREAD; private static Scopes $BACKUPSPOLICIESWRITE; private static Scopes $ARCHIVESREAD; @@ -93,6 +99,7 @@ class Scopes implements JsonSerializable private static Scopes $DOMAINSREAD; private static Scopes $DOMAINSWRITE; private static Scopes $EVENTSREAD; + private static Scopes $USAGEREAD; private string $value; @@ -657,6 +664,48 @@ public static function VCSWRITE(): Scopes } return self::$VCSWRITE; } + public static function INSIGHTSREAD(): Scopes + { + if (!isset(self::$INSIGHTSREAD)) { + self::$INSIGHTSREAD = new Scopes('insights.read'); + } + return self::$INSIGHTSREAD; + } + public static function INSIGHTSWRITE(): Scopes + { + if (!isset(self::$INSIGHTSWRITE)) { + self::$INSIGHTSWRITE = new Scopes('insights.write'); + } + return self::$INSIGHTSWRITE; + } + public static function REPORTSREAD(): Scopes + { + if (!isset(self::$REPORTSREAD)) { + self::$REPORTSREAD = new Scopes('reports.read'); + } + return self::$REPORTSREAD; + } + public static function REPORTSWRITE(): Scopes + { + if (!isset(self::$REPORTSWRITE)) { + self::$REPORTSWRITE = new Scopes('reports.write'); + } + return self::$REPORTSWRITE; + } + public static function PRESENCESREAD(): Scopes + { + if (!isset(self::$PRESENCESREAD)) { + self::$PRESENCESREAD = new Scopes('presences.read'); + } + return self::$PRESENCESREAD; + } + public static function PRESENCESWRITE(): Scopes + { + if (!isset(self::$PRESENCESWRITE)) { + self::$PRESENCESWRITE = new Scopes('presences.write'); + } + return self::$PRESENCESWRITE; + } public static function BACKUPSPOLICIESREAD(): Scopes { if (!isset(self::$BACKUPSPOLICIESREAD)) { @@ -720,6 +769,13 @@ public static function EVENTSREAD(): Scopes } return self::$EVENTSREAD; } + public static function USAGEREAD(): Scopes + { + if (!isset(self::$USAGEREAD)) { + self::$USAGEREAD = new Scopes('usage.read'); + } + return self::$USAGEREAD; + } public static function from(string $value): self { @@ -802,6 +858,12 @@ public static function from(string $value): self 'schedules.write' => self::SCHEDULESWRITE(), 'vcs.read' => self::VCSREAD(), 'vcs.write' => self::VCSWRITE(), + 'insights.read' => self::INSIGHTSREAD(), + 'insights.write' => self::INSIGHTSWRITE(), + 'reports.read' => self::REPORTSREAD(), + 'reports.write' => self::REPORTSWRITE(), + 'presences.read' => self::PRESENCESREAD(), + 'presences.write' => self::PRESENCESWRITE(), 'backups.policies.read' => self::BACKUPSPOLICIESREAD(), 'backups.policies.write' => self::BACKUPSPOLICIESWRITE(), 'archives.read' => self::ARCHIVESREAD(), @@ -811,6 +873,7 @@ public static function from(string $value): self 'domains.read' => self::DOMAINSREAD(), 'domains.write' => self::DOMAINSWRITE(), 'events.read' => self::EVENTSREAD(), + 'usage.read' => self::USAGEREAD(), default => throw new \InvalidArgumentException('Unknown Scopes value: ' . $value), }; } diff --git a/src/Appwrite/Enums/ServiceId.php b/src/Appwrite/Enums/ServiceId.php deleted file mode 100644 index 5bef611..0000000 --- a/src/Appwrite/Enums/ServiceId.php +++ /dev/null @@ -1,187 +0,0 @@ -value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function ACCOUNT(): ServiceId - { - if (!isset(self::$ACCOUNT)) { - self::$ACCOUNT = new ServiceId('account'); - } - return self::$ACCOUNT; - } - public static function AVATARS(): ServiceId - { - if (!isset(self::$AVATARS)) { - self::$AVATARS = new ServiceId('avatars'); - } - return self::$AVATARS; - } - public static function DATABASES(): ServiceId - { - if (!isset(self::$DATABASES)) { - self::$DATABASES = new ServiceId('databases'); - } - return self::$DATABASES; - } - public static function TABLESDB(): ServiceId - { - if (!isset(self::$TABLESDB)) { - self::$TABLESDB = new ServiceId('tablesdb'); - } - return self::$TABLESDB; - } - public static function LOCALE(): ServiceId - { - if (!isset(self::$LOCALE)) { - self::$LOCALE = new ServiceId('locale'); - } - return self::$LOCALE; - } - public static function HEALTH(): ServiceId - { - if (!isset(self::$HEALTH)) { - self::$HEALTH = new ServiceId('health'); - } - return self::$HEALTH; - } - public static function PROJECT(): ServiceId - { - if (!isset(self::$PROJECT)) { - self::$PROJECT = new ServiceId('project'); - } - return self::$PROJECT; - } - public static function STORAGE(): ServiceId - { - if (!isset(self::$STORAGE)) { - self::$STORAGE = new ServiceId('storage'); - } - return self::$STORAGE; - } - public static function TEAMS(): ServiceId - { - if (!isset(self::$TEAMS)) { - self::$TEAMS = new ServiceId('teams'); - } - return self::$TEAMS; - } - public static function USERS(): ServiceId - { - if (!isset(self::$USERS)) { - self::$USERS = new ServiceId('users'); - } - return self::$USERS; - } - public static function VCS(): ServiceId - { - if (!isset(self::$VCS)) { - self::$VCS = new ServiceId('vcs'); - } - return self::$VCS; - } - public static function SITES(): ServiceId - { - if (!isset(self::$SITES)) { - self::$SITES = new ServiceId('sites'); - } - return self::$SITES; - } - public static function FUNCTIONS(): ServiceId - { - if (!isset(self::$FUNCTIONS)) { - self::$FUNCTIONS = new ServiceId('functions'); - } - return self::$FUNCTIONS; - } - public static function PROXY(): ServiceId - { - if (!isset(self::$PROXY)) { - self::$PROXY = new ServiceId('proxy'); - } - return self::$PROXY; - } - public static function GRAPHQL(): ServiceId - { - if (!isset(self::$GRAPHQL)) { - self::$GRAPHQL = new ServiceId('graphql'); - } - return self::$GRAPHQL; - } - public static function MIGRATIONS(): ServiceId - { - if (!isset(self::$MIGRATIONS)) { - self::$MIGRATIONS = new ServiceId('migrations'); - } - return self::$MIGRATIONS; - } - public static function MESSAGING(): ServiceId - { - if (!isset(self::$MESSAGING)) { - self::$MESSAGING = new ServiceId('messaging'); - } - return self::$MESSAGING; - } - - public static function from(string $value): self - { - return match ($value) { - 'account' => self::ACCOUNT(), - 'avatars' => self::AVATARS(), - 'databases' => self::DATABASES(), - 'tablesdb' => self::TABLESDB(), - 'locale' => self::LOCALE(), - 'health' => self::HEALTH(), - 'project' => self::PROJECT(), - 'storage' => self::STORAGE(), - 'teams' => self::TEAMS(), - 'users' => self::USERS(), - 'vcs' => self::VCS(), - 'sites' => self::SITES(), - 'functions' => self::FUNCTIONS(), - 'proxy' => self::PROXY(), - 'graphql' => self::GRAPHQL(), - 'migrations' => self::MIGRATIONS(), - 'messaging' => self::MESSAGING(), - default => throw new \InvalidArgumentException('Unknown ServiceId value: ' . $value), - }; - } -} diff --git a/src/Appwrite/Models/AuthProvider.php b/src/Appwrite/Models/AuthProvider.php deleted file mode 100644 index 9d426ce..0000000 --- a/src/Appwrite/Models/AuthProvider.php +++ /dev/null @@ -1,75 +0,0 @@ - $data - */ - public static function from(array $data): static - { - if (!array_key_exists('key', $data)) { - throw new \InvalidArgumentException('Missing required field "key" for ' . static::class . '.'); - } - if (!array_key_exists('name', $data)) { - throw new \InvalidArgumentException('Missing required field "name" for ' . static::class . '.'); - } - if (!array_key_exists('appId', $data)) { - throw new \InvalidArgumentException('Missing required field "appId" for ' . static::class . '.'); - } - if (!array_key_exists('secret', $data)) { - throw new \InvalidArgumentException('Missing required field "secret" for ' . static::class . '.'); - } - if (!array_key_exists('enabled', $data)) { - throw new \InvalidArgumentException('Missing required field "enabled" for ' . static::class . '.'); - } - - return new static( - key: $data['key'], - name: $data['name'], - appId: $data['appId'], - secret: $data['secret'], - enabled: $data['enabled'] - ); - } - - /** - * @return array - */ - public function toArray(): array - { - $result = [ - 'key' => static::serializeValue($this->key), - 'name' => static::serializeValue($this->name), - 'appId' => static::serializeValue($this->appId), - 'secret' => static::serializeValue($this->secret), - 'enabled' => static::serializeValue($this->enabled) - ]; - - return $result; - } -} diff --git a/src/Appwrite/Models/Database.php b/src/Appwrite/Models/Database.php index 4eb1ee3..fc06cde 100644 --- a/src/Appwrite/Models/Database.php +++ b/src/Appwrite/Models/Database.php @@ -20,8 +20,8 @@ * @param string $updatedAt database update date in iso 8601 format. * @param bool $enabled if database is enabled. can be 'enabled' or 'disabled'. when disabled, the database is inaccessible to users, but remains accessible to server sdks using api keys. * @param DatabaseType $type database type. - * @param list $policies database backup policies. - * @param list $archives database backup archives. + * @param list $policies database backup policies. + * @param list $archives database backup archives. */ public function __construct( public string $id, @@ -74,13 +74,13 @@ public static function from(array $data): static type: static::hydrateTypedValue(DatabaseType::class, $data['type']), policies: is_array($data['policies']) ? array_map( - static fn (mixed $item): mixed => static::hydrateTypedValue(Index::class, $item), + static fn (mixed $item): mixed => static::hydrateTypedValue(BackupPolicy::class, $item), $data['policies'] ) : $data['policies'], archives: is_array($data['archives']) ? array_map( - static fn (mixed $item): mixed => static::hydrateTypedValue(Collection::class, $item), + static fn (mixed $item): mixed => static::hydrateTypedValue(BackupArchive::class, $item), $data['archives'] ) : $data['archives'] diff --git a/src/Appwrite/Models/Insight.php b/src/Appwrite/Models/Insight.php new file mode 100644 index 0000000..84a7317 --- /dev/null +++ b/src/Appwrite/Models/Insight.php @@ -0,0 +1,155 @@ + $ctas list of call-to-action buttons attached to this insight. + * @param string|null $analyzedAt time the insight was analyzed in iso 8601 format. + * @param string|null $dismissedAt time the insight was dismissed in iso 8601 format. empty when not dismissed. + * @param string|null $dismissedBy user id that dismissed the insight. empty when not dismissed. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public string $reportId, + public string $type, + public string $severity, + public string $status, + public string $resourceType, + public string $resourceId, + public string $parentResourceType, + public string $parentResourceId, + public string $title, + public string $summary, + public array $ctas, + public ?string $analyzedAt = null, + public ?string $dismissedAt = null, + public ?string $dismissedBy = null + ) { + } + + /** + * @param array $data + */ + public static function from(array $data): static + { + if (!array_key_exists('$id', $data)) { + throw new \InvalidArgumentException('Missing required field "$id" for ' . static::class . '.'); + } + if (!array_key_exists('$createdAt', $data)) { + throw new \InvalidArgumentException('Missing required field "$createdAt" for ' . static::class . '.'); + } + if (!array_key_exists('$updatedAt', $data)) { + throw new \InvalidArgumentException('Missing required field "$updatedAt" for ' . static::class . '.'); + } + if (!array_key_exists('reportId', $data)) { + throw new \InvalidArgumentException('Missing required field "reportId" for ' . static::class . '.'); + } + if (!array_key_exists('type', $data)) { + throw new \InvalidArgumentException('Missing required field "type" for ' . static::class . '.'); + } + if (!array_key_exists('severity', $data)) { + throw new \InvalidArgumentException('Missing required field "severity" for ' . static::class . '.'); + } + if (!array_key_exists('status', $data)) { + throw new \InvalidArgumentException('Missing required field "status" for ' . static::class . '.'); + } + if (!array_key_exists('resourceType', $data)) { + throw new \InvalidArgumentException('Missing required field "resourceType" for ' . static::class . '.'); + } + if (!array_key_exists('resourceId', $data)) { + throw new \InvalidArgumentException('Missing required field "resourceId" for ' . static::class . '.'); + } + if (!array_key_exists('parentResourceType', $data)) { + throw new \InvalidArgumentException('Missing required field "parentResourceType" for ' . static::class . '.'); + } + if (!array_key_exists('parentResourceId', $data)) { + throw new \InvalidArgumentException('Missing required field "parentResourceId" for ' . static::class . '.'); + } + if (!array_key_exists('title', $data)) { + throw new \InvalidArgumentException('Missing required field "title" for ' . static::class . '.'); + } + if (!array_key_exists('summary', $data)) { + throw new \InvalidArgumentException('Missing required field "summary" for ' . static::class . '.'); + } + if (!array_key_exists('ctas', $data)) { + throw new \InvalidArgumentException('Missing required field "ctas" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + createdAt: $data['$createdAt'], + updatedAt: $data['$updatedAt'], + reportId: $data['reportId'], + type: $data['type'], + severity: $data['severity'], + status: $data['status'], + resourceType: $data['resourceType'], + resourceId: $data['resourceId'], + parentResourceType: $data['parentResourceType'], + parentResourceId: $data['parentResourceId'], + title: $data['title'], + summary: $data['summary'], + ctas: is_array($data['ctas']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(InsightCTA::class, $item), + $data['ctas'] + ) + : $data['ctas'], + analyzedAt: array_key_exists('analyzedAt', $data) ? $data['analyzedAt'] : null, + dismissedAt: array_key_exists('dismissedAt', $data) ? $data['dismissedAt'] : null, + dismissedBy: array_key_exists('dismissedBy', $data) ? $data['dismissedBy'] : null + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + '$createdAt' => static::serializeValue($this->createdAt), + '$updatedAt' => static::serializeValue($this->updatedAt), + 'reportId' => static::serializeValue($this->reportId), + 'type' => static::serializeValue($this->type), + 'severity' => static::serializeValue($this->severity), + 'status' => static::serializeValue($this->status), + 'resourceType' => static::serializeValue($this->resourceType), + 'resourceId' => static::serializeValue($this->resourceId), + 'parentResourceType' => static::serializeValue($this->parentResourceType), + 'parentResourceId' => static::serializeValue($this->parentResourceId), + 'title' => static::serializeValue($this->title), + 'summary' => static::serializeValue($this->summary), + 'ctas' => static::serializeValue($this->ctas), + 'analyzedAt' => static::serializeValue($this->analyzedAt), + 'dismissedAt' => static::serializeValue($this->dismissedAt), + 'dismissedBy' => static::serializeValue($this->dismissedBy) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/InsightCTA.php b/src/Appwrite/Models/InsightCTA.php new file mode 100644 index 0000000..b1b5bd6 --- /dev/null +++ b/src/Appwrite/Models/InsightCTA.php @@ -0,0 +1,68 @@ + $data + */ + public static function from(array $data): static + { + if (!array_key_exists('label', $data)) { + throw new \InvalidArgumentException('Missing required field "label" for ' . static::class . '.'); + } + if (!array_key_exists('service', $data)) { + throw new \InvalidArgumentException('Missing required field "service" for ' . static::class . '.'); + } + if (!array_key_exists('method', $data)) { + throw new \InvalidArgumentException('Missing required field "method" for ' . static::class . '.'); + } + if (!array_key_exists('params', $data)) { + throw new \InvalidArgumentException('Missing required field "params" for ' . static::class . '.'); + } + + return new static( + label: $data['label'], + service: $data['service'], + method: $data['method'], + params: $data['params'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + 'label' => static::serializeValue($this->label), + 'service' => static::serializeValue($this->service), + 'method' => static::serializeValue($this->method), + 'params' => static::serializeValue($this->params) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/InsightList.php b/src/Appwrite/Models/InsightList.php new file mode 100644 index 0000000..d8dc4e6 --- /dev/null +++ b/src/Appwrite/Models/InsightList.php @@ -0,0 +1,59 @@ + $insights list of insights. + */ + public function __construct( + public int $total, + public array $insights + ) { + } + + /** + * @param array $data + */ + public static function from(array $data): static + { + if (!array_key_exists('total', $data)) { + throw new \InvalidArgumentException('Missing required field "total" for ' . static::class . '.'); + } + if (!array_key_exists('insights', $data)) { + throw new \InvalidArgumentException('Missing required field "insights" for ' . static::class . '.'); + } + + return new static( + total: $data['total'], + insights: is_array($data['insights']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(Insight::class, $item), + $data['insights'] + ) + : $data['insights'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + 'total' => static::serializeValue($this->total), + 'insights' => static::serializeValue($this->insights) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Google.php b/src/Appwrite/Models/OAuth2Google.php index 51124da..be1ab20 100644 --- a/src/Appwrite/Models/OAuth2Google.php +++ b/src/Appwrite/Models/OAuth2Google.php @@ -2,6 +2,8 @@ namespace Appwrite\Models; +use Appwrite\Enums\OAuth2GooglePrompt; + /** * OAuth2Google */ @@ -16,12 +18,14 @@ * @param bool $enabled oauth2 provider is active and can be used to create sessions. * @param string $clientId google oauth2 client id. * @param string $clientSecret google oauth2 client secret. + * @param list $prompt google oauth2 prompt values. */ public function __construct( public string $id, public bool $enabled, public string $clientId, - public string $clientSecret + public string $clientSecret, + public array $prompt ) { } @@ -42,12 +46,21 @@ public static function from(array $data): static if (!array_key_exists('clientSecret', $data)) { throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); } + if (!array_key_exists('prompt', $data)) { + throw new \InvalidArgumentException('Missing required field "prompt" for ' . static::class . '.'); + } return new static( id: $data['$id'], enabled: $data['enabled'], clientId: $data['clientId'], - clientSecret: $data['clientSecret'] + clientSecret: $data['clientSecret'], + prompt: is_array($data['prompt']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(OAuth2GooglePrompt::class, $item), + $data['prompt'] + ) + : $data['prompt'] ); } @@ -60,7 +73,8 @@ public function toArray(): array '$id' => static::serializeValue($this->id), 'enabled' => static::serializeValue($this->enabled), 'clientId' => static::serializeValue($this->clientId), - 'clientSecret' => static::serializeValue($this->clientSecret) + 'clientSecret' => static::serializeValue($this->clientSecret), + 'prompt' => static::serializeValue($this->prompt) ]; return $result; diff --git a/src/Appwrite/Models/Presence.php b/src/Appwrite/Models/Presence.php new file mode 100644 index 0000000..774127b --- /dev/null +++ b/src/Appwrite/Models/Presence.php @@ -0,0 +1,113 @@ + $metadata Additional properties. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public array $permissions, + public string $userId, + public string $source, + public ?string $status = null, + public ?string $expiresAt = null, + public array $metadata = [] + ) { + } + + /** + * @param array $data + */ + public static function from(array $data): static + { + if (!array_key_exists('$id', $data)) { + throw new \InvalidArgumentException('Missing required field "$id" for ' . static::class . '.'); + } + if (!array_key_exists('$createdAt', $data)) { + throw new \InvalidArgumentException('Missing required field "$createdAt" for ' . static::class . '.'); + } + if (!array_key_exists('$updatedAt', $data)) { + throw new \InvalidArgumentException('Missing required field "$updatedAt" for ' . static::class . '.'); + } + if (!array_key_exists('$permissions', $data)) { + throw new \InvalidArgumentException('Missing required field "$permissions" for ' . static::class . '.'); + } + if (!array_key_exists('userId', $data)) { + throw new \InvalidArgumentException('Missing required field "userId" for ' . static::class . '.'); + } + if (!array_key_exists('source', $data)) { + throw new \InvalidArgumentException('Missing required field "source" for ' . static::class . '.'); + } + + $additionalProperties = static::extractAdditionalPropertiesFromFields( + $data, + [ + '$id', + '$createdAt', + '$updatedAt', + '$permissions', + 'userId', + 'status', + 'source', + 'expiresAt' + ] + ); + + return new static( + id: $data['$id'], + createdAt: $data['$createdAt'], + updatedAt: $data['$updatedAt'], + permissions: $data['$permissions'], + userId: $data['userId'], + source: $data['source'], + status: array_key_exists('status', $data) ? $data['status'] : null, + expiresAt: array_key_exists('expiresAt', $data) ? $data['expiresAt'] : null, + metadata: $additionalProperties + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + '$createdAt' => static::serializeValue($this->createdAt), + '$updatedAt' => static::serializeValue($this->updatedAt), + '$permissions' => static::serializeValue($this->permissions), + 'userId' => static::serializeValue($this->userId), + 'status' => static::serializeValue($this->status), + 'source' => static::serializeValue($this->source), + 'expiresAt' => static::serializeValue($this->expiresAt) + ]; + + foreach (static::serializeAdditionalProperties($this->metadata) as $field => $value) { + $result[$field] = $value; + } + + return $result; + } +} diff --git a/src/Appwrite/Models/PresenceList.php b/src/Appwrite/Models/PresenceList.php new file mode 100644 index 0000000..ef67350 --- /dev/null +++ b/src/Appwrite/Models/PresenceList.php @@ -0,0 +1,59 @@ + $presences list of presences. + */ + public function __construct( + public int $total, + public array $presences + ) { + } + + /** + * @param array $data + */ + public static function from(array $data): static + { + if (!array_key_exists('total', $data)) { + throw new \InvalidArgumentException('Missing required field "total" for ' . static::class . '.'); + } + if (!array_key_exists('presences', $data)) { + throw new \InvalidArgumentException('Missing required field "presences" for ' . static::class . '.'); + } + + return new static( + total: $data['total'], + presences: is_array($data['presences']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(Presence::class, $item), + $data['presences'] + ) + : $data['presences'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + 'total' => static::serializeValue($this->total), + 'presences' => static::serializeValue($this->presences) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/Project.php b/src/Appwrite/Models/Project.php index 3cc198f..cdcb986 100644 --- a/src/Appwrite/Models/Project.php +++ b/src/Appwrite/Models/Project.php @@ -16,38 +16,8 @@ * @param string $createdAt project creation date in iso 8601 format. * @param string $updatedAt project update date in iso 8601 format. * @param string $name project name. - * @param string $description project description. * @param string $teamId project team id. - * @param string $logo project logo file id. - * @param string $url project website url. - * @param string $legalName company legal name. - * @param string $legalCountry country code in [iso 3166-1](http://en.wikipedia.org/wiki/iso_3166-1) two-character format. - * @param string $legalState state name. - * @param string $legalCity city name. - * @param string $legalAddress company address. - * @param string $legalTaxId company tax id. - * @param int $authDuration session duration in seconds. - * @param int $authLimit max users allowed. 0 is unlimited. - * @param int $authSessionsLimit max sessions allowed per user. 100 maximum. - * @param int $authPasswordHistory max allowed passwords in the history list per user. max passwords limit allowed in history is 20. use 0 for disabling password history. - * @param bool $authPasswordDictionary whether or not to check user's password against most commonly used passwords. - * @param bool $authPersonalDataCheck whether or not to check the user password for similarity with their personal data. - * @param bool $authDisposableEmails whether or not to disallow disposable email addresses during signup and email updates. - * @param bool $authCanonicalEmails whether or not to require canonical email addresses during signup and email updates. - * @param bool $authFreeEmails whether or not to disallow free email addresses during signup and email updates. - * @param list $authMockNumbers an array of mock numbers and their corresponding verification codes (otps). - * @param bool $authSessionAlerts whether or not to send session alert emails to users. - * @param bool $authMembershipsUserName whether or not to show user names in the teams membership response. - * @param bool $authMembershipsUserEmail whether or not to show user emails in the teams membership response. - * @param bool $authMembershipsMfa whether or not to show user mfa status in the teams membership response. - * @param bool $authMembershipsUserId whether or not to show user ids in the teams membership response. - * @param bool $authMembershipsUserPhone whether or not to show user phone numbers in the teams membership response. - * @param bool $authInvalidateSessions whether or not all existing sessions should be invalidated on password change - * @param list $oAuthProviders list of auth providers. - * @param array $platforms list of platforms. - * @param list $webhooks list of webhooks. - * @param list $keys list of api keys. - * @param list $devKeys list of dev keys. + * @param list $devKeys deprecated since 1.9.5: list of dev keys. * @param bool $smtpEnabled status for custom smtp * @param string $smtpSenderName smtp sender name * @param string $smtpSenderEmail smtp sender email @@ -62,33 +32,9 @@ * @param string $pingedAt last ping datetime in iso 8601 format. * @param array $labels labels for the project. * @param string $status project status - * @param bool $authEmailPassword email/password auth method status - * @param bool $authUsersAuthMagicURL magic url auth method status - * @param bool $authEmailOtp email (otp) auth method status - * @param bool $authAnonymous anonymous auth method status - * @param bool $authInvites invites auth method status - * @param bool $authJWT jwt auth method status - * @param bool $authPhone phone auth method status - * @param bool $serviceStatusForAccount account service status - * @param bool $serviceStatusForAvatars avatars service status - * @param bool $serviceStatusForDatabases databases (legacy) service status - * @param bool $serviceStatusForTablesdb tablesdb service status - * @param bool $serviceStatusForLocale locale service status - * @param bool $serviceStatusForHealth health service status - * @param bool $serviceStatusForProject project service status - * @param bool $serviceStatusForStorage storage service status - * @param bool $serviceStatusForTeams teams service status - * @param bool $serviceStatusForUsers users service status - * @param bool $serviceStatusForVcs vcs service status - * @param bool $serviceStatusForSites sites service status - * @param bool $serviceStatusForFunctions functions service status - * @param bool $serviceStatusForProxy proxy service status - * @param bool $serviceStatusForGraphql graphql service status - * @param bool $serviceStatusForMigrations migrations service status - * @param bool $serviceStatusForMessaging messaging service status - * @param bool $protocolStatusForRest rest protocol status - * @param bool $protocolStatusForGraphql graphql protocol status - * @param bool $protocolStatusForWebsocket websocket protocol status + * @param list $authMethods list of auth methods. + * @param list $services list of services. + * @param list $protocols list of protocols. * @param string $region project region * @param BillingLimits $billingLimits billing limits reached * @param list $blocks project blocks information @@ -99,37 +45,7 @@ public function __construct( public string $createdAt, public string $updatedAt, public string $name, - public string $description, public string $teamId, - public string $logo, - public string $url, - public string $legalName, - public string $legalCountry, - public string $legalState, - public string $legalCity, - public string $legalAddress, - public string $legalTaxId, - public int $authDuration, - public int $authLimit, - public int $authSessionsLimit, - public int $authPasswordHistory, - public bool $authPasswordDictionary, - public bool $authPersonalDataCheck, - public bool $authDisposableEmails, - public bool $authCanonicalEmails, - public bool $authFreeEmails, - public array $authMockNumbers, - public bool $authSessionAlerts, - public bool $authMembershipsUserName, - public bool $authMembershipsUserEmail, - public bool $authMembershipsMfa, - public bool $authMembershipsUserId, - public bool $authMembershipsUserPhone, - public bool $authInvalidateSessions, - public array $oAuthProviders, - public array $platforms, - public array $webhooks, - public array $keys, public array $devKeys, public bool $smtpEnabled, public string $smtpSenderName, @@ -145,33 +61,9 @@ public function __construct( public string $pingedAt, public array $labels, public string $status, - public bool $authEmailPassword, - public bool $authUsersAuthMagicURL, - public bool $authEmailOtp, - public bool $authAnonymous, - public bool $authInvites, - public bool $authJWT, - public bool $authPhone, - public bool $serviceStatusForAccount, - public bool $serviceStatusForAvatars, - public bool $serviceStatusForDatabases, - public bool $serviceStatusForTablesdb, - public bool $serviceStatusForLocale, - public bool $serviceStatusForHealth, - public bool $serviceStatusForProject, - public bool $serviceStatusForStorage, - public bool $serviceStatusForTeams, - public bool $serviceStatusForUsers, - public bool $serviceStatusForVcs, - public bool $serviceStatusForSites, - public bool $serviceStatusForFunctions, - public bool $serviceStatusForProxy, - public bool $serviceStatusForGraphql, - public bool $serviceStatusForMigrations, - public bool $serviceStatusForMessaging, - public bool $protocolStatusForRest, - public bool $protocolStatusForGraphql, - public bool $protocolStatusForWebsocket, + public array $authMethods, + public array $services, + public array $protocols, public string $region, public BillingLimits $billingLimits, public array $blocks, @@ -196,99 +88,9 @@ public static function from(array $data): static if (!array_key_exists('name', $data)) { throw new \InvalidArgumentException('Missing required field "name" for ' . static::class . '.'); } - if (!array_key_exists('description', $data)) { - throw new \InvalidArgumentException('Missing required field "description" for ' . static::class . '.'); - } if (!array_key_exists('teamId', $data)) { throw new \InvalidArgumentException('Missing required field "teamId" for ' . static::class . '.'); } - if (!array_key_exists('logo', $data)) { - throw new \InvalidArgumentException('Missing required field "logo" for ' . static::class . '.'); - } - if (!array_key_exists('url', $data)) { - throw new \InvalidArgumentException('Missing required field "url" for ' . static::class . '.'); - } - if (!array_key_exists('legalName', $data)) { - throw new \InvalidArgumentException('Missing required field "legalName" for ' . static::class . '.'); - } - if (!array_key_exists('legalCountry', $data)) { - throw new \InvalidArgumentException('Missing required field "legalCountry" for ' . static::class . '.'); - } - if (!array_key_exists('legalState', $data)) { - throw new \InvalidArgumentException('Missing required field "legalState" for ' . static::class . '.'); - } - if (!array_key_exists('legalCity', $data)) { - throw new \InvalidArgumentException('Missing required field "legalCity" for ' . static::class . '.'); - } - if (!array_key_exists('legalAddress', $data)) { - throw new \InvalidArgumentException('Missing required field "legalAddress" for ' . static::class . '.'); - } - if (!array_key_exists('legalTaxId', $data)) { - throw new \InvalidArgumentException('Missing required field "legalTaxId" for ' . static::class . '.'); - } - if (!array_key_exists('authDuration', $data)) { - throw new \InvalidArgumentException('Missing required field "authDuration" for ' . static::class . '.'); - } - if (!array_key_exists('authLimit', $data)) { - throw new \InvalidArgumentException('Missing required field "authLimit" for ' . static::class . '.'); - } - if (!array_key_exists('authSessionsLimit', $data)) { - throw new \InvalidArgumentException('Missing required field "authSessionsLimit" for ' . static::class . '.'); - } - if (!array_key_exists('authPasswordHistory', $data)) { - throw new \InvalidArgumentException('Missing required field "authPasswordHistory" for ' . static::class . '.'); - } - if (!array_key_exists('authPasswordDictionary', $data)) { - throw new \InvalidArgumentException('Missing required field "authPasswordDictionary" for ' . static::class . '.'); - } - if (!array_key_exists('authPersonalDataCheck', $data)) { - throw new \InvalidArgumentException('Missing required field "authPersonalDataCheck" for ' . static::class . '.'); - } - if (!array_key_exists('authDisposableEmails', $data)) { - throw new \InvalidArgumentException('Missing required field "authDisposableEmails" for ' . static::class . '.'); - } - if (!array_key_exists('authCanonicalEmails', $data)) { - throw new \InvalidArgumentException('Missing required field "authCanonicalEmails" for ' . static::class . '.'); - } - if (!array_key_exists('authFreeEmails', $data)) { - throw new \InvalidArgumentException('Missing required field "authFreeEmails" for ' . static::class . '.'); - } - if (!array_key_exists('authMockNumbers', $data)) { - throw new \InvalidArgumentException('Missing required field "authMockNumbers" for ' . static::class . '.'); - } - if (!array_key_exists('authSessionAlerts', $data)) { - throw new \InvalidArgumentException('Missing required field "authSessionAlerts" for ' . static::class . '.'); - } - if (!array_key_exists('authMembershipsUserName', $data)) { - throw new \InvalidArgumentException('Missing required field "authMembershipsUserName" for ' . static::class . '.'); - } - if (!array_key_exists('authMembershipsUserEmail', $data)) { - throw new \InvalidArgumentException('Missing required field "authMembershipsUserEmail" for ' . static::class . '.'); - } - if (!array_key_exists('authMembershipsMfa', $data)) { - throw new \InvalidArgumentException('Missing required field "authMembershipsMfa" for ' . static::class . '.'); - } - if (!array_key_exists('authMembershipsUserId', $data)) { - throw new \InvalidArgumentException('Missing required field "authMembershipsUserId" for ' . static::class . '.'); - } - if (!array_key_exists('authMembershipsUserPhone', $data)) { - throw new \InvalidArgumentException('Missing required field "authMembershipsUserPhone" for ' . static::class . '.'); - } - if (!array_key_exists('authInvalidateSessions', $data)) { - throw new \InvalidArgumentException('Missing required field "authInvalidateSessions" for ' . static::class . '.'); - } - if (!array_key_exists('oAuthProviders', $data)) { - throw new \InvalidArgumentException('Missing required field "oAuthProviders" for ' . static::class . '.'); - } - if (!array_key_exists('platforms', $data)) { - throw new \InvalidArgumentException('Missing required field "platforms" for ' . static::class . '.'); - } - if (!array_key_exists('webhooks', $data)) { - throw new \InvalidArgumentException('Missing required field "webhooks" for ' . static::class . '.'); - } - if (!array_key_exists('keys', $data)) { - throw new \InvalidArgumentException('Missing required field "keys" for ' . static::class . '.'); - } if (!array_key_exists('devKeys', $data)) { throw new \InvalidArgumentException('Missing required field "devKeys" for ' . static::class . '.'); } @@ -334,86 +136,14 @@ public static function from(array $data): static if (!array_key_exists('status', $data)) { throw new \InvalidArgumentException('Missing required field "status" for ' . static::class . '.'); } - if (!array_key_exists('authEmailPassword', $data)) { - throw new \InvalidArgumentException('Missing required field "authEmailPassword" for ' . static::class . '.'); - } - if (!array_key_exists('authUsersAuthMagicURL', $data)) { - throw new \InvalidArgumentException('Missing required field "authUsersAuthMagicURL" for ' . static::class . '.'); - } - if (!array_key_exists('authEmailOtp', $data)) { - throw new \InvalidArgumentException('Missing required field "authEmailOtp" for ' . static::class . '.'); - } - if (!array_key_exists('authAnonymous', $data)) { - throw new \InvalidArgumentException('Missing required field "authAnonymous" for ' . static::class . '.'); - } - if (!array_key_exists('authInvites', $data)) { - throw new \InvalidArgumentException('Missing required field "authInvites" for ' . static::class . '.'); + if (!array_key_exists('authMethods', $data)) { + throw new \InvalidArgumentException('Missing required field "authMethods" for ' . static::class . '.'); } - if (!array_key_exists('authJWT', $data)) { - throw new \InvalidArgumentException('Missing required field "authJWT" for ' . static::class . '.'); + if (!array_key_exists('services', $data)) { + throw new \InvalidArgumentException('Missing required field "services" for ' . static::class . '.'); } - if (!array_key_exists('authPhone', $data)) { - throw new \InvalidArgumentException('Missing required field "authPhone" for ' . static::class . '.'); - } - if (!array_key_exists('serviceStatusForAccount', $data)) { - throw new \InvalidArgumentException('Missing required field "serviceStatusForAccount" for ' . static::class . '.'); - } - if (!array_key_exists('serviceStatusForAvatars', $data)) { - throw new \InvalidArgumentException('Missing required field "serviceStatusForAvatars" for ' . static::class . '.'); - } - if (!array_key_exists('serviceStatusForDatabases', $data)) { - throw new \InvalidArgumentException('Missing required field "serviceStatusForDatabases" for ' . static::class . '.'); - } - if (!array_key_exists('serviceStatusForTablesdb', $data)) { - throw new \InvalidArgumentException('Missing required field "serviceStatusForTablesdb" for ' . static::class . '.'); - } - if (!array_key_exists('serviceStatusForLocale', $data)) { - throw new \InvalidArgumentException('Missing required field "serviceStatusForLocale" for ' . static::class . '.'); - } - if (!array_key_exists('serviceStatusForHealth', $data)) { - throw new \InvalidArgumentException('Missing required field "serviceStatusForHealth" for ' . static::class . '.'); - } - if (!array_key_exists('serviceStatusForProject', $data)) { - throw new \InvalidArgumentException('Missing required field "serviceStatusForProject" for ' . static::class . '.'); - } - if (!array_key_exists('serviceStatusForStorage', $data)) { - throw new \InvalidArgumentException('Missing required field "serviceStatusForStorage" for ' . static::class . '.'); - } - if (!array_key_exists('serviceStatusForTeams', $data)) { - throw new \InvalidArgumentException('Missing required field "serviceStatusForTeams" for ' . static::class . '.'); - } - if (!array_key_exists('serviceStatusForUsers', $data)) { - throw new \InvalidArgumentException('Missing required field "serviceStatusForUsers" for ' . static::class . '.'); - } - if (!array_key_exists('serviceStatusForVcs', $data)) { - throw new \InvalidArgumentException('Missing required field "serviceStatusForVcs" for ' . static::class . '.'); - } - if (!array_key_exists('serviceStatusForSites', $data)) { - throw new \InvalidArgumentException('Missing required field "serviceStatusForSites" for ' . static::class . '.'); - } - if (!array_key_exists('serviceStatusForFunctions', $data)) { - throw new \InvalidArgumentException('Missing required field "serviceStatusForFunctions" for ' . static::class . '.'); - } - if (!array_key_exists('serviceStatusForProxy', $data)) { - throw new \InvalidArgumentException('Missing required field "serviceStatusForProxy" for ' . static::class . '.'); - } - if (!array_key_exists('serviceStatusForGraphql', $data)) { - throw new \InvalidArgumentException('Missing required field "serviceStatusForGraphql" for ' . static::class . '.'); - } - if (!array_key_exists('serviceStatusForMigrations', $data)) { - throw new \InvalidArgumentException('Missing required field "serviceStatusForMigrations" for ' . static::class . '.'); - } - if (!array_key_exists('serviceStatusForMessaging', $data)) { - throw new \InvalidArgumentException('Missing required field "serviceStatusForMessaging" for ' . static::class . '.'); - } - if (!array_key_exists('protocolStatusForRest', $data)) { - throw new \InvalidArgumentException('Missing required field "protocolStatusForRest" for ' . static::class . '.'); - } - if (!array_key_exists('protocolStatusForGraphql', $data)) { - throw new \InvalidArgumentException('Missing required field "protocolStatusForGraphql" for ' . static::class . '.'); - } - if (!array_key_exists('protocolStatusForWebsocket', $data)) { - throw new \InvalidArgumentException('Missing required field "protocolStatusForWebsocket" for ' . static::class . '.'); + if (!array_key_exists('protocols', $data)) { + throw new \InvalidArgumentException('Missing required field "protocols" for ' . static::class . '.'); } if (!array_key_exists('region', $data)) { throw new \InvalidArgumentException('Missing required field "region" for ' . static::class . '.'); @@ -433,57 +163,7 @@ public static function from(array $data): static createdAt: $data['$createdAt'], updatedAt: $data['$updatedAt'], name: $data['name'], - description: $data['description'], teamId: $data['teamId'], - logo: $data['logo'], - url: $data['url'], - legalName: $data['legalName'], - legalCountry: $data['legalCountry'], - legalState: $data['legalState'], - legalCity: $data['legalCity'], - legalAddress: $data['legalAddress'], - legalTaxId: $data['legalTaxId'], - authDuration: $data['authDuration'], - authLimit: $data['authLimit'], - authSessionsLimit: $data['authSessionsLimit'], - authPasswordHistory: $data['authPasswordHistory'], - authPasswordDictionary: $data['authPasswordDictionary'], - authPersonalDataCheck: $data['authPersonalDataCheck'], - authDisposableEmails: $data['authDisposableEmails'], - authCanonicalEmails: $data['authCanonicalEmails'], - authFreeEmails: $data['authFreeEmails'], - authMockNumbers: is_array($data['authMockNumbers']) - ? array_map( - static fn (mixed $item): mixed => static::hydrateTypedValue(MockNumber::class, $item), - $data['authMockNumbers'] - ) - : $data['authMockNumbers'], - authSessionAlerts: $data['authSessionAlerts'], - authMembershipsUserName: $data['authMembershipsUserName'], - authMembershipsUserEmail: $data['authMembershipsUserEmail'], - authMembershipsMfa: $data['authMembershipsMfa'], - authMembershipsUserId: $data['authMembershipsUserId'], - authMembershipsUserPhone: $data['authMembershipsUserPhone'], - authInvalidateSessions: $data['authInvalidateSessions'], - oAuthProviders: is_array($data['oAuthProviders']) - ? array_map( - static fn (mixed $item): mixed => static::hydrateTypedValue(AuthProvider::class, $item), - $data['oAuthProviders'] - ) - : $data['oAuthProviders'], - platforms: $data['platforms'], - webhooks: is_array($data['webhooks']) - ? array_map( - static fn (mixed $item): mixed => static::hydrateTypedValue(Webhook::class, $item), - $data['webhooks'] - ) - : $data['webhooks'], - keys: is_array($data['keys']) - ? array_map( - static fn (mixed $item): mixed => static::hydrateTypedValue(Key::class, $item), - $data['keys'] - ) - : $data['keys'], devKeys: is_array($data['devKeys']) ? array_map( static fn (mixed $item): mixed => static::hydrateTypedValue(DevKey::class, $item), @@ -504,33 +184,24 @@ public static function from(array $data): static pingedAt: $data['pingedAt'], labels: $data['labels'], status: $data['status'], - authEmailPassword: $data['authEmailPassword'], - authUsersAuthMagicURL: $data['authUsersAuthMagicURL'], - authEmailOtp: $data['authEmailOtp'], - authAnonymous: $data['authAnonymous'], - authInvites: $data['authInvites'], - authJWT: $data['authJWT'], - authPhone: $data['authPhone'], - serviceStatusForAccount: $data['serviceStatusForAccount'], - serviceStatusForAvatars: $data['serviceStatusForAvatars'], - serviceStatusForDatabases: $data['serviceStatusForDatabases'], - serviceStatusForTablesdb: $data['serviceStatusForTablesdb'], - serviceStatusForLocale: $data['serviceStatusForLocale'], - serviceStatusForHealth: $data['serviceStatusForHealth'], - serviceStatusForProject: $data['serviceStatusForProject'], - serviceStatusForStorage: $data['serviceStatusForStorage'], - serviceStatusForTeams: $data['serviceStatusForTeams'], - serviceStatusForUsers: $data['serviceStatusForUsers'], - serviceStatusForVcs: $data['serviceStatusForVcs'], - serviceStatusForSites: $data['serviceStatusForSites'], - serviceStatusForFunctions: $data['serviceStatusForFunctions'], - serviceStatusForProxy: $data['serviceStatusForProxy'], - serviceStatusForGraphql: $data['serviceStatusForGraphql'], - serviceStatusForMigrations: $data['serviceStatusForMigrations'], - serviceStatusForMessaging: $data['serviceStatusForMessaging'], - protocolStatusForRest: $data['protocolStatusForRest'], - protocolStatusForGraphql: $data['protocolStatusForGraphql'], - protocolStatusForWebsocket: $data['protocolStatusForWebsocket'], + authMethods: is_array($data['authMethods']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(ProjectAuthMethod::class, $item), + $data['authMethods'] + ) + : $data['authMethods'], + services: is_array($data['services']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(ProjectService::class, $item), + $data['services'] + ) + : $data['services'], + protocols: is_array($data['protocols']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(ProjectProtocol::class, $item), + $data['protocols'] + ) + : $data['protocols'], region: $data['region'], billingLimits: static::hydrateTypedValue(BillingLimits::class, $data['billingLimits']), blocks: is_array($data['blocks']) @@ -553,37 +224,7 @@ public function toArray(): array '$createdAt' => static::serializeValue($this->createdAt), '$updatedAt' => static::serializeValue($this->updatedAt), 'name' => static::serializeValue($this->name), - 'description' => static::serializeValue($this->description), 'teamId' => static::serializeValue($this->teamId), - 'logo' => static::serializeValue($this->logo), - 'url' => static::serializeValue($this->url), - 'legalName' => static::serializeValue($this->legalName), - 'legalCountry' => static::serializeValue($this->legalCountry), - 'legalState' => static::serializeValue($this->legalState), - 'legalCity' => static::serializeValue($this->legalCity), - 'legalAddress' => static::serializeValue($this->legalAddress), - 'legalTaxId' => static::serializeValue($this->legalTaxId), - 'authDuration' => static::serializeValue($this->authDuration), - 'authLimit' => static::serializeValue($this->authLimit), - 'authSessionsLimit' => static::serializeValue($this->authSessionsLimit), - 'authPasswordHistory' => static::serializeValue($this->authPasswordHistory), - 'authPasswordDictionary' => static::serializeValue($this->authPasswordDictionary), - 'authPersonalDataCheck' => static::serializeValue($this->authPersonalDataCheck), - 'authDisposableEmails' => static::serializeValue($this->authDisposableEmails), - 'authCanonicalEmails' => static::serializeValue($this->authCanonicalEmails), - 'authFreeEmails' => static::serializeValue($this->authFreeEmails), - 'authMockNumbers' => static::serializeValue($this->authMockNumbers), - 'authSessionAlerts' => static::serializeValue($this->authSessionAlerts), - 'authMembershipsUserName' => static::serializeValue($this->authMembershipsUserName), - 'authMembershipsUserEmail' => static::serializeValue($this->authMembershipsUserEmail), - 'authMembershipsMfa' => static::serializeValue($this->authMembershipsMfa), - 'authMembershipsUserId' => static::serializeValue($this->authMembershipsUserId), - 'authMembershipsUserPhone' => static::serializeValue($this->authMembershipsUserPhone), - 'authInvalidateSessions' => static::serializeValue($this->authInvalidateSessions), - 'oAuthProviders' => static::serializeValue($this->oAuthProviders), - 'platforms' => static::serializeValue($this->platforms), - 'webhooks' => static::serializeValue($this->webhooks), - 'keys' => static::serializeValue($this->keys), 'devKeys' => static::serializeValue($this->devKeys), 'smtpEnabled' => static::serializeValue($this->smtpEnabled), 'smtpSenderName' => static::serializeValue($this->smtpSenderName), @@ -599,33 +240,9 @@ public function toArray(): array 'pingedAt' => static::serializeValue($this->pingedAt), 'labels' => static::serializeValue($this->labels), 'status' => static::serializeValue($this->status), - 'authEmailPassword' => static::serializeValue($this->authEmailPassword), - 'authUsersAuthMagicURL' => static::serializeValue($this->authUsersAuthMagicURL), - 'authEmailOtp' => static::serializeValue($this->authEmailOtp), - 'authAnonymous' => static::serializeValue($this->authAnonymous), - 'authInvites' => static::serializeValue($this->authInvites), - 'authJWT' => static::serializeValue($this->authJWT), - 'authPhone' => static::serializeValue($this->authPhone), - 'serviceStatusForAccount' => static::serializeValue($this->serviceStatusForAccount), - 'serviceStatusForAvatars' => static::serializeValue($this->serviceStatusForAvatars), - 'serviceStatusForDatabases' => static::serializeValue($this->serviceStatusForDatabases), - 'serviceStatusForTablesdb' => static::serializeValue($this->serviceStatusForTablesdb), - 'serviceStatusForLocale' => static::serializeValue($this->serviceStatusForLocale), - 'serviceStatusForHealth' => static::serializeValue($this->serviceStatusForHealth), - 'serviceStatusForProject' => static::serializeValue($this->serviceStatusForProject), - 'serviceStatusForStorage' => static::serializeValue($this->serviceStatusForStorage), - 'serviceStatusForTeams' => static::serializeValue($this->serviceStatusForTeams), - 'serviceStatusForUsers' => static::serializeValue($this->serviceStatusForUsers), - 'serviceStatusForVcs' => static::serializeValue($this->serviceStatusForVcs), - 'serviceStatusForSites' => static::serializeValue($this->serviceStatusForSites), - 'serviceStatusForFunctions' => static::serializeValue($this->serviceStatusForFunctions), - 'serviceStatusForProxy' => static::serializeValue($this->serviceStatusForProxy), - 'serviceStatusForGraphql' => static::serializeValue($this->serviceStatusForGraphql), - 'serviceStatusForMigrations' => static::serializeValue($this->serviceStatusForMigrations), - 'serviceStatusForMessaging' => static::serializeValue($this->serviceStatusForMessaging), - 'protocolStatusForRest' => static::serializeValue($this->protocolStatusForRest), - 'protocolStatusForGraphql' => static::serializeValue($this->protocolStatusForGraphql), - 'protocolStatusForWebsocket' => static::serializeValue($this->protocolStatusForWebsocket), + 'authMethods' => static::serializeValue($this->authMethods), + 'services' => static::serializeValue($this->services), + 'protocols' => static::serializeValue($this->protocols), 'region' => static::serializeValue($this->region), 'billingLimits' => static::serializeValue($this->billingLimits), 'blocks' => static::serializeValue($this->blocks), diff --git a/src/Appwrite/Models/ProjectAuthMethod.php b/src/Appwrite/Models/ProjectAuthMethod.php new file mode 100644 index 0000000..2f5903c --- /dev/null +++ b/src/Appwrite/Models/ProjectAuthMethod.php @@ -0,0 +1,56 @@ + $data + */ + public static function from(array $data): static + { + if (!array_key_exists('$id', $data)) { + throw new \InvalidArgumentException('Missing required field "$id" for ' . static::class . '.'); + } + if (!array_key_exists('enabled', $data)) { + throw new \InvalidArgumentException('Missing required field "enabled" for ' . static::class . '.'); + } + + return new static( + id: static::hydrateTypedValue(ProjectAuthMethodId::class, $data['$id']), + enabled: $data['enabled'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/ProjectProtocol.php b/src/Appwrite/Models/ProjectProtocol.php new file mode 100644 index 0000000..c5f7bd1 --- /dev/null +++ b/src/Appwrite/Models/ProjectProtocol.php @@ -0,0 +1,56 @@ + $data + */ + public static function from(array $data): static + { + if (!array_key_exists('$id', $data)) { + throw new \InvalidArgumentException('Missing required field "$id" for ' . static::class . '.'); + } + if (!array_key_exists('enabled', $data)) { + throw new \InvalidArgumentException('Missing required field "enabled" for ' . static::class . '.'); + } + + return new static( + id: static::hydrateTypedValue(ProjectProtocolId::class, $data['$id']), + enabled: $data['enabled'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/ProjectService.php b/src/Appwrite/Models/ProjectService.php new file mode 100644 index 0000000..357ad85 --- /dev/null +++ b/src/Appwrite/Models/ProjectService.php @@ -0,0 +1,56 @@ + $data + */ + public static function from(array $data): static + { + if (!array_key_exists('$id', $data)) { + throw new \InvalidArgumentException('Missing required field "$id" for ' . static::class . '.'); + } + if (!array_key_exists('enabled', $data)) { + throw new \InvalidArgumentException('Missing required field "enabled" for ' . static::class . '.'); + } + + return new static( + id: static::hydrateTypedValue(ProjectServiceId::class, $data['$id']), + enabled: $data['enabled'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/Report.php b/src/Appwrite/Models/Report.php new file mode 100644 index 0000000..d0301ab --- /dev/null +++ b/src/Appwrite/Models/Report.php @@ -0,0 +1,126 @@ + $insights insights nested under this report. + * @param string|null $analyzedAt time the report was analyzed in iso 8601 format. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public string $appId, + public string $type, + public string $title, + public string $summary, + public string $targetType, + public string $target, + public array $categories, + public array $insights, + public ?string $analyzedAt = null + ) { + } + + /** + * @param array $data + */ + public static function from(array $data): static + { + if (!array_key_exists('$id', $data)) { + throw new \InvalidArgumentException('Missing required field "$id" for ' . static::class . '.'); + } + if (!array_key_exists('$createdAt', $data)) { + throw new \InvalidArgumentException('Missing required field "$createdAt" for ' . static::class . '.'); + } + if (!array_key_exists('$updatedAt', $data)) { + throw new \InvalidArgumentException('Missing required field "$updatedAt" for ' . static::class . '.'); + } + if (!array_key_exists('appId', $data)) { + throw new \InvalidArgumentException('Missing required field "appId" for ' . static::class . '.'); + } + if (!array_key_exists('type', $data)) { + throw new \InvalidArgumentException('Missing required field "type" for ' . static::class . '.'); + } + if (!array_key_exists('title', $data)) { + throw new \InvalidArgumentException('Missing required field "title" for ' . static::class . '.'); + } + if (!array_key_exists('summary', $data)) { + throw new \InvalidArgumentException('Missing required field "summary" for ' . static::class . '.'); + } + if (!array_key_exists('targetType', $data)) { + throw new \InvalidArgumentException('Missing required field "targetType" for ' . static::class . '.'); + } + if (!array_key_exists('target', $data)) { + throw new \InvalidArgumentException('Missing required field "target" for ' . static::class . '.'); + } + if (!array_key_exists('categories', $data)) { + throw new \InvalidArgumentException('Missing required field "categories" for ' . static::class . '.'); + } + if (!array_key_exists('insights', $data)) { + throw new \InvalidArgumentException('Missing required field "insights" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + createdAt: $data['$createdAt'], + updatedAt: $data['$updatedAt'], + appId: $data['appId'], + type: $data['type'], + title: $data['title'], + summary: $data['summary'], + targetType: $data['targetType'], + target: $data['target'], + categories: $data['categories'], + insights: is_array($data['insights']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(Insight::class, $item), + $data['insights'] + ) + : $data['insights'], + analyzedAt: array_key_exists('analyzedAt', $data) ? $data['analyzedAt'] : null + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + '$createdAt' => static::serializeValue($this->createdAt), + '$updatedAt' => static::serializeValue($this->updatedAt), + 'appId' => static::serializeValue($this->appId), + 'type' => static::serializeValue($this->type), + 'title' => static::serializeValue($this->title), + 'summary' => static::serializeValue($this->summary), + 'targetType' => static::serializeValue($this->targetType), + 'target' => static::serializeValue($this->target), + 'categories' => static::serializeValue($this->categories), + 'insights' => static::serializeValue($this->insights), + 'analyzedAt' => static::serializeValue($this->analyzedAt) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/ReportList.php b/src/Appwrite/Models/ReportList.php new file mode 100644 index 0000000..caf999e --- /dev/null +++ b/src/Appwrite/Models/ReportList.php @@ -0,0 +1,59 @@ + $reports list of reports. + */ + public function __construct( + public int $total, + public array $reports + ) { + } + + /** + * @param array $data + */ + public static function from(array $data): static + { + if (!array_key_exists('total', $data)) { + throw new \InvalidArgumentException('Missing required field "total" for ' . static::class . '.'); + } + if (!array_key_exists('reports', $data)) { + throw new \InvalidArgumentException('Missing required field "reports" for ' . static::class . '.'); + } + + return new static( + total: $data['total'], + reports: is_array($data['reports']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(Report::class, $item), + $data['reports'] + ) + : $data['reports'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + 'total' => static::serializeValue($this->total), + 'reports' => static::serializeValue($this->reports) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/UsageEvent.php b/src/Appwrite/Models/UsageEvent.php new file mode 100644 index 0000000..d40f8b9 --- /dev/null +++ b/src/Appwrite/Models/UsageEvent.php @@ -0,0 +1,110 @@ + $data + */ + public static function from(array $data): static + { + if (!array_key_exists('metric', $data)) { + throw new \InvalidArgumentException('Missing required field "metric" for ' . static::class . '.'); + } + if (!array_key_exists('value', $data)) { + throw new \InvalidArgumentException('Missing required field "value" for ' . static::class . '.'); + } + if (!array_key_exists('time', $data)) { + throw new \InvalidArgumentException('Missing required field "time" for ' . static::class . '.'); + } + if (!array_key_exists('path', $data)) { + throw new \InvalidArgumentException('Missing required field "path" for ' . static::class . '.'); + } + if (!array_key_exists('method', $data)) { + throw new \InvalidArgumentException('Missing required field "method" for ' . static::class . '.'); + } + if (!array_key_exists('status', $data)) { + throw new \InvalidArgumentException('Missing required field "status" for ' . static::class . '.'); + } + if (!array_key_exists('resourceType', $data)) { + throw new \InvalidArgumentException('Missing required field "resourceType" for ' . static::class . '.'); + } + if (!array_key_exists('resourceId', $data)) { + throw new \InvalidArgumentException('Missing required field "resourceId" for ' . static::class . '.'); + } + if (!array_key_exists('countryCode', $data)) { + throw new \InvalidArgumentException('Missing required field "countryCode" for ' . static::class . '.'); + } + if (!array_key_exists('userAgent', $data)) { + throw new \InvalidArgumentException('Missing required field "userAgent" for ' . static::class . '.'); + } + + return new static( + metric: $data['metric'], + value: $data['value'], + time: $data['time'], + path: $data['path'], + method: $data['method'], + status: $data['status'], + resourceType: $data['resourceType'], + resourceId: $data['resourceId'], + countryCode: $data['countryCode'], + userAgent: $data['userAgent'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + 'metric' => static::serializeValue($this->metric), + 'value' => static::serializeValue($this->value), + 'time' => static::serializeValue($this->time), + 'path' => static::serializeValue($this->path), + 'method' => static::serializeValue($this->method), + 'status' => static::serializeValue($this->status), + 'resourceType' => static::serializeValue($this->resourceType), + 'resourceId' => static::serializeValue($this->resourceId), + 'countryCode' => static::serializeValue($this->countryCode), + 'userAgent' => static::serializeValue($this->userAgent) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/UsageEventList.php b/src/Appwrite/Models/UsageEventList.php new file mode 100644 index 0000000..bd0066e --- /dev/null +++ b/src/Appwrite/Models/UsageEventList.php @@ -0,0 +1,59 @@ + $events list of events. + */ + public function __construct( + public int $total, + public array $events + ) { + } + + /** + * @param array $data + */ + public static function from(array $data): static + { + if (!array_key_exists('total', $data)) { + throw new \InvalidArgumentException('Missing required field "total" for ' . static::class . '.'); + } + if (!array_key_exists('events', $data)) { + throw new \InvalidArgumentException('Missing required field "events" for ' . static::class . '.'); + } + + return new static( + total: $data['total'], + events: is_array($data['events']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(UsageEvent::class, $item), + $data['events'] + ) + : $data['events'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + 'total' => static::serializeValue($this->total), + 'events' => static::serializeValue($this->events) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/UsageGauge.php b/src/Appwrite/Models/UsageGauge.php new file mode 100644 index 0000000..24012c2 --- /dev/null +++ b/src/Appwrite/Models/UsageGauge.php @@ -0,0 +1,61 @@ + $data + */ + public static function from(array $data): static + { + if (!array_key_exists('metric', $data)) { + throw new \InvalidArgumentException('Missing required field "metric" for ' . static::class . '.'); + } + if (!array_key_exists('value', $data)) { + throw new \InvalidArgumentException('Missing required field "value" for ' . static::class . '.'); + } + if (!array_key_exists('time', $data)) { + throw new \InvalidArgumentException('Missing required field "time" for ' . static::class . '.'); + } + + return new static( + metric: $data['metric'], + value: $data['value'], + time: $data['time'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + 'metric' => static::serializeValue($this->metric), + 'value' => static::serializeValue($this->value), + 'time' => static::serializeValue($this->time) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/UsageGaugeList.php b/src/Appwrite/Models/UsageGaugeList.php new file mode 100644 index 0000000..94f22d1 --- /dev/null +++ b/src/Appwrite/Models/UsageGaugeList.php @@ -0,0 +1,59 @@ + $gauges list of gauges. + */ + public function __construct( + public int $total, + public array $gauges + ) { + } + + /** + * @param array $data + */ + public static function from(array $data): static + { + if (!array_key_exists('total', $data)) { + throw new \InvalidArgumentException('Missing required field "total" for ' . static::class . '.'); + } + if (!array_key_exists('gauges', $data)) { + throw new \InvalidArgumentException('Missing required field "gauges" for ' . static::class . '.'); + } + + return new static( + total: $data['total'], + gauges: is_array($data['gauges']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(UsageGauge::class, $item), + $data['gauges'] + ) + : $data['gauges'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + 'total' => static::serializeValue($this->total), + 'gauges' => static::serializeValue($this->gauges) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Services/Advisor.php b/src/Appwrite/Services/Advisor.php new file mode 100644 index 0000000..267ad1d --- /dev/null +++ b/src/Appwrite/Services/Advisor.php @@ -0,0 +1,217 @@ +client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\ReportList::from($response); + + } + + /** + * Get an analyzer report by its unique ID. The response includes the report's + * metadata and the nested insights it produced. + * + * + * @param string $reportId + * @throws AppwriteException + * @return \Appwrite\Models\Report + */ + public function getReport(string $reportId): \Appwrite\Models\Report + { + $apiPath = str_replace( + ['{reportId}'], + [$reportId], + '/reports/{reportId}' + ); + + $apiParams = []; + $apiParams['reportId'] = $reportId; + + $apiHeaders = []; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Report::from($response); + + } + + /** + * Delete an analyzer report by its unique ID. Nested insights and CTA + * metadata are removed asynchronously by the deletes worker. + * + * + * @param string $reportId + * @throws AppwriteException + * @return string + */ + public function deleteReport(string $reportId): string + { + $apiPath = str_replace( + ['{reportId}'], + [$reportId], + '/reports/{reportId}' + ); + + $apiParams = []; + $apiParams['reportId'] = $reportId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + + return $response; + + } + + /** + * List the insights produced under a single analyzer report. You can use the + * query params to filter your results further. + * + * + * @param string $reportId + * @param ?array $queries + * @param ?bool $total + * @throws AppwriteException + * @return \Appwrite\Models\InsightList + */ + public function listInsights(string $reportId, ?array $queries = null, ?bool $total = null): \Appwrite\Models\InsightList + { + $apiPath = str_replace( + ['{reportId}'], + [$reportId], + '/reports/{reportId}/insights' + ); + + $apiParams = []; + $apiParams['reportId'] = $reportId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($total)) { + $apiParams['total'] = $total; + } + + $apiHeaders = []; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\InsightList::from($response); + + } + + /** + * Get an insight by its unique ID, scoped to its parent report. + * + * + * @param string $reportId + * @param string $insightId + * @throws AppwriteException + * @return \Appwrite\Models\Insight + */ + public function getInsight(string $reportId, string $insightId): \Appwrite\Models\Insight + { + $apiPath = str_replace( + ['{reportId}', '{insightId}'], + [$reportId, $insightId], + '/reports/{reportId}/insights/{insightId}' + ); + + $apiParams = []; + $apiParams['reportId'] = $reportId; + $apiParams['insightId'] = $insightId; + + $apiHeaders = []; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Insight::from($response); + + } +} diff --git a/src/Appwrite/Services/Presences.php b/src/Appwrite/Services/Presences.php new file mode 100644 index 0000000..78e4306 --- /dev/null +++ b/src/Appwrite/Services/Presences.php @@ -0,0 +1,256 @@ +client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\PresenceList::from($response); + + } + + /** + * Get a presence log by its unique ID. Entries whose `expiresAt` is in the + * past are treated as not found. + * + * + * @param string $presenceId + * @throws AppwriteException + * @return \Appwrite\Models\Presence + */ + public function get(string $presenceId): \Appwrite\Models\Presence + { + $apiPath = str_replace( + ['{presenceId}'], + [$presenceId], + '/presences/{presenceId}' + ); + + $apiParams = []; + $apiParams['presenceId'] = $presenceId; + + $apiHeaders = []; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Presence::from($response); + + } + + /** + * Create or update a presence log by its user ID. + * + * + * @param string $presenceId + * @param string $userId + * @param string $status + * @param ?array $permissions + * @param ?string $expiresAt + * @param ?array $metadata + * @throws AppwriteException + * @return \Appwrite\Models\Presence + */ + public function upsert(string $presenceId, string $userId, string $status, ?array $permissions = null, ?string $expiresAt = null, ?array $metadata = null): \Appwrite\Models\Presence + { + $apiPath = str_replace( + ['{presenceId}'], + [$presenceId], + '/presences/{presenceId}' + ); + + $apiParams = []; + $apiParams['presenceId'] = $presenceId; + $apiParams['userId'] = $userId; + $apiParams['status'] = $status; + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + if (!is_null($expiresAt)) { + $apiParams['expiresAt'] = $expiresAt; + } + + if (!is_null($metadata)) { + $apiParams['metadata'] = $metadata; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Presence::from($response); + + } + + /** + * Update a presence log by its unique ID. Using the patch method you can pass + * only specific fields that will get updated. + * + * + * @param string $presenceId + * @param string $userId + * @param ?string $status + * @param ?string $expiresAt + * @param ?array $metadata + * @param ?array $permissions + * @param ?bool $purge + * @throws AppwriteException + * @return \Appwrite\Models\Presence + */ + public function updatePresence(string $presenceId, string $userId, ?string $status = null, ?string $expiresAt = null, ?array $metadata = null, ?array $permissions = null, ?bool $purge = null): \Appwrite\Models\Presence + { + $apiPath = str_replace( + ['{presenceId}'], + [$presenceId], + '/presences/{presenceId}' + ); + + $apiParams = []; + $apiParams['presenceId'] = $presenceId; + $apiParams['userId'] = $userId; + + if (!is_null($status)) { + $apiParams['status'] = $status; + } + + if (!is_null($expiresAt)) { + $apiParams['expiresAt'] = $expiresAt; + } + + if (!is_null($metadata)) { + $apiParams['metadata'] = $metadata; + } + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + if (!is_null($purge)) { + $apiParams['purge'] = $purge; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Presence::from($response); + + } + + /** + * Delete a presence log by its unique ID. + * + * + * @param string $presenceId + * @throws AppwriteException + * @return string + */ + public function delete(string $presenceId): string + { + $apiPath = str_replace( + ['{presenceId}'], + [$presenceId], + '/presences/{presenceId}' + ); + + $apiParams = []; + $apiParams['presenceId'] = $presenceId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + + return $response; + + } +} diff --git a/src/Appwrite/Services/Project.php b/src/Appwrite/Services/Project.php index d88b8d2..7d2ec31 100644 --- a/src/Appwrite/Services/Project.php +++ b/src/Appwrite/Services/Project.php @@ -6,15 +6,16 @@ use Appwrite\Client; use Appwrite\Service; use Appwrite\InputFile; -use Appwrite\Enums\AuthMethod; -use Appwrite\Enums\Scopes; -use Appwrite\Enums\OAuthProvider; -use Appwrite\Enums\ProjectPolicy; -use Appwrite\Enums\ProtocolId; -use Appwrite\Enums\ServiceId; -use Appwrite\Enums\Secure; -use Appwrite\Enums\EmailTemplateType; -use Appwrite\Enums\EmailTemplateLocale; +use Appwrite\Enums\ProjectAuthMethodId; +use Appwrite\Enums\ProjectKeyScopes; +use Appwrite\Enums\ProjectOAuth2GooglePrompt; +use Appwrite\Enums\ProjectOAuthProviderId; +use Appwrite\Enums\ProjectPolicyId; +use Appwrite\Enums\ProjectProtocolId; +use Appwrite\Enums\ProjectServiceId; +use Appwrite\Enums\ProjectSMTPSecure; +use Appwrite\Enums\ProjectEmailTemplateId; +use Appwrite\Enums\ProjectEmailTemplateLocale; class Project extends Service { @@ -23,6 +24,39 @@ public function __construct(Client $client) parent::__construct($client); } + /** + * Get a project. + * + * @throws AppwriteException + * @return \Appwrite\Models\Project + */ + public function get(): \Appwrite\Models\Project + { + $apiPath = str_replace( + [], + [], + '/project' + ); + + $apiParams = []; + + $apiHeaders = []; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Project::from($response); + + } + /** * Delete a project. * @@ -57,12 +91,12 @@ public function delete(): string * Update properties of a specific auth method. Use this endpoint to enable or * disable a method in your project. * - * @param AuthMethod $methodId + * @param ProjectAuthMethodId $methodId * @param bool $enabled * @throws AppwriteException * @return \Appwrite\Models\Project */ - public function updateAuthMethod(AuthMethod $methodId, bool $enabled): \Appwrite\Models\Project + public function updateAuthMethod(ProjectAuthMethodId $methodId, bool $enabled): \Appwrite\Models\Project { $apiPath = str_replace( ['{methodId}'], @@ -1344,11 +1378,12 @@ public function updateOAuth2Gitlab(?string $applicationId = null, ?string $secre * * @param ?string $clientId * @param ?string $clientSecret + * @param ?array $prompt * @param ?bool $enabled * @throws AppwriteException * @return \Appwrite\Models\OAuth2Google */ - public function updateOAuth2Google(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Google + public function updateOAuth2Google(?string $clientId = null, ?string $clientSecret = null, ?array $prompt = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Google { $apiPath = str_replace( [], @@ -1359,6 +1394,7 @@ public function updateOAuth2Google(?string $clientId = null, ?string $clientSecr $apiParams = []; $apiParams['clientId'] = $clientId; $apiParams['clientSecret'] = $clientSecret; + $apiParams['prompt'] = $prompt; $apiParams['enabled'] = $enabled; $apiHeaders = []; @@ -2321,11 +2357,11 @@ public function updateOAuth2Zoom(?string $clientId = null, ?string $clientSecret * Get a single OAuth2 provider configuration. Credential fields (client * secret, p8 file, key/team IDs) are write-only and always returned empty. * - * @param OAuthProvider $providerId + * @param ProjectOAuthProviderId $providerId * @throws AppwriteException * @return \Appwrite\Models\OAuth2Github|\Appwrite\Models\OAuth2Discord|\Appwrite\Models\OAuth2Figma|\Appwrite\Models\OAuth2Dropbox|\Appwrite\Models\OAuth2Dailymotion|\Appwrite\Models\OAuth2Bitbucket|\Appwrite\Models\OAuth2Bitly|\Appwrite\Models\OAuth2Box|\Appwrite\Models\OAuth2Autodesk|\Appwrite\Models\OAuth2Google|\Appwrite\Models\OAuth2Zoom|\Appwrite\Models\OAuth2Zoho|\Appwrite\Models\OAuth2Yandex|\Appwrite\Models\OAuth2X|\Appwrite\Models\OAuth2WordPress|\Appwrite\Models\OAuth2Twitch|\Appwrite\Models\OAuth2Stripe|\Appwrite\Models\OAuth2Spotify|\Appwrite\Models\OAuth2Slack|\Appwrite\Models\OAuth2Podio|\Appwrite\Models\OAuth2Notion|\Appwrite\Models\OAuth2Salesforce|\Appwrite\Models\OAuth2Yahoo|\Appwrite\Models\OAuth2Linkedin|\Appwrite\Models\OAuth2Disqus|\Appwrite\Models\OAuth2Amazon|\Appwrite\Models\OAuth2Etsy|\Appwrite\Models\OAuth2Facebook|\Appwrite\Models\OAuth2Tradeshift|\Appwrite\Models\OAuth2Paypal|\Appwrite\Models\OAuth2Gitlab|\Appwrite\Models\OAuth2Authentik|\Appwrite\Models\OAuth2Auth0|\Appwrite\Models\OAuth2FusionAuth|\Appwrite\Models\OAuth2Keycloak|\Appwrite\Models\OAuth2Oidc|\Appwrite\Models\OAuth2Apple|\Appwrite\Models\OAuth2Okta|\Appwrite\Models\OAuth2Kick|\Appwrite\Models\OAuth2Microsoft */ - public function getOAuth2Provider(OAuthProvider $providerId): \Appwrite\Models\OAuth2Github|\Appwrite\Models\OAuth2Discord|\Appwrite\Models\OAuth2Figma|\Appwrite\Models\OAuth2Dropbox|\Appwrite\Models\OAuth2Dailymotion|\Appwrite\Models\OAuth2Bitbucket|\Appwrite\Models\OAuth2Bitly|\Appwrite\Models\OAuth2Box|\Appwrite\Models\OAuth2Autodesk|\Appwrite\Models\OAuth2Google|\Appwrite\Models\OAuth2Zoom|\Appwrite\Models\OAuth2Zoho|\Appwrite\Models\OAuth2Yandex|\Appwrite\Models\OAuth2X|\Appwrite\Models\OAuth2WordPress|\Appwrite\Models\OAuth2Twitch|\Appwrite\Models\OAuth2Stripe|\Appwrite\Models\OAuth2Spotify|\Appwrite\Models\OAuth2Slack|\Appwrite\Models\OAuth2Podio|\Appwrite\Models\OAuth2Notion|\Appwrite\Models\OAuth2Salesforce|\Appwrite\Models\OAuth2Yahoo|\Appwrite\Models\OAuth2Linkedin|\Appwrite\Models\OAuth2Disqus|\Appwrite\Models\OAuth2Amazon|\Appwrite\Models\OAuth2Etsy|\Appwrite\Models\OAuth2Facebook|\Appwrite\Models\OAuth2Tradeshift|\Appwrite\Models\OAuth2Paypal|\Appwrite\Models\OAuth2Gitlab|\Appwrite\Models\OAuth2Authentik|\Appwrite\Models\OAuth2Auth0|\Appwrite\Models\OAuth2FusionAuth|\Appwrite\Models\OAuth2Keycloak|\Appwrite\Models\OAuth2Oidc|\Appwrite\Models\OAuth2Apple|\Appwrite\Models\OAuth2Okta|\Appwrite\Models\OAuth2Kick|\Appwrite\Models\OAuth2Microsoft + public function getOAuth2Provider(ProjectOAuthProviderId $providerId): \Appwrite\Models\OAuth2Github|\Appwrite\Models\OAuth2Discord|\Appwrite\Models\OAuth2Figma|\Appwrite\Models\OAuth2Dropbox|\Appwrite\Models\OAuth2Dailymotion|\Appwrite\Models\OAuth2Bitbucket|\Appwrite\Models\OAuth2Bitly|\Appwrite\Models\OAuth2Box|\Appwrite\Models\OAuth2Autodesk|\Appwrite\Models\OAuth2Google|\Appwrite\Models\OAuth2Zoom|\Appwrite\Models\OAuth2Zoho|\Appwrite\Models\OAuth2Yandex|\Appwrite\Models\OAuth2X|\Appwrite\Models\OAuth2WordPress|\Appwrite\Models\OAuth2Twitch|\Appwrite\Models\OAuth2Stripe|\Appwrite\Models\OAuth2Spotify|\Appwrite\Models\OAuth2Slack|\Appwrite\Models\OAuth2Podio|\Appwrite\Models\OAuth2Notion|\Appwrite\Models\OAuth2Salesforce|\Appwrite\Models\OAuth2Yahoo|\Appwrite\Models\OAuth2Linkedin|\Appwrite\Models\OAuth2Disqus|\Appwrite\Models\OAuth2Amazon|\Appwrite\Models\OAuth2Etsy|\Appwrite\Models\OAuth2Facebook|\Appwrite\Models\OAuth2Tradeshift|\Appwrite\Models\OAuth2Paypal|\Appwrite\Models\OAuth2Gitlab|\Appwrite\Models\OAuth2Authentik|\Appwrite\Models\OAuth2Auth0|\Appwrite\Models\OAuth2FusionAuth|\Appwrite\Models\OAuth2Keycloak|\Appwrite\Models\OAuth2Oidc|\Appwrite\Models\OAuth2Apple|\Appwrite\Models\OAuth2Okta|\Appwrite\Models\OAuth2Kick|\Appwrite\Models\OAuth2Microsoft { $apiPath = str_replace( ['{providerId}'], @@ -3104,6 +3140,117 @@ public function listPolicies(?array $queries = null, ?bool $total = null): \Appw } + /** + * Configures if aliased emails such as subaddresses and emails with suffixes + * are denied during new users sign-ups and email updates. + * + * @param bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\Project + */ + public function updateDenyAliasedEmailPolicy(bool $enabled): \Appwrite\Models\Project + { + $apiPath = str_replace( + [], + [], + '/project/policies/deny-aliased-email' + ); + + $apiParams = []; + $apiParams['enabled'] = $enabled; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Project::from($response); + + } + + /** + * Configures if disposable emails from known temporary domains are denied + * during new users sign-ups and email updates. + * + * @param bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\Project + */ + public function updateDenyDisposableEmailPolicy(bool $enabled): \Appwrite\Models\Project + { + $apiPath = str_replace( + [], + [], + '/project/policies/deny-disposable-email' + ); + + $apiParams = []; + $apiParams['enabled'] = $enabled; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Project::from($response); + + } + + /** + * Configures if emails from free providers such as Gmail or Yahoo are denied + * during new users sign-ups and email updates. + * + * @param bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\Project + */ + public function updateDenyFreeEmailPolicy(bool $enabled): \Appwrite\Models\Project + { + $apiPath = str_replace( + [], + [], + '/project/policies/deny-free-email' + ); + + $apiParams = []; + $apiParams['enabled'] = $enabled; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Project::from($response); + + } + /** * Updating this policy allows you to control if team members can see other * members information. When enabled, all team members can see ID, name, @@ -3480,11 +3627,11 @@ public function updateUserLimitPolicy(?int $total): \Appwrite\Models\Project * Get a policy by its unique ID. This endpoint returns the current * configuration for the requested project policy. * - * @param ProjectPolicy $policyId + * @param ProjectPolicyId $policyId * @throws AppwriteException * @return \Appwrite\Models\PolicyPasswordDictionary|\Appwrite\Models\PolicyPasswordHistory|\Appwrite\Models\PolicyPasswordPersonalData|\Appwrite\Models\PolicySessionAlert|\Appwrite\Models\PolicySessionDuration|\Appwrite\Models\PolicySessionInvalidation|\Appwrite\Models\PolicySessionLimit|\Appwrite\Models\PolicyUserLimit|\Appwrite\Models\PolicyMembershipPrivacy */ - public function getPolicy(ProjectPolicy $policyId): \Appwrite\Models\PolicyPasswordDictionary|\Appwrite\Models\PolicyPasswordHistory|\Appwrite\Models\PolicyPasswordPersonalData|\Appwrite\Models\PolicySessionAlert|\Appwrite\Models\PolicySessionDuration|\Appwrite\Models\PolicySessionInvalidation|\Appwrite\Models\PolicySessionLimit|\Appwrite\Models\PolicyUserLimit|\Appwrite\Models\PolicyMembershipPrivacy + public function getPolicy(ProjectPolicyId $policyId): \Appwrite\Models\PolicyPasswordDictionary|\Appwrite\Models\PolicyPasswordHistory|\Appwrite\Models\PolicyPasswordPersonalData|\Appwrite\Models\PolicySessionAlert|\Appwrite\Models\PolicySessionDuration|\Appwrite\Models\PolicySessionInvalidation|\Appwrite\Models\PolicySessionLimit|\Appwrite\Models\PolicyUserLimit|\Appwrite\Models\PolicyMembershipPrivacy { $apiPath = str_replace( ['{policyId}'], @@ -3552,12 +3699,12 @@ public function getPolicy(ProjectPolicy $policyId): \Appwrite\Models\PolicyPassw * Update properties of a specific protocol. Use this endpoint to enable or * disable a protocol in your project. * - * @param ProtocolId $protocolId + * @param ProjectProtocolId $protocolId * @param bool $enabled * @throws AppwriteException * @return \Appwrite\Models\Project */ - public function updateProtocol(ProtocolId $protocolId, bool $enabled): \Appwrite\Models\Project + public function updateProtocol(ProjectProtocolId $protocolId, bool $enabled): \Appwrite\Models\Project { $apiPath = str_replace( ['{protocolId}'], @@ -3591,12 +3738,12 @@ public function updateProtocol(ProtocolId $protocolId, bool $enabled): \Appwrite * Update properties of a specific service. Use this endpoint to enable or * disable a service in your project. * - * @param ServiceId $serviceId + * @param ProjectServiceId $serviceId * @param bool $enabled * @throws AppwriteException * @return \Appwrite\Models\Project */ - public function updateService(ServiceId $serviceId, bool $enabled): \Appwrite\Models\Project + public function updateService(ProjectServiceId $serviceId, bool $enabled): \Appwrite\Models\Project { $apiPath = str_replace( ['{serviceId}'], @@ -3639,12 +3786,12 @@ public function updateService(ServiceId $serviceId, bool $enabled): \Appwrite\Mo * @param ?string $senderName * @param ?string $replyToEmail * @param ?string $replyToName - * @param ?Secure $secure + * @param ?ProjectSMTPSecure $secure * @param ?bool $enabled * @throws AppwriteException * @return \Appwrite\Models\Project */ - public function updateSMTP(?string $host = null, ?int $port = null, ?string $username = null, ?string $password = null, ?string $senderEmail = null, ?string $senderName = null, ?string $replyToEmail = null, ?string $replyToName = null, ?Secure $secure = null, ?bool $enabled = null): \Appwrite\Models\Project + public function updateSMTP(?string $host = null, ?int $port = null, ?string $username = null, ?string $password = null, ?string $senderEmail = null, ?string $senderName = null, ?string $replyToEmail = null, ?string $replyToName = null, ?ProjectSMTPSecure $secure = null, ?bool $enabled = null): \Appwrite\Models\Project { $apiPath = str_replace( [], @@ -3763,8 +3910,8 @@ public function listEmailTemplates(?array $queries = null, ?bool $total = null): * Update a custom email template for the specified locale and type. Use this * endpoint to modify the content of your email templates. * - * @param EmailTemplateType $templateId - * @param ?EmailTemplateLocale $locale + * @param ProjectEmailTemplateId $templateId + * @param ?ProjectEmailTemplateLocale $locale * @param ?string $subject * @param ?string $message * @param ?string $senderName @@ -3774,7 +3921,7 @@ public function listEmailTemplates(?array $queries = null, ?bool $total = null): * @throws AppwriteException * @return \Appwrite\Models\EmailTemplate */ - public function updateEmailTemplate(EmailTemplateType $templateId, ?EmailTemplateLocale $locale = null, ?string $subject = null, ?string $message = null, ?string $senderName = null, ?string $senderEmail = null, ?string $replyToEmail = null, ?string $replyToName = null): \Appwrite\Models\EmailTemplate + public function updateEmailTemplate(ProjectEmailTemplateId $templateId, ?ProjectEmailTemplateLocale $locale = null, ?string $subject = null, ?string $message = null, ?string $senderName = null, ?string $senderEmail = null, ?string $replyToEmail = null, ?string $replyToName = null): \Appwrite\Models\EmailTemplate { $apiPath = str_replace( [], @@ -3818,12 +3965,12 @@ public function updateEmailTemplate(EmailTemplateType $templateId, ?EmailTemplat * endpoint returns the template content, subject, and other configuration * details. * - * @param EmailTemplateType $templateId - * @param ?EmailTemplateLocale $locale + * @param ProjectEmailTemplateId $templateId + * @param ?ProjectEmailTemplateLocale $locale * @throws AppwriteException * @return \Appwrite\Models\EmailTemplate */ - public function getEmailTemplate(EmailTemplateType $templateId, ?EmailTemplateLocale $locale = null): \Appwrite\Models\EmailTemplate + public function getEmailTemplate(ProjectEmailTemplateId $templateId, ?ProjectEmailTemplateLocale $locale = null): \Appwrite\Models\EmailTemplate { $apiPath = str_replace( ['{templateId}'], diff --git a/src/Appwrite/Services/Usage.php b/src/Appwrite/Services/Usage.php new file mode 100644 index 0000000..75da953 --- /dev/null +++ b/src/Appwrite/Services/Usage.php @@ -0,0 +1,123 @@ +client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\UsageEventList::from($response); + + } + + /** + * Query usage gauge metrics (point-in-time resource snapshots) from the usage + * database. Returns individual gauge snapshots with metric, value, and + * timestamp. Pass Query objects as JSON strings to filter, paginate, and + * order results. Supported query methods: equal, greaterThanEqual, + * lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter + * attributes: metric, time. Use `orderDesc("time"), limit(1)` to fetch the + * most recent snapshot. When no time filter is supplied the endpoint defaults + * to the last 7 days. Default `limit(100)` is applied if none is given; + * user-supplied limits are capped at 500. The `total` field is capped at 5000 + * to keep counts predictable — pass `total=false` to skip the count + * entirely. + * + * @param ?array $queries + * @param ?bool $total + * @throws AppwriteException + * @return \Appwrite\Models\UsageGaugeList + */ + public function listGauges(?array $queries = null, ?bool $total = null): \Appwrite\Models\UsageGaugeList + { + $apiPath = str_replace( + [], + [], + '/usage/gauges' + ); + + $apiParams = []; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($total)) { + $apiParams['total'] = $total; + } + + $apiHeaders = []; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\UsageGaugeList::from($response); + + } +} diff --git a/tests/Appwrite/Services/AdvisorTest.php b/tests/Appwrite/Services/AdvisorTest.php new file mode 100644 index 0000000..fc42f64 --- /dev/null +++ b/tests/Appwrite/Services/AdvisorTest.php @@ -0,0 +1,221 @@ +client = Mockery::mock(Client::class); + $this->advisor = new Advisor($this->client); + } + + public function testMethodListReports(): void + { + $data = array( + "total" => 5, + "reports" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "appId" => "5e5ea5c16897e", + "type" => "lighthouse", + "title" => "Lighthouse audit for https://appwrite.io/", + "summary" => "Performance score 78. 4 opportunities found.", + "targetType" => "urls", + "target" => "https://appwrite.io/", + "categories" => array(), + "insights" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "reportId" => "5e5ea5c16897e", + "type" => "tablesDBIndex", + "severity" => "warning", + "status" => "active", + "resourceType" => "databases", + "resourceId" => "main", + "parentResourceType" => "tables", + "parentResourceId" => "orders", + "title" => "Missing index on collection orders", + "summary" => "Queries against `orders.status` are scanning the full collection.", + "ctas" => array( + array( + "label" => "Create missing index", + "service" => "tablesDB", + "method" => "createIndex", + "params" => array() + ) + ) + ) + ) + ) + ) + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->advisor->listReports(); + + $this->assertInstanceOf(\Appwrite\Models\ReportList::class, $response); + } + + public function testMethodGetReport(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "appId" => "5e5ea5c16897e", + "type" => "lighthouse", + "title" => "Lighthouse audit for https://appwrite.io/", + "summary" => "Performance score 78. 4 opportunities found.", + "targetType" => "urls", + "target" => "https://appwrite.io/", + "categories" => array(), + "insights" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "reportId" => "5e5ea5c16897e", + "type" => "tablesDBIndex", + "severity" => "warning", + "status" => "active", + "resourceType" => "databases", + "resourceId" => "main", + "parentResourceType" => "tables", + "parentResourceId" => "orders", + "title" => "Missing index on collection orders", + "summary" => "Queries against `orders.status` are scanning the full collection.", + "ctas" => array( + array( + "label" => "Create missing index", + "service" => "tablesDB", + "method" => "createIndex", + "params" => array() + ) + ) + ) + ) + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->advisor->getReport( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Report::class, $response); + } + + public function testMethodDeleteReport(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->advisor->deleteReport( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListInsights(): void + { + $data = array( + "total" => 5, + "insights" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "reportId" => "5e5ea5c16897e", + "type" => "tablesDBIndex", + "severity" => "warning", + "status" => "active", + "resourceType" => "databases", + "resourceId" => "main", + "parentResourceType" => "tables", + "parentResourceId" => "orders", + "title" => "Missing index on collection orders", + "summary" => "Queries against `orders.status` are scanning the full collection.", + "ctas" => array( + array( + "label" => "Create missing index", + "service" => "tablesDB", + "method" => "createIndex", + "params" => array() + ) + ) + ) + ) + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->advisor->listInsights( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\InsightList::class, $response); + } + + public function testMethodGetInsight(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "reportId" => "5e5ea5c16897e", + "type" => "tablesDBIndex", + "severity" => "warning", + "status" => "active", + "resourceType" => "databases", + "resourceId" => "main", + "parentResourceType" => "tables", + "parentResourceId" => "orders", + "title" => "Missing index on collection orders", + "summary" => "Queries against `orders.status` are scanning the full collection.", + "ctas" => array( + array( + "label" => "Create missing index", + "service" => "tablesDB", + "method" => "createIndex", + "params" => array() + ) + ) + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->advisor->getInsight( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Insight::class, $response); + } + +} diff --git a/tests/Appwrite/Services/DatabasesTest.php b/tests/Appwrite/Services/DatabasesTest.php index caddb3e..3e2883c 100644 --- a/tests/Appwrite/Services/DatabasesTest.php +++ b/tests/Appwrite/Services/DatabasesTest.php @@ -37,14 +37,14 @@ public function testMethodList(): void "policies" => array( array( "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(), - "lengths" => array() + "services" => array(), + "resources" => array(), + "retention" => 7, + "schedule" => "0 * * * *", + "enabled" => true ) ), "archives" => array( @@ -52,27 +52,13 @@ public function testMethodList(): void "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "databaseId" => "5e5ea5c16897e", - "name" => "My Collection", - "enabled" => true, - "documentSecurity" => true, - "attributes" => array(), - "indexes" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(), - "lengths" => array() - ) - ), - "bytesMax" => 65535, - "bytesUsed" => 1500 + "policyId" => "did8jx6ws45jana098ab7", + "size" => 100000, + "status" => "completed", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "migrationId" => "did8jx6ws45jana098ab7", + "services" => array(), + "resources" => array() ) ) ) @@ -100,14 +86,14 @@ public function testMethodCreate(): void "policies" => array( array( "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(), - "lengths" => array() + "services" => array(), + "resources" => array(), + "retention" => 7, + "schedule" => "0 * * * *", + "enabled" => true ) ), "archives" => array( @@ -115,27 +101,13 @@ public function testMethodCreate(): void "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "databaseId" => "5e5ea5c16897e", - "name" => "My Collection", - "enabled" => true, - "documentSecurity" => true, - "attributes" => array(), - "indexes" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(), - "lengths" => array() - ) - ), - "bytesMax" => 65535, - "bytesUsed" => 1500 + "policyId" => "did8jx6ws45jana098ab7", + "size" => 100000, + "status" => "completed", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "migrationId" => "did8jx6ws45jana098ab7", + "services" => array(), + "resources" => array() ) ) ); @@ -290,14 +262,14 @@ public function testMethodGet(): void "policies" => array( array( "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(), - "lengths" => array() + "services" => array(), + "resources" => array(), + "retention" => 7, + "schedule" => "0 * * * *", + "enabled" => true ) ), "archives" => array( @@ -305,27 +277,13 @@ public function testMethodGet(): void "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "databaseId" => "5e5ea5c16897e", - "name" => "My Collection", - "enabled" => true, - "documentSecurity" => true, - "attributes" => array(), - "indexes" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(), - "lengths" => array() - ) - ), - "bytesMax" => 65535, - "bytesUsed" => 1500 + "policyId" => "did8jx6ws45jana098ab7", + "size" => 100000, + "status" => "completed", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "migrationId" => "did8jx6ws45jana098ab7", + "services" => array(), + "resources" => array() ) ) ); @@ -353,14 +311,14 @@ public function testMethodUpdate(): void "policies" => array( array( "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(), - "lengths" => array() + "services" => array(), + "resources" => array(), + "retention" => 7, + "schedule" => "0 * * * *", + "enabled" => true ) ), "archives" => array( @@ -368,27 +326,13 @@ public function testMethodUpdate(): void "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "databaseId" => "5e5ea5c16897e", - "name" => "My Collection", - "enabled" => true, - "documentSecurity" => true, - "attributes" => array(), - "indexes" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(), - "lengths" => array() - ) - ), - "bytesMax" => 65535, - "bytesUsed" => 1500 + "policyId" => "did8jx6ws45jana098ab7", + "size" => 100000, + "status" => "completed", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "migrationId" => "did8jx6ws45jana098ab7", + "services" => array(), + "resources" => array() ) ) ); diff --git a/tests/Appwrite/Services/PresencesTest.php b/tests/Appwrite/Services/PresencesTest.php new file mode 100644 index 0000000..28201ac --- /dev/null +++ b/tests/Appwrite/Services/PresencesTest.php @@ -0,0 +1,130 @@ +client = Mockery::mock(Client::class); + $this->presences = new Presences($this->client); + } + + public function testMethodList(): void + { + $data = array( + "total" => 5, + "presences" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "userId" => "674af8f3e12a5f9ac0be", + "source" => "HTTP" + ) + ) + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->presences->list(); + + $this->assertInstanceOf(\Appwrite\Models\PresenceList::class, $response); + } + + public function testMethodGet(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "userId" => "674af8f3e12a5f9ac0be", + "source" => "HTTP" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->presences->get( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Presence::class, $response); + } + + public function testMethodUpsert(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "userId" => "674af8f3e12a5f9ac0be", + "source" => "HTTP" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->presences->upsert( + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Presence::class, $response); + } + + public function testMethodUpdatePresence(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "userId" => "674af8f3e12a5f9ac0be", + "source" => "HTTP" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->presences->updatePresence( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Presence::class, $response); + } + + public function testMethodDelete(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->presences->delete( + "" + ); + + $this->assertSame($data, $response); + } + +} diff --git a/tests/Appwrite/Services/ProjectTest.php b/tests/Appwrite/Services/ProjectTest.php index 1f8dc1b..eb0a579 100644 --- a/tests/Appwrite/Services/ProjectTest.php +++ b/tests/Appwrite/Services/ProjectTest.php @@ -6,15 +6,16 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; -use Appwrite\Enums\AuthMethod; -use Appwrite\Enums\Scopes; -use Appwrite\Enums\OAuthProvider; -use Appwrite\Enums\ProjectPolicy; -use Appwrite\Enums\ProtocolId; -use Appwrite\Enums\ServiceId; -use Appwrite\Enums\Secure; -use Appwrite\Enums\EmailTemplateType; -use Appwrite\Enums\EmailTemplateLocale; +use Appwrite\Enums\ProjectAuthMethodId; +use Appwrite\Enums\ProjectKeyScopes; +use Appwrite\Enums\ProjectOAuth2GooglePrompt; +use Appwrite\Enums\ProjectOAuthProviderId; +use Appwrite\Enums\ProjectPolicyId; +use Appwrite\Enums\ProjectProtocolId; +use Appwrite\Enums\ProjectServiceId; +use Appwrite\Enums\ProjectSMTPSecure; +use Appwrite\Enums\ProjectEmailTemplateId; +use Appwrite\Enums\ProjectEmailTemplateLocale; final class ProjectTest extends TestCase { @@ -27,100 +28,114 @@ protected function setUp(): void $this->project = new Project($this->client); } - public function testMethodDelete(): void - { - $data = ''; - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->project->delete(); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateAuthMethod(): void + public function testMethodGet(): void { $data = array( "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "name" => "New Project", - "description" => "This is a new project.", "teamId" => "1592981250", - "logo" => "5f5c451b403cb", - "url" => "5f5c451b403cb", - "legalName" => "Company LTD.", - "legalCountry" => "US", - "legalState" => "New York", - "legalCity" => "New York City.", - "legalAddress" => "620 Eighth Avenue, New York, NY 10018", - "legalTaxId" => "131102020", - "authDuration" => 60, - "authLimit" => 100, - "authSessionsLimit" => 10, - "authPasswordHistory" => 5, - "authPasswordDictionary" => true, - "authPersonalDataCheck" => true, - "authDisposableEmails" => true, - "authCanonicalEmails" => true, - "authFreeEmails" => true, - "authMockNumbers" => array( + "devKeys" => array( array( - "number" => "+1612842323", - "otp" => "123456", + "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Dev API Key", + "expire" => "2020-10-15T06:38:00.000+00:00", + "secret" => "919c2d18fb5d4...a2ae413da83346ad2", + "accessedAt" => "2020-10-15T06:38:00.000+00:00", + "sdks" => array() + ) + ), + "smtpEnabled" => true, + "smtpSenderName" => "John Appwrite", + "smtpSenderEmail" => "john@appwrite.io", + "smtpReplyToName" => "Support Team", + "smtpReplyToEmail" => "support@appwrite.io", + "smtpHost" => "mail.appwrite.io", + "smtpPort" => 25, + "smtpUsername" => "emailuser", + "smtpPassword" => "[SMTPPASSWORD]", + "smtpSecure" => "tls", + "pingCount" => 1, + "pingedAt" => "2020-10-15T06:38:00.000+00:00", + "labels" => array(), + "status" => "active", + "authMethods" => array( + array( + "\$id" => "email-password", + "enabled" => true ) ), - "authSessionAlerts" => true, - "authMembershipsUserName" => true, - "authMembershipsUserEmail" => true, - "authMembershipsMfa" => true, - "authMembershipsUserId" => true, - "authMembershipsUserPhone" => true, - "authInvalidateSessions" => true, - "oAuthProviders" => array( + "services" => array( array( - "key" => "github", - "name" => "GitHub", - "appId" => "259125845563242502", - "secret" => "[SECRET]", + "\$id" => "account", "enabled" => true ) ), - "platforms" => array(), - "webhooks" => array( + "protocols" => array( array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Webhook", - "url" => "https://example.com/webhook", - "events" => array(), - "tls" => true, - "authUsername" => "username", - "authPassword" => "password", - "secret" => "ad3d581ca230e2b7059c545e5a", - "enabled" => true, - "logs" => "Failed to connect to remote server.", - "attempts" => 10 + "\$id" => "rest", + "enabled" => true ) ), - "keys" => array( + "region" => "fra", + "billingLimits" => array( + "bandwidth" => 5, + "storage" => 150, + "users" => 200000, + "executions" => 750000, + "GBHours" => 100, + "imageTransformations" => 100, + "authPhone" => 10, + "budgetLimit" => 100 + ), + "blocks" => array( array( - "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My API Key", - "expire" => "2020-10-15T06:38:00.000+00:00", - "scopes" => array(), - "secret" => "919c2d18fb5d4...a2ae413da83346ad2", - "accessedAt" => "2020-10-15T06:38:00.000+00:00", - "sdks" => array() + "resourceType" => "project", + "resourceId" => "5e5ea5c16897e", + "projectName" => "My Project", + "region" => "fra", + "organizationName" => "Acme Inc.", + "organizationId" => "5e5ea5c16897e", + "billingPlan" => "pro" ) ), + "consoleAccessedAt" => "2020-10-15T06:38:00.000+00:00" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->get(); + + $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); + } + + public function testMethodDelete(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->delete(); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateAuthMethod(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "New Project", + "teamId" => "1592981250", "devKeys" => array( array( "\$id" => "5e5ea5c16897e", @@ -147,33 +162,24 @@ public function testMethodUpdateAuthMethod(): void "pingedAt" => "2020-10-15T06:38:00.000+00:00", "labels" => array(), "status" => "active", - "authEmailPassword" => true, - "authUsersAuthMagicURL" => true, - "authEmailOtp" => true, - "authAnonymous" => true, - "authInvites" => true, - "authJWT" => true, - "authPhone" => true, - "serviceStatusForAccount" => true, - "serviceStatusForAvatars" => true, - "serviceStatusForDatabases" => true, - "serviceStatusForTablesdb" => true, - "serviceStatusForLocale" => true, - "serviceStatusForHealth" => true, - "serviceStatusForProject" => true, - "serviceStatusForStorage" => true, - "serviceStatusForTeams" => true, - "serviceStatusForUsers" => true, - "serviceStatusForVcs" => true, - "serviceStatusForSites" => true, - "serviceStatusForFunctions" => true, - "serviceStatusForProxy" => true, - "serviceStatusForGraphql" => true, - "serviceStatusForMigrations" => true, - "serviceStatusForMessaging" => true, - "protocolStatusForRest" => true, - "protocolStatusForGraphql" => true, - "protocolStatusForWebsocket" => true, + "authMethods" => array( + array( + "\$id" => "email-password", + "enabled" => true + ) + ), + "services" => array( + array( + "\$id" => "account", + "enabled" => true + ) + ), + "protocols" => array( + array( + "\$id" => "rest", + "enabled" => true + ) + ), "region" => "fra", "billingLimits" => array( "bandwidth" => 5, @@ -205,7 +211,7 @@ public function testMethodUpdateAuthMethod(): void ->andReturn($data); $response = $this->project->updateAuthMethod( - AuthMethod::EMAILPASSWORD(), + ProjectAuthMethodId::EMAILPASSWORD(), true ); @@ -261,7 +267,7 @@ public function testMethodCreateKey(): void $response = $this->project->createKey( "", "", - array(Scopes::PROJECTREAD()) + array(ProjectKeyScopes::PROJECTREAD()) ); $this->assertInstanceOf(\Appwrite\Models\Key::class, $response); @@ -286,7 +292,7 @@ public function testMethodCreateEphemeralKey(): void ->andReturn($data); $response = $this->project->createEphemeralKey( - array(Scopes::PROJECTREAD()), + array(ProjectKeyScopes::PROJECTREAD()), 1 ); @@ -339,7 +345,7 @@ public function testMethodUpdateKey(): void $response = $this->project->updateKey( "", "", - array(Scopes::PROJECTREAD()) + array(ProjectKeyScopes::PROJECTREAD()) ); $this->assertInstanceOf(\Appwrite\Models\Key::class, $response); @@ -367,80 +373,7 @@ public function testMethodUpdateLabels(): void "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "name" => "New Project", - "description" => "This is a new project.", "teamId" => "1592981250", - "logo" => "5f5c451b403cb", - "url" => "5f5c451b403cb", - "legalName" => "Company LTD.", - "legalCountry" => "US", - "legalState" => "New York", - "legalCity" => "New York City.", - "legalAddress" => "620 Eighth Avenue, New York, NY 10018", - "legalTaxId" => "131102020", - "authDuration" => 60, - "authLimit" => 100, - "authSessionsLimit" => 10, - "authPasswordHistory" => 5, - "authPasswordDictionary" => true, - "authPersonalDataCheck" => true, - "authDisposableEmails" => true, - "authCanonicalEmails" => true, - "authFreeEmails" => true, - "authMockNumbers" => array( - array( - "number" => "+1612842323", - "otp" => "123456", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" - ) - ), - "authSessionAlerts" => true, - "authMembershipsUserName" => true, - "authMembershipsUserEmail" => true, - "authMembershipsMfa" => true, - "authMembershipsUserId" => true, - "authMembershipsUserPhone" => true, - "authInvalidateSessions" => true, - "oAuthProviders" => array( - array( - "key" => "github", - "name" => "GitHub", - "appId" => "259125845563242502", - "secret" => "[SECRET]", - "enabled" => true - ) - ), - "platforms" => array(), - "webhooks" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Webhook", - "url" => "https://example.com/webhook", - "events" => array(), - "tls" => true, - "authUsername" => "username", - "authPassword" => "password", - "secret" => "ad3d581ca230e2b7059c545e5a", - "enabled" => true, - "logs" => "Failed to connect to remote server.", - "attempts" => 10 - ) - ), - "keys" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My API Key", - "expire" => "2020-10-15T06:38:00.000+00:00", - "scopes" => array(), - "secret" => "919c2d18fb5d4...a2ae413da83346ad2", - "accessedAt" => "2020-10-15T06:38:00.000+00:00", - "sdks" => array() - ) - ), "devKeys" => array( array( "\$id" => "5e5ea5c16897e", @@ -467,33 +400,24 @@ public function testMethodUpdateLabels(): void "pingedAt" => "2020-10-15T06:38:00.000+00:00", "labels" => array(), "status" => "active", - "authEmailPassword" => true, - "authUsersAuthMagicURL" => true, - "authEmailOtp" => true, - "authAnonymous" => true, - "authInvites" => true, - "authJWT" => true, - "authPhone" => true, - "serviceStatusForAccount" => true, - "serviceStatusForAvatars" => true, - "serviceStatusForDatabases" => true, - "serviceStatusForTablesdb" => true, - "serviceStatusForLocale" => true, - "serviceStatusForHealth" => true, - "serviceStatusForProject" => true, - "serviceStatusForStorage" => true, - "serviceStatusForTeams" => true, - "serviceStatusForUsers" => true, - "serviceStatusForVcs" => true, - "serviceStatusForSites" => true, - "serviceStatusForFunctions" => true, - "serviceStatusForProxy" => true, - "serviceStatusForGraphql" => true, - "serviceStatusForMigrations" => true, - "serviceStatusForMessaging" => true, - "protocolStatusForRest" => true, - "protocolStatusForGraphql" => true, - "protocolStatusForWebsocket" => true, + "authMethods" => array( + array( + "\$id" => "email-password", + "enabled" => true + ) + ), + "services" => array( + array( + "\$id" => "account", + "enabled" => true + ) + ), + "protocols" => array( + array( + "\$id" => "rest", + "enabled" => true + ) + ), "region" => "fra", "billingLimits" => array( "bandwidth" => 5, @@ -653,7 +577,7 @@ public function testMethodUpdateOAuth2Amazon(): void "\$id" => "github", "enabled" => true, "clientId" => "amzn1.application-oa2-client.87400c00000000000000000000063d5b2", - "clientSecret" => "" + "clientSecret" => "79ffe4000000000000000000000000000000000000000000000000000002de55" ); $this->client @@ -691,7 +615,7 @@ public function testMethodUpdateOAuth2Auth0(): void "\$id" => "github", "enabled" => true, "clientId" => "OaOkIA000000000000000000005KLSYq", - "clientSecret" => "", + "clientSecret" => "zXz0000-00000000000000000000000000000-00000000000000000000PJafnF", "endpoint" => "example.us.auth0.com" ); @@ -710,7 +634,7 @@ public function testMethodUpdateOAuth2Authentik(): void "\$id" => "github", "enabled" => true, "clientId" => "dTKOPa0000000000000000000000000000e7G8hv", - "clientSecret" => "", + "clientSecret" => "ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK", "endpoint" => "example.authentik.com" ); @@ -729,7 +653,7 @@ public function testMethodUpdateOAuth2Autodesk(): void "\$id" => "github", "enabled" => true, "clientId" => "5zw90v00000000000000000000kVYXN7", - "clientSecret" => "" + "clientSecret" => "7I000000000000MW" ); $this->client @@ -747,7 +671,7 @@ public function testMethodUpdateOAuth2Bitbucket(): void "\$id" => "github", "enabled" => true, "key" => "Knt70000000000ByRc", - "secret" => "" + "secret" => "NMfLZJ00000000000000000000TLQdDx" ); $this->client @@ -765,7 +689,7 @@ public function testMethodUpdateOAuth2Bitly(): void "\$id" => "github", "enabled" => true, "clientId" => "d95151000000000000000000000000000067af9b", - "clientSecret" => "" + "clientSecret" => "a13e250000000000000000000000000000d73095" ); $this->client @@ -783,7 +707,7 @@ public function testMethodUpdateOAuth2Box(): void "\$id" => "github", "enabled" => true, "clientId" => "deglcs00000000000000000000x2og6y", - "clientSecret" => "" + "clientSecret" => "OKM1f100000000000000000000eshEif" ); $this->client @@ -801,7 +725,7 @@ public function testMethodUpdateOAuth2Dailymotion(): void "\$id" => "github", "enabled" => true, "apiKey" => "07a9000000000000067f", - "apiSecret" => "" + "apiSecret" => "a399a90000000000000000000000000000d90639" ); $this->client @@ -819,7 +743,7 @@ public function testMethodUpdateOAuth2Discord(): void "\$id" => "github", "enabled" => true, "clientId" => "950722000000343754", - "clientSecret" => "" + "clientSecret" => "YmPXnM000000000000000000002zFg5D" ); $this->client @@ -837,7 +761,7 @@ public function testMethodUpdateOAuth2Disqus(): void "\$id" => "github", "enabled" => true, "publicKey" => "cgegH70000000000000000000000000000000000000000000000000000Hr1nYX", - "secretKey" => "" + "secretKey" => "W7Bykj00000000000000000000000000000000000000000000000000003o43w9" ); $this->client @@ -855,7 +779,7 @@ public function testMethodUpdateOAuth2Dropbox(): void "\$id" => "github", "enabled" => true, "appKey" => "jl000000000009t", - "appSecret" => "" + "appSecret" => "g200000000000vw" ); $this->client @@ -873,7 +797,7 @@ public function testMethodUpdateOAuth2Etsy(): void "\$id" => "github", "enabled" => true, "keyString" => "nsgzxh0000000000008j85a2", - "sharedSecret" => "" + "sharedSecret" => "tp000000ru" ); $this->client @@ -891,7 +815,7 @@ public function testMethodUpdateOAuth2Facebook(): void "\$id" => "github", "enabled" => true, "appId" => "260600000007694", - "appSecret" => "" + "appSecret" => "2d0b2800000000000000000000d38af4" ); $this->client @@ -909,7 +833,7 @@ public function testMethodUpdateOAuth2Figma(): void "\$id" => "github", "enabled" => true, "clientId" => "byay5H0000000000VtiI40", - "clientSecret" => "" + "clientSecret" => "yEpOYn0000000000000000004iIsU5" ); $this->client @@ -927,7 +851,7 @@ public function testMethodUpdateOAuth2FusionAuth(): void "\$id" => "github", "enabled" => true, "clientId" => "b2222c00-0000-0000-0000-000000862097", - "clientSecret" => "", + "clientSecret" => "Jx4s0C0000000000000000000000000000000wGqLsc", "endpoint" => "example.fusionauth.io" ); @@ -946,7 +870,7 @@ public function testMethodUpdateOAuth2GitHub(): void "\$id" => "github", "enabled" => true, "clientId" => "e4d87900000000540733", - "clientSecret" => "" + "clientSecret" => "5e07c00000000000000000000000000000198bcc" ); $this->client @@ -964,7 +888,7 @@ public function testMethodUpdateOAuth2Gitlab(): void "\$id" => "github", "enabled" => true, "applicationId" => "d41ffe0000000000000000000000000000000000000000000000000000d5e252", - "secret" => "", + "secret" => "gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38", "endpoint" => "https://gitlab.com" ); @@ -983,7 +907,8 @@ public function testMethodUpdateOAuth2Google(): void "\$id" => "github", "enabled" => true, "clientId" => "120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com", - "clientSecret" => "" + "clientSecret" => "GOCSPX-2k8gsR0000000000000000VNahJj", + "prompt" => array() ); $this->client @@ -1001,7 +926,7 @@ public function testMethodUpdateOAuth2Keycloak(): void "\$id" => "github", "enabled" => true, "clientId" => "appwrite-o0000000st-app", - "clientSecret" => "", + "clientSecret" => "jdjrJd00000000000000000000HUsaZO", "endpoint" => "keycloak.example.com", "realmName" => "appwrite-realm" ); @@ -1021,7 +946,7 @@ public function testMethodUpdateOAuth2Kick(): void "\$id" => "github", "enabled" => true, "clientId" => "01KQ7C00000000000001MFHS32", - "clientSecret" => "" + "clientSecret" => "34ac5600000000000000000000000000000000000000000000000000e830c8b" ); $this->client @@ -1039,7 +964,7 @@ public function testMethodUpdateOAuth2Linkedin(): void "\$id" => "github", "enabled" => true, "clientId" => "770000000000dv", - "primaryClientSecret" => "" + "primaryClientSecret" => "WPL_AP1.2Bf0000000000000./HtlYw==" ); $this->client @@ -1057,7 +982,7 @@ public function testMethodUpdateOAuth2Microsoft(): void "\$id" => "github", "enabled" => true, "applicationId" => "00001111-aaaa-2222-bbbb-3333cccc4444", - "applicationSecret" => "", + "applicationSecret" => "A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u", "tenant" => "common" ); @@ -1076,7 +1001,7 @@ public function testMethodUpdateOAuth2Notion(): void "\$id" => "github", "enabled" => true, "oauthClientId" => "341d8700-0000-0000-0000-000000446ee3", - "oauthClientSecret" => "" + "oauthClientSecret" => "secret_dLUr4b000000000000000000000000000000lFHAa9" ); $this->client @@ -1094,7 +1019,7 @@ public function testMethodUpdateOAuth2Oidc(): void "\$id" => "github", "enabled" => true, "clientId" => "qibI2x0000000000000000000000000006L2YFoG", - "clientSecret" => "", + "clientSecret" => "Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV", "wellKnownURL" => "https://myoauth.com/.well-known/openid-configuration", "authorizationURL" => "https://myoauth.com/oauth2/authorize", "tokenURL" => "https://myoauth.com/oauth2/token", @@ -1116,7 +1041,7 @@ public function testMethodUpdateOAuth2Okta(): void "\$id" => "github", "enabled" => true, "clientId" => "0oa00000000000000698", - "clientSecret" => "", + "clientSecret" => "Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV", "domain" => "trial-6400025.okta.com", "authorizationServerId" => "aus000000000000000h7z" ); @@ -1136,7 +1061,7 @@ public function testMethodUpdateOAuth2Paypal(): void "\$id" => "github", "enabled" => true, "clientId" => "AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB", - "secretKey" => "" + "secretKey" => "EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp" ); $this->client @@ -1154,7 +1079,7 @@ public function testMethodUpdateOAuth2PaypalSandbox(): void "\$id" => "github", "enabled" => true, "clientId" => "AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB", - "secretKey" => "" + "secretKey" => "EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp" ); $this->client @@ -1172,7 +1097,7 @@ public function testMethodUpdateOAuth2Podio(): void "\$id" => "github", "enabled" => true, "clientId" => "appwrite-oauth-test-app", - "clientSecret" => "" + "clientSecret" => "Rn247T0000000000000000000000000000000000000000000000000000W2zWTN" ); $this->client @@ -1190,7 +1115,7 @@ public function testMethodUpdateOAuth2Salesforce(): void "\$id" => "github", "enabled" => true, "customerKey" => "3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq", - "customerSecret" => "" + "customerSecret" => "3w000000000000e2" ); $this->client @@ -1208,7 +1133,7 @@ public function testMethodUpdateOAuth2Slack(): void "\$id" => "github", "enabled" => true, "clientId" => "23000000089.15000000000023", - "clientSecret" => "" + "clientSecret" => "81656000000000000000000000f3d2fd" ); $this->client @@ -1226,7 +1151,7 @@ public function testMethodUpdateOAuth2Spotify(): void "\$id" => "github", "enabled" => true, "clientId" => "6ec271000000000000000000009beace", - "clientSecret" => "" + "clientSecret" => "db068a000000000000000000008b5b9f" ); $this->client @@ -1244,7 +1169,7 @@ public function testMethodUpdateOAuth2Stripe(): void "\$id" => "github", "enabled" => true, "clientId" => "ca_UKibXX0000000000000000000006byvR", - "apiSecretKey" => "" + "apiSecretKey" => "sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp" ); $this->client @@ -1262,7 +1187,7 @@ public function testMethodUpdateOAuth2Tradeshift(): void "\$id" => "github", "enabled" => true, "oauth2ClientId" => "appwrite-test-org.appwrite-test-app", - "oauth2ClientSecret" => "" + "oauth2ClientSecret" => "7cb52700-0000-0000-0000-000000ca5b83" ); $this->client @@ -1280,7 +1205,7 @@ public function testMethodUpdateOAuth2TradeshiftSandbox(): void "\$id" => "github", "enabled" => true, "oauth2ClientId" => "appwrite-test-org.appwrite-test-app", - "oauth2ClientSecret" => "" + "oauth2ClientSecret" => "7cb52700-0000-0000-0000-000000ca5b83" ); $this->client @@ -1298,7 +1223,7 @@ public function testMethodUpdateOAuth2Twitch(): void "\$id" => "github", "enabled" => true, "clientId" => "vvi0in000000000000000000ikmt9p", - "clientSecret" => "" + "clientSecret" => "pmapue000000000000000000zylw3v" ); $this->client @@ -1316,7 +1241,7 @@ public function testMethodUpdateOAuth2WordPress(): void "\$id" => "github", "enabled" => true, "clientId" => "130005", - "clientSecret" => "" + "clientSecret" => "PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk" ); $this->client @@ -1334,7 +1259,7 @@ public function testMethodUpdateOAuth2X(): void "\$id" => "github", "enabled" => true, "customerKey" => "slzZV0000000000000NFLaWT", - "secretKey" => "" + "secretKey" => "tkEPkp00000000000000000000000000000000000000FTxbI9" ); $this->client @@ -1352,7 +1277,7 @@ public function testMethodUpdateOAuth2Yahoo(): void "\$id" => "github", "enabled" => true, "clientId" => "dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm", - "clientSecret" => "" + "clientSecret" => "cf978f0000000000000000000000000000c5e2e9" ); $this->client @@ -1370,7 +1295,7 @@ public function testMethodUpdateOAuth2Yandex(): void "\$id" => "github", "enabled" => true, "clientId" => "6a8a6a0000000000000000000091483c", - "clientSecret" => "" + "clientSecret" => "bbf98500000000000000000000c75a63" ); $this->client @@ -1388,7 +1313,7 @@ public function testMethodUpdateOAuth2Zoho(): void "\$id" => "github", "enabled" => true, "clientId" => "1000.83C178000000000000000000RPNX0B", - "clientSecret" => "" + "clientSecret" => "fb5cac000000000000000000000000000000a68f6e" ); $this->client @@ -1406,7 +1331,7 @@ public function testMethodUpdateOAuth2Zoom(): void "\$id" => "github", "enabled" => true, "clientId" => "QMAC00000000000000w0AQ", - "clientSecret" => "" + "clientSecret" => "GAWsG4000000000000000000007U01ON" ); $this->client @@ -1425,7 +1350,7 @@ public function testMethodGetOAuth2Provider(): void "\$id" => "github", "enabled" => true, "applicationId" => "00001111-aaaa-2222-bbbb-3333cccc4444", - "applicationSecret" => "", + "applicationSecret" => "A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u", "tenant" => "common" ), array( @@ -1438,7 +1363,7 @@ public function testMethodGetOAuth2Provider(): void ->andReturn($data); $response = $this->project->getOAuth2Provider( - OAuthProvider::AMAZON() + ProjectOAuthProviderId::AMAZON() ); $this->assertInstanceOf(\Appwrite\Models\OAuth2Microsoft::class, $response); @@ -1758,87 +1683,14 @@ public function testMethodListPolicies(): void $this->assertInstanceOf(\Appwrite\Models\PolicyList::class, $response); } - public function testMethodUpdateMembershipPrivacyPolicy(): void + public function testMethodUpdateDenyAliasedEmailPolicy(): void { $data = array( "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "name" => "New Project", - "description" => "This is a new project.", "teamId" => "1592981250", - "logo" => "5f5c451b403cb", - "url" => "5f5c451b403cb", - "legalName" => "Company LTD.", - "legalCountry" => "US", - "legalState" => "New York", - "legalCity" => "New York City.", - "legalAddress" => "620 Eighth Avenue, New York, NY 10018", - "legalTaxId" => "131102020", - "authDuration" => 60, - "authLimit" => 100, - "authSessionsLimit" => 10, - "authPasswordHistory" => 5, - "authPasswordDictionary" => true, - "authPersonalDataCheck" => true, - "authDisposableEmails" => true, - "authCanonicalEmails" => true, - "authFreeEmails" => true, - "authMockNumbers" => array( - array( - "number" => "+1612842323", - "otp" => "123456", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" - ) - ), - "authSessionAlerts" => true, - "authMembershipsUserName" => true, - "authMembershipsUserEmail" => true, - "authMembershipsMfa" => true, - "authMembershipsUserId" => true, - "authMembershipsUserPhone" => true, - "authInvalidateSessions" => true, - "oAuthProviders" => array( - array( - "key" => "github", - "name" => "GitHub", - "appId" => "259125845563242502", - "secret" => "[SECRET]", - "enabled" => true - ) - ), - "platforms" => array(), - "webhooks" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Webhook", - "url" => "https://example.com/webhook", - "events" => array(), - "tls" => true, - "authUsername" => "username", - "authPassword" => "password", - "secret" => "ad3d581ca230e2b7059c545e5a", - "enabled" => true, - "logs" => "Failed to connect to remote server.", - "attempts" => 10 - ) - ), - "keys" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My API Key", - "expire" => "2020-10-15T06:38:00.000+00:00", - "scopes" => array(), - "secret" => "919c2d18fb5d4...a2ae413da83346ad2", - "accessedAt" => "2020-10-15T06:38:00.000+00:00", - "sdks" => array() - ) - ), "devKeys" => array( array( "\$id" => "5e5ea5c16897e", @@ -1865,33 +1717,24 @@ public function testMethodUpdateMembershipPrivacyPolicy(): void "pingedAt" => "2020-10-15T06:38:00.000+00:00", "labels" => array(), "status" => "active", - "authEmailPassword" => true, - "authUsersAuthMagicURL" => true, - "authEmailOtp" => true, - "authAnonymous" => true, - "authInvites" => true, - "authJWT" => true, - "authPhone" => true, - "serviceStatusForAccount" => true, - "serviceStatusForAvatars" => true, - "serviceStatusForDatabases" => true, - "serviceStatusForTablesdb" => true, - "serviceStatusForLocale" => true, - "serviceStatusForHealth" => true, - "serviceStatusForProject" => true, - "serviceStatusForStorage" => true, - "serviceStatusForTeams" => true, - "serviceStatusForUsers" => true, - "serviceStatusForVcs" => true, - "serviceStatusForSites" => true, - "serviceStatusForFunctions" => true, - "serviceStatusForProxy" => true, - "serviceStatusForGraphql" => true, - "serviceStatusForMigrations" => true, - "serviceStatusForMessaging" => true, - "protocolStatusForRest" => true, - "protocolStatusForGraphql" => true, - "protocolStatusForWebsocket" => true, + "authMethods" => array( + array( + "\$id" => "email-password", + "enabled" => true + ) + ), + "services" => array( + array( + "\$id" => "account", + "enabled" => true + ) + ), + "protocols" => array( + array( + "\$id" => "rest", + "enabled" => true + ) + ), "region" => "fra", "billingLimits" => array( "bandwidth" => 5, @@ -1922,92 +1765,21 @@ public function testMethodUpdateMembershipPrivacyPolicy(): void ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->project->updateMembershipPrivacyPolicy(); + $response = $this->project->updateDenyAliasedEmailPolicy( + true + ); $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); } - public function testMethodUpdatePasswordDictionaryPolicy(): void + public function testMethodUpdateDenyDisposableEmailPolicy(): void { $data = array( "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "name" => "New Project", - "description" => "This is a new project.", "teamId" => "1592981250", - "logo" => "5f5c451b403cb", - "url" => "5f5c451b403cb", - "legalName" => "Company LTD.", - "legalCountry" => "US", - "legalState" => "New York", - "legalCity" => "New York City.", - "legalAddress" => "620 Eighth Avenue, New York, NY 10018", - "legalTaxId" => "131102020", - "authDuration" => 60, - "authLimit" => 100, - "authSessionsLimit" => 10, - "authPasswordHistory" => 5, - "authPasswordDictionary" => true, - "authPersonalDataCheck" => true, - "authDisposableEmails" => true, - "authCanonicalEmails" => true, - "authFreeEmails" => true, - "authMockNumbers" => array( - array( - "number" => "+1612842323", - "otp" => "123456", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" - ) - ), - "authSessionAlerts" => true, - "authMembershipsUserName" => true, - "authMembershipsUserEmail" => true, - "authMembershipsMfa" => true, - "authMembershipsUserId" => true, - "authMembershipsUserPhone" => true, - "authInvalidateSessions" => true, - "oAuthProviders" => array( - array( - "key" => "github", - "name" => "GitHub", - "appId" => "259125845563242502", - "secret" => "[SECRET]", - "enabled" => true - ) - ), - "platforms" => array(), - "webhooks" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Webhook", - "url" => "https://example.com/webhook", - "events" => array(), - "tls" => true, - "authUsername" => "username", - "authPassword" => "password", - "secret" => "ad3d581ca230e2b7059c545e5a", - "enabled" => true, - "logs" => "Failed to connect to remote server.", - "attempts" => 10 - ) - ), - "keys" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My API Key", - "expire" => "2020-10-15T06:38:00.000+00:00", - "scopes" => array(), - "secret" => "919c2d18fb5d4...a2ae413da83346ad2", - "accessedAt" => "2020-10-15T06:38:00.000+00:00", - "sdks" => array() - ) - ), "devKeys" => array( array( "\$id" => "5e5ea5c16897e", @@ -2034,33 +1806,24 @@ public function testMethodUpdatePasswordDictionaryPolicy(): void "pingedAt" => "2020-10-15T06:38:00.000+00:00", "labels" => array(), "status" => "active", - "authEmailPassword" => true, - "authUsersAuthMagicURL" => true, - "authEmailOtp" => true, - "authAnonymous" => true, - "authInvites" => true, - "authJWT" => true, - "authPhone" => true, - "serviceStatusForAccount" => true, - "serviceStatusForAvatars" => true, - "serviceStatusForDatabases" => true, - "serviceStatusForTablesdb" => true, - "serviceStatusForLocale" => true, - "serviceStatusForHealth" => true, - "serviceStatusForProject" => true, - "serviceStatusForStorage" => true, - "serviceStatusForTeams" => true, - "serviceStatusForUsers" => true, - "serviceStatusForVcs" => true, - "serviceStatusForSites" => true, - "serviceStatusForFunctions" => true, - "serviceStatusForProxy" => true, - "serviceStatusForGraphql" => true, - "serviceStatusForMigrations" => true, - "serviceStatusForMessaging" => true, - "protocolStatusForRest" => true, - "protocolStatusForGraphql" => true, - "protocolStatusForWebsocket" => true, + "authMethods" => array( + array( + "\$id" => "email-password", + "enabled" => true + ) + ), + "services" => array( + array( + "\$id" => "account", + "enabled" => true + ) + ), + "protocols" => array( + array( + "\$id" => "rest", + "enabled" => true + ) + ), "region" => "fra", "billingLimits" => array( "bandwidth" => 5, @@ -2091,94 +1854,110 @@ public function testMethodUpdatePasswordDictionaryPolicy(): void ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->project->updatePasswordDictionaryPolicy( + $response = $this->project->updateDenyDisposableEmailPolicy( true ); $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); } - public function testMethodUpdatePasswordHistoryPolicy(): void + public function testMethodUpdateDenyFreeEmailPolicy(): void { $data = array( "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "name" => "New Project", - "description" => "This is a new project.", "teamId" => "1592981250", - "logo" => "5f5c451b403cb", - "url" => "5f5c451b403cb", - "legalName" => "Company LTD.", - "legalCountry" => "US", - "legalState" => "New York", - "legalCity" => "New York City.", - "legalAddress" => "620 Eighth Avenue, New York, NY 10018", - "legalTaxId" => "131102020", - "authDuration" => 60, - "authLimit" => 100, - "authSessionsLimit" => 10, - "authPasswordHistory" => 5, - "authPasswordDictionary" => true, - "authPersonalDataCheck" => true, - "authDisposableEmails" => true, - "authCanonicalEmails" => true, - "authFreeEmails" => true, - "authMockNumbers" => array( + "devKeys" => array( array( - "number" => "+1612842323", - "otp" => "123456", + "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Dev API Key", + "expire" => "2020-10-15T06:38:00.000+00:00", + "secret" => "919c2d18fb5d4...a2ae413da83346ad2", + "accessedAt" => "2020-10-15T06:38:00.000+00:00", + "sdks" => array() ) ), - "authSessionAlerts" => true, - "authMembershipsUserName" => true, - "authMembershipsUserEmail" => true, - "authMembershipsMfa" => true, - "authMembershipsUserId" => true, - "authMembershipsUserPhone" => true, - "authInvalidateSessions" => true, - "oAuthProviders" => array( + "smtpEnabled" => true, + "smtpSenderName" => "John Appwrite", + "smtpSenderEmail" => "john@appwrite.io", + "smtpReplyToName" => "Support Team", + "smtpReplyToEmail" => "support@appwrite.io", + "smtpHost" => "mail.appwrite.io", + "smtpPort" => 25, + "smtpUsername" => "emailuser", + "smtpPassword" => "[SMTPPASSWORD]", + "smtpSecure" => "tls", + "pingCount" => 1, + "pingedAt" => "2020-10-15T06:38:00.000+00:00", + "labels" => array(), + "status" => "active", + "authMethods" => array( array( - "key" => "github", - "name" => "GitHub", - "appId" => "259125845563242502", - "secret" => "[SECRET]", + "\$id" => "email-password", "enabled" => true ) ), - "platforms" => array(), - "webhooks" => array( + "services" => array( array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Webhook", - "url" => "https://example.com/webhook", - "events" => array(), - "tls" => true, - "authUsername" => "username", - "authPassword" => "password", - "secret" => "ad3d581ca230e2b7059c545e5a", - "enabled" => true, - "logs" => "Failed to connect to remote server.", - "attempts" => 10 + "\$id" => "account", + "enabled" => true ) ), - "keys" => array( + "protocols" => array( + array( + "\$id" => "rest", + "enabled" => true + ) + ), + "region" => "fra", + "billingLimits" => array( + "bandwidth" => 5, + "storage" => 150, + "users" => 200000, + "executions" => 750000, + "GBHours" => 100, + "imageTransformations" => 100, + "authPhone" => 10, + "budgetLimit" => 100 + ), + "blocks" => array( array( - "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My API Key", - "expire" => "2020-10-15T06:38:00.000+00:00", - "scopes" => array(), - "secret" => "919c2d18fb5d4...a2ae413da83346ad2", - "accessedAt" => "2020-10-15T06:38:00.000+00:00", - "sdks" => array() + "resourceType" => "project", + "resourceId" => "5e5ea5c16897e", + "projectName" => "My Project", + "region" => "fra", + "organizationName" => "Acme Inc.", + "organizationId" => "5e5ea5c16897e", + "billingPlan" => "pro" ) ), + "consoleAccessedAt" => "2020-10-15T06:38:00.000+00:00" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateDenyFreeEmailPolicy( + true + ); + + $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); + } + + public function testMethodUpdateMembershipPrivacyPolicy(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "New Project", + "teamId" => "1592981250", "devKeys" => array( array( "\$id" => "5e5ea5c16897e", @@ -2205,33 +1984,24 @@ public function testMethodUpdatePasswordHistoryPolicy(): void "pingedAt" => "2020-10-15T06:38:00.000+00:00", "labels" => array(), "status" => "active", - "authEmailPassword" => true, - "authUsersAuthMagicURL" => true, - "authEmailOtp" => true, - "authAnonymous" => true, - "authInvites" => true, - "authJWT" => true, - "authPhone" => true, - "serviceStatusForAccount" => true, - "serviceStatusForAvatars" => true, - "serviceStatusForDatabases" => true, - "serviceStatusForTablesdb" => true, - "serviceStatusForLocale" => true, - "serviceStatusForHealth" => true, - "serviceStatusForProject" => true, - "serviceStatusForStorage" => true, - "serviceStatusForTeams" => true, - "serviceStatusForUsers" => true, - "serviceStatusForVcs" => true, - "serviceStatusForSites" => true, - "serviceStatusForFunctions" => true, - "serviceStatusForProxy" => true, - "serviceStatusForGraphql" => true, - "serviceStatusForMigrations" => true, - "serviceStatusForMessaging" => true, - "protocolStatusForRest" => true, - "protocolStatusForGraphql" => true, - "protocolStatusForWebsocket" => true, + "authMethods" => array( + array( + "\$id" => "email-password", + "enabled" => true + ) + ), + "services" => array( + array( + "\$id" => "account", + "enabled" => true + ) + ), + "protocols" => array( + array( + "\$id" => "rest", + "enabled" => true + ) + ), "region" => "fra", "billingLimits" => array( "bandwidth" => 5, @@ -2262,94 +2032,108 @@ public function testMethodUpdatePasswordHistoryPolicy(): void ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->project->updatePasswordHistoryPolicy( - 1 - ); + $response = $this->project->updateMembershipPrivacyPolicy(); $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); } - public function testMethodUpdatePasswordPersonalDataPolicy(): void + public function testMethodUpdatePasswordDictionaryPolicy(): void { $data = array( "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "name" => "New Project", - "description" => "This is a new project.", "teamId" => "1592981250", - "logo" => "5f5c451b403cb", - "url" => "5f5c451b403cb", - "legalName" => "Company LTD.", - "legalCountry" => "US", - "legalState" => "New York", - "legalCity" => "New York City.", - "legalAddress" => "620 Eighth Avenue, New York, NY 10018", - "legalTaxId" => "131102020", - "authDuration" => 60, - "authLimit" => 100, - "authSessionsLimit" => 10, - "authPasswordHistory" => 5, - "authPasswordDictionary" => true, - "authPersonalDataCheck" => true, - "authDisposableEmails" => true, - "authCanonicalEmails" => true, - "authFreeEmails" => true, - "authMockNumbers" => array( + "devKeys" => array( array( - "number" => "+1612842323", - "otp" => "123456", + "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Dev API Key", + "expire" => "2020-10-15T06:38:00.000+00:00", + "secret" => "919c2d18fb5d4...a2ae413da83346ad2", + "accessedAt" => "2020-10-15T06:38:00.000+00:00", + "sdks" => array() ) ), - "authSessionAlerts" => true, - "authMembershipsUserName" => true, - "authMembershipsUserEmail" => true, - "authMembershipsMfa" => true, - "authMembershipsUserId" => true, - "authMembershipsUserPhone" => true, - "authInvalidateSessions" => true, - "oAuthProviders" => array( + "smtpEnabled" => true, + "smtpSenderName" => "John Appwrite", + "smtpSenderEmail" => "john@appwrite.io", + "smtpReplyToName" => "Support Team", + "smtpReplyToEmail" => "support@appwrite.io", + "smtpHost" => "mail.appwrite.io", + "smtpPort" => 25, + "smtpUsername" => "emailuser", + "smtpPassword" => "[SMTPPASSWORD]", + "smtpSecure" => "tls", + "pingCount" => 1, + "pingedAt" => "2020-10-15T06:38:00.000+00:00", + "labels" => array(), + "status" => "active", + "authMethods" => array( array( - "key" => "github", - "name" => "GitHub", - "appId" => "259125845563242502", - "secret" => "[SECRET]", + "\$id" => "email-password", "enabled" => true ) ), - "platforms" => array(), - "webhooks" => array( + "services" => array( array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Webhook", - "url" => "https://example.com/webhook", - "events" => array(), - "tls" => true, - "authUsername" => "username", - "authPassword" => "password", - "secret" => "ad3d581ca230e2b7059c545e5a", - "enabled" => true, - "logs" => "Failed to connect to remote server.", - "attempts" => 10 + "\$id" => "account", + "enabled" => true ) ), - "keys" => array( + "protocols" => array( + array( + "\$id" => "rest", + "enabled" => true + ) + ), + "region" => "fra", + "billingLimits" => array( + "bandwidth" => 5, + "storage" => 150, + "users" => 200000, + "executions" => 750000, + "GBHours" => 100, + "imageTransformations" => 100, + "authPhone" => 10, + "budgetLimit" => 100 + ), + "blocks" => array( array( - "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My API Key", - "expire" => "2020-10-15T06:38:00.000+00:00", - "scopes" => array(), - "secret" => "919c2d18fb5d4...a2ae413da83346ad2", - "accessedAt" => "2020-10-15T06:38:00.000+00:00", - "sdks" => array() + "resourceType" => "project", + "resourceId" => "5e5ea5c16897e", + "projectName" => "My Project", + "region" => "fra", + "organizationName" => "Acme Inc.", + "organizationId" => "5e5ea5c16897e", + "billingPlan" => "pro" ) ), + "consoleAccessedAt" => "2020-10-15T06:38:00.000+00:00" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updatePasswordDictionaryPolicy( + true + ); + + $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); + } + + public function testMethodUpdatePasswordHistoryPolicy(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "New Project", + "teamId" => "1592981250", "devKeys" => array( array( "\$id" => "5e5ea5c16897e", @@ -2376,33 +2160,24 @@ public function testMethodUpdatePasswordPersonalDataPolicy(): void "pingedAt" => "2020-10-15T06:38:00.000+00:00", "labels" => array(), "status" => "active", - "authEmailPassword" => true, - "authUsersAuthMagicURL" => true, - "authEmailOtp" => true, - "authAnonymous" => true, - "authInvites" => true, - "authJWT" => true, - "authPhone" => true, - "serviceStatusForAccount" => true, - "serviceStatusForAvatars" => true, - "serviceStatusForDatabases" => true, - "serviceStatusForTablesdb" => true, - "serviceStatusForLocale" => true, - "serviceStatusForHealth" => true, - "serviceStatusForProject" => true, - "serviceStatusForStorage" => true, - "serviceStatusForTeams" => true, - "serviceStatusForUsers" => true, - "serviceStatusForVcs" => true, - "serviceStatusForSites" => true, - "serviceStatusForFunctions" => true, - "serviceStatusForProxy" => true, - "serviceStatusForGraphql" => true, - "serviceStatusForMigrations" => true, - "serviceStatusForMessaging" => true, - "protocolStatusForRest" => true, - "protocolStatusForGraphql" => true, - "protocolStatusForWebsocket" => true, + "authMethods" => array( + array( + "\$id" => "email-password", + "enabled" => true + ) + ), + "services" => array( + array( + "\$id" => "account", + "enabled" => true + ) + ), + "protocols" => array( + array( + "\$id" => "rest", + "enabled" => true + ) + ), "region" => "fra", "billingLimits" => array( "bandwidth" => 5, @@ -2433,94 +2208,110 @@ public function testMethodUpdatePasswordPersonalDataPolicy(): void ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->project->updatePasswordPersonalDataPolicy( - true + $response = $this->project->updatePasswordHistoryPolicy( + 1 ); $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); } - public function testMethodUpdateSessionAlertPolicy(): void + public function testMethodUpdatePasswordPersonalDataPolicy(): void { $data = array( "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "name" => "New Project", - "description" => "This is a new project.", "teamId" => "1592981250", - "logo" => "5f5c451b403cb", - "url" => "5f5c451b403cb", - "legalName" => "Company LTD.", - "legalCountry" => "US", - "legalState" => "New York", - "legalCity" => "New York City.", - "legalAddress" => "620 Eighth Avenue, New York, NY 10018", - "legalTaxId" => "131102020", - "authDuration" => 60, - "authLimit" => 100, - "authSessionsLimit" => 10, - "authPasswordHistory" => 5, - "authPasswordDictionary" => true, - "authPersonalDataCheck" => true, - "authDisposableEmails" => true, - "authCanonicalEmails" => true, - "authFreeEmails" => true, - "authMockNumbers" => array( + "devKeys" => array( array( - "number" => "+1612842323", - "otp" => "123456", + "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Dev API Key", + "expire" => "2020-10-15T06:38:00.000+00:00", + "secret" => "919c2d18fb5d4...a2ae413da83346ad2", + "accessedAt" => "2020-10-15T06:38:00.000+00:00", + "sdks" => array() ) ), - "authSessionAlerts" => true, - "authMembershipsUserName" => true, - "authMembershipsUserEmail" => true, - "authMembershipsMfa" => true, - "authMembershipsUserId" => true, - "authMembershipsUserPhone" => true, - "authInvalidateSessions" => true, - "oAuthProviders" => array( + "smtpEnabled" => true, + "smtpSenderName" => "John Appwrite", + "smtpSenderEmail" => "john@appwrite.io", + "smtpReplyToName" => "Support Team", + "smtpReplyToEmail" => "support@appwrite.io", + "smtpHost" => "mail.appwrite.io", + "smtpPort" => 25, + "smtpUsername" => "emailuser", + "smtpPassword" => "[SMTPPASSWORD]", + "smtpSecure" => "tls", + "pingCount" => 1, + "pingedAt" => "2020-10-15T06:38:00.000+00:00", + "labels" => array(), + "status" => "active", + "authMethods" => array( array( - "key" => "github", - "name" => "GitHub", - "appId" => "259125845563242502", - "secret" => "[SECRET]", + "\$id" => "email-password", "enabled" => true ) ), - "platforms" => array(), - "webhooks" => array( + "services" => array( array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Webhook", - "url" => "https://example.com/webhook", - "events" => array(), - "tls" => true, - "authUsername" => "username", - "authPassword" => "password", - "secret" => "ad3d581ca230e2b7059c545e5a", - "enabled" => true, - "logs" => "Failed to connect to remote server.", - "attempts" => 10 + "\$id" => "account", + "enabled" => true ) ), - "keys" => array( + "protocols" => array( + array( + "\$id" => "rest", + "enabled" => true + ) + ), + "region" => "fra", + "billingLimits" => array( + "bandwidth" => 5, + "storage" => 150, + "users" => 200000, + "executions" => 750000, + "GBHours" => 100, + "imageTransformations" => 100, + "authPhone" => 10, + "budgetLimit" => 100 + ), + "blocks" => array( array( - "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My API Key", - "expire" => "2020-10-15T06:38:00.000+00:00", - "scopes" => array(), - "secret" => "919c2d18fb5d4...a2ae413da83346ad2", - "accessedAt" => "2020-10-15T06:38:00.000+00:00", - "sdks" => array() + "resourceType" => "project", + "resourceId" => "5e5ea5c16897e", + "projectName" => "My Project", + "region" => "fra", + "organizationName" => "Acme Inc.", + "organizationId" => "5e5ea5c16897e", + "billingPlan" => "pro" ) ), + "consoleAccessedAt" => "2020-10-15T06:38:00.000+00:00" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updatePasswordPersonalDataPolicy( + true + ); + + $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); + } + + public function testMethodUpdateSessionAlertPolicy(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "New Project", + "teamId" => "1592981250", "devKeys" => array( array( "\$id" => "5e5ea5c16897e", @@ -2547,33 +2338,24 @@ public function testMethodUpdateSessionAlertPolicy(): void "pingedAt" => "2020-10-15T06:38:00.000+00:00", "labels" => array(), "status" => "active", - "authEmailPassword" => true, - "authUsersAuthMagicURL" => true, - "authEmailOtp" => true, - "authAnonymous" => true, - "authInvites" => true, - "authJWT" => true, - "authPhone" => true, - "serviceStatusForAccount" => true, - "serviceStatusForAvatars" => true, - "serviceStatusForDatabases" => true, - "serviceStatusForTablesdb" => true, - "serviceStatusForLocale" => true, - "serviceStatusForHealth" => true, - "serviceStatusForProject" => true, - "serviceStatusForStorage" => true, - "serviceStatusForTeams" => true, - "serviceStatusForUsers" => true, - "serviceStatusForVcs" => true, - "serviceStatusForSites" => true, - "serviceStatusForFunctions" => true, - "serviceStatusForProxy" => true, - "serviceStatusForGraphql" => true, - "serviceStatusForMigrations" => true, - "serviceStatusForMessaging" => true, - "protocolStatusForRest" => true, - "protocolStatusForGraphql" => true, - "protocolStatusForWebsocket" => true, + "authMethods" => array( + array( + "\$id" => "email-password", + "enabled" => true + ) + ), + "services" => array( + array( + "\$id" => "account", + "enabled" => true + ) + ), + "protocols" => array( + array( + "\$id" => "rest", + "enabled" => true + ) + ), "region" => "fra", "billingLimits" => array( "bandwidth" => 5, @@ -2618,80 +2400,7 @@ public function testMethodUpdateSessionDurationPolicy(): void "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "name" => "New Project", - "description" => "This is a new project.", "teamId" => "1592981250", - "logo" => "5f5c451b403cb", - "url" => "5f5c451b403cb", - "legalName" => "Company LTD.", - "legalCountry" => "US", - "legalState" => "New York", - "legalCity" => "New York City.", - "legalAddress" => "620 Eighth Avenue, New York, NY 10018", - "legalTaxId" => "131102020", - "authDuration" => 60, - "authLimit" => 100, - "authSessionsLimit" => 10, - "authPasswordHistory" => 5, - "authPasswordDictionary" => true, - "authPersonalDataCheck" => true, - "authDisposableEmails" => true, - "authCanonicalEmails" => true, - "authFreeEmails" => true, - "authMockNumbers" => array( - array( - "number" => "+1612842323", - "otp" => "123456", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" - ) - ), - "authSessionAlerts" => true, - "authMembershipsUserName" => true, - "authMembershipsUserEmail" => true, - "authMembershipsMfa" => true, - "authMembershipsUserId" => true, - "authMembershipsUserPhone" => true, - "authInvalidateSessions" => true, - "oAuthProviders" => array( - array( - "key" => "github", - "name" => "GitHub", - "appId" => "259125845563242502", - "secret" => "[SECRET]", - "enabled" => true - ) - ), - "platforms" => array(), - "webhooks" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Webhook", - "url" => "https://example.com/webhook", - "events" => array(), - "tls" => true, - "authUsername" => "username", - "authPassword" => "password", - "secret" => "ad3d581ca230e2b7059c545e5a", - "enabled" => true, - "logs" => "Failed to connect to remote server.", - "attempts" => 10 - ) - ), - "keys" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My API Key", - "expire" => "2020-10-15T06:38:00.000+00:00", - "scopes" => array(), - "secret" => "919c2d18fb5d4...a2ae413da83346ad2", - "accessedAt" => "2020-10-15T06:38:00.000+00:00", - "sdks" => array() - ) - ), "devKeys" => array( array( "\$id" => "5e5ea5c16897e", @@ -2718,33 +2427,24 @@ public function testMethodUpdateSessionDurationPolicy(): void "pingedAt" => "2020-10-15T06:38:00.000+00:00", "labels" => array(), "status" => "active", - "authEmailPassword" => true, - "authUsersAuthMagicURL" => true, - "authEmailOtp" => true, - "authAnonymous" => true, - "authInvites" => true, - "authJWT" => true, - "authPhone" => true, - "serviceStatusForAccount" => true, - "serviceStatusForAvatars" => true, - "serviceStatusForDatabases" => true, - "serviceStatusForTablesdb" => true, - "serviceStatusForLocale" => true, - "serviceStatusForHealth" => true, - "serviceStatusForProject" => true, - "serviceStatusForStorage" => true, - "serviceStatusForTeams" => true, - "serviceStatusForUsers" => true, - "serviceStatusForVcs" => true, - "serviceStatusForSites" => true, - "serviceStatusForFunctions" => true, - "serviceStatusForProxy" => true, - "serviceStatusForGraphql" => true, - "serviceStatusForMigrations" => true, - "serviceStatusForMessaging" => true, - "protocolStatusForRest" => true, - "protocolStatusForGraphql" => true, - "protocolStatusForWebsocket" => true, + "authMethods" => array( + array( + "\$id" => "email-password", + "enabled" => true + ) + ), + "services" => array( + array( + "\$id" => "account", + "enabled" => true + ) + ), + "protocols" => array( + array( + "\$id" => "rest", + "enabled" => true + ) + ), "region" => "fra", "billingLimits" => array( "bandwidth" => 5, @@ -2789,80 +2489,7 @@ public function testMethodUpdateSessionInvalidationPolicy(): void "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "name" => "New Project", - "description" => "This is a new project.", "teamId" => "1592981250", - "logo" => "5f5c451b403cb", - "url" => "5f5c451b403cb", - "legalName" => "Company LTD.", - "legalCountry" => "US", - "legalState" => "New York", - "legalCity" => "New York City.", - "legalAddress" => "620 Eighth Avenue, New York, NY 10018", - "legalTaxId" => "131102020", - "authDuration" => 60, - "authLimit" => 100, - "authSessionsLimit" => 10, - "authPasswordHistory" => 5, - "authPasswordDictionary" => true, - "authPersonalDataCheck" => true, - "authDisposableEmails" => true, - "authCanonicalEmails" => true, - "authFreeEmails" => true, - "authMockNumbers" => array( - array( - "number" => "+1612842323", - "otp" => "123456", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" - ) - ), - "authSessionAlerts" => true, - "authMembershipsUserName" => true, - "authMembershipsUserEmail" => true, - "authMembershipsMfa" => true, - "authMembershipsUserId" => true, - "authMembershipsUserPhone" => true, - "authInvalidateSessions" => true, - "oAuthProviders" => array( - array( - "key" => "github", - "name" => "GitHub", - "appId" => "259125845563242502", - "secret" => "[SECRET]", - "enabled" => true - ) - ), - "platforms" => array(), - "webhooks" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Webhook", - "url" => "https://example.com/webhook", - "events" => array(), - "tls" => true, - "authUsername" => "username", - "authPassword" => "password", - "secret" => "ad3d581ca230e2b7059c545e5a", - "enabled" => true, - "logs" => "Failed to connect to remote server.", - "attempts" => 10 - ) - ), - "keys" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My API Key", - "expire" => "2020-10-15T06:38:00.000+00:00", - "scopes" => array(), - "secret" => "919c2d18fb5d4...a2ae413da83346ad2", - "accessedAt" => "2020-10-15T06:38:00.000+00:00", - "sdks" => array() - ) - ), "devKeys" => array( array( "\$id" => "5e5ea5c16897e", @@ -2889,33 +2516,24 @@ public function testMethodUpdateSessionInvalidationPolicy(): void "pingedAt" => "2020-10-15T06:38:00.000+00:00", "labels" => array(), "status" => "active", - "authEmailPassword" => true, - "authUsersAuthMagicURL" => true, - "authEmailOtp" => true, - "authAnonymous" => true, - "authInvites" => true, - "authJWT" => true, - "authPhone" => true, - "serviceStatusForAccount" => true, - "serviceStatusForAvatars" => true, - "serviceStatusForDatabases" => true, - "serviceStatusForTablesdb" => true, - "serviceStatusForLocale" => true, - "serviceStatusForHealth" => true, - "serviceStatusForProject" => true, - "serviceStatusForStorage" => true, - "serviceStatusForTeams" => true, - "serviceStatusForUsers" => true, - "serviceStatusForVcs" => true, - "serviceStatusForSites" => true, - "serviceStatusForFunctions" => true, - "serviceStatusForProxy" => true, - "serviceStatusForGraphql" => true, - "serviceStatusForMigrations" => true, - "serviceStatusForMessaging" => true, - "protocolStatusForRest" => true, - "protocolStatusForGraphql" => true, - "protocolStatusForWebsocket" => true, + "authMethods" => array( + array( + "\$id" => "email-password", + "enabled" => true + ) + ), + "services" => array( + array( + "\$id" => "account", + "enabled" => true + ) + ), + "protocols" => array( + array( + "\$id" => "rest", + "enabled" => true + ) + ), "region" => "fra", "billingLimits" => array( "bandwidth" => 5, @@ -2960,80 +2578,7 @@ public function testMethodUpdateSessionLimitPolicy(): void "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "name" => "New Project", - "description" => "This is a new project.", "teamId" => "1592981250", - "logo" => "5f5c451b403cb", - "url" => "5f5c451b403cb", - "legalName" => "Company LTD.", - "legalCountry" => "US", - "legalState" => "New York", - "legalCity" => "New York City.", - "legalAddress" => "620 Eighth Avenue, New York, NY 10018", - "legalTaxId" => "131102020", - "authDuration" => 60, - "authLimit" => 100, - "authSessionsLimit" => 10, - "authPasswordHistory" => 5, - "authPasswordDictionary" => true, - "authPersonalDataCheck" => true, - "authDisposableEmails" => true, - "authCanonicalEmails" => true, - "authFreeEmails" => true, - "authMockNumbers" => array( - array( - "number" => "+1612842323", - "otp" => "123456", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" - ) - ), - "authSessionAlerts" => true, - "authMembershipsUserName" => true, - "authMembershipsUserEmail" => true, - "authMembershipsMfa" => true, - "authMembershipsUserId" => true, - "authMembershipsUserPhone" => true, - "authInvalidateSessions" => true, - "oAuthProviders" => array( - array( - "key" => "github", - "name" => "GitHub", - "appId" => "259125845563242502", - "secret" => "[SECRET]", - "enabled" => true - ) - ), - "platforms" => array(), - "webhooks" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Webhook", - "url" => "https://example.com/webhook", - "events" => array(), - "tls" => true, - "authUsername" => "username", - "authPassword" => "password", - "secret" => "ad3d581ca230e2b7059c545e5a", - "enabled" => true, - "logs" => "Failed to connect to remote server.", - "attempts" => 10 - ) - ), - "keys" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My API Key", - "expire" => "2020-10-15T06:38:00.000+00:00", - "scopes" => array(), - "secret" => "919c2d18fb5d4...a2ae413da83346ad2", - "accessedAt" => "2020-10-15T06:38:00.000+00:00", - "sdks" => array() - ) - ), "devKeys" => array( array( "\$id" => "5e5ea5c16897e", @@ -3060,33 +2605,24 @@ public function testMethodUpdateSessionLimitPolicy(): void "pingedAt" => "2020-10-15T06:38:00.000+00:00", "labels" => array(), "status" => "active", - "authEmailPassword" => true, - "authUsersAuthMagicURL" => true, - "authEmailOtp" => true, - "authAnonymous" => true, - "authInvites" => true, - "authJWT" => true, - "authPhone" => true, - "serviceStatusForAccount" => true, - "serviceStatusForAvatars" => true, - "serviceStatusForDatabases" => true, - "serviceStatusForTablesdb" => true, - "serviceStatusForLocale" => true, - "serviceStatusForHealth" => true, - "serviceStatusForProject" => true, - "serviceStatusForStorage" => true, - "serviceStatusForTeams" => true, - "serviceStatusForUsers" => true, - "serviceStatusForVcs" => true, - "serviceStatusForSites" => true, - "serviceStatusForFunctions" => true, - "serviceStatusForProxy" => true, - "serviceStatusForGraphql" => true, - "serviceStatusForMigrations" => true, - "serviceStatusForMessaging" => true, - "protocolStatusForRest" => true, - "protocolStatusForGraphql" => true, - "protocolStatusForWebsocket" => true, + "authMethods" => array( + array( + "\$id" => "email-password", + "enabled" => true + ) + ), + "services" => array( + array( + "\$id" => "account", + "enabled" => true + ) + ), + "protocols" => array( + array( + "\$id" => "rest", + "enabled" => true + ) + ), "region" => "fra", "billingLimits" => array( "bandwidth" => 5, @@ -3131,80 +2667,7 @@ public function testMethodUpdateUserLimitPolicy(): void "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "name" => "New Project", - "description" => "This is a new project.", "teamId" => "1592981250", - "logo" => "5f5c451b403cb", - "url" => "5f5c451b403cb", - "legalName" => "Company LTD.", - "legalCountry" => "US", - "legalState" => "New York", - "legalCity" => "New York City.", - "legalAddress" => "620 Eighth Avenue, New York, NY 10018", - "legalTaxId" => "131102020", - "authDuration" => 60, - "authLimit" => 100, - "authSessionsLimit" => 10, - "authPasswordHistory" => 5, - "authPasswordDictionary" => true, - "authPersonalDataCheck" => true, - "authDisposableEmails" => true, - "authCanonicalEmails" => true, - "authFreeEmails" => true, - "authMockNumbers" => array( - array( - "number" => "+1612842323", - "otp" => "123456", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" - ) - ), - "authSessionAlerts" => true, - "authMembershipsUserName" => true, - "authMembershipsUserEmail" => true, - "authMembershipsMfa" => true, - "authMembershipsUserId" => true, - "authMembershipsUserPhone" => true, - "authInvalidateSessions" => true, - "oAuthProviders" => array( - array( - "key" => "github", - "name" => "GitHub", - "appId" => "259125845563242502", - "secret" => "[SECRET]", - "enabled" => true - ) - ), - "platforms" => array(), - "webhooks" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Webhook", - "url" => "https://example.com/webhook", - "events" => array(), - "tls" => true, - "authUsername" => "username", - "authPassword" => "password", - "secret" => "ad3d581ca230e2b7059c545e5a", - "enabled" => true, - "logs" => "Failed to connect to remote server.", - "attempts" => 10 - ) - ), - "keys" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My API Key", - "expire" => "2020-10-15T06:38:00.000+00:00", - "scopes" => array(), - "secret" => "919c2d18fb5d4...a2ae413da83346ad2", - "accessedAt" => "2020-10-15T06:38:00.000+00:00", - "sdks" => array() - ) - ), "devKeys" => array( array( "\$id" => "5e5ea5c16897e", @@ -3231,33 +2694,24 @@ public function testMethodUpdateUserLimitPolicy(): void "pingedAt" => "2020-10-15T06:38:00.000+00:00", "labels" => array(), "status" => "active", - "authEmailPassword" => true, - "authUsersAuthMagicURL" => true, - "authEmailOtp" => true, - "authAnonymous" => true, - "authInvites" => true, - "authJWT" => true, - "authPhone" => true, - "serviceStatusForAccount" => true, - "serviceStatusForAvatars" => true, - "serviceStatusForDatabases" => true, - "serviceStatusForTablesdb" => true, - "serviceStatusForLocale" => true, - "serviceStatusForHealth" => true, - "serviceStatusForProject" => true, - "serviceStatusForStorage" => true, - "serviceStatusForTeams" => true, - "serviceStatusForUsers" => true, - "serviceStatusForVcs" => true, - "serviceStatusForSites" => true, - "serviceStatusForFunctions" => true, - "serviceStatusForProxy" => true, - "serviceStatusForGraphql" => true, - "serviceStatusForMigrations" => true, - "serviceStatusForMessaging" => true, - "protocolStatusForRest" => true, - "protocolStatusForGraphql" => true, - "protocolStatusForWebsocket" => true, + "authMethods" => array( + array( + "\$id" => "email-password", + "enabled" => true + ) + ), + "services" => array( + array( + "\$id" => "account", + "enabled" => true + ) + ), + "protocols" => array( + array( + "\$id" => "rest", + "enabled" => true + ) + ), "region" => "fra", "billingLimits" => array( "bandwidth" => 5, @@ -3316,7 +2770,7 @@ public function testMethodGetPolicy(): void ->andReturn($data); $response = $this->project->getPolicy( - ProjectPolicy::PASSWORDDICTIONARY() + ProjectPolicyId::PASSWORDDICTIONARY() ); $this->assertInstanceOf(\Appwrite\Models\PolicyMembershipPrivacy::class, $response); @@ -3329,80 +2783,7 @@ public function testMethodUpdateProtocol(): void "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "name" => "New Project", - "description" => "This is a new project.", "teamId" => "1592981250", - "logo" => "5f5c451b403cb", - "url" => "5f5c451b403cb", - "legalName" => "Company LTD.", - "legalCountry" => "US", - "legalState" => "New York", - "legalCity" => "New York City.", - "legalAddress" => "620 Eighth Avenue, New York, NY 10018", - "legalTaxId" => "131102020", - "authDuration" => 60, - "authLimit" => 100, - "authSessionsLimit" => 10, - "authPasswordHistory" => 5, - "authPasswordDictionary" => true, - "authPersonalDataCheck" => true, - "authDisposableEmails" => true, - "authCanonicalEmails" => true, - "authFreeEmails" => true, - "authMockNumbers" => array( - array( - "number" => "+1612842323", - "otp" => "123456", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" - ) - ), - "authSessionAlerts" => true, - "authMembershipsUserName" => true, - "authMembershipsUserEmail" => true, - "authMembershipsMfa" => true, - "authMembershipsUserId" => true, - "authMembershipsUserPhone" => true, - "authInvalidateSessions" => true, - "oAuthProviders" => array( - array( - "key" => "github", - "name" => "GitHub", - "appId" => "259125845563242502", - "secret" => "[SECRET]", - "enabled" => true - ) - ), - "platforms" => array(), - "webhooks" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Webhook", - "url" => "https://example.com/webhook", - "events" => array(), - "tls" => true, - "authUsername" => "username", - "authPassword" => "password", - "secret" => "ad3d581ca230e2b7059c545e5a", - "enabled" => true, - "logs" => "Failed to connect to remote server.", - "attempts" => 10 - ) - ), - "keys" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My API Key", - "expire" => "2020-10-15T06:38:00.000+00:00", - "scopes" => array(), - "secret" => "919c2d18fb5d4...a2ae413da83346ad2", - "accessedAt" => "2020-10-15T06:38:00.000+00:00", - "sdks" => array() - ) - ), "devKeys" => array( array( "\$id" => "5e5ea5c16897e", @@ -3429,33 +2810,24 @@ public function testMethodUpdateProtocol(): void "pingedAt" => "2020-10-15T06:38:00.000+00:00", "labels" => array(), "status" => "active", - "authEmailPassword" => true, - "authUsersAuthMagicURL" => true, - "authEmailOtp" => true, - "authAnonymous" => true, - "authInvites" => true, - "authJWT" => true, - "authPhone" => true, - "serviceStatusForAccount" => true, - "serviceStatusForAvatars" => true, - "serviceStatusForDatabases" => true, - "serviceStatusForTablesdb" => true, - "serviceStatusForLocale" => true, - "serviceStatusForHealth" => true, - "serviceStatusForProject" => true, - "serviceStatusForStorage" => true, - "serviceStatusForTeams" => true, - "serviceStatusForUsers" => true, - "serviceStatusForVcs" => true, - "serviceStatusForSites" => true, - "serviceStatusForFunctions" => true, - "serviceStatusForProxy" => true, - "serviceStatusForGraphql" => true, - "serviceStatusForMigrations" => true, - "serviceStatusForMessaging" => true, - "protocolStatusForRest" => true, - "protocolStatusForGraphql" => true, - "protocolStatusForWebsocket" => true, + "authMethods" => array( + array( + "\$id" => "email-password", + "enabled" => true + ) + ), + "services" => array( + array( + "\$id" => "account", + "enabled" => true + ) + ), + "protocols" => array( + array( + "\$id" => "rest", + "enabled" => true + ) + ), "region" => "fra", "billingLimits" => array( "bandwidth" => 5, @@ -3487,7 +2859,7 @@ public function testMethodUpdateProtocol(): void ->andReturn($data); $response = $this->project->updateProtocol( - ProtocolId::REST(), + ProjectProtocolId::REST(), true ); @@ -3501,80 +2873,7 @@ public function testMethodUpdateService(): void "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "name" => "New Project", - "description" => "This is a new project.", "teamId" => "1592981250", - "logo" => "5f5c451b403cb", - "url" => "5f5c451b403cb", - "legalName" => "Company LTD.", - "legalCountry" => "US", - "legalState" => "New York", - "legalCity" => "New York City.", - "legalAddress" => "620 Eighth Avenue, New York, NY 10018", - "legalTaxId" => "131102020", - "authDuration" => 60, - "authLimit" => 100, - "authSessionsLimit" => 10, - "authPasswordHistory" => 5, - "authPasswordDictionary" => true, - "authPersonalDataCheck" => true, - "authDisposableEmails" => true, - "authCanonicalEmails" => true, - "authFreeEmails" => true, - "authMockNumbers" => array( - array( - "number" => "+1612842323", - "otp" => "123456", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" - ) - ), - "authSessionAlerts" => true, - "authMembershipsUserName" => true, - "authMembershipsUserEmail" => true, - "authMembershipsMfa" => true, - "authMembershipsUserId" => true, - "authMembershipsUserPhone" => true, - "authInvalidateSessions" => true, - "oAuthProviders" => array( - array( - "key" => "github", - "name" => "GitHub", - "appId" => "259125845563242502", - "secret" => "[SECRET]", - "enabled" => true - ) - ), - "platforms" => array(), - "webhooks" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Webhook", - "url" => "https://example.com/webhook", - "events" => array(), - "tls" => true, - "authUsername" => "username", - "authPassword" => "password", - "secret" => "ad3d581ca230e2b7059c545e5a", - "enabled" => true, - "logs" => "Failed to connect to remote server.", - "attempts" => 10 - ) - ), - "keys" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My API Key", - "expire" => "2020-10-15T06:38:00.000+00:00", - "scopes" => array(), - "secret" => "919c2d18fb5d4...a2ae413da83346ad2", - "accessedAt" => "2020-10-15T06:38:00.000+00:00", - "sdks" => array() - ) - ), "devKeys" => array( array( "\$id" => "5e5ea5c16897e", @@ -3601,33 +2900,24 @@ public function testMethodUpdateService(): void "pingedAt" => "2020-10-15T06:38:00.000+00:00", "labels" => array(), "status" => "active", - "authEmailPassword" => true, - "authUsersAuthMagicURL" => true, - "authEmailOtp" => true, - "authAnonymous" => true, - "authInvites" => true, - "authJWT" => true, - "authPhone" => true, - "serviceStatusForAccount" => true, - "serviceStatusForAvatars" => true, - "serviceStatusForDatabases" => true, - "serviceStatusForTablesdb" => true, - "serviceStatusForLocale" => true, - "serviceStatusForHealth" => true, - "serviceStatusForProject" => true, - "serviceStatusForStorage" => true, - "serviceStatusForTeams" => true, - "serviceStatusForUsers" => true, - "serviceStatusForVcs" => true, - "serviceStatusForSites" => true, - "serviceStatusForFunctions" => true, - "serviceStatusForProxy" => true, - "serviceStatusForGraphql" => true, - "serviceStatusForMigrations" => true, - "serviceStatusForMessaging" => true, - "protocolStatusForRest" => true, - "protocolStatusForGraphql" => true, - "protocolStatusForWebsocket" => true, + "authMethods" => array( + array( + "\$id" => "email-password", + "enabled" => true + ) + ), + "services" => array( + array( + "\$id" => "account", + "enabled" => true + ) + ), + "protocols" => array( + array( + "\$id" => "rest", + "enabled" => true + ) + ), "region" => "fra", "billingLimits" => array( "bandwidth" => 5, @@ -3659,7 +2949,7 @@ public function testMethodUpdateService(): void ->andReturn($data); $response = $this->project->updateService( - ServiceId::ACCOUNT(), + ProjectServiceId::ACCOUNT(), true ); @@ -3673,80 +2963,7 @@ public function testMethodUpdateSMTP(): void "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "name" => "New Project", - "description" => "This is a new project.", "teamId" => "1592981250", - "logo" => "5f5c451b403cb", - "url" => "5f5c451b403cb", - "legalName" => "Company LTD.", - "legalCountry" => "US", - "legalState" => "New York", - "legalCity" => "New York City.", - "legalAddress" => "620 Eighth Avenue, New York, NY 10018", - "legalTaxId" => "131102020", - "authDuration" => 60, - "authLimit" => 100, - "authSessionsLimit" => 10, - "authPasswordHistory" => 5, - "authPasswordDictionary" => true, - "authPersonalDataCheck" => true, - "authDisposableEmails" => true, - "authCanonicalEmails" => true, - "authFreeEmails" => true, - "authMockNumbers" => array( - array( - "number" => "+1612842323", - "otp" => "123456", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" - ) - ), - "authSessionAlerts" => true, - "authMembershipsUserName" => true, - "authMembershipsUserEmail" => true, - "authMembershipsMfa" => true, - "authMembershipsUserId" => true, - "authMembershipsUserPhone" => true, - "authInvalidateSessions" => true, - "oAuthProviders" => array( - array( - "key" => "github", - "name" => "GitHub", - "appId" => "259125845563242502", - "secret" => "[SECRET]", - "enabled" => true - ) - ), - "platforms" => array(), - "webhooks" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Webhook", - "url" => "https://example.com/webhook", - "events" => array(), - "tls" => true, - "authUsername" => "username", - "authPassword" => "password", - "secret" => "ad3d581ca230e2b7059c545e5a", - "enabled" => true, - "logs" => "Failed to connect to remote server.", - "attempts" => 10 - ) - ), - "keys" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My API Key", - "expire" => "2020-10-15T06:38:00.000+00:00", - "scopes" => array(), - "secret" => "919c2d18fb5d4...a2ae413da83346ad2", - "accessedAt" => "2020-10-15T06:38:00.000+00:00", - "sdks" => array() - ) - ), "devKeys" => array( array( "\$id" => "5e5ea5c16897e", @@ -3773,33 +2990,24 @@ public function testMethodUpdateSMTP(): void "pingedAt" => "2020-10-15T06:38:00.000+00:00", "labels" => array(), "status" => "active", - "authEmailPassword" => true, - "authUsersAuthMagicURL" => true, - "authEmailOtp" => true, - "authAnonymous" => true, - "authInvites" => true, - "authJWT" => true, - "authPhone" => true, - "serviceStatusForAccount" => true, - "serviceStatusForAvatars" => true, - "serviceStatusForDatabases" => true, - "serviceStatusForTablesdb" => true, - "serviceStatusForLocale" => true, - "serviceStatusForHealth" => true, - "serviceStatusForProject" => true, - "serviceStatusForStorage" => true, - "serviceStatusForTeams" => true, - "serviceStatusForUsers" => true, - "serviceStatusForVcs" => true, - "serviceStatusForSites" => true, - "serviceStatusForFunctions" => true, - "serviceStatusForProxy" => true, - "serviceStatusForGraphql" => true, - "serviceStatusForMigrations" => true, - "serviceStatusForMessaging" => true, - "protocolStatusForRest" => true, - "protocolStatusForGraphql" => true, - "protocolStatusForWebsocket" => true, + "authMethods" => array( + array( + "\$id" => "email-password", + "enabled" => true + ) + ), + "services" => array( + array( + "\$id" => "account", + "enabled" => true + ) + ), + "protocols" => array( + array( + "\$id" => "rest", + "enabled" => true + ) + ), "region" => "fra", "billingLimits" => array( "bandwidth" => 5, @@ -3895,7 +3103,7 @@ public function testMethodUpdateEmailTemplate(): void ->andReturn($data); $response = $this->project->updateEmailTemplate( - EmailTemplateType::VERIFICATION() + ProjectEmailTemplateId::VERIFICATION() ); $this->assertInstanceOf(\Appwrite\Models\EmailTemplate::class, $response); @@ -3919,7 +3127,7 @@ public function testMethodGetEmailTemplate(): void ->andReturn($data); $response = $this->project->getEmailTemplate( - EmailTemplateType::VERIFICATION() + ProjectEmailTemplateId::VERIFICATION() ); $this->assertInstanceOf(\Appwrite\Models\EmailTemplate::class, $response); diff --git a/tests/Appwrite/Services/TablesDBTest.php b/tests/Appwrite/Services/TablesDBTest.php index c1622e4..74f2c77 100644 --- a/tests/Appwrite/Services/TablesDBTest.php +++ b/tests/Appwrite/Services/TablesDBTest.php @@ -37,14 +37,14 @@ public function testMethodList(): void "policies" => array( array( "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(), - "lengths" => array() + "services" => array(), + "resources" => array(), + "retention" => 7, + "schedule" => "0 * * * *", + "enabled" => true ) ), "archives" => array( @@ -52,27 +52,13 @@ public function testMethodList(): void "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "databaseId" => "5e5ea5c16897e", - "name" => "My Collection", - "enabled" => true, - "documentSecurity" => true, - "attributes" => array(), - "indexes" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(), - "lengths" => array() - ) - ), - "bytesMax" => 65535, - "bytesUsed" => 1500 + "policyId" => "did8jx6ws45jana098ab7", + "size" => 100000, + "status" => "completed", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "migrationId" => "did8jx6ws45jana098ab7", + "services" => array(), + "resources" => array() ) ) ) @@ -100,14 +86,14 @@ public function testMethodCreate(): void "policies" => array( array( "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(), - "lengths" => array() + "services" => array(), + "resources" => array(), + "retention" => 7, + "schedule" => "0 * * * *", + "enabled" => true ) ), "archives" => array( @@ -115,27 +101,13 @@ public function testMethodCreate(): void "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "databaseId" => "5e5ea5c16897e", - "name" => "My Collection", - "enabled" => true, - "documentSecurity" => true, - "attributes" => array(), - "indexes" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(), - "lengths" => array() - ) - ), - "bytesMax" => 65535, - "bytesUsed" => 1500 + "policyId" => "did8jx6ws45jana098ab7", + "size" => 100000, + "status" => "completed", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "migrationId" => "did8jx6ws45jana098ab7", + "services" => array(), + "resources" => array() ) ) ); @@ -290,14 +262,14 @@ public function testMethodGet(): void "policies" => array( array( "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(), - "lengths" => array() + "services" => array(), + "resources" => array(), + "retention" => 7, + "schedule" => "0 * * * *", + "enabled" => true ) ), "archives" => array( @@ -305,27 +277,13 @@ public function testMethodGet(): void "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "databaseId" => "5e5ea5c16897e", - "name" => "My Collection", - "enabled" => true, - "documentSecurity" => true, - "attributes" => array(), - "indexes" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(), - "lengths" => array() - ) - ), - "bytesMax" => 65535, - "bytesUsed" => 1500 + "policyId" => "did8jx6ws45jana098ab7", + "size" => 100000, + "status" => "completed", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "migrationId" => "did8jx6ws45jana098ab7", + "services" => array(), + "resources" => array() ) ) ); @@ -353,14 +311,14 @@ public function testMethodUpdate(): void "policies" => array( array( "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(), - "lengths" => array() + "services" => array(), + "resources" => array(), + "retention" => 7, + "schedule" => "0 * * * *", + "enabled" => true ) ), "archives" => array( @@ -368,27 +326,13 @@ public function testMethodUpdate(): void "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "databaseId" => "5e5ea5c16897e", - "name" => "My Collection", - "enabled" => true, - "documentSecurity" => true, - "attributes" => array(), - "indexes" => array( - array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(), - "lengths" => array() - ) - ), - "bytesMax" => 65535, - "bytesUsed" => 1500 + "policyId" => "did8jx6ws45jana098ab7", + "size" => 100000, + "status" => "completed", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "migrationId" => "did8jx6ws45jana098ab7", + "services" => array(), + "resources" => array() ) ) ); diff --git a/tests/Appwrite/Services/UsageTest.php b/tests/Appwrite/Services/UsageTest.php new file mode 100644 index 0000000..29fabee --- /dev/null +++ b/tests/Appwrite/Services/UsageTest.php @@ -0,0 +1,72 @@ +client = Mockery::mock(Client::class); + $this->usage = new Usage($this->client); + } + + public function testMethodListEvents(): void + { + $data = array( + "total" => 5, + "events" => array( + array( + "metric" => "bandwidth", + "value" => 5000, + "time" => "2026-04-09T12:00:00.000+00:00", + "path" => "/v1/storage/files", + "method" => "POST", + "status" => "201", + "resourceType" => "bucket", + "resourceId" => "abc123", + "countryCode" => "US", + "userAgent" => "AppwriteSDK/1.0" + ) + ) + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->usage->listEvents(); + + $this->assertInstanceOf(\Appwrite\Models\UsageEventList::class, $response); + } + + public function testMethodListGauges(): void + { + $data = array( + "total" => 5, + "gauges" => array( + array( + "metric" => "users", + "value" => 1500, + "time" => "2026-04-09T12:00:00.000+00:00" + ) + ) + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->usage->listGauges(); + + $this->assertInstanceOf(\Appwrite\Models\UsageGaugeList::class, $response); + } + +} From eee806f311a0db30a71390bb727066e0603542ae Mon Sep 17 00:00:00 2001 From: root Date: Mon, 18 May 2026 12:31:30 +0000 Subject: [PATCH 2/2] chore: update PHP SDK to 24.0.0 --- docs/project.md | 4 ++-- tests/Appwrite/Services/ProjectTest.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/project.md b/docs/project.md index 81f603c..7ef92d7 100644 --- a/docs/project.md +++ b/docs/project.md @@ -501,7 +501,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/google | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com | | -| clientSecret | string | 'Client Secret' of Google OAuth2 app. For example: GOCSPX-2k8gsR0000000000000000VNahJj | | +| clientSecret | string | 'Client Secret' of Google OAuth2 app. For example: example-google-client-secret | | | prompt | array | Array of Google OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. Must not be specified with other values. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | @@ -549,7 +549,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/linkedin | Field Name | Type | Description | Default | | --- | --- | --- | --- | | clientId | string | 'Client ID' of Linkedin OAuth2 app. For example: 770000000000dv | | -| primaryClientSecret | string | 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: WPL_AP1.2Bf0000000000000./HtlYw== | | +| primaryClientSecret | string | 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: example-linkedin-client-secret | | | enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | diff --git a/tests/Appwrite/Services/ProjectTest.php b/tests/Appwrite/Services/ProjectTest.php index eb0a579..81180fb 100644 --- a/tests/Appwrite/Services/ProjectTest.php +++ b/tests/Appwrite/Services/ProjectTest.php @@ -907,7 +907,7 @@ public function testMethodUpdateOAuth2Google(): void "\$id" => "github", "enabled" => true, "clientId" => "120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com", - "clientSecret" => "GOCSPX-2k8gsR0000000000000000VNahJj", + "clientSecret" => "example-google-client-secret", "prompt" => array() ); @@ -964,7 +964,7 @@ public function testMethodUpdateOAuth2Linkedin(): void "\$id" => "github", "enabled" => true, "clientId" => "770000000000dv", - "primaryClientSecret" => "WPL_AP1.2Bf0000000000000./HtlYw==" + "primaryClientSecret" => "example-linkedin-client-secret" ); $this->client