From b5a5a557f9951b48cc4b26b211e34ac7f254ba8d Mon Sep 17 00:00:00 2001 From: root Date: Fri, 8 May 2026 11:06:35 +0000 Subject: [PATCH] feat: PHP SDK update for version 23.1.0 --- CHANGELOG.md | 6 + README.md | 4 +- docs/account.md | 2 +- docs/databases.md | 42 + .../databases/create-big-int-attribute.md | 23 + .../databases/update-big-int-attribute.md | 23 + docs/examples/functions/create-variable.md | 1 + docs/examples/functions/create.md | 2 +- docs/examples/functions/list-variables.md | 4 +- docs/examples/functions/update-variable.md | 2 +- docs/examples/functions/update.md | 2 +- 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 | 18 + docs/examples/project/create-key.md | 2 +- docs/examples/project/create-mock-phone.md | 17 + docs/examples/project/create-smtp-test.md | 16 + docs/examples/project/delete-mock-phone.md | 16 + docs/examples/project/delete.md | 15 + docs/examples/project/get-email-template.md | 19 + docs/examples/project/get-mock-phone.md | 16 + .../examples/project/get-o-auth-2-provider.md | 17 + docs/examples/project/get-policy.md | 17 + docs/examples/project/list-email-templates.md | 17 + docs/examples/project/list-mock-phones.md | 17 + .../project/list-o-auth-2-providers.md | 17 + docs/examples/project/list-policies.md | 17 + docs/examples/project/update-auth-method.md | 18 + .../examples/project/update-email-template.md | 25 + docs/examples/project/update-key.md | 2 +- .../update-membership-privacy-policy.md | 20 + docs/examples/project/update-mock-phone.md | 17 + .../project/update-o-auth-2-amazon.md | 18 + .../examples/project/update-o-auth-2-apple.md | 20 + .../project/update-o-auth-2-auth-0.md | 19 + .../project/update-o-auth-2-authentik.md | 19 + .../project/update-o-auth-2-autodesk.md | 18 + .../project/update-o-auth-2-bitbucket.md | 18 + .../examples/project/update-o-auth-2-bitly.md | 18 + docs/examples/project/update-o-auth-2-box.md | 18 + .../project/update-o-auth-2-dailymotion.md | 18 + .../project/update-o-auth-2-discord.md | 18 + .../project/update-o-auth-2-disqus.md | 18 + .../project/update-o-auth-2-dropbox.md | 18 + docs/examples/project/update-o-auth-2-etsy.md | 18 + .../project/update-o-auth-2-facebook.md | 18 + .../examples/project/update-o-auth-2-figma.md | 18 + .../project/update-o-auth-2-fusion-auth.md | 19 + .../project/update-o-auth-2-git-hub.md | 18 + .../project/update-o-auth-2-gitlab.md | 19 + .../project/update-o-auth-2-google.md | 18 + .../project/update-o-auth-2-keycloak.md | 20 + docs/examples/project/update-o-auth-2-kick.md | 18 + .../project/update-o-auth-2-linkedin.md | 18 + .../project/update-o-auth-2-microsoft.md | 19 + .../project/update-o-auth-2-notion.md | 18 + docs/examples/project/update-o-auth-2-oidc.md | 22 + docs/examples/project/update-o-auth-2-okta.md | 20 + .../project/update-o-auth-2-paypal-sandbox.md | 18 + .../project/update-o-auth-2-paypal.md | 18 + .../examples/project/update-o-auth-2-podio.md | 18 + .../project/update-o-auth-2-salesforce.md | 18 + .../examples/project/update-o-auth-2-slack.md | 18 + .../project/update-o-auth-2-spotify.md | 18 + .../project/update-o-auth-2-stripe.md | 18 + .../update-o-auth-2-tradeshift-sandbox.md | 18 + .../project/update-o-auth-2-tradeshift.md | 18 + .../project/update-o-auth-2-twitch.md | 18 + .../project/update-o-auth-2-word-press.md | 18 + .../examples/project/update-o-auth-2-yahoo.md | 18 + .../project/update-o-auth-2-yandex.md | 18 + docs/examples/project/update-o-auth-2-zoho.md | 18 + docs/examples/project/update-o-auth-2-zoom.md | 18 + docs/examples/project/update-o-auth-2x.md | 18 + .../update-password-dictionary-policy.md | 16 + .../project/update-password-history-policy.md | 16 + .../update-password-personal-data-policy.md | 16 + ...-protocol-status.md => update-protocol.md} | 2 +- ...te-service-status.md => update-service.md} | 2 +- .../project/update-session-alert-policy.md | 16 + .../project/update-session-duration-policy.md | 16 + .../update-session-invalidation-policy.md | 16 + .../project/update-session-limit-policy.md | 16 + docs/examples/project/update-smtp.md | 26 + .../project/update-user-limit-policy.md | 16 + docs/examples/proxy/create-api-rule.md | 16 + docs/examples/proxy/create-function-rule.md | 18 + docs/examples/proxy/create-redirect-rule.md | 22 + docs/examples/proxy/create-site-rule.md | 18 + docs/examples/proxy/delete-rule.md | 16 + docs/examples/proxy/get-rule.md | 16 + docs/examples/proxy/list-rules.md | 17 + docs/examples/proxy/update-rule-status.md | 16 + docs/examples/sites/create-variable.md | 1 + docs/examples/sites/list-variables.md | 4 +- docs/examples/sites/update-variable.md | 2 +- .../tablesdb/create-big-int-column.md | 23 + .../tablesdb/update-big-int-column.md | 23 + docs/functions.md | 3 + docs/presences.md | 80 + docs/project.md | 1076 +++++- docs/proxy.md | 123 + docs/sites.md | 3 + docs/tablesdb.md | 42 + src/Appwrite/Client.php | 42 +- src/Appwrite/Enums/BuildRuntime.php | 9 + src/Appwrite/Enums/EmailTemplateLocale.php | 1213 ++++++ src/Appwrite/Enums/EmailTemplateType.php | 97 + src/Appwrite/Enums/MethodId.php | 97 + src/Appwrite/Enums/OAuthProvider.php | 27 + src/Appwrite/Enums/PolicyId.php | 115 + src/Appwrite/Enums/ProviderId.php | 457 +++ src/Appwrite/Enums/ProxyResourceType.php | 52 + .../Enums/ProxyRuleDeploymentResourceType.php | 52 + src/Appwrite/Enums/ProxyRuleStatus.php | 61 + src/Appwrite/Enums/Runtime.php | 9 + src/Appwrite/Enums/Scopes.php | 615 +-- src/Appwrite/Enums/Secure.php | 52 + src/Appwrite/Enums/StatusCode.php | 70 + src/Appwrite/Models/AttributeBigint.php | 107 + src/Appwrite/Models/AuthProvider.php | 2 +- src/Appwrite/Models/BackupArchive.php | 2 +- src/Appwrite/Models/Block.php | 37 +- src/Appwrite/Models/ColumnBigint.php | 107 + src/Appwrite/Models/EmailTemplate.php | 96 + src/Appwrite/Models/EmailTemplateList.php | 59 + src/Appwrite/Models/EphemeralKey.php | 103 + src/Appwrite/Models/Membership.php | 7 + src/Appwrite/Models/MockNumber.php | 32 +- src/Appwrite/Models/MockNumberList.php | 59 + src/Appwrite/Models/OAuth2Amazon.php | 68 + src/Appwrite/Models/OAuth2Apple.php | 82 + src/Appwrite/Models/OAuth2Auth0.php | 75 + src/Appwrite/Models/OAuth2Authentik.php | 75 + src/Appwrite/Models/OAuth2Autodesk.php | 68 + src/Appwrite/Models/OAuth2Bitbucket.php | 68 + src/Appwrite/Models/OAuth2Bitly.php | 68 + src/Appwrite/Models/OAuth2Box.php | 68 + src/Appwrite/Models/OAuth2Dailymotion.php | 68 + src/Appwrite/Models/OAuth2Discord.php | 68 + src/Appwrite/Models/OAuth2Disqus.php | 68 + src/Appwrite/Models/OAuth2Dropbox.php | 68 + src/Appwrite/Models/OAuth2Etsy.php | 68 + src/Appwrite/Models/OAuth2Facebook.php | 68 + src/Appwrite/Models/OAuth2Figma.php | 68 + src/Appwrite/Models/OAuth2FusionAuth.php | 75 + src/Appwrite/Models/OAuth2Github.php | 68 + src/Appwrite/Models/OAuth2Gitlab.php | 75 + src/Appwrite/Models/OAuth2Google.php | 68 + src/Appwrite/Models/OAuth2Keycloak.php | 82 + src/Appwrite/Models/OAuth2Kick.php | 68 + src/Appwrite/Models/OAuth2Linkedin.php | 68 + src/Appwrite/Models/OAuth2Microsoft.php | 75 + src/Appwrite/Models/OAuth2Notion.php | 68 + src/Appwrite/Models/OAuth2Oidc.php | 96 + src/Appwrite/Models/OAuth2Okta.php | 82 + src/Appwrite/Models/OAuth2Paypal.php | 68 + src/Appwrite/Models/OAuth2Podio.php | 68 + src/Appwrite/Models/OAuth2ProviderList.php | 54 + src/Appwrite/Models/OAuth2Salesforce.php | 68 + src/Appwrite/Models/OAuth2Slack.php | 68 + src/Appwrite/Models/OAuth2Spotify.php | 68 + src/Appwrite/Models/OAuth2Stripe.php | 68 + src/Appwrite/Models/OAuth2Tradeshift.php | 68 + src/Appwrite/Models/OAuth2Twitch.php | 68 + src/Appwrite/Models/OAuth2WordPress.php | 68 + src/Appwrite/Models/OAuth2X.php | 68 + src/Appwrite/Models/OAuth2Yahoo.php | 68 + src/Appwrite/Models/OAuth2Yandex.php | 68 + src/Appwrite/Models/OAuth2Zoho.php | 68 + src/Appwrite/Models/OAuth2Zoom.php | 68 + src/Appwrite/Models/PolicyList.php | 54 + .../Models/PolicyMembershipPrivacy.php | 82 + .../Models/PolicyPasswordDictionary.php | 54 + src/Appwrite/Models/PolicyPasswordHistory.php | 54 + .../Models/PolicyPasswordPersonalData.php | 54 + src/Appwrite/Models/PolicySessionAlert.php | 54 + src/Appwrite/Models/PolicySessionDuration.php | 54 + .../Models/PolicySessionInvalidation.php | 54 + src/Appwrite/Models/PolicySessionLimit.php | 54 + src/Appwrite/Models/PolicyUserLimit.php | 54 + src/Appwrite/Models/Presence.php | 129 + src/Appwrite/Models/PresenceList.php | 59 + src/Appwrite/Models/Project.php | 35 +- src/Appwrite/Models/ProxyRule.php | 145 + src/Appwrite/Models/ProxyRuleList.php | 59 + src/Appwrite/Services/Databases.php | 113 + src/Appwrite/Services/Functions.php | 20 +- src/Appwrite/Services/Presences.php | 231 ++ src/Appwrite/Services/Project.php | 3430 +++++++++++++++-- src/Appwrite/Services/Proxy.php | 347 ++ src/Appwrite/Services/Sites.php | 20 +- src/Appwrite/Services/TablesDB.php | 107 + tests/Appwrite/Services/DatabasesTest.php | 53 + tests/Appwrite/Services/FunctionsTest.php | 4 +- tests/Appwrite/Services/PresencesTest.php | 138 + tests/Appwrite/Services/ProjectTest.php | 3333 +++++++++++++++- tests/Appwrite/Services/ProxyTest.php | 257 ++ tests/Appwrite/Services/SitesTest.php | 4 +- tests/Appwrite/Services/TablesDBTest.php | 53 + tests/Appwrite/Services/TeamsTest.php | 5 + tests/Appwrite/Services/UsersTest.php | 1 + 205 files changed, 17813 insertions(+), 715 deletions(-) create mode 100644 docs/examples/databases/create-big-int-attribute.md create mode 100644 docs/examples/databases/update-big-int-attribute.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/create-ephemeral-key.md create mode 100644 docs/examples/project/create-mock-phone.md create mode 100644 docs/examples/project/create-smtp-test.md create mode 100644 docs/examples/project/delete-mock-phone.md create mode 100644 docs/examples/project/delete.md create mode 100644 docs/examples/project/get-email-template.md create mode 100644 docs/examples/project/get-mock-phone.md create mode 100644 docs/examples/project/get-o-auth-2-provider.md create mode 100644 docs/examples/project/get-policy.md create mode 100644 docs/examples/project/list-email-templates.md create mode 100644 docs/examples/project/list-mock-phones.md create mode 100644 docs/examples/project/list-o-auth-2-providers.md create mode 100644 docs/examples/project/list-policies.md create mode 100644 docs/examples/project/update-auth-method.md create mode 100644 docs/examples/project/update-email-template.md create mode 100644 docs/examples/project/update-membership-privacy-policy.md create mode 100644 docs/examples/project/update-mock-phone.md create mode 100644 docs/examples/project/update-o-auth-2-amazon.md create mode 100644 docs/examples/project/update-o-auth-2-apple.md create mode 100644 docs/examples/project/update-o-auth-2-auth-0.md create mode 100644 docs/examples/project/update-o-auth-2-authentik.md create mode 100644 docs/examples/project/update-o-auth-2-autodesk.md create mode 100644 docs/examples/project/update-o-auth-2-bitbucket.md create mode 100644 docs/examples/project/update-o-auth-2-bitly.md create mode 100644 docs/examples/project/update-o-auth-2-box.md create mode 100644 docs/examples/project/update-o-auth-2-dailymotion.md create mode 100644 docs/examples/project/update-o-auth-2-discord.md create mode 100644 docs/examples/project/update-o-auth-2-disqus.md create mode 100644 docs/examples/project/update-o-auth-2-dropbox.md create mode 100644 docs/examples/project/update-o-auth-2-etsy.md create mode 100644 docs/examples/project/update-o-auth-2-facebook.md create mode 100644 docs/examples/project/update-o-auth-2-figma.md create mode 100644 docs/examples/project/update-o-auth-2-fusion-auth.md create mode 100644 docs/examples/project/update-o-auth-2-git-hub.md create mode 100644 docs/examples/project/update-o-auth-2-gitlab.md create mode 100644 docs/examples/project/update-o-auth-2-google.md create mode 100644 docs/examples/project/update-o-auth-2-keycloak.md create mode 100644 docs/examples/project/update-o-auth-2-kick.md create mode 100644 docs/examples/project/update-o-auth-2-linkedin.md create mode 100644 docs/examples/project/update-o-auth-2-microsoft.md create mode 100644 docs/examples/project/update-o-auth-2-notion.md create mode 100644 docs/examples/project/update-o-auth-2-oidc.md create mode 100644 docs/examples/project/update-o-auth-2-okta.md create mode 100644 docs/examples/project/update-o-auth-2-paypal-sandbox.md create mode 100644 docs/examples/project/update-o-auth-2-paypal.md create mode 100644 docs/examples/project/update-o-auth-2-podio.md create mode 100644 docs/examples/project/update-o-auth-2-salesforce.md create mode 100644 docs/examples/project/update-o-auth-2-slack.md create mode 100644 docs/examples/project/update-o-auth-2-spotify.md create mode 100644 docs/examples/project/update-o-auth-2-stripe.md create mode 100644 docs/examples/project/update-o-auth-2-tradeshift-sandbox.md create mode 100644 docs/examples/project/update-o-auth-2-tradeshift.md create mode 100644 docs/examples/project/update-o-auth-2-twitch.md create mode 100644 docs/examples/project/update-o-auth-2-word-press.md create mode 100644 docs/examples/project/update-o-auth-2-yahoo.md create mode 100644 docs/examples/project/update-o-auth-2-yandex.md create mode 100644 docs/examples/project/update-o-auth-2-zoho.md create mode 100644 docs/examples/project/update-o-auth-2-zoom.md create mode 100644 docs/examples/project/update-o-auth-2x.md create mode 100644 docs/examples/project/update-password-dictionary-policy.md create mode 100644 docs/examples/project/update-password-history-policy.md create mode 100644 docs/examples/project/update-password-personal-data-policy.md rename docs/examples/project/{update-protocol-status.md => update-protocol.md} (90%) rename docs/examples/project/{update-service-status.md => update-service.md} (90%) create mode 100644 docs/examples/project/update-session-alert-policy.md create mode 100644 docs/examples/project/update-session-duration-policy.md create mode 100644 docs/examples/project/update-session-invalidation-policy.md create mode 100644 docs/examples/project/update-session-limit-policy.md create mode 100644 docs/examples/project/update-smtp.md create mode 100644 docs/examples/project/update-user-limit-policy.md create mode 100644 docs/examples/proxy/create-api-rule.md create mode 100644 docs/examples/proxy/create-function-rule.md create mode 100644 docs/examples/proxy/create-redirect-rule.md create mode 100644 docs/examples/proxy/create-site-rule.md create mode 100644 docs/examples/proxy/delete-rule.md create mode 100644 docs/examples/proxy/get-rule.md create mode 100644 docs/examples/proxy/list-rules.md create mode 100644 docs/examples/proxy/update-rule-status.md create mode 100644 docs/examples/tablesdb/create-big-int-column.md create mode 100644 docs/examples/tablesdb/update-big-int-column.md create mode 100644 docs/presences.md create mode 100644 docs/proxy.md create mode 100644 src/Appwrite/Enums/EmailTemplateLocale.php create mode 100644 src/Appwrite/Enums/EmailTemplateType.php create mode 100644 src/Appwrite/Enums/MethodId.php create mode 100644 src/Appwrite/Enums/PolicyId.php create mode 100644 src/Appwrite/Enums/ProviderId.php create mode 100644 src/Appwrite/Enums/ProxyResourceType.php create mode 100644 src/Appwrite/Enums/ProxyRuleDeploymentResourceType.php create mode 100644 src/Appwrite/Enums/ProxyRuleStatus.php create mode 100644 src/Appwrite/Enums/Secure.php create mode 100644 src/Appwrite/Enums/StatusCode.php create mode 100644 src/Appwrite/Models/AttributeBigint.php create mode 100644 src/Appwrite/Models/ColumnBigint.php create mode 100644 src/Appwrite/Models/EmailTemplate.php create mode 100644 src/Appwrite/Models/EmailTemplateList.php create mode 100644 src/Appwrite/Models/EphemeralKey.php create mode 100644 src/Appwrite/Models/MockNumberList.php create mode 100644 src/Appwrite/Models/OAuth2Amazon.php create mode 100644 src/Appwrite/Models/OAuth2Apple.php create mode 100644 src/Appwrite/Models/OAuth2Auth0.php create mode 100644 src/Appwrite/Models/OAuth2Authentik.php create mode 100644 src/Appwrite/Models/OAuth2Autodesk.php create mode 100644 src/Appwrite/Models/OAuth2Bitbucket.php create mode 100644 src/Appwrite/Models/OAuth2Bitly.php create mode 100644 src/Appwrite/Models/OAuth2Box.php create mode 100644 src/Appwrite/Models/OAuth2Dailymotion.php create mode 100644 src/Appwrite/Models/OAuth2Discord.php create mode 100644 src/Appwrite/Models/OAuth2Disqus.php create mode 100644 src/Appwrite/Models/OAuth2Dropbox.php create mode 100644 src/Appwrite/Models/OAuth2Etsy.php create mode 100644 src/Appwrite/Models/OAuth2Facebook.php create mode 100644 src/Appwrite/Models/OAuth2Figma.php create mode 100644 src/Appwrite/Models/OAuth2FusionAuth.php create mode 100644 src/Appwrite/Models/OAuth2Github.php create mode 100644 src/Appwrite/Models/OAuth2Gitlab.php create mode 100644 src/Appwrite/Models/OAuth2Google.php create mode 100644 src/Appwrite/Models/OAuth2Keycloak.php create mode 100644 src/Appwrite/Models/OAuth2Kick.php create mode 100644 src/Appwrite/Models/OAuth2Linkedin.php create mode 100644 src/Appwrite/Models/OAuth2Microsoft.php create mode 100644 src/Appwrite/Models/OAuth2Notion.php create mode 100644 src/Appwrite/Models/OAuth2Oidc.php create mode 100644 src/Appwrite/Models/OAuth2Okta.php create mode 100644 src/Appwrite/Models/OAuth2Paypal.php create mode 100644 src/Appwrite/Models/OAuth2Podio.php create mode 100644 src/Appwrite/Models/OAuth2ProviderList.php create mode 100644 src/Appwrite/Models/OAuth2Salesforce.php create mode 100644 src/Appwrite/Models/OAuth2Slack.php create mode 100644 src/Appwrite/Models/OAuth2Spotify.php create mode 100644 src/Appwrite/Models/OAuth2Stripe.php create mode 100644 src/Appwrite/Models/OAuth2Tradeshift.php create mode 100644 src/Appwrite/Models/OAuth2Twitch.php create mode 100644 src/Appwrite/Models/OAuth2WordPress.php create mode 100644 src/Appwrite/Models/OAuth2X.php create mode 100644 src/Appwrite/Models/OAuth2Yahoo.php create mode 100644 src/Appwrite/Models/OAuth2Yandex.php create mode 100644 src/Appwrite/Models/OAuth2Zoho.php create mode 100644 src/Appwrite/Models/OAuth2Zoom.php create mode 100644 src/Appwrite/Models/PolicyList.php create mode 100644 src/Appwrite/Models/PolicyMembershipPrivacy.php create mode 100644 src/Appwrite/Models/PolicyPasswordDictionary.php create mode 100644 src/Appwrite/Models/PolicyPasswordHistory.php create mode 100644 src/Appwrite/Models/PolicyPasswordPersonalData.php create mode 100644 src/Appwrite/Models/PolicySessionAlert.php create mode 100644 src/Appwrite/Models/PolicySessionDuration.php create mode 100644 src/Appwrite/Models/PolicySessionInvalidation.php create mode 100644 src/Appwrite/Models/PolicySessionLimit.php create mode 100644 src/Appwrite/Models/PolicyUserLimit.php create mode 100644 src/Appwrite/Models/Presence.php create mode 100644 src/Appwrite/Models/PresenceList.php create mode 100644 src/Appwrite/Models/ProxyRule.php create mode 100644 src/Appwrite/Models/ProxyRuleList.php create mode 100644 src/Appwrite/Services/Presences.php create mode 100644 src/Appwrite/Services/Proxy.php create mode 100644 tests/Appwrite/Services/PresencesTest.php create mode 100644 tests/Appwrite/Services/ProxyTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index bf49df96..8514a50e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 23.1.0 + +* Added: Introduced `bigint` create/update APIs for legacy Databases attributes +* Added: Introduced `bigint` create/update APIs for `TablesDB` columns +* Updated: Extended key-list query filters with `key`, `resourceType`, `resourceId`, and `secret` + ## 23.0.0 * [BREAKING] Renamed Webhook model fields: `security` → `tls`, `httpUser` → `authUsername`, `httpPass` → `authPassword`, `signatureKey` → `secret` diff --git a/README.md b/README.md index 1d399118..5648365d 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Appwrite PHP SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-php.svg?style=flat-square&v=1) -![Version](https://img.shields.io/badge/api%20version-1.9.1-blue.svg?style=flat-square&v=1) +![Version](https://img.shields.io/badge/api%20version-1.9.4-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) -**This SDK is compatible with Appwrite server version 1.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-php/releases).** +**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-php/releases).** Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the PHP SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) diff --git a/docs/account.md b/docs/account.md index 11d4edbf..9b74014c 100644 --- a/docs/account.md +++ b/docs/account.md @@ -565,7 +565,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| provider | string | **Required** OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. | | +| provider | string | **Required** OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. | | | success | string | URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. | | | failure | string | URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. | | | scopes | array | A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. | [] | diff --git a/docs/databases.md b/docs/databases.md index 71399a9b..b3435f40 100644 --- a/docs/databases.md +++ b/docs/databases.md @@ -253,6 +253,48 @@ GET https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionI | total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | +```http request +POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/bigint +``` + +** Create a bigint attribute. Optionally, minimum and maximum values can be provided. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| key | string | Attribute Key. | | +| required | boolean | Is attribute required? | | +| min | integer | Minimum value | | +| max | integer | Maximum value | | +| default | integer | Default value. Cannot be set when attribute is required. | | +| array | boolean | Is attribute an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/bigint/{key} +``` + +** Update a bigint attribute. Changing the `default` value will not update already existing documents. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| key | string | **Required** Attribute Key. | | +| required | boolean | Is attribute required? | | +| min | integer | Minimum value | | +| max | integer | Maximum value | | +| default | integer | Default value. Cannot be set when attribute is required. | | +| newKey | string | New Attribute Key. | | + + ```http request POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/boolean ``` diff --git a/docs/examples/databases/create-big-int-attribute.md b/docs/examples/databases/create-big-int-attribute.md new file mode 100644 index 00000000..eea06b58 --- /dev/null +++ b/docs/examples/databases/create-big-int-attribute.md @@ -0,0 +1,23 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createBigIntAttribute( + databaseId: '', + collectionId: '', + key: '', + required: false, + min: null, // optional + max: null, // optional + default: null, // optional + array: false // optional +);``` diff --git a/docs/examples/databases/update-big-int-attribute.md b/docs/examples/databases/update-big-int-attribute.md new file mode 100644 index 00000000..5d0eb63e --- /dev/null +++ b/docs/examples/databases/update-big-int-attribute.md @@ -0,0 +1,23 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateBigIntAttribute( + databaseId: '', + collectionId: '', + key: '', + required: false, + default: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +);``` diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md index d860cb32..685a21aa 100644 --- a/docs/examples/functions/create-variable.md +++ b/docs/examples/functions/create-variable.md @@ -13,6 +13,7 @@ $functions = new Functions($client); $result = $functions->createVariable( functionId: '', + variableId: '', key: '', value: '', secret: false // optional diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index 958a4aa1..8f387dcb 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -25,7 +25,7 @@ $result = $functions->create( logging: false, // optional entrypoint: '', // optional commands: '', // optional - scopes: [Scopes::SESSIONSWRITE()], // optional + scopes: [Scopes::PROJECTREAD()], // optional installationId: '', // optional providerRepositoryId: '', // optional providerBranch: '', // optional diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md index 8867ad6c..33d09ddf 100644 --- a/docs/examples/functions/list-variables.md +++ b/docs/examples/functions/list-variables.md @@ -12,5 +12,7 @@ $client = (new Client()) $functions = new Functions($client); $result = $functions->listVariables( - functionId: '' + functionId: '', + queries: [], // optional + total: false // optional );``` diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md index 3a280697..c4b9a4c3 100644 --- a/docs/examples/functions/update-variable.md +++ b/docs/examples/functions/update-variable.md @@ -14,7 +14,7 @@ $functions = new Functions($client); $result = $functions->updateVariable( functionId: '', variableId: '', - key: '', + key: '', // optional value: '', // optional secret: false // optional );``` diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index 56e66b57..564428c9 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -25,7 +25,7 @@ $result = $functions->update( logging: false, // optional entrypoint: '', // optional commands: '', // optional - scopes: [Scopes::SESSIONSWRITE()], // optional + scopes: [Scopes::PROJECTREAD()], // optional installationId: '', // optional providerRepositoryId: '', // optional providerBranch: '', // optional diff --git a/docs/examples/presences/delete.md b/docs/examples/presences/delete.md new file mode 100644 index 00000000..225ee6ca --- /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 00000000..c0196986 --- /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 00000000..61620297 --- /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 00000000..d017a136 --- /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 00000000..f6d34e2e --- /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 new file mode 100644 index 00000000..fbbac300 --- /dev/null +++ b/docs/examples/project/create-ephemeral-key.md @@ -0,0 +1,18 @@ +```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->createEphemeralKey( + scopes: [Scopes::PROJECTREAD()], + duration: 600 +);``` diff --git a/docs/examples/project/create-key.md b/docs/examples/project/create-key.md index cd8020b0..9157fcef 100644 --- a/docs/examples/project/create-key.md +++ b/docs/examples/project/create-key.md @@ -15,6 +15,6 @@ $project = new Project($client); $result = $project->createKey( keyId: '', name: '', - scopes: [Scopes::SESSIONSWRITE()], + scopes: [Scopes::PROJECTREAD()], expire: '2020-10-15T06:38:00.000+00:00' // optional );``` diff --git a/docs/examples/project/create-mock-phone.md b/docs/examples/project/create-mock-phone.md new file mode 100644 index 00000000..6d73a0b4 --- /dev/null +++ b/docs/examples/project/create-mock-phone.md @@ -0,0 +1,17 @@ +```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->createMockPhone( + number: '+12065550100', + otp: '' +);``` diff --git a/docs/examples/project/create-smtp-test.md b/docs/examples/project/create-smtp-test.md new file mode 100644 index 00000000..98cb7edd --- /dev/null +++ b/docs/examples/project/create-smtp-test.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->createSMTPTest( + emails: [] +);``` diff --git a/docs/examples/project/delete-mock-phone.md b/docs/examples/project/delete-mock-phone.md new file mode 100644 index 00000000..6cdfcc1c --- /dev/null +++ b/docs/examples/project/delete-mock-phone.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->deleteMockPhone( + number: '+12065550100' +);``` diff --git a/docs/examples/project/delete.md b/docs/examples/project/delete.md new file mode 100644 index 00000000..adb63241 --- /dev/null +++ b/docs/examples/project/delete.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->delete(); +``` diff --git a/docs/examples/project/get-email-template.md b/docs/examples/project/get-email-template.md new file mode 100644 index 00000000..409933db --- /dev/null +++ b/docs/examples/project/get-email-template.md @@ -0,0 +1,19 @@ +```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->getEmailTemplate( + templateId: EmailTemplateType::VERIFICATION(), + locale: EmailTemplateLocale::AF() // optional +);``` diff --git a/docs/examples/project/get-mock-phone.md b/docs/examples/project/get-mock-phone.md new file mode 100644 index 00000000..512d64c4 --- /dev/null +++ b/docs/examples/project/get-mock-phone.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->getMockPhone( + number: '+12065550100' +);``` diff --git a/docs/examples/project/get-o-auth-2-provider.md b/docs/examples/project/get-o-auth-2-provider.md new file mode 100644 index 00000000..0fb2da1f --- /dev/null +++ b/docs/examples/project/get-o-auth-2-provider.md @@ -0,0 +1,17 @@ +```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->getOAuth2Provider( + providerId: ProviderId::AMAZON() +);``` diff --git a/docs/examples/project/get-policy.md b/docs/examples/project/get-policy.md new file mode 100644 index 00000000..4698932a --- /dev/null +++ b/docs/examples/project/get-policy.md @@ -0,0 +1,17 @@ +```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->getPolicy( + policyId: PolicyId::PASSWORDDICTIONARY() +);``` diff --git a/docs/examples/project/list-email-templates.md b/docs/examples/project/list-email-templates.md new file mode 100644 index 00000000..47c65c4d --- /dev/null +++ b/docs/examples/project/list-email-templates.md @@ -0,0 +1,17 @@ +```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->listEmailTemplates( + queries: [], // optional + total: false // optional +);``` diff --git a/docs/examples/project/list-mock-phones.md b/docs/examples/project/list-mock-phones.md new file mode 100644 index 00000000..5ca11c28 --- /dev/null +++ b/docs/examples/project/list-mock-phones.md @@ -0,0 +1,17 @@ +```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->listMockPhones( + queries: [], // optional + total: false // optional +);``` diff --git a/docs/examples/project/list-o-auth-2-providers.md b/docs/examples/project/list-o-auth-2-providers.md new file mode 100644 index 00000000..5f661d4b --- /dev/null +++ b/docs/examples/project/list-o-auth-2-providers.md @@ -0,0 +1,17 @@ +```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->listOAuth2Providers( + queries: [], // optional + total: false // optional +);``` diff --git a/docs/examples/project/list-policies.md b/docs/examples/project/list-policies.md new file mode 100644 index 00000000..59d49f3e --- /dev/null +++ b/docs/examples/project/list-policies.md @@ -0,0 +1,17 @@ +```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->listPolicies( + queries: [], // optional + total: false // optional +);``` diff --git a/docs/examples/project/update-auth-method.md b/docs/examples/project/update-auth-method.md new file mode 100644 index 00000000..a63711ed --- /dev/null +++ b/docs/examples/project/update-auth-method.md @@ -0,0 +1,18 @@ +```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->updateAuthMethod( + methodId: MethodId::EMAILPASSWORD(), + enabled: false +);``` diff --git a/docs/examples/project/update-email-template.md b/docs/examples/project/update-email-template.md new file mode 100644 index 00000000..442d2c14 --- /dev/null +++ b/docs/examples/project/update-email-template.md @@ -0,0 +1,25 @@ +```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->updateEmailTemplate( + templateId: EmailTemplateType::VERIFICATION(), + locale: EmailTemplateLocale::AF(), // optional + subject: '', // optional + message: '', // optional + senderName: '', // optional + senderEmail: 'email@example.com', // optional + replyToEmail: 'email@example.com', // optional + replyToName: '' // optional +);``` diff --git a/docs/examples/project/update-key.md b/docs/examples/project/update-key.md index 589f018a..1d1e6fd6 100644 --- a/docs/examples/project/update-key.md +++ b/docs/examples/project/update-key.md @@ -15,6 +15,6 @@ $project = new Project($client); $result = $project->updateKey( keyId: '', name: '', - scopes: [Scopes::SESSIONSWRITE()], + scopes: [Scopes::PROJECTREAD()], expire: '2020-10-15T06:38:00.000+00:00' // optional );``` diff --git a/docs/examples/project/update-membership-privacy-policy.md b/docs/examples/project/update-membership-privacy-policy.md new file mode 100644 index 00000000..a62ace78 --- /dev/null +++ b/docs/examples/project/update-membership-privacy-policy.md @@ -0,0 +1,20 @@ +```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->updateMembershipPrivacyPolicy( + userId: false, // optional + userEmail: false, // optional + userPhone: false, // optional + userName: false, // optional + userMFA: false // optional +);``` diff --git a/docs/examples/project/update-mock-phone.md b/docs/examples/project/update-mock-phone.md new file mode 100644 index 00000000..f157343f --- /dev/null +++ b/docs/examples/project/update-mock-phone.md @@ -0,0 +1,17 @@ +```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->updateMockPhone( + number: '+12065550100', + otp: '' +);``` diff --git a/docs/examples/project/update-o-auth-2-amazon.md b/docs/examples/project/update-o-auth-2-amazon.md new file mode 100644 index 00000000..8a473860 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-amazon.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Amazon( + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-apple.md b/docs/examples/project/update-o-auth-2-apple.md new file mode 100644 index 00000000..3f4516c3 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-apple.md @@ -0,0 +1,20 @@ +```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->updateOAuth2Apple( + serviceId: '', // optional + keyId: '', // optional + teamId: '', // optional + p8File: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-auth-0.md b/docs/examples/project/update-o-auth-2-auth-0.md new file mode 100644 index 00000000..d9f17f78 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-auth-0.md @@ -0,0 +1,19 @@ +```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->updateOAuth2Auth0( + clientId: '', // optional + clientSecret: '', // optional + endpoint: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-authentik.md b/docs/examples/project/update-o-auth-2-authentik.md new file mode 100644 index 00000000..b5c7e27e --- /dev/null +++ b/docs/examples/project/update-o-auth-2-authentik.md @@ -0,0 +1,19 @@ +```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->updateOAuth2Authentik( + clientId: '', // optional + clientSecret: '', // optional + endpoint: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-autodesk.md b/docs/examples/project/update-o-auth-2-autodesk.md new file mode 100644 index 00000000..e85b9bb9 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-autodesk.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Autodesk( + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-bitbucket.md b/docs/examples/project/update-o-auth-2-bitbucket.md new file mode 100644 index 00000000..4985215c --- /dev/null +++ b/docs/examples/project/update-o-auth-2-bitbucket.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Bitbucket( + key: '', // optional + secret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-bitly.md b/docs/examples/project/update-o-auth-2-bitly.md new file mode 100644 index 00000000..b8c00ecd --- /dev/null +++ b/docs/examples/project/update-o-auth-2-bitly.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Bitly( + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-box.md b/docs/examples/project/update-o-auth-2-box.md new file mode 100644 index 00000000..ba88f561 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-box.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Box( + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-dailymotion.md b/docs/examples/project/update-o-auth-2-dailymotion.md new file mode 100644 index 00000000..44634caa --- /dev/null +++ b/docs/examples/project/update-o-auth-2-dailymotion.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Dailymotion( + apiKey: '', // optional + apiSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-discord.md b/docs/examples/project/update-o-auth-2-discord.md new file mode 100644 index 00000000..d323c92d --- /dev/null +++ b/docs/examples/project/update-o-auth-2-discord.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Discord( + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-disqus.md b/docs/examples/project/update-o-auth-2-disqus.md new file mode 100644 index 00000000..30281862 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-disqus.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Disqus( + publicKey: '', // optional + secretKey: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-dropbox.md b/docs/examples/project/update-o-auth-2-dropbox.md new file mode 100644 index 00000000..59575cdc --- /dev/null +++ b/docs/examples/project/update-o-auth-2-dropbox.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Dropbox( + appKey: '', // optional + appSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-etsy.md b/docs/examples/project/update-o-auth-2-etsy.md new file mode 100644 index 00000000..19aab961 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-etsy.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Etsy( + keyString: '', // optional + sharedSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-facebook.md b/docs/examples/project/update-o-auth-2-facebook.md new file mode 100644 index 00000000..8f76d065 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-facebook.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Facebook( + appId: '', // optional + appSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-figma.md b/docs/examples/project/update-o-auth-2-figma.md new file mode 100644 index 00000000..71d36ebf --- /dev/null +++ b/docs/examples/project/update-o-auth-2-figma.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Figma( + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-fusion-auth.md b/docs/examples/project/update-o-auth-2-fusion-auth.md new file mode 100644 index 00000000..0b3709b2 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-fusion-auth.md @@ -0,0 +1,19 @@ +```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->updateOAuth2FusionAuth( + clientId: '', // optional + clientSecret: '', // optional + endpoint: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-git-hub.md b/docs/examples/project/update-o-auth-2-git-hub.md new file mode 100644 index 00000000..62871aa6 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-git-hub.md @@ -0,0 +1,18 @@ +```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->updateOAuth2GitHub( + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-gitlab.md b/docs/examples/project/update-o-auth-2-gitlab.md new file mode 100644 index 00000000..2532af0c --- /dev/null +++ b/docs/examples/project/update-o-auth-2-gitlab.md @@ -0,0 +1,19 @@ +```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->updateOAuth2Gitlab( + applicationId: '', // optional + secret: '', // optional + endpoint: 'https://example.com', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-google.md b/docs/examples/project/update-o-auth-2-google.md new file mode 100644 index 00000000..06fc6b62 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-google.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Google( + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-keycloak.md b/docs/examples/project/update-o-auth-2-keycloak.md new file mode 100644 index 00000000..3604e4b6 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-keycloak.md @@ -0,0 +1,20 @@ +```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->updateOAuth2Keycloak( + clientId: '', // optional + clientSecret: '', // optional + endpoint: '', // optional + realmName: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-kick.md b/docs/examples/project/update-o-auth-2-kick.md new file mode 100644 index 00000000..02c876fc --- /dev/null +++ b/docs/examples/project/update-o-auth-2-kick.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Kick( + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-linkedin.md b/docs/examples/project/update-o-auth-2-linkedin.md new file mode 100644 index 00000000..06451e14 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-linkedin.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Linkedin( + clientId: '', // optional + primaryClientSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-microsoft.md b/docs/examples/project/update-o-auth-2-microsoft.md new file mode 100644 index 00000000..f5a0af73 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-microsoft.md @@ -0,0 +1,19 @@ +```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->updateOAuth2Microsoft( + applicationId: '', // optional + applicationSecret: '', // optional + tenant: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-notion.md b/docs/examples/project/update-o-auth-2-notion.md new file mode 100644 index 00000000..abf0b430 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-notion.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Notion( + oauthClientId: '', // optional + oauthClientSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-oidc.md b/docs/examples/project/update-o-auth-2-oidc.md new file mode 100644 index 00000000..1b9d9b86 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-oidc.md @@ -0,0 +1,22 @@ +```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->updateOAuth2Oidc( + clientId: '', // optional + clientSecret: '', // optional + wellKnownURL: 'https://example.com', // optional + authorizationURL: 'https://example.com', // optional + tokenURL: 'https://example.com', // optional + userInfoURL: 'https://example.com', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-okta.md b/docs/examples/project/update-o-auth-2-okta.md new file mode 100644 index 00000000..4de41d22 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-okta.md @@ -0,0 +1,20 @@ +```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->updateOAuth2Okta( + clientId: '', // optional + clientSecret: '', // optional + domain: '', // optional + authorizationServerId: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-paypal-sandbox.md b/docs/examples/project/update-o-auth-2-paypal-sandbox.md new file mode 100644 index 00000000..5cb43b6d --- /dev/null +++ b/docs/examples/project/update-o-auth-2-paypal-sandbox.md @@ -0,0 +1,18 @@ +```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->updateOAuth2PaypalSandbox( + clientId: '', // optional + secretKey: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-paypal.md b/docs/examples/project/update-o-auth-2-paypal.md new file mode 100644 index 00000000..51e8935f --- /dev/null +++ b/docs/examples/project/update-o-auth-2-paypal.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Paypal( + clientId: '', // optional + secretKey: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-podio.md b/docs/examples/project/update-o-auth-2-podio.md new file mode 100644 index 00000000..1c607660 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-podio.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Podio( + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-salesforce.md b/docs/examples/project/update-o-auth-2-salesforce.md new file mode 100644 index 00000000..8e0ab044 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-salesforce.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Salesforce( + customerKey: '', // optional + customerSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-slack.md b/docs/examples/project/update-o-auth-2-slack.md new file mode 100644 index 00000000..858113c8 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-slack.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Slack( + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-spotify.md b/docs/examples/project/update-o-auth-2-spotify.md new file mode 100644 index 00000000..44f22c33 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-spotify.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Spotify( + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-stripe.md b/docs/examples/project/update-o-auth-2-stripe.md new file mode 100644 index 00000000..9b2276c6 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-stripe.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Stripe( + clientId: '', // optional + apiSecretKey: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md b/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md new file mode 100644 index 00000000..24777704 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md @@ -0,0 +1,18 @@ +```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->updateOAuth2TradeshiftSandbox( + oauth2ClientId: '', // optional + oauth2ClientSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-tradeshift.md b/docs/examples/project/update-o-auth-2-tradeshift.md new file mode 100644 index 00000000..72177e62 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-tradeshift.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Tradeshift( + oauth2ClientId: '', // optional + oauth2ClientSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-twitch.md b/docs/examples/project/update-o-auth-2-twitch.md new file mode 100644 index 00000000..a3cf258d --- /dev/null +++ b/docs/examples/project/update-o-auth-2-twitch.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Twitch( + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-word-press.md b/docs/examples/project/update-o-auth-2-word-press.md new file mode 100644 index 00000000..3380007c --- /dev/null +++ b/docs/examples/project/update-o-auth-2-word-press.md @@ -0,0 +1,18 @@ +```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->updateOAuth2WordPress( + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-yahoo.md b/docs/examples/project/update-o-auth-2-yahoo.md new file mode 100644 index 00000000..588c9926 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-yahoo.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Yahoo( + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-yandex.md b/docs/examples/project/update-o-auth-2-yandex.md new file mode 100644 index 00000000..c1e5b24d --- /dev/null +++ b/docs/examples/project/update-o-auth-2-yandex.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Yandex( + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-zoho.md b/docs/examples/project/update-o-auth-2-zoho.md new file mode 100644 index 00000000..08a9b1e1 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-zoho.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Zoho( + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-zoom.md b/docs/examples/project/update-o-auth-2-zoom.md new file mode 100644 index 00000000..e30af5ba --- /dev/null +++ b/docs/examples/project/update-o-auth-2-zoom.md @@ -0,0 +1,18 @@ +```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->updateOAuth2Zoom( + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-o-auth-2x.md b/docs/examples/project/update-o-auth-2x.md new file mode 100644 index 00000000..86ee07f1 --- /dev/null +++ b/docs/examples/project/update-o-auth-2x.md @@ -0,0 +1,18 @@ +```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->updateOAuth2X( + customerKey: '', // optional + secretKey: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-password-dictionary-policy.md b/docs/examples/project/update-password-dictionary-policy.md new file mode 100644 index 00000000..680edb5f --- /dev/null +++ b/docs/examples/project/update-password-dictionary-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->updatePasswordDictionaryPolicy( + enabled: false +);``` diff --git a/docs/examples/project/update-password-history-policy.md b/docs/examples/project/update-password-history-policy.md new file mode 100644 index 00000000..2fac6d7d --- /dev/null +++ b/docs/examples/project/update-password-history-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->updatePasswordHistoryPolicy( + total: 1 +);``` diff --git a/docs/examples/project/update-password-personal-data-policy.md b/docs/examples/project/update-password-personal-data-policy.md new file mode 100644 index 00000000..6cce48c7 --- /dev/null +++ b/docs/examples/project/update-password-personal-data-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->updatePasswordPersonalDataPolicy( + enabled: false +);``` diff --git a/docs/examples/project/update-protocol-status.md b/docs/examples/project/update-protocol.md similarity index 90% rename from docs/examples/project/update-protocol-status.md rename to docs/examples/project/update-protocol.md index 272332d3..0b648577 100644 --- a/docs/examples/project/update-protocol-status.md +++ b/docs/examples/project/update-protocol.md @@ -12,7 +12,7 @@ $client = (new Client()) $project = new Project($client); -$result = $project->updateProtocolStatus( +$result = $project->updateProtocol( protocolId: ProtocolId::REST(), enabled: false );``` diff --git a/docs/examples/project/update-service-status.md b/docs/examples/project/update-service.md similarity index 90% rename from docs/examples/project/update-service-status.md rename to docs/examples/project/update-service.md index fea9614c..ba8b90e4 100644 --- a/docs/examples/project/update-service-status.md +++ b/docs/examples/project/update-service.md @@ -12,7 +12,7 @@ $client = (new Client()) $project = new Project($client); -$result = $project->updateServiceStatus( +$result = $project->updateService( serviceId: ServiceId::ACCOUNT(), enabled: false );``` diff --git a/docs/examples/project/update-session-alert-policy.md b/docs/examples/project/update-session-alert-policy.md new file mode 100644 index 00000000..ac10696c --- /dev/null +++ b/docs/examples/project/update-session-alert-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->updateSessionAlertPolicy( + enabled: false +);``` diff --git a/docs/examples/project/update-session-duration-policy.md b/docs/examples/project/update-session-duration-policy.md new file mode 100644 index 00000000..89526e79 --- /dev/null +++ b/docs/examples/project/update-session-duration-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->updateSessionDurationPolicy( + duration: 5 +);``` diff --git a/docs/examples/project/update-session-invalidation-policy.md b/docs/examples/project/update-session-invalidation-policy.md new file mode 100644 index 00000000..fa744e57 --- /dev/null +++ b/docs/examples/project/update-session-invalidation-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->updateSessionInvalidationPolicy( + enabled: false +);``` diff --git a/docs/examples/project/update-session-limit-policy.md b/docs/examples/project/update-session-limit-policy.md new file mode 100644 index 00000000..f1bb2e20 --- /dev/null +++ b/docs/examples/project/update-session-limit-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->updateSessionLimitPolicy( + total: 1 +);``` diff --git a/docs/examples/project/update-smtp.md b/docs/examples/project/update-smtp.md new file mode 100644 index 00000000..164230d2 --- /dev/null +++ b/docs/examples/project/update-smtp.md @@ -0,0 +1,26 @@ +```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->updateSMTP( + host: '', // optional + port: null, // optional + username: '', // optional + password: '', // optional + senderEmail: 'email@example.com', // optional + senderName: '', // optional + replyToEmail: 'email@example.com', // optional + replyToName: '', // optional + secure: Secure::TLS(), // optional + enabled: false // optional +);``` diff --git a/docs/examples/project/update-user-limit-policy.md b/docs/examples/project/update-user-limit-policy.md new file mode 100644 index 00000000..bb787e9e --- /dev/null +++ b/docs/examples/project/update-user-limit-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->updateUserLimitPolicy( + total: 1 +);``` diff --git a/docs/examples/proxy/create-api-rule.md b/docs/examples/proxy/create-api-rule.md new file mode 100644 index 00000000..81d7813d --- /dev/null +++ b/docs/examples/proxy/create-api-rule.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$proxy = new Proxy($client); + +$result = $proxy->createAPIRule( + domain: '' +);``` diff --git a/docs/examples/proxy/create-function-rule.md b/docs/examples/proxy/create-function-rule.md new file mode 100644 index 00000000..0bd403fa --- /dev/null +++ b/docs/examples/proxy/create-function-rule.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$proxy = new Proxy($client); + +$result = $proxy->createFunctionRule( + domain: '', + functionId: '', + branch: '' // optional +);``` diff --git a/docs/examples/proxy/create-redirect-rule.md b/docs/examples/proxy/create-redirect-rule.md new file mode 100644 index 00000000..abef3f99 --- /dev/null +++ b/docs/examples/proxy/create-redirect-rule.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$proxy = new Proxy($client); + +$result = $proxy->createRedirectRule( + domain: '', + url: 'https://example.com', + statusCode: StatusCode::MOVEDPERMANENTLY301(), + resourceId: '', + resourceType: ProxyResourceType::SITE() +);``` diff --git a/docs/examples/proxy/create-site-rule.md b/docs/examples/proxy/create-site-rule.md new file mode 100644 index 00000000..e1f0f2da --- /dev/null +++ b/docs/examples/proxy/create-site-rule.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$proxy = new Proxy($client); + +$result = $proxy->createSiteRule( + domain: '', + siteId: '', + branch: '' // optional +);``` diff --git a/docs/examples/proxy/delete-rule.md b/docs/examples/proxy/delete-rule.md new file mode 100644 index 00000000..45c6c35d --- /dev/null +++ b/docs/examples/proxy/delete-rule.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$proxy = new Proxy($client); + +$result = $proxy->deleteRule( + ruleId: '' +);``` diff --git a/docs/examples/proxy/get-rule.md b/docs/examples/proxy/get-rule.md new file mode 100644 index 00000000..c6f4c693 --- /dev/null +++ b/docs/examples/proxy/get-rule.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$proxy = new Proxy($client); + +$result = $proxy->getRule( + ruleId: '' +);``` diff --git a/docs/examples/proxy/list-rules.md b/docs/examples/proxy/list-rules.md new file mode 100644 index 00000000..53c1e1a0 --- /dev/null +++ b/docs/examples/proxy/list-rules.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$proxy = new Proxy($client); + +$result = $proxy->listRules( + queries: [], // optional + total: false // optional +);``` diff --git a/docs/examples/proxy/update-rule-status.md b/docs/examples/proxy/update-rule-status.md new file mode 100644 index 00000000..0640da6d --- /dev/null +++ b/docs/examples/proxy/update-rule-status.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$proxy = new Proxy($client); + +$result = $proxy->updateRuleStatus( + ruleId: '' +);``` diff --git a/docs/examples/sites/create-variable.md b/docs/examples/sites/create-variable.md index fee3ae9d..5cc10bf0 100644 --- a/docs/examples/sites/create-variable.md +++ b/docs/examples/sites/create-variable.md @@ -13,6 +13,7 @@ $sites = new Sites($client); $result = $sites->createVariable( siteId: '', + variableId: '', key: '', value: '', secret: false // optional diff --git a/docs/examples/sites/list-variables.md b/docs/examples/sites/list-variables.md index 7b7ab117..7caa8a5e 100644 --- a/docs/examples/sites/list-variables.md +++ b/docs/examples/sites/list-variables.md @@ -12,5 +12,7 @@ $client = (new Client()) $sites = new Sites($client); $result = $sites->listVariables( - siteId: '' + siteId: '', + queries: [], // optional + total: false // optional );``` diff --git a/docs/examples/sites/update-variable.md b/docs/examples/sites/update-variable.md index 96518754..bbdd3d51 100644 --- a/docs/examples/sites/update-variable.md +++ b/docs/examples/sites/update-variable.md @@ -14,7 +14,7 @@ $sites = new Sites($client); $result = $sites->updateVariable( siteId: '', variableId: '', - key: '', + key: '', // optional value: '', // optional secret: false // optional );``` diff --git a/docs/examples/tablesdb/create-big-int-column.md b/docs/examples/tablesdb/create-big-int-column.md new file mode 100644 index 00000000..2833fdd6 --- /dev/null +++ b/docs/examples/tablesdb/create-big-int-column.md @@ -0,0 +1,23 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDB = new TablesDB($client); + +$result = $tablesDB->createBigIntColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + min: null, // optional + max: null, // optional + default: null, // optional + array: false // optional +);``` diff --git a/docs/examples/tablesdb/update-big-int-column.md b/docs/examples/tablesdb/update-big-int-column.md new file mode 100644 index 00000000..1a317032 --- /dev/null +++ b/docs/examples/tablesdb/update-big-int-column.md @@ -0,0 +1,23 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDB = new TablesDB($client); + +$result = $tablesDB->updateBigIntColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +);``` diff --git a/docs/functions.md b/docs/functions.md index baaf38b4..e77dc282 100644 --- a/docs/functions.md +++ b/docs/functions.md @@ -355,6 +355,8 @@ GET https://cloud.appwrite.io/v1/functions/{functionId}/variables | Field Name | Type | Description | Default | | --- | --- | --- | --- | | functionId | string | **Required** Function unique 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: key, resourceType, resourceId, secret | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -368,6 +370,7 @@ POST https://cloud.appwrite.io/v1/functions/{functionId}/variables | Field Name | Type | Description | Default | | --- | --- | --- | --- | | functionId | string | **Required** Function unique ID. | | +| variableId | string | Variable ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | | key | string | Variable key. Max length: 255 chars. | | | value | string | Variable value. Max length: 8192 chars. | | | secret | boolean | Secret variables can be updated or deleted, but only functions can read them during build and runtime. | 1 | diff --git a/docs/presences.md b/docs/presences.md new file mode 100644 index 00000000..9d75518b --- /dev/null +++ b/docs/presences.md @@ -0,0 +1,80 @@ +# Presences Service + + +```http request +GET https://cloud.appwrite.io/v1/presences +``` + +** List presence logs. ** + +### 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. ** + +### 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 unique 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. ** + +### 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 903afa53..34660053 100644 --- a/docs/project.md +++ b/docs/project.md @@ -1,89 +1,868 @@ # Project Service +```http request +DELETE https://cloud.appwrite.io/v1/project +``` + +** Delete a project. ** + + +```http request +PATCH https://cloud.appwrite.io/v1/project/auth-methods/{methodId} +``` + +** Update properties of a specific auth method. Use this endpoint to enable or disable a method in your project. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| methodId | string | **Required** Auth Method ID. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone | | +| enabled | boolean | Auth method status. | | + + ```http request GET https://cloud.appwrite.io/v1/project/keys ``` -** Get a list of all API keys from the current project. ** +** Get a list of all API keys from the current project. ** + +### 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: expire, accessedAt, name, scopes | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | + + +```http request +POST https://cloud.appwrite.io/v1/project/keys +``` + +** Create a new API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. + +You can also create an ephemeral API key if you need a short-lived key instead. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| keyId | string | Key ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | +| name | string | Key name. Max length: 128 chars. | | +| scopes | array | Key scopes list. Maximum of 100 scopes are allowed. | | +| expire | string | Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. | | + + +```http request +POST https://cloud.appwrite.io/v1/project/keys/ephemeral +``` + +** Create a new ephemeral API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. + +You can also create a standard API key if you need a longer-lived key instead. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| scopes | array | Key scopes list. Maximum of 100 scopes are allowed. | | +| duration | integer | Time in seconds before ephemeral key expires. Maximum duration is 3600 seconds. | | + + +```http request +GET https://cloud.appwrite.io/v1/project/keys/{keyId} +``` + +** Get a key by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| keyId | string | **Required** Key ID. | | + + +```http request +PUT https://cloud.appwrite.io/v1/project/keys/{keyId} +``` + +** Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| keyId | string | **Required** Key ID. | | +| name | string | Key name. Max length: 128 chars. | | +| scopes | array | Key scopes list. Maximum of 100 scopes are allowed. | | +| expire | string | Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/project/keys/{keyId} +``` + +** Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| keyId | string | **Required** Key ID. | | + + +```http request +PUT https://cloud.appwrite.io/v1/project/labels +``` + +** Update the project labels. Labels can be used to easily filter projects in an organization. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| labels | array | Array of project labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. | | + + +```http request +GET https://cloud.appwrite.io/v1/project/mock-phones +``` + +** Get a list of all mock phones in the project. This endpoint returns an array of all mock phones and their OTPs. ** + +### 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). Only supported methods are limit and offset | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | + + +```http request +POST https://cloud.appwrite.io/v1/project/mock-phones +``` + +** Create a new mock phone for your project. Use this endpoint to register a mock phone number and its sign-in OTP for your testers. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| number | string | Phone number to associate with the mock phone. Must be a valid E.164 formatted phone number. | | +| otp | string | One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. | | + + +```http request +GET https://cloud.appwrite.io/v1/project/mock-phones/{number} +``` + +** Get a mock phone by its unique number. This endpoint returns the mock phone's OTP. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| number | string | **Required** Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. | | + + +```http request +PUT https://cloud.appwrite.io/v1/project/mock-phones/{number} +``` + +** Update a mock phone by its unique number. Use this endpoint to update the mock phone's OTP. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| number | string | **Required** Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. | | +| otp | string | One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/project/mock-phones/{number} +``` + +** Delete a mock phone by its unique number. This endpoint removes the mock phone and its OTP configuration from the project. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| number | string | **Required** Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. | | + + +```http request +GET https://cloud.appwrite.io/v1/project/oauth2 +``` + +** Get a list of all OAuth2 providers supported by the server, along with the project's configuration for each. Credential fields are write-only and always returned empty. ** + +### 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). Only supported methods are limit and offset | [] | +| 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/project/oauth2/:provider +``` + +** Get a single OAuth2 provider configuration. Credential fields (client secret, p8 file, key/team IDs) are write-only and always returned empty. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| providerId | string | **Required** OAuth2 provider key. For example: github, google, apple. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/amazon +``` + +** Update the project OAuth2 Amazon configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/apple +``` + +** Update the project OAuth2 Apple configuration. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| serviceId | string | 'Service ID' of Apple OAuth2 app. For example: ip.appwrite.app.web | | +| keyId | string | 'Key ID' of Apple OAuth2 app. For example: P4000000N8 | | +| teamId | string | 'Team ID' of Apple OAuth2 app. For example: D4000000R6 | | +| p8File | string | Contents of the Apple OAuth2 app .p8 private key file. The secret key wrapped by the PEM markers is 200 characters long. For example: -----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY----- | | +| 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/auth0 +``` + +** Update the project OAuth2 Auth0 configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/authentik +``` + +** Update the project OAuth2 Authentik configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/autodesk +``` + +** Update the project OAuth2 Autodesk configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/bitbucket +``` + +** Update the project OAuth2 Bitbucket configuration. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| key | string | 'Key' of Bitbucket OAuth2 app. For example: Knt70000000000ByRc | | +| 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/bitly +``` + +** Update the project OAuth2 Bitly configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/box +``` + +** Update the project OAuth2 Box configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/dailymotion +``` + +** Update the project OAuth2 Dailymotion configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/discord +``` + +** Update the project OAuth2 Discord configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/disqus +``` + +** Update the project OAuth2 Disqus configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/dropbox +``` + +** Update the project OAuth2 Dropbox configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/etsy +``` + +** Update the project OAuth2 Etsy configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/facebook +``` + +** Update the project OAuth2 Facebook configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/figma +``` + +** Update the project OAuth2 Figma configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/fusionauth +``` + +** Update the project OAuth2 FusionAuth configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/github +``` + +** Update the project OAuth2 GitHub configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/gitlab +``` + +** Update the project OAuth2 Gitlab configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/google +``` + +** Update the project OAuth2 Google configuration. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| clientId | string | 'Client ID' of Google OAuth2 app. For example: your-google-client-id.apps.googleusercontent.com | | +| clientSecret | string | 'Client Secret' of Google OAuth2 app. For example: your-google-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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/keycloak +``` + +** Update the project OAuth2 Keycloak configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/kick +``` + +** Update the project OAuth2 Kick configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/linkedin +``` + +** Update the project OAuth2 Linkedin configuration. ** + +### Parameters + +| 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: your-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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/microsoft +``` + +** Update the project OAuth2 Microsoft configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/notion +``` + +** Update the project OAuth2 Notion configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/oidc +``` + +** Update the project OAuth2 Oidc configuration. ** + +### Parameters + +| 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: 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 | | +| userInfoURL | string | OpenID Connect user info endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/userinfo | | +| 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/okta +``` + +** Update the project OAuth2 Okta configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/paypal +``` + +** Update the project OAuth2 Paypal configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/paypalSandbox +``` + +** Update the project OAuth2 PaypalSandbox configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/podio +``` + +** Update the project OAuth2 Podio configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/salesforce +``` + +** Update the project OAuth2 Salesforce configuration. ** ### 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: expire, accessedAt, name, scopes | [] | -| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | +| customerKey | string | 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq | | +| 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. | | ```http request -POST https://cloud.appwrite.io/v1/project/keys +PATCH https://cloud.appwrite.io/v1/project/oauth2/slack ``` -** Create a new API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. ** +** Update the project OAuth2 Slack configuration. ** ### Parameters | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| keyId | string | Key ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | -| name | string | Key name. Max length: 128 chars. | | -| scopes | array | Key scopes list. Maximum of 100 scopes are allowed. | | -| expire | string | Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. | | +| clientId | string | 'Client ID' of Slack OAuth2 app. For example: 23000000089.15000000000023 | | +| 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. | | ```http request -GET https://cloud.appwrite.io/v1/project/keys/{keyId} +PATCH https://cloud.appwrite.io/v1/project/oauth2/spotify ``` -** Get a key by its unique ID. ** +** Update the project OAuth2 Spotify configuration. ** ### Parameters | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| keyId | string | **Required** Key ID. | | +| clientId | string | 'Client ID' of Spotify OAuth2 app. For example: 6ec271000000000000000000009beace | | +| 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. | | ```http request -PUT https://cloud.appwrite.io/v1/project/keys/{keyId} +PATCH https://cloud.appwrite.io/v1/project/oauth2/stripe ``` -** Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key. ** +** Update the project OAuth2 Stripe configuration. ** ### Parameters | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| keyId | string | **Required** Key ID. | | -| name | string | Key name. Max length: 128 chars. | | -| scopes | array | Key scopes list. Maximum of 100 scopes are allowed. | | -| expire | string | Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. | | +| clientId | string | 'Client ID' of Stripe OAuth2 app. For example: ca_UKibXX0000000000000000000006byvR | | +| 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. | | ```http request -DELETE https://cloud.appwrite.io/v1/project/keys/{keyId} +PATCH https://cloud.appwrite.io/v1/project/oauth2/tradeshift ``` -** Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls. ** +** Update the project OAuth2 Tradeshift configuration. ** ### Parameters | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| keyId | string | **Required** Key ID. | | +| 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: 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. | | ```http request -PUT https://cloud.appwrite.io/v1/project/labels +PATCH https://cloud.appwrite.io/v1/project/oauth2/tradeshiftBox ``` -** Update the project labels. Labels can be used to easily filter projects in an organization. ** +** Update the project OAuth2 Tradeshift Sandbox configuration. ** ### Parameters | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| labels | array | Array of project labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. | | +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/twitch +``` + +** Update the project OAuth2 Twitch configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/wordpress +``` + +** Update the project OAuth2 WordPress configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/x +``` + +** Update the project OAuth2 X configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/yahoo +``` + +** Update the project OAuth2 Yahoo configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/yandex +``` + +** Update the project OAuth2 Yandex configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/zoho +``` + +** Update the project OAuth2 Zoho configuration. ** + +### Parameters + +| 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: 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/oauth2/zoom +``` + +** Update the project OAuth2 Zoom configuration. ** + +### Parameters + +| 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: 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. | | ```http request @@ -277,10 +1056,160 @@ DELETE https://cloud.appwrite.io/v1/project/platforms/{platformId} ```http request -PATCH https://cloud.appwrite.io/v1/project/protocols/{protocolId}/status +GET https://cloud.appwrite.io/v1/project/policies +``` + +** Get a list of all project policies and their current configuration. ** + +### 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). Only supported methods are limit and offset | [] | +| 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/membership-privacy +``` + +** Updating this policy allows you to control if team members can see other members information. When enabled, all team members can see ID, name, email, phone number, and MFA status of other members.. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | boolean | Set to true if you want make user ID visible to all team members, or false to hide it. | | +| userEmail | boolean | Set to true if you want make user email visible to all team members, or false to hide it. | | +| userPhone | boolean | Set to true if you want make user phone number visible to all team members, or false to hide it. | | +| userName | boolean | Set to true if you want make user name visible to all team members, or false to hide it. | | +| userMFA | boolean | Set to true if you want make user MFA status visible to all team members, or false to hide it. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/policies/password-dictionary +``` + +** Updating this policy allows you to control if new passwords are checked against most common passwords dictionary. When enabled, and user changes their password, password must not be contained in the dictionary. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| enabled | boolean | Toggle password dictionary policy. Set to true if you want password change to block passwords in the dictionary, or false to allow them. When changing this policy, existing passwords remain valid. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/policies/password-history +``` + +** Updates one of password strength policies. Based on total length configured, previous password hashes are stored, and users cannot choose a new password that is already stored in the passwird history list, when updating an user password, or setting new one through password recovery. + +Keep in mind, while password history policy is disabled, the history is not being stored. Enabling the policy will not have any history on existing users, and it will only start to collect and enforce the policy on password changes since the policy is enabled. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| total | integer | Set the password history length per user. Value can be between 1 and 5000, or null to disable the limit. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/policies/password-personal-data +``` + +** Updating this policy allows you to control if password strength is checked against personal data. When enabled, and user sets or changes their password, the password must not contain user ID, name, email or phone number. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| enabled | boolean | Toggle password personal data policy. Set to true if you want to block passwords including user's personal data, or false to allow it. When changing this policy, existing passwords remain valid. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/policies/session-alert +``` + +** Updating this policy allows you to control if email alert is sent upon session creation. When enabled, and user signs into their account, they will be sent an email notification. There is an exception, the first session after a new sign up does not trigger an alert, even if the policy is enabled. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| enabled | boolean | Toggle session alert policy. Set to true if you want users to receive email notifications when a sessions are created for their users, or false to not send email alerts. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/policies/session-duration +``` + +** Update maximum duration how long sessions created within a project should stay active for. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| duration | integer | Maximum session length in seconds. Minium allowed value is 5 second, and maximum is 1 year, which is 31536000 seconds. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/policies/session-invalidation +``` + +** Updating this policy allows you to control if existing sessions should be invalidated when a password of a user is changed. When enabled, and user changes their password, they will be logged out of all their devices. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| enabled | boolean | Toggle session invalidation policy. Set to true if you want password change to invalidate all sessions of an user, or false to keep sessions active. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/policies/session-limit +``` + +** Update the maximum number of sessions allowed per user. When the limit is hit, the oldest session will be deleted to make room for new one. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| total | integer | Set the maximum number of sessions allowed per user. Value can be between 1 and 5000, or null to disable the limit. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/policies/user-limit +``` + +** Update the maximum number of users in the project. When the limit is hit or amount of existing users already exceeded the limit, all users remain active, but new user sign up will be prohibited. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| total | integer | Set the maximum number of users allowed in the project. Value can be between 1 and 5000, or null to disable the limit. | | + + +```http request +GET https://cloud.appwrite.io/v1/project/policies/{policyId} +``` + +** Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| policyId | string | **Required** Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/protocols/{protocolId} ``` -** Update the status of a specific protocol. Use this endpoint to enable or disable a protocol in your project. ** +** Update properties of a specific protocol. Use this endpoint to enable or disable a protocol in your project. ** ### Parameters @@ -291,10 +1220,10 @@ PATCH https://cloud.appwrite.io/v1/project/protocols/{protocolId}/status ```http request -PATCH https://cloud.appwrite.io/v1/project/services/{serviceId}/status +PATCH https://cloud.appwrite.io/v1/project/services/{serviceId} ``` -** Update the status of a specific service. Use this endpoint to enable or disable a service in your project. ** +** Update properties of a specific service. Use this endpoint to enable or disable a service in your project. ** ### Parameters @@ -304,6 +1233,89 @@ PATCH https://cloud.appwrite.io/v1/project/services/{serviceId}/status | enabled | boolean | Service status. | | +```http request +PATCH https://cloud.appwrite.io/v1/project/smtp +``` + +** Update the SMTP configuration for your project. Use this endpoint to configure your project's SMTP provider with your custom settings for sending transactional emails. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| host | string | SMTP server hostname (domain) | | +| port | integer | SMTP server port | | +| username | string | SMTP server username. Leave empty for no authorization. | | +| password | string | SMTP server password. Leave empty for no authorization. This property is stored securely and cannot be read in future (write-only). | | +| senderEmail | string | Email address shown in inbox as the sender of the email. | | +| senderName | string | Name shown in inbox as the sender of the email. | | +| replyToEmail | string | Email used when user replies to the email. | | +| replyToName | string | Name used when user replies to the email. | | +| secure | string | Configures if communication with SMTP server is encrypted. Allowed values are: tls, ssl. Leave empty for no encryption. | | +| enabled | boolean | Enable or disable custom SMTP. Custom SMTP is useful for branding purposes, but also allows use of custom email templates. | | + + +```http request +POST https://cloud.appwrite.io/v1/project/smtp/tests +``` + +** Send a test email to verify SMTP configuration. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| emails | array | Array of emails to send test email to. Maximum of 10 emails are allowed. | | + + +```http request +GET https://cloud.appwrite.io/v1/project/templates/email +``` + +** Get a list of all custom email templates configured for the project. This endpoint returns an array of all configured email templates and their locales. ** + +### 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). Only supported methods are limit and offset | [] | +| 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/templates/email +``` + +** Update a custom email template for the specified locale and type. Use this endpoint to modify the content of your email templates. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| templateId | string | Custom email template type. Can be one of: verification, magicSession, recovery, invitation, mfaChallenge, sessionAlert, otpSession | | +| locale | string | Custom email template locale. If left empty, the fallback locale (en) will be used. | | +| subject | string | Subject of the email template. Can be up to 255 characters. | | +| message | string | Plain or HTML body of the email template message. Can be up to 10MB of content. | | +| senderName | string | Name of the email sender. | | +| senderEmail | string | Email of the sender. | | +| replyToEmail | string | Reply to email. | | +| replyToName | string | Reply to name. | | + + +```http request +GET https://cloud.appwrite.io/v1/project/templates/email/{templateId} +``` + +** Get a custom email template for the specified locale and type. This endpoint returns the template content, subject, and other configuration details. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| templateId | string | **Required** Custom email template type. Can be one of: verification, magicSession, recovery, invitation, mfaChallenge, sessionAlert, otpSession | | +| locale | string | Custom email template locale. If left empty, the fallback locale (en) will be used. | | + + ```http request GET https://cloud.appwrite.io/v1/project/variables ``` @@ -328,7 +1340,7 @@ POST https://cloud.appwrite.io/v1/project/variables | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| variableId | string | Variable ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | +| variableId | string | Variable unique ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | | key | string | Variable key. Max length: 255 chars. | | | value | string | Variable value. Max length: 8192 chars. | | | secret | boolean | Secret variables can be updated or deleted, but only projects can read them during build and runtime. | 1 | @@ -344,7 +1356,7 @@ GET https://cloud.appwrite.io/v1/project/variables/{variableId} | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| variableId | string | **Required** Variable ID. | | +| variableId | string | **Required** Variable unique ID. | | ```http request @@ -357,7 +1369,7 @@ PUT https://cloud.appwrite.io/v1/project/variables/{variableId} | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| variableId | string | **Required** Variable ID. | | +| variableId | string | **Required** Variable unique ID. | | | key | string | Variable key. Max length: 255 chars. | | | value | string | Variable value. Max length: 8192 chars. | | | secret | boolean | Secret variables can be updated or deleted, but only projects can read them during build and runtime. | | @@ -373,5 +1385,5 @@ DELETE https://cloud.appwrite.io/v1/project/variables/{variableId} | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| variableId | string | **Required** Variable ID. | | +| variableId | string | **Required** Variable unique ID. | | diff --git a/docs/proxy.md b/docs/proxy.md new file mode 100644 index 00000000..3c8d9b51 --- /dev/null +++ b/docs/proxy.md @@ -0,0 +1,123 @@ +# Proxy Service + + +```http request +GET https://cloud.appwrite.io/v1/proxy/rules +``` + +** Get a list of all the proxy rules. 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/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: domain, type, trigger, deploymentResourceType, deploymentResourceId, deploymentId, deploymentVcsProviderBranch | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | + + +```http request +POST https://cloud.appwrite.io/v1/proxy/rules/api +``` + +** Create a new proxy rule for serving Appwrite's API on custom domain. + +Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domain | string | Domain name. | | + + +```http request +POST https://cloud.appwrite.io/v1/proxy/rules/function +``` + +** Create a new proxy rule for executing Appwrite Function on custom domain. + +Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domain | string | Domain name. | | +| functionId | string | ID of function to be executed. | | +| branch | string | Name of VCS branch to deploy changes automatically | | + + +```http request +POST https://cloud.appwrite.io/v1/proxy/rules/redirect +``` + +** Create a new proxy rule for to redirect from custom domain to another domain. + +Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domain | string | Domain name. | | +| url | string | Target URL of redirection | | +| statusCode | string | Status code of redirection | | +| resourceId | string | ID of parent resource. | | +| resourceType | string | Type of parent resource. | | + + +```http request +POST https://cloud.appwrite.io/v1/proxy/rules/site +``` + +** Create a new proxy rule for serving Appwrite Site on custom domain. + +Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domain | string | Domain name. | | +| siteId | string | ID of site to be executed. | | +| branch | string | Name of VCS branch to deploy changes automatically | | + + +```http request +GET https://cloud.appwrite.io/v1/proxy/rules/{ruleId} +``` + +** Get a proxy rule by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| ruleId | string | **Required** Rule ID. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/proxy/rules/{ruleId} +``` + +** Delete a proxy rule by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| ruleId | string | **Required** Rule ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/proxy/rules/{ruleId}/status +``` + +** If not succeeded yet, retry verification process of a proxy rule domain. This endpoint triggers domain verification by checking DNS records. If verification is successful, a TLS certificate will be automatically provisioned for the domain asynchronously in the background. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| ruleId | string | **Required** Rule ID. | | + diff --git a/docs/sites.md b/docs/sites.md index a298449d..16aa9a19 100644 --- a/docs/sites.md +++ b/docs/sites.md @@ -334,6 +334,8 @@ GET https://cloud.appwrite.io/v1/sites/{siteId}/variables | Field Name | Type | Description | Default | | --- | --- | --- | --- | | siteId | string | **Required** Site unique 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: key, resourceType, resourceId, secret | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request @@ -347,6 +349,7 @@ POST https://cloud.appwrite.io/v1/sites/{siteId}/variables | Field Name | Type | Description | Default | | --- | --- | --- | --- | | siteId | string | **Required** Site unique ID. | | +| variableId | string | Variable ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | | key | string | Variable key. Max length: 255 chars. | | | value | string | Variable value. Max length: 8192 chars. | | | secret | boolean | Secret variables can be updated or deleted, but only sites can read them during build and runtime. | 1 | diff --git a/docs/tablesdb.md b/docs/tablesdb.md index cd779b10..b8ef008f 100644 --- a/docs/tablesdb.md +++ b/docs/tablesdb.md @@ -253,6 +253,48 @@ GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns | total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | +```http request +POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/bigint +``` + +** Create a bigint column. Optionally, minimum and maximum values can be provided. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| key | string | Column Key. | | +| required | boolean | Is column required? | | +| min | integer | Minimum value | | +| max | integer | Maximum value | | +| default | integer | Default value. Cannot be set when column is required. | | +| array | boolean | Is column an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/bigint/{key} +``` + +** Update a bigint column. Changing the `default` value will not update already existing rows. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| key | string | **Required** Column Key. | | +| required | boolean | Is column required? | | +| min | integer | Minimum value | | +| max | integer | Maximum value | | +| default | integer | Default value. Cannot be set when column is required. | | +| newKey | string | New Column Key. | | + + ```http request POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/boolean ``` diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php index 69fac5af..6c99d177 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.0.0 ()', + 'user-agent' => 'AppwritePHPSDK/23.1.0 ()', 'x-sdk-name'=> 'PHP', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'php', - 'x-sdk-version'=> '23.0.0', + 'x-sdk-version'=> '23.1.0', ]; /** @@ -63,7 +63,7 @@ class Client */ public function __construct() { - $this->headers['X-Appwrite-Response-Format'] = '1.9.1'; + $this->headers['X-Appwrite-Response-Format'] = '1.9.4'; } @@ -161,6 +161,38 @@ public function setForwardedUserAgent(string $value): Client return $this; } + /** + * Set DevKey + * + * Your secret dev API key + * + * @param string $value + * + * @return Client + */ + public function setDevKey(string $value): Client + { + $this->addHeader('X-Appwrite-Dev-Key', $value); + + return $this; + } + + /** + * Set Cookie + * + * The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes. + * + * @param string $value + * + * @return Client + */ + public function setCookie(string $value): Client + { + $this->addHeader('Cookie', $value); + + return $this; + } + /** * Set ImpersonateUserId * @@ -381,8 +413,6 @@ public function call( if (curl_errno($ch)) { throw new AppwriteException(curl_error($ch), $responseStatus, $responseBody['type'] ?? '', $responseBody); } - - curl_close($ch); if($responseStatus >= 400) { if(is_array($responseBody)) { @@ -413,7 +443,7 @@ protected function flatten(array $data, string $prefix = ''): array { $finalKey = $prefix ? "{$prefix}[{$key}]" : $key; if (is_array($value)) { - $output += $this->flatten($value, $finalKey); // @todo: handle name collision here if needed + $output = array_merge($output, $this->flatten($value, $finalKey)); } else { $output[$finalKey] = $value; diff --git a/src/Appwrite/Enums/BuildRuntime.php b/src/Appwrite/Enums/BuildRuntime.php index d3bcad0a..901d5f98 100644 --- a/src/Appwrite/Enums/BuildRuntime.php +++ b/src/Appwrite/Enums/BuildRuntime.php @@ -86,6 +86,7 @@ class BuildRuntime implements JsonSerializable private static BuildRuntime $GO124; private static BuildRuntime $GO125; private static BuildRuntime $GO126; + private static BuildRuntime $RUST183; private static BuildRuntime $STATIC1; private static BuildRuntime $FLUTTER324; private static BuildRuntime $FLUTTER327; @@ -672,6 +673,13 @@ public static function GO126(): BuildRuntime } return self::$GO126; } + public static function RUST183(): BuildRuntime + { + if (!isset(self::$RUST183)) { + self::$RUST183 = new BuildRuntime('rust-1.83'); + } + return self::$RUST183; + } public static function STATIC1(): BuildRuntime { if (!isset(self::$STATIC1)) { @@ -812,6 +820,7 @@ public static function from(string $value): self 'go-1.24' => self::GO124(), 'go-1.25' => self::GO125(), 'go-1.26' => self::GO126(), + 'rust-1.83' => self::RUST183(), 'static-1' => self::STATIC1(), 'flutter-3.24' => self::FLUTTER324(), 'flutter-3.27' => self::FLUTTER327(), diff --git a/src/Appwrite/Enums/EmailTemplateLocale.php b/src/Appwrite/Enums/EmailTemplateLocale.php new file mode 100644 index 00000000..a851b56a --- /dev/null +++ b/src/Appwrite/Enums/EmailTemplateLocale.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(): 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/EmailTemplateType.php b/src/Appwrite/Enums/EmailTemplateType.php new file mode 100644 index 00000000..21086cea --- /dev/null +++ b/src/Appwrite/Enums/EmailTemplateType.php @@ -0,0 +1,97 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function VERIFICATION(): EmailTemplateType + { + if (!isset(self::$VERIFICATION)) { + self::$VERIFICATION = new EmailTemplateType('verification'); + } + return self::$VERIFICATION; + } + public static function MAGICSESSION(): EmailTemplateType + { + if (!isset(self::$MAGICSESSION)) { + self::$MAGICSESSION = new EmailTemplateType('magicSession'); + } + return self::$MAGICSESSION; + } + public static function RECOVERY(): EmailTemplateType + { + if (!isset(self::$RECOVERY)) { + self::$RECOVERY = new EmailTemplateType('recovery'); + } + return self::$RECOVERY; + } + public static function INVITATION(): EmailTemplateType + { + if (!isset(self::$INVITATION)) { + self::$INVITATION = new EmailTemplateType('invitation'); + } + return self::$INVITATION; + } + public static function MFACHALLENGE(): EmailTemplateType + { + if (!isset(self::$MFACHALLENGE)) { + self::$MFACHALLENGE = new EmailTemplateType('mfaChallenge'); + } + return self::$MFACHALLENGE; + } + public static function SESSIONALERT(): EmailTemplateType + { + if (!isset(self::$SESSIONALERT)) { + self::$SESSIONALERT = new EmailTemplateType('sessionAlert'); + } + return self::$SESSIONALERT; + } + public static function OTPSESSION(): EmailTemplateType + { + if (!isset(self::$OTPSESSION)) { + self::$OTPSESSION = new EmailTemplateType('otpSession'); + } + return self::$OTPSESSION; + } + + public static function from(string $value): self + { + return match ($value) { + 'verification' => self::VERIFICATION(), + 'magicSession' => self::MAGICSESSION(), + 'recovery' => self::RECOVERY(), + 'invitation' => self::INVITATION(), + 'mfaChallenge' => self::MFACHALLENGE(), + 'sessionAlert' => self::SESSIONALERT(), + 'otpSession' => self::OTPSESSION(), + default => throw new \InvalidArgumentException('Unknown EmailTemplateType value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/MethodId.php b/src/Appwrite/Enums/MethodId.php new file mode 100644 index 00000000..daf89a75 --- /dev/null +++ b/src/Appwrite/Enums/MethodId.php @@ -0,0 +1,97 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function EMAILPASSWORD(): MethodId + { + if (!isset(self::$EMAILPASSWORD)) { + self::$EMAILPASSWORD = new MethodId('email-password'); + } + return self::$EMAILPASSWORD; + } + public static function MAGICURL(): MethodId + { + if (!isset(self::$MAGICURL)) { + self::$MAGICURL = new MethodId('magic-url'); + } + return self::$MAGICURL; + } + public static function EMAILOTP(): MethodId + { + if (!isset(self::$EMAILOTP)) { + self::$EMAILOTP = new MethodId('email-otp'); + } + return self::$EMAILOTP; + } + public static function ANONYMOUS(): MethodId + { + if (!isset(self::$ANONYMOUS)) { + self::$ANONYMOUS = new MethodId('anonymous'); + } + return self::$ANONYMOUS; + } + public static function INVITES(): MethodId + { + if (!isset(self::$INVITES)) { + self::$INVITES = new MethodId('invites'); + } + return self::$INVITES; + } + public static function JWT(): MethodId + { + if (!isset(self::$JWT)) { + self::$JWT = new MethodId('jwt'); + } + return self::$JWT; + } + public static function PHONE(): MethodId + { + if (!isset(self::$PHONE)) { + self::$PHONE = new MethodId('phone'); + } + return self::$PHONE; + } + + public static function from(string $value): self + { + return match ($value) { + 'email-password' => self::EMAILPASSWORD(), + 'magic-url' => self::MAGICURL(), + 'email-otp' => self::EMAILOTP(), + 'anonymous' => self::ANONYMOUS(), + 'invites' => self::INVITES(), + 'jwt' => self::JWT(), + 'phone' => self::PHONE(), + default => throw new \InvalidArgumentException('Unknown MethodId value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/OAuthProvider.php b/src/Appwrite/Enums/OAuthProvider.php index a1938bd4..4763c082 100644 --- a/src/Appwrite/Enums/OAuthProvider.php +++ b/src/Appwrite/Enums/OAuthProvider.php @@ -21,9 +21,12 @@ class OAuthProvider implements JsonSerializable private static OAuthProvider $ETSY; private static OAuthProvider $FACEBOOK; private static OAuthProvider $FIGMA; + private static OAuthProvider $FUSIONAUTH; private static OAuthProvider $GITHUB; private static OAuthProvider $GITLAB; private static OAuthProvider $GOOGLE; + private static OAuthProvider $KEYCLOAK; + private static OAuthProvider $KICK; private static OAuthProvider $LINKEDIN; private static OAuthProvider $MICROSOFT; private static OAuthProvider $NOTION; @@ -169,6 +172,13 @@ public static function FIGMA(): OAuthProvider } return self::$FIGMA; } + public static function FUSIONAUTH(): OAuthProvider + { + if (!isset(self::$FUSIONAUTH)) { + self::$FUSIONAUTH = new OAuthProvider('fusionauth'); + } + return self::$FUSIONAUTH; + } public static function GITHUB(): OAuthProvider { if (!isset(self::$GITHUB)) { @@ -190,6 +200,20 @@ public static function GOOGLE(): OAuthProvider } return self::$GOOGLE; } + public static function KEYCLOAK(): OAuthProvider + { + if (!isset(self::$KEYCLOAK)) { + self::$KEYCLOAK = new OAuthProvider('keycloak'); + } + return self::$KEYCLOAK; + } + public static function KICK(): OAuthProvider + { + if (!isset(self::$KICK)) { + self::$KICK = new OAuthProvider('kick'); + } + return self::$KICK; + } public static function LINKEDIN(): OAuthProvider { if (!isset(self::$LINKEDIN)) { @@ -363,9 +387,12 @@ public static function from(string $value): self '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(), diff --git a/src/Appwrite/Enums/PolicyId.php b/src/Appwrite/Enums/PolicyId.php new file mode 100644 index 00000000..389ee78e --- /dev/null +++ b/src/Appwrite/Enums/PolicyId.php @@ -0,0 +1,115 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function PASSWORDDICTIONARY(): PolicyId + { + if (!isset(self::$PASSWORDDICTIONARY)) { + self::$PASSWORDDICTIONARY = new PolicyId('password-dictionary'); + } + return self::$PASSWORDDICTIONARY; + } + public static function PASSWORDHISTORY(): PolicyId + { + if (!isset(self::$PASSWORDHISTORY)) { + self::$PASSWORDHISTORY = new PolicyId('password-history'); + } + return self::$PASSWORDHISTORY; + } + public static function PASSWORDPERSONALDATA(): PolicyId + { + if (!isset(self::$PASSWORDPERSONALDATA)) { + self::$PASSWORDPERSONALDATA = new PolicyId('password-personal-data'); + } + return self::$PASSWORDPERSONALDATA; + } + public static function SESSIONALERT(): PolicyId + { + if (!isset(self::$SESSIONALERT)) { + self::$SESSIONALERT = new PolicyId('session-alert'); + } + return self::$SESSIONALERT; + } + public static function SESSIONDURATION(): PolicyId + { + if (!isset(self::$SESSIONDURATION)) { + self::$SESSIONDURATION = new PolicyId('session-duration'); + } + return self::$SESSIONDURATION; + } + public static function SESSIONINVALIDATION(): PolicyId + { + if (!isset(self::$SESSIONINVALIDATION)) { + self::$SESSIONINVALIDATION = new PolicyId('session-invalidation'); + } + return self::$SESSIONINVALIDATION; + } + public static function SESSIONLIMIT(): PolicyId + { + if (!isset(self::$SESSIONLIMIT)) { + self::$SESSIONLIMIT = new PolicyId('session-limit'); + } + return self::$SESSIONLIMIT; + } + public static function USERLIMIT(): PolicyId + { + if (!isset(self::$USERLIMIT)) { + self::$USERLIMIT = new PolicyId('user-limit'); + } + return self::$USERLIMIT; + } + public static function MEMBERSHIPPRIVACY(): PolicyId + { + if (!isset(self::$MEMBERSHIPPRIVACY)) { + self::$MEMBERSHIPPRIVACY = new PolicyId('membership-privacy'); + } + return self::$MEMBERSHIPPRIVACY; + } + + public static function from(string $value): self + { + return match ($value) { + 'password-dictionary' => self::PASSWORDDICTIONARY(), + 'password-history' => self::PASSWORDHISTORY(), + 'password-personal-data' => self::PASSWORDPERSONALDATA(), + 'session-alert' => self::SESSIONALERT(), + 'session-duration' => self::SESSIONDURATION(), + 'session-invalidation' => self::SESSIONINVALIDATION(), + 'session-limit' => self::SESSIONLIMIT(), + 'user-limit' => self::USERLIMIT(), + 'membership-privacy' => self::MEMBERSHIPPRIVACY(), + default => throw new \InvalidArgumentException('Unknown PolicyId value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/ProviderId.php b/src/Appwrite/Enums/ProviderId.php new file mode 100644 index 00000000..cda03c3e --- /dev/null +++ b/src/Appwrite/Enums/ProviderId.php @@ -0,0 +1,457 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function AMAZON(): ProviderId + { + if (!isset(self::$AMAZON)) { + self::$AMAZON = new ProviderId('amazon'); + } + return self::$AMAZON; + } + public static function APPLE(): ProviderId + { + if (!isset(self::$APPLE)) { + self::$APPLE = new ProviderId('apple'); + } + return self::$APPLE; + } + public static function AUTH0(): ProviderId + { + if (!isset(self::$AUTH0)) { + self::$AUTH0 = new ProviderId('auth0'); + } + return self::$AUTH0; + } + public static function AUTHENTIK(): ProviderId + { + if (!isset(self::$AUTHENTIK)) { + self::$AUTHENTIK = new ProviderId('authentik'); + } + return self::$AUTHENTIK; + } + public static function AUTODESK(): ProviderId + { + if (!isset(self::$AUTODESK)) { + self::$AUTODESK = new ProviderId('autodesk'); + } + return self::$AUTODESK; + } + public static function BITBUCKET(): ProviderId + { + if (!isset(self::$BITBUCKET)) { + self::$BITBUCKET = new ProviderId('bitbucket'); + } + return self::$BITBUCKET; + } + public static function BITLY(): ProviderId + { + if (!isset(self::$BITLY)) { + self::$BITLY = new ProviderId('bitly'); + } + return self::$BITLY; + } + public static function BOX(): ProviderId + { + if (!isset(self::$BOX)) { + self::$BOX = new ProviderId('box'); + } + return self::$BOX; + } + public static function DAILYMOTION(): ProviderId + { + if (!isset(self::$DAILYMOTION)) { + self::$DAILYMOTION = new ProviderId('dailymotion'); + } + return self::$DAILYMOTION; + } + public static function DISCORD(): ProviderId + { + if (!isset(self::$DISCORD)) { + self::$DISCORD = new ProviderId('discord'); + } + return self::$DISCORD; + } + public static function DISQUS(): ProviderId + { + if (!isset(self::$DISQUS)) { + self::$DISQUS = new ProviderId('disqus'); + } + return self::$DISQUS; + } + public static function DROPBOX(): ProviderId + { + if (!isset(self::$DROPBOX)) { + self::$DROPBOX = new ProviderId('dropbox'); + } + return self::$DROPBOX; + } + public static function ETSY(): ProviderId + { + if (!isset(self::$ETSY)) { + self::$ETSY = new ProviderId('etsy'); + } + return self::$ETSY; + } + public static function FACEBOOK(): ProviderId + { + if (!isset(self::$FACEBOOK)) { + self::$FACEBOOK = new ProviderId('facebook'); + } + return self::$FACEBOOK; + } + public static function FIGMA(): ProviderId + { + if (!isset(self::$FIGMA)) { + self::$FIGMA = new ProviderId('figma'); + } + return self::$FIGMA; + } + public static function FUSIONAUTH(): ProviderId + { + if (!isset(self::$FUSIONAUTH)) { + self::$FUSIONAUTH = new ProviderId('fusionauth'); + } + return self::$FUSIONAUTH; + } + public static function GITHUB(): ProviderId + { + if (!isset(self::$GITHUB)) { + self::$GITHUB = new ProviderId('github'); + } + return self::$GITHUB; + } + public static function GITLAB(): ProviderId + { + if (!isset(self::$GITLAB)) { + self::$GITLAB = new ProviderId('gitlab'); + } + return self::$GITLAB; + } + public static function GOOGLE(): ProviderId + { + if (!isset(self::$GOOGLE)) { + self::$GOOGLE = new ProviderId('google'); + } + return self::$GOOGLE; + } + public static function KEYCLOAK(): ProviderId + { + if (!isset(self::$KEYCLOAK)) { + self::$KEYCLOAK = new ProviderId('keycloak'); + } + return self::$KEYCLOAK; + } + public static function KICK(): ProviderId + { + if (!isset(self::$KICK)) { + self::$KICK = new ProviderId('kick'); + } + return self::$KICK; + } + public static function LINKEDIN(): ProviderId + { + if (!isset(self::$LINKEDIN)) { + self::$LINKEDIN = new ProviderId('linkedin'); + } + return self::$LINKEDIN; + } + public static function MICROSOFT(): ProviderId + { + if (!isset(self::$MICROSOFT)) { + self::$MICROSOFT = new ProviderId('microsoft'); + } + return self::$MICROSOFT; + } + public static function NOTION(): ProviderId + { + if (!isset(self::$NOTION)) { + self::$NOTION = new ProviderId('notion'); + } + return self::$NOTION; + } + public static function OIDC(): ProviderId + { + if (!isset(self::$OIDC)) { + self::$OIDC = new ProviderId('oidc'); + } + return self::$OIDC; + } + public static function OKTA(): ProviderId + { + if (!isset(self::$OKTA)) { + self::$OKTA = new ProviderId('okta'); + } + return self::$OKTA; + } + public static function PAYPAL(): ProviderId + { + if (!isset(self::$PAYPAL)) { + self::$PAYPAL = new ProviderId('paypal'); + } + return self::$PAYPAL; + } + public static function PAYPALSANDBOX(): ProviderId + { + if (!isset(self::$PAYPALSANDBOX)) { + self::$PAYPALSANDBOX = new ProviderId('paypalSandbox'); + } + return self::$PAYPALSANDBOX; + } + public static function PODIO(): ProviderId + { + if (!isset(self::$PODIO)) { + self::$PODIO = new ProviderId('podio'); + } + return self::$PODIO; + } + public static function SALESFORCE(): ProviderId + { + if (!isset(self::$SALESFORCE)) { + self::$SALESFORCE = new ProviderId('salesforce'); + } + return self::$SALESFORCE; + } + public static function SLACK(): ProviderId + { + if (!isset(self::$SLACK)) { + self::$SLACK = new ProviderId('slack'); + } + return self::$SLACK; + } + public static function SPOTIFY(): ProviderId + { + if (!isset(self::$SPOTIFY)) { + self::$SPOTIFY = new ProviderId('spotify'); + } + return self::$SPOTIFY; + } + public static function STRIPE(): ProviderId + { + if (!isset(self::$STRIPE)) { + self::$STRIPE = new ProviderId('stripe'); + } + return self::$STRIPE; + } + public static function TRADESHIFT(): ProviderId + { + if (!isset(self::$TRADESHIFT)) { + self::$TRADESHIFT = new ProviderId('tradeshift'); + } + return self::$TRADESHIFT; + } + public static function TRADESHIFTBOX(): ProviderId + { + if (!isset(self::$TRADESHIFTBOX)) { + self::$TRADESHIFTBOX = new ProviderId('tradeshiftBox'); + } + return self::$TRADESHIFTBOX; + } + public static function TWITCH(): ProviderId + { + if (!isset(self::$TWITCH)) { + self::$TWITCH = new ProviderId('twitch'); + } + return self::$TWITCH; + } + public static function WORDPRESS(): ProviderId + { + if (!isset(self::$WORDPRESS)) { + self::$WORDPRESS = new ProviderId('wordpress'); + } + return self::$WORDPRESS; + } + public static function X(): ProviderId + { + if (!isset(self::$X)) { + self::$X = new ProviderId('x'); + } + return self::$X; + } + public static function YAHOO(): ProviderId + { + if (!isset(self::$YAHOO)) { + self::$YAHOO = new ProviderId('yahoo'); + } + return self::$YAHOO; + } + public static function YAMMER(): ProviderId + { + if (!isset(self::$YAMMER)) { + self::$YAMMER = new ProviderId('yammer'); + } + return self::$YAMMER; + } + public static function YANDEX(): ProviderId + { + if (!isset(self::$YANDEX)) { + self::$YANDEX = new ProviderId('yandex'); + } + return self::$YANDEX; + } + public static function ZOHO(): ProviderId + { + if (!isset(self::$ZOHO)) { + self::$ZOHO = new ProviderId('zoho'); + } + return self::$ZOHO; + } + public static function ZOOM(): ProviderId + { + if (!isset(self::$ZOOM)) { + self::$ZOOM = new ProviderId('zoom'); + } + return self::$ZOOM; + } + public static function MOCK(): ProviderId + { + if (!isset(self::$MOCK)) { + self::$MOCK = new ProviderId('mock'); + } + return self::$MOCK; + } + public static function MOCKUNVERIFIED(): ProviderId + { + if (!isset(self::$MOCKUNVERIFIED)) { + self::$MOCKUNVERIFIED = new ProviderId('mock-unverified'); + } + return self::$MOCKUNVERIFIED; + } + public static function GITHUBIMAGINE(): ProviderId + { + if (!isset(self::$GITHUBIMAGINE)) { + self::$GITHUBIMAGINE = new ProviderId('githubImagine'); + } + return self::$GITHUBIMAGINE; + } + public static function GOOGLEIMAGINE(): ProviderId + { + if (!isset(self::$GOOGLEIMAGINE)) { + self::$GOOGLEIMAGINE = new ProviderId('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(), + 'mock' => self::MOCK(), + 'mock-unverified' => self::MOCKUNVERIFIED(), + 'githubImagine' => self::GITHUBIMAGINE(), + 'googleImagine' => self::GOOGLEIMAGINE(), + default => throw new \InvalidArgumentException('Unknown ProviderId value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/ProxyResourceType.php b/src/Appwrite/Enums/ProxyResourceType.php new file mode 100644 index 00000000..65a0a1bd --- /dev/null +++ b/src/Appwrite/Enums/ProxyResourceType.php @@ -0,0 +1,52 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function SITE(): ProxyResourceType + { + if (!isset(self::$SITE)) { + self::$SITE = new ProxyResourceType('site'); + } + return self::$SITE; + } + public static function FUNCTIONMODEL(): ProxyResourceType + { + if (!isset(self::$FUNCTIONMODEL)) { + self::$FUNCTIONMODEL = new ProxyResourceType('function'); + } + return self::$FUNCTIONMODEL; + } + + public static function from(string $value): self + { + return match ($value) { + 'site' => self::SITE(), + 'function' => self::FUNCTIONMODEL(), + default => throw new \InvalidArgumentException('Unknown ProxyResourceType value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/ProxyRuleDeploymentResourceType.php b/src/Appwrite/Enums/ProxyRuleDeploymentResourceType.php new file mode 100644 index 00000000..983314fc --- /dev/null +++ b/src/Appwrite/Enums/ProxyRuleDeploymentResourceType.php @@ -0,0 +1,52 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function FUNCTION(): ProxyRuleDeploymentResourceType + { + if (!isset(self::$FUNCTION)) { + self::$FUNCTION = new ProxyRuleDeploymentResourceType('function'); + } + return self::$FUNCTION; + } + public static function SITE(): ProxyRuleDeploymentResourceType + { + if (!isset(self::$SITE)) { + self::$SITE = new ProxyRuleDeploymentResourceType('site'); + } + return self::$SITE; + } + + public static function from(string $value): self + { + return match ($value) { + 'function' => self::FUNCTION(), + 'site' => self::SITE(), + default => throw new \InvalidArgumentException('Unknown ProxyRuleDeploymentResourceType value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/ProxyRuleStatus.php b/src/Appwrite/Enums/ProxyRuleStatus.php new file mode 100644 index 00000000..8bac5eb8 --- /dev/null +++ b/src/Appwrite/Enums/ProxyRuleStatus.php @@ -0,0 +1,61 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function UNVERIFIED(): ProxyRuleStatus + { + if (!isset(self::$UNVERIFIED)) { + self::$UNVERIFIED = new ProxyRuleStatus('unverified'); + } + return self::$UNVERIFIED; + } + public static function VERIFYING(): ProxyRuleStatus + { + if (!isset(self::$VERIFYING)) { + self::$VERIFYING = new ProxyRuleStatus('verifying'); + } + return self::$VERIFYING; + } + public static function VERIFIED(): ProxyRuleStatus + { + if (!isset(self::$VERIFIED)) { + self::$VERIFIED = new ProxyRuleStatus('verified'); + } + return self::$VERIFIED; + } + + public static function from(string $value): self + { + return match ($value) { + 'unverified' => self::UNVERIFIED(), + 'verifying' => self::VERIFYING(), + 'verified' => self::VERIFIED(), + default => throw new \InvalidArgumentException('Unknown ProxyRuleStatus value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/Runtime.php b/src/Appwrite/Enums/Runtime.php index 18825a6f..5bf14b0c 100644 --- a/src/Appwrite/Enums/Runtime.php +++ b/src/Appwrite/Enums/Runtime.php @@ -86,6 +86,7 @@ class Runtime implements JsonSerializable private static Runtime $GO124; private static Runtime $GO125; private static Runtime $GO126; + private static Runtime $RUST183; private static Runtime $STATIC1; private static Runtime $FLUTTER324; private static Runtime $FLUTTER327; @@ -672,6 +673,13 @@ public static function GO126(): Runtime } return self::$GO126; } + public static function RUST183(): Runtime + { + if (!isset(self::$RUST183)) { + self::$RUST183 = new Runtime('rust-1.83'); + } + return self::$RUST183; + } public static function STATIC1(): Runtime { if (!isset(self::$STATIC1)) { @@ -812,6 +820,7 @@ public static function from(string $value): self 'go-1.24' => self::GO124(), 'go-1.25' => self::GO125(), 'go-1.26' => self::GO126(), + 'rust-1.83' => self::RUST183(), 'static-1' => self::STATIC1(), 'flutter-3.24' => self::FLUTTER324(), 'flutter-3.27' => self::FLUTTER327(), diff --git a/src/Appwrite/Enums/Scopes.php b/src/Appwrite/Enums/Scopes.php index 95438adb..c09138ba 100644 --- a/src/Appwrite/Enums/Scopes.php +++ b/src/Appwrite/Enums/Scopes.php @@ -6,73 +6,88 @@ class Scopes implements JsonSerializable { - private static Scopes $SESSIONSWRITE; + private static Scopes $PROJECTREAD; + private static Scopes $PROJECTWRITE; + private static Scopes $KEYSREAD; + private static Scopes $KEYSWRITE; + private static Scopes $PLATFORMSREAD; + private static Scopes $PLATFORMSWRITE; + private static Scopes $MOCKSREAD; + private static Scopes $MOCKSWRITE; + private static Scopes $POLICIESREAD; + private static Scopes $POLICIESWRITE; + private static Scopes $PROJECTPOLICIESREAD; + private static Scopes $PROJECTPOLICIESWRITE; + private static Scopes $TEMPLATESREAD; + private static Scopes $TEMPLATESWRITE; + private static Scopes $OAUTH2READ; + private static Scopes $OAUTH2WRITE; private static Scopes $USERSREAD; private static Scopes $USERSWRITE; + private static Scopes $SESSIONSREAD; + private static Scopes $SESSIONSWRITE; private static Scopes $TEAMSREAD; private static Scopes $TEAMSWRITE; private static Scopes $DATABASESREAD; private static Scopes $DATABASESWRITE; - private static Scopes $COLLECTIONSREAD; - private static Scopes $COLLECTIONSWRITE; private static Scopes $TABLESREAD; private static Scopes $TABLESWRITE; - private static Scopes $ATTRIBUTESREAD; - private static Scopes $ATTRIBUTESWRITE; private static Scopes $COLUMNSREAD; private static Scopes $COLUMNSWRITE; private static Scopes $INDEXESREAD; private static Scopes $INDEXESWRITE; - private static Scopes $DOCUMENTSREAD; - private static Scopes $DOCUMENTSWRITE; private static Scopes $ROWSREAD; private static Scopes $ROWSWRITE; - private static Scopes $FILESREAD; - private static Scopes $FILESWRITE; + private static Scopes $COLLECTIONSREAD; + private static Scopes $COLLECTIONSWRITE; + private static Scopes $ATTRIBUTESREAD; + private static Scopes $ATTRIBUTESWRITE; + private static Scopes $DOCUMENTSREAD; + private static Scopes $DOCUMENTSWRITE; private static Scopes $BUCKETSREAD; private static Scopes $BUCKETSWRITE; + private static Scopes $FILESREAD; + private static Scopes $FILESWRITE; + private static Scopes $TOKENSREAD; + private static Scopes $TOKENSWRITE; private static Scopes $FUNCTIONSREAD; private static Scopes $FUNCTIONSWRITE; + private static Scopes $EXECUTIONSREAD; + private static Scopes $EXECUTIONSWRITE; + private static Scopes $EXECUTIONREAD; + private static Scopes $EXECUTIONWRITE; private static Scopes $SITESREAD; private static Scopes $SITESWRITE; private static Scopes $LOGREAD; private static Scopes $LOGWRITE; - private static Scopes $EXECUTIONREAD; - private static Scopes $EXECUTIONWRITE; - private static Scopes $LOCALEREAD; - private static Scopes $AVATARSREAD; - private static Scopes $HEALTHREAD; private static Scopes $PROVIDERSREAD; private static Scopes $PROVIDERSWRITE; - private static Scopes $MESSAGESREAD; - private static Scopes $MESSAGESWRITE; private static Scopes $TOPICSREAD; private static Scopes $TOPICSWRITE; private static Scopes $SUBSCRIBERSREAD; private static Scopes $SUBSCRIBERSWRITE; private static Scopes $TARGETSREAD; private static Scopes $TARGETSWRITE; + private static Scopes $MESSAGESREAD; + private static Scopes $MESSAGESWRITE; private static Scopes $RULESREAD; private static Scopes $RULESWRITE; - private static Scopes $SCHEDULESREAD; - private static Scopes $SCHEDULESWRITE; + private static Scopes $WEBHOOKSREAD; + private static Scopes $WEBHOOKSWRITE; + private static Scopes $LOCALEREAD; + private static Scopes $AVATARSREAD; + private static Scopes $HEALTHREAD; + private static Scopes $ASSISTANTREAD; private static Scopes $MIGRATIONSREAD; private static Scopes $MIGRATIONSWRITE; + private static Scopes $SCHEDULESREAD; + private static Scopes $SCHEDULESWRITE; private static Scopes $VCSREAD; private static Scopes $VCSWRITE; - private static Scopes $ASSISTANTREAD; - private static Scopes $TOKENSREAD; - private static Scopes $TOKENSWRITE; - private static Scopes $WEBHOOKSREAD; - private static Scopes $WEBHOOKSWRITE; - private static Scopes $PROJECTREAD; - private static Scopes $PROJECTWRITE; - private static Scopes $KEYSREAD; - private static Scopes $KEYSWRITE; - private static Scopes $PLATFORMSREAD; - private static Scopes $PLATFORMSWRITE; - private static Scopes $POLICIESWRITE; - private static Scopes $POLICIESREAD; + private static Scopes $PRESENCESREAD; + private static Scopes $PRESENCESWRITE; + private static Scopes $BACKUPSPOLICIESREAD; + private static Scopes $BACKUPSPOLICIESWRITE; private static Scopes $ARCHIVESREAD; private static Scopes $ARCHIVESWRITE; private static Scopes $RESTORATIONSREAD; @@ -98,12 +113,117 @@ public function jsonSerialize(): string return $this->value; } - public static function SESSIONSWRITE(): Scopes + public static function PROJECTREAD(): Scopes { - if (!isset(self::$SESSIONSWRITE)) { - self::$SESSIONSWRITE = new Scopes('sessions.write'); + if (!isset(self::$PROJECTREAD)) { + self::$PROJECTREAD = new Scopes('project.read'); } - return self::$SESSIONSWRITE; + return self::$PROJECTREAD; + } + public static function PROJECTWRITE(): Scopes + { + if (!isset(self::$PROJECTWRITE)) { + self::$PROJECTWRITE = new Scopes('project.write'); + } + return self::$PROJECTWRITE; + } + public static function KEYSREAD(): Scopes + { + if (!isset(self::$KEYSREAD)) { + self::$KEYSREAD = new Scopes('keys.read'); + } + return self::$KEYSREAD; + } + public static function KEYSWRITE(): Scopes + { + if (!isset(self::$KEYSWRITE)) { + self::$KEYSWRITE = new Scopes('keys.write'); + } + return self::$KEYSWRITE; + } + public static function PLATFORMSREAD(): Scopes + { + if (!isset(self::$PLATFORMSREAD)) { + self::$PLATFORMSREAD = new Scopes('platforms.read'); + } + return self::$PLATFORMSREAD; + } + public static function PLATFORMSWRITE(): Scopes + { + if (!isset(self::$PLATFORMSWRITE)) { + self::$PLATFORMSWRITE = new Scopes('platforms.write'); + } + return self::$PLATFORMSWRITE; + } + public static function MOCKSREAD(): Scopes + { + if (!isset(self::$MOCKSREAD)) { + self::$MOCKSREAD = new Scopes('mocks.read'); + } + return self::$MOCKSREAD; + } + public static function MOCKSWRITE(): Scopes + { + if (!isset(self::$MOCKSWRITE)) { + self::$MOCKSWRITE = new Scopes('mocks.write'); + } + return self::$MOCKSWRITE; + } + public static function POLICIESREAD(): Scopes + { + if (!isset(self::$POLICIESREAD)) { + self::$POLICIESREAD = new Scopes('policies.read'); + } + return self::$POLICIESREAD; + } + public static function POLICIESWRITE(): Scopes + { + if (!isset(self::$POLICIESWRITE)) { + self::$POLICIESWRITE = new Scopes('policies.write'); + } + return self::$POLICIESWRITE; + } + public static function PROJECTPOLICIESREAD(): Scopes + { + if (!isset(self::$PROJECTPOLICIESREAD)) { + self::$PROJECTPOLICIESREAD = new Scopes('project.policies.read'); + } + return self::$PROJECTPOLICIESREAD; + } + public static function PROJECTPOLICIESWRITE(): Scopes + { + if (!isset(self::$PROJECTPOLICIESWRITE)) { + self::$PROJECTPOLICIESWRITE = new Scopes('project.policies.write'); + } + return self::$PROJECTPOLICIESWRITE; + } + public static function TEMPLATESREAD(): Scopes + { + if (!isset(self::$TEMPLATESREAD)) { + self::$TEMPLATESREAD = new Scopes('templates.read'); + } + return self::$TEMPLATESREAD; + } + public static function TEMPLATESWRITE(): Scopes + { + if (!isset(self::$TEMPLATESWRITE)) { + self::$TEMPLATESWRITE = new Scopes('templates.write'); + } + return self::$TEMPLATESWRITE; + } + public static function OAUTH2READ(): Scopes + { + if (!isset(self::$OAUTH2READ)) { + self::$OAUTH2READ = new Scopes('oauth2.read'); + } + return self::$OAUTH2READ; + } + public static function OAUTH2WRITE(): Scopes + { + if (!isset(self::$OAUTH2WRITE)) { + self::$OAUTH2WRITE = new Scopes('oauth2.write'); + } + return self::$OAUTH2WRITE; } public static function USERSREAD(): Scopes { @@ -119,6 +239,20 @@ public static function USERSWRITE(): Scopes } return self::$USERSWRITE; } + public static function SESSIONSREAD(): Scopes + { + if (!isset(self::$SESSIONSREAD)) { + self::$SESSIONSREAD = new Scopes('sessions.read'); + } + return self::$SESSIONSREAD; + } + public static function SESSIONSWRITE(): Scopes + { + if (!isset(self::$SESSIONSWRITE)) { + self::$SESSIONSWRITE = new Scopes('sessions.write'); + } + return self::$SESSIONSWRITE; + } public static function TEAMSREAD(): Scopes { if (!isset(self::$TEAMSREAD)) { @@ -147,20 +281,6 @@ public static function DATABASESWRITE(): Scopes } return self::$DATABASESWRITE; } - public static function COLLECTIONSREAD(): Scopes - { - if (!isset(self::$COLLECTIONSREAD)) { - self::$COLLECTIONSREAD = new Scopes('collections.read'); - } - return self::$COLLECTIONSREAD; - } - public static function COLLECTIONSWRITE(): Scopes - { - if (!isset(self::$COLLECTIONSWRITE)) { - self::$COLLECTIONSWRITE = new Scopes('collections.write'); - } - return self::$COLLECTIONSWRITE; - } public static function TABLESREAD(): Scopes { if (!isset(self::$TABLESREAD)) { @@ -175,20 +295,6 @@ public static function TABLESWRITE(): Scopes } return self::$TABLESWRITE; } - public static function ATTRIBUTESREAD(): Scopes - { - if (!isset(self::$ATTRIBUTESREAD)) { - self::$ATTRIBUTESREAD = new Scopes('attributes.read'); - } - return self::$ATTRIBUTESREAD; - } - public static function ATTRIBUTESWRITE(): Scopes - { - if (!isset(self::$ATTRIBUTESWRITE)) { - self::$ATTRIBUTESWRITE = new Scopes('attributes.write'); - } - return self::$ATTRIBUTESWRITE; - } public static function COLUMNSREAD(): Scopes { if (!isset(self::$COLUMNSREAD)) { @@ -217,6 +323,48 @@ public static function INDEXESWRITE(): Scopes } return self::$INDEXESWRITE; } + public static function ROWSREAD(): Scopes + { + if (!isset(self::$ROWSREAD)) { + self::$ROWSREAD = new Scopes('rows.read'); + } + return self::$ROWSREAD; + } + public static function ROWSWRITE(): Scopes + { + if (!isset(self::$ROWSWRITE)) { + self::$ROWSWRITE = new Scopes('rows.write'); + } + return self::$ROWSWRITE; + } + public static function COLLECTIONSREAD(): Scopes + { + if (!isset(self::$COLLECTIONSREAD)) { + self::$COLLECTIONSREAD = new Scopes('collections.read'); + } + return self::$COLLECTIONSREAD; + } + public static function COLLECTIONSWRITE(): Scopes + { + if (!isset(self::$COLLECTIONSWRITE)) { + self::$COLLECTIONSWRITE = new Scopes('collections.write'); + } + return self::$COLLECTIONSWRITE; + } + public static function ATTRIBUTESREAD(): Scopes + { + if (!isset(self::$ATTRIBUTESREAD)) { + self::$ATTRIBUTESREAD = new Scopes('attributes.read'); + } + return self::$ATTRIBUTESREAD; + } + public static function ATTRIBUTESWRITE(): Scopes + { + if (!isset(self::$ATTRIBUTESWRITE)) { + self::$ATTRIBUTESWRITE = new Scopes('attributes.write'); + } + return self::$ATTRIBUTESWRITE; + } public static function DOCUMENTSREAD(): Scopes { if (!isset(self::$DOCUMENTSREAD)) { @@ -231,19 +379,19 @@ public static function DOCUMENTSWRITE(): Scopes } return self::$DOCUMENTSWRITE; } - public static function ROWSREAD(): Scopes + public static function BUCKETSREAD(): Scopes { - if (!isset(self::$ROWSREAD)) { - self::$ROWSREAD = new Scopes('rows.read'); + if (!isset(self::$BUCKETSREAD)) { + self::$BUCKETSREAD = new Scopes('buckets.read'); } - return self::$ROWSREAD; + return self::$BUCKETSREAD; } - public static function ROWSWRITE(): Scopes + public static function BUCKETSWRITE(): Scopes { - if (!isset(self::$ROWSWRITE)) { - self::$ROWSWRITE = new Scopes('rows.write'); + if (!isset(self::$BUCKETSWRITE)) { + self::$BUCKETSWRITE = new Scopes('buckets.write'); } - return self::$ROWSWRITE; + return self::$BUCKETSWRITE; } public static function FILESREAD(): Scopes { @@ -259,19 +407,19 @@ public static function FILESWRITE(): Scopes } return self::$FILESWRITE; } - public static function BUCKETSREAD(): Scopes + public static function TOKENSREAD(): Scopes { - if (!isset(self::$BUCKETSREAD)) { - self::$BUCKETSREAD = new Scopes('buckets.read'); + if (!isset(self::$TOKENSREAD)) { + self::$TOKENSREAD = new Scopes('tokens.read'); } - return self::$BUCKETSREAD; + return self::$TOKENSREAD; } - public static function BUCKETSWRITE(): Scopes + public static function TOKENSWRITE(): Scopes { - if (!isset(self::$BUCKETSWRITE)) { - self::$BUCKETSWRITE = new Scopes('buckets.write'); + if (!isset(self::$TOKENSWRITE)) { + self::$TOKENSWRITE = new Scopes('tokens.write'); } - return self::$BUCKETSWRITE; + return self::$TOKENSWRITE; } public static function FUNCTIONSREAD(): Scopes { @@ -285,35 +433,21 @@ public static function FUNCTIONSWRITE(): Scopes if (!isset(self::$FUNCTIONSWRITE)) { self::$FUNCTIONSWRITE = new Scopes('functions.write'); } - return self::$FUNCTIONSWRITE; - } - public static function SITESREAD(): Scopes - { - if (!isset(self::$SITESREAD)) { - self::$SITESREAD = new Scopes('sites.read'); - } - return self::$SITESREAD; - } - public static function SITESWRITE(): Scopes - { - if (!isset(self::$SITESWRITE)) { - self::$SITESWRITE = new Scopes('sites.write'); - } - return self::$SITESWRITE; + return self::$FUNCTIONSWRITE; } - public static function LOGREAD(): Scopes + public static function EXECUTIONSREAD(): Scopes { - if (!isset(self::$LOGREAD)) { - self::$LOGREAD = new Scopes('log.read'); + if (!isset(self::$EXECUTIONSREAD)) { + self::$EXECUTIONSREAD = new Scopes('executions.read'); } - return self::$LOGREAD; + return self::$EXECUTIONSREAD; } - public static function LOGWRITE(): Scopes + public static function EXECUTIONSWRITE(): Scopes { - if (!isset(self::$LOGWRITE)) { - self::$LOGWRITE = new Scopes('log.write'); + if (!isset(self::$EXECUTIONSWRITE)) { + self::$EXECUTIONSWRITE = new Scopes('executions.write'); } - return self::$LOGWRITE; + return self::$EXECUTIONSWRITE; } public static function EXECUTIONREAD(): Scopes { @@ -329,26 +463,33 @@ public static function EXECUTIONWRITE(): Scopes } return self::$EXECUTIONWRITE; } - public static function LOCALEREAD(): Scopes + public static function SITESREAD(): Scopes { - if (!isset(self::$LOCALEREAD)) { - self::$LOCALEREAD = new Scopes('locale.read'); + if (!isset(self::$SITESREAD)) { + self::$SITESREAD = new Scopes('sites.read'); } - return self::$LOCALEREAD; + return self::$SITESREAD; } - public static function AVATARSREAD(): Scopes + public static function SITESWRITE(): Scopes { - if (!isset(self::$AVATARSREAD)) { - self::$AVATARSREAD = new Scopes('avatars.read'); + if (!isset(self::$SITESWRITE)) { + self::$SITESWRITE = new Scopes('sites.write'); } - return self::$AVATARSREAD; + return self::$SITESWRITE; } - public static function HEALTHREAD(): Scopes + public static function LOGREAD(): Scopes { - if (!isset(self::$HEALTHREAD)) { - self::$HEALTHREAD = new Scopes('health.read'); + if (!isset(self::$LOGREAD)) { + self::$LOGREAD = new Scopes('log.read'); } - return self::$HEALTHREAD; + return self::$LOGREAD; + } + public static function LOGWRITE(): Scopes + { + if (!isset(self::$LOGWRITE)) { + self::$LOGWRITE = new Scopes('log.write'); + } + return self::$LOGWRITE; } public static function PROVIDERSREAD(): Scopes { @@ -364,20 +505,6 @@ public static function PROVIDERSWRITE(): Scopes } return self::$PROVIDERSWRITE; } - public static function MESSAGESREAD(): Scopes - { - if (!isset(self::$MESSAGESREAD)) { - self::$MESSAGESREAD = new Scopes('messages.read'); - } - return self::$MESSAGESREAD; - } - public static function MESSAGESWRITE(): Scopes - { - if (!isset(self::$MESSAGESWRITE)) { - self::$MESSAGESWRITE = new Scopes('messages.write'); - } - return self::$MESSAGESWRITE; - } public static function TOPICSREAD(): Scopes { if (!isset(self::$TOPICSREAD)) { @@ -420,6 +547,20 @@ public static function TARGETSWRITE(): Scopes } return self::$TARGETSWRITE; } + public static function MESSAGESREAD(): Scopes + { + if (!isset(self::$MESSAGESREAD)) { + self::$MESSAGESREAD = new Scopes('messages.read'); + } + return self::$MESSAGESREAD; + } + public static function MESSAGESWRITE(): Scopes + { + if (!isset(self::$MESSAGESWRITE)) { + self::$MESSAGESWRITE = new Scopes('messages.write'); + } + return self::$MESSAGESWRITE; + } public static function RULESREAD(): Scopes { if (!isset(self::$RULESREAD)) { @@ -434,47 +575,40 @@ public static function RULESWRITE(): Scopes } return self::$RULESWRITE; } - public static function SCHEDULESREAD(): Scopes - { - if (!isset(self::$SCHEDULESREAD)) { - self::$SCHEDULESREAD = new Scopes('schedules.read'); - } - return self::$SCHEDULESREAD; - } - public static function SCHEDULESWRITE(): Scopes + public static function WEBHOOKSREAD(): Scopes { - if (!isset(self::$SCHEDULESWRITE)) { - self::$SCHEDULESWRITE = new Scopes('schedules.write'); + if (!isset(self::$WEBHOOKSREAD)) { + self::$WEBHOOKSREAD = new Scopes('webhooks.read'); } - return self::$SCHEDULESWRITE; + return self::$WEBHOOKSREAD; } - public static function MIGRATIONSREAD(): Scopes + public static function WEBHOOKSWRITE(): Scopes { - if (!isset(self::$MIGRATIONSREAD)) { - self::$MIGRATIONSREAD = new Scopes('migrations.read'); + if (!isset(self::$WEBHOOKSWRITE)) { + self::$WEBHOOKSWRITE = new Scopes('webhooks.write'); } - return self::$MIGRATIONSREAD; + return self::$WEBHOOKSWRITE; } - public static function MIGRATIONSWRITE(): Scopes + public static function LOCALEREAD(): Scopes { - if (!isset(self::$MIGRATIONSWRITE)) { - self::$MIGRATIONSWRITE = new Scopes('migrations.write'); + if (!isset(self::$LOCALEREAD)) { + self::$LOCALEREAD = new Scopes('locale.read'); } - return self::$MIGRATIONSWRITE; + return self::$LOCALEREAD; } - public static function VCSREAD(): Scopes + public static function AVATARSREAD(): Scopes { - if (!isset(self::$VCSREAD)) { - self::$VCSREAD = new Scopes('vcs.read'); + if (!isset(self::$AVATARSREAD)) { + self::$AVATARSREAD = new Scopes('avatars.read'); } - return self::$VCSREAD; + return self::$AVATARSREAD; } - public static function VCSWRITE(): Scopes + public static function HEALTHREAD(): Scopes { - if (!isset(self::$VCSWRITE)) { - self::$VCSWRITE = new Scopes('vcs.write'); + if (!isset(self::$HEALTHREAD)) { + self::$HEALTHREAD = new Scopes('health.read'); } - return self::$VCSWRITE; + return self::$HEALTHREAD; } public static function ASSISTANTREAD(): Scopes { @@ -483,89 +617,75 @@ public static function ASSISTANTREAD(): Scopes } return self::$ASSISTANTREAD; } - public static function TOKENSREAD(): Scopes - { - if (!isset(self::$TOKENSREAD)) { - self::$TOKENSREAD = new Scopes('tokens.read'); - } - return self::$TOKENSREAD; - } - public static function TOKENSWRITE(): Scopes - { - if (!isset(self::$TOKENSWRITE)) { - self::$TOKENSWRITE = new Scopes('tokens.write'); - } - return self::$TOKENSWRITE; - } - public static function WEBHOOKSREAD(): Scopes + public static function MIGRATIONSREAD(): Scopes { - if (!isset(self::$WEBHOOKSREAD)) { - self::$WEBHOOKSREAD = new Scopes('webhooks.read'); + if (!isset(self::$MIGRATIONSREAD)) { + self::$MIGRATIONSREAD = new Scopes('migrations.read'); } - return self::$WEBHOOKSREAD; + return self::$MIGRATIONSREAD; } - public static function WEBHOOKSWRITE(): Scopes + public static function MIGRATIONSWRITE(): Scopes { - if (!isset(self::$WEBHOOKSWRITE)) { - self::$WEBHOOKSWRITE = new Scopes('webhooks.write'); + if (!isset(self::$MIGRATIONSWRITE)) { + self::$MIGRATIONSWRITE = new Scopes('migrations.write'); } - return self::$WEBHOOKSWRITE; + return self::$MIGRATIONSWRITE; } - public static function PROJECTREAD(): Scopes + public static function SCHEDULESREAD(): Scopes { - if (!isset(self::$PROJECTREAD)) { - self::$PROJECTREAD = new Scopes('project.read'); + if (!isset(self::$SCHEDULESREAD)) { + self::$SCHEDULESREAD = new Scopes('schedules.read'); } - return self::$PROJECTREAD; + return self::$SCHEDULESREAD; } - public static function PROJECTWRITE(): Scopes + public static function SCHEDULESWRITE(): Scopes { - if (!isset(self::$PROJECTWRITE)) { - self::$PROJECTWRITE = new Scopes('project.write'); + if (!isset(self::$SCHEDULESWRITE)) { + self::$SCHEDULESWRITE = new Scopes('schedules.write'); } - return self::$PROJECTWRITE; + return self::$SCHEDULESWRITE; } - public static function KEYSREAD(): Scopes + public static function VCSREAD(): Scopes { - if (!isset(self::$KEYSREAD)) { - self::$KEYSREAD = new Scopes('keys.read'); + if (!isset(self::$VCSREAD)) { + self::$VCSREAD = new Scopes('vcs.read'); } - return self::$KEYSREAD; + return self::$VCSREAD; } - public static function KEYSWRITE(): Scopes + public static function VCSWRITE(): Scopes { - if (!isset(self::$KEYSWRITE)) { - self::$KEYSWRITE = new Scopes('keys.write'); + if (!isset(self::$VCSWRITE)) { + self::$VCSWRITE = new Scopes('vcs.write'); } - return self::$KEYSWRITE; + return self::$VCSWRITE; } - public static function PLATFORMSREAD(): Scopes + public static function PRESENCESREAD(): Scopes { - if (!isset(self::$PLATFORMSREAD)) { - self::$PLATFORMSREAD = new Scopes('platforms.read'); + if (!isset(self::$PRESENCESREAD)) { + self::$PRESENCESREAD = new Scopes('presences.read'); } - return self::$PLATFORMSREAD; + return self::$PRESENCESREAD; } - public static function PLATFORMSWRITE(): Scopes + public static function PRESENCESWRITE(): Scopes { - if (!isset(self::$PLATFORMSWRITE)) { - self::$PLATFORMSWRITE = new Scopes('platforms.write'); + if (!isset(self::$PRESENCESWRITE)) { + self::$PRESENCESWRITE = new Scopes('presences.write'); } - return self::$PLATFORMSWRITE; + return self::$PRESENCESWRITE; } - public static function POLICIESWRITE(): Scopes + public static function BACKUPSPOLICIESREAD(): Scopes { - if (!isset(self::$POLICIESWRITE)) { - self::$POLICIESWRITE = new Scopes('policies.write'); + if (!isset(self::$BACKUPSPOLICIESREAD)) { + self::$BACKUPSPOLICIESREAD = new Scopes('backups.policies.read'); } - return self::$POLICIESWRITE; + return self::$BACKUPSPOLICIESREAD; } - public static function POLICIESREAD(): Scopes + public static function BACKUPSPOLICIESWRITE(): Scopes { - if (!isset(self::$POLICIESREAD)) { - self::$POLICIESREAD = new Scopes('policies.read'); + if (!isset(self::$BACKUPSPOLICIESWRITE)) { + self::$BACKUPSPOLICIESWRITE = new Scopes('backups.policies.write'); } - return self::$POLICIESREAD; + return self::$BACKUPSPOLICIESWRITE; } public static function ARCHIVESREAD(): Scopes { @@ -620,73 +740,88 @@ public static function EVENTSREAD(): Scopes public static function from(string $value): self { return match ($value) { - 'sessions.write' => self::SESSIONSWRITE(), + '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(), - 'collections.read' => self::COLLECTIONSREAD(), - 'collections.write' => self::COLLECTIONSWRITE(), 'tables.read' => self::TABLESREAD(), 'tables.write' => self::TABLESWRITE(), - 'attributes.read' => self::ATTRIBUTESREAD(), - 'attributes.write' => self::ATTRIBUTESWRITE(), 'columns.read' => self::COLUMNSREAD(), 'columns.write' => self::COLUMNSWRITE(), 'indexes.read' => self::INDEXESREAD(), 'indexes.write' => self::INDEXESWRITE(), - 'documents.read' => self::DOCUMENTSREAD(), - 'documents.write' => self::DOCUMENTSWRITE(), 'rows.read' => self::ROWSREAD(), 'rows.write' => self::ROWSWRITE(), - 'files.read' => self::FILESREAD(), - 'files.write' => self::FILESWRITE(), + '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(), - 'execution.read' => self::EXECUTIONREAD(), - 'execution.write' => self::EXECUTIONWRITE(), - 'locale.read' => self::LOCALEREAD(), - 'avatars.read' => self::AVATARSREAD(), - 'health.read' => self::HEALTHREAD(), 'providers.read' => self::PROVIDERSREAD(), 'providers.write' => self::PROVIDERSWRITE(), - 'messages.read' => self::MESSAGESREAD(), - 'messages.write' => self::MESSAGESWRITE(), '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(), - 'schedules.read' => self::SCHEDULESREAD(), - 'schedules.write' => self::SCHEDULESWRITE(), + '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(), - 'assistant.read' => self::ASSISTANTREAD(), - 'tokens.read' => self::TOKENSREAD(), - 'tokens.write' => self::TOKENSWRITE(), - 'webhooks.read' => self::WEBHOOKSREAD(), - 'webhooks.write' => self::WEBHOOKSWRITE(), - 'project.read' => self::PROJECTREAD(), - 'project.write' => self::PROJECTWRITE(), - 'keys.read' => self::KEYSREAD(), - 'keys.write' => self::KEYSWRITE(), - 'platforms.read' => self::PLATFORMSREAD(), - 'platforms.write' => self::PLATFORMSWRITE(), - 'policies.write' => self::POLICIESWRITE(), - 'policies.read' => self::POLICIESREAD(), + '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(), diff --git a/src/Appwrite/Enums/Secure.php b/src/Appwrite/Enums/Secure.php new file mode 100644 index 00000000..4e15981f --- /dev/null +++ b/src/Appwrite/Enums/Secure.php @@ -0,0 +1,52 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function TLS(): Secure + { + if (!isset(self::$TLS)) { + self::$TLS = new Secure('tls'); + } + return self::$TLS; + } + public static function SSL(): Secure + { + if (!isset(self::$SSL)) { + self::$SSL = new Secure('ssl'); + } + return self::$SSL; + } + + public static function from(string $value): self + { + return match ($value) { + 'tls' => self::TLS(), + 'ssl' => self::SSL(), + default => throw new \InvalidArgumentException('Unknown Secure value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/StatusCode.php b/src/Appwrite/Enums/StatusCode.php new file mode 100644 index 00000000..08d3ea92 --- /dev/null +++ b/src/Appwrite/Enums/StatusCode.php @@ -0,0 +1,70 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function MOVEDPERMANENTLY301(): StatusCode + { + if (!isset(self::$MOVEDPERMANENTLY301)) { + self::$MOVEDPERMANENTLY301 = new StatusCode('301'); + } + return self::$MOVEDPERMANENTLY301; + } + public static function FOUND302(): StatusCode + { + if (!isset(self::$FOUND302)) { + self::$FOUND302 = new StatusCode('302'); + } + return self::$FOUND302; + } + public static function TEMPORARYREDIRECT307(): StatusCode + { + if (!isset(self::$TEMPORARYREDIRECT307)) { + self::$TEMPORARYREDIRECT307 = new StatusCode('307'); + } + return self::$TEMPORARYREDIRECT307; + } + public static function PERMANENTREDIRECT308(): StatusCode + { + if (!isset(self::$PERMANENTREDIRECT308)) { + self::$PERMANENTREDIRECT308 = new StatusCode('308'); + } + return self::$PERMANENTREDIRECT308; + } + + public static function from(string $value): self + { + return match ($value) { + '301' => self::MOVEDPERMANENTLY301(), + '302' => self::FOUND302(), + '307' => self::TEMPORARYREDIRECT307(), + '308' => self::PERMANENTREDIRECT308(), + default => throw new \InvalidArgumentException('Unknown StatusCode value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Models/AttributeBigint.php b/src/Appwrite/Models/AttributeBigint.php new file mode 100644 index 00000000..bcd175c2 --- /dev/null +++ b/src/Appwrite/Models/AttributeBigint.php @@ -0,0 +1,107 @@ + $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('type', $data)) { + throw new \InvalidArgumentException('Missing required field "type" for ' . static::class . '.'); + } + if (!array_key_exists('status', $data)) { + throw new \InvalidArgumentException('Missing required field "status" for ' . static::class . '.'); + } + if (!array_key_exists('error', $data)) { + throw new \InvalidArgumentException('Missing required field "error" for ' . static::class . '.'); + } + if (!array_key_exists('required', $data)) { + throw new \InvalidArgumentException('Missing required field "required" 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 . '.'); + } + + return new static( + key: $data['key'], + type: $data['type'], + status: static::hydrateTypedValue(AttributeStatus::class, $data['status']), + error: $data['error'], + required: $data['required'], + createdAt: $data['$createdAt'], + updatedAt: $data['$updatedAt'], + array: array_key_exists('array', $data) ? $data['array'] : null, + min: array_key_exists('min', $data) ? $data['min'] : null, + max: array_key_exists('max', $data) ? $data['max'] : null, + default: array_key_exists('default', $data) ? $data['default'] : null + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + 'key' => static::serializeValue($this->key), + 'type' => static::serializeValue($this->type), + 'status' => static::serializeValue($this->status), + 'error' => static::serializeValue($this->error), + 'required' => static::serializeValue($this->required), + 'array' => static::serializeValue($this->array), + '$createdAt' => static::serializeValue($this->createdAt), + '$updatedAt' => static::serializeValue($this->updatedAt), + 'min' => static::serializeValue($this->min), + 'max' => static::serializeValue($this->max), + 'default' => static::serializeValue($this->default) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/AuthProvider.php b/src/Appwrite/Models/AuthProvider.php index efe6208b..9d426ced 100644 --- a/src/Appwrite/Models/AuthProvider.php +++ b/src/Appwrite/Models/AuthProvider.php @@ -15,7 +15,7 @@ * @param string $key auth provider. * @param string $name auth provider name. * @param string $appId oauth 2.0 application id. - * @param string $secret oauth 2.0 application secret. might be json string if provider requires extra configuration. + * @param string $secret oauth 2.0 application secret. might be json string if provider requires extra configuration. this property is write-only and always returned empty. * @param bool $enabled auth provider is active and can be used to create session. */ public function __construct( diff --git a/src/Appwrite/Models/BackupArchive.php b/src/Appwrite/Models/BackupArchive.php index 47a2b3ce..2a0fcfa5 100644 --- a/src/Appwrite/Models/BackupArchive.php +++ b/src/Appwrite/Models/BackupArchive.php @@ -17,7 +17,7 @@ * @param string $updatedAt archive update date in iso 8601 format. * @param string $policyId archive policy id. * @param int $size archive size in bytes. - * @param string $status the status of the archive creation. possible values: pending, processing, uploading, completed, failed. + * @param string $status the status of the archive creation. possible values: pending, processing, uploading, completed, failed, skipped. * @param string $startedAt the backup start time. * @param string $migrationId migration id. * @param array $services the services that are backed up by this archive. diff --git a/src/Appwrite/Models/Block.php b/src/Appwrite/Models/Block.php index 682cd510..350d0c12 100644 --- a/src/Appwrite/Models/Block.php +++ b/src/Appwrite/Models/Block.php @@ -15,6 +15,11 @@ * @param string $createdAt block creation date in iso 8601 format. * @param string $resourceType resource type that is blocked * @param string $resourceId resource identifier that is blocked + * @param string $projectName name of the project this block applies to. + * @param string $region region of the project this block applies to. + * @param string $organizationName name of the organization that owns the project. + * @param string $organizationId id of the organization that owns the project. + * @param string $billingPlan billing plan of the organization that owns the project. * @param string|null $reason reason for the block. can be null if no reason was provided. * @param string|null $expiredAt block expiration date in iso 8601 format. can be null if the block does not expire. */ @@ -22,6 +27,11 @@ public function __construct( public string $createdAt, public string $resourceType, public string $resourceId, + public string $projectName, + public string $region, + public string $organizationName, + public string $organizationId, + public string $billingPlan, public ?string $reason = null, public ?string $expiredAt = null ) { @@ -41,11 +51,31 @@ public static function from(array $data): static if (!array_key_exists('resourceId', $data)) { throw new \InvalidArgumentException('Missing required field "resourceId" for ' . static::class . '.'); } + if (!array_key_exists('projectName', $data)) { + throw new \InvalidArgumentException('Missing required field "projectName" for ' . static::class . '.'); + } + if (!array_key_exists('region', $data)) { + throw new \InvalidArgumentException('Missing required field "region" for ' . static::class . '.'); + } + if (!array_key_exists('organizationName', $data)) { + throw new \InvalidArgumentException('Missing required field "organizationName" for ' . static::class . '.'); + } + if (!array_key_exists('organizationId', $data)) { + throw new \InvalidArgumentException('Missing required field "organizationId" for ' . static::class . '.'); + } + if (!array_key_exists('billingPlan', $data)) { + throw new \InvalidArgumentException('Missing required field "billingPlan" for ' . static::class . '.'); + } return new static( createdAt: $data['$createdAt'], resourceType: $data['resourceType'], resourceId: $data['resourceId'], + projectName: $data['projectName'], + region: $data['region'], + organizationName: $data['organizationName'], + organizationId: $data['organizationId'], + billingPlan: $data['billingPlan'], reason: array_key_exists('reason', $data) ? $data['reason'] : null, expiredAt: array_key_exists('expiredAt', $data) ? $data['expiredAt'] : null ); @@ -61,7 +91,12 @@ public function toArray(): array 'resourceType' => static::serializeValue($this->resourceType), 'resourceId' => static::serializeValue($this->resourceId), 'reason' => static::serializeValue($this->reason), - 'expiredAt' => static::serializeValue($this->expiredAt) + 'expiredAt' => static::serializeValue($this->expiredAt), + 'projectName' => static::serializeValue($this->projectName), + 'region' => static::serializeValue($this->region), + 'organizationName' => static::serializeValue($this->organizationName), + 'organizationId' => static::serializeValue($this->organizationId), + 'billingPlan' => static::serializeValue($this->billingPlan) ]; return $result; diff --git a/src/Appwrite/Models/ColumnBigint.php b/src/Appwrite/Models/ColumnBigint.php new file mode 100644 index 00000000..dcf0372b --- /dev/null +++ b/src/Appwrite/Models/ColumnBigint.php @@ -0,0 +1,107 @@ + $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('type', $data)) { + throw new \InvalidArgumentException('Missing required field "type" for ' . static::class . '.'); + } + if (!array_key_exists('status', $data)) { + throw new \InvalidArgumentException('Missing required field "status" for ' . static::class . '.'); + } + if (!array_key_exists('error', $data)) { + throw new \InvalidArgumentException('Missing required field "error" for ' . static::class . '.'); + } + if (!array_key_exists('required', $data)) { + throw new \InvalidArgumentException('Missing required field "required" 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 . '.'); + } + + return new static( + key: $data['key'], + type: $data['type'], + status: static::hydrateTypedValue(ColumnStatus::class, $data['status']), + error: $data['error'], + required: $data['required'], + createdAt: $data['$createdAt'], + updatedAt: $data['$updatedAt'], + array: array_key_exists('array', $data) ? $data['array'] : null, + min: array_key_exists('min', $data) ? $data['min'] : null, + max: array_key_exists('max', $data) ? $data['max'] : null, + default: array_key_exists('default', $data) ? $data['default'] : null + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + 'key' => static::serializeValue($this->key), + 'type' => static::serializeValue($this->type), + 'status' => static::serializeValue($this->status), + 'error' => static::serializeValue($this->error), + 'required' => static::serializeValue($this->required), + 'array' => static::serializeValue($this->array), + '$createdAt' => static::serializeValue($this->createdAt), + '$updatedAt' => static::serializeValue($this->updatedAt), + 'min' => static::serializeValue($this->min), + 'max' => static::serializeValue($this->max), + 'default' => static::serializeValue($this->default) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/EmailTemplate.php b/src/Appwrite/Models/EmailTemplate.php new file mode 100644 index 00000000..0eb72fa6 --- /dev/null +++ b/src/Appwrite/Models/EmailTemplate.php @@ -0,0 +1,96 @@ + $data + */ + public static function from(array $data): static + { + if (!array_key_exists('templateId', $data)) { + throw new \InvalidArgumentException('Missing required field "templateId" for ' . static::class . '.'); + } + if (!array_key_exists('locale', $data)) { + throw new \InvalidArgumentException('Missing required field "locale" for ' . static::class . '.'); + } + if (!array_key_exists('message', $data)) { + throw new \InvalidArgumentException('Missing required field "message" for ' . static::class . '.'); + } + if (!array_key_exists('senderName', $data)) { + throw new \InvalidArgumentException('Missing required field "senderName" for ' . static::class . '.'); + } + if (!array_key_exists('senderEmail', $data)) { + throw new \InvalidArgumentException('Missing required field "senderEmail" for ' . static::class . '.'); + } + if (!array_key_exists('replyToEmail', $data)) { + throw new \InvalidArgumentException('Missing required field "replyToEmail" for ' . static::class . '.'); + } + if (!array_key_exists('replyToName', $data)) { + throw new \InvalidArgumentException('Missing required field "replyToName" for ' . static::class . '.'); + } + if (!array_key_exists('subject', $data)) { + throw new \InvalidArgumentException('Missing required field "subject" for ' . static::class . '.'); + } + + return new static( + templateId: $data['templateId'], + locale: $data['locale'], + message: $data['message'], + senderName: $data['senderName'], + senderEmail: $data['senderEmail'], + replyToEmail: $data['replyToEmail'], + replyToName: $data['replyToName'], + subject: $data['subject'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + 'templateId' => static::serializeValue($this->templateId), + 'locale' => static::serializeValue($this->locale), + 'message' => static::serializeValue($this->message), + 'senderName' => static::serializeValue($this->senderName), + 'senderEmail' => static::serializeValue($this->senderEmail), + 'replyToEmail' => static::serializeValue($this->replyToEmail), + 'replyToName' => static::serializeValue($this->replyToName), + 'subject' => static::serializeValue($this->subject) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/EmailTemplateList.php b/src/Appwrite/Models/EmailTemplateList.php new file mode 100644 index 00000000..a39660b0 --- /dev/null +++ b/src/Appwrite/Models/EmailTemplateList.php @@ -0,0 +1,59 @@ + $templates list of templates. + */ + public function __construct( + public int $total, + public array $templates + ) { + } + + /** + * @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('templates', $data)) { + throw new \InvalidArgumentException('Missing required field "templates" for ' . static::class . '.'); + } + + return new static( + total: $data['total'], + templates: is_array($data['templates']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(EmailTemplate::class, $item), + $data['templates'] + ) + : $data['templates'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + 'total' => static::serializeValue($this->total), + 'templates' => static::serializeValue($this->templates) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/EphemeralKey.php b/src/Appwrite/Models/EphemeralKey.php new file mode 100644 index 00000000..16729bec --- /dev/null +++ b/src/Appwrite/Models/EphemeralKey.php @@ -0,0 +1,103 @@ + $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('name', $data)) { + throw new \InvalidArgumentException('Missing required field "name" for ' . static::class . '.'); + } + if (!array_key_exists('expire', $data)) { + throw new \InvalidArgumentException('Missing required field "expire" for ' . static::class . '.'); + } + if (!array_key_exists('scopes', $data)) { + throw new \InvalidArgumentException('Missing required field "scopes" for ' . static::class . '.'); + } + if (!array_key_exists('secret', $data)) { + throw new \InvalidArgumentException('Missing required field "secret" for ' . static::class . '.'); + } + if (!array_key_exists('accessedAt', $data)) { + throw new \InvalidArgumentException('Missing required field "accessedAt" for ' . static::class . '.'); + } + if (!array_key_exists('sdks', $data)) { + throw new \InvalidArgumentException('Missing required field "sdks" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + createdAt: $data['$createdAt'], + updatedAt: $data['$updatedAt'], + name: $data['name'], + expire: $data['expire'], + scopes: $data['scopes'], + secret: $data['secret'], + accessedAt: $data['accessedAt'], + sdks: $data['sdks'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + '$createdAt' => static::serializeValue($this->createdAt), + '$updatedAt' => static::serializeValue($this->updatedAt), + 'name' => static::serializeValue($this->name), + 'expire' => static::serializeValue($this->expire), + 'scopes' => static::serializeValue($this->scopes), + 'secret' => static::serializeValue($this->secret), + 'accessedAt' => static::serializeValue($this->accessedAt), + 'sdks' => static::serializeValue($this->sdks) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/Membership.php b/src/Appwrite/Models/Membership.php index e7264c28..e5db4567 100644 --- a/src/Appwrite/Models/Membership.php +++ b/src/Appwrite/Models/Membership.php @@ -18,6 +18,7 @@ * @param string $userId user id. * @param string $userName user name. hide this attribute by toggling membership privacy in the console. * @param string $userEmail user email address. hide this attribute by toggling membership privacy in the console. + * @param string $userPhone user phone number. hide this attribute by toggling membership privacy in the console. * @param string $teamId team id. * @param string $teamName team name. * @param string $invited date, the user has been invited to join the team in iso 8601 format. @@ -33,6 +34,7 @@ public function __construct( public string $userId, public string $userName, public string $userEmail, + public string $userPhone, public string $teamId, public string $teamName, public string $invited, @@ -66,6 +68,9 @@ public static function from(array $data): static if (!array_key_exists('userEmail', $data)) { throw new \InvalidArgumentException('Missing required field "userEmail" for ' . static::class . '.'); } + if (!array_key_exists('userPhone', $data)) { + throw new \InvalidArgumentException('Missing required field "userPhone" for ' . static::class . '.'); + } if (!array_key_exists('teamId', $data)) { throw new \InvalidArgumentException('Missing required field "teamId" for ' . static::class . '.'); } @@ -95,6 +100,7 @@ public static function from(array $data): static userId: $data['userId'], userName: $data['userName'], userEmail: $data['userEmail'], + userPhone: $data['userPhone'], teamId: $data['teamId'], teamName: $data['teamName'], invited: $data['invited'], @@ -117,6 +123,7 @@ public function toArray(): array 'userId' => static::serializeValue($this->userId), 'userName' => static::serializeValue($this->userName), 'userEmail' => static::serializeValue($this->userEmail), + 'userPhone' => static::serializeValue($this->userPhone), 'teamId' => static::serializeValue($this->teamId), 'teamName' => static::serializeValue($this->teamName), 'invited' => static::serializeValue($this->invited), diff --git a/src/Appwrite/Models/MockNumber.php b/src/Appwrite/Models/MockNumber.php index 64f341b3..2bbb1814 100644 --- a/src/Appwrite/Models/MockNumber.php +++ b/src/Appwrite/Models/MockNumber.php @@ -12,12 +12,16 @@ /** * MockNumber constructor. * - * @param string $phone mock phone number for testing phone authentication. useful for testing phone authentication without sending an sms. + * @param string $number mock phone number for testing phone authentication. useful for testing phone authentication without sending an sms. * @param string $otp mock otp for the number. + * @param string $createdAt attribute creation date in iso 8601 format. + * @param string $updatedAt attribute update date in iso 8601 format. */ public function __construct( - public string $phone, - public string $otp + public string $number, + public string $otp, + public string $createdAt, + public string $updatedAt ) { } @@ -26,16 +30,24 @@ public function __construct( */ public static function from(array $data): static { - if (!array_key_exists('phone', $data)) { - throw new \InvalidArgumentException('Missing required field "phone" for ' . static::class . '.'); + if (!array_key_exists('number', $data)) { + throw new \InvalidArgumentException('Missing required field "number" for ' . static::class . '.'); } if (!array_key_exists('otp', $data)) { throw new \InvalidArgumentException('Missing required field "otp" 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 . '.'); + } return new static( - phone: $data['phone'], - otp: $data['otp'] + number: $data['number'], + otp: $data['otp'], + createdAt: $data['$createdAt'], + updatedAt: $data['$updatedAt'] ); } @@ -45,8 +57,10 @@ public static function from(array $data): static public function toArray(): array { $result = [ - 'phone' => static::serializeValue($this->phone), - 'otp' => static::serializeValue($this->otp) + 'number' => static::serializeValue($this->number), + 'otp' => static::serializeValue($this->otp), + '$createdAt' => static::serializeValue($this->createdAt), + '$updatedAt' => static::serializeValue($this->updatedAt) ]; return $result; diff --git a/src/Appwrite/Models/MockNumberList.php b/src/Appwrite/Models/MockNumberList.php new file mode 100644 index 00000000..1d47405f --- /dev/null +++ b/src/Appwrite/Models/MockNumberList.php @@ -0,0 +1,59 @@ + $mockNumbers list of mocknumbers. + */ + public function __construct( + public int $total, + public array $mockNumbers + ) { + } + + /** + * @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('mockNumbers', $data)) { + throw new \InvalidArgumentException('Missing required field "mockNumbers" for ' . static::class . '.'); + } + + return new static( + total: $data['total'], + mockNumbers: is_array($data['mockNumbers']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(MockNumber::class, $item), + $data['mockNumbers'] + ) + : $data['mockNumbers'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + 'total' => static::serializeValue($this->total), + 'mockNumbers' => static::serializeValue($this->mockNumbers) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Amazon.php b/src/Appwrite/Models/OAuth2Amazon.php new file mode 100644 index 00000000..4b431fb7 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Amazon.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Apple.php b/src/Appwrite/Models/OAuth2Apple.php new file mode 100644 index 00000000..3c7029bb --- /dev/null +++ b/src/Appwrite/Models/OAuth2Apple.php @@ -0,0 +1,82 @@ + $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 . '.'); + } + if (!array_key_exists('serviceId', $data)) { + throw new \InvalidArgumentException('Missing required field "serviceId" for ' . static::class . '.'); + } + if (!array_key_exists('keyId', $data)) { + throw new \InvalidArgumentException('Missing required field "keyId" for ' . static::class . '.'); + } + if (!array_key_exists('teamId', $data)) { + throw new \InvalidArgumentException('Missing required field "teamId" for ' . static::class . '.'); + } + if (!array_key_exists('p8File', $data)) { + throw new \InvalidArgumentException('Missing required field "p8File" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + serviceId: $data['serviceId'], + keyId: $data['keyId'], + teamId: $data['teamId'], + p8File: $data['p8File'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'serviceId' => static::serializeValue($this->serviceId), + 'keyId' => static::serializeValue($this->keyId), + 'teamId' => static::serializeValue($this->teamId), + 'p8File' => static::serializeValue($this->p8File) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Auth0.php b/src/Appwrite/Models/OAuth2Auth0.php new file mode 100644 index 00000000..8c72ff7e --- /dev/null +++ b/src/Appwrite/Models/OAuth2Auth0.php @@ -0,0 +1,75 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + if (!array_key_exists('endpoint', $data)) { + throw new \InvalidArgumentException('Missing required field "endpoint" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'], + endpoint: $data['endpoint'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret), + 'endpoint' => static::serializeValue($this->endpoint) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Authentik.php b/src/Appwrite/Models/OAuth2Authentik.php new file mode 100644 index 00000000..c939589d --- /dev/null +++ b/src/Appwrite/Models/OAuth2Authentik.php @@ -0,0 +1,75 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + if (!array_key_exists('endpoint', $data)) { + throw new \InvalidArgumentException('Missing required field "endpoint" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'], + endpoint: $data['endpoint'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret), + 'endpoint' => static::serializeValue($this->endpoint) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Autodesk.php b/src/Appwrite/Models/OAuth2Autodesk.php new file mode 100644 index 00000000..ea2067be --- /dev/null +++ b/src/Appwrite/Models/OAuth2Autodesk.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Bitbucket.php b/src/Appwrite/Models/OAuth2Bitbucket.php new file mode 100644 index 00000000..f1a6e42f --- /dev/null +++ b/src/Appwrite/Models/OAuth2Bitbucket.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('key', $data)) { + throw new \InvalidArgumentException('Missing required field "key" for ' . static::class . '.'); + } + if (!array_key_exists('secret', $data)) { + throw new \InvalidArgumentException('Missing required field "secret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + key: $data['key'], + secret: $data['secret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'key' => static::serializeValue($this->key), + 'secret' => static::serializeValue($this->secret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Bitly.php b/src/Appwrite/Models/OAuth2Bitly.php new file mode 100644 index 00000000..8dd8ab8a --- /dev/null +++ b/src/Appwrite/Models/OAuth2Bitly.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Box.php b/src/Appwrite/Models/OAuth2Box.php new file mode 100644 index 00000000..7b4b14e6 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Box.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Dailymotion.php b/src/Appwrite/Models/OAuth2Dailymotion.php new file mode 100644 index 00000000..8bc52f6b --- /dev/null +++ b/src/Appwrite/Models/OAuth2Dailymotion.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('apiKey', $data)) { + throw new \InvalidArgumentException('Missing required field "apiKey" for ' . static::class . '.'); + } + if (!array_key_exists('apiSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "apiSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + apiKey: $data['apiKey'], + apiSecret: $data['apiSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'apiKey' => static::serializeValue($this->apiKey), + 'apiSecret' => static::serializeValue($this->apiSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Discord.php b/src/Appwrite/Models/OAuth2Discord.php new file mode 100644 index 00000000..f9c1d5b3 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Discord.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Disqus.php b/src/Appwrite/Models/OAuth2Disqus.php new file mode 100644 index 00000000..1bc8367c --- /dev/null +++ b/src/Appwrite/Models/OAuth2Disqus.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('publicKey', $data)) { + throw new \InvalidArgumentException('Missing required field "publicKey" for ' . static::class . '.'); + } + if (!array_key_exists('secretKey', $data)) { + throw new \InvalidArgumentException('Missing required field "secretKey" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + publicKey: $data['publicKey'], + secretKey: $data['secretKey'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'publicKey' => static::serializeValue($this->publicKey), + 'secretKey' => static::serializeValue($this->secretKey) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Dropbox.php b/src/Appwrite/Models/OAuth2Dropbox.php new file mode 100644 index 00000000..b0474ab4 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Dropbox.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('appKey', $data)) { + throw new \InvalidArgumentException('Missing required field "appKey" for ' . static::class . '.'); + } + if (!array_key_exists('appSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "appSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + appKey: $data['appKey'], + appSecret: $data['appSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'appKey' => static::serializeValue($this->appKey), + 'appSecret' => static::serializeValue($this->appSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Etsy.php b/src/Appwrite/Models/OAuth2Etsy.php new file mode 100644 index 00000000..120cf59a --- /dev/null +++ b/src/Appwrite/Models/OAuth2Etsy.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('keyString', $data)) { + throw new \InvalidArgumentException('Missing required field "keyString" for ' . static::class . '.'); + } + if (!array_key_exists('sharedSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "sharedSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + keyString: $data['keyString'], + sharedSecret: $data['sharedSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'keyString' => static::serializeValue($this->keyString), + 'sharedSecret' => static::serializeValue($this->sharedSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Facebook.php b/src/Appwrite/Models/OAuth2Facebook.php new file mode 100644 index 00000000..9a9e8adb --- /dev/null +++ b/src/Appwrite/Models/OAuth2Facebook.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('appId', $data)) { + throw new \InvalidArgumentException('Missing required field "appId" for ' . static::class . '.'); + } + if (!array_key_exists('appSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "appSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + appId: $data['appId'], + appSecret: $data['appSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'appId' => static::serializeValue($this->appId), + 'appSecret' => static::serializeValue($this->appSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Figma.php b/src/Appwrite/Models/OAuth2Figma.php new file mode 100644 index 00000000..02eab723 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Figma.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2FusionAuth.php b/src/Appwrite/Models/OAuth2FusionAuth.php new file mode 100644 index 00000000..0e2a7042 --- /dev/null +++ b/src/Appwrite/Models/OAuth2FusionAuth.php @@ -0,0 +1,75 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + if (!array_key_exists('endpoint', $data)) { + throw new \InvalidArgumentException('Missing required field "endpoint" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'], + endpoint: $data['endpoint'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret), + 'endpoint' => static::serializeValue($this->endpoint) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Github.php b/src/Appwrite/Models/OAuth2Github.php new file mode 100644 index 00000000..c103d864 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Github.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Gitlab.php b/src/Appwrite/Models/OAuth2Gitlab.php new file mode 100644 index 00000000..61b54587 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Gitlab.php @@ -0,0 +1,75 @@ + $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 . '.'); + } + if (!array_key_exists('applicationId', $data)) { + throw new \InvalidArgumentException('Missing required field "applicationId" for ' . static::class . '.'); + } + if (!array_key_exists('secret', $data)) { + throw new \InvalidArgumentException('Missing required field "secret" for ' . static::class . '.'); + } + if (!array_key_exists('endpoint', $data)) { + throw new \InvalidArgumentException('Missing required field "endpoint" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + applicationId: $data['applicationId'], + secret: $data['secret'], + endpoint: $data['endpoint'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'applicationId' => static::serializeValue($this->applicationId), + 'secret' => static::serializeValue($this->secret), + 'endpoint' => static::serializeValue($this->endpoint) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Google.php b/src/Appwrite/Models/OAuth2Google.php new file mode 100644 index 00000000..51124da7 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Google.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Keycloak.php b/src/Appwrite/Models/OAuth2Keycloak.php new file mode 100644 index 00000000..8f7ca6d5 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Keycloak.php @@ -0,0 +1,82 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + if (!array_key_exists('endpoint', $data)) { + throw new \InvalidArgumentException('Missing required field "endpoint" for ' . static::class . '.'); + } + if (!array_key_exists('realmName', $data)) { + throw new \InvalidArgumentException('Missing required field "realmName" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'], + endpoint: $data['endpoint'], + realmName: $data['realmName'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret), + 'endpoint' => static::serializeValue($this->endpoint), + 'realmName' => static::serializeValue($this->realmName) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Kick.php b/src/Appwrite/Models/OAuth2Kick.php new file mode 100644 index 00000000..cbf58c7c --- /dev/null +++ b/src/Appwrite/Models/OAuth2Kick.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Linkedin.php b/src/Appwrite/Models/OAuth2Linkedin.php new file mode 100644 index 00000000..e3676882 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Linkedin.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('primaryClientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "primaryClientSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + primaryClientSecret: $data['primaryClientSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'primaryClientSecret' => static::serializeValue($this->primaryClientSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Microsoft.php b/src/Appwrite/Models/OAuth2Microsoft.php new file mode 100644 index 00000000..dc086930 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Microsoft.php @@ -0,0 +1,75 @@ + $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 . '.'); + } + if (!array_key_exists('applicationId', $data)) { + throw new \InvalidArgumentException('Missing required field "applicationId" for ' . static::class . '.'); + } + if (!array_key_exists('applicationSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "applicationSecret" for ' . static::class . '.'); + } + if (!array_key_exists('tenant', $data)) { + throw new \InvalidArgumentException('Missing required field "tenant" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + applicationId: $data['applicationId'], + applicationSecret: $data['applicationSecret'], + tenant: $data['tenant'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'applicationId' => static::serializeValue($this->applicationId), + 'applicationSecret' => static::serializeValue($this->applicationSecret), + 'tenant' => static::serializeValue($this->tenant) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Notion.php b/src/Appwrite/Models/OAuth2Notion.php new file mode 100644 index 00000000..f2612124 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Notion.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('oauthClientId', $data)) { + throw new \InvalidArgumentException('Missing required field "oauthClientId" for ' . static::class . '.'); + } + if (!array_key_exists('oauthClientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "oauthClientSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + oauthClientId: $data['oauthClientId'], + oauthClientSecret: $data['oauthClientSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'oauthClientId' => static::serializeValue($this->oauthClientId), + 'oauthClientSecret' => static::serializeValue($this->oauthClientSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Oidc.php b/src/Appwrite/Models/OAuth2Oidc.php new file mode 100644 index 00000000..7fd780e9 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Oidc.php @@ -0,0 +1,96 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + if (!array_key_exists('wellKnownURL', $data)) { + throw new \InvalidArgumentException('Missing required field "wellKnownURL" for ' . static::class . '.'); + } + if (!array_key_exists('authorizationURL', $data)) { + throw new \InvalidArgumentException('Missing required field "authorizationURL" for ' . static::class . '.'); + } + if (!array_key_exists('tokenURL', $data)) { + throw new \InvalidArgumentException('Missing required field "tokenURL" for ' . static::class . '.'); + } + if (!array_key_exists('userInfoURL', $data)) { + throw new \InvalidArgumentException('Missing required field "userInfoURL" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'], + wellKnownURL: $data['wellKnownURL'], + authorizationURL: $data['authorizationURL'], + tokenURL: $data['tokenURL'], + userInfoURL: $data['userInfoURL'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret), + 'wellKnownURL' => static::serializeValue($this->wellKnownURL), + 'authorizationURL' => static::serializeValue($this->authorizationURL), + 'tokenURL' => static::serializeValue($this->tokenURL), + 'userInfoURL' => static::serializeValue($this->userInfoURL) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Okta.php b/src/Appwrite/Models/OAuth2Okta.php new file mode 100644 index 00000000..5ddd3f50 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Okta.php @@ -0,0 +1,82 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + if (!array_key_exists('domain', $data)) { + throw new \InvalidArgumentException('Missing required field "domain" for ' . static::class . '.'); + } + if (!array_key_exists('authorizationServerId', $data)) { + throw new \InvalidArgumentException('Missing required field "authorizationServerId" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'], + domain: $data['domain'], + authorizationServerId: $data['authorizationServerId'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret), + 'domain' => static::serializeValue($this->domain), + 'authorizationServerId' => static::serializeValue($this->authorizationServerId) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Paypal.php b/src/Appwrite/Models/OAuth2Paypal.php new file mode 100644 index 00000000..fbe8ded0 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Paypal.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('secretKey', $data)) { + throw new \InvalidArgumentException('Missing required field "secretKey" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + secretKey: $data['secretKey'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'secretKey' => static::serializeValue($this->secretKey) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Podio.php b/src/Appwrite/Models/OAuth2Podio.php new file mode 100644 index 00000000..53d92cdf --- /dev/null +++ b/src/Appwrite/Models/OAuth2Podio.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2ProviderList.php b/src/Appwrite/Models/OAuth2ProviderList.php new file mode 100644 index 00000000..91f22677 --- /dev/null +++ b/src/Appwrite/Models/OAuth2ProviderList.php @@ -0,0 +1,54 @@ + $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('providers', $data)) { + throw new \InvalidArgumentException('Missing required field "providers" for ' . static::class . '.'); + } + + return new static( + total: $data['total'], + providers: $data['providers'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + 'total' => static::serializeValue($this->total), + 'providers' => static::serializeValue($this->providers) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Salesforce.php b/src/Appwrite/Models/OAuth2Salesforce.php new file mode 100644 index 00000000..7c43e7b3 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Salesforce.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('customerKey', $data)) { + throw new \InvalidArgumentException('Missing required field "customerKey" for ' . static::class . '.'); + } + if (!array_key_exists('customerSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "customerSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + customerKey: $data['customerKey'], + customerSecret: $data['customerSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'customerKey' => static::serializeValue($this->customerKey), + 'customerSecret' => static::serializeValue($this->customerSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Slack.php b/src/Appwrite/Models/OAuth2Slack.php new file mode 100644 index 00000000..15d38489 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Slack.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Spotify.php b/src/Appwrite/Models/OAuth2Spotify.php new file mode 100644 index 00000000..c632a878 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Spotify.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Stripe.php b/src/Appwrite/Models/OAuth2Stripe.php new file mode 100644 index 00000000..d779a8d5 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Stripe.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('apiSecretKey', $data)) { + throw new \InvalidArgumentException('Missing required field "apiSecretKey" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + apiSecretKey: $data['apiSecretKey'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'apiSecretKey' => static::serializeValue($this->apiSecretKey) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Tradeshift.php b/src/Appwrite/Models/OAuth2Tradeshift.php new file mode 100644 index 00000000..1fda081e --- /dev/null +++ b/src/Appwrite/Models/OAuth2Tradeshift.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('oauth2ClientId', $data)) { + throw new \InvalidArgumentException('Missing required field "oauth2ClientId" for ' . static::class . '.'); + } + if (!array_key_exists('oauth2ClientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "oauth2ClientSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + oauth2ClientId: $data['oauth2ClientId'], + oauth2ClientSecret: $data['oauth2ClientSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'oauth2ClientId' => static::serializeValue($this->oauth2ClientId), + 'oauth2ClientSecret' => static::serializeValue($this->oauth2ClientSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Twitch.php b/src/Appwrite/Models/OAuth2Twitch.php new file mode 100644 index 00000000..0d003260 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Twitch.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2WordPress.php b/src/Appwrite/Models/OAuth2WordPress.php new file mode 100644 index 00000000..4748f573 --- /dev/null +++ b/src/Appwrite/Models/OAuth2WordPress.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2X.php b/src/Appwrite/Models/OAuth2X.php new file mode 100644 index 00000000..0d63599b --- /dev/null +++ b/src/Appwrite/Models/OAuth2X.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('customerKey', $data)) { + throw new \InvalidArgumentException('Missing required field "customerKey" for ' . static::class . '.'); + } + if (!array_key_exists('secretKey', $data)) { + throw new \InvalidArgumentException('Missing required field "secretKey" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + customerKey: $data['customerKey'], + secretKey: $data['secretKey'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'customerKey' => static::serializeValue($this->customerKey), + 'secretKey' => static::serializeValue($this->secretKey) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Yahoo.php b/src/Appwrite/Models/OAuth2Yahoo.php new file mode 100644 index 00000000..0d2fad34 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Yahoo.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Yandex.php b/src/Appwrite/Models/OAuth2Yandex.php new file mode 100644 index 00000000..e2b43d52 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Yandex.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Zoho.php b/src/Appwrite/Models/OAuth2Zoho.php new file mode 100644 index 00000000..73eab938 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Zoho.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/OAuth2Zoom.php b/src/Appwrite/Models/OAuth2Zoom.php new file mode 100644 index 00000000..34454121 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Zoom.php @@ -0,0 +1,68 @@ + $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 . '.'); + } + if (!array_key_exists('clientId', $data)) { + throw new \InvalidArgumentException('Missing required field "clientId" for ' . static::class . '.'); + } + if (!array_key_exists('clientSecret', $data)) { + throw new \InvalidArgumentException('Missing required field "clientSecret" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/PolicyList.php b/src/Appwrite/Models/PolicyList.php new file mode 100644 index 00000000..5258e808 --- /dev/null +++ b/src/Appwrite/Models/PolicyList.php @@ -0,0 +1,54 @@ + $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('policies', $data)) { + throw new \InvalidArgumentException('Missing required field "policies" for ' . static::class . '.'); + } + + return new static( + total: $data['total'], + policies: $data['policies'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + 'total' => static::serializeValue($this->total), + 'policies' => static::serializeValue($this->policies) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/PolicyMembershipPrivacy.php b/src/Appwrite/Models/PolicyMembershipPrivacy.php new file mode 100644 index 00000000..e7f8bb75 --- /dev/null +++ b/src/Appwrite/Models/PolicyMembershipPrivacy.php @@ -0,0 +1,82 @@ + $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('userId', $data)) { + throw new \InvalidArgumentException('Missing required field "userId" for ' . static::class . '.'); + } + if (!array_key_exists('userEmail', $data)) { + throw new \InvalidArgumentException('Missing required field "userEmail" for ' . static::class . '.'); + } + if (!array_key_exists('userPhone', $data)) { + throw new \InvalidArgumentException('Missing required field "userPhone" for ' . static::class . '.'); + } + if (!array_key_exists('userName', $data)) { + throw new \InvalidArgumentException('Missing required field "userName" for ' . static::class . '.'); + } + if (!array_key_exists('userMFA', $data)) { + throw new \InvalidArgumentException('Missing required field "userMFA" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + userId: $data['userId'], + userEmail: $data['userEmail'], + userPhone: $data['userPhone'], + userName: $data['userName'], + userMFA: $data['userMFA'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'userId' => static::serializeValue($this->userId), + 'userEmail' => static::serializeValue($this->userEmail), + 'userPhone' => static::serializeValue($this->userPhone), + 'userName' => static::serializeValue($this->userName), + 'userMFA' => static::serializeValue($this->userMFA) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/PolicyPasswordDictionary.php b/src/Appwrite/Models/PolicyPasswordDictionary.php new file mode 100644 index 00000000..e640be87 --- /dev/null +++ b/src/Appwrite/Models/PolicyPasswordDictionary.php @@ -0,0 +1,54 @@ + $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: $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/PolicyPasswordHistory.php b/src/Appwrite/Models/PolicyPasswordHistory.php new file mode 100644 index 00000000..7192807a --- /dev/null +++ b/src/Appwrite/Models/PolicyPasswordHistory.php @@ -0,0 +1,54 @@ + $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('total', $data)) { + throw new \InvalidArgumentException('Missing required field "total" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + total: $data['total'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'total' => static::serializeValue($this->total) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/PolicyPasswordPersonalData.php b/src/Appwrite/Models/PolicyPasswordPersonalData.php new file mode 100644 index 00000000..4637c56e --- /dev/null +++ b/src/Appwrite/Models/PolicyPasswordPersonalData.php @@ -0,0 +1,54 @@ + $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: $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/PolicySessionAlert.php b/src/Appwrite/Models/PolicySessionAlert.php new file mode 100644 index 00000000..74939839 --- /dev/null +++ b/src/Appwrite/Models/PolicySessionAlert.php @@ -0,0 +1,54 @@ + $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: $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/PolicySessionDuration.php b/src/Appwrite/Models/PolicySessionDuration.php new file mode 100644 index 00000000..a3f60b7b --- /dev/null +++ b/src/Appwrite/Models/PolicySessionDuration.php @@ -0,0 +1,54 @@ + $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('duration', $data)) { + throw new \InvalidArgumentException('Missing required field "duration" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + duration: $data['duration'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'duration' => static::serializeValue($this->duration) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/PolicySessionInvalidation.php b/src/Appwrite/Models/PolicySessionInvalidation.php new file mode 100644 index 00000000..9b6e1630 --- /dev/null +++ b/src/Appwrite/Models/PolicySessionInvalidation.php @@ -0,0 +1,54 @@ + $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: $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/PolicySessionLimit.php b/src/Appwrite/Models/PolicySessionLimit.php new file mode 100644 index 00000000..9055b3bc --- /dev/null +++ b/src/Appwrite/Models/PolicySessionLimit.php @@ -0,0 +1,54 @@ + $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('total', $data)) { + throw new \InvalidArgumentException('Missing required field "total" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + total: $data['total'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'total' => static::serializeValue($this->total) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/PolicyUserLimit.php b/src/Appwrite/Models/PolicyUserLimit.php new file mode 100644 index 00000000..c3866462 --- /dev/null +++ b/src/Appwrite/Models/PolicyUserLimit.php @@ -0,0 +1,54 @@ + $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('total', $data)) { + throw new \InvalidArgumentException('Missing required field "total" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + total: $data['total'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'total' => static::serializeValue($this->total) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/Presence.php b/src/Appwrite/Models/Presence.php new file mode 100644 index 00000000..dc444bd5 --- /dev/null +++ b/src/Appwrite/Models/Presence.php @@ -0,0 +1,129 @@ + $data Additional properties. + */ + public function __construct( + public string $id, + public string $sequence, + public string $createdAt, + public string $updatedAt, + public array $permissions, + public string $userInternalId, + public string $userId, + public string $source, + public ?string $status = null, + public ?string $expiresAt = null, + public array $data = [] + ) { + } + + /** + * @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('$sequence', $data)) { + throw new \InvalidArgumentException('Missing required field "$sequence" 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('userInternalId', $data)) { + throw new \InvalidArgumentException('Missing required field "userInternalId" 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', + '$sequence', + '$createdAt', + '$updatedAt', + '$permissions', + 'userInternalId', + 'userId', + 'status', + 'source', + 'expiresAt' + ] + ); + + return new static( + id: $data['$id'], + sequence: $data['$sequence'], + createdAt: $data['$createdAt'], + updatedAt: $data['$updatedAt'], + permissions: $data['$permissions'], + userInternalId: $data['userInternalId'], + userId: $data['userId'], + source: $data['source'], + status: array_key_exists('status', $data) ? $data['status'] : null, + expiresAt: array_key_exists('expiresAt', $data) ? $data['expiresAt'] : null, + data: $additionalProperties + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + '$sequence' => static::serializeValue($this->sequence), + '$createdAt' => static::serializeValue($this->createdAt), + '$updatedAt' => static::serializeValue($this->updatedAt), + '$permissions' => static::serializeValue($this->permissions), + 'userInternalId' => static::serializeValue($this->userInternalId), + 'userId' => static::serializeValue($this->userId), + 'status' => static::serializeValue($this->status), + 'source' => static::serializeValue($this->source), + 'expiresAt' => static::serializeValue($this->expiresAt) + ]; + + foreach (static::serializeAdditionalProperties($this->data) 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 00000000..ef673505 --- /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 dea878a4..3cc198f7 100644 --- a/src/Appwrite/Models/Project.php +++ b/src/Appwrite/Models/Project.php @@ -40,6 +40,8 @@ * @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. @@ -49,11 +51,12 @@ * @param bool $smtpEnabled status for custom smtp * @param string $smtpSenderName smtp sender name * @param string $smtpSenderEmail smtp sender email - * @param string $smtpReplyTo smtp reply to email + * @param string $smtpReplyToName smtp reply to name + * @param string $smtpReplyToEmail smtp reply to email * @param string $smtpHost smtp server host name * @param int $smtpPort smtp server port * @param string $smtpUsername smtp server username - * @param string $smtpPassword smtp server password + * @param string $smtpPassword smtp server password. this property is write-only and always returned empty. * @param string $smtpSecure smtp server secure protocol * @param int $pingCount number of times the ping was received for this project. * @param string $pingedAt last ping datetime in iso 8601 format. @@ -120,6 +123,8 @@ public function __construct( public bool $authMembershipsUserName, public bool $authMembershipsUserEmail, public bool $authMembershipsMfa, + public bool $authMembershipsUserId, + public bool $authMembershipsUserPhone, public bool $authInvalidateSessions, public array $oAuthProviders, public array $platforms, @@ -129,7 +134,8 @@ public function __construct( public bool $smtpEnabled, public string $smtpSenderName, public string $smtpSenderEmail, - public string $smtpReplyTo, + public string $smtpReplyToName, + public string $smtpReplyToEmail, public string $smtpHost, public int $smtpPort, public string $smtpUsername, @@ -262,6 +268,12 @@ public static function from(array $data): static 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 . '.'); } @@ -289,8 +301,11 @@ public static function from(array $data): static if (!array_key_exists('smtpSenderEmail', $data)) { throw new \InvalidArgumentException('Missing required field "smtpSenderEmail" for ' . static::class . '.'); } - if (!array_key_exists('smtpReplyTo', $data)) { - throw new \InvalidArgumentException('Missing required field "smtpReplyTo" for ' . static::class . '.'); + if (!array_key_exists('smtpReplyToName', $data)) { + throw new \InvalidArgumentException('Missing required field "smtpReplyToName" for ' . static::class . '.'); + } + if (!array_key_exists('smtpReplyToEmail', $data)) { + throw new \InvalidArgumentException('Missing required field "smtpReplyToEmail" for ' . static::class . '.'); } if (!array_key_exists('smtpHost', $data)) { throw new \InvalidArgumentException('Missing required field "smtpHost" for ' . static::class . '.'); @@ -447,6 +462,8 @@ public static function from(array $data): static 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( @@ -476,7 +493,8 @@ public static function from(array $data): static smtpEnabled: $data['smtpEnabled'], smtpSenderName: $data['smtpSenderName'], smtpSenderEmail: $data['smtpSenderEmail'], - smtpReplyTo: $data['smtpReplyTo'], + smtpReplyToName: $data['smtpReplyToName'], + smtpReplyToEmail: $data['smtpReplyToEmail'], smtpHost: $data['smtpHost'], smtpPort: $data['smtpPort'], smtpUsername: $data['smtpUsername'], @@ -559,6 +577,8 @@ public function toArray(): array '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), @@ -568,7 +588,8 @@ public function toArray(): array 'smtpEnabled' => static::serializeValue($this->smtpEnabled), 'smtpSenderName' => static::serializeValue($this->smtpSenderName), 'smtpSenderEmail' => static::serializeValue($this->smtpSenderEmail), - 'smtpReplyTo' => static::serializeValue($this->smtpReplyTo), + 'smtpReplyToName' => static::serializeValue($this->smtpReplyToName), + 'smtpReplyToEmail' => static::serializeValue($this->smtpReplyToEmail), 'smtpHost' => static::serializeValue($this->smtpHost), 'smtpPort' => static::serializeValue($this->smtpPort), 'smtpUsername' => static::serializeValue($this->smtpUsername), diff --git a/src/Appwrite/Models/ProxyRule.php b/src/Appwrite/Models/ProxyRule.php new file mode 100644 index 00000000..7c2ae6dc --- /dev/null +++ b/src/Appwrite/Models/ProxyRule.php @@ -0,0 +1,145 @@ + $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('domain', $data)) { + throw new \InvalidArgumentException('Missing required field "domain" for ' . static::class . '.'); + } + if (!array_key_exists('type', $data)) { + throw new \InvalidArgumentException('Missing required field "type" for ' . static::class . '.'); + } + if (!array_key_exists('trigger', $data)) { + throw new \InvalidArgumentException('Missing required field "trigger" for ' . static::class . '.'); + } + if (!array_key_exists('redirectUrl', $data)) { + throw new \InvalidArgumentException('Missing required field "redirectUrl" for ' . static::class . '.'); + } + if (!array_key_exists('redirectStatusCode', $data)) { + throw new \InvalidArgumentException('Missing required field "redirectStatusCode" for ' . static::class . '.'); + } + if (!array_key_exists('deploymentId', $data)) { + throw new \InvalidArgumentException('Missing required field "deploymentId" for ' . static::class . '.'); + } + if (!array_key_exists('deploymentResourceId', $data)) { + throw new \InvalidArgumentException('Missing required field "deploymentResourceId" for ' . static::class . '.'); + } + if (!array_key_exists('deploymentVcsProviderBranch', $data)) { + throw new \InvalidArgumentException('Missing required field "deploymentVcsProviderBranch" for ' . static::class . '.'); + } + if (!array_key_exists('status', $data)) { + throw new \InvalidArgumentException('Missing required field "status" for ' . static::class . '.'); + } + if (!array_key_exists('logs', $data)) { + throw new \InvalidArgumentException('Missing required field "logs" for ' . static::class . '.'); + } + if (!array_key_exists('renewAt', $data)) { + throw new \InvalidArgumentException('Missing required field "renewAt" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + createdAt: $data['$createdAt'], + updatedAt: $data['$updatedAt'], + domain: $data['domain'], + type: $data['type'], + trigger: $data['trigger'], + redirectUrl: $data['redirectUrl'], + redirectStatusCode: $data['redirectStatusCode'], + deploymentId: $data['deploymentId'], + deploymentResourceId: $data['deploymentResourceId'], + deploymentVcsProviderBranch: $data['deploymentVcsProviderBranch'], + status: static::hydrateTypedValue(ProxyRuleStatus::class, $data['status']), + logs: $data['logs'], + renewAt: $data['renewAt'], + deploymentResourceType: array_key_exists('deploymentResourceType', $data) ? static::hydrateTypedValue(ProxyRuleDeploymentResourceType::class, $data['deploymentResourceType'], true) : null + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + '$createdAt' => static::serializeValue($this->createdAt), + '$updatedAt' => static::serializeValue($this->updatedAt), + 'domain' => static::serializeValue($this->domain), + 'type' => static::serializeValue($this->type), + 'trigger' => static::serializeValue($this->trigger), + 'redirectUrl' => static::serializeValue($this->redirectUrl), + 'redirectStatusCode' => static::serializeValue($this->redirectStatusCode), + 'deploymentId' => static::serializeValue($this->deploymentId), + 'deploymentResourceType' => static::serializeValue($this->deploymentResourceType), + 'deploymentResourceId' => static::serializeValue($this->deploymentResourceId), + 'deploymentVcsProviderBranch' => static::serializeValue($this->deploymentVcsProviderBranch), + 'status' => static::serializeValue($this->status), + 'logs' => static::serializeValue($this->logs), + 'renewAt' => static::serializeValue($this->renewAt) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/ProxyRuleList.php b/src/Appwrite/Models/ProxyRuleList.php new file mode 100644 index 00000000..5c5377ca --- /dev/null +++ b/src/Appwrite/Models/ProxyRuleList.php @@ -0,0 +1,59 @@ + $rules list of rules. + */ + public function __construct( + public int $total, + public array $rules + ) { + } + + /** + * @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('rules', $data)) { + throw new \InvalidArgumentException('Missing required field "rules" for ' . static::class . '.'); + } + + return new static( + total: $data['total'], + rules: is_array($data['rules']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(ProxyRule::class, $item), + $data['rules'] + ) + : $data['rules'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + 'total' => static::serializeValue($this->total), + 'rules' => static::serializeValue($this->rules) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Services/Databases.php b/src/Appwrite/Services/Databases.php index 6eb07890..d750f79e 100644 --- a/src/Appwrite/Services/Databases.php +++ b/src/Appwrite/Services/Databases.php @@ -786,6 +786,119 @@ public function listAttributes(string $databaseId, string $collectionId, ?array } + /** + * Create a bigint attribute. Optionally, minimum and maximum values can be + * provided. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?int $min + * @param ?int $max + * @param ?int $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return \Appwrite\Models\AttributeBigint + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createBigIntColumn` instead. + * @see TablesDB::createBigIntColumn + */ + public function createBigIntAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?int $min = null, ?int $max = null, ?int $xdefault = null, ?bool $xarray = null): \Appwrite\Models\AttributeBigint + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/attributes/bigint' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['min'] = $min; + $apiParams['max'] = $max; + $apiParams['default'] = $xdefault; + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\AttributeBigint::from($response); + + } + + /** + * Update a bigint attribute. Changing the `default` value will not update + * already existing documents. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?int $xdefault + * @param ?int $min + * @param ?int $max + * @param ?string $newKey + * @throws AppwriteException + * @return \Appwrite\Models\AttributeBigint + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateBigIntColumn` instead. + * @see TablesDB::updateBigIntColumn + */ + public function updateBigIntAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?int $xdefault, ?int $min = null, ?int $max = null, ?string $newKey = null): \Appwrite\Models\AttributeBigint + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/databases/{databaseId}/collections/{collectionId}/attributes/bigint/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + $apiParams['min'] = $min; + $apiParams['max'] = $max; + $apiParams['newKey'] = $newKey; + + $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\AttributeBigint::from($response); + + } + /** * Create a boolean attribute. * diff --git a/src/Appwrite/Services/Functions.php b/src/Appwrite/Services/Functions.php index c5c6e913..7d44d391 100644 --- a/src/Appwrite/Services/Functions.php +++ b/src/Appwrite/Services/Functions.php @@ -1165,10 +1165,12 @@ public function deleteExecution(string $functionId, string $executionId): string * Get a list of all variables of a specific function. * * @param string $functionId + * @param ?array $queries + * @param ?bool $total * @throws AppwriteException * @return \Appwrite\Models\VariableList */ - public function listVariables(string $functionId): \Appwrite\Models\VariableList + public function listVariables(string $functionId, ?array $queries = null, ?bool $total = null): \Appwrite\Models\VariableList { $apiPath = str_replace( ['{functionId}'], @@ -1179,6 +1181,14 @@ public function listVariables(string $functionId): \Appwrite\Models\VariableList $apiParams = []; $apiParams['functionId'] = $functionId; + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; $response = $this->client->call( @@ -1201,13 +1211,14 @@ public function listVariables(string $functionId): \Appwrite\Models\VariableList * in the function at runtime as environment variables. * * @param string $functionId + * @param string $variableId * @param string $key * @param string $value * @param ?bool $secret * @throws AppwriteException * @return \Appwrite\Models\Variable */ - public function createVariable(string $functionId, string $key, string $value, ?bool $secret = null): \Appwrite\Models\Variable + public function createVariable(string $functionId, string $variableId, string $key, string $value, ?bool $secret = null): \Appwrite\Models\Variable { $apiPath = str_replace( ['{functionId}'], @@ -1217,6 +1228,7 @@ public function createVariable(string $functionId, string $key, string $value, ? $apiParams = []; $apiParams['functionId'] = $functionId; + $apiParams['variableId'] = $variableId; $apiParams['key'] = $key; $apiParams['value'] = $value; @@ -1284,13 +1296,13 @@ public function getVariable(string $functionId, string $variableId): \Appwrite\M * * @param string $functionId * @param string $variableId - * @param string $key + * @param ?string $key * @param ?string $value * @param ?bool $secret * @throws AppwriteException * @return \Appwrite\Models\Variable */ - public function updateVariable(string $functionId, string $variableId, string $key, ?string $value = null, ?bool $secret = null): \Appwrite\Models\Variable + public function updateVariable(string $functionId, string $variableId, ?string $key = null, ?string $value = null, ?bool $secret = null): \Appwrite\Models\Variable { $apiPath = str_replace( ['{functionId}', '{variableId}'], diff --git a/src/Appwrite/Services/Presences.php b/src/Appwrite/Services/Presences.php new file mode 100644 index 00000000..73aeb67e --- /dev/null +++ b/src/Appwrite/Services/Presences.php @@ -0,0 +1,231 @@ +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. + * + * @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 unique 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; + $apiParams['permissions'] = $permissions; + $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. + * + * @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; + $apiParams['status'] = $status; + $apiParams['expiresAt'] = $expiresAt; + $apiParams['metadata'] = $metadata; + $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 07796816..ec64b5d6 100644 --- a/src/Appwrite/Services/Project.php +++ b/src/Appwrite/Services/Project.php @@ -6,9 +6,15 @@ use Appwrite\Client; use Appwrite\Service; use Appwrite\InputFile; +use Appwrite\Enums\MethodId; use Appwrite\Enums\Scopes; +use Appwrite\Enums\ProviderId; +use Appwrite\Enums\PolicyId; use Appwrite\Enums\ProtocolId; use Appwrite\Enums\ServiceId; +use Appwrite\Enums\Secure; +use Appwrite\Enums\EmailTemplateType; +use Appwrite\Enums\EmailTemplateLocale; class Project extends Service { @@ -17,6 +23,75 @@ public function __construct(Client $client) parent::__construct($client); } + /** + * Delete a project. + * + * @throws AppwriteException + * @return string + */ + public function delete(): string + { + $apiPath = str_replace( + [], + [], + '/project' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + + return $response; + + } + + /** + * Update properties of a specific auth method. Use this endpoint to enable or + * disable a method in your project. + * + * @param MethodId $methodId + * @param bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\Project + */ + public function updateAuthMethod(MethodId $methodId, bool $enabled): \Appwrite\Models\Project + { + $apiPath = str_replace( + ['{methodId}'], + [$methodId], + '/project/auth-methods/{methodId}' + ); + + $apiParams = []; + $apiParams['methodId'] = $methodId; + $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); + + } + /** * Get a list of all API keys from the current project. * @@ -63,6 +138,9 @@ public function listKeys(?array $queries = null, ?bool $total = null): \Appwrite /** * Create a new API key. It's recommended to have multiple API keys with * strict scopes for separate functions within your project. + * + * You can also create an ephemeral API key if you need a short-lived key + * instead. * * @param string $keyId * @param string $name @@ -103,6 +181,48 @@ public function createKey(string $keyId, string $name, array $scopes, ?string $e } + /** + * Create a new ephemeral API key. It's recommended to have multiple API keys + * with strict scopes for separate functions within your project. + * + * You can also create a standard API key if you need a longer-lived key + * instead. + * + * @param array $scopes + * @param int $duration + * @throws AppwriteException + * @return \Appwrite\Models\EphemeralKey + */ + public function createEphemeralKey(array $scopes, int $duration): \Appwrite\Models\EphemeralKey + { + $apiPath = str_replace( + [], + [], + '/project/keys/ephemeral' + ); + + $apiParams = []; + $apiParams['scopes'] = $scopes; + $apiParams['duration'] = $duration; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\EphemeralKey::from($response); + + } + /** * Get a key by its unique ID. * @@ -252,20 +372,20 @@ public function updateLabels(array $labels): \Appwrite\Models\Project } /** - * Get a list of all platforms in the project. This endpoint returns an array - * of all platforms and their configurations. + * Get a list of all mock phones in the project. This endpoint returns an + * array of all mock phones and their OTPs. * * @param ?array $queries * @param ?bool $total * @throws AppwriteException - * @return \Appwrite\Models\PlatformList + * @return \Appwrite\Models\MockNumberList */ - public function listPlatforms(?array $queries = null, ?bool $total = null): \Appwrite\Models\PlatformList + public function listMockPhones(?array $queries = null, ?bool $total = null): \Appwrite\Models\MockNumberList { $apiPath = str_replace( [], [], - '/project/platforms' + '/project/mock-phones' ); $apiParams = []; @@ -291,33 +411,30 @@ public function listPlatforms(?array $queries = null, ?bool $total = null): \App throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); } - return \Appwrite\Models\PlatformList::from($response); + return \Appwrite\Models\MockNumberList::from($response); } /** - * Create a new Android platform for your project. Use this endpoint to - * register a new Android platform where your users will run your application - * which will interact with the Appwrite API. + * Create a new mock phone for your project. Use this endpoint to register a + * mock phone number and its sign-in OTP for your testers. * - * @param string $platformId - * @param string $name - * @param string $applicationId + * @param string $number + * @param string $otp * @throws AppwriteException - * @return \Appwrite\Models\PlatformAndroid + * @return \Appwrite\Models\MockNumber */ - public function createAndroidPlatform(string $platformId, string $name, string $applicationId): \Appwrite\Models\PlatformAndroid + public function createMockPhone(string $number, string $otp): \Appwrite\Models\MockNumber { $apiPath = str_replace( [], [], - '/project/platforms/android' + '/project/mock-phones' ); $apiParams = []; - $apiParams['platformId'] = $platformId; - $apiParams['name'] = $name; - $apiParams['applicationId'] = $applicationId; + $apiParams['number'] = $number; + $apiParams['otp'] = $otp; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -333,38 +450,33 @@ public function createAndroidPlatform(string $platformId, string $name, string $ throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); } - return \Appwrite\Models\PlatformAndroid::from($response); + return \Appwrite\Models\MockNumber::from($response); } /** - * Update an Android platform by its unique ID. Use this endpoint to update - * the platform's name or application ID. + * Get a mock phone by its unique number. This endpoint returns the mock + * phone's OTP. * - * @param string $platformId - * @param string $name - * @param string $applicationId + * @param string $number * @throws AppwriteException - * @return \Appwrite\Models\PlatformAndroid + * @return \Appwrite\Models\MockNumber */ - public function updateAndroidPlatform(string $platformId, string $name, string $applicationId): \Appwrite\Models\PlatformAndroid + public function getMockPhone(string $number): \Appwrite\Models\MockNumber { $apiPath = str_replace( - ['{platformId}'], - [$platformId], - '/project/platforms/android/{platformId}' + ['{number}'], + [$number], + '/project/mock-phones/{number}' ); $apiParams = []; - $apiParams['platformId'] = $platformId; - $apiParams['name'] = $name; - $apiParams['applicationId'] = $applicationId; + $apiParams['number'] = $number; $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; $response = $this->client->call( - Client::METHOD_PUT, + Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams @@ -374,39 +486,36 @@ public function updateAndroidPlatform(string $platformId, string $name, string $ throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); } - return \Appwrite\Models\PlatformAndroid::from($response); + return \Appwrite\Models\MockNumber::from($response); } /** - * Create a new Apple platform for your project. Use this endpoint to register - * a new Apple platform where your users will run your application which will - * interact with the Appwrite API. + * Update a mock phone by its unique number. Use this endpoint to update the + * mock phone's OTP. * - * @param string $platformId - * @param string $name - * @param string $bundleIdentifier + * @param string $number + * @param string $otp * @throws AppwriteException - * @return \Appwrite\Models\PlatformApple + * @return \Appwrite\Models\MockNumber */ - public function createApplePlatform(string $platformId, string $name, string $bundleIdentifier): \Appwrite\Models\PlatformApple + public function updateMockPhone(string $number, string $otp): \Appwrite\Models\MockNumber { $apiPath = str_replace( - [], - [], - '/project/platforms/apple' + ['{number}'], + [$number], + '/project/mock-phones/{number}' ); $apiParams = []; - $apiParams['platformId'] = $platformId; - $apiParams['name'] = $name; - $apiParams['bundleIdentifier'] = $bundleIdentifier; + $apiParams['number'] = $number; + $apiParams['otp'] = $otp; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; $response = $this->client->call( - Client::METHOD_POST, + Client::METHOD_PUT, $apiPath, $apiHeaders, $apiParams @@ -416,80 +525,75 @@ public function createApplePlatform(string $platformId, string $name, string $bu throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); } - return \Appwrite\Models\PlatformApple::from($response); + return \Appwrite\Models\MockNumber::from($response); } /** - * Update an Apple platform by its unique ID. Use this endpoint to update the - * platform's name or bundle identifier. + * Delete a mock phone by its unique number. This endpoint removes the mock + * phone and its OTP configuration from the project. * - * @param string $platformId - * @param string $name - * @param string $bundleIdentifier + * @param string $number * @throws AppwriteException - * @return \Appwrite\Models\PlatformApple + * @return string */ - public function updateApplePlatform(string $platformId, string $name, string $bundleIdentifier): \Appwrite\Models\PlatformApple + public function deleteMockPhone(string $number): string { $apiPath = str_replace( - ['{platformId}'], - [$platformId], - '/project/platforms/apple/{platformId}' + ['{number}'], + [$number], + '/project/mock-phones/{number}' ); $apiParams = []; - $apiParams['platformId'] = $platformId; - $apiParams['name'] = $name; - $apiParams['bundleIdentifier'] = $bundleIdentifier; + $apiParams['number'] = $number; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; $response = $this->client->call( - Client::METHOD_PUT, + Client::METHOD_DELETE, $apiPath, $apiHeaders, $apiParams ); - if (!is_array($response)) { - throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); - } - - return \Appwrite\Models\PlatformApple::from($response); + return $response; } /** - * Create a new Linux platform for your project. Use this endpoint to register - * a new Linux platform where your users will run your application which will - * interact with the Appwrite API. + * Get a list of all OAuth2 providers supported by the server, along with the + * project's configuration for each. Credential fields are write-only and + * always returned empty. * - * @param string $platformId - * @param string $name - * @param string $packageName + * @param ?array $queries + * @param ?bool $total * @throws AppwriteException - * @return \Appwrite\Models\PlatformLinux + * @return \Appwrite\Models\OAuth2ProviderList */ - public function createLinuxPlatform(string $platformId, string $name, string $packageName): \Appwrite\Models\PlatformLinux + public function listOAuth2Providers(?array $queries = null, ?bool $total = null): \Appwrite\Models\OAuth2ProviderList { $apiPath = str_replace( [], [], - '/project/platforms/linux' + '/project/oauth2' ); $apiParams = []; - $apiParams['platformId'] = $platformId; - $apiParams['name'] = $name; - $apiParams['packageName'] = $packageName; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($total)) { + $apiParams['total'] = $total; + } $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; $response = $this->client->call( - Client::METHOD_POST, + Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams @@ -499,38 +603,33 @@ public function createLinuxPlatform(string $platformId, string $name, string $pa throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); } - return \Appwrite\Models\PlatformLinux::from($response); + return \Appwrite\Models\OAuth2ProviderList::from($response); } /** - * Update a Linux platform by its unique ID. Use this endpoint to update the - * platform's name or package name. + * Get a single OAuth2 provider configuration. Credential fields (client + * secret, p8 file, key/team IDs) are write-only and always returned empty. * - * @param string $platformId - * @param string $name - * @param string $packageName + * @param ProviderId $providerId * @throws AppwriteException - * @return \Appwrite\Models\PlatformLinux + * @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 updateLinuxPlatform(string $platformId, string $name, string $packageName): \Appwrite\Models\PlatformLinux + public function getOAuth2Provider(ProviderId $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( - ['{platformId}'], - [$platformId], - '/project/platforms/linux/{platformId}' + [], + [], + '/project/oauth2/:provider' ); $apiParams = []; - $apiParams['platformId'] = $platformId; - $apiParams['name'] = $name; - $apiParams['packageName'] = $packageName; + $apiParams['providerId'] = $providerId; $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; $response = $this->client->call( - Client::METHOD_PUT, + Client::METHOD_GET, $apiPath, $apiHeaders, $apiParams @@ -540,80 +639,2755 @@ public function updateLinuxPlatform(string $platformId, string $name, string $pa throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); } - return \Appwrite\Models\PlatformLinux::from($response); + if (($response['$id'] ?? null) === 'github') { + return \Appwrite\Models\OAuth2Github::from($response); + } - } + if (($response['$id'] ?? null) === 'discord') { + return \Appwrite\Models\OAuth2Discord::from($response); + } - /** - * Create a new web platform for your project. Use this endpoint to register a - * new platform where your users will run your application which will interact - * with the Appwrite API. - * - * @param string $platformId - * @param string $name - * @param string $hostname - * @throws AppwriteException - * @return \Appwrite\Models\PlatformWeb - */ - public function createWebPlatform(string $platformId, string $name, string $hostname): \Appwrite\Models\PlatformWeb - { - $apiPath = str_replace( - [], - [], - '/project/platforms/web' - ); + if (($response['$id'] ?? null) === 'figma') { + return \Appwrite\Models\OAuth2Figma::from($response); + } - $apiParams = []; - $apiParams['platformId'] = $platformId; - $apiParams['name'] = $name; - $apiParams['hostname'] = $hostname; + if (($response['$id'] ?? null) === 'dropbox') { + return \Appwrite\Models\OAuth2Dropbox::from($response); + } - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; + if (($response['$id'] ?? null) === 'dailymotion') { + return \Appwrite\Models\OAuth2Dailymotion::from($response); + } - $response = $this->client->call( - Client::METHOD_POST, - $apiPath, - $apiHeaders, - $apiParams - ); + if (($response['$id'] ?? null) === 'bitbucket') { + return \Appwrite\Models\OAuth2Bitbucket::from($response); + } - if (!is_array($response)) { - throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + if (($response['$id'] ?? null) === 'bitly') { + return \Appwrite\Models\OAuth2Bitly::from($response); } - return \Appwrite\Models\PlatformWeb::from($response); + if (($response['$id'] ?? null) === 'box') { + return \Appwrite\Models\OAuth2Box::from($response); + } - } + if (($response['$id'] ?? null) === 'autodesk') { + return \Appwrite\Models\OAuth2Autodesk::from($response); + } - /** - * Update a web platform by its unique ID. Use this endpoint to update the - * platform's name or hostname. - * + if (($response['$id'] ?? null) === 'google') { + return \Appwrite\Models\OAuth2Google::from($response); + } + + if (($response['$id'] ?? null) === 'zoom') { + return \Appwrite\Models\OAuth2Zoom::from($response); + } + + if (($response['$id'] ?? null) === 'zoho') { + return \Appwrite\Models\OAuth2Zoho::from($response); + } + + if (($response['$id'] ?? null) === 'yandex') { + return \Appwrite\Models\OAuth2Yandex::from($response); + } + + if (($response['$id'] ?? null) === 'x') { + return \Appwrite\Models\OAuth2X::from($response); + } + + if (($response['$id'] ?? null) === 'wordpress') { + return \Appwrite\Models\OAuth2WordPress::from($response); + } + + if (($response['$id'] ?? null) === 'twitch') { + return \Appwrite\Models\OAuth2Twitch::from($response); + } + + if (($response['$id'] ?? null) === 'stripe') { + return \Appwrite\Models\OAuth2Stripe::from($response); + } + + if (($response['$id'] ?? null) === 'spotify') { + return \Appwrite\Models\OAuth2Spotify::from($response); + } + + if (($response['$id'] ?? null) === 'slack') { + return \Appwrite\Models\OAuth2Slack::from($response); + } + + if (($response['$id'] ?? null) === 'podio') { + return \Appwrite\Models\OAuth2Podio::from($response); + } + + if (($response['$id'] ?? null) === 'notion') { + return \Appwrite\Models\OAuth2Notion::from($response); + } + + if (($response['$id'] ?? null) === 'salesforce') { + return \Appwrite\Models\OAuth2Salesforce::from($response); + } + + if (($response['$id'] ?? null) === 'yahoo') { + return \Appwrite\Models\OAuth2Yahoo::from($response); + } + + if (($response['$id'] ?? null) === 'linkedin') { + return \Appwrite\Models\OAuth2Linkedin::from($response); + } + + if (($response['$id'] ?? null) === 'disqus') { + return \Appwrite\Models\OAuth2Disqus::from($response); + } + + if (($response['$id'] ?? null) === 'amazon') { + return \Appwrite\Models\OAuth2Amazon::from($response); + } + + if (($response['$id'] ?? null) === 'etsy') { + return \Appwrite\Models\OAuth2Etsy::from($response); + } + + if (($response['$id'] ?? null) === 'facebook') { + return \Appwrite\Models\OAuth2Facebook::from($response); + } + + if (($response['$id'] ?? null) === 'tradeshiftBox') { + return \Appwrite\Models\OAuth2Tradeshift::from($response); + } + + if (($response['$id'] ?? null) === 'paypalSandbox') { + return \Appwrite\Models\OAuth2Paypal::from($response); + } + + if (($response['$id'] ?? null) === 'gitlab') { + return \Appwrite\Models\OAuth2Gitlab::from($response); + } + + if (($response['$id'] ?? null) === 'authentik') { + return \Appwrite\Models\OAuth2Authentik::from($response); + } + + if (($response['$id'] ?? null) === 'auth0') { + return \Appwrite\Models\OAuth2Auth0::from($response); + } + + if (($response['$id'] ?? null) === 'fusionauth') { + return \Appwrite\Models\OAuth2FusionAuth::from($response); + } + + if (($response['$id'] ?? null) === 'keycloak') { + return \Appwrite\Models\OAuth2Keycloak::from($response); + } + + if (($response['$id'] ?? null) === 'oidc') { + return \Appwrite\Models\OAuth2Oidc::from($response); + } + + if (($response['$id'] ?? null) === 'apple') { + return \Appwrite\Models\OAuth2Apple::from($response); + } + + if (($response['$id'] ?? null) === 'okta') { + return \Appwrite\Models\OAuth2Okta::from($response); + } + + if (($response['$id'] ?? null) === 'kick') { + return \Appwrite\Models\OAuth2Kick::from($response); + } + + if (($response['$id'] ?? null) === 'microsoft') { + return \Appwrite\Models\OAuth2Microsoft::from($response); + } + + throw new \UnexpectedValueException('Unable to match response to any expected response model.'); + + } + + /** + * Update the project OAuth2 Amazon configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Amazon + */ + public function updateOAuth2Amazon(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Amazon + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/amazon' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $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\OAuth2Amazon::from($response); + + } + + /** + * Update the project OAuth2 Apple configuration. + * + * @param ?string $serviceId + * @param ?string $keyId + * @param ?string $teamId + * @param ?string $p8File + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Apple + */ + public function updateOAuth2Apple(?string $serviceId = null, ?string $keyId = null, ?string $teamId = null, ?string $p8File = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Apple + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/apple' + ); + + $apiParams = []; + $apiParams['serviceId'] = $serviceId; + $apiParams['keyId'] = $keyId; + $apiParams['teamId'] = $teamId; + $apiParams['p8File'] = $p8File; + $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\OAuth2Apple::from($response); + + } + + /** + * Update the project OAuth2 Auth0 configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?string $endpoint + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Auth0 + */ + public function updateOAuth2Auth0(?string $clientId = null, ?string $clientSecret = null, ?string $endpoint = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Auth0 + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/auth0' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $apiParams['endpoint'] = $endpoint; + $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\OAuth2Auth0::from($response); + + } + + /** + * Update the project OAuth2 Authentik configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?string $endpoint + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Authentik + */ + public function updateOAuth2Authentik(?string $clientId = null, ?string $clientSecret = null, ?string $endpoint = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Authentik + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/authentik' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $apiParams['endpoint'] = $endpoint; + $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\OAuth2Authentik::from($response); + + } + + /** + * Update the project OAuth2 Autodesk configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Autodesk + */ + public function updateOAuth2Autodesk(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Autodesk + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/autodesk' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $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\OAuth2Autodesk::from($response); + + } + + /** + * Update the project OAuth2 Bitbucket configuration. + * + * @param ?string $key + * @param ?string $secret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Bitbucket + */ + public function updateOAuth2Bitbucket(?string $key = null, ?string $secret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Bitbucket + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/bitbucket' + ); + + $apiParams = []; + $apiParams['key'] = $key; + $apiParams['secret'] = $secret; + $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\OAuth2Bitbucket::from($response); + + } + + /** + * Update the project OAuth2 Bitly configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Bitly + */ + public function updateOAuth2Bitly(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Bitly + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/bitly' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $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\OAuth2Bitly::from($response); + + } + + /** + * Update the project OAuth2 Box configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Box + */ + public function updateOAuth2Box(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Box + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/box' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $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\OAuth2Box::from($response); + + } + + /** + * Update the project OAuth2 Dailymotion configuration. + * + * @param ?string $apiKey + * @param ?string $apiSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Dailymotion + */ + public function updateOAuth2Dailymotion(?string $apiKey = null, ?string $apiSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Dailymotion + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/dailymotion' + ); + + $apiParams = []; + $apiParams['apiKey'] = $apiKey; + $apiParams['apiSecret'] = $apiSecret; + $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\OAuth2Dailymotion::from($response); + + } + + /** + * Update the project OAuth2 Discord configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Discord + */ + public function updateOAuth2Discord(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Discord + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/discord' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $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\OAuth2Discord::from($response); + + } + + /** + * Update the project OAuth2 Disqus configuration. + * + * @param ?string $publicKey + * @param ?string $secretKey + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Disqus + */ + public function updateOAuth2Disqus(?string $publicKey = null, ?string $secretKey = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Disqus + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/disqus' + ); + + $apiParams = []; + $apiParams['publicKey'] = $publicKey; + $apiParams['secretKey'] = $secretKey; + $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\OAuth2Disqus::from($response); + + } + + /** + * Update the project OAuth2 Dropbox configuration. + * + * @param ?string $appKey + * @param ?string $appSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Dropbox + */ + public function updateOAuth2Dropbox(?string $appKey = null, ?string $appSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Dropbox + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/dropbox' + ); + + $apiParams = []; + $apiParams['appKey'] = $appKey; + $apiParams['appSecret'] = $appSecret; + $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\OAuth2Dropbox::from($response); + + } + + /** + * Update the project OAuth2 Etsy configuration. + * + * @param ?string $keyString + * @param ?string $sharedSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Etsy + */ + public function updateOAuth2Etsy(?string $keyString = null, ?string $sharedSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Etsy + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/etsy' + ); + + $apiParams = []; + $apiParams['keyString'] = $keyString; + $apiParams['sharedSecret'] = $sharedSecret; + $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\OAuth2Etsy::from($response); + + } + + /** + * Update the project OAuth2 Facebook configuration. + * + * @param ?string $appId + * @param ?string $appSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Facebook + */ + public function updateOAuth2Facebook(?string $appId = null, ?string $appSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Facebook + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/facebook' + ); + + $apiParams = []; + $apiParams['appId'] = $appId; + $apiParams['appSecret'] = $appSecret; + $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\OAuth2Facebook::from($response); + + } + + /** + * Update the project OAuth2 Figma configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Figma + */ + public function updateOAuth2Figma(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Figma + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/figma' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $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\OAuth2Figma::from($response); + + } + + /** + * Update the project OAuth2 FusionAuth configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?string $endpoint + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2FusionAuth + */ + public function updateOAuth2FusionAuth(?string $clientId = null, ?string $clientSecret = null, ?string $endpoint = null, ?bool $enabled = null): \Appwrite\Models\OAuth2FusionAuth + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/fusionauth' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $apiParams['endpoint'] = $endpoint; + $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\OAuth2FusionAuth::from($response); + + } + + /** + * Update the project OAuth2 GitHub configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Github + */ + public function updateOAuth2GitHub(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Github + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/github' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $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\OAuth2Github::from($response); + + } + + /** + * Update the project OAuth2 Gitlab configuration. + * + * @param ?string $applicationId + * @param ?string $secret + * @param ?string $endpoint + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Gitlab + */ + public function updateOAuth2Gitlab(?string $applicationId = null, ?string $secret = null, ?string $endpoint = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Gitlab + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/gitlab' + ); + + $apiParams = []; + $apiParams['applicationId'] = $applicationId; + $apiParams['secret'] = $secret; + $apiParams['endpoint'] = $endpoint; + $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\OAuth2Gitlab::from($response); + + } + + /** + * Update the project OAuth2 Google configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Google + */ + public function updateOAuth2Google(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Google + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/google' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $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\OAuth2Google::from($response); + + } + + /** + * Update the project OAuth2 Keycloak configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?string $endpoint + * @param ?string $realmName + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Keycloak + */ + public function updateOAuth2Keycloak(?string $clientId = null, ?string $clientSecret = null, ?string $endpoint = null, ?string $realmName = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Keycloak + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/keycloak' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $apiParams['endpoint'] = $endpoint; + $apiParams['realmName'] = $realmName; + $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\OAuth2Keycloak::from($response); + + } + + /** + * Update the project OAuth2 Kick configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Kick + */ + public function updateOAuth2Kick(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Kick + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/kick' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $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\OAuth2Kick::from($response); + + } + + /** + * Update the project OAuth2 Linkedin configuration. + * + * @param ?string $clientId + * @param ?string $primaryClientSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Linkedin + */ + public function updateOAuth2Linkedin(?string $clientId = null, ?string $primaryClientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Linkedin + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/linkedin' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['primaryClientSecret'] = $primaryClientSecret; + $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\OAuth2Linkedin::from($response); + + } + + /** + * Update the project OAuth2 Microsoft configuration. + * + * @param ?string $applicationId + * @param ?string $applicationSecret + * @param ?string $tenant + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Microsoft + */ + public function updateOAuth2Microsoft(?string $applicationId = null, ?string $applicationSecret = null, ?string $tenant = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Microsoft + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/microsoft' + ); + + $apiParams = []; + $apiParams['applicationId'] = $applicationId; + $apiParams['applicationSecret'] = $applicationSecret; + $apiParams['tenant'] = $tenant; + $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\OAuth2Microsoft::from($response); + + } + + /** + * Update the project OAuth2 Notion configuration. + * + * @param ?string $oauthClientId + * @param ?string $oauthClientSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Notion + */ + public function updateOAuth2Notion(?string $oauthClientId = null, ?string $oauthClientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Notion + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/notion' + ); + + $apiParams = []; + $apiParams['oauthClientId'] = $oauthClientId; + $apiParams['oauthClientSecret'] = $oauthClientSecret; + $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\OAuth2Notion::from($response); + + } + + /** + * Update the project OAuth2 Oidc configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?string $wellKnownURL + * @param ?string $authorizationURL + * @param ?string $tokenURL + * @param ?string $userInfoURL + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Oidc + */ + public function updateOAuth2Oidc(?string $clientId = null, ?string $clientSecret = null, ?string $wellKnownURL = null, ?string $authorizationURL = null, ?string $tokenURL = null, ?string $userInfoURL = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Oidc + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/oidc' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $apiParams['wellKnownURL'] = $wellKnownURL; + $apiParams['authorizationURL'] = $authorizationURL; + $apiParams['tokenURL'] = $tokenURL; + $apiParams['userInfoURL'] = $userInfoURL; + $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\OAuth2Oidc::from($response); + + } + + /** + * Update the project OAuth2 Okta configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?string $domain + * @param ?string $authorizationServerId + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Okta + */ + public function updateOAuth2Okta(?string $clientId = null, ?string $clientSecret = null, ?string $domain = null, ?string $authorizationServerId = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Okta + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/okta' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $apiParams['domain'] = $domain; + $apiParams['authorizationServerId'] = $authorizationServerId; + $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\OAuth2Okta::from($response); + + } + + /** + * Update the project OAuth2 Paypal configuration. + * + * @param ?string $clientId + * @param ?string $secretKey + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Paypal + */ + public function updateOAuth2Paypal(?string $clientId = null, ?string $secretKey = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Paypal + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/paypal' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['secretKey'] = $secretKey; + $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\OAuth2Paypal::from($response); + + } + + /** + * Update the project OAuth2 PaypalSandbox configuration. + * + * @param ?string $clientId + * @param ?string $secretKey + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Paypal + */ + public function updateOAuth2PaypalSandbox(?string $clientId = null, ?string $secretKey = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Paypal + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/paypalSandbox' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['secretKey'] = $secretKey; + $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\OAuth2Paypal::from($response); + + } + + /** + * Update the project OAuth2 Podio configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Podio + */ + public function updateOAuth2Podio(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Podio + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/podio' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $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\OAuth2Podio::from($response); + + } + + /** + * Update the project OAuth2 Salesforce configuration. + * + * @param ?string $customerKey + * @param ?string $customerSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Salesforce + */ + public function updateOAuth2Salesforce(?string $customerKey = null, ?string $customerSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Salesforce + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/salesforce' + ); + + $apiParams = []; + $apiParams['customerKey'] = $customerKey; + $apiParams['customerSecret'] = $customerSecret; + $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\OAuth2Salesforce::from($response); + + } + + /** + * Update the project OAuth2 Slack configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Slack + */ + public function updateOAuth2Slack(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Slack + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/slack' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $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\OAuth2Slack::from($response); + + } + + /** + * Update the project OAuth2 Spotify configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Spotify + */ + public function updateOAuth2Spotify(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Spotify + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/spotify' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $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\OAuth2Spotify::from($response); + + } + + /** + * Update the project OAuth2 Stripe configuration. + * + * @param ?string $clientId + * @param ?string $apiSecretKey + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Stripe + */ + public function updateOAuth2Stripe(?string $clientId = null, ?string $apiSecretKey = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Stripe + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/stripe' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['apiSecretKey'] = $apiSecretKey; + $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\OAuth2Stripe::from($response); + + } + + /** + * Update the project OAuth2 Tradeshift configuration. + * + * @param ?string $oauth2ClientId + * @param ?string $oauth2ClientSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Tradeshift + */ + public function updateOAuth2Tradeshift(?string $oauth2ClientId = null, ?string $oauth2ClientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Tradeshift + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/tradeshift' + ); + + $apiParams = []; + $apiParams['oauth2ClientId'] = $oauth2ClientId; + $apiParams['oauth2ClientSecret'] = $oauth2ClientSecret; + $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\OAuth2Tradeshift::from($response); + + } + + /** + * Update the project OAuth2 Tradeshift Sandbox configuration. + * + * @param ?string $oauth2ClientId + * @param ?string $oauth2ClientSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Tradeshift + */ + public function updateOAuth2TradeshiftSandbox(?string $oauth2ClientId = null, ?string $oauth2ClientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Tradeshift + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/tradeshiftBox' + ); + + $apiParams = []; + $apiParams['oauth2ClientId'] = $oauth2ClientId; + $apiParams['oauth2ClientSecret'] = $oauth2ClientSecret; + $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\OAuth2Tradeshift::from($response); + + } + + /** + * Update the project OAuth2 Twitch configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Twitch + */ + public function updateOAuth2Twitch(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Twitch + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/twitch' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $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\OAuth2Twitch::from($response); + + } + + /** + * Update the project OAuth2 WordPress configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2WordPress + */ + public function updateOAuth2WordPress(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2WordPress + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/wordpress' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $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\OAuth2WordPress::from($response); + + } + + /** + * Update the project OAuth2 X configuration. + * + * @param ?string $customerKey + * @param ?string $secretKey + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2X + */ + public function updateOAuth2X(?string $customerKey = null, ?string $secretKey = null, ?bool $enabled = null): \Appwrite\Models\OAuth2X + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/x' + ); + + $apiParams = []; + $apiParams['customerKey'] = $customerKey; + $apiParams['secretKey'] = $secretKey; + $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\OAuth2X::from($response); + + } + + /** + * Update the project OAuth2 Yahoo configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Yahoo + */ + public function updateOAuth2Yahoo(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Yahoo + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/yahoo' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $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\OAuth2Yahoo::from($response); + + } + + /** + * Update the project OAuth2 Yandex configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Yandex + */ + public function updateOAuth2Yandex(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Yandex + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/yandex' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $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\OAuth2Yandex::from($response); + + } + + /** + * Update the project OAuth2 Zoho configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Zoho + */ + public function updateOAuth2Zoho(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Zoho + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/zoho' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $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\OAuth2Zoho::from($response); + + } + + /** + * Update the project OAuth2 Zoom configuration. + * + * @param ?string $clientId + * @param ?string $clientSecret + * @param ?bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\OAuth2Zoom + */ + public function updateOAuth2Zoom(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Zoom + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/zoom' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $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\OAuth2Zoom::from($response); + + } + + /** + * Get a list of all platforms in the project. This endpoint returns an array + * of all platforms and their configurations. + * + * @param ?array $queries + * @param ?bool $total + * @throws AppwriteException + * @return \Appwrite\Models\PlatformList + */ + public function listPlatforms(?array $queries = null, ?bool $total = null): \Appwrite\Models\PlatformList + { + $apiPath = str_replace( + [], + [], + '/project/platforms' + ); + + $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\PlatformList::from($response); + + } + + /** + * Create a new Android platform for your project. Use this endpoint to + * register a new Android platform where your users will run your application + * which will interact with the Appwrite API. + * + * @param string $platformId + * @param string $name + * @param string $applicationId + * @throws AppwriteException + * @return \Appwrite\Models\PlatformAndroid + */ + public function createAndroidPlatform(string $platformId, string $name, string $applicationId): \Appwrite\Models\PlatformAndroid + { + $apiPath = str_replace( + [], + [], + '/project/platforms/android' + ); + + $apiParams = []; + $apiParams['platformId'] = $platformId; + $apiParams['name'] = $name; + $apiParams['applicationId'] = $applicationId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\PlatformAndroid::from($response); + + } + + /** + * Update an Android platform by its unique ID. Use this endpoint to update + * the platform's name or application ID. + * + * @param string $platformId + * @param string $name + * @param string $applicationId + * @throws AppwriteException + * @return \Appwrite\Models\PlatformAndroid + */ + public function updateAndroidPlatform(string $platformId, string $name, string $applicationId): \Appwrite\Models\PlatformAndroid + { + $apiPath = str_replace( + ['{platformId}'], + [$platformId], + '/project/platforms/android/{platformId}' + ); + + $apiParams = []; + $apiParams['platformId'] = $platformId; + $apiParams['name'] = $name; + $apiParams['applicationId'] = $applicationId; + + $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\PlatformAndroid::from($response); + + } + + /** + * Create a new Apple platform for your project. Use this endpoint to register + * a new Apple platform where your users will run your application which will + * interact with the Appwrite API. + * + * @param string $platformId + * @param string $name + * @param string $bundleIdentifier + * @throws AppwriteException + * @return \Appwrite\Models\PlatformApple + */ + public function createApplePlatform(string $platformId, string $name, string $bundleIdentifier): \Appwrite\Models\PlatformApple + { + $apiPath = str_replace( + [], + [], + '/project/platforms/apple' + ); + + $apiParams = []; + $apiParams['platformId'] = $platformId; + $apiParams['name'] = $name; + $apiParams['bundleIdentifier'] = $bundleIdentifier; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\PlatformApple::from($response); + + } + + /** + * Update an Apple platform by its unique ID. Use this endpoint to update the + * platform's name or bundle identifier. + * + * @param string $platformId + * @param string $name + * @param string $bundleIdentifier + * @throws AppwriteException + * @return \Appwrite\Models\PlatformApple + */ + public function updateApplePlatform(string $platformId, string $name, string $bundleIdentifier): \Appwrite\Models\PlatformApple + { + $apiPath = str_replace( + ['{platformId}'], + [$platformId], + '/project/platforms/apple/{platformId}' + ); + + $apiParams = []; + $apiParams['platformId'] = $platformId; + $apiParams['name'] = $name; + $apiParams['bundleIdentifier'] = $bundleIdentifier; + + $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\PlatformApple::from($response); + + } + + /** + * Create a new Linux platform for your project. Use this endpoint to register + * a new Linux platform where your users will run your application which will + * interact with the Appwrite API. + * + * @param string $platformId + * @param string $name + * @param string $packageName + * @throws AppwriteException + * @return \Appwrite\Models\PlatformLinux + */ + public function createLinuxPlatform(string $platformId, string $name, string $packageName): \Appwrite\Models\PlatformLinux + { + $apiPath = str_replace( + [], + [], + '/project/platforms/linux' + ); + + $apiParams = []; + $apiParams['platformId'] = $platformId; + $apiParams['name'] = $name; + $apiParams['packageName'] = $packageName; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\PlatformLinux::from($response); + + } + + /** + * Update a Linux platform by its unique ID. Use this endpoint to update the + * platform's name or package name. + * + * @param string $platformId + * @param string $name + * @param string $packageName + * @throws AppwriteException + * @return \Appwrite\Models\PlatformLinux + */ + public function updateLinuxPlatform(string $platformId, string $name, string $packageName): \Appwrite\Models\PlatformLinux + { + $apiPath = str_replace( + ['{platformId}'], + [$platformId], + '/project/platforms/linux/{platformId}' + ); + + $apiParams = []; + $apiParams['platformId'] = $platformId; + $apiParams['name'] = $name; + $apiParams['packageName'] = $packageName; + + $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\PlatformLinux::from($response); + + } + + /** + * Create a new web platform for your project. Use this endpoint to register a + * new platform where your users will run your application which will interact + * with the Appwrite API. + * + * @param string $platformId + * @param string $name + * @param string $hostname + * @throws AppwriteException + * @return \Appwrite\Models\PlatformWeb + */ + public function createWebPlatform(string $platformId, string $name, string $hostname): \Appwrite\Models\PlatformWeb + { + $apiPath = str_replace( + [], + [], + '/project/platforms/web' + ); + + $apiParams = []; + $apiParams['platformId'] = $platformId; + $apiParams['name'] = $name; + $apiParams['hostname'] = $hostname; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\PlatformWeb::from($response); + + } + + /** + * Update a web platform by its unique ID. Use this endpoint to update the + * platform's name or hostname. + * * @param string $platformId * @param string $name * @param string $hostname * @throws AppwriteException - * @return \Appwrite\Models\PlatformWeb + * @return \Appwrite\Models\PlatformWeb + */ + public function updateWebPlatform(string $platformId, string $name, string $hostname): \Appwrite\Models\PlatformWeb + { + $apiPath = str_replace( + ['{platformId}'], + [$platformId], + '/project/platforms/web/{platformId}' + ); + + $apiParams = []; + $apiParams['platformId'] = $platformId; + $apiParams['name'] = $name; + $apiParams['hostname'] = $hostname; + + $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\PlatformWeb::from($response); + + } + + /** + * Create a new Windows platform for your project. Use this endpoint to + * register a new Windows platform where your users will run your application + * which will interact with the Appwrite API. + * + * @param string $platformId + * @param string $name + * @param string $packageIdentifierName + * @throws AppwriteException + * @return \Appwrite\Models\PlatformWindows + */ + public function createWindowsPlatform(string $platformId, string $name, string $packageIdentifierName): \Appwrite\Models\PlatformWindows + { + $apiPath = str_replace( + [], + [], + '/project/platforms/windows' + ); + + $apiParams = []; + $apiParams['platformId'] = $platformId; + $apiParams['name'] = $name; + $apiParams['packageIdentifierName'] = $packageIdentifierName; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\PlatformWindows::from($response); + + } + + /** + * Update a Windows platform by its unique ID. Use this endpoint to update the + * platform's name or package identifier name. + * + * @param string $platformId + * @param string $name + * @param string $packageIdentifierName + * @throws AppwriteException + * @return \Appwrite\Models\PlatformWindows + */ + public function updateWindowsPlatform(string $platformId, string $name, string $packageIdentifierName): \Appwrite\Models\PlatformWindows + { + $apiPath = str_replace( + ['{platformId}'], + [$platformId], + '/project/platforms/windows/{platformId}' + ); + + $apiParams = []; + $apiParams['platformId'] = $platformId; + $apiParams['name'] = $name; + $apiParams['packageIdentifierName'] = $packageIdentifierName; + + $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\PlatformWindows::from($response); + + } + + /** + * Get a platform by its unique ID. This endpoint returns the platform's + * details, including its name, type, and key configurations. + * + * @param string $platformId + * @throws AppwriteException + * @return \Appwrite\Models\PlatformWeb|\Appwrite\Models\PlatformApple|\Appwrite\Models\PlatformAndroid|\Appwrite\Models\PlatformWindows|\Appwrite\Models\PlatformLinux + */ + public function getPlatform(string $platformId): \Appwrite\Models\PlatformWeb|\Appwrite\Models\PlatformApple|\Appwrite\Models\PlatformAndroid|\Appwrite\Models\PlatformWindows|\Appwrite\Models\PlatformLinux + { + $apiPath = str_replace( + ['{platformId}'], + [$platformId], + '/project/platforms/{platformId}' + ); + + $apiParams = []; + $apiParams['platformId'] = $platformId; + + $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.'); + } + + if (($response['type'] ?? null) === 'web') { + return \Appwrite\Models\PlatformWeb::from($response); + } + + if (($response['type'] ?? null) === 'apple') { + return \Appwrite\Models\PlatformApple::from($response); + } + + if (($response['type'] ?? null) === 'android') { + return \Appwrite\Models\PlatformAndroid::from($response); + } + + if (($response['type'] ?? null) === 'windows') { + return \Appwrite\Models\PlatformWindows::from($response); + } + + if (($response['type'] ?? null) === 'linux') { + return \Appwrite\Models\PlatformLinux::from($response); + } + + throw new \UnexpectedValueException('Unable to match response to any expected response model.'); + + } + + /** + * Delete a platform by its unique ID. This endpoint removes the platform and + * all its configurations from the project. + * + * @param string $platformId + * @throws AppwriteException + * @return string + */ + public function deletePlatform(string $platformId): string + { + $apiPath = str_replace( + ['{platformId}'], + [$platformId], + '/project/platforms/{platformId}' + ); + + $apiParams = []; + $apiParams['platformId'] = $platformId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + + return $response; + + } + + /** + * Get a list of all project policies and their current configuration. + * + * @param ?array $queries + * @param ?bool $total + * @throws AppwriteException + * @return \Appwrite\Models\PolicyList + */ + public function listPolicies(?array $queries = null, ?bool $total = null): \Appwrite\Models\PolicyList + { + $apiPath = str_replace( + [], + [], + '/project/policies' + ); + + $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\PolicyList::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, + * email, phone number, and MFA status of other members.. + * + * @param ?bool $userId + * @param ?bool $userEmail + * @param ?bool $userPhone + * @param ?bool $userName + * @param ?bool $userMFA + * @throws AppwriteException + * @return \Appwrite\Models\Project + */ + public function updateMembershipPrivacyPolicy(?bool $userId = null, ?bool $userEmail = null, ?bool $userPhone = null, ?bool $userName = null, ?bool $userMFA = null): \Appwrite\Models\Project + { + $apiPath = str_replace( + [], + [], + '/project/policies/membership-privacy' + ); + + $apiParams = []; + + if (!is_null($userId)) { + $apiParams['userId'] = $userId; + } + + if (!is_null($userEmail)) { + $apiParams['userEmail'] = $userEmail; + } + + if (!is_null($userPhone)) { + $apiParams['userPhone'] = $userPhone; + } + + if (!is_null($userName)) { + $apiParams['userName'] = $userName; + } + + if (!is_null($userMFA)) { + $apiParams['userMFA'] = $userMFA; + } + + $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 new passwords are checked + * against most common passwords dictionary. When enabled, and user changes + * their password, password must not be contained in the dictionary. + * + * @param bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\Project + */ + public function updatePasswordDictionaryPolicy(bool $enabled): \Appwrite\Models\Project + { + $apiPath = str_replace( + [], + [], + '/project/policies/password-dictionary' + ); + + $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); + + } + + /** + * Updates one of password strength policies. Based on total length + * configured, previous password hashes are stored, and users cannot choose a + * new password that is already stored in the passwird history list, when + * updating an user password, or setting new one through password recovery. + * + * Keep in mind, while password history policy is disabled, the history is not + * being stored. Enabling the policy will not have any history on existing + * users, and it will only start to collect and enforce the policy on password + * changes since the policy is enabled. + * + * @param ?int $total + * @throws AppwriteException + * @return \Appwrite\Models\Project + */ + public function updatePasswordHistoryPolicy(?int $total): \Appwrite\Models\Project + { + $apiPath = str_replace( + [], + [], + '/project/policies/password-history' + ); + + $apiParams = []; + $apiParams['total'] = $total; + + $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 password strength is checked + * against personal data. When enabled, and user sets or changes their + * password, the password must not contain user ID, name, email or phone + * number. + * + * @param bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\Project + */ + public function updatePasswordPersonalDataPolicy(bool $enabled): \Appwrite\Models\Project + { + $apiPath = str_replace( + [], + [], + '/project/policies/password-personal-data' + ); + + $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 email alert is sent upon + * session creation. When enabled, and user signs into their account, they + * will be sent an email notification. There is an exception, the first + * session after a new sign up does not trigger an alert, even if the policy + * is enabled. + * + * @param bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\Project + */ + public function updateSessionAlertPolicy(bool $enabled): \Appwrite\Models\Project + { + $apiPath = str_replace( + [], + [], + '/project/policies/session-alert' + ); + + $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); + + } + + /** + * Update maximum duration how long sessions created within a project should + * stay active for. + * + * @param int $duration + * @throws AppwriteException + * @return \Appwrite\Models\Project + */ + public function updateSessionDurationPolicy(int $duration): \Appwrite\Models\Project + { + $apiPath = str_replace( + [], + [], + '/project/policies/session-duration' + ); + + $apiParams = []; + $apiParams['duration'] = $duration; + + $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 existing sessions should be + * invalidated when a password of a user is changed. When enabled, and user + * changes their password, they will be logged out of all their devices. + * + * @param bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\Project */ - public function updateWebPlatform(string $platformId, string $name, string $hostname): \Appwrite\Models\PlatformWeb + public function updateSessionInvalidationPolicy(bool $enabled): \Appwrite\Models\Project { $apiPath = str_replace( - ['{platformId}'], - [$platformId], - '/project/platforms/web/{platformId}' + [], + [], + '/project/policies/session-invalidation' ); $apiParams = []; - $apiParams['platformId'] = $platformId; - $apiParams['name'] = $name; - $apiParams['hostname'] = $hostname; + $apiParams['enabled'] = $enabled; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; $response = $this->client->call( - Client::METHOD_PUT, + Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams @@ -623,39 +3397,34 @@ public function updateWebPlatform(string $platformId, string $name, string $host throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); } - return \Appwrite\Models\PlatformWeb::from($response); + return \Appwrite\Models\Project::from($response); } /** - * Create a new Windows platform for your project. Use this endpoint to - * register a new Windows platform where your users will run your application - * which will interact with the Appwrite API. + * Update the maximum number of sessions allowed per user. When the limit is + * hit, the oldest session will be deleted to make room for new one. * - * @param string $platformId - * @param string $name - * @param string $packageIdentifierName + * @param ?int $total * @throws AppwriteException - * @return \Appwrite\Models\PlatformWindows + * @return \Appwrite\Models\Project */ - public function createWindowsPlatform(string $platformId, string $name, string $packageIdentifierName): \Appwrite\Models\PlatformWindows + public function updateSessionLimitPolicy(?int $total): \Appwrite\Models\Project { $apiPath = str_replace( [], [], - '/project/platforms/windows' + '/project/policies/session-limit' ); $apiParams = []; - $apiParams['platformId'] = $platformId; - $apiParams['name'] = $name; - $apiParams['packageIdentifierName'] = $packageIdentifierName; + $apiParams['total'] = $total; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; $response = $this->client->call( - Client::METHOD_POST, + Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams @@ -665,38 +3434,35 @@ public function createWindowsPlatform(string $platformId, string $name, string $ throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); } - return \Appwrite\Models\PlatformWindows::from($response); + return \Appwrite\Models\Project::from($response); } /** - * Update a Windows platform by its unique ID. Use this endpoint to update the - * platform's name or package identifier name. + * Update the maximum number of users in the project. When the limit is hit or + * amount of existing users already exceeded the limit, all users remain + * active, but new user sign up will be prohibited. * - * @param string $platformId - * @param string $name - * @param string $packageIdentifierName + * @param ?int $total * @throws AppwriteException - * @return \Appwrite\Models\PlatformWindows + * @return \Appwrite\Models\Project */ - public function updateWindowsPlatform(string $platformId, string $name, string $packageIdentifierName): \Appwrite\Models\PlatformWindows + public function updateUserLimitPolicy(?int $total): \Appwrite\Models\Project { $apiPath = str_replace( - ['{platformId}'], - [$platformId], - '/project/platforms/windows/{platformId}' + [], + [], + '/project/policies/user-limit' ); $apiParams = []; - $apiParams['platformId'] = $platformId; - $apiParams['name'] = $name; - $apiParams['packageIdentifierName'] = $packageIdentifierName; + $apiParams['total'] = $total; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; $response = $this->client->call( - Client::METHOD_PUT, + Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams @@ -706,28 +3472,28 @@ public function updateWindowsPlatform(string $platformId, string $name, string $ throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); } - return \Appwrite\Models\PlatformWindows::from($response); + return \Appwrite\Models\Project::from($response); } /** - * Get a platform by its unique ID. This endpoint returns the platform's - * details, including its name, type, and key configurations. + * Get a policy by its unique ID. This endpoint returns the current + * configuration for the requested project policy. * - * @param string $platformId + * @param PolicyId $policyId * @throws AppwriteException - * @return \Appwrite\Models\PlatformWeb|\Appwrite\Models\PlatformApple|\Appwrite\Models\PlatformAndroid|\Appwrite\Models\PlatformWindows|\Appwrite\Models\PlatformLinux + * @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 getPlatform(string $platformId): \Appwrite\Models\PlatformWeb|\Appwrite\Models\PlatformApple|\Appwrite\Models\PlatformAndroid|\Appwrite\Models\PlatformWindows|\Appwrite\Models\PlatformLinux + public function getPolicy(PolicyId $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( - ['{platformId}'], - [$platformId], - '/project/platforms/{platformId}' + ['{policyId}'], + [$policyId], + '/project/policies/{policyId}' ); $apiParams = []; - $apiParams['platformId'] = $platformId; + $apiParams['policyId'] = $policyId; $apiHeaders = []; @@ -742,24 +3508,40 @@ public function getPlatform(string $platformId): \Appwrite\Models\PlatformWeb|\A throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); } - if (($response['type'] ?? null) === 'web') { - return \Appwrite\Models\PlatformWeb::from($response); + if (($response['$id'] ?? null) === 'password-dictionary') { + return \Appwrite\Models\PolicyPasswordDictionary::from($response); } - if (($response['type'] ?? null) === 'apple') { - return \Appwrite\Models\PlatformApple::from($response); + if (($response['$id'] ?? null) === 'password-history') { + return \Appwrite\Models\PolicyPasswordHistory::from($response); } - if (($response['type'] ?? null) === 'android') { - return \Appwrite\Models\PlatformAndroid::from($response); + if (($response['$id'] ?? null) === 'password-personal-data') { + return \Appwrite\Models\PolicyPasswordPersonalData::from($response); } - if (($response['type'] ?? null) === 'windows') { - return \Appwrite\Models\PlatformWindows::from($response); + if (($response['$id'] ?? null) === 'session-alert') { + return \Appwrite\Models\PolicySessionAlert::from($response); } - if (($response['type'] ?? null) === 'linux') { - return \Appwrite\Models\PlatformLinux::from($response); + if (($response['$id'] ?? null) === 'session-duration') { + return \Appwrite\Models\PolicySessionDuration::from($response); + } + + if (($response['$id'] ?? null) === 'session-invalidation') { + return \Appwrite\Models\PolicySessionInvalidation::from($response); + } + + if (($response['$id'] ?? null) === 'session-limit') { + return \Appwrite\Models\PolicySessionLimit::from($response); + } + + if (($response['$id'] ?? null) === 'user-limit') { + return \Appwrite\Models\PolicyUserLimit::from($response); + } + + if (($response['$id'] ?? null) === 'membership-privacy') { + return \Appwrite\Models\PolicyMembershipPrivacy::from($response); } throw new \UnexpectedValueException('Unable to match response to any expected response model.'); @@ -767,57 +3549,63 @@ public function getPlatform(string $platformId): \Appwrite\Models\PlatformWeb|\A } /** - * Delete a platform by its unique ID. This endpoint removes the platform and - * all its configurations from the project. + * Update properties of a specific protocol. Use this endpoint to enable or + * disable a protocol in your project. * - * @param string $platformId + * @param ProtocolId $protocolId + * @param bool $enabled * @throws AppwriteException - * @return string + * @return \Appwrite\Models\Project */ - public function deletePlatform(string $platformId): string + public function updateProtocol(ProtocolId $protocolId, bool $enabled): \Appwrite\Models\Project { $apiPath = str_replace( - ['{platformId}'], - [$platformId], - '/project/platforms/{platformId}' + ['{protocolId}'], + [$protocolId], + '/project/protocols/{protocolId}' ); $apiParams = []; - $apiParams['platformId'] = $platformId; + $apiParams['protocolId'] = $protocolId; + $apiParams['enabled'] = $enabled; $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; $response = $this->client->call( - Client::METHOD_DELETE, + Client::METHOD_PATCH, $apiPath, $apiHeaders, $apiParams ); - return $response; + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Project::from($response); } /** - * Update the status of a specific protocol. Use this endpoint to enable or - * disable a protocol in your project. + * Update properties of a specific service. Use this endpoint to enable or + * disable a service in your project. * - * @param ProtocolId $protocolId + * @param ServiceId $serviceId * @param bool $enabled * @throws AppwriteException * @return \Appwrite\Models\Project */ - public function updateProtocolStatus(ProtocolId $protocolId, bool $enabled): \Appwrite\Models\Project + public function updateService(ServiceId $serviceId, bool $enabled): \Appwrite\Models\Project { $apiPath = str_replace( - ['{protocolId}'], - [$protocolId], - '/project/protocols/{protocolId}/status' + ['{serviceId}'], + [$serviceId], + '/project/services/{serviceId}' ); $apiParams = []; - $apiParams['protocolId'] = $protocolId; + $apiParams['serviceId'] = $serviceId; $apiParams['enabled'] = $enabled; $apiHeaders = []; @@ -839,24 +3627,41 @@ public function updateProtocolStatus(ProtocolId $protocolId, bool $enabled): \Ap } /** - * Update the status of a specific service. Use this endpoint to enable or - * disable a service in your project. + * Update the SMTP configuration for your project. Use this endpoint to + * configure your project's SMTP provider with your custom settings for + * sending transactional emails. * - * @param ServiceId $serviceId - * @param bool $enabled + * @param ?string $host + * @param ?int $port + * @param ?string $username + * @param ?string $password + * @param ?string $senderEmail + * @param ?string $senderName + * @param ?string $replyToEmail + * @param ?string $replyToName + * @param ?Secure $secure + * @param ?bool $enabled * @throws AppwriteException * @return \Appwrite\Models\Project */ - public function updateServiceStatus(ServiceId $serviceId, bool $enabled): \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 { $apiPath = str_replace( - ['{serviceId}'], - [$serviceId], - '/project/services/{serviceId}/status' + [], + [], + '/project/smtp' ); $apiParams = []; - $apiParams['serviceId'] = $serviceId; + $apiParams['host'] = $host; + $apiParams['port'] = $port; + $apiParams['username'] = $username; + $apiParams['password'] = $password; + $apiParams['senderEmail'] = $senderEmail; + $apiParams['senderName'] = $senderName; + $apiParams['replyToEmail'] = $replyToEmail; + $apiParams['replyToName'] = $replyToName; + $apiParams['secure'] = $secure; $apiParams['enabled'] = $enabled; $apiHeaders = []; @@ -877,6 +3682,179 @@ public function updateServiceStatus(ServiceId $serviceId, bool $enabled): \Appwr } + /** + * Send a test email to verify SMTP configuration. + * + * @param array $emails + * @throws AppwriteException + * @return string + */ + public function createSMTPTest(array $emails): string + { + $apiPath = str_replace( + [], + [], + '/project/smtp/tests' + ); + + $apiParams = []; + $apiParams['emails'] = $emails; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + return $response; + + } + + /** + * Get a list of all custom email templates configured for the project. This + * endpoint returns an array of all configured email templates and their + * locales. + * + * @param ?array $queries + * @param ?bool $total + * @throws AppwriteException + * @return \Appwrite\Models\EmailTemplateList + */ + public function listEmailTemplates(?array $queries = null, ?bool $total = null): \Appwrite\Models\EmailTemplateList + { + $apiPath = str_replace( + [], + [], + '/project/templates/email' + ); + + $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\EmailTemplateList::from($response); + + } + + /** + * 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 ?string $subject + * @param ?string $message + * @param ?string $senderName + * @param ?string $senderEmail + * @param ?string $replyToEmail + * @param ?string $replyToName + * @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 + { + $apiPath = str_replace( + [], + [], + '/project/templates/email' + ); + + $apiParams = []; + $apiParams['templateId'] = $templateId; + + if (!is_null($locale)) { + $apiParams['locale'] = $locale; + } + $apiParams['subject'] = $subject; + $apiParams['message'] = $message; + $apiParams['senderName'] = $senderName; + $apiParams['senderEmail'] = $senderEmail; + $apiParams['replyToEmail'] = $replyToEmail; + $apiParams['replyToName'] = $replyToName; + + $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\EmailTemplate::from($response); + + } + + /** + * Get a custom email template for the specified locale and type. This + * endpoint returns the template content, subject, and other configuration + * details. + * + * @param EmailTemplateType $templateId + * @param ?EmailTemplateLocale $locale + * @throws AppwriteException + * @return \Appwrite\Models\EmailTemplate + */ + public function getEmailTemplate(EmailTemplateType $templateId, ?EmailTemplateLocale $locale = null): \Appwrite\Models\EmailTemplate + { + $apiPath = str_replace( + ['{templateId}'], + [$templateId], + '/project/templates/email/{templateId}' + ); + + $apiParams = []; + $apiParams['templateId'] = $templateId; + + if (!is_null($locale)) { + $apiParams['locale'] = $locale; + } + + $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\EmailTemplate::from($response); + + } + /** * Get a list of all project environment variables. * diff --git a/src/Appwrite/Services/Proxy.php b/src/Appwrite/Services/Proxy.php new file mode 100644 index 00000000..282e8275 --- /dev/null +++ b/src/Appwrite/Services/Proxy.php @@ -0,0 +1,347 @@ +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\ProxyRuleList::from($response); + + } + + /** + * Create a new proxy rule for serving Appwrite's API on custom domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for + * performance purposes. + * + * @param string $domain + * @throws AppwriteException + * @return \Appwrite\Models\ProxyRule + */ + public function createAPIRule(string $domain): \Appwrite\Models\ProxyRule + { + $apiPath = str_replace( + [], + [], + '/proxy/rules/api' + ); + + $apiParams = []; + $apiParams['domain'] = $domain; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\ProxyRule::from($response); + + } + + /** + * Create a new proxy rule for executing Appwrite Function on custom domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for + * performance purposes. + * + * @param string $domain + * @param string $functionId + * @param ?string $branch + * @throws AppwriteException + * @return \Appwrite\Models\ProxyRule + */ + public function createFunctionRule(string $domain, string $functionId, ?string $branch = null): \Appwrite\Models\ProxyRule + { + $apiPath = str_replace( + [], + [], + '/proxy/rules/function' + ); + + $apiParams = []; + $apiParams['domain'] = $domain; + $apiParams['functionId'] = $functionId; + + if (!is_null($branch)) { + $apiParams['branch'] = $branch; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\ProxyRule::from($response); + + } + + /** + * Create a new proxy rule for to redirect from custom domain to another + * domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for + * performance purposes. + * + * @param string $domain + * @param string $url + * @param StatusCode $statusCode + * @param string $resourceId + * @param ProxyResourceType $resourceType + * @throws AppwriteException + * @return \Appwrite\Models\ProxyRule + */ + public function createRedirectRule(string $domain, string $url, StatusCode $statusCode, string $resourceId, ProxyResourceType $resourceType): \Appwrite\Models\ProxyRule + { + $apiPath = str_replace( + [], + [], + '/proxy/rules/redirect' + ); + + $apiParams = []; + $apiParams['domain'] = $domain; + $apiParams['url'] = $url; + $apiParams['statusCode'] = $statusCode; + $apiParams['resourceId'] = $resourceId; + $apiParams['resourceType'] = $resourceType; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\ProxyRule::from($response); + + } + + /** + * Create a new proxy rule for serving Appwrite Site on custom domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for + * performance purposes. + * + * @param string $domain + * @param string $siteId + * @param ?string $branch + * @throws AppwriteException + * @return \Appwrite\Models\ProxyRule + */ + public function createSiteRule(string $domain, string $siteId, ?string $branch = null): \Appwrite\Models\ProxyRule + { + $apiPath = str_replace( + [], + [], + '/proxy/rules/site' + ); + + $apiParams = []; + $apiParams['domain'] = $domain; + $apiParams['siteId'] = $siteId; + + if (!is_null($branch)) { + $apiParams['branch'] = $branch; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\ProxyRule::from($response); + + } + + /** + * Get a proxy rule by its unique ID. + * + * @param string $ruleId + * @throws AppwriteException + * @return \Appwrite\Models\ProxyRule + */ + public function getRule(string $ruleId): \Appwrite\Models\ProxyRule + { + $apiPath = str_replace( + ['{ruleId}'], + [$ruleId], + '/proxy/rules/{ruleId}' + ); + + $apiParams = []; + $apiParams['ruleId'] = $ruleId; + + $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\ProxyRule::from($response); + + } + + /** + * Delete a proxy rule by its unique ID. + * + * @param string $ruleId + * @throws AppwriteException + * @return string + */ + public function deleteRule(string $ruleId): string + { + $apiPath = str_replace( + ['{ruleId}'], + [$ruleId], + '/proxy/rules/{ruleId}' + ); + + $apiParams = []; + $apiParams['ruleId'] = $ruleId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + + return $response; + + } + + /** + * If not succeeded yet, retry verification process of a proxy rule domain. + * This endpoint triggers domain verification by checking DNS records. If + * verification is successful, a TLS certificate will be automatically + * provisioned for the domain asynchronously in the background. + * + * @param string $ruleId + * @throws AppwriteException + * @return \Appwrite\Models\ProxyRule + */ + public function updateRuleStatus(string $ruleId): \Appwrite\Models\ProxyRule + { + $apiPath = str_replace( + ['{ruleId}'], + [$ruleId], + '/proxy/rules/{ruleId}/status' + ); + + $apiParams = []; + $apiParams['ruleId'] = $ruleId; + + $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\ProxyRule::from($response); + + } +} diff --git a/src/Appwrite/Services/Sites.php b/src/Appwrite/Services/Sites.php index 6d784d16..660a1bbc 100644 --- a/src/Appwrite/Services/Sites.php +++ b/src/Appwrite/Services/Sites.php @@ -1100,10 +1100,12 @@ public function deleteLog(string $siteId, string $logId): string * Get a list of all variables of a specific site. * * @param string $siteId + * @param ?array $queries + * @param ?bool $total * @throws AppwriteException * @return \Appwrite\Models\VariableList */ - public function listVariables(string $siteId): \Appwrite\Models\VariableList + public function listVariables(string $siteId, ?array $queries = null, ?bool $total = null): \Appwrite\Models\VariableList { $apiPath = str_replace( ['{siteId}'], @@ -1114,6 +1116,14 @@ public function listVariables(string $siteId): \Appwrite\Models\VariableList $apiParams = []; $apiParams['siteId'] = $siteId; + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; $response = $this->client->call( @@ -1136,13 +1146,14 @@ public function listVariables(string $siteId): \Appwrite\Models\VariableList * and runtime (server-side rendering) as environment variables. * * @param string $siteId + * @param string $variableId * @param string $key * @param string $value * @param ?bool $secret * @throws AppwriteException * @return \Appwrite\Models\Variable */ - public function createVariable(string $siteId, string $key, string $value, ?bool $secret = null): \Appwrite\Models\Variable + public function createVariable(string $siteId, string $variableId, string $key, string $value, ?bool $secret = null): \Appwrite\Models\Variable { $apiPath = str_replace( ['{siteId}'], @@ -1152,6 +1163,7 @@ public function createVariable(string $siteId, string $key, string $value, ?bool $apiParams = []; $apiParams['siteId'] = $siteId; + $apiParams['variableId'] = $variableId; $apiParams['key'] = $key; $apiParams['value'] = $value; @@ -1219,13 +1231,13 @@ public function getVariable(string $siteId, string $variableId): \Appwrite\Model * * @param string $siteId * @param string $variableId - * @param string $key + * @param ?string $key * @param ?string $value * @param ?bool $secret * @throws AppwriteException * @return \Appwrite\Models\Variable */ - public function updateVariable(string $siteId, string $variableId, string $key, ?string $value = null, ?bool $secret = null): \Appwrite\Models\Variable + public function updateVariable(string $siteId, string $variableId, ?string $key = null, ?string $value = null, ?bool $secret = null): \Appwrite\Models\Variable { $apiPath = str_replace( ['{siteId}', '{variableId}'], diff --git a/src/Appwrite/Services/TablesDB.php b/src/Appwrite/Services/TablesDB.php index 55f7f679..491ecdf3 100644 --- a/src/Appwrite/Services/TablesDB.php +++ b/src/Appwrite/Services/TablesDB.php @@ -753,6 +753,113 @@ public function listColumns(string $databaseId, string $tableId, ?array $queries } + /** + * Create a bigint column. Optionally, minimum and maximum values can be + * provided. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?int $min + * @param ?int $max + * @param ?int $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return \Appwrite\Models\ColumnBigint + */ + public function createBigIntColumn(string $databaseId, string $tableId, string $key, bool $required, ?int $min = null, ?int $max = null, ?int $xdefault = null, ?bool $xarray = null): \Appwrite\Models\ColumnBigint + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['min'] = $min; + $apiParams['max'] = $max; + $apiParams['default'] = $xdefault; + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\ColumnBigint::from($response); + + } + + /** + * Update a bigint column. Changing the `default` value will not update + * already existing rows. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?int $xdefault + * @param ?int $min + * @param ?int $max + * @param ?string $newKey + * @throws AppwriteException + * @return \Appwrite\Models\ColumnBigint + */ + public function updateBigIntColumn(string $databaseId, string $tableId, string $key, bool $required, ?int $xdefault, ?int $min = null, ?int $max = null, ?string $newKey = null): \Appwrite\Models\ColumnBigint + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + $apiParams['min'] = $min; + $apiParams['max'] = $max; + $apiParams['newKey'] = $newKey; + + $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\ColumnBigint::from($response); + + } + /** * Create a boolean column. * diff --git a/tests/Appwrite/Services/DatabasesTest.php b/tests/Appwrite/Services/DatabasesTest.php index c3c281c4..caddb3ed 100644 --- a/tests/Appwrite/Services/DatabasesTest.php +++ b/tests/Appwrite/Services/DatabasesTest.php @@ -623,6 +623,59 @@ public function testMethodListAttributes(): void $this->assertInstanceOf(\Appwrite\Models\AttributeList::class, $response); } + public function testMethodCreateBigIntAttribute(): void + { + $data = array( + "key" => "count", + "type" => "bigint", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createBigIntAttribute( + "", + "", + "", + true + ); + + $this->assertInstanceOf(\Appwrite\Models\AttributeBigint::class, $response); + } + + public function testMethodUpdateBigIntAttribute(): void + { + $data = array( + "key" => "count", + "type" => "bigint", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updateBigIntAttribute( + "", + "", + "", + true, + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\AttributeBigint::class, $response); + } + public function testMethodCreateBooleanAttribute(): void { $data = array( diff --git a/tests/Appwrite/Services/FunctionsTest.php b/tests/Appwrite/Services/FunctionsTest.php index 988c1b69..6bfd281f 100644 --- a/tests/Appwrite/Services/FunctionsTest.php +++ b/tests/Appwrite/Services/FunctionsTest.php @@ -930,6 +930,7 @@ public function testMethodCreateVariable(): void $response = $this->functions->createVariable( "", + "", "", "" ); @@ -981,8 +982,7 @@ public function testMethodUpdateVariable(): void $response = $this->functions->updateVariable( "", - "", - "" + "" ); $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); diff --git a/tests/Appwrite/Services/PresencesTest.php b/tests/Appwrite/Services/PresencesTest.php new file mode 100644 index 00000000..b078caf4 --- /dev/null +++ b/tests/Appwrite/Services/PresencesTest.php @@ -0,0 +1,138 @@ +client = Mockery::mock(Client::class); + $this->presences = new Presences($this->client); + } + + public function testMethodList(): void + { + $data = array( + "total" => 5, + "presences" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "userInternalId" => "1", + "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", + "\$sequence" => "1", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "userInternalId" => "1", + "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", + "\$sequence" => "1", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "userInternalId" => "1", + "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", + "\$sequence" => "1", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "userInternalId" => "1", + "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 a14223be..60ff72e5 100644 --- a/tests/Appwrite/Services/ProjectTest.php +++ b/tests/Appwrite/Services/ProjectTest.php @@ -6,9 +6,15 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; +use Appwrite\Enums\MethodId; use Appwrite\Enums\Scopes; +use Appwrite\Enums\ProviderId; +use Appwrite\Enums\PolicyId; use Appwrite\Enums\ProtocolId; use Appwrite\Enums\ServiceId; +use Appwrite\Enums\Secure; +use Appwrite\Enums\EmailTemplateType; +use Appwrite\Enums\EmailTemplateLocale; final class ProjectTest extends TestCase { @@ -21,6 +27,191 @@ 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 + { + $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", + "\$createdAt" => "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", + "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, + "region" => "fra", + "billingLimits" => array( + "bandwidth" => 5, + "storage" => 150, + "users" => 200000, + "executions" => 750000, + "GBHours" => 100, + "imageTransformations" => 100, + "authPhone" => 10, + "budgetLimit" => 100 + ), + "blocks" => array( + array( + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "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->updateAuthMethod( + MethodId::EMAILPASSWORD(), + true + ); + + $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); + } + public function testMethodListKeys(): void { $data = array( @@ -70,12 +261,38 @@ public function testMethodCreateKey(): void $response = $this->project->createKey( "", "", - array(Scopes::SESSIONSWRITE()) + array(Scopes::PROJECTREAD()) ); $this->assertInstanceOf(\Appwrite\Models\Key::class, $response); } + public function testMethodCreateEphemeralKey(): void + { + $data = 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() + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->createEphemeralKey( + array(Scopes::PROJECTREAD()), + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\EphemeralKey::class, $response); + } + public function testMethodGetKey(): void { $data = array( @@ -122,7 +339,7 @@ public function testMethodUpdateKey(): void $response = $this->project->updateKey( "", "", - array(Scopes::SESSIONSWRITE()) + array(Scopes::PROJECTREAD()) ); $this->assertInstanceOf(\Appwrite\Models\Key::class, $response); @@ -171,21 +388,25 @@ public function testMethodUpdateLabels(): void "authFreeEmails" => true, "authMockNumbers" => array( array( - "phone" => "+1612842323", - "otp" => "123456" + "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" => "Bpw_g9c2TGXxfgLshDbSaL8tsCcqgczQ", + "secret" => "[SECRET]", "enabled" => true ) ), @@ -235,11 +456,12 @@ public function testMethodUpdateLabels(): void "smtpEnabled" => true, "smtpSenderName" => "John Appwrite", "smtpSenderEmail" => "john@appwrite.io", - "smtpReplyTo" => "support@appwrite.io", + "smtpReplyToName" => "Support Team", + "smtpReplyToEmail" => "support@appwrite.io", "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "securepassword", + "smtpPassword" => "[SMTPPASSWORD]", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -287,7 +509,12 @@ public function testMethodUpdateLabels(): void array( "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "resourceType" => "project", - "resourceId" => "5e5ea5c16897e" + "resourceId" => "5e5ea5c16897e", + "projectName" => "My Project", + "region" => "fra", + "organizationName" => "Acme Inc.", + "organizationId" => "5e5ea5c16897e", + "billingPlan" => "pro" ) ), "consoleAccessedAt" => "2020-10-15T06:38:00.000+00:00" @@ -304,275 +531,2783 @@ public function testMethodUpdateLabels(): void $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); } - public function testMethodListPlatforms(): void + public function testMethodListMockPhones(): void { $data = array( "total" => 5, - "platforms" => array() + "mockNumbers" => array( + array( + "number" => "+1612842323", + "otp" => "123456", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "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->listPlatforms(); + $response = $this->project->listMockPhones(); - $this->assertInstanceOf(\Appwrite\Models\PlatformList::class, $response); + $this->assertInstanceOf(\Appwrite\Models\MockNumberList::class, $response); } - public function testMethodCreateAndroidPlatform(): void + public function testMethodCreateMockPhone(): void { $data = array( - "\$id" => "5e5ea5c16897e", + "number" => "+1612842323", + "otp" => "123456", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Web App", - "type" => "windows", - "applicationId" => "com.company.appname" + "\$updatedAt" => "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->createAndroidPlatform( - "", - "", - "" + $response = $this->project->createMockPhone( + "+12065550100", + "" ); - $this->assertInstanceOf(\Appwrite\Models\PlatformAndroid::class, $response); + $this->assertInstanceOf(\Appwrite\Models\MockNumber::class, $response); } - public function testMethodUpdateAndroidPlatform(): void + public function testMethodGetMockPhone(): void { $data = array( - "\$id" => "5e5ea5c16897e", + "number" => "+1612842323", + "otp" => "123456", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Web App", - "type" => "windows", - "applicationId" => "com.company.appname" + "\$updatedAt" => "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->updateAndroidPlatform( - "", - "", - "" + $response = $this->project->getMockPhone( + "+12065550100" ); - $this->assertInstanceOf(\Appwrite\Models\PlatformAndroid::class, $response); + $this->assertInstanceOf(\Appwrite\Models\MockNumber::class, $response); } - public function testMethodCreateApplePlatform(): void + public function testMethodUpdateMockPhone(): void { $data = array( - "\$id" => "5e5ea5c16897e", + "number" => "+1612842323", + "otp" => "123456", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Web App", - "type" => "windows", - "bundleIdentifier" => "com.company.appname" + "\$updatedAt" => "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->createApplePlatform( - "", - "", - "" + $response = $this->project->updateMockPhone( + "+12065550100", + "" ); - $this->assertInstanceOf(\Appwrite\Models\PlatformApple::class, $response); + $this->assertInstanceOf(\Appwrite\Models\MockNumber::class, $response); } - public function testMethodUpdateApplePlatform(): void + public function testMethodDeleteMockPhone(): void { - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Web App", - "type" => "windows", - "bundleIdentifier" => "com.company.appname" - ); + $data = ''; $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->project->updateApplePlatform( - "", - "", - "" + $response = $this->project->deleteMockPhone( + "+12065550100" ); - $this->assertInstanceOf(\Appwrite\Models\PlatformApple::class, $response); + $this->assertSame($data, $response); } - public function testMethodCreateLinuxPlatform(): void + public function testMethodListOAuth2Providers(): void { $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Web App", - "type" => "windows", - "packageName" => "com.company.appname" + "total" => 5, + "providers" => array() ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->project->createLinuxPlatform( - "", - "", - "" + $response = $this->project->listOAuth2Providers(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2ProviderList::class, $response); + } + + public function testMethodGetOAuth2Provider(): void + { + $data = array_replace( + array( + "\$id" => "github", + "enabled" => true, + "applicationId" => "00001111-aaaa-2222-bbbb-3333cccc4444", + "applicationSecret" => "A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u", + "tenant" => "common" + ), + array( + "\$id" => "microsoft" + ) ); - $this->assertInstanceOf(\Appwrite\Models\PlatformLinux::class, $response); + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->getOAuth2Provider( + ProviderId::AMAZON() + ); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Microsoft::class, $response); } - public function testMethodUpdateLinuxPlatform(): void + public function testMethodUpdateOAuth2Amazon(): void { $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Web App", - "type" => "windows", - "packageName" => "com.company.appname" + "\$id" => "github", + "enabled" => true, + "clientId" => "amzn1.application-oa2-client.87400c00000000000000000000063d5b2", + "clientSecret" => "79ffe4000000000000000000000000000000000000000000000000000002de55" ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->project->updateLinuxPlatform( - "", - "", - "" + $response = $this->project->updateOAuth2Amazon(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Amazon::class, $response); + } + + public function testMethodUpdateOAuth2Apple(): void + { + $data = array( + "\$id" => "apple", + "enabled" => true, + "serviceId" => "ip.appwrite.app.web", + "keyId" => "P4000000N8", + "teamId" => "D4000000R6", + "p8File" => "-----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY-----" ); - $this->assertInstanceOf(\Appwrite\Models\PlatformLinux::class, $response); + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Apple(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Apple::class, $response); } - public function testMethodCreateWebPlatform(): void + public function testMethodUpdateOAuth2Auth0(): void { $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Web App", - "type" => "windows", - "hostname" => "app.example.com" + "\$id" => "github", + "enabled" => true, + "clientId" => "OaOkIA000000000000000000005KLSYq", + "clientSecret" => "zXz0000-00000000000000000000000000000-00000000000000000000PJafnF", + "endpoint" => "example.us.auth0.com" ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->project->createWebPlatform( - "", - "", - "app.example.com" + $response = $this->project->updateOAuth2Auth0(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Auth0::class, $response); + } + + public function testMethodUpdateOAuth2Authentik(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "dTKOPa0000000000000000000000000000e7G8hv", + "clientSecret" => "ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK", + "endpoint" => "example.authentik.com" ); - $this->assertInstanceOf(\Appwrite\Models\PlatformWeb::class, $response); + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Authentik(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Authentik::class, $response); } - public function testMethodUpdateWebPlatform(): void + public function testMethodUpdateOAuth2Autodesk(): void { $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Web App", - "type" => "windows", - "hostname" => "app.example.com" + "\$id" => "github", + "enabled" => true, + "clientId" => "5zw90v00000000000000000000kVYXN7", + "clientSecret" => "7I000000000000MW" ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->project->updateWebPlatform( - "", - "", - "app.example.com" + $response = $this->project->updateOAuth2Autodesk(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Autodesk::class, $response); + } + + public function testMethodUpdateOAuth2Bitbucket(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "key" => "Knt70000000000ByRc", + "secret" => "NMfLZJ00000000000000000000TLQdDx" ); - $this->assertInstanceOf(\Appwrite\Models\PlatformWeb::class, $response); + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Bitbucket(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Bitbucket::class, $response); } - public function testMethodCreateWindowsPlatform(): void + public function testMethodUpdateOAuth2Bitly(): void { $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Web App", - "type" => "windows", - "packageIdentifierName" => "com.company.appname" + "\$id" => "github", + "enabled" => true, + "clientId" => "d95151000000000000000000000000000067af9b", + "clientSecret" => "a13e250000000000000000000000000000d73095" ); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->project->createWindowsPlatform( - "", - "", - "" + $response = $this->project->updateOAuth2Bitly(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Bitly::class, $response); + } + + public function testMethodUpdateOAuth2Box(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "deglcs00000000000000000000x2og6y", + "clientSecret" => "OKM1f100000000000000000000eshEif" ); - $this->assertInstanceOf(\Appwrite\Models\PlatformWindows::class, $response); + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Box(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Box::class, $response); } - public function testMethodUpdateWindowsPlatform(): void + public function testMethodUpdateOAuth2Dailymotion(): void { $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Web App", - "type" => "windows", - "packageIdentifierName" => "com.company.appname" + "\$id" => "github", + "enabled" => true, + "apiKey" => "07a9000000000000067f", + "apiSecret" => "a399a90000000000000000000000000000d90639" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Dailymotion(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Dailymotion::class, $response); + } + + public function testMethodUpdateOAuth2Discord(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "950722000000343754", + "clientSecret" => "YmPXnM000000000000000000002zFg5D" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Discord(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Discord::class, $response); + } + + public function testMethodUpdateOAuth2Disqus(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "publicKey" => "cgegH70000000000000000000000000000000000000000000000000000Hr1nYX", + "secretKey" => "W7Bykj00000000000000000000000000000000000000000000000000003o43w9" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Disqus(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Disqus::class, $response); + } + + public function testMethodUpdateOAuth2Dropbox(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "appKey" => "jl000000000009t", + "appSecret" => "g200000000000vw" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Dropbox(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Dropbox::class, $response); + } + + public function testMethodUpdateOAuth2Etsy(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "keyString" => "nsgzxh0000000000008j85a2", + "sharedSecret" => "tp000000ru" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Etsy(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Etsy::class, $response); + } + + public function testMethodUpdateOAuth2Facebook(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "appId" => "260600000007694", + "appSecret" => "2d0b2800000000000000000000d38af4" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Facebook(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Facebook::class, $response); + } + + public function testMethodUpdateOAuth2Figma(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "byay5H0000000000VtiI40", + "clientSecret" => "yEpOYn0000000000000000004iIsU5" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Figma(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Figma::class, $response); + } + + public function testMethodUpdateOAuth2FusionAuth(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "b2222c00-0000-0000-0000-000000862097", + "clientSecret" => "Jx4s0C0000000000000000000000000000000wGqLsc", + "endpoint" => "example.fusionauth.io" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2FusionAuth(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2FusionAuth::class, $response); + } + + public function testMethodUpdateOAuth2GitHub(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "e4d87900000000540733", + "clientSecret" => "5e07c00000000000000000000000000000198bcc" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2GitHub(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Github::class, $response); + } + + public function testMethodUpdateOAuth2Gitlab(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "applicationId" => "d41ffe0000000000000000000000000000000000000000000000000000d5e252", + "secret" => "gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38", + "endpoint" => "https://gitlab.com" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Gitlab(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Gitlab::class, $response); + } + + public function testMethodUpdateOAuth2Google(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "your-google-client-id.apps.googleusercontent.com", + "clientSecret" => "your-google-client-secret" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Google(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Google::class, $response); + } + + public function testMethodUpdateOAuth2Keycloak(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "appwrite-o0000000st-app", + "clientSecret" => "jdjrJd00000000000000000000HUsaZO", + "endpoint" => "keycloak.example.com", + "realmName" => "appwrite-realm" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Keycloak(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Keycloak::class, $response); + } + + public function testMethodUpdateOAuth2Kick(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "01KQ7C00000000000001MFHS32", + "clientSecret" => "34ac5600000000000000000000000000000000000000000000000000e830c8b" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Kick(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Kick::class, $response); + } + + public function testMethodUpdateOAuth2Linkedin(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "770000000000dv", + "primaryClientSecret" => "your-linkedin-client-secret" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Linkedin(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Linkedin::class, $response); + } + + public function testMethodUpdateOAuth2Microsoft(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "applicationId" => "00001111-aaaa-2222-bbbb-3333cccc4444", + "applicationSecret" => "A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u", + "tenant" => "common" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Microsoft(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Microsoft::class, $response); + } + + public function testMethodUpdateOAuth2Notion(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "oauthClientId" => "341d8700-0000-0000-0000-000000446ee3", + "oauthClientSecret" => "secret_dLUr4b000000000000000000000000000000lFHAa9" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Notion(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Notion::class, $response); + } + + public function testMethodUpdateOAuth2Oidc(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "qibI2x0000000000000000000000000006L2YFoG", + "clientSecret" => "Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV", + "wellKnownURL" => "https://myoauth.com/.well-known/openid-configuration", + "authorizationURL" => "https://myoauth.com/oauth2/authorize", + "tokenURL" => "https://myoauth.com/oauth2/token", + "userInfoURL" => "https://myoauth.com/oauth2/userinfo" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Oidc(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Oidc::class, $response); + } + + public function testMethodUpdateOAuth2Okta(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "0oa00000000000000698", + "clientSecret" => "Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV", + "domain" => "trial-6400025.okta.com", + "authorizationServerId" => "aus000000000000000h7z" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Okta(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Okta::class, $response); + } + + public function testMethodUpdateOAuth2Paypal(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB", + "secretKey" => "EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Paypal(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Paypal::class, $response); + } + + public function testMethodUpdateOAuth2PaypalSandbox(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB", + "secretKey" => "EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2PaypalSandbox(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Paypal::class, $response); + } + + public function testMethodUpdateOAuth2Podio(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "appwrite-oauth-test-app", + "clientSecret" => "Rn247T0000000000000000000000000000000000000000000000000000W2zWTN" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Podio(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Podio::class, $response); + } + + public function testMethodUpdateOAuth2Salesforce(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "customerKey" => "3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq", + "customerSecret" => "3w000000000000e2" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Salesforce(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Salesforce::class, $response); + } + + public function testMethodUpdateOAuth2Slack(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "23000000089.15000000000023", + "clientSecret" => "81656000000000000000000000f3d2fd" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Slack(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Slack::class, $response); + } + + public function testMethodUpdateOAuth2Spotify(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "6ec271000000000000000000009beace", + "clientSecret" => "db068a000000000000000000008b5b9f" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Spotify(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Spotify::class, $response); + } + + public function testMethodUpdateOAuth2Stripe(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "ca_UKibXX0000000000000000000006byvR", + "apiSecretKey" => "sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Stripe(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Stripe::class, $response); + } + + public function testMethodUpdateOAuth2Tradeshift(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "oauth2ClientId" => "appwrite-test-org.appwrite-test-app", + "oauth2ClientSecret" => "7cb52700-0000-0000-0000-000000ca5b83" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Tradeshift(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Tradeshift::class, $response); + } + + public function testMethodUpdateOAuth2TradeshiftSandbox(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "oauth2ClientId" => "appwrite-test-org.appwrite-test-app", + "oauth2ClientSecret" => "7cb52700-0000-0000-0000-000000ca5b83" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2TradeshiftSandbox(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Tradeshift::class, $response); + } + + public function testMethodUpdateOAuth2Twitch(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "vvi0in000000000000000000ikmt9p", + "clientSecret" => "pmapue000000000000000000zylw3v" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Twitch(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Twitch::class, $response); + } + + public function testMethodUpdateOAuth2WordPress(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "130005", + "clientSecret" => "PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2WordPress(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2WordPress::class, $response); + } + + public function testMethodUpdateOAuth2X(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "customerKey" => "slzZV0000000000000NFLaWT", + "secretKey" => "tkEPkp00000000000000000000000000000000000000FTxbI9" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2X(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2X::class, $response); + } + + public function testMethodUpdateOAuth2Yahoo(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm", + "clientSecret" => "cf978f0000000000000000000000000000c5e2e9" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Yahoo(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Yahoo::class, $response); + } + + public function testMethodUpdateOAuth2Yandex(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "6a8a6a0000000000000000000091483c", + "clientSecret" => "bbf98500000000000000000000c75a63" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Yandex(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Yandex::class, $response); + } + + public function testMethodUpdateOAuth2Zoho(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "1000.83C178000000000000000000RPNX0B", + "clientSecret" => "fb5cac000000000000000000000000000000a68f6e" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Zoho(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Zoho::class, $response); + } + + public function testMethodUpdateOAuth2Zoom(): void + { + $data = array( + "\$id" => "github", + "enabled" => true, + "clientId" => "QMAC00000000000000w0AQ", + "clientSecret" => "GAWsG4000000000000000000007U01ON" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateOAuth2Zoom(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Zoom::class, $response); + } + + public function testMethodListPlatforms(): void + { + $data = array( + "total" => 5, + "platforms" => array() + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->listPlatforms(); + + $this->assertInstanceOf(\Appwrite\Models\PlatformList::class, $response); + } + + public function testMethodCreateAndroidPlatform(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Web App", + "type" => "windows", + "applicationId" => "com.company.appname" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->createAndroidPlatform( + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\PlatformAndroid::class, $response); + } + + public function testMethodUpdateAndroidPlatform(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Web App", + "type" => "windows", + "applicationId" => "com.company.appname" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateAndroidPlatform( + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\PlatformAndroid::class, $response); + } + + public function testMethodCreateApplePlatform(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Web App", + "type" => "windows", + "bundleIdentifier" => "com.company.appname" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->createApplePlatform( + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\PlatformApple::class, $response); + } + + public function testMethodUpdateApplePlatform(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Web App", + "type" => "windows", + "bundleIdentifier" => "com.company.appname" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateApplePlatform( + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\PlatformApple::class, $response); + } + + public function testMethodCreateLinuxPlatform(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Web App", + "type" => "windows", + "packageName" => "com.company.appname" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->createLinuxPlatform( + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\PlatformLinux::class, $response); + } + + public function testMethodUpdateLinuxPlatform(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Web App", + "type" => "windows", + "packageName" => "com.company.appname" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateLinuxPlatform( + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\PlatformLinux::class, $response); + } + + public function testMethodCreateWebPlatform(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Web App", + "type" => "windows", + "hostname" => "app.example.com" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->createWebPlatform( + "", + "", + "app.example.com" + ); + + $this->assertInstanceOf(\Appwrite\Models\PlatformWeb::class, $response); + } + + public function testMethodUpdateWebPlatform(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Web App", + "type" => "windows", + "hostname" => "app.example.com" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateWebPlatform( + "", + "", + "app.example.com" + ); + + $this->assertInstanceOf(\Appwrite\Models\PlatformWeb::class, $response); + } + + public function testMethodCreateWindowsPlatform(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Web App", + "type" => "windows", + "packageIdentifierName" => "com.company.appname" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->createWindowsPlatform( + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\PlatformWindows::class, $response); + } + + public function testMethodUpdateWindowsPlatform(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Web App", + "type" => "windows", + "packageIdentifierName" => "com.company.appname" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateWindowsPlatform( + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\PlatformWindows::class, $response); + } + + public function testMethodGetPlatform(): void + { + $data = array_replace( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Web App", + "type" => "windows", + "packageName" => "com.company.appname" + ), + array( + "type" => "linux" + ) + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->getPlatform( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\PlatformLinux::class, $response); + } + + public function testMethodDeletePlatform(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->deletePlatform( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListPolicies(): void + { + $data = array( + "total" => 9, + "policies" => array() + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->listPolicies(); + + $this->assertInstanceOf(\Appwrite\Models\PolicyList::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", + "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", + "\$createdAt" => "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", + "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, + "region" => "fra", + "billingLimits" => array( + "bandwidth" => 5, + "storage" => 150, + "users" => 200000, + "executions" => 750000, + "GBHours" => 100, + "imageTransformations" => 100, + "authPhone" => 10, + "budgetLimit" => 100 + ), + "blocks" => array( + array( + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "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->updateMembershipPrivacyPolicy(); + + $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); + } + + 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( + 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", + "\$createdAt" => "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", + "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, + "region" => "fra", + "billingLimits" => array( + "bandwidth" => 5, + "storage" => 150, + "users" => 200000, + "executions" => 750000, + "GBHours" => 100, + "imageTransformations" => 100, + "authPhone" => 10, + "budgetLimit" => 100 + ), + "blocks" => array( + array( + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "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", + "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", + "\$createdAt" => "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", + "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, + "region" => "fra", + "billingLimits" => array( + "bandwidth" => 5, + "storage" => 150, + "users" => 200000, + "executions" => 750000, + "GBHours" => 100, + "imageTransformations" => 100, + "authPhone" => 10, + "budgetLimit" => 100 + ), + "blocks" => array( + array( + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "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->updatePasswordHistoryPolicy( + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); + } + + 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( + 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", + "\$createdAt" => "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", + "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, + "region" => "fra", + "billingLimits" => array( + "bandwidth" => 5, + "storage" => 150, + "users" => 200000, + "executions" => 750000, + "GBHours" => 100, + "imageTransformations" => 100, + "authPhone" => 10, + "budgetLimit" => 100 + ), + "blocks" => array( + array( + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "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", + "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", + "\$createdAt" => "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", + "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, + "region" => "fra", + "billingLimits" => array( + "bandwidth" => 5, + "storage" => 150, + "users" => 200000, + "executions" => 750000, + "GBHours" => 100, + "imageTransformations" => 100, + "authPhone" => 10, + "budgetLimit" => 100 + ), + "blocks" => array( + array( + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "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->updateSessionAlertPolicy( + true + ); + + $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); + } + + public function testMethodUpdateSessionDurationPolicy(): 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", + "\$createdAt" => "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", + "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, + "region" => "fra", + "billingLimits" => array( + "bandwidth" => 5, + "storage" => 150, + "users" => 200000, + "executions" => 750000, + "GBHours" => 100, + "imageTransformations" => 100, + "authPhone" => 10, + "budgetLimit" => 100 + ), + "blocks" => array( + array( + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "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->updateSessionDurationPolicy( + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); + } + + public function testMethodUpdateSessionInvalidationPolicy(): 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", + "\$createdAt" => "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", + "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, + "region" => "fra", + "billingLimits" => array( + "bandwidth" => 5, + "storage" => 150, + "users" => 200000, + "executions" => 750000, + "GBHours" => 100, + "imageTransformations" => 100, + "authPhone" => 10, + "budgetLimit" => 100 + ), + "blocks" => array( + array( + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "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->updateSessionInvalidationPolicy( + true + ); + + $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); + } + + public function testMethodUpdateSessionLimitPolicy(): 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", + "\$createdAt" => "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", + "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, + "region" => "fra", + "billingLimits" => array( + "bandwidth" => 5, + "storage" => 150, + "users" => 200000, + "executions" => 750000, + "GBHours" => 100, + "imageTransformations" => 100, + "authPhone" => 10, + "budgetLimit" => 100 + ), + "blocks" => array( + array( + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "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->updateSessionLimitPolicy( + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); + } + + public function testMethodUpdateUserLimitPolicy(): 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", + "\$createdAt" => "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", + "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, + "region" => "fra", + "billingLimits" => array( + "bandwidth" => 5, + "storage" => 150, + "users" => 200000, + "executions" => 750000, + "GBHours" => 100, + "imageTransformations" => 100, + "authPhone" => 10, + "budgetLimit" => 100 + ), + "blocks" => array( + array( + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "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->updateWindowsPlatform( - "", - "", - "" + $response = $this->project->updateUserLimitPolicy( + 1 ); - $this->assertInstanceOf(\Appwrite\Models\PlatformWindows::class, $response); + $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); } - public function testMethodGetPlatform(): void + public function testMethodGetPolicy(): void { $data = array_replace( array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "My Web App", - "type" => "windows", - "packageName" => "com.company.appname" + "\$id" => "password-dictionary", + "userId" => true, + "userEmail" => true, + "userPhone" => true, + "userName" => true, + "userMFA" => true ), array( - "type" => "linux" + "\$id" => "membership-privacy" ) ); @@ -580,29 +3315,186 @@ public function testMethodGetPlatform(): void ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->project->getPlatform( - "" + $response = $this->project->getPolicy( + PolicyId::PASSWORDDICTIONARY() ); - $this->assertInstanceOf(\Appwrite\Models\PlatformLinux::class, $response); + $this->assertInstanceOf(\Appwrite\Models\PolicyMembershipPrivacy::class, $response); } - public function testMethodDeletePlatform(): void + public function testMethodUpdateProtocol(): void { - $data = ''; + $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", + "\$createdAt" => "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", + "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, + "region" => "fra", + "billingLimits" => array( + "bandwidth" => 5, + "storage" => 150, + "users" => 200000, + "executions" => 750000, + "GBHours" => 100, + "imageTransformations" => 100, + "authPhone" => 10, + "budgetLimit" => 100 + ), + "blocks" => array( + array( + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "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->deletePlatform( - "" + $response = $this->project->updateProtocol( + ProtocolId::REST(), + true ); - $this->assertSame($data, $response); + $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); } - public function testMethodUpdateProtocolStatus(): void + public function testMethodUpdateService(): void { $data = array( "\$id" => "5e5ea5c16897e", @@ -630,21 +3522,25 @@ public function testMethodUpdateProtocolStatus(): void "authFreeEmails" => true, "authMockNumbers" => array( array( - "phone" => "+1612842323", - "otp" => "123456" + "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" => "Bpw_g9c2TGXxfgLshDbSaL8tsCcqgczQ", + "secret" => "[SECRET]", "enabled" => true ) ), @@ -694,11 +3590,12 @@ public function testMethodUpdateProtocolStatus(): void "smtpEnabled" => true, "smtpSenderName" => "John Appwrite", "smtpSenderEmail" => "john@appwrite.io", - "smtpReplyTo" => "support@appwrite.io", + "smtpReplyToName" => "Support Team", + "smtpReplyToEmail" => "support@appwrite.io", "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "securepassword", + "smtpPassword" => "[SMTPPASSWORD]", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -746,7 +3643,12 @@ public function testMethodUpdateProtocolStatus(): void array( "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "resourceType" => "project", - "resourceId" => "5e5ea5c16897e" + "resourceId" => "5e5ea5c16897e", + "projectName" => "My Project", + "region" => "fra", + "organizationName" => "Acme Inc.", + "organizationId" => "5e5ea5c16897e", + "billingPlan" => "pro" ) ), "consoleAccessedAt" => "2020-10-15T06:38:00.000+00:00" @@ -756,15 +3658,15 @@ public function testMethodUpdateProtocolStatus(): void ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->project->updateProtocolStatus( - ProtocolId::REST(), + $response = $this->project->updateService( + ServiceId::ACCOUNT(), true ); $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); } - public function testMethodUpdateServiceStatus(): void + public function testMethodUpdateSMTP(): void { $data = array( "\$id" => "5e5ea5c16897e", @@ -792,21 +3694,25 @@ public function testMethodUpdateServiceStatus(): void "authFreeEmails" => true, "authMockNumbers" => array( array( - "phone" => "+1612842323", - "otp" => "123456" + "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" => "Bpw_g9c2TGXxfgLshDbSaL8tsCcqgczQ", + "secret" => "[SECRET]", "enabled" => true ) ), @@ -856,11 +3762,12 @@ public function testMethodUpdateServiceStatus(): void "smtpEnabled" => true, "smtpSenderName" => "John Appwrite", "smtpSenderEmail" => "john@appwrite.io", - "smtpReplyTo" => "support@appwrite.io", + "smtpReplyToName" => "Support Team", + "smtpReplyToEmail" => "support@appwrite.io", "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "securepassword", + "smtpPassword" => "[SMTPPASSWORD]", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -908,7 +3815,12 @@ public function testMethodUpdateServiceStatus(): void array( "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "resourceType" => "project", - "resourceId" => "5e5ea5c16897e" + "resourceId" => "5e5ea5c16897e", + "projectName" => "My Project", + "region" => "fra", + "organizationName" => "Acme Inc.", + "organizationId" => "5e5ea5c16897e", + "billingPlan" => "pro" ) ), "consoleAccessedAt" => "2020-10-15T06:38:00.000+00:00" @@ -918,14 +3830,101 @@ public function testMethodUpdateServiceStatus(): void ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->project->updateServiceStatus( - ServiceId::ACCOUNT(), - true - ); + $response = $this->project->updateSMTP(); $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); } + public function testMethodCreateSMTPTest(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->createSMTPTest( + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodListEmailTemplates(): void + { + $data = array( + "total" => 5, + "templates" => array( + array( + "templateId" => "verification", + "locale" => "en_us", + "message" => "Click on the link to verify your account.", + "senderName" => "My User", + "senderEmail" => "mail@appwrite.io", + "replyToEmail" => "emails@appwrite.io", + "replyToName" => "Support Team", + "subject" => "Please verify your email address" + ) + ) + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->listEmailTemplates(); + + $this->assertInstanceOf(\Appwrite\Models\EmailTemplateList::class, $response); + } + + public function testMethodUpdateEmailTemplate(): void + { + $data = array( + "templateId" => "verification", + "locale" => "en_us", + "message" => "Click on the link to verify your account.", + "senderName" => "My User", + "senderEmail" => "mail@appwrite.io", + "replyToEmail" => "emails@appwrite.io", + "replyToName" => "Support Team", + "subject" => "Please verify your email address" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateEmailTemplate( + EmailTemplateType::VERIFICATION() + ); + + $this->assertInstanceOf(\Appwrite\Models\EmailTemplate::class, $response); + } + + public function testMethodGetEmailTemplate(): void + { + $data = array( + "templateId" => "verification", + "locale" => "en_us", + "message" => "Click on the link to verify your account.", + "senderName" => "My User", + "senderEmail" => "mail@appwrite.io", + "replyToEmail" => "emails@appwrite.io", + "replyToName" => "Support Team", + "subject" => "Please verify your email address" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->getEmailTemplate( + EmailTemplateType::VERIFICATION() + ); + + $this->assertInstanceOf(\Appwrite\Models\EmailTemplate::class, $response); + } + public function testMethodListVariables(): void { $data = array( diff --git a/tests/Appwrite/Services/ProxyTest.php b/tests/Appwrite/Services/ProxyTest.php new file mode 100644 index 00000000..ea218575 --- /dev/null +++ b/tests/Appwrite/Services/ProxyTest.php @@ -0,0 +1,257 @@ +client = Mockery::mock(Client::class); + $this->proxy = new Proxy($this->client); + } + + public function testMethodListRules(): void + { + $data = array( + "total" => 5, + "rules" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "domain" => "appwrite.company.com", + "type" => "deployment", + "trigger" => "manual", + "redirectUrl" => "https://appwrite.io/docs", + "redirectStatusCode" => 301, + "deploymentId" => "n3u9feiwmf", + "deploymentResourceId" => "n3u9feiwmf", + "deploymentVcsProviderBranch" => "main", + "status" => "unverified", + "logs" => "Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.", + "renewAt" => "datetime" + ) + ) + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->proxy->listRules(); + + $this->assertInstanceOf(\Appwrite\Models\ProxyRuleList::class, $response); + } + + public function testMethodCreateAPIRule(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "domain" => "appwrite.company.com", + "type" => "deployment", + "trigger" => "manual", + "redirectUrl" => "https://appwrite.io/docs", + "redirectStatusCode" => 301, + "deploymentId" => "n3u9feiwmf", + "deploymentResourceId" => "n3u9feiwmf", + "deploymentVcsProviderBranch" => "main", + "status" => "unverified", + "logs" => "Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.", + "renewAt" => "datetime" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->proxy->createAPIRule( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\ProxyRule::class, $response); + } + + public function testMethodCreateFunctionRule(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "domain" => "appwrite.company.com", + "type" => "deployment", + "trigger" => "manual", + "redirectUrl" => "https://appwrite.io/docs", + "redirectStatusCode" => 301, + "deploymentId" => "n3u9feiwmf", + "deploymentResourceId" => "n3u9feiwmf", + "deploymentVcsProviderBranch" => "main", + "status" => "unverified", + "logs" => "Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.", + "renewAt" => "datetime" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->proxy->createFunctionRule( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\ProxyRule::class, $response); + } + + public function testMethodCreateRedirectRule(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "domain" => "appwrite.company.com", + "type" => "deployment", + "trigger" => "manual", + "redirectUrl" => "https://appwrite.io/docs", + "redirectStatusCode" => 301, + "deploymentId" => "n3u9feiwmf", + "deploymentResourceId" => "n3u9feiwmf", + "deploymentVcsProviderBranch" => "main", + "status" => "unverified", + "logs" => "Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.", + "renewAt" => "datetime" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->proxy->createRedirectRule( + "", + "https://example.com", + StatusCode::MOVEDPERMANENTLY301(), + "", + ProxyResourceType::SITE() + ); + + $this->assertInstanceOf(\Appwrite\Models\ProxyRule::class, $response); + } + + public function testMethodCreateSiteRule(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "domain" => "appwrite.company.com", + "type" => "deployment", + "trigger" => "manual", + "redirectUrl" => "https://appwrite.io/docs", + "redirectStatusCode" => 301, + "deploymentId" => "n3u9feiwmf", + "deploymentResourceId" => "n3u9feiwmf", + "deploymentVcsProviderBranch" => "main", + "status" => "unverified", + "logs" => "Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.", + "renewAt" => "datetime" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->proxy->createSiteRule( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\ProxyRule::class, $response); + } + + public function testMethodGetRule(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "domain" => "appwrite.company.com", + "type" => "deployment", + "trigger" => "manual", + "redirectUrl" => "https://appwrite.io/docs", + "redirectStatusCode" => 301, + "deploymentId" => "n3u9feiwmf", + "deploymentResourceId" => "n3u9feiwmf", + "deploymentVcsProviderBranch" => "main", + "status" => "unverified", + "logs" => "Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.", + "renewAt" => "datetime" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->proxy->getRule( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\ProxyRule::class, $response); + } + + public function testMethodDeleteRule(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->proxy->deleteRule( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateRuleStatus(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "domain" => "appwrite.company.com", + "type" => "deployment", + "trigger" => "manual", + "redirectUrl" => "https://appwrite.io/docs", + "redirectStatusCode" => 301, + "deploymentId" => "n3u9feiwmf", + "deploymentResourceId" => "n3u9feiwmf", + "deploymentVcsProviderBranch" => "main", + "status" => "unverified", + "logs" => "Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.", + "renewAt" => "datetime" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->proxy->updateRuleStatus( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\ProxyRule::class, $response); + } + +} diff --git a/tests/Appwrite/Services/SitesTest.php b/tests/Appwrite/Services/SitesTest.php index 2fe7810b..a42f7f41 100644 --- a/tests/Appwrite/Services/SitesTest.php +++ b/tests/Appwrite/Services/SitesTest.php @@ -903,6 +903,7 @@ public function testMethodCreateVariable(): void $response = $this->sites->createVariable( "", + "", "", "" ); @@ -954,8 +955,7 @@ public function testMethodUpdateVariable(): void $response = $this->sites->updateVariable( "", - "", - "" + "" ); $this->assertInstanceOf(\Appwrite\Models\Variable::class, $response); diff --git a/tests/Appwrite/Services/TablesDBTest.php b/tests/Appwrite/Services/TablesDBTest.php index 979085de..c1622e48 100644 --- a/tests/Appwrite/Services/TablesDBTest.php +++ b/tests/Appwrite/Services/TablesDBTest.php @@ -623,6 +623,59 @@ public function testMethodListColumns(): void $this->assertInstanceOf(\Appwrite\Models\ColumnList::class, $response); } + public function testMethodCreateBigIntColumn(): void + { + $data = array( + "key" => "count", + "type" => "bigint", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->createBigIntColumn( + "", + "", + "", + true + ); + + $this->assertInstanceOf(\Appwrite\Models\ColumnBigint::class, $response); + } + + public function testMethodUpdateBigIntColumn(): void + { + $data = array( + "key" => "count", + "type" => "bigint", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->updateBigIntColumn( + "", + "", + "", + true, + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\ColumnBigint::class, $response); + } + public function testMethodCreateBooleanColumn(): void { $data = array( diff --git a/tests/Appwrite/Services/TeamsTest.php b/tests/Appwrite/Services/TeamsTest.php index 0c72a695..d87d2d35 100644 --- a/tests/Appwrite/Services/TeamsTest.php +++ b/tests/Appwrite/Services/TeamsTest.php @@ -138,6 +138,7 @@ public function testMethodListMemberships(): void "userId" => "5e5ea5c16897e", "userName" => "John Doe", "userEmail" => "john@appwrite.io", + "userPhone" => "+1 555 555 5555", "teamId" => "5e5ea5c16897e", "teamName" => "VIP", "invited" => "2020-10-15T06:38:00.000+00:00", @@ -169,6 +170,7 @@ public function testMethodCreateMembership(): void "userId" => "5e5ea5c16897e", "userName" => "John Doe", "userEmail" => "john@appwrite.io", + "userPhone" => "+1 555 555 5555", "teamId" => "5e5ea5c16897e", "teamName" => "VIP", "invited" => "2020-10-15T06:38:00.000+00:00", @@ -199,6 +201,7 @@ public function testMethodGetMembership(): void "userId" => "5e5ea5c16897e", "userName" => "John Doe", "userEmail" => "john@appwrite.io", + "userPhone" => "+1 555 555 5555", "teamId" => "5e5ea5c16897e", "teamName" => "VIP", "invited" => "2020-10-15T06:38:00.000+00:00", @@ -229,6 +232,7 @@ public function testMethodUpdateMembership(): void "userId" => "5e5ea5c16897e", "userName" => "John Doe", "userEmail" => "john@appwrite.io", + "userPhone" => "+1 555 555 5555", "teamId" => "5e5ea5c16897e", "teamName" => "VIP", "invited" => "2020-10-15T06:38:00.000+00:00", @@ -276,6 +280,7 @@ public function testMethodUpdateMembershipStatus(): void "userId" => "5e5ea5c16897e", "userName" => "John Doe", "userEmail" => "john@appwrite.io", + "userPhone" => "+1 555 555 5555", "teamId" => "5e5ea5c16897e", "teamName" => "VIP", "invited" => "2020-10-15T06:38:00.000+00:00", diff --git a/tests/Appwrite/Services/UsersTest.php b/tests/Appwrite/Services/UsersTest.php index 3af694d1..5f6f88ec 100644 --- a/tests/Appwrite/Services/UsersTest.php +++ b/tests/Appwrite/Services/UsersTest.php @@ -739,6 +739,7 @@ public function testMethodListMemberships(): void "userId" => "5e5ea5c16897e", "userName" => "John Doe", "userEmail" => "john@appwrite.io", + "userPhone" => "+1 555 555 5555", "teamId" => "5e5ea5c16897e", "teamName" => "VIP", "invited" => "2020-10-15T06:38:00.000+00:00",