From 401ee119ba2e77eeb4473f0e6b2a849a856e0e91 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 14 Oct 2026 12:21:51 +0100 Subject: [PATCH 1/2] feat: PHP SDK update for version 30.4.0 --- CHANGELOG.md | 20 + docs/account.md | 106 + docs/avatars.md | 20 + docs/databases.md | 1 + docs/documentsdb.md | 1 + docs/domains.md | 794 ++++++ .../account/create-email-password-session.md | 3 +- .../account/create-email-verification-otp.md | 17 + .../account/create-id-token-session.md | 23 + docs/examples/account/create-recovery-otp.md | 18 + docs/examples/account/delete-sessions.md | 4 +- docs/examples/account/list-sessions.md | 4 +- .../account/update-email-verification-otp.md | 18 + docs/examples/account/update-recovery-otp.md | 19 + docs/examples/avatars/delete-photo.md | 15 + docs/examples/avatars/update-photo.md | 18 + docs/examples/databases/list-transactions.md | 3 +- .../examples/documentsdb/list-transactions.md | 3 +- .../domains/create-preset-google-workspace.md | 17 + .../examples/domains/create-preset-i-cloud.md | 17 + .../examples/domains/create-preset-mailgun.md | 17 + .../examples/domains/create-preset-outlook.md | 17 + .../domains/create-preset-proton-mail.md | 17 + docs/examples/domains/create-preset-zoho.md | 17 + docs/examples/domains/create-record-a.md | 21 + docs/examples/domains/create-record-aaaa.md | 21 + docs/examples/domains/create-record-alias.md | 21 + docs/examples/domains/create-record-caa.md | 21 + docs/examples/domains/create-record-cname.md | 21 + docs/examples/domains/create-record-https.md | 21 + docs/examples/domains/create-record-mx.md | 22 + docs/examples/domains/create-record-ns.md | 21 + docs/examples/domains/create-record-srv.md | 24 + docs/examples/domains/create-record-txt.md | 21 + docs/examples/domains/create.md | 18 + docs/examples/domains/delete-record.md | 18 + docs/examples/domains/delete.md | 17 + .../domains/get-preset-google-workspace.md | 17 + docs/examples/domains/get-preset-i-cloud.md | 17 + docs/examples/domains/get-preset-mailgun.md | 17 + docs/examples/domains/get-preset-outlook.md | 17 + .../domains/get-preset-proton-mail.md | 17 + docs/examples/domains/get-preset-zoho.md | 17 + docs/examples/domains/get-price.md | 20 + docs/examples/domains/get-record.md | 18 + docs/examples/domains/get-transfer-status.md | 17 + docs/examples/domains/get-zone.md | 17 + docs/examples/domains/get.md | 17 + docs/examples/domains/list-prices.md | 20 + docs/examples/domains/list-records.md | 18 + docs/examples/domains/list.md | 18 + docs/examples/domains/update-nameservers.md | 18 + docs/examples/domains/update-record-a.md | 22 + docs/examples/domains/update-record-aaaa.md | 22 + docs/examples/domains/update-record-alias.md | 22 + docs/examples/domains/update-record-caa.md | 22 + docs/examples/domains/update-record-cname.md | 22 + docs/examples/domains/update-record-https.md | 22 + docs/examples/domains/update-record-mx.md | 23 + docs/examples/domains/update-record-ns.md | 22 + docs/examples/domains/update-record-srv.md | 25 + docs/examples/domains/update-record-txt.md | 22 + docs/examples/domains/update-team.md | 18 + docs/examples/domains/update-zone.md | 18 + docs/examples/domains/verify-nameservers.md | 17 + docs/examples/functions/list-runtimes.md | 4 +- .../examples/functions/list-specifications.md | 3 +- docs/examples/locale/list-codes.md | 4 +- docs/examples/locale/list-continents.md | 4 +- docs/examples/locale/list-countries-eu.md | 4 +- docs/examples/locale/list-countries-phones.md | 4 +- docs/examples/locale/list-countries.md | 4 +- docs/examples/locale/list-currencies.md | 4 +- docs/examples/locale/list-languages.md | 4 +- .../messaging/create-appwrite-provider.md | 21 + docs/examples/messaging/create-email.md | 4 +- docs/examples/messaging/create-push.md | 3 +- docs/examples/messaging/create-topic.md | 4 +- .../messaging/update-appwrite-provider.md | 21 + docs/examples/messaging/update-email.md | 4 +- docs/examples/messaging/update-push.md | 3 +- docs/examples/messaging/update-topic.md | 4 +- docs/examples/oauth2/introspect.md | 20 + .../create-ephemeral-project-key.md | 20 + .../organization/delete-project-key.md | 18 + docs/examples/organization/get-project-key.md | 18 + .../organization/list-project-keys.md | 19 + .../organization/update-project-key.md | 22 + .../project/create-android-platform.md | 3 +- docs/examples/project/create-environment.md | 18 + docs/examples/project/delete-environment.md | 17 + docs/examples/project/get-environment.md | 17 + docs/examples/project/list-environments.md | 18 + .../project/update-android-platform.md | 3 +- docs/examples/project/update-environment.md | 18 + .../examples/project/update-o-auth-2-apple.md | 4 +- .../project/update-o-auth-2-auth-0.md | 4 +- .../project/update-o-auth-2-discord.md | 4 +- .../project/update-o-auth-2-git-hub.md | 4 +- .../project/update-o-auth-2-google.md | 4 +- .../examples/project/update-o-auth-2-kakao.md | 21 + .../project/update-o-auth-2-microsoft.md | 4 +- docs/examples/project/update-o-auth-2-okta.md | 4 +- .../project/update-o-auth-2-salesforce.md | 4 +- .../project/update-o-auth-2-tik-tok.md | 19 + .../project/update-o-auth-2-webflow.md | 19 + docs/examples/project/update-o-auth-2-zoho.md | 4 +- .../project/update-password-pwned-policy.md | 19 + .../update-password-rotation-policy.md | 18 + docs/examples/sites/list-frameworks.md | 4 +- docs/examples/sites/list-specifications.md | 3 +- docs/examples/storage/get-file-preview.md | 2 +- docs/examples/tablesdb/list-transactions.md | 3 +- docs/examples/teams/create-membership.md | 3 +- docs/examples/vectorsdb/list-transactions.md | 3 +- docs/examples/waf/create-bypass-rule.md | 24 + docs/examples/waf/create-challenge-rule.md | 27 + docs/examples/waf/create-deny-rule.md | 24 + docs/examples/waf/create-rate-limit-rule.md | 29 + docs/examples/waf/create-redirect-rule.md | 26 + docs/examples/waf/delete-rule.md | 17 + docs/examples/waf/get-rule.md | 17 + docs/examples/waf/list-rules.md | 19 + docs/examples/waf/update-bypass-rule.md | 24 + docs/examples/waf/update-challenge-rule.md | 27 + docs/examples/waf/update-deny-rule.md | 24 + docs/examples/waf/update-rate-limit-rule.md | 28 + docs/examples/waf/update-redirect-rule.md | 26 + docs/functions.md | 7 + docs/locale.md | 42 + docs/messaging.md | 44 + docs/oauth2.md | 17 + docs/organization.md | 77 + docs/project.md | 160 +- docs/sites.md | 7 + docs/tablesdb.md | 1 + docs/teams.md | 1 + docs/vectorsdb.md | 1 + docs/waf.md | 275 +++ src/Appwrite/Client.php | 4 +- src/Appwrite/Enums/BillingPlanGroup.php | 16 + src/Appwrite/Enums/BuildRuntime.php | 16 + src/Appwrite/Enums/DatabasesIndexType.php | 8 + src/Appwrite/Enums/DomainRegistrationType.php | 66 + .../Enums/DomainTransferStatusEnum.php | 98 + src/Appwrite/Enums/Framework.php | 8 + src/Appwrite/Enums/IdTokenProvider.php | 50 + src/Appwrite/Enums/ImageGravity.php | 8 + src/Appwrite/Enums/OAuth2Auth0Prompt.php | 58 + src/Appwrite/Enums/OAuth2DiscordPrompt.php | 50 + src/Appwrite/Enums/OAuth2GithubPrompt.php | 42 + src/Appwrite/Enums/OAuth2KakaoPrompt.php | 66 + src/Appwrite/Enums/OAuth2MicrosoftPrompt.php | 66 + src/Appwrite/Enums/OAuth2OktaPrompt.php | 58 + src/Appwrite/Enums/OAuth2SalesforcePrompt.php | 50 + src/Appwrite/Enums/OAuth2ZohoPrompt.php | 42 + src/Appwrite/Enums/OAuthProvider.php | 24 + src/Appwrite/Enums/ProjectEmailTemplateId.php | 16 + src/Appwrite/Enums/ProjectKeyScopes.php | 32 + .../Enums/ProjectOAuth2Auth0Prompt.php | 58 + .../Enums/ProjectOAuth2DiscordPrompt.php | 50 + .../Enums/ProjectOAuth2GitHubPrompt.php | 42 + .../Enums/ProjectOAuth2KakaoPrompt.php | 66 + .../Enums/ProjectOAuth2MicrosoftPrompt.php | 66 + .../Enums/ProjectOAuth2OktaPrompt.php | 58 + .../Enums/ProjectOAuth2SalesforcePrompt.php | 50 + .../Enums/ProjectOAuth2ZohoPrompt.php | 42 + src/Appwrite/Enums/ProjectOAuthProviderId.php | 24 + src/Appwrite/Enums/ProjectPolicyId.php | 16 + .../Enums/ProxyRuleDeploymentResourceType.php | 8 + src/Appwrite/Enums/Runtime.php | 16 + src/Appwrite/Enums/TablesDBIndexType.php | 8 + src/Appwrite/Enums/WafRuleAction.php | 74 + src/Appwrite/Models/Account.php | 164 ++ src/Appwrite/Models/BillingPlan.php | 8 + src/Appwrite/Models/DedicatedDatabase.php | 16 +- .../Models/DedicatedDatabaseSpecification.php | 20 +- src/Appwrite/Models/DnsRecord.php | 104 + src/Appwrite/Models/DnsRecordsList.php | 59 + src/Appwrite/Models/Domain.php | 115 + src/Appwrite/Models/DomainPrice.php | 82 + src/Appwrite/Models/DomainPricesList.php | 59 + src/Appwrite/Models/DomainTransferStatus.php | 61 + src/Appwrite/Models/DomainsList.php | 59 + src/Appwrite/Models/Identity.php | 10 +- src/Appwrite/Models/OAuth2Apple.php | 14 +- src/Appwrite/Models/OAuth2Auth0.php | 19 +- src/Appwrite/Models/OAuth2Discord.php | 21 +- src/Appwrite/Models/OAuth2Github.php | 21 +- src/Appwrite/Models/OAuth2Google.php | 14 +- src/Appwrite/Models/OAuth2Kakao.php | 76 + src/Appwrite/Models/OAuth2Microsoft.php | 19 +- src/Appwrite/Models/OAuth2Okta.php | 19 +- src/Appwrite/Models/OAuth2Salesforce.php | 21 +- src/Appwrite/Models/OAuth2TikTok.php | 64 + src/Appwrite/Models/OAuth2Webflow.php | 64 + src/Appwrite/Models/OAuth2Zoho.php | 21 +- src/Appwrite/Models/Oauth2Introspection.php | 93 + src/Appwrite/Models/PlatformAndroid.php | 10 +- src/Appwrite/Models/PolicyPasswordPwned.php | 64 + .../Models/PolicyPasswordRotation.php | 59 + src/Appwrite/Models/Project.php | 12 + src/Appwrite/Models/Topic.php | 14 +- src/Appwrite/Models/User.php | 4 + src/Appwrite/Models/WafRuleBypass.php | 119 + src/Appwrite/Models/WafRuleChallenge.php | 134 + src/Appwrite/Models/WafRuleDeny.php | 119 + src/Appwrite/Models/WafRuleList.php | 54 + src/Appwrite/Models/WafRuleRateLimit.php | 144 ++ src/Appwrite/Models/WafRuleRedirect.php | 129 + src/Appwrite/Services/Account.php | 292 ++- src/Appwrite/Services/Avatars.php | 200 ++ src/Appwrite/Services/Databases.php | 6 +- src/Appwrite/Services/DocumentsDB.php | 6 +- src/Appwrite/Services/Domains.php | 2182 +++++++++++++++++ src/Appwrite/Services/Functions.php | 12 +- src/Appwrite/Services/Locale.php | 42 +- src/Appwrite/Services/Messaging.php | 116 +- src/Appwrite/Services/Oauth2.php | 49 + src/Appwrite/Services/Organization.php | 222 ++ src/Appwrite/Services/Project.php | 462 +++- src/Appwrite/Services/Sites.php | 12 +- src/Appwrite/Services/TablesDB.php | 6 +- src/Appwrite/Services/Teams.php | 6 +- src/Appwrite/Services/VectorsDB.php | 6 +- src/Appwrite/Services/Waf.php | 740 ++++++ tests/Appwrite/Services/AccountTest.php | 146 ++ tests/Appwrite/Services/AvatarsTest.php | 61 + tests/Appwrite/Services/DomainsTest.php | 1633 ++++++++++++ tests/Appwrite/Services/MessagingTest.php | 53 + tests/Appwrite/Services/Oauth2Test.php | 19 + tests/Appwrite/Services/OrganizationTest.php | 138 ++ tests/Appwrite/Services/ProjectTest.php | 521 +++- tests/Appwrite/Services/WafTest.php | 451 ++++ 234 files changed, 14103 insertions(+), 121 deletions(-) create mode 100644 docs/domains.md create mode 100644 docs/examples/account/create-email-verification-otp.md create mode 100644 docs/examples/account/create-id-token-session.md create mode 100644 docs/examples/account/create-recovery-otp.md create mode 100644 docs/examples/account/update-email-verification-otp.md create mode 100644 docs/examples/account/update-recovery-otp.md create mode 100644 docs/examples/avatars/delete-photo.md create mode 100644 docs/examples/avatars/update-photo.md create mode 100644 docs/examples/domains/create-preset-google-workspace.md create mode 100644 docs/examples/domains/create-preset-i-cloud.md create mode 100644 docs/examples/domains/create-preset-mailgun.md create mode 100644 docs/examples/domains/create-preset-outlook.md create mode 100644 docs/examples/domains/create-preset-proton-mail.md create mode 100644 docs/examples/domains/create-preset-zoho.md create mode 100644 docs/examples/domains/create-record-a.md create mode 100644 docs/examples/domains/create-record-aaaa.md create mode 100644 docs/examples/domains/create-record-alias.md create mode 100644 docs/examples/domains/create-record-caa.md create mode 100644 docs/examples/domains/create-record-cname.md create mode 100644 docs/examples/domains/create-record-https.md create mode 100644 docs/examples/domains/create-record-mx.md create mode 100644 docs/examples/domains/create-record-ns.md create mode 100644 docs/examples/domains/create-record-srv.md create mode 100644 docs/examples/domains/create-record-txt.md create mode 100644 docs/examples/domains/create.md create mode 100644 docs/examples/domains/delete-record.md create mode 100644 docs/examples/domains/delete.md create mode 100644 docs/examples/domains/get-preset-google-workspace.md create mode 100644 docs/examples/domains/get-preset-i-cloud.md create mode 100644 docs/examples/domains/get-preset-mailgun.md create mode 100644 docs/examples/domains/get-preset-outlook.md create mode 100644 docs/examples/domains/get-preset-proton-mail.md create mode 100644 docs/examples/domains/get-preset-zoho.md create mode 100644 docs/examples/domains/get-price.md create mode 100644 docs/examples/domains/get-record.md create mode 100644 docs/examples/domains/get-transfer-status.md create mode 100644 docs/examples/domains/get-zone.md create mode 100644 docs/examples/domains/get.md create mode 100644 docs/examples/domains/list-prices.md create mode 100644 docs/examples/domains/list-records.md create mode 100644 docs/examples/domains/list.md create mode 100644 docs/examples/domains/update-nameservers.md create mode 100644 docs/examples/domains/update-record-a.md create mode 100644 docs/examples/domains/update-record-aaaa.md create mode 100644 docs/examples/domains/update-record-alias.md create mode 100644 docs/examples/domains/update-record-caa.md create mode 100644 docs/examples/domains/update-record-cname.md create mode 100644 docs/examples/domains/update-record-https.md create mode 100644 docs/examples/domains/update-record-mx.md create mode 100644 docs/examples/domains/update-record-ns.md create mode 100644 docs/examples/domains/update-record-srv.md create mode 100644 docs/examples/domains/update-record-txt.md create mode 100644 docs/examples/domains/update-team.md create mode 100644 docs/examples/domains/update-zone.md create mode 100644 docs/examples/domains/verify-nameservers.md create mode 100644 docs/examples/messaging/create-appwrite-provider.md create mode 100644 docs/examples/messaging/update-appwrite-provider.md create mode 100644 docs/examples/oauth2/introspect.md create mode 100644 docs/examples/organization/create-ephemeral-project-key.md create mode 100644 docs/examples/organization/delete-project-key.md create mode 100644 docs/examples/organization/get-project-key.md create mode 100644 docs/examples/organization/list-project-keys.md create mode 100644 docs/examples/organization/update-project-key.md create mode 100644 docs/examples/project/create-environment.md create mode 100644 docs/examples/project/delete-environment.md create mode 100644 docs/examples/project/get-environment.md create mode 100644 docs/examples/project/list-environments.md create mode 100644 docs/examples/project/update-environment.md create mode 100644 docs/examples/project/update-o-auth-2-kakao.md create mode 100644 docs/examples/project/update-o-auth-2-tik-tok.md create mode 100644 docs/examples/project/update-o-auth-2-webflow.md create mode 100644 docs/examples/project/update-password-pwned-policy.md create mode 100644 docs/examples/project/update-password-rotation-policy.md create mode 100644 docs/examples/waf/create-bypass-rule.md create mode 100644 docs/examples/waf/create-challenge-rule.md create mode 100644 docs/examples/waf/create-deny-rule.md create mode 100644 docs/examples/waf/create-rate-limit-rule.md create mode 100644 docs/examples/waf/create-redirect-rule.md create mode 100644 docs/examples/waf/delete-rule.md create mode 100644 docs/examples/waf/get-rule.md create mode 100644 docs/examples/waf/list-rules.md create mode 100644 docs/examples/waf/update-bypass-rule.md create mode 100644 docs/examples/waf/update-challenge-rule.md create mode 100644 docs/examples/waf/update-deny-rule.md create mode 100644 docs/examples/waf/update-rate-limit-rule.md create mode 100644 docs/examples/waf/update-redirect-rule.md create mode 100644 docs/waf.md create mode 100644 src/Appwrite/Enums/DomainRegistrationType.php create mode 100644 src/Appwrite/Enums/DomainTransferStatusEnum.php create mode 100644 src/Appwrite/Enums/IdTokenProvider.php create mode 100644 src/Appwrite/Enums/OAuth2Auth0Prompt.php create mode 100644 src/Appwrite/Enums/OAuth2DiscordPrompt.php create mode 100644 src/Appwrite/Enums/OAuth2GithubPrompt.php create mode 100644 src/Appwrite/Enums/OAuth2KakaoPrompt.php create mode 100644 src/Appwrite/Enums/OAuth2MicrosoftPrompt.php create mode 100644 src/Appwrite/Enums/OAuth2OktaPrompt.php create mode 100644 src/Appwrite/Enums/OAuth2SalesforcePrompt.php create mode 100644 src/Appwrite/Enums/OAuth2ZohoPrompt.php create mode 100644 src/Appwrite/Enums/ProjectOAuth2Auth0Prompt.php create mode 100644 src/Appwrite/Enums/ProjectOAuth2DiscordPrompt.php create mode 100644 src/Appwrite/Enums/ProjectOAuth2GitHubPrompt.php create mode 100644 src/Appwrite/Enums/ProjectOAuth2KakaoPrompt.php create mode 100644 src/Appwrite/Enums/ProjectOAuth2MicrosoftPrompt.php create mode 100644 src/Appwrite/Enums/ProjectOAuth2OktaPrompt.php create mode 100644 src/Appwrite/Enums/ProjectOAuth2SalesforcePrompt.php create mode 100644 src/Appwrite/Enums/ProjectOAuth2ZohoPrompt.php create mode 100644 src/Appwrite/Enums/WafRuleAction.php create mode 100644 src/Appwrite/Models/Account.php create mode 100644 src/Appwrite/Models/DnsRecord.php create mode 100644 src/Appwrite/Models/DnsRecordsList.php create mode 100644 src/Appwrite/Models/Domain.php create mode 100644 src/Appwrite/Models/DomainPrice.php create mode 100644 src/Appwrite/Models/DomainPricesList.php create mode 100644 src/Appwrite/Models/DomainTransferStatus.php create mode 100644 src/Appwrite/Models/DomainsList.php create mode 100644 src/Appwrite/Models/OAuth2Kakao.php create mode 100644 src/Appwrite/Models/OAuth2TikTok.php create mode 100644 src/Appwrite/Models/OAuth2Webflow.php create mode 100644 src/Appwrite/Models/Oauth2Introspection.php create mode 100644 src/Appwrite/Models/PolicyPasswordPwned.php create mode 100644 src/Appwrite/Models/PolicyPasswordRotation.php create mode 100644 src/Appwrite/Models/WafRuleBypass.php create mode 100644 src/Appwrite/Models/WafRuleChallenge.php create mode 100644 src/Appwrite/Models/WafRuleDeny.php create mode 100644 src/Appwrite/Models/WafRuleList.php create mode 100644 src/Appwrite/Models/WafRuleRateLimit.php create mode 100644 src/Appwrite/Models/WafRuleRedirect.php create mode 100644 src/Appwrite/Services/Domains.php create mode 100644 src/Appwrite/Services/Waf.php create mode 100644 tests/Appwrite/Services/DomainsTest.php create mode 100644 tests/Appwrite/Services/WafTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 844d769b..aa3b2ea3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Change Log +## 30.4.0 + +* Added: `domains` service to register, transfer and manage domains, DNS records, email presets and zones +* Added: `waf` service with bypass, challenge, deny, rate-limit and redirect rules +* Added: `account.createEmailVerificationOTP`, `updateEmailVerificationOTP`, `createRecoveryOTP` and `updateRecoveryOTP` +* Added: `account.createIdTokenSession` and `Identity.providerIdToken` +* Added: `oauth2.introspect` +* Added: project environments with `project.createEnvironment`, `getEnvironment`, `listEnvironments`, `updateEnvironment` and `deleteEnvironment` +* Added: `organization.createEphemeralProjectKey`, `listProjectKeys`, `getProjectKey`, `updateProjectKey` and `deleteProjectKey` +* Added: Kakao, TikTok and Webflow OAuth2 providers with `project.updateOAuth2Kakao`, `updateOAuth2TikTok` and `updateOAuth2Webflow` +* Added: optional `prompt` on the Auth0, Discord, GitHub, Microsoft, Okta, Salesforce and Zoho OAuth2 settings, and native client IDs on Apple and Google +* Added: `project.updatePasswordPwnedPolicy`, `project.updatePasswordRotationPolicy` and `User.passwordPwned` +* Added: `messaging.createAppwriteProvider` and `messaging.updateAppwriteProvider` +* Added: optional `replyToEmail` and `replyToName` on email messages, `channelId` on push messages, and `qos` and `expiry` on topics +* Added: `avatars.updatePhoto` and `avatars.deletePhoto` +* Added: optional `duration` on `account.createEmailPasswordSession`, `current` on `account.deleteSessions`, `membershipId` on `teams.createMembership` and `fingerprints` on Android platforms +* Added: optional `total` on the locale, transaction, runtime, specification and framework lists +* Added: `dart-3.13` and `flutter-3.47` runtimes, the `jaspr` framework, the `trigram` index type, `auto` image gravity, the `dedicatedDatabase` proxy rule resource type, OTP email templates and new key scopes +* Added: optional fields on `BillingPlan`, `DedicatedDatabase`, `DedicatedDatabaseSpecification`, `Project` and `Topic`, and `free` and `start` in `BillingPlanGroup` + ## 30.3.1 * Fixed: added `ProjectAuthMethodId::PASSKEY()`, so `project.updateAuthMethod` can enable passkeys diff --git a/docs/account.md b/docs/account.md index 70ae607b..80e592a5 100644 --- a/docs/account.md +++ b/docs/account.md @@ -541,12 +541,51 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ | password | string | New user password. Must be between 8 and 256 chars. | | +```http request +POST https://cloud.appwrite.io/v1/account/recovery/otp +``` + +** Use this endpoint to send a 6-digit password recovery code to the user's email address. Unlike [createRecovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery), this method requires no redirect URL, which makes it suitable for mobile and desktop apps that cannot host a recovery page. Learn more about how to [complete the recovery process](https://appwrite.io/docs/references/cloud/client-web/account#updateRecoveryOTP). The code sent to the user's email address is valid for 15 minutes. + +Enable the **phrase** parameter to include a randomly generated security phrase in both the email and the response. Showing that phrase in your app lets the user confirm the email genuinely came from your request, which helps protect against phishing. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| email | string | User email. | | +| phrase | boolean | Toggle for security phrase. If enabled, email will be sent with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow. | | + + +```http request +PUT https://cloud.appwrite.io/v1/account/recovery/otp +``` + +** Use this endpoint to complete the user password recovery process using the 6-digit code that was emailed by [createRecoveryOTP](https://appwrite.io/docs/references/cloud/client-web/account#createRecoveryOTP). Pass the **userId** of the user along with the **secret** code from the email and the new **password** to set. If confirmed, this route will return a 200 status code, the code is consumed and the user's password is updated. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | User ID. | | +| secret | string | Valid recovery OTP code. | | +| password | string | New user password. Must be between 8 and 256 chars. | | + + ```http request GET https://cloud.appwrite.io/v1/account/sessions ``` ** Get the list of active sessions across different devices for the currently logged in user. ** +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | + ```http request DELETE https://cloud.appwrite.io/v1/account/sessions @@ -554,6 +593,12 @@ DELETE https://cloud.appwrite.io/v1/account/sessions ** Delete all sessions from the user account and remove any sessions cookies from the end client. ** +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| current | boolean | Delete the current session too. Use false to sign out of every other session while staying signed in on this one. | 1 | + ```http request POST https://cloud.appwrite.io/v1/account/sessions/anonymous @@ -576,6 +621,36 @@ A user is limited to 10 active sessions at a time by default. [Learn more about | --- | --- | --- | --- | | email | string | User email. | | | password | string | User password. Must be at least 8 chars. | | +| duration | integer | Session length in seconds. Minimum is 60 seconds, and it cannot exceed the project maximum session length. Defaults to the project maximum session length. | | + + +```http request +POST https://cloud.appwrite.io/v1/account/sessions/id-token +``` + +** Allow the user to login to their account using an OpenID Connect ID token obtained natively from the OAuth2 provider, for example via Google Credential Manager on Android or Sign in with Apple on iOS. No browser or redirect is involved: the ID token is verified against the provider's published signing keys and a session is created in a single request. + +Native sign-in is switched on per provider with its nativeEnabled setting. It is independent of the browser-based flow's enabled setting, which has no effect on this endpoint. The token's audience must match the provider's configured client ID or one of its native client IDs; tokens issued for any other client ID are rejected. For Sign in with Apple, register your app's bundle ID as a native client ID. For Google, the web client ID used by Credential Manager is usually the configured client ID; add your Android and iOS client IDs as native client IDs if your app requests tokens for them. + +Pass the raw nonce used when requesting the ID token so it can be validated against the token's nonce claim. When signing in with Apple, the nonce is required: hash it with SHA-256 before passing it to the Apple SDK, and send the raw value here - Apple tokens requested without a nonce are rejected. For Google the nonce is optional: it is validated whenever the token carries one, and ignored when the provider issued the token without one. Apple only returns the user's name on the first authorization, and never inside the ID token - capture it on the client and pass it via the name parameter. + +If there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the verified email received from the provider and attach the new session to the existing user. If no matching user is found - the server will create a new user. + +This flow does not return provider refresh tokens. You may pass an access token the provider handed your client, along with its lifetime, to store it on the session - but Appwrite cannot renew it once it expires. If your app needs long-lived access to provider APIs, use the browser-based OAuth2 flow instead. + +A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| provider | string | OAuth2 provider that issued the ID token. Currently, supported providers are: apple, google. | | +| idToken | string | OpenID Connect ID token (JWT) obtained natively from the provider, for example via Google Credential Manager or Sign in with Apple. | | +| nonce | string | Raw nonce used when requesting the ID token. Required for Apple, and whenever the token carries a nonce claim, which must match it. Ignored when the provider issued the token without a nonce. | | +| accessToken | string | Provider access token to store alongside the session for calling provider APIs. Never used for authentication. | | +| accessTokenExpiry | integer | Seconds until the provider access token expires, as reported by the provider. Stored so clients can tell when the stored token goes stale. | 0 | +| name | string | User name. Only used when creating a new user and the ID token has no name claim, such as on the first Sign in with Apple authorization. | | ```http request @@ -821,6 +896,37 @@ PUT https://cloud.appwrite.io/v1/account/verifications/email | secret | string | Valid verification token. | | +```http request +POST https://cloud.appwrite.io/v1/account/verifications/email/otp +``` + +** Use this endpoint to send a 6-digit verification code to the currently logged in user's email address. Unlike [createEmailVerification](https://appwrite.io/docs/references/cloud/client-web/account#createEmailVerification), this method requires no redirect URL, which makes it suitable for mobile and desktop apps that cannot host a verification page. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateEmailVerificationOTP). The code sent to the user's email address is valid for 15 minutes. + +Enable the **phrase** parameter to include a randomly generated security phrase in both the email and the response. Showing that phrase in your app lets the user confirm the email genuinely came from your request, which helps protect against phishing. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| phrase | boolean | Toggle for security phrase. If enabled, email will be sent with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow. | | + + +```http request +PUT https://cloud.appwrite.io/v1/account/verifications/email/otp +``` + +** Use this endpoint to complete the user email verification process using the 6-digit code that was emailed by [createEmailVerificationOTP](https://appwrite.io/docs/references/cloud/client-web/account#createEmailVerificationOTP). Pass the **userId** of the user being verified along with the **secret** code from the email. If confirmed, this route will return a 200 status code and the code is consumed. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | User ID. | | +| secret | string | Valid verification OTP code. | | + + ```http request POST https://cloud.appwrite.io/v1/account/verifications/phone ``` diff --git a/docs/avatars.md b/docs/avatars.md index 367d29f6..7b9377d2 100644 --- a/docs/avatars.md +++ b/docs/avatars.md @@ -134,6 +134,26 @@ Passing `userId` — `current()` for the authenticated user — resolves the pho | name | string | Name to render initials from instead of the user's own name. Max length: 128 chars. | | +```http request +PUT https://cloud.appwrite.io/v1/avatars/photo +``` + +** Update the profile photo of the currently authenticated user. The uploaded image takes priority over every other photo source, including OAuth2 identity photos, Gravatar, and Libravatar. Updating an already customized photo replaces it. The image must be at most 5MB and is sent in a single request. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| file | file | Binary image file of at most 5MB. Allowed file types are png, jpg, jpeg, and webp. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/avatars/photo +``` + +** Delete the profile photo of the currently authenticated user and store the built-in static placeholder in its place. The placeholder is the user's photo from then on, so it takes priority over every other photo source — OAuth2 identity photos, Gravatar, Libravatar, and initials — until a new photo is uploaded with avatars.updatePhoto. ** + + ```http request GET https://cloud.appwrite.io/v1/avatars/qr ``` diff --git a/docs/databases.md b/docs/databases.md index 4915ffbc..1b1f7bf6 100644 --- a/docs/databases.md +++ b/docs/databases.md @@ -43,6 +43,7 @@ GET https://cloud.appwrite.io/v1/databases/transactions | 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). | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request diff --git a/docs/documentsdb.md b/docs/documentsdb.md index 49e3a09a..4f650b12 100644 --- a/docs/documentsdb.md +++ b/docs/documentsdb.md @@ -52,6 +52,7 @@ GET https://cloud.appwrite.io/v1/documentsdb/transactions | 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). | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request diff --git a/docs/domains.md b/docs/domains.md new file mode 100644 index 00000000..19b339cd --- /dev/null +++ b/docs/domains.md @@ -0,0 +1,794 @@ +# Domains Service + + +```http request +GET https://cloud.appwrite.io/v1/domains +``` + +** List all domains registered for this project. This endpoint supports pagination. ** + +### 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 attributes such as domain name, teamInternalId, expiration, etc. | [] | +| search | string | Search term to filter your list results. Max length: 256 chars. | | + + +```http request +POST https://cloud.appwrite.io/v1/domains +``` + +** Create a new domain. Before creating a domain, you need to ensure that your DNS provider is properly configured. After creating the domain, you can use the verification endpoint to check if the domain is ready to be used. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | Team unique ID. | | +| domain | string | Domain name (e.g. "example.com"). | | + + +```http request +GET https://cloud.appwrite.io/v1/domains/price +``` + +** Get the registration price for a domain name. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domain | string | **Required** Domain name to get price for. | | +| periodYears | integer | Number of years to calculate the domain price for. Must be at least 1. | 1 | +| registrationType | string | Type of registration pricing to fetch. Allowed values: new, transfer, renewal, trade. | new | + + +```http request +GET https://cloud.appwrite.io/v1/domains/prices +``` + +** Check availability and get the requested registration price for one or more domain names. Availability is resolved for all domains in a single registrar lookup. Unavailable domains have a null price for new registrations, but can still be priced for renewal, transfer, or trade. Every priced domain also carries its renewal price for the same period, so a separate renewal lookup is not needed. A domain whose price could not be resolved, for example because its TLD is not supported, is returned with a null price. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domains | array | **Required** Domain names to check availability and price for. Maximum of 50 domains per request. | | +| periodYears | integer | Number of years to calculate the domain price for. Must be at least 1. | 1 | +| registrationType | string | Type of registration pricing to fetch. Allowed values: new, transfer, renewal, trade. | new | + + +```http request +GET https://cloud.appwrite.io/v1/domains/{domainId} +``` + +** Get a domain by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/domains/{domainId} +``` + +** Delete a domain by its unique ID. This endpoint can be used to delete a domain from your project. +Once deleted, the domain will no longer be available for use and all associated resources will be removed. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/domains/{domainId}/nameservers +``` + +** Update the registrar nameservers for the given domain. When nameservers are not provided, +the domain will be updated to use Appwrite nameservers. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| nameservers | array | Nameservers to set for the domain. Defaults to Appwrite nameservers when omitted. | [] | + + +```http request +PATCH https://cloud.appwrite.io/v1/domains/{domainId}/nameservers/verification +``` + +** Verify which NS records are used and update the domain accordingly. This will check the domain's +nameservers and update the domain's status based on whether the nameservers match the expected +Appwrite nameservers. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/domains/{domainId}/presets/google-workspace +``` + +** List Google Workspace DNS records. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | + + +```http request +POST https://cloud.appwrite.io/v1/domains/{domainId}/presets/google-workspace +``` + +** Add Google Workspace DNS records to the domain. This will create the required MX records +for Google Workspace email hosting. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/domains/{domainId}/presets/icloud +``` + +** List iCloud DNS records. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | + + +```http request +POST https://cloud.appwrite.io/v1/domains/{domainId}/presets/icloud +``` + +** Add iCloud DNS records to the domain. This will create the required MX and SPF records +for using iCloud email services with your domain. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/domains/{domainId}/presets/mailgun +``` + +** List Mailgun DNS records. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | + + +```http request +POST https://cloud.appwrite.io/v1/domains/{domainId}/presets/mailgun +``` + +** Add Mailgun DNS records to the domain. This endpoint will create the required DNS records +for Mailgun in the specified domain. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/domains/{domainId}/presets/outlook +``` + +** List Outlook DNS records. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | + + +```http request +POST https://cloud.appwrite.io/v1/domains/{domainId}/presets/outlook +``` + +** Add Outlook DNS records to the domain. This will create the required MX records +for setting up Outlook email hosting for your domain. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/domains/{domainId}/presets/proton-mail +``` + +** List ProtonMail DNS records. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | + + +```http request +POST https://cloud.appwrite.io/v1/domains/{domainId}/presets/proton-mail +``` + +** Add ProtonMail DNS records to the domain. This will create the required MX records +for using ProtonMail with your custom domain. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/domains/{domainId}/presets/zoho +``` + +** List Zoho DNS records. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | + + +```http request +POST https://cloud.appwrite.io/v1/domains/{domainId}/presets/zoho +``` + +** Add Zoho Mail DNS records to the domain. This will create the required MX records +for setting up Zoho Mail on your domain. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/domains/{domainId}/records +``` + +** List DNS records for a given domain. You can use this endpoint to list all the DNS records +associated with your domain. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| queries | array | Array of query strings generated using the Query class provided by the SDK. You may filter on attributes such as type, name, value, etc. Maximum of 100 queries are allowed, each 4096 characters long. | [] | + + +```http request +POST https://cloud.appwrite.io/v1/domains/{domainId}/records/a +``` + +** Create a new A record for the given domain. A records are used to point a domain name +to an IPv4 address. The record value should be a valid IPv4 address. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| name | string | Record name (subdomain). | | +| value | string | IPv4 address for this A record. | | +| ttl | integer | Time to live, in seconds. Must be between 1 and 2147483647. | | +| comment | string | A comment explaining what this record is for. | | + + +```http request +PUT https://cloud.appwrite.io/v1/domains/{domainId}/records/a/{recordId} +``` + +** Update an existing A record for the given domain. This endpoint allows you to modify +the properties of an A record including its name (subdomain), IPv4 address, TTL, +and optional comment. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| recordId | string | **Required** DNS record unique ID. | | +| name | string | Record name (subdomain). | | +| value | string | IPv4 address for this A record. | | +| ttl | integer | Time to live, in seconds. Must be between 1 and 2147483647. | | +| comment | string | A comment explaining what this record is for. | | + + +```http request +POST https://cloud.appwrite.io/v1/domains/{domainId}/records/aaaa +``` + +** Create a new AAAA record for the given domain. This endpoint allows you to add a new IPv6 DNS record +to your domain. The record will be used to point a hostname to an IPv6 address. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| name | string | Record name (subdomain). | | +| value | string | IPv6 address for this AAAA record. | | +| ttl | integer | Time to live, in seconds. Must be between 1 and 2147483647. | | +| comment | string | A comment explaining what this record is for. | | + + +```http request +PUT https://cloud.appwrite.io/v1/domains/{domainId}/records/aaaa/{recordId} +``` + +** Update an existing AAAA record for the given domain. This endpoint allows you to modify +the properties of an existing AAAA record, including its name (subdomain), IPv6 address, +TTL, and optional comment. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| recordId | string | **Required** DNS record unique ID. | | +| name | string | Record name (subdomain). | | +| value | string | IPv6 address for this AAAA record. | | +| ttl | integer | Time to live, in seconds. Must be between 1 and 2147483647. | | +| comment | string | A comment for this record. | | + + +```http request +POST https://cloud.appwrite.io/v1/domains/{domainId}/records/alias +``` + +** Create a new ALIAS record for the given domain. This record type can be used to point your domain +to another domain name that will serve as an alias. This is particularly useful when you want to +map your domain to a target domain that may change its IP address. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| name | string | Record name. | | +| value | string | Target domain for this ALIAS record. | | +| ttl | integer | Time to live, in seconds. Must be between 1 and 2147483647. | | +| comment | string | A comment for this record. | | + + +```http request +PUT https://cloud.appwrite.io/v1/domains/{domainId}/records/alias/{recordId} +``` + +** Update an existing ALIAS record for the specified domain. This endpoint allows you to modify +the properties of an existing ALIAS record including its name, target domain, TTL, and comment. + +The ALIAS record type is similar to a CNAME record but can be used at the zone apex (root domain). +It provides a way to map one domain name to another. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| recordId | string | **Required** DNS record unique ID. | | +| name | string | Record name. | | +| value | string | Target domain for this ALIAS record. | | +| ttl | integer | Time to live, in seconds. Must be between 1 and 2147483647. | | +| comment | string | A comment for this record. | | + + +```http request +POST https://cloud.appwrite.io/v1/domains/{domainId}/records/caa +``` + +** Create a new CAA record for the given domain. CAA records are used to specify which +Certificate Authorities (CAs) are allowed to issue SSL/TLS certificates for your domain. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| name | string | Record name. | | +| value | string | CAA value (e.g. issuer domain). | | +| ttl | integer | Time to live, in seconds. Must be between 1 and 2147483647. | | +| comment | string | A comment for this record. | | + + +```http request +PUT https://cloud.appwrite.io/v1/domains/{domainId}/records/caa/{recordId} +``` + +** Update an existing CAA record for the given domain. A CAA (Certification Authority Authorization) +record is used to specify which certificate authorities (CAs) are authorized to issue certificates +for a domain. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| recordId | string | **Required** DNS record unique ID. | | +| name | string | Record name. | | +| value | string | CAA value (e.g. issuer domain). | | +| ttl | integer | Time to live, in seconds. Must be between 1 and 2147483647. | | +| comment | string | A comment for this record. | | + + +```http request +POST https://cloud.appwrite.io/v1/domains/{domainId}/records/cname +``` + +** Create a new CNAME record for the given domain. + +A CNAME record maps a subdomain to another domain name, allowing you to create aliases +for your domain. For example, you can create a CNAME record to point 'blog.example.com' +to 'example.wordpress.com'. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| name | string | Record name (subdomain). | | +| value | string | Canonical target for this CNAME record. | | +| ttl | integer | Time to live, in seconds. Must be between 1 and 2147483647. | | +| comment | string | A comment for this record. | | + + +```http request +PUT https://cloud.appwrite.io/v1/domains/{domainId}/records/cname/{recordId} +``` + +** Update an existing CNAME record for the given domain. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| recordId | string | **Required** DNS record unique ID. | | +| name | string | Record name (subdomain). | | +| value | string | Canonical target for this CNAME record. | | +| ttl | integer | Time to live, in seconds. Must be between 1 and 2147483647. | | +| comment | string | A comment for this record. | | + + +```http request +POST https://cloud.appwrite.io/v1/domains/{domainId}/records/https +``` + +** Create a new HTTPS record for the given domain. This record is used to configure HTTPS +settings for your domain, enabling secure communication over SSL/TLS. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| name | string | Record name (subdomain). | | +| value | string | Target for the HTTPS record. | | +| ttl | integer | Time to live, in seconds. Must be between 1 and 2147483647. | | +| comment | string | A comment for this record. | | + + +```http request +PUT https://cloud.appwrite.io/v1/domains/{domainId}/records/https/{recordId} +``` + +** Update an existing HTTPS record for the given domain. This endpoint allows you to modify +the properties of an HTTPS record associated with your domain, including the name (subdomain), +target value, TTL, and optional comment. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| recordId | string | **Required** DNS record unique ID. | | +| name | string | Record name (subdomain). | | +| value | string | Target for the HTTPS record. | | +| ttl | integer | Time to live, in seconds. Must be between 1 and 2147483647. | | +| comment | string | A comment for this record. | | + + +```http request +POST https://cloud.appwrite.io/v1/domains/{domainId}/records/mx +``` + +** Create a new MX record for the given domain. MX records are used to define the mail servers responsible +for accepting email messages for the domain. Multiple MX records can be created with different priorities. +The priority parameter determines the order in which mail servers are used, with lower values indicating +higher priority. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| name | string | Record name (subdomain). | | +| value | string | Mail server domain for this MX record. | | +| ttl | integer | Time to live, in seconds. Must be between 1 and 2147483647. | | +| priority | integer | MX priority. Lower values are tried first. | | +| comment | string | A comment for this record. | | + + +```http request +PUT https://cloud.appwrite.io/v1/domains/{domainId}/records/mx/{recordId} +``` + +** Update an existing MX record for the given domain. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| recordId | string | **Required** DNS record unique ID. | | +| name | string | Record name (subdomain). | | +| value | string | Mail server domain for this MX record. | | +| ttl | integer | Time to live, in seconds. Must be between 1 and 2147483647. | | +| priority | integer | MX priority. Lower values are tried first. | | +| comment | string | A comment for this record. | | + + +```http request +POST https://cloud.appwrite.io/v1/domains/{domainId}/records/ns +``` + +** Create a new NS record for the given domain. NS records specify the nameservers that are used +to resolve the domain name to IP addresses. Each domain can have multiple NS records. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| name | string | Record name (subdomain). | | +| value | string | Nameserver target for this NS record. | | +| ttl | integer | Time to live, in seconds. Must be between 1 and 2147483647. | | +| comment | string | A comment for this record. | | + + +```http request +PUT https://cloud.appwrite.io/v1/domains/{domainId}/records/ns/{recordId} +``` + +** Update an existing NS record for the given domain. This endpoint allows you to modify +the properties of an NS (nameserver) record associated with your domain. You can update +the record name (subdomain), target nameserver value, TTL, and add or modify comments +for better record management. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| recordId | string | **Required** DNS record unique ID. | | +| name | string | Record name (subdomain). | | +| value | string | Nameserver target for this NS record. | | +| ttl | integer | Time to live, in seconds. Must be between 1 and 2147483647. | | +| comment | string | A comment for this record. | | + + +```http request +POST https://cloud.appwrite.io/v1/domains/{domainId}/records/srv +``` + +** Create a new SRV record for the given domain. SRV records are used to define the location +of servers for specific services. For example, they can be used to specify which server +handles a specific service like SIP or XMPP for the domain. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| name | string | Record name (service name). | | +| value | string | Target hostname for this SRV record. | | +| ttl | integer | Time to live, in seconds. Must be between 1 and 2147483647. | | +| priority | integer | Record priority. Lower values are tried first. | | +| weight | integer | Record weight, used to share load between targets of equal priority. | | +| port | integer | Port number for the service. | | +| comment | string | A comment for this record. | | + + +```http request +PUT https://cloud.appwrite.io/v1/domains/{domainId}/records/srv/{recordId} +``` + +** Update an existing SRV record for the given domain. + +Required parameters: +- domainId: Domain unique ID +- recordId: DNS record unique ID +- name: Record name (service name) +- value: Target hostname for this SRV record +- ttl: Time to live, in seconds +- priority: Record priority +- weight: Record weight +- port: Port number for the service + +Optional parameters: +- comment: A comment for this record ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| recordId | string | **Required** DNS record unique ID. | | +| name | string | Record name (service name). | | +| value | string | Target hostname for this SRV record. | | +| ttl | integer | Time to live, in seconds. Must be between 1 and 2147483647. | | +| priority | integer | Record priority. Lower values are tried first. | | +| weight | integer | Record weight, used to share load between targets of equal priority. | | +| port | integer | Port number for the service. | | +| comment | string | A comment for this record. | | + + +```http request +POST https://cloud.appwrite.io/v1/domains/{domainId}/records/txt +``` + +** Create a new TXT record for the given domain. TXT records can be used +to provide additional information about your domain, such as domain +verification records, SPF records, or DKIM records. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| name | string | Record name (subdomain) for the TXT record. | | +| value | string | TXT record value. | | +| ttl | integer | Time to live, in seconds. Must be between 1 and 2147483647. | | +| comment | string | A comment for this record. | | + + +```http request +PUT https://cloud.appwrite.io/v1/domains/{domainId}/records/txt/{recordId} +``` + +** Update an existing TXT record for the given domain. + +Update the TXT record details for a specific domain by providing the domain ID, +record ID, and the new record configuration including name, value, TTL, and an optional comment. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| recordId | string | **Required** DNS record unique ID. | | +| name | string | Record name (subdomain) for the TXT record. | | +| value | string | TXT record value. | | +| ttl | integer | Time to live, in seconds. Must be between 1 and 2147483647. | | +| comment | string | A comment for this record. | | + + +```http request +GET https://cloud.appwrite.io/v1/domains/{domainId}/records/{recordId} +``` + +** Get a single DNS record for a given domain by record ID. + +This endpoint allows you to retrieve a specific DNS record associated with a domain +using its unique identifier. The record contains information about the DNS configuration +such as type, value, and TTL settings. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| recordId | string | **Required** DNS record unique ID. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/domains/{domainId}/records/{recordId} +``` + +** Delete a DNS record for the given domain. This endpoint allows you to delete an existing DNS record +from a specific domain. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| recordId | string | **Required** DNS record unique ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/domains/{domainId}/team +``` + +** Update the team ID for a specific domain. The caller must administer the current +team and be an owner of the destination team. + +Updating the team ID will transfer ownership and access control of the domain +and all its DNS records to the new team. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| teamId | string | New team unique ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/domains/{domainId}/transfers/status +``` + +** Retrieve the current transfer status for a domain. Returns the status, an optional reason, and a timestamp of the last status change. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/domains/{domainId}/zone +``` + +** Retrieve the DNS zone file for the given domain. This endpoint will return the DNS +zone file in a standardized format that can be used to configure DNS servers. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | + + +```http request +PUT https://cloud.appwrite.io/v1/domains/{domainId}/zone +``` + +** Update the DNS zone for the given domain using the provided zone file content. +All parsed records are imported and then the main domain document is returned. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| domainId | string | **Required** Domain unique ID. | | +| content | string | DNS zone file content as a string. | | + diff --git a/docs/examples/account/create-email-password-session.md b/docs/examples/account/create-email-password-session.md index b462ef80..44770741 100644 --- a/docs/examples/account/create-email-password-session.md +++ b/docs/examples/account/create-email-password-session.md @@ -13,6 +13,7 @@ $account = new Account($client); $result = $account->createEmailPasswordSession( email: 'email@example.com', - password: 'password' + password: 'password', + duration: 60 // optional ); ``` diff --git a/docs/examples/account/create-email-verification-otp.md b/docs/examples/account/create-email-verification-otp.md new file mode 100644 index 00000000..c70bbaf2 --- /dev/null +++ b/docs/examples/account/create-email-verification-otp.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->createEmailVerificationOTP( + phrase: false // optional +); +``` diff --git a/docs/examples/account/create-id-token-session.md b/docs/examples/account/create-id-token-session.md new file mode 100644 index 00000000..c4873827 --- /dev/null +++ b/docs/examples/account/create-id-token-session.md @@ -0,0 +1,23 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->createIdTokenSession( + provider: IdTokenProvider::APPLE(), + idToken: '', + nonce: '', // optional + accessToken: '', // optional + accessTokenExpiry: 0, // optional + name: '' // optional +); +``` diff --git a/docs/examples/account/create-recovery-otp.md b/docs/examples/account/create-recovery-otp.md new file mode 100644 index 00000000..1da306f5 --- /dev/null +++ b/docs/examples/account/create-recovery-otp.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->createRecoveryOTP( + email: 'email@example.com', + phrase: false // optional +); +``` diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md index 7886fabf..e5ce7f23 100644 --- a/docs/examples/account/delete-sessions.md +++ b/docs/examples/account/delete-sessions.md @@ -11,5 +11,7 @@ $client = (new Client()) $account = new Account($client); -$result = $account->deleteSessions(); +$result = $account->deleteSessions( + current: false // optional +); ``` diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md index 9c42f8ca..a737fc74 100644 --- a/docs/examples/account/list-sessions.md +++ b/docs/examples/account/list-sessions.md @@ -11,5 +11,7 @@ $client = (new Client()) $account = new Account($client); -$result = $account->listSessions(); +$result = $account->listSessions( + total: false // optional +); ``` diff --git a/docs/examples/account/update-email-verification-otp.md b/docs/examples/account/update-email-verification-otp.md new file mode 100644 index 00000000..f70bd592 --- /dev/null +++ b/docs/examples/account/update-email-verification-otp.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateEmailVerificationOTP( + userId: '', + secret: '' +); +``` diff --git a/docs/examples/account/update-recovery-otp.md b/docs/examples/account/update-recovery-otp.md new file mode 100644 index 00000000..bd3f2af3 --- /dev/null +++ b/docs/examples/account/update-recovery-otp.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateRecoveryOTP( + userId: '', + secret: '', + password: 'password' +); +``` diff --git a/docs/examples/avatars/delete-photo.md b/docs/examples/avatars/delete-photo.md new file mode 100644 index 00000000..f6e300b1 --- /dev/null +++ b/docs/examples/avatars/delete-photo.md @@ -0,0 +1,15 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$avatars = new Avatars($client); + +$result = $avatars->deletePhoto(); +``` diff --git a/docs/examples/avatars/update-photo.md b/docs/examples/avatars/update-photo.md new file mode 100644 index 00000000..c031ea7f --- /dev/null +++ b/docs/examples/avatars/update-photo.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$avatars = new Avatars($client); + +$result = $avatars->updatePhoto( + file: InputFile::withPath('file.png') +); +``` diff --git a/docs/examples/databases/list-transactions.md b/docs/examples/databases/list-transactions.md index 97cb6abd..1c2ec60a 100644 --- a/docs/examples/databases/list-transactions.md +++ b/docs/examples/databases/list-transactions.md @@ -12,6 +12,7 @@ $client = (new Client()) $databases = new Databases($client); $result = $databases->listTransactions( - queries: [] // optional + queries: [], // optional + total: false // optional ); ``` diff --git a/docs/examples/documentsdb/list-transactions.md b/docs/examples/documentsdb/list-transactions.md index f154df8e..988d867a 100644 --- a/docs/examples/documentsdb/list-transactions.md +++ b/docs/examples/documentsdb/list-transactions.md @@ -12,6 +12,7 @@ $client = (new Client()) $documentsDB = new DocumentsDB($client); $result = $documentsDB->listTransactions( - queries: [] // optional + queries: [], // optional + total: false // optional ); ``` diff --git a/docs/examples/domains/create-preset-google-workspace.md b/docs/examples/domains/create-preset-google-workspace.md new file mode 100644 index 00000000..fc372d93 --- /dev/null +++ b/docs/examples/domains/create-preset-google-workspace.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->createPresetGoogleWorkspace( + domainId: '' +); +``` diff --git a/docs/examples/domains/create-preset-i-cloud.md b/docs/examples/domains/create-preset-i-cloud.md new file mode 100644 index 00000000..13b32386 --- /dev/null +++ b/docs/examples/domains/create-preset-i-cloud.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->createPresetICloud( + domainId: '' +); +``` diff --git a/docs/examples/domains/create-preset-mailgun.md b/docs/examples/domains/create-preset-mailgun.md new file mode 100644 index 00000000..e8383ba5 --- /dev/null +++ b/docs/examples/domains/create-preset-mailgun.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->createPresetMailgun( + domainId: '' +); +``` diff --git a/docs/examples/domains/create-preset-outlook.md b/docs/examples/domains/create-preset-outlook.md new file mode 100644 index 00000000..55124396 --- /dev/null +++ b/docs/examples/domains/create-preset-outlook.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->createPresetOutlook( + domainId: '' +); +``` diff --git a/docs/examples/domains/create-preset-proton-mail.md b/docs/examples/domains/create-preset-proton-mail.md new file mode 100644 index 00000000..80444bee --- /dev/null +++ b/docs/examples/domains/create-preset-proton-mail.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->createPresetProtonMail( + domainId: '' +); +``` diff --git a/docs/examples/domains/create-preset-zoho.md b/docs/examples/domains/create-preset-zoho.md new file mode 100644 index 00000000..3a481b3a --- /dev/null +++ b/docs/examples/domains/create-preset-zoho.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->createPresetZoho( + domainId: '' +); +``` diff --git a/docs/examples/domains/create-record-a.md b/docs/examples/domains/create-record-a.md new file mode 100644 index 00000000..d1dfed17 --- /dev/null +++ b/docs/examples/domains/create-record-a.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->createRecordA( + domainId: '', + name: '', + value: '', + ttl: 1, + comment: '' // optional +); +``` diff --git a/docs/examples/domains/create-record-aaaa.md b/docs/examples/domains/create-record-aaaa.md new file mode 100644 index 00000000..9f299544 --- /dev/null +++ b/docs/examples/domains/create-record-aaaa.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->createRecordAAAA( + domainId: '', + name: '', + value: '', + ttl: 1, + comment: '' // optional +); +``` diff --git a/docs/examples/domains/create-record-alias.md b/docs/examples/domains/create-record-alias.md new file mode 100644 index 00000000..157dbade --- /dev/null +++ b/docs/examples/domains/create-record-alias.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->createRecordAlias( + domainId: '', + name: '', + value: '', + ttl: 1, + comment: '' // optional +); +``` diff --git a/docs/examples/domains/create-record-caa.md b/docs/examples/domains/create-record-caa.md new file mode 100644 index 00000000..12b71122 --- /dev/null +++ b/docs/examples/domains/create-record-caa.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->createRecordCAA( + domainId: '', + name: '', + value: '', + ttl: 1, + comment: '' // optional +); +``` diff --git a/docs/examples/domains/create-record-cname.md b/docs/examples/domains/create-record-cname.md new file mode 100644 index 00000000..c0ccb3bf --- /dev/null +++ b/docs/examples/domains/create-record-cname.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->createRecordCNAME( + domainId: '', + name: '', + value: '', + ttl: 1, + comment: '' // optional +); +``` diff --git a/docs/examples/domains/create-record-https.md b/docs/examples/domains/create-record-https.md new file mode 100644 index 00000000..6736edb5 --- /dev/null +++ b/docs/examples/domains/create-record-https.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->createRecordHTTPS( + domainId: '', + name: '', + value: '', + ttl: 1, + comment: '' // optional +); +``` diff --git a/docs/examples/domains/create-record-mx.md b/docs/examples/domains/create-record-mx.md new file mode 100644 index 00000000..409dc09f --- /dev/null +++ b/docs/examples/domains/create-record-mx.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->createRecordMX( + domainId: '', + name: '', + value: '', + ttl: 1, + priority: 0, + comment: '' // optional +); +``` diff --git a/docs/examples/domains/create-record-ns.md b/docs/examples/domains/create-record-ns.md new file mode 100644 index 00000000..9faef297 --- /dev/null +++ b/docs/examples/domains/create-record-ns.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->createRecordNS( + domainId: '', + name: '', + value: '', + ttl: 1, + comment: '' // optional +); +``` diff --git a/docs/examples/domains/create-record-srv.md b/docs/examples/domains/create-record-srv.md new file mode 100644 index 00000000..fa3a45af --- /dev/null +++ b/docs/examples/domains/create-record-srv.md @@ -0,0 +1,24 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->createRecordSRV( + domainId: '', + name: '', + value: '', + ttl: 1, + priority: 0, + weight: 0, + port: 0, + comment: '' // optional +); +``` diff --git a/docs/examples/domains/create-record-txt.md b/docs/examples/domains/create-record-txt.md new file mode 100644 index 00000000..a541e82d --- /dev/null +++ b/docs/examples/domains/create-record-txt.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->createRecordTXT( + domainId: '', + name: '', + ttl: 1, + value: '', // optional + comment: '' // optional +); +``` diff --git a/docs/examples/domains/create.md b/docs/examples/domains/create.md new file mode 100644 index 00000000..898f946b --- /dev/null +++ b/docs/examples/domains/create.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->create( + teamId: '', + domain: 'example.com' +); +``` diff --git a/docs/examples/domains/delete-record.md b/docs/examples/domains/delete-record.md new file mode 100644 index 00000000..70686472 --- /dev/null +++ b/docs/examples/domains/delete-record.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->deleteRecord( + domainId: '', + recordId: '' +); +``` diff --git a/docs/examples/domains/delete.md b/docs/examples/domains/delete.md new file mode 100644 index 00000000..b38392f3 --- /dev/null +++ b/docs/examples/domains/delete.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->delete( + domainId: '' +); +``` diff --git a/docs/examples/domains/get-preset-google-workspace.md b/docs/examples/domains/get-preset-google-workspace.md new file mode 100644 index 00000000..3cd16539 --- /dev/null +++ b/docs/examples/domains/get-preset-google-workspace.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->getPresetGoogleWorkspace( + domainId: '' +); +``` diff --git a/docs/examples/domains/get-preset-i-cloud.md b/docs/examples/domains/get-preset-i-cloud.md new file mode 100644 index 00000000..98d33b0c --- /dev/null +++ b/docs/examples/domains/get-preset-i-cloud.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->getPresetICloud( + domainId: '' +); +``` diff --git a/docs/examples/domains/get-preset-mailgun.md b/docs/examples/domains/get-preset-mailgun.md new file mode 100644 index 00000000..5f1440d7 --- /dev/null +++ b/docs/examples/domains/get-preset-mailgun.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->getPresetMailgun( + domainId: '' +); +``` diff --git a/docs/examples/domains/get-preset-outlook.md b/docs/examples/domains/get-preset-outlook.md new file mode 100644 index 00000000..3619b440 --- /dev/null +++ b/docs/examples/domains/get-preset-outlook.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->getPresetOutlook( + domainId: '' +); +``` diff --git a/docs/examples/domains/get-preset-proton-mail.md b/docs/examples/domains/get-preset-proton-mail.md new file mode 100644 index 00000000..15759207 --- /dev/null +++ b/docs/examples/domains/get-preset-proton-mail.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->getPresetProtonMail( + domainId: '' +); +``` diff --git a/docs/examples/domains/get-preset-zoho.md b/docs/examples/domains/get-preset-zoho.md new file mode 100644 index 00000000..151896cb --- /dev/null +++ b/docs/examples/domains/get-preset-zoho.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->getPresetZoho( + domainId: '' +); +``` diff --git a/docs/examples/domains/get-price.md b/docs/examples/domains/get-price.md new file mode 100644 index 00000000..7df25fa4 --- /dev/null +++ b/docs/examples/domains/get-price.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->getPrice( + domain: 'example.com', + periodYears: null, // optional + registrationType: DomainRegistrationType::NEW() // optional +); +``` diff --git a/docs/examples/domains/get-record.md b/docs/examples/domains/get-record.md new file mode 100644 index 00000000..96cb1561 --- /dev/null +++ b/docs/examples/domains/get-record.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->getRecord( + domainId: '', + recordId: '' +); +``` diff --git a/docs/examples/domains/get-transfer-status.md b/docs/examples/domains/get-transfer-status.md new file mode 100644 index 00000000..7789d3b9 --- /dev/null +++ b/docs/examples/domains/get-transfer-status.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->getTransferStatus( + domainId: '' +); +``` diff --git a/docs/examples/domains/get-zone.md b/docs/examples/domains/get-zone.md new file mode 100644 index 00000000..f8d2dc15 --- /dev/null +++ b/docs/examples/domains/get-zone.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->getZone( + domainId: '' +); +``` diff --git a/docs/examples/domains/get.md b/docs/examples/domains/get.md new file mode 100644 index 00000000..12ed0117 --- /dev/null +++ b/docs/examples/domains/get.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->get( + domainId: '' +); +``` diff --git a/docs/examples/domains/list-prices.md b/docs/examples/domains/list-prices.md new file mode 100644 index 00000000..f1211fc4 --- /dev/null +++ b/docs/examples/domains/list-prices.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->listPrices( + domains: [], + periodYears: null, // optional + registrationType: DomainRegistrationType::NEW() // optional +); +``` diff --git a/docs/examples/domains/list-records.md b/docs/examples/domains/list-records.md new file mode 100644 index 00000000..19d29a93 --- /dev/null +++ b/docs/examples/domains/list-records.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->listRecords( + domainId: '', + queries: [] // optional +); +``` diff --git a/docs/examples/domains/list.md b/docs/examples/domains/list.md new file mode 100644 index 00000000..dcce2187 --- /dev/null +++ b/docs/examples/domains/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 + +$domains = new Domains($client); + +$result = $domains->list( + queries: [], // optional + search: '' // optional +); +``` diff --git a/docs/examples/domains/update-nameservers.md b/docs/examples/domains/update-nameservers.md new file mode 100644 index 00000000..3e99d08a --- /dev/null +++ b/docs/examples/domains/update-nameservers.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->updateNameservers( + domainId: '', + nameservers: [] // optional +); +``` diff --git a/docs/examples/domains/update-record-a.md b/docs/examples/domains/update-record-a.md new file mode 100644 index 00000000..243f89b4 --- /dev/null +++ b/docs/examples/domains/update-record-a.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->updateRecordA( + domainId: '', + recordId: '', + name: '', + value: '', + ttl: 1, + comment: '' // optional +); +``` diff --git a/docs/examples/domains/update-record-aaaa.md b/docs/examples/domains/update-record-aaaa.md new file mode 100644 index 00000000..8bc18ee9 --- /dev/null +++ b/docs/examples/domains/update-record-aaaa.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->updateRecordAAAA( + domainId: '', + recordId: '', + name: '', + value: '', + ttl: 1, + comment: '' // optional +); +``` diff --git a/docs/examples/domains/update-record-alias.md b/docs/examples/domains/update-record-alias.md new file mode 100644 index 00000000..457a3bed --- /dev/null +++ b/docs/examples/domains/update-record-alias.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->updateRecordAlias( + domainId: '', + recordId: '', + name: '', + value: '', + ttl: 1, + comment: '' // optional +); +``` diff --git a/docs/examples/domains/update-record-caa.md b/docs/examples/domains/update-record-caa.md new file mode 100644 index 00000000..26bcadfd --- /dev/null +++ b/docs/examples/domains/update-record-caa.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->updateRecordCAA( + domainId: '', + recordId: '', + name: '', + value: '', + ttl: 1, + comment: '' // optional +); +``` diff --git a/docs/examples/domains/update-record-cname.md b/docs/examples/domains/update-record-cname.md new file mode 100644 index 00000000..c170899c --- /dev/null +++ b/docs/examples/domains/update-record-cname.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->updateRecordCNAME( + domainId: '', + recordId: '', + name: '', + value: '', + ttl: 1, + comment: '' // optional +); +``` diff --git a/docs/examples/domains/update-record-https.md b/docs/examples/domains/update-record-https.md new file mode 100644 index 00000000..2182a995 --- /dev/null +++ b/docs/examples/domains/update-record-https.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->updateRecordHTTPS( + domainId: '', + recordId: '', + name: '', + value: '', + ttl: 1, + comment: '' // optional +); +``` diff --git a/docs/examples/domains/update-record-mx.md b/docs/examples/domains/update-record-mx.md new file mode 100644 index 00000000..7f152d6a --- /dev/null +++ b/docs/examples/domains/update-record-mx.md @@ -0,0 +1,23 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->updateRecordMX( + domainId: '', + recordId: '', + name: '', + value: '', + ttl: 1, + priority: 0, + comment: '' // optional +); +``` diff --git a/docs/examples/domains/update-record-ns.md b/docs/examples/domains/update-record-ns.md new file mode 100644 index 00000000..a6530196 --- /dev/null +++ b/docs/examples/domains/update-record-ns.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->updateRecordNS( + domainId: '', + recordId: '', + name: '', + value: '', + ttl: 1, + comment: '' // optional +); +``` diff --git a/docs/examples/domains/update-record-srv.md b/docs/examples/domains/update-record-srv.md new file mode 100644 index 00000000..7148a740 --- /dev/null +++ b/docs/examples/domains/update-record-srv.md @@ -0,0 +1,25 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->updateRecordSRV( + domainId: '', + recordId: '', + name: '', + value: '', + ttl: 1, + priority: 0, + weight: 0, + port: 0, + comment: '' // optional +); +``` diff --git a/docs/examples/domains/update-record-txt.md b/docs/examples/domains/update-record-txt.md new file mode 100644 index 00000000..677b5fe4 --- /dev/null +++ b/docs/examples/domains/update-record-txt.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->updateRecordTXT( + domainId: '', + recordId: '', + name: '', + value: '', + ttl: 1, + comment: '' // optional +); +``` diff --git a/docs/examples/domains/update-team.md b/docs/examples/domains/update-team.md new file mode 100644 index 00000000..bd706e5c --- /dev/null +++ b/docs/examples/domains/update-team.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->updateTeam( + domainId: '', + teamId: '' +); +``` diff --git a/docs/examples/domains/update-zone.md b/docs/examples/domains/update-zone.md new file mode 100644 index 00000000..e60c7a92 --- /dev/null +++ b/docs/examples/domains/update-zone.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->updateZone( + domainId: '', + content: '' +); +``` diff --git a/docs/examples/domains/verify-nameservers.md b/docs/examples/domains/verify-nameservers.md new file mode 100644 index 00000000..6a66d9d0 --- /dev/null +++ b/docs/examples/domains/verify-nameservers.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$domains = new Domains($client); + +$result = $domains->verifyNameservers( + domainId: '' +); +``` diff --git a/docs/examples/functions/list-runtimes.md b/docs/examples/functions/list-runtimes.md index 320a9dc6..e2e5cbf4 100644 --- a/docs/examples/functions/list-runtimes.md +++ b/docs/examples/functions/list-runtimes.md @@ -11,5 +11,7 @@ $client = (new Client()) $functions = new Functions($client); -$result = $functions->listRuntimes(); +$result = $functions->listRuntimes( + total: false // optional +); ``` diff --git a/docs/examples/functions/list-specifications.md b/docs/examples/functions/list-specifications.md index da2bec2e..47406b02 100644 --- a/docs/examples/functions/list-specifications.md +++ b/docs/examples/functions/list-specifications.md @@ -12,6 +12,7 @@ $client = (new Client()) $functions = new Functions($client); $result = $functions->listSpecifications( - type: 'runtimes' // optional + type: 'runtimes', // optional + total: false // optional ); ``` diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md index 5c99bbf2..af3d0aa6 100644 --- a/docs/examples/locale/list-codes.md +++ b/docs/examples/locale/list-codes.md @@ -11,5 +11,7 @@ $client = (new Client()) $locale = new Locale($client); -$result = $locale->listCodes(); +$result = $locale->listCodes( + total: false // optional +); ``` diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md index 1245b2ec..0c865bfb 100644 --- a/docs/examples/locale/list-continents.md +++ b/docs/examples/locale/list-continents.md @@ -11,5 +11,7 @@ $client = (new Client()) $locale = new Locale($client); -$result = $locale->listContinents(); +$result = $locale->listContinents( + total: false // optional +); ``` diff --git a/docs/examples/locale/list-countries-eu.md b/docs/examples/locale/list-countries-eu.md index 9744c8ea..afdce554 100644 --- a/docs/examples/locale/list-countries-eu.md +++ b/docs/examples/locale/list-countries-eu.md @@ -11,5 +11,7 @@ $client = (new Client()) $locale = new Locale($client); -$result = $locale->listCountriesEU(); +$result = $locale->listCountriesEU( + total: false // optional +); ``` diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md index df66061f..d330d1ec 100644 --- a/docs/examples/locale/list-countries-phones.md +++ b/docs/examples/locale/list-countries-phones.md @@ -11,5 +11,7 @@ $client = (new Client()) $locale = new Locale($client); -$result = $locale->listCountriesPhones(); +$result = $locale->listCountriesPhones( + total: false // optional +); ``` diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md index f4f96262..df1a58a7 100644 --- a/docs/examples/locale/list-countries.md +++ b/docs/examples/locale/list-countries.md @@ -11,5 +11,7 @@ $client = (new Client()) $locale = new Locale($client); -$result = $locale->listCountries(); +$result = $locale->listCountries( + total: false // optional +); ``` diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md index f4f1125a..64147256 100644 --- a/docs/examples/locale/list-currencies.md +++ b/docs/examples/locale/list-currencies.md @@ -11,5 +11,7 @@ $client = (new Client()) $locale = new Locale($client); -$result = $locale->listCurrencies(); +$result = $locale->listCurrencies( + total: false // optional +); ``` diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md index b25fab64..2d5e0f86 100644 --- a/docs/examples/locale/list-languages.md +++ b/docs/examples/locale/list-languages.md @@ -11,5 +11,7 @@ $client = (new Client()) $locale = new Locale($client); -$result = $locale->listLanguages(); +$result = $locale->listLanguages( + total: false // optional +); ``` diff --git a/docs/examples/messaging/create-appwrite-provider.md b/docs/examples/messaging/create-appwrite-provider.md new file mode 100644 index 00000000..178e2bc9 --- /dev/null +++ b/docs/examples/messaging/create-appwrite-provider.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createAppwriteProvider( + providerId: '', + name: '', + enabled: false, // optional + qos: 0, // optional + expiry: 0 // optional +); +``` diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md index cd03c685..b20e6784 100644 --- a/docs/examples/messaging/create-email.md +++ b/docs/examples/messaging/create-email.md @@ -23,6 +23,8 @@ $result = $messaging->createEmail( attachments: [], // optional draft: false, // optional html: false, // optional - scheduledAt: '2020-10-15T06:38:00.000+00:00' // optional + scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional + replyToEmail: 'email@example.com', // optional + replyToName: '' // optional ); ``` diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md index 75734171..701dc47d 100644 --- a/docs/examples/messaging/create-push.md +++ b/docs/examples/messaging/create-push.md @@ -31,6 +31,7 @@ $result = $messaging->createPush( scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional contentAvailable: false, // optional critical: false, // optional - priority: MessagePriority::NORMAL() // optional + priority: MessagePriority::NORMAL(), // optional + channelId: '' // optional ); ``` diff --git a/docs/examples/messaging/create-topic.md b/docs/examples/messaging/create-topic.md index eca6d541..ffb578bb 100644 --- a/docs/examples/messaging/create-topic.md +++ b/docs/examples/messaging/create-topic.md @@ -14,6 +14,8 @@ $messaging = new Messaging($client); $result = $messaging->createTopic( topicId: '', name: '', - subscribe: ["any"] // optional + subscribe: ["any"], // optional + qos: 0, // optional + expiry: 0 // optional ); ``` diff --git a/docs/examples/messaging/update-appwrite-provider.md b/docs/examples/messaging/update-appwrite-provider.md new file mode 100644 index 00000000..bc041e6a --- /dev/null +++ b/docs/examples/messaging/update-appwrite-provider.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateAppwriteProvider( + providerId: '', + name: '', // optional + enabled: false, // optional + qos: 0, // optional + expiry: 0 // optional +); +``` diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md index 01884f13..8f24271c 100644 --- a/docs/examples/messaging/update-email.md +++ b/docs/examples/messaging/update-email.md @@ -23,6 +23,8 @@ $result = $messaging->updateEmail( cc: [], // optional bcc: [], // optional scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional - attachments: [] // optional + attachments: [], // optional + replyToEmail: 'email@example.com', // optional + replyToName: '' // optional ); ``` diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md index a1b14b71..f266fd7d 100644 --- a/docs/examples/messaging/update-push.md +++ b/docs/examples/messaging/update-push.md @@ -31,6 +31,7 @@ $result = $messaging->updatePush( scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional contentAvailable: false, // optional critical: false, // optional - priority: MessagePriority::NORMAL() // optional + priority: MessagePriority::NORMAL(), // optional + channelId: '' // optional ); ``` diff --git a/docs/examples/messaging/update-topic.md b/docs/examples/messaging/update-topic.md index 14877cc9..6016049c 100644 --- a/docs/examples/messaging/update-topic.md +++ b/docs/examples/messaging/update-topic.md @@ -14,6 +14,8 @@ $messaging = new Messaging($client); $result = $messaging->updateTopic( topicId: '', name: '', // optional - subscribe: ["any"] // optional + subscribe: ["any"], // optional + qos: 0, // optional + expiry: 0 // optional ); ``` diff --git a/docs/examples/oauth2/introspect.md b/docs/examples/oauth2/introspect.md new file mode 100644 index 00000000..cdde0e1e --- /dev/null +++ b/docs/examples/oauth2/introspect.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$oauth2 = new Oauth2($client); + +$result = $oauth2->introspect( + token: '', + tokenTypeHint: 'access_token', // optional + clientId: '', // optional + clientSecret: '' // optional +); +``` diff --git a/docs/examples/organization/create-ephemeral-project-key.md b/docs/examples/organization/create-ephemeral-project-key.md new file mode 100644 index 00000000..445227fd --- /dev/null +++ b/docs/examples/organization/create-ephemeral-project-key.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$organization = new Organization($client); + +$result = $organization->createEphemeralProjectKey( + projectId: '', + scopes: [ProjectKeyScopes::USERSREAD()], + duration: 600 +); +``` diff --git a/docs/examples/organization/delete-project-key.md b/docs/examples/organization/delete-project-key.md new file mode 100644 index 00000000..29483c93 --- /dev/null +++ b/docs/examples/organization/delete-project-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 + +$organization = new Organization($client); + +$result = $organization->deleteProjectKey( + projectId: '', + keyId: '' +); +``` diff --git a/docs/examples/organization/get-project-key.md b/docs/examples/organization/get-project-key.md new file mode 100644 index 00000000..7e777a45 --- /dev/null +++ b/docs/examples/organization/get-project-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 + +$organization = new Organization($client); + +$result = $organization->getProjectKey( + projectId: '', + keyId: '' +); +``` diff --git a/docs/examples/organization/list-project-keys.md b/docs/examples/organization/list-project-keys.md new file mode 100644 index 00000000..64b5490b --- /dev/null +++ b/docs/examples/organization/list-project-keys.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$organization = new Organization($client); + +$result = $organization->listProjectKeys( + projectId: '', + queries: [], // optional + total: false // optional +); +``` diff --git a/docs/examples/organization/update-project-key.md b/docs/examples/organization/update-project-key.md new file mode 100644 index 00000000..b40f14e1 --- /dev/null +++ b/docs/examples/organization/update-project-key.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$organization = new Organization($client); + +$result = $organization->updateProjectKey( + projectId: '', + keyId: '', + name: '', + scopes: [ProjectKeyScopes::USERSREAD()], + expire: '2020-10-15T06:38:00.000+00:00' // optional +); +``` diff --git a/docs/examples/project/create-android-platform.md b/docs/examples/project/create-android-platform.md index ae1df197..16d8fa2b 100644 --- a/docs/examples/project/create-android-platform.md +++ b/docs/examples/project/create-android-platform.md @@ -14,6 +14,7 @@ $project = new Project($client); $result = $project->createAndroidPlatform( platformId: '', name: '', - applicationId: '' + applicationId: '', + fingerprints: [] // optional ); ``` diff --git a/docs/examples/project/create-environment.md b/docs/examples/project/create-environment.md new file mode 100644 index 00000000..8d6953a3 --- /dev/null +++ b/docs/examples/project/create-environment.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->createEnvironment( + environmentId: '', + name: '' +); +``` diff --git a/docs/examples/project/delete-environment.md b/docs/examples/project/delete-environment.md new file mode 100644 index 00000000..c286564c --- /dev/null +++ b/docs/examples/project/delete-environment.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->deleteEnvironment( + environmentId: '' +); +``` diff --git a/docs/examples/project/get-environment.md b/docs/examples/project/get-environment.md new file mode 100644 index 00000000..e4b95a89 --- /dev/null +++ b/docs/examples/project/get-environment.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->getEnvironment( + environmentId: '' +); +``` diff --git a/docs/examples/project/list-environments.md b/docs/examples/project/list-environments.md new file mode 100644 index 00000000..87fdc1a0 --- /dev/null +++ b/docs/examples/project/list-environments.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->listEnvironments( + queries: [], // optional + total: false // optional +); +``` diff --git a/docs/examples/project/update-android-platform.md b/docs/examples/project/update-android-platform.md index 1898911d..6a9518c4 100644 --- a/docs/examples/project/update-android-platform.md +++ b/docs/examples/project/update-android-platform.md @@ -14,6 +14,7 @@ $project = new Project($client); $result = $project->updateAndroidPlatform( platformId: '', name: '', - applicationId: '' + applicationId: '', + fingerprints: [] // optional ); ``` diff --git a/docs/examples/project/update-environment.md b/docs/examples/project/update-environment.md new file mode 100644 index 00000000..5a9e6bf5 --- /dev/null +++ b/docs/examples/project/update-environment.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->updateEnvironment( + environmentId: '', + name: '' +); +``` diff --git a/docs/examples/project/update-o-auth-2-apple.md b/docs/examples/project/update-o-auth-2-apple.md index f742927c..a25415f3 100644 --- a/docs/examples/project/update-o-auth-2-apple.md +++ b/docs/examples/project/update-o-auth-2-apple.md @@ -16,6 +16,8 @@ $result = $project->updateOAuth2Apple( keyId: '', // optional teamId: '', // optional p8File: '', // optional - enabled: false // optional + enabled: false, // optional + nativeClientIds: [], // optional + nativeEnabled: 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 index b80b4b15..39a431ac 100644 --- a/docs/examples/project/update-o-auth-2-auth-0.md +++ b/docs/examples/project/update-o-auth-2-auth-0.md @@ -3,6 +3,7 @@ use Appwrite\Client; use Appwrite\Services\Project; +use Appwrite\Enums\ProjectOAuth2Auth0Prompt; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -15,6 +16,7 @@ $result = $project->updateOAuth2Auth0( clientId: '', // optional clientSecret: '', // optional endpoint: '', // optional - enabled: false // optional + enabled: false, // optional + prompt: [ProjectOAuth2Auth0Prompt::NONE()] // optional ); ``` diff --git a/docs/examples/project/update-o-auth-2-discord.md b/docs/examples/project/update-o-auth-2-discord.md index 9a0b1616..6a7a39da 100644 --- a/docs/examples/project/update-o-auth-2-discord.md +++ b/docs/examples/project/update-o-auth-2-discord.md @@ -3,6 +3,7 @@ use Appwrite\Client; use Appwrite\Services\Project; +use Appwrite\Enums\ProjectOAuth2DiscordPrompt; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -14,6 +15,7 @@ $project = new Project($client); $result = $project->updateOAuth2Discord( clientId: '', // optional clientSecret: '', // optional - enabled: false // optional + enabled: false, // optional + prompt: [ProjectOAuth2DiscordPrompt::NONE()] // 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 index 92dc5726..fe4be9f3 100644 --- a/docs/examples/project/update-o-auth-2-git-hub.md +++ b/docs/examples/project/update-o-auth-2-git-hub.md @@ -3,6 +3,7 @@ use Appwrite\Client; use Appwrite\Services\Project; +use Appwrite\Enums\ProjectOAuth2GitHubPrompt; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -14,6 +15,7 @@ $project = new Project($client); $result = $project->updateOAuth2GitHub( clientId: '', // optional clientSecret: '', // optional - enabled: false // optional + enabled: false, // optional + prompt: [ProjectOAuth2GitHubPrompt::SELECTACCOUNT()] // optional ); ``` diff --git a/docs/examples/project/update-o-auth-2-google.md b/docs/examples/project/update-o-auth-2-google.md index 28137e9a..f31d8bab 100644 --- a/docs/examples/project/update-o-auth-2-google.md +++ b/docs/examples/project/update-o-auth-2-google.md @@ -16,6 +16,8 @@ $result = $project->updateOAuth2Google( clientId: '', // optional clientSecret: '', // optional prompt: [ProjectOAuth2GooglePrompt::NONE()], // optional - enabled: false // optional + enabled: false, // optional + nativeClientIds: [], // optional + nativeEnabled: false // optional ); ``` diff --git a/docs/examples/project/update-o-auth-2-kakao.md b/docs/examples/project/update-o-auth-2-kakao.md new file mode 100644 index 00000000..78fe1cbd --- /dev/null +++ b/docs/examples/project/update-o-auth-2-kakao.md @@ -0,0 +1,21 @@ +```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->updateOAuth2Kakao( + clientId: '', // optional + clientSecret: '', // optional + prompt: [ProjectOAuth2KakaoPrompt::NONE()], // 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 index 349bf932..51fca422 100644 --- a/docs/examples/project/update-o-auth-2-microsoft.md +++ b/docs/examples/project/update-o-auth-2-microsoft.md @@ -3,6 +3,7 @@ use Appwrite\Client; use Appwrite\Services\Project; +use Appwrite\Enums\ProjectOAuth2MicrosoftPrompt; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -15,6 +16,7 @@ $result = $project->updateOAuth2Microsoft( applicationId: '', // optional applicationSecret: '', // optional tenant: '', // optional - enabled: false // optional + enabled: false, // optional + prompt: [ProjectOAuth2MicrosoftPrompt::NONE()] // optional ); ``` diff --git a/docs/examples/project/update-o-auth-2-okta.md b/docs/examples/project/update-o-auth-2-okta.md index e03c9b83..eb58774c 100644 --- a/docs/examples/project/update-o-auth-2-okta.md +++ b/docs/examples/project/update-o-auth-2-okta.md @@ -3,6 +3,7 @@ use Appwrite\Client; use Appwrite\Services\Project; +use Appwrite\Enums\ProjectOAuth2OktaPrompt; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -16,6 +17,7 @@ $result = $project->updateOAuth2Okta( clientSecret: '', // optional domain: 'example.com', // optional authorizationServerId: '', // optional - enabled: false // optional + enabled: false, // optional + prompt: [ProjectOAuth2OktaPrompt::NONE()] // optional ); ``` diff --git a/docs/examples/project/update-o-auth-2-salesforce.md b/docs/examples/project/update-o-auth-2-salesforce.md index 1247627c..03ef55bd 100644 --- a/docs/examples/project/update-o-auth-2-salesforce.md +++ b/docs/examples/project/update-o-auth-2-salesforce.md @@ -3,6 +3,7 @@ use Appwrite\Client; use Appwrite\Services\Project; +use Appwrite\Enums\ProjectOAuth2SalesforcePrompt; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -14,6 +15,7 @@ $project = new Project($client); $result = $project->updateOAuth2Salesforce( customerKey: '', // optional customerSecret: '', // optional - enabled: false // optional + enabled: false, // optional + prompt: [ProjectOAuth2SalesforcePrompt::LOGIN()] // optional ); ``` diff --git a/docs/examples/project/update-o-auth-2-tik-tok.md b/docs/examples/project/update-o-auth-2-tik-tok.md new file mode 100644 index 00000000..435ab664 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-tik-tok.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->updateOAuth2TikTok( + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional +); +``` diff --git a/docs/examples/project/update-o-auth-2-webflow.md b/docs/examples/project/update-o-auth-2-webflow.md new file mode 100644 index 00000000..50c90d7e --- /dev/null +++ b/docs/examples/project/update-o-auth-2-webflow.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->updateOAuth2Webflow( + 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 index 624b7f4f..e2bd5f69 100644 --- a/docs/examples/project/update-o-auth-2-zoho.md +++ b/docs/examples/project/update-o-auth-2-zoho.md @@ -3,6 +3,7 @@ use Appwrite\Client; use Appwrite\Services\Project; +use Appwrite\Enums\ProjectOAuth2ZohoPrompt; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -14,6 +15,7 @@ $project = new Project($client); $result = $project->updateOAuth2Zoho( clientId: '', // optional clientSecret: '', // optional - enabled: false // optional + enabled: false, // optional + prompt: [ProjectOAuth2ZohoPrompt::CONSENT()] // optional ); ``` diff --git a/docs/examples/project/update-password-pwned-policy.md b/docs/examples/project/update-password-pwned-policy.md new file mode 100644 index 00000000..5cd19ade --- /dev/null +++ b/docs/examples/project/update-password-pwned-policy.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->updatePasswordPwnedPolicy( + enabled: false, // optional + sessions: false, // optional + users: false // optional +); +``` diff --git a/docs/examples/project/update-password-rotation-policy.md b/docs/examples/project/update-password-rotation-policy.md new file mode 100644 index 00000000..506fc82a --- /dev/null +++ b/docs/examples/project/update-password-rotation-policy.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->updatePasswordRotationPolicy( + enabled: false, // optional + maxAge: 86400 // optional +); +``` diff --git a/docs/examples/sites/list-frameworks.md b/docs/examples/sites/list-frameworks.md index 74ea8821..511338ad 100644 --- a/docs/examples/sites/list-frameworks.md +++ b/docs/examples/sites/list-frameworks.md @@ -11,5 +11,7 @@ $client = (new Client()) $sites = new Sites($client); -$result = $sites->listFrameworks(); +$result = $sites->listFrameworks( + total: false // optional +); ``` diff --git a/docs/examples/sites/list-specifications.md b/docs/examples/sites/list-specifications.md index 3a6826ad..10e98a4c 100644 --- a/docs/examples/sites/list-specifications.md +++ b/docs/examples/sites/list-specifications.md @@ -12,6 +12,7 @@ $client = (new Client()) $sites = new Sites($client); $result = $sites->listSpecifications( - type: 'runtimes' // optional + type: 'runtimes', // optional + total: false // optional ); ``` diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index a2960d66..85cf889d 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -18,7 +18,7 @@ $result = $storage->getFilePreview( fileId: '', width: 0, // optional height: 0, // optional - gravity: ImageGravity::CENTER(), // optional + gravity: ImageGravity::AUTO(), // optional quality: -1, // optional borderWidth: 0, // optional borderColor: 'FFFFFF', // optional diff --git a/docs/examples/tablesdb/list-transactions.md b/docs/examples/tablesdb/list-transactions.md index 90b698c5..2cad3139 100644 --- a/docs/examples/tablesdb/list-transactions.md +++ b/docs/examples/tablesdb/list-transactions.md @@ -12,6 +12,7 @@ $client = (new Client()) $tablesDB = new TablesDB($client); $result = $tablesDB->listTransactions( - queries: [] // optional + queries: [], // optional + total: false // optional ); ``` diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index 4c09dc7e..cd9524a7 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -18,6 +18,7 @@ $result = $teams->createMembership( userId: '', // optional phone: '+12065550100', // optional url: 'https://example.com', // optional - name: '' // optional + name: '', // optional + membershipId: '' // optional ); ``` diff --git a/docs/examples/vectorsdb/list-transactions.md b/docs/examples/vectorsdb/list-transactions.md index 022bd60e..6688e404 100644 --- a/docs/examples/vectorsdb/list-transactions.md +++ b/docs/examples/vectorsdb/list-transactions.md @@ -12,6 +12,7 @@ $client = (new Client()) $vectorsDB = new VectorsDB($client); $result = $vectorsDB->listTransactions( - queries: [] // optional + queries: [], // optional + total: false // optional ); ``` diff --git a/docs/examples/waf/create-bypass-rule.md b/docs/examples/waf/create-bypass-rule.md new file mode 100644 index 00000000..664e7db6 --- /dev/null +++ b/docs/examples/waf/create-bypass-rule.md @@ -0,0 +1,24 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$waf = new Waf($client); + +$result = $waf->createBypassRule( + ruleId: '', + resourceType: 'api', + name: '', + resourceId: '', // optional + description: '', // optional + priority: -100000, // optional + enabled: false, // optional + conditions: [] // optional +); +``` diff --git a/docs/examples/waf/create-challenge-rule.md b/docs/examples/waf/create-challenge-rule.md new file mode 100644 index 00000000..fc21ab11 --- /dev/null +++ b/docs/examples/waf/create-challenge-rule.md @@ -0,0 +1,27 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$waf = new Waf($client); + +$result = $waf->createChallengeRule( + ruleId: '', + resourceType: 'api', + name: '', + resourceId: '', // optional + description: '', // optional + challengeType: 'compute', // optional + priority: -100000, // optional + enabled: false, // optional + conditions: [], // optional + difficulty: 1, // optional + ttl: 900 // optional +); +``` diff --git a/docs/examples/waf/create-deny-rule.md b/docs/examples/waf/create-deny-rule.md new file mode 100644 index 00000000..e29761e8 --- /dev/null +++ b/docs/examples/waf/create-deny-rule.md @@ -0,0 +1,24 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$waf = new Waf($client); + +$result = $waf->createDenyRule( + ruleId: '', + resourceType: 'api', + name: '', + resourceId: '', // optional + description: '', // optional + priority: -100000, // optional + enabled: false, // optional + conditions: [] // optional +); +``` diff --git a/docs/examples/waf/create-rate-limit-rule.md b/docs/examples/waf/create-rate-limit-rule.md new file mode 100644 index 00000000..955a57f5 --- /dev/null +++ b/docs/examples/waf/create-rate-limit-rule.md @@ -0,0 +1,29 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$waf = new Waf($client); + +$result = $waf->createRateLimitRule( + ruleId: '', + resourceType: 'api', + name: '', + limit: 1, + interval: 1, + resourceId: '', // optional + description: '', // optional + key: 'ip', // optional + strategy: 'fixedWindow', // optional + maxBucketSize: 1, // optional + priority: -100000, // optional + enabled: false, // optional + conditions: [] // optional +); +``` diff --git a/docs/examples/waf/create-redirect-rule.md b/docs/examples/waf/create-redirect-rule.md new file mode 100644 index 00000000..c6b4642a --- /dev/null +++ b/docs/examples/waf/create-redirect-rule.md @@ -0,0 +1,26 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$waf = new Waf($client); + +$result = $waf->createRedirectRule( + ruleId: '', + resourceType: 'api', + name: '', + location: '', + statusCode: 300, + resourceId: '', // optional + description: '', // optional + priority: -100000, // optional + enabled: false, // optional + conditions: [] // optional +); +``` diff --git a/docs/examples/waf/delete-rule.md b/docs/examples/waf/delete-rule.md new file mode 100644 index 00000000..9e813d90 --- /dev/null +++ b/docs/examples/waf/delete-rule.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$waf = new Waf($client); + +$result = $waf->deleteRule( + ruleId: '' +); +``` diff --git a/docs/examples/waf/get-rule.md b/docs/examples/waf/get-rule.md new file mode 100644 index 00000000..09456dfa --- /dev/null +++ b/docs/examples/waf/get-rule.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$waf = new Waf($client); + +$result = $waf->getRule( + ruleId: '' +); +``` diff --git a/docs/examples/waf/list-rules.md b/docs/examples/waf/list-rules.md new file mode 100644 index 00000000..8e3d99cf --- /dev/null +++ b/docs/examples/waf/list-rules.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$waf = new Waf($client); + +$result = $waf->listRules( + queries: [], // optional + search: '', // optional + total: false // optional +); +``` diff --git a/docs/examples/waf/update-bypass-rule.md b/docs/examples/waf/update-bypass-rule.md new file mode 100644 index 00000000..94d38053 --- /dev/null +++ b/docs/examples/waf/update-bypass-rule.md @@ -0,0 +1,24 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$waf = new Waf($client); + +$result = $waf->updateBypassRule( + ruleId: '', + resourceType: 'api', // optional + resourceId: '', // optional + name: '', // optional + description: '', // optional + priority: -100000, // optional + enabled: false, // optional + conditions: [] // optional +); +``` diff --git a/docs/examples/waf/update-challenge-rule.md b/docs/examples/waf/update-challenge-rule.md new file mode 100644 index 00000000..67175304 --- /dev/null +++ b/docs/examples/waf/update-challenge-rule.md @@ -0,0 +1,27 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$waf = new Waf($client); + +$result = $waf->updateChallengeRule( + ruleId: '', + resourceType: 'api', // optional + resourceId: '', // optional + name: '', // optional + description: '', // optional + challengeType: 'compute', // optional + priority: -100000, // optional + enabled: false, // optional + conditions: [], // optional + difficulty: 1, // optional + ttl: 900 // optional +); +``` diff --git a/docs/examples/waf/update-deny-rule.md b/docs/examples/waf/update-deny-rule.md new file mode 100644 index 00000000..7e790f69 --- /dev/null +++ b/docs/examples/waf/update-deny-rule.md @@ -0,0 +1,24 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$waf = new Waf($client); + +$result = $waf->updateDenyRule( + ruleId: '', + resourceType: 'api', // optional + resourceId: '', // optional + name: '', // optional + description: '', // optional + priority: -100000, // optional + enabled: false, // optional + conditions: [] // optional +); +``` diff --git a/docs/examples/waf/update-rate-limit-rule.md b/docs/examples/waf/update-rate-limit-rule.md new file mode 100644 index 00000000..cf6d917c --- /dev/null +++ b/docs/examples/waf/update-rate-limit-rule.md @@ -0,0 +1,28 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$waf = new Waf($client); + +$result = $waf->updateRateLimitRule( + ruleId: '', + resourceType: 'api', // optional + resourceId: '', // optional + name: '', // optional + description: '', // optional + limit: 1, // optional + interval: 1, // optional + key: 'ip', // optional + maxBucketSize: 1, // optional + priority: -100000, // optional + enabled: false, // optional + conditions: [] // optional +); +``` diff --git a/docs/examples/waf/update-redirect-rule.md b/docs/examples/waf/update-redirect-rule.md new file mode 100644 index 00000000..d7788068 --- /dev/null +++ b/docs/examples/waf/update-redirect-rule.md @@ -0,0 +1,26 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$waf = new Waf($client); + +$result = $waf->updateRedirectRule( + ruleId: '', + resourceType: 'api', // optional + resourceId: '', // optional + name: '', // optional + description: '', // optional + location: '', // optional + statusCode: 300, // optional + priority: -100000, // optional + enabled: false, // optional + conditions: [] // optional +); +``` diff --git a/docs/functions.md b/docs/functions.md index e0214e58..9d6f555c 100644 --- a/docs/functions.md +++ b/docs/functions.md @@ -57,6 +57,12 @@ GET https://cloud.appwrite.io/v1/functions/runtimes ** Get a list of all runtimes that are currently active on your instance. ** +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| 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/functions/specifications @@ -69,6 +75,7 @@ GET https://cloud.appwrite.io/v1/functions/specifications | Field Name | Type | Description | Default | | --- | --- | --- | --- | | type | string | Specification type to list. Can be one of: runtimes, builds. Defaults to runtimes. | runtimes | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request diff --git a/docs/locale.md b/docs/locale.md index 2626a668..0f960117 100644 --- a/docs/locale.md +++ b/docs/locale.md @@ -16,6 +16,12 @@ GET https://cloud.appwrite.io/v1/locale/codes ** List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). ** +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| 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/locale/continents @@ -23,6 +29,12 @@ GET https://cloud.appwrite.io/v1/locale/continents ** List of all continents. You can use the locale header to get the data in a supported language. ** +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| 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/locale/countries @@ -30,6 +42,12 @@ GET https://cloud.appwrite.io/v1/locale/countries ** List of all countries. You can use the locale header to get the data in a supported language. ** +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| 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/locale/countries/eu @@ -37,6 +55,12 @@ GET https://cloud.appwrite.io/v1/locale/countries/eu ** List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language. ** +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| 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/locale/countries/phones @@ -44,6 +68,12 @@ GET https://cloud.appwrite.io/v1/locale/countries/phones ** List of all countries phone codes. You can use the locale header to get the data in a supported language. ** +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| 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/locale/currencies @@ -51,6 +81,12 @@ GET https://cloud.appwrite.io/v1/locale/currencies ** List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language. ** +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| 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/locale/languages @@ -58,3 +94,9 @@ GET https://cloud.appwrite.io/v1/locale/languages ** List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language. ** +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | + diff --git a/docs/messaging.md b/docs/messaging.md index e2585239..e2d897da 100644 --- a/docs/messaging.md +++ b/docs/messaging.md @@ -38,6 +38,8 @@ POST https://cloud.appwrite.io/v1/messaging/messages/email | draft | boolean | Is message a draft | | | html | boolean | Is content of type HTML | | | scheduledAt | string | Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. | | +| replyToEmail | string | Email address to reply to. If not set, defaults to the sender email address. | | +| replyToName | string | Name of the reply to recipient. If not set, defaults to the sender name. | | ```http request @@ -63,6 +65,8 @@ PATCH https://cloud.appwrite.io/v1/messaging/messages/email/{messageId} | bcc | array | Array of target IDs to be added as BCC. | | | scheduledAt | string | Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. | | | attachments | array | Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as :. | | +| replyToEmail | string | Email address to reply to. Pass an empty string to restore the provider or sender default. | | +| replyToName | string | Name of the reply to recipient. Pass an empty string to restore the provider or sender default. | | ```http request @@ -94,6 +98,7 @@ POST https://cloud.appwrite.io/v1/messaging/messages/push | contentAvailable | boolean | If set to true, the notification will be delivered in the background. Available only for iOS Platform. | | | critical | boolean | If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. | | | priority | string | Set the notification priority. "normal" will consider device state and may not deliver notifications immediately. "high" will always attempt to immediately deliver the notification. | high | +| channelId | string | ID of the notification channel to deliver the notification on. The app must have already created a channel with this ID, otherwise the channel from the app manifest is used. Available only for Android Platform. | | ```http request @@ -126,6 +131,7 @@ PATCH https://cloud.appwrite.io/v1/messaging/messages/push/{messageId} | contentAvailable | boolean | If set to true, the notification will be delivered in the background. Available only for iOS Platform. | | | critical | boolean | If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. | | | priority | string | Set the notification priority. "normal" will consider device battery state and may send notifications later. "high" will always attempt to immediately deliver the notification. | | +| channelId | string | ID of the notification channel to deliver the notification on. The app must have already created a channel with this ID, otherwise the channel from the app manifest is used. Pass an empty string to clear it. Available only for Android platforms. | | ```http request @@ -343,6 +349,40 @@ PATCH https://cloud.appwrite.io/v1/messaging/providers/apns/{providerId} | sandbox | boolean | Use APNS sandbox environment. | | +```http request +POST https://cloud.appwrite.io/v1/messaging/providers/appwrite +``` + +** Create a new Appwrite push provider. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| providerId | string | Provider 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 | Provider name. | | +| enabled | boolean | Set as enabled. | | +| qos | integer | Default QoS for topics on this provider (0 or 1). Null lets the subscriber choose. | | +| expiry | integer | Default message retention in seconds for offline delivery. Max 7 days (604800). | | + + +```http request +PATCH https://cloud.appwrite.io/v1/messaging/providers/appwrite/{providerId} +``` + +** Update an Appwrite push provider by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| providerId | string | **Required** Provider ID. | | +| name | string | Provider name. | | +| enabled | boolean | Set as enabled. | | +| qos | integer | Default QoS for topics on this provider (0 or 1). Null lets the subscriber choose. | | +| expiry | integer | Default message retention in seconds for offline delivery. Max 7 days (604800). | | + + ```http request POST https://cloud.appwrite.io/v1/messaging/providers/fcm ``` @@ -914,6 +954,8 @@ POST https://cloud.appwrite.io/v1/messaging/topics | topicId | string | Topic ID. Choose a custom Topic ID or a new Topic ID. | | | name | string | Topic Name. | | | subscribe | array | An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. | ["users"] | +| qos | integer | MQTT delivery quality of service for this topic. 0 is fire-and-forget (delivered only to clients connected at publish time). 1 persists each message and replays it when a client reconnects without having acknowledged it. Null lets the subscriber choose. | | +| expiry | integer | Message retention in seconds for offline delivery. Max 7 days (604800). | | ```http request @@ -944,6 +986,8 @@ PATCH https://cloud.appwrite.io/v1/messaging/topics/{topicId} | topicId | string | **Required** Topic ID. | | | name | string | Topic Name. | | | subscribe | array | An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. | | +| qos | integer | MQTT delivery quality of service for this topic. 0 is fire-and-forget (delivered only to clients connected at publish time). 1 persists each message and replays it when a client reconnects without having acknowledged it. Null lets the subscriber choose. | | +| expiry | integer | Message retention in seconds for offline delivery. Max 7 days (604800). | | ```http request diff --git a/docs/oauth2.md b/docs/oauth2.md index 37e2083b..46c3bc67 100644 --- a/docs/oauth2.md +++ b/docs/oauth2.md @@ -117,6 +117,23 @@ GET https://cloud.appwrite.io/v1/oauth2/{project_id}/grants/{grant_id} | grant_id | string | **Required** Grant ID made during authorization, provided to consent screen in URL search params. | | +```http request +POST https://cloud.appwrite.io/v1/oauth2/{project_id}/introspect +``` + +** Introspect an OAuth2 access token or refresh token. Authenticate with an API key holding the `oauth2.introspect` scope to introspect any token in the project, or with the client credentials of the app the token was issued to. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| project_id | string | **Required** Project ID in which OAuth2 client exists. | | +| token | string | The access token or refresh token to introspect. | | +| token_type_hint | string | Type of token to introspect. Can be one of: `access_token` or `refresh_token`. | | +| client_id | string | OAuth2 client ID. Either a registered app ID or an HTTPS client ID metadata document URL. | | +| client_secret | string | OAuth2 client secret. | | + + ```http request GET https://cloud.appwrite.io/v1/oauth2/{project_id}/organizations ``` diff --git a/docs/organization.md b/docs/organization.md index 6e0e7705..dc3895c1 100644 --- a/docs/organization.md +++ b/docs/organization.md @@ -310,3 +310,80 @@ DELETE https://cloud.appwrite.io/v1/organization/projects/{projectId} | --- | --- | --- | --- | | projectId | string | **Required** Project unique ID. | | + +```http request +GET https://cloud.appwrite.io/v1/organization/projects/{projectId}/keys +``` + +** Get a list of all API keys of a project in your organization. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| projectId | string | **Required** Project 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: 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/organization/projects/{projectId}/keys/ephemeral +``` + +** Create a new ephemeral API key for a project in your organization. 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 | +| --- | --- | --- | --- | +| projectId | string | **Required** Project unique ID. | | +| scopes | array | Key scopes list. Maximum of 200 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/organization/projects/{projectId}/keys/{keyId} +``` + +** Get a project key by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| projectId | string | **Required** Project unique ID. | | +| keyId | string | **Required** Key ID. | | + + +```http request +PUT https://cloud.appwrite.io/v1/organization/projects/{projectId}/keys/{keyId} +``` + +** Update a project 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 | +| --- | --- | --- | --- | +| projectId | string | **Required** Project unique ID. | | +| keyId | string | **Required** Key ID. | | +| name | string | Key name. Max length: 128 chars. | | +| scopes | array | Key scopes list. Maximum of 200 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/organization/projects/{projectId}/keys/{keyId} +``` + +** Delete a project key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| projectId | string | **Required** Project unique ID. | | +| keyId | string | **Required** Key ID. | | + diff --git a/docs/project.md b/docs/project.md index 1472dbbe..add475e8 100644 --- a/docs/project.md +++ b/docs/project.md @@ -29,6 +29,74 @@ PATCH https://cloud.appwrite.io/v1/project/auth-methods/{methodId} | enabled | boolean | Auth method status. | | +```http request +GET https://cloud.appwrite.io/v1/project/environments +``` + +** Get a list of all environments of the project. You can use the query params to filter your results. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, teamId, labels, search, accessedAt, status, parentId | [] | +| 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/environments +``` + +** Create a new environment of the project. An environment is a separate project in the same organization and region, with its own resources and users. Its usage is billed under the project it belongs to. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| environmentId | string | Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, and hyphen. Can't start with a special char. Max length is 36 chars. | | +| name | string | Environment name. Max length: 128 chars. | | + + +```http request +GET https://cloud.appwrite.io/v1/project/environments/{environmentId} +``` + +** Get an environment of the project by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| environmentId | string | **Required** Environment unique ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/environments/{environmentId} +``` + +** Update the name of an environment of the project. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| environmentId | string | **Required** Environment unique ID. | | +| name | string | Environment name. Max length: 128 chars. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/project/environments/{environmentId} +``` + +** Delete an environment of the project, with all of its resources and users. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| environmentId | string | **Required** Environment unique ID. | | + + ```http request GET https://cloud.appwrite.io/v1/project/keys ``` @@ -253,7 +321,9 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/apple | 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. | | +| enabled | boolean | Browser-based OAuth2 sign-in status. Set to true to enable new session creation through the redirect flow. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. Has no effect on native sign-in, which is controlled by nativeEnabled only. | | +| nativeClientIds | array | App bundle IDs accepted as ID token audiences for native Sign in with Apple. For example: com.example.app. Together with the Services ID, these are the only client IDs whose tokens are trusted. Pass an empty array to clear the list. | | +| nativeEnabled | boolean | Native Sign in with Apple status. This is the only switch for creating sessions from ID tokens obtained on device and is independent of enabled. Needs a Services ID or at least one native client ID to match tokens against, but no key or team ID: this method verifies a signature rather than redeeming an authorization code. | | ```http request @@ -285,6 +355,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/auth0 | 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. | | +| prompt | array | Array of Auth0 OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. "login" means: prompt the user to re-authenticate. "consent" means: prompt the user for consent. Pass an empty array to use the Auth0 default. | | ```http request @@ -406,6 +477,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/discord | 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. | | +| prompt | array | Array with at most one Discord OAuth2 prompt value. "none" means: skip the authorization screen for users who already authorized the app with the requested scopes. "consent" means: ask users who already authorized the app to approve it again. Pass an empty array to use the Discord default. | | ```http request @@ -512,6 +584,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/github | 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. | | +| prompt | array | Array of GitHub OAuth2 prompt values. "select_account" means: prompt the user to select an account. Pass an empty array to use the GitHub default. | | ```http request @@ -543,7 +616,9 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/google | clientId | string | 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com | | | clientSecret | string | 'Client Secret' of Google OAuth2 app. For example: GOCSPX-2k8gsR0000000000000000VNahJj | | | prompt | array | Array of Google OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. Must not be specified with other values. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. | | -| enabled | boolean | OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. | | +| enabled | boolean | Browser-based OAuth2 sign-in status. Set to true to enable new session creation through the redirect flow. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. Has no effect on native sign-in, which is controlled by nativeEnabled only. | | +| nativeClientIds | array | Additional OAuth2 client IDs accepted as ID token audiences for native sign-in (Android and iOS client IDs). Together with the client ID, which is always accepted, these are the only client IDs whose tokens are trusted. Pass an empty array to clear the list. | | +| nativeEnabled | boolean | Native Google sign-in status. This is the only switch for creating sessions from ID tokens obtained on device and is independent of enabled. Needs a client ID or at least one native client ID to match tokens against, but no client secret: this method verifies a signature rather than redeeming an authorization code. | | ```http request @@ -561,6 +636,22 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/huggingface | 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/kakao +``` + +** Update the project OAuth2 Kakao configuration. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| clientId | string | 'REST API key' of Kakao OAuth2 app. For example: 839ff5000000000000000000013206de | | +| clientSecret | string | 'Client Secret' of Kakao OAuth2 app. For example: jLNVOK00000000000000000000yJebea. Generate it under Kakao Login > Security and set its status to enabled | | +| prompt | array | Array of Kakao OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. "login" means: prompt the user to re-authenticate. "create" means: prompt the user to sign up. "select_account" means: prompt the user to select an account. Pass an empty array to use the Kakao default. | | +| 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 ``` @@ -622,6 +713,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/microsoft | 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. | | +| prompt | array | Array of Microsoft OAuth2 prompt values. "none" means: don't display any authentication or consent screens. "login" means: prompt the user to re-authenticate. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. Pass an empty array to use the Microsoft default. | | ```http request @@ -675,6 +767,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/okta | 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. | | +| prompt | array | Array of Okta OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. "login" means: prompt the user to re-authenticate. "consent" means: prompt the user for consent. Pass an empty array to use the Okta default. | | ```http request @@ -750,6 +843,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/salesforce | 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. | | +| prompt | array | Array of Salesforce OAuth2 prompt values. "login" means: prompt the user to re-authenticate. "consent" means: prompt the user for consent. Pass an empty array to use the Salesforce default. | | ```http request @@ -797,6 +891,21 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/stripe | 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/tiktok +``` + +** Update the project OAuth2 TikTok configuration. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| clientId | string | 'Client key' of TikTok OAuth2 app. For example: awz000000000tyw0 | | +| clientSecret | string | 'Client secret' of TikTok OAuth2 app. For example: 6wXewM00000000000000000000yXnite | | +| 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/tradeshift ``` @@ -842,6 +951,21 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/twitch | 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/webflow +``` + +** Update the project OAuth2 Webflow configuration. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| clientId | string | 'Client ID' of Webflow OAuth2 app. For example: 8bb20000000000000000000000000000000000000000000000000000000040dd | | +| clientSecret | string | 'Client Secret' of Webflow OAuth2 app. For example: 59bf00000000000000000000000000000000000000000000000000000000fe59 | | +| 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 ``` @@ -915,6 +1039,7 @@ PATCH https://cloud.appwrite.io/v1/project/oauth2/zoho | 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. | | +| prompt | array | Array of Zoho OAuth2 prompt values. "consent" means: prompt the user for consent. Pass an empty array to use the Zoho default. | | ```http request @@ -972,6 +1097,7 @@ POST https://cloud.appwrite.io/v1/project/platforms/android | platformId | string | Platform 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 | Platform name. Max length: 128 chars. | | | applicationId | string | Android application ID. Max length: 256 chars. | | +| fingerprints | array | SHA-256 fingerprints of the certificates your app is signed with, such as "14:6D:E9:...:2B:6A". Passkeys created in the app are accepted when its signature matches one. Find them under App signing in Play Console, or with `./gradlew signingReport`. | [] | ```http request @@ -987,6 +1113,7 @@ PUT https://cloud.appwrite.io/v1/project/platforms/android/{platformId} | platformId | string | **Required** Platform ID. | | | name | string | Platform name. Max length: 128 chars. | | | applicationId | string | Android application ID. Max length: 256 chars. | | +| fingerprints | array | SHA-256 fingerprints of the certificates your app is signed with, such as "14:6D:E9:...:2B:6A". Passkeys created in the app are accepted when its signature matches one. Find them under App signing in Play Console, or with `./gradlew signingReport`. Omit to keep the current list, or pass an empty array to clear it. | | ```http request @@ -1289,6 +1416,35 @@ PATCH https://cloud.appwrite.io/v1/project/policies/password-personal-data | 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/password-pwned +``` + +** Updating this policy allows you to control if passwords are checked against the Have I Been Pwned breach database. When enabled, every password a user signs up, signs in or resets with is checked and the result is recorded on the user as `passwordPwned`. On its own the policy only records. Enable `users` to reject a breached password when a user signs up or sets a new password, and `sessions` to refuse a sign-in with a breached password until it is reset. Only the first five characters of the password hash are ever shared with the service. Options left out keep their current value. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| enabled | boolean | Toggle password pwned policy. Set to true to check passwords against known data breaches and record the result on the user, or false to never check. Default is true. On its own this only records; use `users` and `sessions` to block. When changing this policy, existing passwords remain valid. | | +| sessions | boolean | Whether a sign-in with a breached password is refused until the password is reset. Default is false, which allows the sign-in and only records the result. | | +| users | boolean | Whether a breached password is rejected when a user signs up or sets a new password. Default is false, which allows the password and only records the result. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/project/policies/password-rotation +``` + +** Require a password reset when an email/password sign-in uses a password older than the configured maximum age. Options left out keep their current value. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| enabled | boolean | Enable password rotation. Disabled by default. | | +| maxAge | integer | Maximum password age in seconds. Minimum allowed value is 86400 seconds (1 day), and maximum is 10 years, which is 315360000 seconds. Defaults to 1 year, which is 31536000 seconds. | | + + ```http request PATCH https://cloud.appwrite.io/v1/project/policies/password-strength ``` diff --git a/docs/sites.md b/docs/sites.md index 6fdd49d0..061d1519 100644 --- a/docs/sites.md +++ b/docs/sites.md @@ -58,6 +58,12 @@ GET https://cloud.appwrite.io/v1/sites/frameworks ** Get a list of all frameworks that are currently available on the server instance. ** +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| 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/sites/specifications @@ -70,6 +76,7 @@ GET https://cloud.appwrite.io/v1/sites/specifications | Field Name | Type | Description | Default | | --- | --- | --- | --- | | type | string | Specification type to list. Can be one of: runtimes, builds. Defaults to runtimes. | runtimes | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request diff --git a/docs/tablesdb.md b/docs/tablesdb.md index 4e1b191d..4f2816ef 100644 --- a/docs/tablesdb.md +++ b/docs/tablesdb.md @@ -53,6 +53,7 @@ GET https://cloud.appwrite.io/v1/tablesdb/transactions | 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). | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request diff --git a/docs/teams.md b/docs/teams.md index 6f465c7a..c08fa9b7 100644 --- a/docs/teams.md +++ b/docs/teams.md @@ -184,6 +184,7 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee | roles | array | Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. | | | url | string | URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. | | | name | string | Name of the new team member. Max length: 128 chars. | | +| membershipId | string | Membership 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. | | ```http request diff --git a/docs/vectorsdb.md b/docs/vectorsdb.md index d63113b2..70da401a 100644 --- a/docs/vectorsdb.md +++ b/docs/vectorsdb.md @@ -52,6 +52,7 @@ GET https://cloud.appwrite.io/v1/vectorsdb/transactions | 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). | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | ```http request diff --git a/docs/waf.md b/docs/waf.md new file mode 100644 index 00000000..d2bde476 --- /dev/null +++ b/docs/waf.md @@ -0,0 +1,275 @@ +# Waf Service + + +```http request +GET https://cloud.appwrite.io/v1/waf/rules +``` + +** List WAF rules for 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. | [] | +| search | string | Search term to filter your list results. Max length: 256 chars. | | +| 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/waf/rules/bypass +``` + +** Create a bypass WAF rule. Conditions can match request attributes including `ip` (plain IPs or CIDR blocks like `10.0.0.0/8`), `method`, `path`, `host`, `country`, `continent`, `headers.`, `query.`, `queryKeys`, `userAgent`, `os`, `osVersion`, `browser`, and `browserVersion`. Conditions on `city` and `state` require the premium Geo DB addon. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| ruleId | string | Rule ID. Choose a custom ID or pass `ID.unique()` to generate a unique one. | | +| resourceType | string | Resource type the rule applies to. | | +| resourceId | string | Resource identifier. Leave empty for the API resource type. | | +| name | string | Rule name. | | +| description | string | Optional description for the rule. | | +| priority | integer | Evaluation priority. Lower numbers run earlier. | 0 | +| enabled | boolean | Set to false to create the rule in a disabled state. | 1 | +| conditions | array | Array of condition strings generated using the WAF Condition builder. Maximum of 100 conditions are allowed, each 4096 characters long. | [] | + + +```http request +PATCH https://cloud.appwrite.io/v1/waf/rules/bypass/{ruleId} +``` + +** Update a bypass WAF rule. Conditions can match request attributes including `ip` (plain IPs or CIDR blocks like `10.0.0.0/8`), `method`, `path`, `host`, `country`, `continent`, `headers.`, `query.`, `queryKeys`, `userAgent`, `os`, `osVersion`, `browser`, and `browserVersion`. Conditions on `city` and `state` require the premium Geo DB addon. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| ruleId | string | **Required** Rule ID. | | +| resourceType | string | Resource type the rule applies to. | | +| resourceId | string | Resource identifier. Required for functions and sites. | | +| name | string | Rule name. | | +| description | string | Optional description for the rule. | | +| priority | integer | Evaluation priority. Lower numbers run earlier. | | +| enabled | boolean | Set to false to disable the rule. | | +| conditions | array | Array of condition strings generated using the WAF Condition builder. Maximum of 100 conditions are allowed, each 4096 characters long. | | + + +```http request +POST https://cloud.appwrite.io/v1/waf/rules/challenge +``` + +** Create a challenge WAF rule. Use `difficulty` (1 easiest to 5 hardest) to tune the client-side proof-of-work cost, and `ttl` to control how long, in seconds, a visitor stays cleared after passing the challenge before being challenged again. Conditions can match request attributes including `ip` (plain IPs or CIDR blocks like `10.0.0.0/8`), `method`, `path`, `host`, `country`, `continent`, `headers.`, `query.`, `queryKeys`, `userAgent`, `os`, `osVersion`, `browser`, and `browserVersion`. Conditions on `city` and `state` require the premium Geo DB addon. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| ruleId | string | Rule ID. Choose a custom ID or pass `ID.unique()` to generate a unique one. | | +| resourceType | string | Resource type the rule applies to. | | +| resourceId | string | Resource identifier. Required for functions and sites. | | +| name | string | Rule name. | | +| description | string | Optional description for the rule. | | +| challengeType | string | Challenge type enforced by the rule. | compute | +| priority | integer | Evaluation priority. Lower numbers run earlier. | 0 | +| enabled | boolean | Set to false to create the rule in a disabled state. | 1 | +| conditions | array | Array of condition strings generated using the WAF Condition builder. Maximum of 100 conditions are allowed, each 4096 characters long. | [] | +| difficulty | integer | Challenge difficulty from 1 (easiest) to 5 (hardest). Higher values demand more client-side proof-of-work. | 3 | +| ttl | integer | How long, in seconds, a visitor stays cleared after passing the challenge before being challenged again. | 1800 | + + +```http request +PATCH https://cloud.appwrite.io/v1/waf/rules/challenge/{ruleId} +``` + +** Update a challenge WAF rule. Use `difficulty` (1 easiest to 5 hardest) to tune the client-side proof-of-work cost, and `ttl` to control how long, in seconds, a visitor stays cleared after passing the challenge before being challenged again. Conditions can match request attributes including `ip` (plain IPs or CIDR blocks like `10.0.0.0/8`), `method`, `path`, `host`, `country`, `continent`, `headers.`, `query.`, `queryKeys`, `userAgent`, `os`, `osVersion`, `browser`, and `browserVersion`. Conditions on `city` and `state` require the premium Geo DB addon. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| ruleId | string | **Required** Rule ID. | | +| resourceType | string | Resource type the rule applies to. | | +| resourceId | string | Resource identifier. Required for functions and sites. | | +| name | string | Rule name. | | +| description | string | Optional description for the rule. | | +| challengeType | string | Challenge type enforced by the rule. | | +| priority | integer | Evaluation priority. Lower numbers run earlier. | | +| enabled | boolean | Set to false to disable the rule. | | +| conditions | array | Array of condition strings generated using the WAF Condition builder. Maximum of 100 conditions are allowed, each 4096 characters long. | | +| difficulty | integer | Challenge difficulty from 1 (easiest) to 5 (hardest). Higher values demand more client-side proof-of-work. | | +| ttl | integer | How long, in seconds, a visitor stays cleared after passing the challenge before being challenged again. | | + + +```http request +POST https://cloud.appwrite.io/v1/waf/rules/deny +``` + +** Create a deny WAF rule. Conditions can match request attributes including `ip` (plain IPs or CIDR blocks like `10.0.0.0/8`), `method`, `path`, `host`, `country`, `continent`, `headers.`, `query.`, `queryKeys`, `userAgent`, `os`, `osVersion`, `browser`, and `browserVersion`. Conditions on `city` and `state` require the premium Geo DB addon. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| ruleId | string | Rule ID. Choose a custom ID or pass `ID.unique()` to generate a unique one. | | +| resourceType | string | Resource type the rule applies to. | | +| resourceId | string | Resource identifier. Required for functions and sites. | | +| name | string | Rule name. | | +| description | string | Optional description for the rule. | | +| priority | integer | Evaluation priority. Lower numbers run earlier. | 0 | +| enabled | boolean | Set to false to create the rule in a disabled state. | 1 | +| conditions | array | Array of condition strings generated using the WAF Condition builder. Maximum of 100 conditions are allowed, each 4096 characters long. | [] | + + +```http request +PATCH https://cloud.appwrite.io/v1/waf/rules/deny/{ruleId} +``` + +** Update a deny WAF rule. Conditions can match request attributes including `ip` (plain IPs or CIDR blocks like `10.0.0.0/8`), `method`, `path`, `host`, `country`, `continent`, `headers.`, `query.`, `queryKeys`, `userAgent`, `os`, `osVersion`, `browser`, and `browserVersion`. Conditions on `city` and `state` require the premium Geo DB addon. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| ruleId | string | **Required** Rule ID. | | +| resourceType | string | Resource type the rule applies to. | | +| resourceId | string | Resource identifier. Required for functions and sites. | | +| name | string | Rule name. | | +| description | string | Optional description for the rule. | | +| priority | integer | Evaluation priority. Lower numbers run earlier. | | +| enabled | boolean | Set to false to disable the rule. | | +| conditions | array | Array of condition strings generated using the WAF Condition builder. Maximum of 100 conditions are allowed, each 4096 characters long. | | + + +```http request +POST https://cloud.appwrite.io/v1/waf/rules/rate-limit +``` + +** Create a rate limit WAF rule. Use `key` to choose the counter: `ip` limits per client IP, while `userId` limits per authenticated user (requests without an authenticated user skip `userId` rules). Conditions can match request attributes including `ip` (plain IPs or CIDR blocks like `10.0.0.0/8`), `method`, `path`, `host`, `country`, `continent`, `headers.`, `query.`, `queryKeys`, `userAgent`, `os`, `osVersion`, `browser`, and `browserVersion`. Conditions on `city` and `state` require the premium Geo DB addon. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| ruleId | string | Rule ID. Choose a custom ID or pass `ID.unique()` to generate a unique one. | | +| resourceType | string | Resource type the rule applies to. | | +| resourceId | string | Resource identifier. Required for functions and sites. | | +| name | string | Rule name. | | +| description | string | Optional description for the rule. | | +| limit | integer | Maximum number of matching requests allowed in the configured interval. | | +| interval | integer | Interval in seconds used for rate limiting. | | +| key | string | Rate limit key. Use `ip` to limit per client IP or `userId` to limit per authenticated user. Requests without an authenticated user skip `userId` rules. | ip | +| strategy | string | Rate limit strategy. `fixedWindow` counts requests in discrete intervals, `slidingWindow` weights the previous interval for smoother limiting, and `tokenBucket` refills allowance continuously to permit short bursts. | fixedWindow | +| maxBucketSize | integer | Maximum number of tokens the bucket can hold for the `tokenBucket` strategy, controlling how large a burst is allowed. The sustained refill rate is `limit / interval`. Defaults to `limit` when omitted. Ignored by other strategies. | | +| priority | integer | Evaluation priority. Lower numbers run earlier. | 0 | +| enabled | boolean | Set to false to create the rule in a disabled state. | 1 | +| conditions | array | Array of condition strings generated using the WAF Condition builder. Maximum of 100 conditions are allowed, each 4096 characters long. | [] | + + +```http request +PATCH https://cloud.appwrite.io/v1/waf/rules/rate-limit/{ruleId} +``` + +** Update a rate limit WAF rule. Use `key` to choose the counter: `ip` limits per client IP, while `userId` limits per authenticated user (requests without an authenticated user skip `userId` rules). Conditions can match request attributes including `ip` (plain IPs or CIDR blocks like `10.0.0.0/8`), `method`, `path`, `host`, `country`, `continent`, `headers.`, `query.`, `queryKeys`, `userAgent`, `os`, `osVersion`, `browser`, and `browserVersion`. Conditions on `city` and `state` require the premium Geo DB addon. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| ruleId | string | **Required** Rule ID. | | +| resourceType | string | Resource type the rule applies to. | | +| resourceId | string | Resource identifier. Required for functions and sites. | | +| name | string | Rule name. | | +| description | string | Optional description for the rule. | | +| limit | integer | Maximum number of matching requests allowed in the configured interval. | | +| interval | integer | Interval in seconds used for rate limiting. | | +| key | string | Rate limit key. Use `ip` to limit per client IP or `userId` to limit per authenticated user. Requests without an authenticated user skip `userId` rules. | | +| maxBucketSize | integer | Maximum number of tokens the bucket can hold for the `tokenBucket` strategy, controlling how large a burst is allowed. The sustained refill rate is `limit / interval`. Ignored by other strategies. The strategy itself cannot be changed after creation. | | +| priority | integer | Evaluation priority. Lower numbers run earlier. | | +| enabled | boolean | Set to false to disable the rule. | | +| conditions | array | Array of condition strings generated using the WAF Condition builder. Maximum of 100 conditions are allowed, each 4096 characters long. | | + + +```http request +POST https://cloud.appwrite.io/v1/waf/rules/redirect +``` + +** Create a redirect WAF rule. Conditions can match request attributes including `ip` (plain IPs or CIDR blocks like `10.0.0.0/8`), `method`, `path`, `host`, `country`, `continent`, `headers.`, `query.`, `queryKeys`, `userAgent`, `os`, `osVersion`, `browser`, and `browserVersion`. Conditions on `city` and `state` require the premium Geo DB addon. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| ruleId | string | Rule ID. Choose a custom ID or pass `ID.unique()` to generate a unique one. | | +| resourceType | string | Resource type the rule applies to. | | +| resourceId | string | Resource identifier. Required for functions and sites. | | +| name | string | Rule name. | | +| description | string | Optional description for the rule. | | +| location | string | Location used for redirect responses. | | +| statusCode | integer | Integer status code used for redirect responses. | | +| priority | integer | Evaluation priority. Lower numbers run earlier. | 0 | +| enabled | boolean | Set to false to create the rule in a disabled state. | 1 | +| conditions | array | Array of condition strings generated using the WAF Condition builder. Maximum of 100 conditions are allowed, each 4096 characters long. | [] | + + +```http request +PATCH https://cloud.appwrite.io/v1/waf/rules/redirect/{ruleId} +``` + +** Update a redirect WAF rule. Conditions can match request attributes including `ip` (plain IPs or CIDR blocks like `10.0.0.0/8`), `method`, `path`, `host`, `country`, `continent`, `headers.`, `query.`, `queryKeys`, `userAgent`, `os`, `osVersion`, `browser`, and `browserVersion`. Conditions on `city` and `state` require the premium Geo DB addon. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| ruleId | string | **Required** Rule ID. | | +| resourceType | string | Resource type the rule applies to. | | +| resourceId | string | Resource identifier. Required for functions and sites. | | +| name | string | Rule name. | | +| description | string | Optional description for the rule. | | +| location | string | Location used for redirect responses. | | +| statusCode | integer | Integer status code used for redirect responses. | | +| priority | integer | Evaluation priority. Lower numbers run earlier. | | +| enabled | boolean | Set to false to disable the rule. | | +| conditions | array | Array of condition strings generated using the WAF Condition builder. Maximum of 100 conditions are allowed, each 4096 characters long. | | + + +```http request +GET https://cloud.appwrite.io/v1/waf/rules/{ruleId} +``` + +** Get a WAF rule by its ID. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| ruleId | string | **Required** Rule ID. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/waf/rules/{ruleId} +``` + +** Delete a WAF rule. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| ruleId | string | **Required** Rule ID. | | + diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php index 3d7f3e59..7aaf3809 100644 --- a/src/Appwrite/Client.php +++ b/src/Appwrite/Client.php @@ -43,11 +43,11 @@ class Client * */ protected array $headers = [ - 'user-agent' => 'AppwritePHPSDK/30.3.1 ()', + 'user-agent' => 'AppwritePHPSDK/30.4.0 ()', 'x-sdk-name' => 'PHP', 'x-sdk-platform' => 'server', 'x-sdk-language' => 'php', - 'x-sdk-version' => '30.3.1', + 'x-sdk-version' => '30.4.0', ]; /** diff --git a/src/Appwrite/Enums/BillingPlanGroup.php b/src/Appwrite/Enums/BillingPlanGroup.php index 8ac322dc..59b1adab 100644 --- a/src/Appwrite/Enums/BillingPlanGroup.php +++ b/src/Appwrite/Enums/BillingPlanGroup.php @@ -10,6 +10,8 @@ class BillingPlanGroup implements JsonSerializable, Stringable { private static BillingPlanGroup $STARTER; + private static BillingPlanGroup $FREE; + private static BillingPlanGroup $START; private static BillingPlanGroup $PRO; private static BillingPlanGroup $SCALE; @@ -33,6 +35,18 @@ public static function STARTER(): BillingPlanGroup return self::$STARTER; } + public static function FREE(): BillingPlanGroup + { + self::$FREE ??= new BillingPlanGroup('free'); + + return self::$FREE; + } + public static function START(): BillingPlanGroup + { + self::$START ??= new BillingPlanGroup('start'); + + return self::$START; + } public static function PRO(): BillingPlanGroup { self::$PRO ??= new BillingPlanGroup('pro'); @@ -50,6 +64,8 @@ public static function from(string $value): self { return match ($value) { 'starter' => self::STARTER(), + 'free' => self::FREE(), + 'start' => self::START(), 'pro' => self::PRO(), 'scale' => self::SCALE(), default => throw new \InvalidArgumentException('Unknown BillingPlanGroup value: ' . $value), diff --git a/src/Appwrite/Enums/BuildRuntime.php b/src/Appwrite/Enums/BuildRuntime.php index abde81da..b64d424f 100644 --- a/src/Appwrite/Enums/BuildRuntime.php +++ b/src/Appwrite/Enums/BuildRuntime.php @@ -60,6 +60,7 @@ class BuildRuntime implements JsonSerializable, Stringable private static BuildRuntime $DART310; private static BuildRuntime $DART311; private static BuildRuntime $DART312; + private static BuildRuntime $DART313; private static BuildRuntime $DOTNET60; private static BuildRuntime $DOTNET70; private static BuildRuntime $DOTNET80; @@ -102,6 +103,7 @@ class BuildRuntime implements JsonSerializable, Stringable private static BuildRuntime $FLUTTER338; private static BuildRuntime $FLUTTER341; private static BuildRuntime $FLUTTER344; + private static BuildRuntime $FLUTTER347; private function __construct(private readonly string $value) { @@ -423,6 +425,12 @@ public static function DART312(): BuildRuntime return self::$DART312; } + public static function DART313(): BuildRuntime + { + self::$DART313 ??= new BuildRuntime('dart-3.13'); + + return self::$DART313; + } public static function DOTNET60(): BuildRuntime { self::$DOTNET60 ??= new BuildRuntime('dotnet-6.0'); @@ -675,6 +683,12 @@ public static function FLUTTER344(): BuildRuntime return self::$FLUTTER344; } + public static function FLUTTER347(): BuildRuntime + { + self::$FLUTTER347 ??= new BuildRuntime('flutter-3.47'); + + return self::$FLUTTER347; + } public static function from(string $value): self { @@ -730,6 +744,7 @@ public static function from(string $value): self 'dart-3.10' => self::DART310(), 'dart-3.11' => self::DART311(), 'dart-3.12' => self::DART312(), + 'dart-3.13' => self::DART313(), 'dotnet-6.0' => self::DOTNET60(), 'dotnet-7.0' => self::DOTNET70(), 'dotnet-8.0' => self::DOTNET80(), @@ -772,6 +787,7 @@ public static function from(string $value): self 'flutter-3.38' => self::FLUTTER338(), 'flutter-3.41' => self::FLUTTER341(), 'flutter-3.44' => self::FLUTTER344(), + 'flutter-3.47' => self::FLUTTER347(), default => throw new \InvalidArgumentException('Unknown BuildRuntime value: ' . $value), }; } diff --git a/src/Appwrite/Enums/DatabasesIndexType.php b/src/Appwrite/Enums/DatabasesIndexType.php index bdc86029..33d4d424 100644 --- a/src/Appwrite/Enums/DatabasesIndexType.php +++ b/src/Appwrite/Enums/DatabasesIndexType.php @@ -13,6 +13,7 @@ class DatabasesIndexType implements JsonSerializable, Stringable private static DatabasesIndexType $FULLTEXT; private static DatabasesIndexType $UNIQUE; private static DatabasesIndexType $SPATIAL; + private static DatabasesIndexType $TRIGRAM; private function __construct(private readonly string $value) { @@ -52,6 +53,12 @@ public static function SPATIAL(): DatabasesIndexType return self::$SPATIAL; } + public static function TRIGRAM(): DatabasesIndexType + { + self::$TRIGRAM ??= new DatabasesIndexType('trigram'); + + return self::$TRIGRAM; + } public static function from(string $value): self { @@ -60,6 +67,7 @@ public static function from(string $value): self 'fulltext' => self::FULLTEXT(), 'unique' => self::UNIQUE(), 'spatial' => self::SPATIAL(), + 'trigram' => self::TRIGRAM(), default => throw new \InvalidArgumentException('Unknown DatabasesIndexType value: ' . $value), }; } diff --git a/src/Appwrite/Enums/DomainRegistrationType.php b/src/Appwrite/Enums/DomainRegistrationType.php new file mode 100644 index 00000000..5284f77f --- /dev/null +++ b/src/Appwrite/Enums/DomainRegistrationType.php @@ -0,0 +1,66 @@ +value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function NEW(): DomainRegistrationType + { + self::$NEW ??= new DomainRegistrationType('new'); + + return self::$NEW; + } + public static function TRANSFER(): DomainRegistrationType + { + self::$TRANSFER ??= new DomainRegistrationType('transfer'); + + return self::$TRANSFER; + } + public static function RENEWAL(): DomainRegistrationType + { + self::$RENEWAL ??= new DomainRegistrationType('renewal'); + + return self::$RENEWAL; + } + public static function TRADE(): DomainRegistrationType + { + self::$TRADE ??= new DomainRegistrationType('trade'); + + return self::$TRADE; + } + + public static function from(string $value): self + { + return match ($value) { + 'new' => self::NEW(), + 'transfer' => self::TRANSFER(), + 'renewal' => self::RENEWAL(), + 'trade' => self::TRADE(), + default => throw new \InvalidArgumentException('Unknown DomainRegistrationType value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/DomainTransferStatusEnum.php b/src/Appwrite/Enums/DomainTransferStatusEnum.php new file mode 100644 index 00000000..892f727e --- /dev/null +++ b/src/Appwrite/Enums/DomainTransferStatusEnum.php @@ -0,0 +1,98 @@ +value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function TRANSFERRABLE(): DomainTransferStatusEnum + { + self::$TRANSFERRABLE ??= new DomainTransferStatusEnum('transferrable'); + + return self::$TRANSFERRABLE; + } + public static function NOTTRANSFERRABLE(): DomainTransferStatusEnum + { + self::$NOTTRANSFERRABLE ??= new DomainTransferStatusEnum('not_transferrable'); + + return self::$NOTTRANSFERRABLE; + } + public static function PENDINGOWNER(): DomainTransferStatusEnum + { + self::$PENDINGOWNER ??= new DomainTransferStatusEnum('pending_owner'); + + return self::$PENDINGOWNER; + } + public static function PENDINGADMIN(): DomainTransferStatusEnum + { + self::$PENDINGADMIN ??= new DomainTransferStatusEnum('pending_admin'); + + return self::$PENDINGADMIN; + } + public static function PENDINGREGISTRY(): DomainTransferStatusEnum + { + self::$PENDINGREGISTRY ??= new DomainTransferStatusEnum('pending_registry'); + + return self::$PENDINGREGISTRY; + } + public static function COMPLETED(): DomainTransferStatusEnum + { + self::$COMPLETED ??= new DomainTransferStatusEnum('completed'); + + return self::$COMPLETED; + } + public static function CANCELLED(): DomainTransferStatusEnum + { + self::$CANCELLED ??= new DomainTransferStatusEnum('cancelled'); + + return self::$CANCELLED; + } + public static function SERVICEUNAVAILABLE(): DomainTransferStatusEnum + { + self::$SERVICEUNAVAILABLE ??= new DomainTransferStatusEnum('service_unavailable'); + + return self::$SERVICEUNAVAILABLE; + } + + public static function from(string $value): self + { + return match ($value) { + 'transferrable' => self::TRANSFERRABLE(), + 'not_transferrable' => self::NOTTRANSFERRABLE(), + 'pending_owner' => self::PENDINGOWNER(), + 'pending_admin' => self::PENDINGADMIN(), + 'pending_registry' => self::PENDINGREGISTRY(), + 'completed' => self::COMPLETED(), + 'cancelled' => self::CANCELLED(), + 'service_unavailable' => self::SERVICEUNAVAILABLE(), + default => throw new \InvalidArgumentException('Unknown DomainTransferStatusEnum value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/Framework.php b/src/Appwrite/Enums/Framework.php index bcea65b7..64710428 100644 --- a/src/Appwrite/Enums/Framework.php +++ b/src/Appwrite/Enums/Framework.php @@ -21,6 +21,7 @@ class Framework implements JsonSerializable, Stringable private static Framework $REMIX; private static Framework $LYNX; private static Framework $FLUTTER; + private static Framework $JASPR; private static Framework $REACTNATIVE; private static Framework $VITE; private static Framework $OTHER; @@ -111,6 +112,12 @@ public static function FLUTTER(): Framework return self::$FLUTTER; } + public static function JASPR(): Framework + { + self::$JASPR ??= new Framework('jaspr'); + + return self::$JASPR; + } public static function REACTNATIVE(): Framework { self::$REACTNATIVE ??= new Framework('react-native'); @@ -145,6 +152,7 @@ public static function from(string $value): self 'remix' => self::REMIX(), 'lynx' => self::LYNX(), 'flutter' => self::FLUTTER(), + 'jaspr' => self::JASPR(), 'react-native' => self::REACTNATIVE(), 'vite' => self::VITE(), 'other' => self::OTHER(), diff --git a/src/Appwrite/Enums/IdTokenProvider.php b/src/Appwrite/Enums/IdTokenProvider.php new file mode 100644 index 00000000..1bdad069 --- /dev/null +++ b/src/Appwrite/Enums/IdTokenProvider.php @@ -0,0 +1,50 @@ +value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function APPLE(): IdTokenProvider + { + self::$APPLE ??= new IdTokenProvider('apple'); + + return self::$APPLE; + } + public static function GOOGLE(): IdTokenProvider + { + self::$GOOGLE ??= new IdTokenProvider('google'); + + return self::$GOOGLE; + } + + public static function from(string $value): self + { + return match ($value) { + 'apple' => self::APPLE(), + 'google' => self::GOOGLE(), + default => throw new \InvalidArgumentException('Unknown IdTokenProvider value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/ImageGravity.php b/src/Appwrite/Enums/ImageGravity.php index 871f5153..4ff83e16 100644 --- a/src/Appwrite/Enums/ImageGravity.php +++ b/src/Appwrite/Enums/ImageGravity.php @@ -9,6 +9,7 @@ class ImageGravity implements JsonSerializable, Stringable { + private static ImageGravity $AUTO; private static ImageGravity $CENTER; private static ImageGravity $TOPLEFT; private static ImageGravity $TOP; @@ -33,6 +34,12 @@ public function jsonSerialize(): string return $this->value; } + public static function AUTO(): ImageGravity + { + self::$AUTO ??= new ImageGravity('auto'); + + return self::$AUTO; + } public static function CENTER(): ImageGravity { self::$CENTER ??= new ImageGravity('center'); @@ -91,6 +98,7 @@ public static function BOTTOMRIGHT(): ImageGravity public static function from(string $value): self { return match ($value) { + 'auto' => self::AUTO(), 'center' => self::CENTER(), 'top-left' => self::TOPLEFT(), 'top' => self::TOP(), diff --git a/src/Appwrite/Enums/OAuth2Auth0Prompt.php b/src/Appwrite/Enums/OAuth2Auth0Prompt.php new file mode 100644 index 00000000..d28f4245 --- /dev/null +++ b/src/Appwrite/Enums/OAuth2Auth0Prompt.php @@ -0,0 +1,58 @@ +value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function NONE(): OAuth2Auth0Prompt + { + self::$NONE ??= new OAuth2Auth0Prompt('none'); + + return self::$NONE; + } + public static function LOGIN(): OAuth2Auth0Prompt + { + self::$LOGIN ??= new OAuth2Auth0Prompt('login'); + + return self::$LOGIN; + } + public static function CONSENT(): OAuth2Auth0Prompt + { + self::$CONSENT ??= new OAuth2Auth0Prompt('consent'); + + return self::$CONSENT; + } + + public static function from(string $value): self + { + return match ($value) { + 'none' => self::NONE(), + 'login' => self::LOGIN(), + 'consent' => self::CONSENT(), + default => throw new \InvalidArgumentException('Unknown OAuth2Auth0Prompt value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/OAuth2DiscordPrompt.php b/src/Appwrite/Enums/OAuth2DiscordPrompt.php new file mode 100644 index 00000000..f0061a8f --- /dev/null +++ b/src/Appwrite/Enums/OAuth2DiscordPrompt.php @@ -0,0 +1,50 @@ +value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function NONE(): OAuth2DiscordPrompt + { + self::$NONE ??= new OAuth2DiscordPrompt('none'); + + return self::$NONE; + } + public static function CONSENT(): OAuth2DiscordPrompt + { + self::$CONSENT ??= new OAuth2DiscordPrompt('consent'); + + return self::$CONSENT; + } + + public static function from(string $value): self + { + return match ($value) { + 'none' => self::NONE(), + 'consent' => self::CONSENT(), + default => throw new \InvalidArgumentException('Unknown OAuth2DiscordPrompt value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/OAuth2GithubPrompt.php b/src/Appwrite/Enums/OAuth2GithubPrompt.php new file mode 100644 index 00000000..a518bc67 --- /dev/null +++ b/src/Appwrite/Enums/OAuth2GithubPrompt.php @@ -0,0 +1,42 @@ +value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function SELECTACCOUNT(): OAuth2GithubPrompt + { + self::$SELECTACCOUNT ??= new OAuth2GithubPrompt('select_account'); + + return self::$SELECTACCOUNT; + } + + public static function from(string $value): self + { + return match ($value) { + 'select_account' => self::SELECTACCOUNT(), + default => throw new \InvalidArgumentException('Unknown OAuth2GithubPrompt value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/OAuth2KakaoPrompt.php b/src/Appwrite/Enums/OAuth2KakaoPrompt.php new file mode 100644 index 00000000..57cd967d --- /dev/null +++ b/src/Appwrite/Enums/OAuth2KakaoPrompt.php @@ -0,0 +1,66 @@ +value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function NONE(): OAuth2KakaoPrompt + { + self::$NONE ??= new OAuth2KakaoPrompt('none'); + + return self::$NONE; + } + public static function LOGIN(): OAuth2KakaoPrompt + { + self::$LOGIN ??= new OAuth2KakaoPrompt('login'); + + return self::$LOGIN; + } + public static function CREATE(): OAuth2KakaoPrompt + { + self::$CREATE ??= new OAuth2KakaoPrompt('create'); + + return self::$CREATE; + } + public static function SELECTACCOUNT(): OAuth2KakaoPrompt + { + self::$SELECTACCOUNT ??= new OAuth2KakaoPrompt('select_account'); + + return self::$SELECTACCOUNT; + } + + public static function from(string $value): self + { + return match ($value) { + 'none' => self::NONE(), + 'login' => self::LOGIN(), + 'create' => self::CREATE(), + 'select_account' => self::SELECTACCOUNT(), + default => throw new \InvalidArgumentException('Unknown OAuth2KakaoPrompt value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/OAuth2MicrosoftPrompt.php b/src/Appwrite/Enums/OAuth2MicrosoftPrompt.php new file mode 100644 index 00000000..e0f97470 --- /dev/null +++ b/src/Appwrite/Enums/OAuth2MicrosoftPrompt.php @@ -0,0 +1,66 @@ +value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function NONE(): OAuth2MicrosoftPrompt + { + self::$NONE ??= new OAuth2MicrosoftPrompt('none'); + + return self::$NONE; + } + public static function LOGIN(): OAuth2MicrosoftPrompt + { + self::$LOGIN ??= new OAuth2MicrosoftPrompt('login'); + + return self::$LOGIN; + } + public static function CONSENT(): OAuth2MicrosoftPrompt + { + self::$CONSENT ??= new OAuth2MicrosoftPrompt('consent'); + + return self::$CONSENT; + } + public static function SELECTACCOUNT(): OAuth2MicrosoftPrompt + { + self::$SELECTACCOUNT ??= new OAuth2MicrosoftPrompt('select_account'); + + return self::$SELECTACCOUNT; + } + + public static function from(string $value): self + { + return match ($value) { + 'none' => self::NONE(), + 'login' => self::LOGIN(), + 'consent' => self::CONSENT(), + 'select_account' => self::SELECTACCOUNT(), + default => throw new \InvalidArgumentException('Unknown OAuth2MicrosoftPrompt value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/OAuth2OktaPrompt.php b/src/Appwrite/Enums/OAuth2OktaPrompt.php new file mode 100644 index 00000000..5b5fa15b --- /dev/null +++ b/src/Appwrite/Enums/OAuth2OktaPrompt.php @@ -0,0 +1,58 @@ +value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function NONE(): OAuth2OktaPrompt + { + self::$NONE ??= new OAuth2OktaPrompt('none'); + + return self::$NONE; + } + public static function LOGIN(): OAuth2OktaPrompt + { + self::$LOGIN ??= new OAuth2OktaPrompt('login'); + + return self::$LOGIN; + } + public static function CONSENT(): OAuth2OktaPrompt + { + self::$CONSENT ??= new OAuth2OktaPrompt('consent'); + + return self::$CONSENT; + } + + public static function from(string $value): self + { + return match ($value) { + 'none' => self::NONE(), + 'login' => self::LOGIN(), + 'consent' => self::CONSENT(), + default => throw new \InvalidArgumentException('Unknown OAuth2OktaPrompt value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/OAuth2SalesforcePrompt.php b/src/Appwrite/Enums/OAuth2SalesforcePrompt.php new file mode 100644 index 00000000..c80f2c17 --- /dev/null +++ b/src/Appwrite/Enums/OAuth2SalesforcePrompt.php @@ -0,0 +1,50 @@ +value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function LOGIN(): OAuth2SalesforcePrompt + { + self::$LOGIN ??= new OAuth2SalesforcePrompt('login'); + + return self::$LOGIN; + } + public static function CONSENT(): OAuth2SalesforcePrompt + { + self::$CONSENT ??= new OAuth2SalesforcePrompt('consent'); + + return self::$CONSENT; + } + + public static function from(string $value): self + { + return match ($value) { + 'login' => self::LOGIN(), + 'consent' => self::CONSENT(), + default => throw new \InvalidArgumentException('Unknown OAuth2SalesforcePrompt value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/OAuth2ZohoPrompt.php b/src/Appwrite/Enums/OAuth2ZohoPrompt.php new file mode 100644 index 00000000..bd885408 --- /dev/null +++ b/src/Appwrite/Enums/OAuth2ZohoPrompt.php @@ -0,0 +1,42 @@ +value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function CONSENT(): OAuth2ZohoPrompt + { + self::$CONSENT ??= new OAuth2ZohoPrompt('consent'); + + return self::$CONSENT; + } + + public static function from(string $value): self + { + return match ($value) { + 'consent' => self::CONSENT(), + default => throw new \InvalidArgumentException('Unknown OAuth2ZohoPrompt value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/OAuthProvider.php b/src/Appwrite/Enums/OAuthProvider.php index 0a6cf91a..c65618f4 100644 --- a/src/Appwrite/Enums/OAuthProvider.php +++ b/src/Appwrite/Enums/OAuthProvider.php @@ -31,6 +31,7 @@ class OAuthProvider implements JsonSerializable, Stringable private static OAuthProvider $GITLAB; private static OAuthProvider $GOOGLE; private static OAuthProvider $HUGGINGFACE; + private static OAuthProvider $KAKAO; private static OAuthProvider $KEYCLOAK; private static OAuthProvider $KICK; private static OAuthProvider $LINKEDIN; @@ -46,9 +47,11 @@ class OAuthProvider implements JsonSerializable, Stringable private static OAuthProvider $SLACK; private static OAuthProvider $SPOTIFY; private static OAuthProvider $STRIPE; + private static OAuthProvider $TIKTOK; private static OAuthProvider $TRADESHIFT; private static OAuthProvider $TRADESHIFTBOX; private static OAuthProvider $TWITCH; + private static OAuthProvider $WEBFLOW; private static OAuthProvider $WORDPRESS; private static OAuthProvider $X; private static OAuthProvider $YAHOO; @@ -203,6 +206,12 @@ public static function HUGGINGFACE(): OAuthProvider return self::$HUGGINGFACE; } + public static function KAKAO(): OAuthProvider + { + self::$KAKAO ??= new OAuthProvider('kakao'); + + return self::$KAKAO; + } public static function KEYCLOAK(): OAuthProvider { self::$KEYCLOAK ??= new OAuthProvider('keycloak'); @@ -293,6 +302,12 @@ public static function STRIPE(): OAuthProvider return self::$STRIPE; } + public static function TIKTOK(): OAuthProvider + { + self::$TIKTOK ??= new OAuthProvider('tiktok'); + + return self::$TIKTOK; + } public static function TRADESHIFT(): OAuthProvider { self::$TRADESHIFT ??= new OAuthProvider('tradeshift'); @@ -311,6 +326,12 @@ public static function TWITCH(): OAuthProvider return self::$TWITCH; } + public static function WEBFLOW(): OAuthProvider + { + self::$WEBFLOW ??= new OAuthProvider('webflow'); + + return self::$WEBFLOW; + } public static function WORDPRESS(): OAuthProvider { self::$WORDPRESS ??= new OAuthProvider('wordpress'); @@ -379,6 +400,7 @@ public static function from(string $value): self 'gitlab' => self::GITLAB(), 'google' => self::GOOGLE(), 'huggingface' => self::HUGGINGFACE(), + 'kakao' => self::KAKAO(), 'keycloak' => self::KEYCLOAK(), 'kick' => self::KICK(), 'linkedin' => self::LINKEDIN(), @@ -394,9 +416,11 @@ public static function from(string $value): self 'slack' => self::SLACK(), 'spotify' => self::SPOTIFY(), 'stripe' => self::STRIPE(), + 'tiktok' => self::TIKTOK(), 'tradeshift' => self::TRADESHIFT(), 'tradeshiftBox' => self::TRADESHIFTBOX(), 'twitch' => self::TWITCH(), + 'webflow' => self::WEBFLOW(), 'wordpress' => self::WORDPRESS(), 'x' => self::X(), 'yahoo' => self::YAHOO(), diff --git a/src/Appwrite/Enums/ProjectEmailTemplateId.php b/src/Appwrite/Enums/ProjectEmailTemplateId.php index 4e182479..efe5f6f1 100644 --- a/src/Appwrite/Enums/ProjectEmailTemplateId.php +++ b/src/Appwrite/Enums/ProjectEmailTemplateId.php @@ -16,6 +16,8 @@ class ProjectEmailTemplateId implements JsonSerializable, Stringable private static ProjectEmailTemplateId $MFACHALLENGE; private static ProjectEmailTemplateId $SESSIONALERT; private static ProjectEmailTemplateId $OTPSESSION; + private static ProjectEmailTemplateId $OTPVERIFICATION; + private static ProjectEmailTemplateId $OTPRECOVERY; private function __construct(private readonly string $value) { @@ -73,6 +75,18 @@ public static function OTPSESSION(): ProjectEmailTemplateId return self::$OTPSESSION; } + public static function OTPVERIFICATION(): ProjectEmailTemplateId + { + self::$OTPVERIFICATION ??= new ProjectEmailTemplateId('otpVerification'); + + return self::$OTPVERIFICATION; + } + public static function OTPRECOVERY(): ProjectEmailTemplateId + { + self::$OTPRECOVERY ??= new ProjectEmailTemplateId('otpRecovery'); + + return self::$OTPRECOVERY; + } public static function from(string $value): self { @@ -84,6 +98,8 @@ public static function from(string $value): self 'mfaChallenge' => self::MFACHALLENGE(), 'sessionAlert' => self::SESSIONALERT(), 'otpSession' => self::OTPSESSION(), + 'otpVerification' => self::OTPVERIFICATION(), + 'otpRecovery' => self::OTPRECOVERY(), default => throw new \InvalidArgumentException('Unknown ProjectEmailTemplateId value: ' . $value), }; } diff --git a/src/Appwrite/Enums/ProjectKeyScopes.php b/src/Appwrite/Enums/ProjectKeyScopes.php index cdab332d..5dcb935c 100644 --- a/src/Appwrite/Enums/ProjectKeyScopes.php +++ b/src/Appwrite/Enums/ProjectKeyScopes.php @@ -99,6 +99,7 @@ class ProjectKeyScopes implements JsonSerializable, Stringable private static ProjectKeyScopes $WEBHOOKSWRITE; private static ProjectKeyScopes $LOCALEREAD; private static ProjectKeyScopes $AVATARSREAD; + private static ProjectKeyScopes $AVATARSWRITE; private static ProjectKeyScopes $HEALTHREAD; private static ProjectKeyScopes $ASSISTANTREAD; private static ProjectKeyScopes $MIGRATIONSREAD; @@ -113,6 +114,7 @@ class ProjectKeyScopes implements JsonSerializable, Stringable private static ProjectKeyScopes $REPORTSWRITE; private static ProjectKeyScopes $PRESENCESREAD; private static ProjectKeyScopes $PRESENCESWRITE; + private static ProjectKeyScopes $DEDICATEDDATABASESEXECUTE; private static ProjectKeyScopes $BACKUPSPOLICIESREAD; private static ProjectKeyScopes $BACKUPSPOLICIESWRITE; private static ProjectKeyScopes $ARCHIVESREAD; @@ -130,6 +132,8 @@ class ProjectKeyScopes implements JsonSerializable, Stringable private static ProjectKeyScopes $OAUTH2READ; private static ProjectKeyScopes $OAUTH2WRITE; private static ProjectKeyScopes $OAUTH2INTROSPECT; + private static ProjectKeyScopes $ANALYTICSREAD; + private static ProjectKeyScopes $ANALYTICSWRITE; private function __construct(private readonly string $value) { @@ -685,6 +689,12 @@ public static function AVATARSREAD(): ProjectKeyScopes return self::$AVATARSREAD; } + public static function AVATARSWRITE(): ProjectKeyScopes + { + self::$AVATARSWRITE ??= new ProjectKeyScopes('avatars.write'); + + return self::$AVATARSWRITE; + } public static function HEALTHREAD(): ProjectKeyScopes { self::$HEALTHREAD ??= new ProjectKeyScopes('health.read'); @@ -769,6 +779,12 @@ public static function PRESENCESWRITE(): ProjectKeyScopes return self::$PRESENCESWRITE; } + public static function DEDICATEDDATABASESEXECUTE(): ProjectKeyScopes + { + self::$DEDICATEDDATABASESEXECUTE ??= new ProjectKeyScopes('dedicatedDatabases.execute'); + + return self::$DEDICATEDDATABASESEXECUTE; + } public static function BACKUPSPOLICIESREAD(): ProjectKeyScopes { self::$BACKUPSPOLICIESREAD ??= new ProjectKeyScopes('backups.policies.read'); @@ -871,6 +887,18 @@ public static function OAUTH2INTROSPECT(): ProjectKeyScopes return self::$OAUTH2INTROSPECT; } + public static function ANALYTICSREAD(): ProjectKeyScopes + { + self::$ANALYTICSREAD ??= new ProjectKeyScopes('analytics.read'); + + return self::$ANALYTICSREAD; + } + public static function ANALYTICSWRITE(): ProjectKeyScopes + { + self::$ANALYTICSWRITE ??= new ProjectKeyScopes('analytics.write'); + + return self::$ANALYTICSWRITE; + } public static function from(string $value): self { @@ -965,6 +993,7 @@ public static function from(string $value): self 'webhooks.write' => self::WEBHOOKSWRITE(), 'locale.read' => self::LOCALEREAD(), 'avatars.read' => self::AVATARSREAD(), + 'avatars.write' => self::AVATARSWRITE(), 'health.read' => self::HEALTHREAD(), 'assistant.read' => self::ASSISTANTREAD(), 'migrations.read' => self::MIGRATIONSREAD(), @@ -979,6 +1008,7 @@ public static function from(string $value): self 'reports.write' => self::REPORTSWRITE(), 'presences.read' => self::PRESENCESREAD(), 'presences.write' => self::PRESENCESWRITE(), + 'dedicatedDatabases.execute' => self::DEDICATEDDATABASESEXECUTE(), 'backups.policies.read' => self::BACKUPSPOLICIESREAD(), 'backups.policies.write' => self::BACKUPSPOLICIESWRITE(), 'archives.read' => self::ARCHIVESREAD(), @@ -996,6 +1026,8 @@ public static function from(string $value): self 'oauth2.read' => self::OAUTH2READ(), 'oauth2.write' => self::OAUTH2WRITE(), 'oauth2.introspect' => self::OAUTH2INTROSPECT(), + 'analytics.read' => self::ANALYTICSREAD(), + 'analytics.write' => self::ANALYTICSWRITE(), default => throw new \InvalidArgumentException('Unknown ProjectKeyScopes value: ' . $value), }; } diff --git a/src/Appwrite/Enums/ProjectOAuth2Auth0Prompt.php b/src/Appwrite/Enums/ProjectOAuth2Auth0Prompt.php new file mode 100644 index 00000000..f3ef681f --- /dev/null +++ b/src/Appwrite/Enums/ProjectOAuth2Auth0Prompt.php @@ -0,0 +1,58 @@ +value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function NONE(): ProjectOAuth2Auth0Prompt + { + self::$NONE ??= new ProjectOAuth2Auth0Prompt('none'); + + return self::$NONE; + } + public static function LOGIN(): ProjectOAuth2Auth0Prompt + { + self::$LOGIN ??= new ProjectOAuth2Auth0Prompt('login'); + + return self::$LOGIN; + } + public static function CONSENT(): ProjectOAuth2Auth0Prompt + { + self::$CONSENT ??= new ProjectOAuth2Auth0Prompt('consent'); + + return self::$CONSENT; + } + + public static function from(string $value): self + { + return match ($value) { + 'none' => self::NONE(), + 'login' => self::LOGIN(), + 'consent' => self::CONSENT(), + default => throw new \InvalidArgumentException('Unknown ProjectOAuth2Auth0Prompt value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/ProjectOAuth2DiscordPrompt.php b/src/Appwrite/Enums/ProjectOAuth2DiscordPrompt.php new file mode 100644 index 00000000..9abc8094 --- /dev/null +++ b/src/Appwrite/Enums/ProjectOAuth2DiscordPrompt.php @@ -0,0 +1,50 @@ +value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function NONE(): ProjectOAuth2DiscordPrompt + { + self::$NONE ??= new ProjectOAuth2DiscordPrompt('none'); + + return self::$NONE; + } + public static function CONSENT(): ProjectOAuth2DiscordPrompt + { + self::$CONSENT ??= new ProjectOAuth2DiscordPrompt('consent'); + + return self::$CONSENT; + } + + public static function from(string $value): self + { + return match ($value) { + 'none' => self::NONE(), + 'consent' => self::CONSENT(), + default => throw new \InvalidArgumentException('Unknown ProjectOAuth2DiscordPrompt value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/ProjectOAuth2GitHubPrompt.php b/src/Appwrite/Enums/ProjectOAuth2GitHubPrompt.php new file mode 100644 index 00000000..a90f3b05 --- /dev/null +++ b/src/Appwrite/Enums/ProjectOAuth2GitHubPrompt.php @@ -0,0 +1,42 @@ +value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function SELECTACCOUNT(): ProjectOAuth2GitHubPrompt + { + self::$SELECTACCOUNT ??= new ProjectOAuth2GitHubPrompt('select_account'); + + return self::$SELECTACCOUNT; + } + + public static function from(string $value): self + { + return match ($value) { + 'select_account' => self::SELECTACCOUNT(), + default => throw new \InvalidArgumentException('Unknown ProjectOAuth2GitHubPrompt value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/ProjectOAuth2KakaoPrompt.php b/src/Appwrite/Enums/ProjectOAuth2KakaoPrompt.php new file mode 100644 index 00000000..774ebbb8 --- /dev/null +++ b/src/Appwrite/Enums/ProjectOAuth2KakaoPrompt.php @@ -0,0 +1,66 @@ +value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function NONE(): ProjectOAuth2KakaoPrompt + { + self::$NONE ??= new ProjectOAuth2KakaoPrompt('none'); + + return self::$NONE; + } + public static function LOGIN(): ProjectOAuth2KakaoPrompt + { + self::$LOGIN ??= new ProjectOAuth2KakaoPrompt('login'); + + return self::$LOGIN; + } + public static function CREATE(): ProjectOAuth2KakaoPrompt + { + self::$CREATE ??= new ProjectOAuth2KakaoPrompt('create'); + + return self::$CREATE; + } + public static function SELECTACCOUNT(): ProjectOAuth2KakaoPrompt + { + self::$SELECTACCOUNT ??= new ProjectOAuth2KakaoPrompt('select_account'); + + return self::$SELECTACCOUNT; + } + + public static function from(string $value): self + { + return match ($value) { + 'none' => self::NONE(), + 'login' => self::LOGIN(), + 'create' => self::CREATE(), + 'select_account' => self::SELECTACCOUNT(), + default => throw new \InvalidArgumentException('Unknown ProjectOAuth2KakaoPrompt value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/ProjectOAuth2MicrosoftPrompt.php b/src/Appwrite/Enums/ProjectOAuth2MicrosoftPrompt.php new file mode 100644 index 00000000..c0c7daea --- /dev/null +++ b/src/Appwrite/Enums/ProjectOAuth2MicrosoftPrompt.php @@ -0,0 +1,66 @@ +value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function NONE(): ProjectOAuth2MicrosoftPrompt + { + self::$NONE ??= new ProjectOAuth2MicrosoftPrompt('none'); + + return self::$NONE; + } + public static function LOGIN(): ProjectOAuth2MicrosoftPrompt + { + self::$LOGIN ??= new ProjectOAuth2MicrosoftPrompt('login'); + + return self::$LOGIN; + } + public static function CONSENT(): ProjectOAuth2MicrosoftPrompt + { + self::$CONSENT ??= new ProjectOAuth2MicrosoftPrompt('consent'); + + return self::$CONSENT; + } + public static function SELECTACCOUNT(): ProjectOAuth2MicrosoftPrompt + { + self::$SELECTACCOUNT ??= new ProjectOAuth2MicrosoftPrompt('select_account'); + + return self::$SELECTACCOUNT; + } + + public static function from(string $value): self + { + return match ($value) { + 'none' => self::NONE(), + 'login' => self::LOGIN(), + 'consent' => self::CONSENT(), + 'select_account' => self::SELECTACCOUNT(), + default => throw new \InvalidArgumentException('Unknown ProjectOAuth2MicrosoftPrompt value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/ProjectOAuth2OktaPrompt.php b/src/Appwrite/Enums/ProjectOAuth2OktaPrompt.php new file mode 100644 index 00000000..b3894bc7 --- /dev/null +++ b/src/Appwrite/Enums/ProjectOAuth2OktaPrompt.php @@ -0,0 +1,58 @@ +value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function NONE(): ProjectOAuth2OktaPrompt + { + self::$NONE ??= new ProjectOAuth2OktaPrompt('none'); + + return self::$NONE; + } + public static function LOGIN(): ProjectOAuth2OktaPrompt + { + self::$LOGIN ??= new ProjectOAuth2OktaPrompt('login'); + + return self::$LOGIN; + } + public static function CONSENT(): ProjectOAuth2OktaPrompt + { + self::$CONSENT ??= new ProjectOAuth2OktaPrompt('consent'); + + return self::$CONSENT; + } + + public static function from(string $value): self + { + return match ($value) { + 'none' => self::NONE(), + 'login' => self::LOGIN(), + 'consent' => self::CONSENT(), + default => throw new \InvalidArgumentException('Unknown ProjectOAuth2OktaPrompt value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/ProjectOAuth2SalesforcePrompt.php b/src/Appwrite/Enums/ProjectOAuth2SalesforcePrompt.php new file mode 100644 index 00000000..9236734e --- /dev/null +++ b/src/Appwrite/Enums/ProjectOAuth2SalesforcePrompt.php @@ -0,0 +1,50 @@ +value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function LOGIN(): ProjectOAuth2SalesforcePrompt + { + self::$LOGIN ??= new ProjectOAuth2SalesforcePrompt('login'); + + return self::$LOGIN; + } + public static function CONSENT(): ProjectOAuth2SalesforcePrompt + { + self::$CONSENT ??= new ProjectOAuth2SalesforcePrompt('consent'); + + return self::$CONSENT; + } + + public static function from(string $value): self + { + return match ($value) { + 'login' => self::LOGIN(), + 'consent' => self::CONSENT(), + default => throw new \InvalidArgumentException('Unknown ProjectOAuth2SalesforcePrompt value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/ProjectOAuth2ZohoPrompt.php b/src/Appwrite/Enums/ProjectOAuth2ZohoPrompt.php new file mode 100644 index 00000000..0f062a3a --- /dev/null +++ b/src/Appwrite/Enums/ProjectOAuth2ZohoPrompt.php @@ -0,0 +1,42 @@ +value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function CONSENT(): ProjectOAuth2ZohoPrompt + { + self::$CONSENT ??= new ProjectOAuth2ZohoPrompt('consent'); + + return self::$CONSENT; + } + + public static function from(string $value): self + { + return match ($value) { + 'consent' => self::CONSENT(), + default => throw new \InvalidArgumentException('Unknown ProjectOAuth2ZohoPrompt value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/ProjectOAuthProviderId.php b/src/Appwrite/Enums/ProjectOAuthProviderId.php index 1d797c89..296ec5e2 100644 --- a/src/Appwrite/Enums/ProjectOAuthProviderId.php +++ b/src/Appwrite/Enums/ProjectOAuthProviderId.php @@ -31,6 +31,7 @@ class ProjectOAuthProviderId implements JsonSerializable, Stringable private static ProjectOAuthProviderId $GITLAB; private static ProjectOAuthProviderId $GOOGLE; private static ProjectOAuthProviderId $HUGGINGFACE; + private static ProjectOAuthProviderId $KAKAO; private static ProjectOAuthProviderId $KEYCLOAK; private static ProjectOAuthProviderId $KICK; private static ProjectOAuthProviderId $LINKEDIN; @@ -46,9 +47,11 @@ class ProjectOAuthProviderId implements JsonSerializable, Stringable private static ProjectOAuthProviderId $SLACK; private static ProjectOAuthProviderId $SPOTIFY; private static ProjectOAuthProviderId $STRIPE; + private static ProjectOAuthProviderId $TIKTOK; private static ProjectOAuthProviderId $TRADESHIFT; private static ProjectOAuthProviderId $TRADESHIFTBOX; private static ProjectOAuthProviderId $TWITCH; + private static ProjectOAuthProviderId $WEBFLOW; private static ProjectOAuthProviderId $WORDPRESS; private static ProjectOAuthProviderId $X; private static ProjectOAuthProviderId $YAHOO; @@ -203,6 +206,12 @@ public static function HUGGINGFACE(): ProjectOAuthProviderId return self::$HUGGINGFACE; } + public static function KAKAO(): ProjectOAuthProviderId + { + self::$KAKAO ??= new ProjectOAuthProviderId('kakao'); + + return self::$KAKAO; + } public static function KEYCLOAK(): ProjectOAuthProviderId { self::$KEYCLOAK ??= new ProjectOAuthProviderId('keycloak'); @@ -293,6 +302,12 @@ public static function STRIPE(): ProjectOAuthProviderId return self::$STRIPE; } + public static function TIKTOK(): ProjectOAuthProviderId + { + self::$TIKTOK ??= new ProjectOAuthProviderId('tiktok'); + + return self::$TIKTOK; + } public static function TRADESHIFT(): ProjectOAuthProviderId { self::$TRADESHIFT ??= new ProjectOAuthProviderId('tradeshift'); @@ -311,6 +326,12 @@ public static function TWITCH(): ProjectOAuthProviderId return self::$TWITCH; } + public static function WEBFLOW(): ProjectOAuthProviderId + { + self::$WEBFLOW ??= new ProjectOAuthProviderId('webflow'); + + return self::$WEBFLOW; + } public static function WORDPRESS(): ProjectOAuthProviderId { self::$WORDPRESS ??= new ProjectOAuthProviderId('wordpress'); @@ -379,6 +400,7 @@ public static function from(string $value): self 'gitlab' => self::GITLAB(), 'google' => self::GOOGLE(), 'huggingface' => self::HUGGINGFACE(), + 'kakao' => self::KAKAO(), 'keycloak' => self::KEYCLOAK(), 'kick' => self::KICK(), 'linkedin' => self::LINKEDIN(), @@ -394,9 +416,11 @@ public static function from(string $value): self 'slack' => self::SLACK(), 'spotify' => self::SPOTIFY(), 'stripe' => self::STRIPE(), + 'tiktok' => self::TIKTOK(), 'tradeshift' => self::TRADESHIFT(), 'tradeshiftBox' => self::TRADESHIFTBOX(), 'twitch' => self::TWITCH(), + 'webflow' => self::WEBFLOW(), 'wordpress' => self::WORDPRESS(), 'x' => self::X(), 'yahoo' => self::YAHOO(), diff --git a/src/Appwrite/Enums/ProjectPolicyId.php b/src/Appwrite/Enums/ProjectPolicyId.php index 3b134d5c..e3513a52 100644 --- a/src/Appwrite/Enums/ProjectPolicyId.php +++ b/src/Appwrite/Enums/ProjectPolicyId.php @@ -13,6 +13,8 @@ class ProjectPolicyId implements JsonSerializable, Stringable private static ProjectPolicyId $PASSWORDHISTORY; private static ProjectPolicyId $PASSWORDSTRENGTH; private static ProjectPolicyId $PASSWORDPERSONALDATA; + private static ProjectPolicyId $PASSWORDPWNED; + private static ProjectPolicyId $PASSWORDROTATION; private static ProjectPolicyId $SESSIONALERT; private static ProjectPolicyId $SESSIONDURATION; private static ProjectPolicyId $SESSIONINVALIDATION; @@ -64,6 +66,18 @@ public static function PASSWORDPERSONALDATA(): ProjectPolicyId return self::$PASSWORDPERSONALDATA; } + public static function PASSWORDPWNED(): ProjectPolicyId + { + self::$PASSWORDPWNED ??= new ProjectPolicyId('password-pwned'); + + return self::$PASSWORDPWNED; + } + public static function PASSWORDROTATION(): ProjectPolicyId + { + self::$PASSWORDROTATION ??= new ProjectPolicyId('password-rotation'); + + return self::$PASSWORDROTATION; + } public static function SESSIONALERT(): ProjectPolicyId { self::$SESSIONALERT ??= new ProjectPolicyId('session-alert'); @@ -144,6 +158,8 @@ public static function from(string $value): self 'password-history' => self::PASSWORDHISTORY(), 'password-strength' => self::PASSWORDSTRENGTH(), 'password-personal-data' => self::PASSWORDPERSONALDATA(), + 'password-pwned' => self::PASSWORDPWNED(), + 'password-rotation' => self::PASSWORDROTATION(), 'session-alert' => self::SESSIONALERT(), 'session-duration' => self::SESSIONDURATION(), 'session-invalidation' => self::SESSIONINVALIDATION(), diff --git a/src/Appwrite/Enums/ProxyRuleDeploymentResourceType.php b/src/Appwrite/Enums/ProxyRuleDeploymentResourceType.php index 20549427..06adad67 100644 --- a/src/Appwrite/Enums/ProxyRuleDeploymentResourceType.php +++ b/src/Appwrite/Enums/ProxyRuleDeploymentResourceType.php @@ -11,6 +11,7 @@ class ProxyRuleDeploymentResourceType implements JsonSerializable, Stringable { private static ProxyRuleDeploymentResourceType $FUNCTION; private static ProxyRuleDeploymentResourceType $SITE; + private static ProxyRuleDeploymentResourceType $DEDICATEDDATABASE; private function __construct(private readonly string $value) { @@ -38,12 +39,19 @@ public static function SITE(): ProxyRuleDeploymentResourceType return self::$SITE; } + public static function DEDICATEDDATABASE(): ProxyRuleDeploymentResourceType + { + self::$DEDICATEDDATABASE ??= new ProxyRuleDeploymentResourceType('dedicatedDatabase'); + + return self::$DEDICATEDDATABASE; + } public static function from(string $value): self { return match ($value) { 'function' => self::FUNCTION(), 'site' => self::SITE(), + 'dedicatedDatabase' => self::DEDICATEDDATABASE(), default => throw new \InvalidArgumentException('Unknown ProxyRuleDeploymentResourceType value: ' . $value), }; } diff --git a/src/Appwrite/Enums/Runtime.php b/src/Appwrite/Enums/Runtime.php index d07d3d99..f34edd6d 100644 --- a/src/Appwrite/Enums/Runtime.php +++ b/src/Appwrite/Enums/Runtime.php @@ -60,6 +60,7 @@ class Runtime implements JsonSerializable, Stringable private static Runtime $DART310; private static Runtime $DART311; private static Runtime $DART312; + private static Runtime $DART313; private static Runtime $DOTNET60; private static Runtime $DOTNET70; private static Runtime $DOTNET80; @@ -102,6 +103,7 @@ class Runtime implements JsonSerializable, Stringable private static Runtime $FLUTTER338; private static Runtime $FLUTTER341; private static Runtime $FLUTTER344; + private static Runtime $FLUTTER347; private function __construct(private readonly string $value) { @@ -423,6 +425,12 @@ public static function DART312(): Runtime return self::$DART312; } + public static function DART313(): Runtime + { + self::$DART313 ??= new Runtime('dart-3.13'); + + return self::$DART313; + } public static function DOTNET60(): Runtime { self::$DOTNET60 ??= new Runtime('dotnet-6.0'); @@ -675,6 +683,12 @@ public static function FLUTTER344(): Runtime return self::$FLUTTER344; } + public static function FLUTTER347(): Runtime + { + self::$FLUTTER347 ??= new Runtime('flutter-3.47'); + + return self::$FLUTTER347; + } public static function from(string $value): self { @@ -730,6 +744,7 @@ public static function from(string $value): self 'dart-3.10' => self::DART310(), 'dart-3.11' => self::DART311(), 'dart-3.12' => self::DART312(), + 'dart-3.13' => self::DART313(), 'dotnet-6.0' => self::DOTNET60(), 'dotnet-7.0' => self::DOTNET70(), 'dotnet-8.0' => self::DOTNET80(), @@ -772,6 +787,7 @@ public static function from(string $value): self 'flutter-3.38' => self::FLUTTER338(), 'flutter-3.41' => self::FLUTTER341(), 'flutter-3.44' => self::FLUTTER344(), + 'flutter-3.47' => self::FLUTTER347(), default => throw new \InvalidArgumentException('Unknown Runtime value: ' . $value), }; } diff --git a/src/Appwrite/Enums/TablesDBIndexType.php b/src/Appwrite/Enums/TablesDBIndexType.php index 1399870c..6ef567ee 100644 --- a/src/Appwrite/Enums/TablesDBIndexType.php +++ b/src/Appwrite/Enums/TablesDBIndexType.php @@ -13,6 +13,7 @@ class TablesDBIndexType implements JsonSerializable, Stringable private static TablesDBIndexType $FULLTEXT; private static TablesDBIndexType $UNIQUE; private static TablesDBIndexType $SPATIAL; + private static TablesDBIndexType $TRIGRAM; private function __construct(private readonly string $value) { @@ -52,6 +53,12 @@ public static function SPATIAL(): TablesDBIndexType return self::$SPATIAL; } + public static function TRIGRAM(): TablesDBIndexType + { + self::$TRIGRAM ??= new TablesDBIndexType('trigram'); + + return self::$TRIGRAM; + } public static function from(string $value): self { @@ -60,6 +67,7 @@ public static function from(string $value): self 'fulltext' => self::FULLTEXT(), 'unique' => self::UNIQUE(), 'spatial' => self::SPATIAL(), + 'trigram' => self::TRIGRAM(), default => throw new \InvalidArgumentException('Unknown TablesDBIndexType value: ' . $value), }; } diff --git a/src/Appwrite/Enums/WafRuleAction.php b/src/Appwrite/Enums/WafRuleAction.php new file mode 100644 index 00000000..aa211108 --- /dev/null +++ b/src/Appwrite/Enums/WafRuleAction.php @@ -0,0 +1,74 @@ +value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function BYPASS(): WafRuleAction + { + self::$BYPASS ??= new WafRuleAction('bypass'); + + return self::$BYPASS; + } + public static function DENY(): WafRuleAction + { + self::$DENY ??= new WafRuleAction('deny'); + + return self::$DENY; + } + public static function CHALLENGE(): WafRuleAction + { + self::$CHALLENGE ??= new WafRuleAction('challenge'); + + return self::$CHALLENGE; + } + public static function RATELIMIT(): WafRuleAction + { + self::$RATELIMIT ??= new WafRuleAction('rateLimit'); + + return self::$RATELIMIT; + } + public static function REDIRECT(): WafRuleAction + { + self::$REDIRECT ??= new WafRuleAction('redirect'); + + return self::$REDIRECT; + } + + public static function from(string $value): self + { + return match ($value) { + 'bypass' => self::BYPASS(), + 'deny' => self::DENY(), + 'challenge' => self::CHALLENGE(), + 'rateLimit' => self::RATELIMIT(), + 'redirect' => self::REDIRECT(), + default => throw new \InvalidArgumentException('Unknown WafRuleAction value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Models/Account.php b/src/Appwrite/Models/Account.php new file mode 100644 index 00000000..994809cd --- /dev/null +++ b/src/Appwrite/Models/Account.php @@ -0,0 +1,164 @@ + $targets a user-owned message receiver. a single user may have multiple e.g. emails, phones, and a browser. each target is registered with a single provider. + * @param string $accessedAt most recent access date in iso 8601 format. this attribute is only updated again after 24 hours. + * @param string|null $emailCanonical canonical form of the user email address. + * @param bool|null $emailIsFree whether the user email is from a free email provider. + * @param bool|null $emailIsDisposable whether the user email is from a disposable email provider. + * @param bool|null $emailIsCorporate whether the user email is from a corporate domain. + * @param bool|null $emailIsCanonical whether the user email is in its canonical form. + * @param bool|null $passwordPwned whether the password was found in a known data breach the last time it was checked. null when the password has never been checked. + * @param bool|null $impersonator whether the user can impersonate other users. + * @param string|null $impersonatorUserId id of the original actor performing the impersonation. present only when the current request is impersonating another user. internal audit logs attribute the action to this user, while the impersonated target is recorded only in internal audit payload data. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public string $name, + public string $registration, + public bool $status, + public array $labels, + public string $passwordUpdate, + public string $email, + public string $phone, + public bool $emailVerification, + public bool $phoneVerification, + public bool $mfa, + public Preferences $prefs, + public array $targets, + public string $accessedAt, + public ?string $emailCanonical = null, + public ?bool $emailIsFree = null, + public ?bool $emailIsDisposable = null, + public ?bool $emailIsCorporate = null, + public ?bool $emailIsCanonical = null, + public ?bool $passwordPwned = null, + public ?bool $impersonator = null, + public ?string $impersonatorUserId = null + ) { + } + + /** + * @param array $data + */ + public static function from(array $data): static + { + $data += [ + '$id' => "", + '$createdAt' => "", + '$updatedAt' => "", + 'name' => "", + 'registration' => "", + 'status' => true, + 'labels' => [], + 'passwordUpdate' => "", + 'email' => "", + 'phone' => "", + 'emailVerification' => false, + 'phoneVerification' => false, + 'mfa' => false, + 'targets' => [], + 'accessedAt' => "", + ]; + + if (!array_key_exists('prefs', $data)) { + throw new \InvalidArgumentException('Missing required field "prefs" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + createdAt: $data['$createdAt'], + updatedAt: $data['$updatedAt'], + name: $data['name'], + registration: $data['registration'], + status: $data['status'], + labels: $data['labels'], + passwordUpdate: $data['passwordUpdate'], + email: $data['email'], + phone: $data['phone'], + emailVerification: $data['emailVerification'], + phoneVerification: $data['phoneVerification'], + mfa: $data['mfa'], + prefs: static::hydrateTypedValue(Preferences::class, $data['prefs']), + targets: is_array($data['targets']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(Target::class, $item), + $data['targets'] + ) + : $data['targets'], + accessedAt: $data['accessedAt'], + emailCanonical: $data['emailCanonical'] ?? null, + emailIsFree: $data['emailIsFree'] ?? null, + emailIsDisposable: $data['emailIsDisposable'] ?? null, + emailIsCorporate: $data['emailIsCorporate'] ?? null, + emailIsCanonical: $data['emailIsCanonical'] ?? null, + passwordPwned: $data['passwordPwned'] ?? null, + impersonator: $data['impersonator'] ?? null, + impersonatorUserId: $data['impersonatorUserId'] ?? null + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + '$id' => static::serializeValue($this->id), + '$createdAt' => static::serializeValue($this->createdAt), + '$updatedAt' => static::serializeValue($this->updatedAt), + 'name' => static::serializeValue($this->name), + 'registration' => static::serializeValue($this->registration), + 'status' => static::serializeValue($this->status), + 'labels' => static::serializeValue($this->labels), + 'passwordUpdate' => static::serializeValue($this->passwordUpdate), + 'email' => static::serializeValue($this->email), + 'phone' => static::serializeValue($this->phone), + 'emailVerification' => static::serializeValue($this->emailVerification), + 'emailCanonical' => static::serializeValue($this->emailCanonical), + 'emailIsFree' => static::serializeValue($this->emailIsFree), + 'emailIsDisposable' => static::serializeValue($this->emailIsDisposable), + 'emailIsCorporate' => static::serializeValue($this->emailIsCorporate), + 'emailIsCanonical' => static::serializeValue($this->emailIsCanonical), + 'passwordPwned' => static::serializeValue($this->passwordPwned), + 'phoneVerification' => static::serializeValue($this->phoneVerification), + 'mfa' => static::serializeValue($this->mfa), + 'prefs' => static::serializeValue($this->prefs), + 'targets' => static::serializeValue($this->targets), + 'accessedAt' => static::serializeValue($this->accessedAt), + 'impersonator' => static::serializeValue($this->impersonator), + 'impersonatorUserId' => static::serializeValue($this->impersonatorUserId) + ]; + } +} diff --git a/src/Appwrite/Models/BillingPlan.php b/src/Appwrite/Models/BillingPlan.php index 3c4d2a1a..c8da4643 100644 --- a/src/Appwrite/Models/BillingPlan.php +++ b/src/Appwrite/Models/BillingPlan.php @@ -83,9 +83,11 @@ * @param BillingPlanGroup $group group of this billing plan for variants * @param float $databaseComputeCredit included monthly dedicated-database compute credit in usd. resets each billing cycle with no roll-over. * @param int|null $members members + * @param int|null $environments maximum environments per project. 0 when the plan does not offer environments. * @param int|null $activityLogs activity log days * @param array|null $usageLogsIntervals usage log time intervals allowed for this plan (e.g. 15m, 1h, 1d). * @param array|null $usageAggregateOnlyMetrics metrics this plan only records as a total. they cannot be broken down by dimension or filtered, because the stored events cover a fraction of the real traffic. + * @param array|null $eligibleCountries iso country codes eligible for this regional plan. empty means no restriction. * @param bool|null $backupsEnabled does plan support backup policies. * @param int|null $backupPolicies how many policies does plan support * @param BillingPlanLimits|null $limits plan specific limits @@ -158,9 +160,11 @@ public function __construct( public BillingPlanGroup $group, public float $databaseComputeCredit, public ?int $members = null, + public ?int $environments = null, public ?int $activityLogs = null, public ?array $usageLogsIntervals = null, public ?array $usageAggregateOnlyMetrics = null, + public ?array $eligibleCountries = null, public ?bool $backupsEnabled = null, public ?int $backupPolicies = null, public ?BillingPlanLimits $limits = null, @@ -316,9 +320,11 @@ functionsIntervalMinimum: $data['functionsIntervalMinimum'], group: static::hydrateTypedValue(BillingPlanGroup::class, $data['group']), databaseComputeCredit: $data['databaseComputeCredit'], members: $data['members'] ?? null, + environments: $data['environments'] ?? null, activityLogs: $data['activityLogs'] ?? null, usageLogsIntervals: $data['usageLogsIntervals'] ?? null, usageAggregateOnlyMetrics: $data['usageAggregateOnlyMetrics'] ?? null, + eligibleCountries: $data['eligibleCountries'] ?? null, backupsEnabled: $data['backupsEnabled'] ?? null, backupPolicies: $data['backupPolicies'] ?? null, limits: array_key_exists('limits', $data) ? static::hydrateTypedValue(BillingPlanLimits::class, $data['limits'], true) : null, @@ -346,6 +352,7 @@ public function toArray(): array 'members' => static::serializeValue($this->members), 'webhooks' => static::serializeValue($this->webhooks), 'wafRules' => static::serializeValue($this->wafRules), + 'environments' => static::serializeValue($this->environments), 'projects' => static::serializeValue($this->projects), 'platforms' => static::serializeValue($this->platforms), 'users' => static::serializeValue($this->users), @@ -380,6 +387,7 @@ public function toArray(): array 'emailBranding' => static::serializeValue($this->emailBranding), 'requiresPaymentMethod' => static::serializeValue($this->requiresPaymentMethod), 'requiresBillingAddress' => static::serializeValue($this->requiresBillingAddress), + 'eligibleCountries' => static::serializeValue($this->eligibleCountries), 'isAvailable' => static::serializeValue($this->isAvailable), 'selfService' => static::serializeValue($this->selfService), 'premiumSupport' => static::serializeValue($this->premiumSupport), diff --git a/src/Appwrite/Models/DedicatedDatabase.php b/src/Appwrite/Models/DedicatedDatabase.php index 2b0f84e9..acd6c5d1 100644 --- a/src/Appwrite/Models/DedicatedDatabase.php +++ b/src/Appwrite/Models/DedicatedDatabase.php @@ -65,6 +65,9 @@ * @param string $error error message if status is failed. * @param string|null $lastAccessedAt last activity timestamp in iso 8601 format. * @param string|null $idleUntil display-only timestamp when the database is expected to be considered idle (iso 8601 format). derived from last activity; lifecycle transitions are driven by lifecyclestate. + * @param string|null $storageStatus storage resize status. possible values: idle (no resize in flight), resizing (the volume is growing towards storagetargetgb). + * @param int|null $storageTargetGb size in gb the volume is growing towards while storagestatus is resizing. 0 when no resize is in flight. + * @param string|null $storageResizeStartedAt time the in-flight storage resize started, in iso 8601 format. */ public function __construct( public string $id, @@ -115,7 +118,10 @@ public function __construct( public int $sqlApiTimeoutSeconds, public string $error, public ?string $lastAccessedAt = null, - public ?string $idleUntil = null + public ?string $idleUntil = null, + public ?string $storageStatus = null, + public ?int $storageTargetGb = null, + public ?string $storageResizeStartedAt = null ) { } @@ -232,7 +238,10 @@ public static function from(array $data): static sqlApiTimeoutSeconds: $data['sqlApiTimeoutSeconds'], error: $data['error'], lastAccessedAt: $data['lastAccessedAt'] ?? null, - idleUntil: $data['idleUntil'] ?? null + idleUntil: $data['idleUntil'] ?? null, + storageStatus: $data['storageStatus'] ?? null, + storageTargetGb: $data['storageTargetGb'] ?? null, + storageResizeStartedAt: $data['storageResizeStartedAt'] ?? null ); } @@ -268,6 +277,9 @@ public function toArray(): array 'cpu' => static::serializeValue($this->cpu), 'memory' => static::serializeValue($this->memory), 'storage' => static::serializeValue($this->storage), + 'storageStatus' => static::serializeValue($this->storageStatus), + 'storageTargetGb' => static::serializeValue($this->storageTargetGb), + 'storageResizeStartedAt' => static::serializeValue($this->storageResizeStartedAt), 'storageClass' => static::serializeValue($this->storageClass), 'storageMaxGb' => static::serializeValue($this->storageMaxGb), 'nodePool' => static::serializeValue($this->nodePool), diff --git a/src/Appwrite/Models/DedicatedDatabaseSpecification.php b/src/Appwrite/Models/DedicatedDatabaseSpecification.php index 1768bfdb..a4612cc0 100644 --- a/src/Appwrite/Models/DedicatedDatabaseSpecification.php +++ b/src/Appwrite/Models/DedicatedDatabaseSpecification.php @@ -25,6 +25,10 @@ * @param int $includedStorage included storage in gb before overage charges apply. * @param int $includedBandwidth included bandwidth in gb before overage charges apply. * @param bool $enabled whether the specification is available on the current plan. + * @param float|null $storageOverageRate price per gb of storage above the included amount, per month, in usd. + * @param float|null $bandwidthOverageRate price per gb of bandwidth above the included amount, per month, in usd. + * @param float|null $replicaRate high availability replica price as a fraction of the specification price. + * @param float|null $pitrRate point-in-time recovery price as a fraction of the specification price. */ public function __construct( public string $slug, @@ -35,7 +39,11 @@ public function __construct( public int $maxConnections, public int $includedStorage, public int $includedBandwidth, - public bool $enabled + public bool $enabled, + public ?float $storageOverageRate = null, + public ?float $bandwidthOverageRate = null, + public ?float $replicaRate = null, + public ?float $pitrRate = null ) { } @@ -65,7 +73,11 @@ public static function from(array $data): static maxConnections: $data['maxConnections'], includedStorage: $data['includedStorage'], includedBandwidth: $data['includedBandwidth'], - enabled: $data['enabled'] + enabled: $data['enabled'], + storageOverageRate: $data['storageOverageRate'] ?? null, + bandwidthOverageRate: $data['bandwidthOverageRate'] ?? null, + replicaRate: $data['replicaRate'] ?? null, + pitrRate: $data['pitrRate'] ?? null ); } @@ -78,6 +90,10 @@ public function toArray(): array 'slug' => static::serializeValue($this->slug), 'name' => static::serializeValue($this->name), 'price' => static::serializeValue($this->price), + 'storageOverageRate' => static::serializeValue($this->storageOverageRate), + 'bandwidthOverageRate' => static::serializeValue($this->bandwidthOverageRate), + 'replicaRate' => static::serializeValue($this->replicaRate), + 'pitrRate' => static::serializeValue($this->pitrRate), 'cpu' => static::serializeValue($this->cpu), 'memory' => static::serializeValue($this->memory), 'maxConnections' => static::serializeValue($this->maxConnections), diff --git a/src/Appwrite/Models/DnsRecord.php b/src/Appwrite/Models/DnsRecord.php new file mode 100644 index 00000000..13ee01c4 --- /dev/null +++ b/src/Appwrite/Models/DnsRecord.php @@ -0,0 +1,104 @@ + $data + */ + public static function from(array $data): static + { + $data += [ + '$id' => "", + '$createdAt' => "", + '$updatedAt' => "", + 'type' => "", + 'name' => "", + 'value' => "", + 'ttl' => 3600, + 'priority' => 0, + 'lock' => false, + 'weight' => 0, + 'port' => 0, + 'comment' => "", + ]; + + return new static( + id: $data['$id'], + createdAt: $data['$createdAt'], + updatedAt: $data['$updatedAt'], + type: $data['type'], + name: $data['name'], + value: $data['value'], + ttl: $data['ttl'], + priority: $data['priority'], + lock: $data['lock'], + weight: $data['weight'], + port: $data['port'], + comment: $data['comment'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + '$id' => static::serializeValue($this->id), + '$createdAt' => static::serializeValue($this->createdAt), + '$updatedAt' => static::serializeValue($this->updatedAt), + 'type' => static::serializeValue($this->type), + 'name' => static::serializeValue($this->name), + 'value' => static::serializeValue($this->value), + 'ttl' => static::serializeValue($this->ttl), + 'priority' => static::serializeValue($this->priority), + 'lock' => static::serializeValue($this->lock), + 'weight' => static::serializeValue($this->weight), + 'port' => static::serializeValue($this->port), + 'comment' => static::serializeValue($this->comment) + ]; + } +} diff --git a/src/Appwrite/Models/DnsRecordsList.php b/src/Appwrite/Models/DnsRecordsList.php new file mode 100644 index 00000000..0fa7b942 --- /dev/null +++ b/src/Appwrite/Models/DnsRecordsList.php @@ -0,0 +1,59 @@ + $dnsRecords list of dnsrecords. + */ + public function __construct( + public int $total, + public array $dnsRecords + ) { + } + + /** + * @param array $data + */ + public static function from(array $data): static + { + $data += [ + 'total' => 0, + 'dnsRecords' => [], + ]; + + return new static( + total: $data['total'], + dnsRecords: is_array($data['dnsRecords']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(DnsRecord::class, $item), + $data['dnsRecords'] + ) + : $data['dnsRecords'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'total' => static::serializeValue($this->total), + 'dnsRecords' => static::serializeValue($this->dnsRecords) + ]; + } +} diff --git a/src/Appwrite/Models/Domain.php b/src/Appwrite/Models/Domain.php new file mode 100644 index 00000000..1fddd0d4 --- /dev/null +++ b/src/Appwrite/Models/Domain.php @@ -0,0 +1,115 @@ + $dnsRecords dns records + * @param DomainTransferStatusEnum|null $transferStatus transfer status for domains being transferred in. null when the domain is not being transferred. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public string $domain, + public string $registrar, + public string $nameservers, + public string $expire, + public string $renewal, + public bool $autoRenewal, + public int $renewalPrice, + public string $teamId, + public array $dnsRecords, + public ?DomainTransferStatusEnum $transferStatus = null + ) { + } + + /** + * @param array $data + */ + public static function from(array $data): static + { + $data += [ + '$id' => "", + '$createdAt' => "", + '$updatedAt' => "", + 'domain' => "", + 'registrar' => "", + 'nameservers' => "", + 'expire' => "", + 'renewal' => "", + 'autoRenewal' => false, + 'renewalPrice' => 0, + 'teamId' => "", + 'dnsRecords' => [], + ]; + + return new static( + id: $data['$id'], + createdAt: $data['$createdAt'], + updatedAt: $data['$updatedAt'], + domain: $data['domain'], + registrar: $data['registrar'], + nameservers: $data['nameservers'], + expire: $data['expire'], + renewal: $data['renewal'], + autoRenewal: $data['autoRenewal'], + renewalPrice: $data['renewalPrice'], + teamId: $data['teamId'], + dnsRecords: is_array($data['dnsRecords']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(DnsRecord::class, $item), + $data['dnsRecords'] + ) + : $data['dnsRecords'], + transferStatus: array_key_exists('transferStatus', $data) ? static::hydrateTypedValue(DomainTransferStatusEnum::class, $data['transferStatus'], true) : null + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + '$id' => static::serializeValue($this->id), + '$createdAt' => static::serializeValue($this->createdAt), + '$updatedAt' => static::serializeValue($this->updatedAt), + 'domain' => static::serializeValue($this->domain), + 'registrar' => static::serializeValue($this->registrar), + 'nameservers' => static::serializeValue($this->nameservers), + 'expire' => static::serializeValue($this->expire), + 'renewal' => static::serializeValue($this->renewal), + 'autoRenewal' => static::serializeValue($this->autoRenewal), + 'renewalPrice' => static::serializeValue($this->renewalPrice), + 'transferStatus' => static::serializeValue($this->transferStatus), + 'teamId' => static::serializeValue($this->teamId), + 'dnsRecords' => static::serializeValue($this->dnsRecords) + ]; + } +} diff --git a/src/Appwrite/Models/DomainPrice.php b/src/Appwrite/Models/DomainPrice.php new file mode 100644 index 00000000..753218d3 --- /dev/null +++ b/src/Appwrite/Models/DomainPrice.php @@ -0,0 +1,82 @@ + $data + */ + public static function from(array $data): static + { + $data += [ + 'domain' => "", + 'tld' => "", + 'available' => false, + 'periodYears' => 1, + 'premium' => false, + 'renewalPeriodYears' => 1, + ]; + + return new static( + domain: $data['domain'], + tld: $data['tld'], + available: $data['available'], + periodYears: $data['periodYears'], + premium: $data['premium'], + renewalPeriodYears: $data['renewalPeriodYears'], + price: $data['price'] ?? null, + renewalPrice: $data['renewalPrice'] ?? null + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'domain' => static::serializeValue($this->domain), + 'tld' => static::serializeValue($this->tld), + 'available' => static::serializeValue($this->available), + 'price' => static::serializeValue($this->price), + 'periodYears' => static::serializeValue($this->periodYears), + 'premium' => static::serializeValue($this->premium), + 'renewalPrice' => static::serializeValue($this->renewalPrice), + 'renewalPeriodYears' => static::serializeValue($this->renewalPeriodYears) + ]; + } +} diff --git a/src/Appwrite/Models/DomainPricesList.php b/src/Appwrite/Models/DomainPricesList.php new file mode 100644 index 00000000..4554aa5e --- /dev/null +++ b/src/Appwrite/Models/DomainPricesList.php @@ -0,0 +1,59 @@ + $prices list of prices. + */ + public function __construct( + public int $total, + public array $prices + ) { + } + + /** + * @param array $data + */ + public static function from(array $data): static + { + $data += [ + 'total' => 0, + 'prices' => [], + ]; + + return new static( + total: $data['total'], + prices: is_array($data['prices']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(DomainPrice::class, $item), + $data['prices'] + ) + : $data['prices'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'total' => static::serializeValue($this->total), + 'prices' => static::serializeValue($this->prices) + ]; + } +} diff --git a/src/Appwrite/Models/DomainTransferStatus.php b/src/Appwrite/Models/DomainTransferStatus.php new file mode 100644 index 00000000..3306c49e --- /dev/null +++ b/src/Appwrite/Models/DomainTransferStatus.php @@ -0,0 +1,61 @@ + $data + */ + public static function from(array $data): static + { + $data += [ + 'status' => "pending_registry", + 'reason' => "", + 'timestamp' => "", + ]; + + return new static( + status: static::hydrateTypedValue(DomainTransferStatusEnum::class, $data['status']), + reason: $data['reason'], + timestamp: $data['timestamp'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'status' => static::serializeValue($this->status), + 'reason' => static::serializeValue($this->reason), + 'timestamp' => static::serializeValue($this->timestamp) + ]; + } +} diff --git a/src/Appwrite/Models/DomainsList.php b/src/Appwrite/Models/DomainsList.php new file mode 100644 index 00000000..f8ec83b7 --- /dev/null +++ b/src/Appwrite/Models/DomainsList.php @@ -0,0 +1,59 @@ + $domains list of domains. + */ + public function __construct( + public int $total, + public array $domains + ) { + } + + /** + * @param array $data + */ + public static function from(array $data): static + { + $data += [ + 'total' => 0, + 'domains' => [], + ]; + + return new static( + total: $data['total'], + domains: is_array($data['domains']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(Domain::class, $item), + $data['domains'] + ) + : $data['domains'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'total' => static::serializeValue($this->total), + 'domains' => static::serializeValue($this->domains) + ]; + } +} diff --git a/src/Appwrite/Models/Identity.php b/src/Appwrite/Models/Identity.php index 82b4c282..7b208ff5 100644 --- a/src/Appwrite/Models/Identity.php +++ b/src/Appwrite/Models/Identity.php @@ -26,6 +26,7 @@ * @param string $providerAccessToken identity provider access token. * @param string $providerAccessTokenExpiry the date of when the access token expires in iso 8601 format. * @param string $providerRefreshToken identity provider refresh token. + * @param string|null $providerIdToken identity provider id token (jwt) from the most recent native sign-in. empty for identities created through the browser oauth2 flow. */ public function __construct( public string $id, @@ -37,7 +38,8 @@ public function __construct( public string $providerEmail, public string $providerAccessToken, public string $providerAccessTokenExpiry, - public string $providerRefreshToken + public string $providerRefreshToken, + public ?string $providerIdToken = null ) { } @@ -69,7 +71,8 @@ public static function from(array $data): static providerEmail: $data['providerEmail'], providerAccessToken: $data['providerAccessToken'], providerAccessTokenExpiry: $data['providerAccessTokenExpiry'], - providerRefreshToken: $data['providerRefreshToken'] + providerRefreshToken: $data['providerRefreshToken'], + providerIdToken: $data['providerIdToken'] ?? null ); } @@ -88,7 +91,8 @@ public function toArray(): array 'providerEmail' => static::serializeValue($this->providerEmail), 'providerAccessToken' => static::serializeValue($this->providerAccessToken), 'providerAccessTokenExpiry' => static::serializeValue($this->providerAccessTokenExpiry), - 'providerRefreshToken' => static::serializeValue($this->providerRefreshToken) + 'providerRefreshToken' => static::serializeValue($this->providerRefreshToken), + 'providerIdToken' => static::serializeValue($this->providerIdToken) ]; } } diff --git a/src/Appwrite/Models/OAuth2Apple.php b/src/Appwrite/Models/OAuth2Apple.php index b885f0a6..91b6b61c 100644 --- a/src/Appwrite/Models/OAuth2Apple.php +++ b/src/Appwrite/Models/OAuth2Apple.php @@ -22,6 +22,8 @@ * @param string $keyId apple oauth2 key id. * @param string $teamId apple oauth2 team id. * @param string $p8File apple oauth2 .p8 private key file contents. the secret key wrapped by the pem markers is 200 characters long. + * @param bool|null $nativeEnabled native sign in with apple is active and can be used to create sessions from an id token. independent of enabled, which only controls the browser-based flow. + * @param array|null $nativeClientIds app bundle ids accepted as id token audiences for native sign in with apple, next to the services id. */ public function __construct( public string $id, @@ -29,7 +31,9 @@ public function __construct( public string $serviceId, public string $keyId, public string $teamId, - public string $p8File + public string $p8File, + public ?bool $nativeEnabled = null, + public ?array $nativeClientIds = null ) { } @@ -53,7 +57,9 @@ public static function from(array $data): static serviceId: $data['serviceId'], keyId: $data['keyId'], teamId: $data['teamId'], - p8File: $data['p8File'] + p8File: $data['p8File'], + nativeEnabled: $data['nativeEnabled'] ?? null, + nativeClientIds: $data['nativeClientIds'] ?? null ); } @@ -68,7 +74,9 @@ public function toArray(): array 'serviceId' => static::serializeValue($this->serviceId), 'keyId' => static::serializeValue($this->keyId), 'teamId' => static::serializeValue($this->teamId), - 'p8File' => static::serializeValue($this->p8File) + 'p8File' => static::serializeValue($this->p8File), + 'nativeEnabled' => static::serializeValue($this->nativeEnabled), + 'nativeClientIds' => static::serializeValue($this->nativeClientIds) ]; } } diff --git a/src/Appwrite/Models/OAuth2Auth0.php b/src/Appwrite/Models/OAuth2Auth0.php index 46fe409f..2e119529 100644 --- a/src/Appwrite/Models/OAuth2Auth0.php +++ b/src/Appwrite/Models/OAuth2Auth0.php @@ -4,6 +4,8 @@ namespace Appwrite\Models; +use Appwrite\Enums\OAuth2Auth0Prompt; + /** * OAuth2Auth0 * @@ -21,13 +23,15 @@ * @param string $clientId auth0 oauth2 client id. * @param string $clientSecret auth0 oauth2 client secret. * @param string $endpoint auth0 oauth2 endpoint domain. + * @param list|null $prompt auth0 oauth2 prompt values. */ public function __construct( public string $id, public bool $enabled, public string $clientId, public string $clientSecret, - public string $endpoint + public string $endpoint, + public ?array $prompt = null ) { } @@ -49,7 +53,17 @@ public static function from(array $data): static enabled: $data['enabled'], clientId: $data['clientId'], clientSecret: $data['clientSecret'], - endpoint: $data['endpoint'] + endpoint: $data['endpoint'], + prompt: array_key_exists('prompt', $data) + ? ( + is_array($data['prompt']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(OAuth2Auth0Prompt::class, $item), + $data['prompt'] + ) + : $data['prompt'] + ) + : null ); } @@ -63,6 +77,7 @@ public function toArray(): array 'enabled' => static::serializeValue($this->enabled), 'clientId' => static::serializeValue($this->clientId), 'clientSecret' => static::serializeValue($this->clientSecret), + 'prompt' => static::serializeValue($this->prompt), 'endpoint' => static::serializeValue($this->endpoint) ]; } diff --git a/src/Appwrite/Models/OAuth2Discord.php b/src/Appwrite/Models/OAuth2Discord.php index 25a1794f..34d4d3d0 100644 --- a/src/Appwrite/Models/OAuth2Discord.php +++ b/src/Appwrite/Models/OAuth2Discord.php @@ -4,6 +4,8 @@ namespace Appwrite\Models; +use Appwrite\Enums\OAuth2DiscordPrompt; + /** * OAuth2Discord * @@ -20,12 +22,14 @@ * @param bool $enabled oauth2 provider is active and can be used to create sessions. * @param string $clientId discord oauth2 client id. * @param string $clientSecret discord oauth2 client secret. + * @param list|null $prompt discord oauth2 prompt values. */ public function __construct( public string $id, public bool $enabled, public string $clientId, - public string $clientSecret + public string $clientSecret, + public ?array $prompt = null ) { } @@ -45,7 +49,17 @@ public static function from(array $data): static id: $data['$id'], enabled: $data['enabled'], clientId: $data['clientId'], - clientSecret: $data['clientSecret'] + clientSecret: $data['clientSecret'], + prompt: array_key_exists('prompt', $data) + ? ( + is_array($data['prompt']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(OAuth2DiscordPrompt::class, $item), + $data['prompt'] + ) + : $data['prompt'] + ) + : null ); } @@ -58,7 +72,8 @@ public function toArray(): array '$id' => static::serializeValue($this->id), 'enabled' => static::serializeValue($this->enabled), 'clientId' => static::serializeValue($this->clientId), - 'clientSecret' => static::serializeValue($this->clientSecret) + 'clientSecret' => static::serializeValue($this->clientSecret), + 'prompt' => static::serializeValue($this->prompt) ]; } } diff --git a/src/Appwrite/Models/OAuth2Github.php b/src/Appwrite/Models/OAuth2Github.php index f8d91efc..3e40437f 100644 --- a/src/Appwrite/Models/OAuth2Github.php +++ b/src/Appwrite/Models/OAuth2Github.php @@ -4,6 +4,8 @@ namespace Appwrite\Models; +use Appwrite\Enums\OAuth2GithubPrompt; + /** * OAuth2GitHub * @@ -20,12 +22,14 @@ * @param bool $enabled oauth2 provider is active and can be used to create sessions. * @param string $clientId github oauth2 client id. for github apps, use the "app id" when both an app id and client id are available. * @param string $clientSecret github oauth2 client secret. + * @param list|null $prompt github oauth2 prompt values. */ public function __construct( public string $id, public bool $enabled, public string $clientId, - public string $clientSecret + public string $clientSecret, + public ?array $prompt = null ) { } @@ -45,7 +49,17 @@ public static function from(array $data): static id: $data['$id'], enabled: $data['enabled'], clientId: $data['clientId'], - clientSecret: $data['clientSecret'] + clientSecret: $data['clientSecret'], + prompt: array_key_exists('prompt', $data) + ? ( + is_array($data['prompt']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(OAuth2GithubPrompt::class, $item), + $data['prompt'] + ) + : $data['prompt'] + ) + : null ); } @@ -58,7 +72,8 @@ public function toArray(): array '$id' => static::serializeValue($this->id), 'enabled' => static::serializeValue($this->enabled), 'clientId' => static::serializeValue($this->clientId), - 'clientSecret' => static::serializeValue($this->clientSecret) + 'clientSecret' => static::serializeValue($this->clientSecret), + 'prompt' => static::serializeValue($this->prompt) ]; } } diff --git a/src/Appwrite/Models/OAuth2Google.php b/src/Appwrite/Models/OAuth2Google.php index a4f0a51a..ac2a6bef 100644 --- a/src/Appwrite/Models/OAuth2Google.php +++ b/src/Appwrite/Models/OAuth2Google.php @@ -23,13 +23,17 @@ * @param string $clientId google oauth2 client id. * @param string $clientSecret google oauth2 client secret. * @param list $prompt google oauth2 prompt values. + * @param bool|null $nativeEnabled native google sign-in is active and can be used to create sessions from an id token. independent of enabled, which only controls the browser-based flow. + * @param array|null $nativeClientIds additional oauth2 client ids accepted as id token audiences for native sign-in, next to the client id. */ public function __construct( public string $id, public bool $enabled, public string $clientId, public string $clientSecret, - public array $prompt + public array $prompt, + public ?bool $nativeEnabled = null, + public ?array $nativeClientIds = null ) { } @@ -56,7 +60,9 @@ public static function from(array $data): static static fn (mixed $item): mixed => static::hydrateTypedValue(OAuth2GooglePrompt::class, $item), $data['prompt'] ) - : $data['prompt'] + : $data['prompt'], + nativeEnabled: $data['nativeEnabled'] ?? null, + nativeClientIds: $data['nativeClientIds'] ?? null ); } @@ -70,7 +76,9 @@ public function toArray(): array 'enabled' => static::serializeValue($this->enabled), 'clientId' => static::serializeValue($this->clientId), 'clientSecret' => static::serializeValue($this->clientSecret), - 'prompt' => static::serializeValue($this->prompt) + 'prompt' => static::serializeValue($this->prompt), + 'nativeEnabled' => static::serializeValue($this->nativeEnabled), + 'nativeClientIds' => static::serializeValue($this->nativeClientIds) ]; } } diff --git a/src/Appwrite/Models/OAuth2Kakao.php b/src/Appwrite/Models/OAuth2Kakao.php new file mode 100644 index 00000000..2d329b74 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Kakao.php @@ -0,0 +1,76 @@ + $prompt kakao oauth2 prompt values. + */ + public function __construct( + public string $id, + public bool $enabled, + public string $clientId, + public string $clientSecret, + public array $prompt + ) { + } + + /** + * @param array $data + */ + public static function from(array $data): static + { + $data += [ + '$id' => "", + 'enabled' => false, + 'clientId' => "", + 'clientSecret' => "", + 'prompt' => [], + ]; + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'], + prompt: is_array($data['prompt']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(OAuth2KakaoPrompt::class, $item), + $data['prompt'] + ) + : $data['prompt'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret), + 'prompt' => static::serializeValue($this->prompt) + ]; + } +} diff --git a/src/Appwrite/Models/OAuth2Microsoft.php b/src/Appwrite/Models/OAuth2Microsoft.php index 5be06bc6..12cddc22 100644 --- a/src/Appwrite/Models/OAuth2Microsoft.php +++ b/src/Appwrite/Models/OAuth2Microsoft.php @@ -4,6 +4,8 @@ namespace Appwrite\Models; +use Appwrite\Enums\OAuth2MicrosoftPrompt; + /** * OAuth2Microsoft * @@ -21,13 +23,15 @@ * @param string $applicationId microsoft oauth2 application id. * @param string $applicationSecret microsoft oauth2 application secret. * @param string $tenant microsoft entra id tenant identifier. use 'common', 'organizations', 'consumers' or a specific tenant id. + * @param list|null $prompt microsoft oauth2 prompt values. */ public function __construct( public string $id, public bool $enabled, public string $applicationId, public string $applicationSecret, - public string $tenant + public string $tenant, + public ?array $prompt = null ) { } @@ -49,7 +53,17 @@ public static function from(array $data): static enabled: $data['enabled'], applicationId: $data['applicationId'], applicationSecret: $data['applicationSecret'], - tenant: $data['tenant'] + tenant: $data['tenant'], + prompt: array_key_exists('prompt', $data) + ? ( + is_array($data['prompt']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(OAuth2MicrosoftPrompt::class, $item), + $data['prompt'] + ) + : $data['prompt'] + ) + : null ); } @@ -63,6 +77,7 @@ public function toArray(): array 'enabled' => static::serializeValue($this->enabled), 'applicationId' => static::serializeValue($this->applicationId), 'applicationSecret' => static::serializeValue($this->applicationSecret), + 'prompt' => static::serializeValue($this->prompt), 'tenant' => static::serializeValue($this->tenant) ]; } diff --git a/src/Appwrite/Models/OAuth2Okta.php b/src/Appwrite/Models/OAuth2Okta.php index c43c638b..10f220af 100644 --- a/src/Appwrite/Models/OAuth2Okta.php +++ b/src/Appwrite/Models/OAuth2Okta.php @@ -4,6 +4,8 @@ namespace Appwrite\Models; +use Appwrite\Enums\OAuth2OktaPrompt; + /** * OAuth2Okta * @@ -22,6 +24,7 @@ * @param string $clientSecret okta oauth2 client secret. * @param string $domain okta oauth2 domain. * @param string $authorizationServerId okta oauth2 authorization server id. + * @param list|null $prompt okta oauth2 prompt values. */ public function __construct( public string $id, @@ -29,7 +32,8 @@ public function __construct( public string $clientId, public string $clientSecret, public string $domain, - public string $authorizationServerId + public string $authorizationServerId, + public ?array $prompt = null ) { } @@ -53,7 +57,17 @@ public static function from(array $data): static clientId: $data['clientId'], clientSecret: $data['clientSecret'], domain: $data['domain'], - authorizationServerId: $data['authorizationServerId'] + authorizationServerId: $data['authorizationServerId'], + prompt: array_key_exists('prompt', $data) + ? ( + is_array($data['prompt']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(OAuth2OktaPrompt::class, $item), + $data['prompt'] + ) + : $data['prompt'] + ) + : null ); } @@ -67,6 +81,7 @@ public function toArray(): array 'enabled' => static::serializeValue($this->enabled), 'clientId' => static::serializeValue($this->clientId), 'clientSecret' => static::serializeValue($this->clientSecret), + 'prompt' => static::serializeValue($this->prompt), 'domain' => static::serializeValue($this->domain), 'authorizationServerId' => static::serializeValue($this->authorizationServerId) ]; diff --git a/src/Appwrite/Models/OAuth2Salesforce.php b/src/Appwrite/Models/OAuth2Salesforce.php index fd51b59e..bea4ea61 100644 --- a/src/Appwrite/Models/OAuth2Salesforce.php +++ b/src/Appwrite/Models/OAuth2Salesforce.php @@ -4,6 +4,8 @@ namespace Appwrite\Models; +use Appwrite\Enums\OAuth2SalesforcePrompt; + /** * OAuth2Salesforce * @@ -20,12 +22,14 @@ * @param bool $enabled oauth2 provider is active and can be used to create sessions. * @param string $customerKey salesforce oauth2 consumer key. * @param string $customerSecret salesforce oauth2 consumer secret. + * @param list|null $prompt salesforce oauth2 prompt values. */ public function __construct( public string $id, public bool $enabled, public string $customerKey, - public string $customerSecret + public string $customerSecret, + public ?array $prompt = null ) { } @@ -45,7 +49,17 @@ public static function from(array $data): static id: $data['$id'], enabled: $data['enabled'], customerKey: $data['customerKey'], - customerSecret: $data['customerSecret'] + customerSecret: $data['customerSecret'], + prompt: array_key_exists('prompt', $data) + ? ( + is_array($data['prompt']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(OAuth2SalesforcePrompt::class, $item), + $data['prompt'] + ) + : $data['prompt'] + ) + : null ); } @@ -58,7 +72,8 @@ public function toArray(): array '$id' => static::serializeValue($this->id), 'enabled' => static::serializeValue($this->enabled), 'customerKey' => static::serializeValue($this->customerKey), - 'customerSecret' => static::serializeValue($this->customerSecret) + 'customerSecret' => static::serializeValue($this->customerSecret), + 'prompt' => static::serializeValue($this->prompt) ]; } } diff --git a/src/Appwrite/Models/OAuth2TikTok.php b/src/Appwrite/Models/OAuth2TikTok.php new file mode 100644 index 00000000..9b748217 --- /dev/null +++ b/src/Appwrite/Models/OAuth2TikTok.php @@ -0,0 +1,64 @@ + $data + */ + public static function from(array $data): static + { + $data += [ + '$id' => "", + 'enabled' => false, + 'clientId' => "", + 'clientSecret' => "", + ]; + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret) + ]; + } +} diff --git a/src/Appwrite/Models/OAuth2Webflow.php b/src/Appwrite/Models/OAuth2Webflow.php new file mode 100644 index 00000000..f9712b83 --- /dev/null +++ b/src/Appwrite/Models/OAuth2Webflow.php @@ -0,0 +1,64 @@ + $data + */ + public static function from(array $data): static + { + $data += [ + '$id' => "", + 'enabled' => false, + 'clientId' => "", + 'clientSecret' => "", + ]; + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + clientId: $data['clientId'], + clientSecret: $data['clientSecret'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'clientId' => static::serializeValue($this->clientId), + 'clientSecret' => static::serializeValue($this->clientSecret) + ]; + } +} diff --git a/src/Appwrite/Models/OAuth2Zoho.php b/src/Appwrite/Models/OAuth2Zoho.php index 354c0719..31966c63 100644 --- a/src/Appwrite/Models/OAuth2Zoho.php +++ b/src/Appwrite/Models/OAuth2Zoho.php @@ -4,6 +4,8 @@ namespace Appwrite\Models; +use Appwrite\Enums\OAuth2ZohoPrompt; + /** * OAuth2Zoho * @@ -20,12 +22,14 @@ * @param bool $enabled oauth2 provider is active and can be used to create sessions. * @param string $clientId zoho oauth2 client id. * @param string $clientSecret zoho oauth2 client secret. + * @param list|null $prompt zoho oauth2 prompt values. */ public function __construct( public string $id, public bool $enabled, public string $clientId, - public string $clientSecret + public string $clientSecret, + public ?array $prompt = null ) { } @@ -45,7 +49,17 @@ public static function from(array $data): static id: $data['$id'], enabled: $data['enabled'], clientId: $data['clientId'], - clientSecret: $data['clientSecret'] + clientSecret: $data['clientSecret'], + prompt: array_key_exists('prompt', $data) + ? ( + is_array($data['prompt']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(OAuth2ZohoPrompt::class, $item), + $data['prompt'] + ) + : $data['prompt'] + ) + : null ); } @@ -58,7 +72,8 @@ public function toArray(): array '$id' => static::serializeValue($this->id), 'enabled' => static::serializeValue($this->enabled), 'clientId' => static::serializeValue($this->clientId), - 'clientSecret' => static::serializeValue($this->clientSecret) + 'clientSecret' => static::serializeValue($this->clientSecret), + 'prompt' => static::serializeValue($this->prompt) ]; } } diff --git a/src/Appwrite/Models/Oauth2Introspection.php b/src/Appwrite/Models/Oauth2Introspection.php new file mode 100644 index 00000000..5d6f720f --- /dev/null +++ b/src/Appwrite/Models/Oauth2Introspection.php @@ -0,0 +1,93 @@ + $data + */ + public static function from(array $data): static + { + $data += [ + 'active' => false, + ]; + + return new static( + active: $data['active'], + tokenUse: $data['token_use'] ?? null, + tokenType: $data['token_type'] ?? null, + scope: $data['scope'] ?? null, + clientId: $data['client_id'] ?? null, + sub: $data['sub'] ?? null, + aud: $data['aud'] ?? null, + iss: $data['iss'] ?? null, + exp: $data['exp'] ?? null, + iat: $data['iat'] ?? null, + jti: $data['jti'] ?? null, + authorizationDetails: $data['authorization_details'] ?? null + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'active' => static::serializeValue($this->active), + 'token_use' => static::serializeValue($this->tokenUse), + 'token_type' => static::serializeValue($this->tokenType), + 'scope' => static::serializeValue($this->scope), + 'client_id' => static::serializeValue($this->clientId), + 'sub' => static::serializeValue($this->sub), + 'aud' => static::serializeValue($this->aud), + 'iss' => static::serializeValue($this->iss), + 'exp' => static::serializeValue($this->exp), + 'iat' => static::serializeValue($this->iat), + 'jti' => static::serializeValue($this->jti), + 'authorization_details' => static::serializeValue($this->authorizationDetails) + ]; + } +} diff --git a/src/Appwrite/Models/PlatformAndroid.php b/src/Appwrite/Models/PlatformAndroid.php index 1b809570..246df74b 100644 --- a/src/Appwrite/Models/PlatformAndroid.php +++ b/src/Appwrite/Models/PlatformAndroid.php @@ -24,6 +24,7 @@ * @param string $name platform name. * @param PlatformType $type platform type. possible values are: windows, apple, android, linux, web. * @param string $applicationId android application id. + * @param array|null $fingerprints sha-256 fingerprints of the certificates the app is signed with. passkeys created in the app are accepted when its signature matches one. */ public function __construct( public string $id, @@ -31,7 +32,8 @@ public function __construct( public string $updatedAt, public string $name, public PlatformType $type, - public string $applicationId + public string $applicationId, + public ?array $fingerprints = null ) { } @@ -58,7 +60,8 @@ public static function from(array $data): static updatedAt: $data['$updatedAt'], name: $data['name'], type: static::hydrateTypedValue(PlatformType::class, $data['type']), - applicationId: $data['applicationId'] + applicationId: $data['applicationId'], + fingerprints: $data['fingerprints'] ?? null ); } @@ -73,7 +76,8 @@ public function toArray(): array '$updatedAt' => static::serializeValue($this->updatedAt), 'name' => static::serializeValue($this->name), 'type' => static::serializeValue($this->type), - 'applicationId' => static::serializeValue($this->applicationId) + 'applicationId' => static::serializeValue($this->applicationId), + 'fingerprints' => static::serializeValue($this->fingerprints) ]; } } diff --git a/src/Appwrite/Models/PolicyPasswordPwned.php b/src/Appwrite/Models/PolicyPasswordPwned.php new file mode 100644 index 00000000..f4fceee7 --- /dev/null +++ b/src/Appwrite/Models/PolicyPasswordPwned.php @@ -0,0 +1,64 @@ + $data + */ + public static function from(array $data): static + { + $data += [ + '$id' => "", + 'enabled' => true, + 'sessions' => false, + 'users' => false, + ]; + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + sessions: $data['sessions'], + users: $data['users'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'sessions' => static::serializeValue($this->sessions), + 'users' => static::serializeValue($this->users) + ]; + } +} diff --git a/src/Appwrite/Models/PolicyPasswordRotation.php b/src/Appwrite/Models/PolicyPasswordRotation.php new file mode 100644 index 00000000..2353f990 --- /dev/null +++ b/src/Appwrite/Models/PolicyPasswordRotation.php @@ -0,0 +1,59 @@ + $data + */ + public static function from(array $data): static + { + $data += [ + '$id' => "", + 'enabled' => false, + 'maxAge' => 31536000, + ]; + + return new static( + id: $data['$id'], + enabled: $data['enabled'], + maxAge: $data['maxAge'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled), + 'maxAge' => static::serializeValue($this->maxAge) + ]; + } +} diff --git a/src/Appwrite/Models/Project.php b/src/Appwrite/Models/Project.php index 9898e6ad..256193bd 100644 --- a/src/Appwrite/Models/Project.php +++ b/src/Appwrite/Models/Project.php @@ -44,7 +44,10 @@ * @param list $blocks project blocks information * @param string $consoleAccessedAt last time the project was accessed via console. used with plan's projectinactivitydays to determine if project is paused. * @param bool|null $wafEnabled whether waf enforcement is enabled for the project. + * @param string|null $parentId id of the project this environment belongs to. null when the project is not an environment. * @param BillingLimits|null $billingLimits billing limits reached + * @param string|null $firstAccessedAt first time the project received a non-console api request. empty until the project is used. + * @param string|null $mcpAccessedAt last time the project was accessed through the mcp server. empty if it was never accessed via mcp. * @param bool|null $oAuth2ServerEnabled oauth2 server status * @param string|null $oAuth2ServerAuthorizationUrl oauth2 server authorization url * @param array|null $oAuth2ServerScopes oauth2 server allowed scopes @@ -92,7 +95,10 @@ public function __construct( public array $blocks, public string $consoleAccessedAt, public ?bool $wafEnabled = null, + public ?string $parentId = null, public ?BillingLimits $billingLimits = null, + public ?string $firstAccessedAt = null, + public ?string $mcpAccessedAt = null, public ?bool $oAuth2ServerEnabled = null, public ?string $oAuth2ServerAuthorizationUrl = null, public ?array $oAuth2ServerScopes = null, @@ -213,7 +219,10 @@ public static function from(array $data): static : $data['blocks'], consoleAccessedAt: $data['consoleAccessedAt'], wafEnabled: $data['wafEnabled'] ?? null, + parentId: $data['parentId'] ?? null, billingLimits: array_key_exists('billingLimits', $data) ? static::hydrateTypedValue(BillingLimits::class, $data['billingLimits'], true) : null, + firstAccessedAt: $data['firstAccessedAt'] ?? null, + mcpAccessedAt: $data['mcpAccessedAt'] ?? null, oAuth2ServerEnabled: $data['oAuth2ServerEnabled'] ?? null, oAuth2ServerAuthorizationUrl: $data['oAuth2ServerAuthorizationUrl'] ?? null, oAuth2ServerScopes: $data['oAuth2ServerScopes'] ?? null, @@ -268,7 +277,10 @@ public function toArray(): array 'blocks' => static::serializeValue($this->blocks), 'consoleAccessedAt' => static::serializeValue($this->consoleAccessedAt), 'wafEnabled' => static::serializeValue($this->wafEnabled), + 'parentId' => static::serializeValue($this->parentId), 'billingLimits' => static::serializeValue($this->billingLimits), + 'firstAccessedAt' => static::serializeValue($this->firstAccessedAt), + 'mcpAccessedAt' => static::serializeValue($this->mcpAccessedAt), 'oAuth2ServerEnabled' => static::serializeValue($this->oAuth2ServerEnabled), 'oAuth2ServerAuthorizationUrl' => static::serializeValue($this->oAuth2ServerAuthorizationUrl), 'oAuth2ServerScopes' => static::serializeValue($this->oAuth2ServerScopes), diff --git a/src/Appwrite/Models/Topic.php b/src/Appwrite/Models/Topic.php index fbf02394..42f22386 100644 --- a/src/Appwrite/Models/Topic.php +++ b/src/Appwrite/Models/Topic.php @@ -24,6 +24,8 @@ * @param int $smsTotal total count of sms subscribers subscribed to the topic. * @param int $pushTotal total count of push subscribers subscribed to the topic. * @param array $subscribe subscribe permissions. + * @param int|null $qos mqtt qos for delivery on this topic. null lets the subscriber choose their level. + * @param int|null $expiry message retention in seconds for offline delivery. */ public function __construct( public string $id, @@ -33,7 +35,9 @@ public function __construct( public int $emailTotal, public int $smsTotal, public int $pushTotal, - public array $subscribe + public array $subscribe, + public ?int $qos = null, + public ?int $expiry = null ) { } @@ -61,7 +65,9 @@ public static function from(array $data): static emailTotal: $data['emailTotal'], smsTotal: $data['smsTotal'], pushTotal: $data['pushTotal'], - subscribe: $data['subscribe'] + subscribe: $data['subscribe'], + qos: $data['qos'] ?? null, + expiry: $data['expiry'] ?? null ); } @@ -78,7 +84,9 @@ public function toArray(): array 'emailTotal' => static::serializeValue($this->emailTotal), 'smsTotal' => static::serializeValue($this->smsTotal), 'pushTotal' => static::serializeValue($this->pushTotal), - 'subscribe' => static::serializeValue($this->subscribe) + 'subscribe' => static::serializeValue($this->subscribe), + 'qos' => static::serializeValue($this->qos), + 'expiry' => static::serializeValue($this->expiry) ]; } } diff --git a/src/Appwrite/Models/User.php b/src/Appwrite/Models/User.php index 33fd99ee..476c9802 100644 --- a/src/Appwrite/Models/User.php +++ b/src/Appwrite/Models/User.php @@ -40,6 +40,7 @@ * @param bool|null $emailIsDisposable whether the user email is from a disposable email provider. * @param bool|null $emailIsCorporate whether the user email is from a corporate domain. * @param bool|null $emailIsCanonical whether the user email is in its canonical form. + * @param bool|null $passwordPwned whether the password was found in a known data breach the last time it was checked. null when the password has never been checked. * @param bool|null $impersonator whether the user can impersonate other users. * @param string|null $impersonatorUserId id of the original actor performing the impersonation. present only when the current request is impersonating another user. internal audit logs attribute the action to this user, while the impersonated target is recorded only in internal audit payload data. */ @@ -68,6 +69,7 @@ public function __construct( public ?bool $emailIsDisposable = null, public ?bool $emailIsCorporate = null, public ?bool $emailIsCanonical = null, + public ?bool $passwordPwned = null, public ?bool $impersonator = null, public ?string $impersonatorUserId = null ) { @@ -132,6 +134,7 @@ public static function from(array $data): static emailIsDisposable: $data['emailIsDisposable'] ?? null, emailIsCorporate: $data['emailIsCorporate'] ?? null, emailIsCanonical: $data['emailIsCanonical'] ?? null, + passwordPwned: $data['passwordPwned'] ?? null, impersonator: $data['impersonator'] ?? null, impersonatorUserId: $data['impersonatorUserId'] ?? null ); @@ -162,6 +165,7 @@ public function toArray(): array 'emailIsDisposable' => static::serializeValue($this->emailIsDisposable), 'emailIsCorporate' => static::serializeValue($this->emailIsCorporate), 'emailIsCanonical' => static::serializeValue($this->emailIsCanonical), + 'passwordPwned' => static::serializeValue($this->passwordPwned), 'phoneVerification' => static::serializeValue($this->phoneVerification), 'mfa' => static::serializeValue($this->mfa), 'prefs' => static::serializeValue($this->prefs), diff --git a/src/Appwrite/Models/WafRuleBypass.php b/src/Appwrite/Models/WafRuleBypass.php new file mode 100644 index 00000000..cc8fae81 --- /dev/null +++ b/src/Appwrite/Models/WafRuleBypass.php @@ -0,0 +1,119 @@ + $data + */ + public static function from(array $data): static + { + $data += [ + '$id' => "", + '$createdAt' => "", + '$updatedAt' => "", + 'name' => "", + 'description' => "", + 'teamId' => "", + 'projectId' => "", + 'resourceType' => "api", + 'resourceId' => "", + 'priority' => 0, + 'enabled' => true, + 'conditions' => [], + 'config' => [], + ]; + + if (!array_key_exists('action', $data)) { + throw new \InvalidArgumentException('Missing required field "action" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + createdAt: $data['$createdAt'], + updatedAt: $data['$updatedAt'], + name: $data['name'], + description: $data['description'], + teamId: $data['teamId'], + projectId: $data['projectId'], + resourceType: $data['resourceType'], + resourceId: $data['resourceId'], + action: static::hydrateTypedValue(WafRuleAction::class, $data['action']), + priority: $data['priority'], + enabled: $data['enabled'], + conditions: $data['conditions'], + config: $data['config'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + '$id' => static::serializeValue($this->id), + '$createdAt' => static::serializeValue($this->createdAt), + '$updatedAt' => static::serializeValue($this->updatedAt), + 'name' => static::serializeValue($this->name), + 'description' => static::serializeValue($this->description), + 'teamId' => static::serializeValue($this->teamId), + 'projectId' => static::serializeValue($this->projectId), + 'resourceType' => static::serializeValue($this->resourceType), + 'resourceId' => static::serializeValue($this->resourceId), + 'action' => static::serializeValue($this->action), + 'priority' => static::serializeValue($this->priority), + 'enabled' => static::serializeValue($this->enabled), + 'conditions' => static::serializeValue($this->conditions), + 'config' => static::serializeValue($this->config) + ]; + } +} diff --git a/src/Appwrite/Models/WafRuleChallenge.php b/src/Appwrite/Models/WafRuleChallenge.php new file mode 100644 index 00000000..bcc8ef96 --- /dev/null +++ b/src/Appwrite/Models/WafRuleChallenge.php @@ -0,0 +1,134 @@ + $data + */ + public static function from(array $data): static + { + $data += [ + '$id' => "", + '$createdAt' => "", + '$updatedAt' => "", + 'name' => "", + 'description' => "", + 'teamId' => "", + 'projectId' => "", + 'resourceType' => "api", + 'resourceId' => "", + 'priority' => 0, + 'enabled' => true, + 'conditions' => [], + 'config' => [], + 'challengeType' => "compute", + 'difficulty' => 3, + 'ttl' => 1800, + ]; + + if (!array_key_exists('action', $data)) { + throw new \InvalidArgumentException('Missing required field "action" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + createdAt: $data['$createdAt'], + updatedAt: $data['$updatedAt'], + name: $data['name'], + description: $data['description'], + teamId: $data['teamId'], + projectId: $data['projectId'], + resourceType: $data['resourceType'], + resourceId: $data['resourceId'], + action: static::hydrateTypedValue(WafRuleAction::class, $data['action']), + priority: $data['priority'], + enabled: $data['enabled'], + conditions: $data['conditions'], + config: $data['config'], + challengeType: $data['challengeType'], + difficulty: $data['difficulty'], + ttl: $data['ttl'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + '$id' => static::serializeValue($this->id), + '$createdAt' => static::serializeValue($this->createdAt), + '$updatedAt' => static::serializeValue($this->updatedAt), + 'name' => static::serializeValue($this->name), + 'description' => static::serializeValue($this->description), + 'teamId' => static::serializeValue($this->teamId), + 'projectId' => static::serializeValue($this->projectId), + 'resourceType' => static::serializeValue($this->resourceType), + 'resourceId' => static::serializeValue($this->resourceId), + 'action' => static::serializeValue($this->action), + 'priority' => static::serializeValue($this->priority), + 'enabled' => static::serializeValue($this->enabled), + 'conditions' => static::serializeValue($this->conditions), + 'config' => static::serializeValue($this->config), + 'challengeType' => static::serializeValue($this->challengeType), + 'difficulty' => static::serializeValue($this->difficulty), + 'ttl' => static::serializeValue($this->ttl) + ]; + } +} diff --git a/src/Appwrite/Models/WafRuleDeny.php b/src/Appwrite/Models/WafRuleDeny.php new file mode 100644 index 00000000..8cdf2b81 --- /dev/null +++ b/src/Appwrite/Models/WafRuleDeny.php @@ -0,0 +1,119 @@ + $data + */ + public static function from(array $data): static + { + $data += [ + '$id' => "", + '$createdAt' => "", + '$updatedAt' => "", + 'name' => "", + 'description' => "", + 'teamId' => "", + 'projectId' => "", + 'resourceType' => "api", + 'resourceId' => "", + 'priority' => 0, + 'enabled' => true, + 'conditions' => [], + 'config' => [], + ]; + + if (!array_key_exists('action', $data)) { + throw new \InvalidArgumentException('Missing required field "action" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + createdAt: $data['$createdAt'], + updatedAt: $data['$updatedAt'], + name: $data['name'], + description: $data['description'], + teamId: $data['teamId'], + projectId: $data['projectId'], + resourceType: $data['resourceType'], + resourceId: $data['resourceId'], + action: static::hydrateTypedValue(WafRuleAction::class, $data['action']), + priority: $data['priority'], + enabled: $data['enabled'], + conditions: $data['conditions'], + config: $data['config'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + '$id' => static::serializeValue($this->id), + '$createdAt' => static::serializeValue($this->createdAt), + '$updatedAt' => static::serializeValue($this->updatedAt), + 'name' => static::serializeValue($this->name), + 'description' => static::serializeValue($this->description), + 'teamId' => static::serializeValue($this->teamId), + 'projectId' => static::serializeValue($this->projectId), + 'resourceType' => static::serializeValue($this->resourceType), + 'resourceId' => static::serializeValue($this->resourceId), + 'action' => static::serializeValue($this->action), + 'priority' => static::serializeValue($this->priority), + 'enabled' => static::serializeValue($this->enabled), + 'conditions' => static::serializeValue($this->conditions), + 'config' => static::serializeValue($this->config) + ]; + } +} diff --git a/src/Appwrite/Models/WafRuleList.php b/src/Appwrite/Models/WafRuleList.php new file mode 100644 index 00000000..768bbcfd --- /dev/null +++ b/src/Appwrite/Models/WafRuleList.php @@ -0,0 +1,54 @@ + $data + */ + public static function from(array $data): static + { + $data += [ + 'total' => 0, + 'rules' => [], + ]; + + return new static( + total: $data['total'], + rules: $data['rules'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'total' => static::serializeValue($this->total), + 'rules' => static::serializeValue($this->rules) + ]; + } +} diff --git a/src/Appwrite/Models/WafRuleRateLimit.php b/src/Appwrite/Models/WafRuleRateLimit.php new file mode 100644 index 00000000..914d749d --- /dev/null +++ b/src/Appwrite/Models/WafRuleRateLimit.php @@ -0,0 +1,144 @@ + $data + */ + public static function from(array $data): static + { + $data += [ + '$id' => "", + '$createdAt' => "", + '$updatedAt' => "", + 'name' => "", + 'description' => "", + 'teamId' => "", + 'projectId' => "", + 'resourceType' => "api", + 'resourceId' => "", + 'priority' => 0, + 'enabled' => true, + 'conditions' => [], + 'config' => [], + 'limit' => 100, + 'interval' => 3600, + 'key' => "ip", + 'strategy' => "fixedWindow", + 'maxBucketSize' => 0, + ]; + + if (!array_key_exists('action', $data)) { + throw new \InvalidArgumentException('Missing required field "action" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + createdAt: $data['$createdAt'], + updatedAt: $data['$updatedAt'], + name: $data['name'], + description: $data['description'], + teamId: $data['teamId'], + projectId: $data['projectId'], + resourceType: $data['resourceType'], + resourceId: $data['resourceId'], + action: static::hydrateTypedValue(WafRuleAction::class, $data['action']), + priority: $data['priority'], + enabled: $data['enabled'], + conditions: $data['conditions'], + config: $data['config'], + limit: $data['limit'], + interval: $data['interval'], + key: $data['key'], + strategy: $data['strategy'], + maxBucketSize: $data['maxBucketSize'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + '$id' => static::serializeValue($this->id), + '$createdAt' => static::serializeValue($this->createdAt), + '$updatedAt' => static::serializeValue($this->updatedAt), + 'name' => static::serializeValue($this->name), + 'description' => static::serializeValue($this->description), + 'teamId' => static::serializeValue($this->teamId), + 'projectId' => static::serializeValue($this->projectId), + 'resourceType' => static::serializeValue($this->resourceType), + 'resourceId' => static::serializeValue($this->resourceId), + 'action' => static::serializeValue($this->action), + 'priority' => static::serializeValue($this->priority), + 'enabled' => static::serializeValue($this->enabled), + 'conditions' => static::serializeValue($this->conditions), + 'config' => static::serializeValue($this->config), + 'limit' => static::serializeValue($this->limit), + 'interval' => static::serializeValue($this->interval), + 'key' => static::serializeValue($this->key), + 'strategy' => static::serializeValue($this->strategy), + 'maxBucketSize' => static::serializeValue($this->maxBucketSize) + ]; + } +} diff --git a/src/Appwrite/Models/WafRuleRedirect.php b/src/Appwrite/Models/WafRuleRedirect.php new file mode 100644 index 00000000..304fef92 --- /dev/null +++ b/src/Appwrite/Models/WafRuleRedirect.php @@ -0,0 +1,129 @@ + $data + */ + public static function from(array $data): static + { + $data += [ + '$id' => "", + '$createdAt' => "", + '$updatedAt' => "", + 'name' => "", + 'description' => "", + 'teamId' => "", + 'projectId' => "", + 'resourceType' => "api", + 'resourceId' => "", + 'priority' => 0, + 'enabled' => true, + 'conditions' => [], + 'config' => [], + 'location' => "/", + 'statusCode' => 302, + ]; + + if (!array_key_exists('action', $data)) { + throw new \InvalidArgumentException('Missing required field "action" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + createdAt: $data['$createdAt'], + updatedAt: $data['$updatedAt'], + name: $data['name'], + description: $data['description'], + teamId: $data['teamId'], + projectId: $data['projectId'], + resourceType: $data['resourceType'], + resourceId: $data['resourceId'], + action: static::hydrateTypedValue(WafRuleAction::class, $data['action']), + priority: $data['priority'], + enabled: $data['enabled'], + conditions: $data['conditions'], + config: $data['config'], + location: $data['location'], + statusCode: $data['statusCode'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + '$id' => static::serializeValue($this->id), + '$createdAt' => static::serializeValue($this->createdAt), + '$updatedAt' => static::serializeValue($this->updatedAt), + 'name' => static::serializeValue($this->name), + 'description' => static::serializeValue($this->description), + 'teamId' => static::serializeValue($this->teamId), + 'projectId' => static::serializeValue($this->projectId), + 'resourceType' => static::serializeValue($this->resourceType), + 'resourceId' => static::serializeValue($this->resourceId), + 'action' => static::serializeValue($this->action), + 'priority' => static::serializeValue($this->priority), + 'enabled' => static::serializeValue($this->enabled), + 'conditions' => static::serializeValue($this->conditions), + 'config' => static::serializeValue($this->config), + 'location' => static::serializeValue($this->location), + 'statusCode' => static::serializeValue($this->statusCode) + ]; + } +} diff --git a/src/Appwrite/Services/Account.php b/src/Appwrite/Services/Account.php index e3fcb1dc..6caf55ff 100644 --- a/src/Appwrite/Services/Account.php +++ b/src/Appwrite/Services/Account.php @@ -9,6 +9,7 @@ use Appwrite\Service; use Appwrite\Enums\AuthenticatorType; use Appwrite\Enums\AuthenticationFactor; +use Appwrite\Enums\IdTokenProvider; use Appwrite\Enums\OAuthProvider; class Account extends Service @@ -1350,13 +1351,106 @@ public function updateRecovery(string $userId, string $secret, string $password) return \Appwrite\Models\Token::from($response); } + /** + * Use this endpoint to send a 6-digit password recovery code to the user's + * email address. Unlike + * [createRecovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery), + * this method requires no redirect URL, which makes it suitable for mobile + * and desktop apps that cannot host a recovery page. Learn more about how to + * [complete the recovery + * process](https://appwrite.io/docs/references/cloud/client-web/account#updateRecoveryOTP). + * The code sent to the user's email address is valid for 15 minutes. + * + * Enable the **phrase** parameter to include a randomly generated security + * phrase in both the email and the response. Showing that phrase in your app + * lets the user confirm the email genuinely came from your request, which + * helps protect against phishing. + * + * @throws AppwriteException + */ + public function createRecoveryOTP(string $email, ?bool $phrase = null): \Appwrite\Models\Token + { + $apiPath = str_replace( + [], + [], + '/account/recovery/otp' + ); + + $apiParams = []; + $apiParams['email'] = $email; + + if (!is_null($phrase)) { + $apiParams['phrase'] = $phrase; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\Token::from($response); + } + + /** + * Use this endpoint to complete the user password recovery process using the + * 6-digit code that was emailed by + * [createRecoveryOTP](https://appwrite.io/docs/references/cloud/client-web/account#createRecoveryOTP). + * Pass the **userId** of the user along with the **secret** code from the + * email and the new **password** to set. If confirmed, this route will return + * a 200 status code, the code is consumed and the user's password is updated. + * + * @throws AppwriteException + */ + public function updateRecoveryOTP(string $userId, string $secret, string $password): \Appwrite\Models\Token + { + $apiPath = str_replace( + [], + [], + '/account/recovery/otp' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['secret'] = $secret; + $apiParams['password'] = $password; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\Token::from($response); + } + /** * Get the list of active sessions across different devices for the currently * logged in user. * * @throws AppwriteException */ - public function listSessions(): \Appwrite\Models\SessionList + public function listSessions(?bool $total = null): \Appwrite\Models\SessionList { $apiPath = str_replace( [], @@ -1366,6 +1460,10 @@ public function listSessions(): \Appwrite\Models\SessionList $apiParams = []; + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['accept'] = 'application/json'; @@ -1390,7 +1488,7 @@ public function listSessions(): \Appwrite\Models\SessionList * * @throws AppwriteException */ - public function deleteSessions(): string + public function deleteSessions(?bool $current = null): string { $apiPath = str_replace( [], @@ -1400,6 +1498,10 @@ public function deleteSessions(): string $apiParams = []; + if (!is_null($current)) { + $apiParams['current'] = $current; + } + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; @@ -1462,7 +1564,7 @@ public function createAnonymousSession(): \Appwrite\Models\Session * * @throws AppwriteException */ - public function createEmailPasswordSession(string $email, string $password): \Appwrite\Models\Session + public function createEmailPasswordSession(string $email, string $password, ?int $duration = null): \Appwrite\Models\Session { $apiPath = str_replace( [], @@ -1473,6 +1575,99 @@ public function createEmailPasswordSession(string $email, string $password): \Ap $apiParams = []; $apiParams['email'] = $email; $apiParams['password'] = $password; + $apiParams['duration'] = $duration; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\Session::from($response); + } + + /** + * Allow the user to login to their account using an OpenID Connect ID token + * obtained natively from the OAuth2 provider, for example via Google + * Credential Manager on Android or Sign in with Apple on iOS. No browser or + * redirect is involved: the ID token is verified against the provider's + * published signing keys and a session is created in a single request. + * + * Native sign-in is switched on per provider with its nativeEnabled setting. + * It is independent of the browser-based flow's enabled setting, which has no + * effect on this endpoint. The token's audience must match the provider's + * configured client ID or one of its native client IDs; tokens issued for any + * other client ID are rejected. For Sign in with Apple, register your app's + * bundle ID as a native client ID. For Google, the web client ID used by + * Credential Manager is usually the configured client ID; add your Android + * and iOS client IDs as native client IDs if your app requests tokens for + * them. + * + * Pass the raw nonce used when requesting the ID token so it can be validated + * against the token's nonce claim. When signing in with Apple, the nonce is + * required: hash it with SHA-256 before passing it to the Apple SDK, and send + * the raw value here - Apple tokens requested without a nonce are rejected. + * For Google the nonce is optional: it is validated whenever the token + * carries one, and ignored when the provider issued the token without one. + * Apple only returns the user's name on the first authorization, and never + * inside the ID token - capture it on the client and pass it via the name + * parameter. + * + * If there is already an active session, the new session will be attached to + * the logged-in account. If there are no active sessions, the server will + * attempt to look for a user with the same email address as the verified + * email received from the provider and attach the new session to the existing + * user. If no matching user is found - the server will create a new user. + * + * This flow does not return provider refresh tokens. You may pass an access + * token the provider handed your client, along with its lifetime, to store it + * on the session - but Appwrite cannot renew it once it expires. If your app + * needs long-lived access to provider APIs, use the browser-based OAuth2 flow + * instead. + * + * A user is limited to 10 active sessions at a time by default. [Learn more + * about session + * limits](https://appwrite.io/docs/authentication-security#limits). + * + * @throws AppwriteException + */ + public function createIdTokenSession(IdTokenProvider $provider, string $idToken, ?string $nonce = null, ?string $accessToken = null, ?int $accessTokenExpiry = null, ?string $name = null): \Appwrite\Models\Session + { + $apiPath = str_replace( + [], + [], + '/account/sessions/id-token' + ); + + $apiParams = []; + $apiParams['provider'] = $provider; + $apiParams['idToken'] = $idToken; + + if (!is_null($nonce)) { + $apiParams['nonce'] = $nonce; + } + + if (!is_null($accessToken)) { + $apiParams['accessToken'] = $accessToken; + } + + if (!is_null($accessTokenExpiry)) { + $apiParams['accessTokenExpiry'] = $accessTokenExpiry; + } + + if (!is_null($name)) { + $apiParams['name'] = $name; + } $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); @@ -2228,6 +2423,97 @@ public function updateVerification(string $userId, string $secret): \Appwrite\Mo return \Appwrite\Models\Token::from($response); } + /** + * Use this endpoint to send a 6-digit verification code to the currently + * logged in user's email address. Unlike + * [createEmailVerification](https://appwrite.io/docs/references/cloud/client-web/account#createEmailVerification), + * this method requires no redirect URL, which makes it suitable for mobile + * and desktop apps that cannot host a verification page. Learn more about how + * to [complete the verification + * process](https://appwrite.io/docs/references/cloud/client-web/account#updateEmailVerificationOTP). + * The code sent to the user's email address is valid for 15 minutes. + * + * Enable the **phrase** parameter to include a randomly generated security + * phrase in both the email and the response. Showing that phrase in your app + * lets the user confirm the email genuinely came from your request, which + * helps protect against phishing. + * + * @throws AppwriteException + */ + public function createEmailVerificationOTP(?bool $phrase = null): \Appwrite\Models\Token + { + $apiPath = str_replace( + [], + [], + '/account/verifications/email/otp' + ); + + $apiParams = []; + + if (!is_null($phrase)) { + $apiParams['phrase'] = $phrase; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\Token::from($response); + } + + /** + * Use this endpoint to complete the user email verification process using the + * 6-digit code that was emailed by + * [createEmailVerificationOTP](https://appwrite.io/docs/references/cloud/client-web/account#createEmailVerificationOTP). + * Pass the **userId** of the user being verified along with the **secret** + * code from the email. If confirmed, this route will return a 200 status code + * and the code is consumed. + * + * @throws AppwriteException + */ + public function updateEmailVerificationOTP(string $userId, string $secret): \Appwrite\Models\Token + { + $apiPath = str_replace( + [], + [], + '/account/verifications/email/otp' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['secret'] = $secret; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\Token::from($response); + } + /** * Use this endpoint to send a verification SMS to the currently logged in * user. This endpoint is meant for use after updating a user's phone number diff --git a/src/Appwrite/Services/Avatars.php b/src/Appwrite/Services/Avatars.php index 7d59419c..ba8f5c11 100644 --- a/src/Appwrite/Services/Avatars.php +++ b/src/Appwrite/Services/Avatars.php @@ -10,9 +10,11 @@ use Appwrite\Enums\Browser; use Appwrite\Enums\CreditCard; use Appwrite\Enums\Flag; +use Appwrite\InputFile; use Appwrite\Enums\BrowserTheme; use Appwrite\Enums\Timezone; use Appwrite\Enums\ImageFormat; +use Utopia\Psr7\Request\Multipart\Part; class Avatars extends Service { @@ -367,6 +369,204 @@ public function getPhoto(?int $width = null, ?int $height = null, ?int $quality ); } + /** + * Update the profile photo of the currently authenticated user. The uploaded + * image takes priority over every other photo source, including OAuth2 + * identity photos, Gravatar, and Libravatar. Updating an already customized + * photo replaces it. The image must be at most 5MB and is sent in a single + * request. + * + * @throws AppwriteException + */ + public function updatePhoto(InputFile $file, ?callable $onProgress = null): \Appwrite\Models\Account + { + $apiPath = str_replace( + [], + [], + '/avatars/photo' + ); + + $apiParams = []; + $apiParams['file'] = $file; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'multipart/form-data'; + $apiHeaders['accept'] = 'application/json'; + if (empty($file->getPath() ?? null)) { + $size = strlen($file->getData()); + $mimeType = $file->getMimeType(); + $postedName = $file->getFilename(); + if ($size <= Client::CHUNK_SIZE) { + $apiParams['file'] = Part::body('file', $file->getData(), $postedName, $mimeType); + $response = $this->client->call(Client::METHOD_PUT, $apiPath, [ + 'content-type' => 'multipart/form-data', + 'accept' => 'application/json', + ], $apiParams); + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Account::from($response); + } + } else { + $size = filesize($file->getPath()); + $mimeType = $file->getMimeType() ?? mime_content_type($file->getPath()); + $postedName = $file->getFilename() ?? basename($file->getPath()); + //send single file if size is less than or equal to 5MB + if ($size <= Client::CHUNK_SIZE) { + $apiParams['file'] = Part::file('file', $file->getPath(), $postedName, $mimeType); + $response = $this->client->call(Client::METHOD_PUT, $apiPath, [ + 'content-type' => 'multipart/form-data', + 'accept' => 'application/json', + ], $apiParams); + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Account::from($response); + } + } + + $counter = 0; + + + $apiHeaders = [ + 'X-Appwrite-Project' => $this->client->getConfig('project'), + 'content-type' => 'multipart/form-data', + 'accept' => 'application/json', + ]; + $handle = null; + + if (!empty($file->getPath())) { + $handle = @fopen($file->getPath(), "rb"); + } + + $uploadId = ''; + $totalChunks = (int) ceil($size / Client::CHUNK_SIZE); + $chunks = []; + $start = $counter * Client::CHUNK_SIZE; + while ($start < $size) { + $chunks[] = [ + 'index' => $counter, + 'start' => $start, + 'end' => min($start + Client::CHUNK_SIZE, $size), + ]; + $counter++; + $start += Client::CHUNK_SIZE; + } + + $readChunk = function (int $start, int $end) use ($handle, $file): string|false { + if (!empty($handle)) { + fseek($handle, $start); + return @fread($handle, $end - $start); + } + + return substr($file->getData(), $start, $end - $start); + }; + + $uploadChunk = function (array $chunk, string $currentUploadId = '') use ($readChunk, $apiPath, $apiHeaders, $apiParams, $mimeType, $postedName, $size) { + $chunkParams = $apiParams; + $chunkHeaders = $apiHeaders; + $data = $readChunk($chunk['start'], $chunk['end']); + if (!is_string($data)) { + throw new AppwriteException('Failed to read upload chunk'); + } + $chunkParams['file'] = Part::body('file', $data, $postedName, $mimeType); + $chunkHeaders['content-range'] = 'bytes ' . $chunk['start'] . '-' . ($chunk['end'] - 1) . '/' . $size; + if (!empty($currentUploadId)) { + $chunkHeaders['x-appwrite-id'] = $currentUploadId; + } + + return $this->client->call(Client::METHOD_PUT, $apiPath, $chunkHeaders, $chunkParams); + }; + + $isUploadComplete = function ($chunkResponse) use ($totalChunks): bool { + if (!is_array($chunkResponse) || !isset($chunkResponse['chunksUploaded'])) { + return false; + } + + return (int) $chunkResponse['chunksUploaded'] >= (int) ($chunkResponse['chunksTotal'] ?? $totalChunks); + }; + + $response = $uploadChunk($chunks[0], $uploadId); + $uploadId = $response['$id']; + $completedCount = $chunks[0]['index'] + 1; + $uploadedSize = $chunks[0]['end']; + if ($onProgress !== null) { + $onProgress([ + '$id' => $response['$id'], + 'progress' => $uploadedSize / $size * 100, + 'sizeUploaded' => $uploadedSize, + 'chunksTotal' => $totalChunks, + 'chunksUploaded' => $completedCount, + ]); + } + + $remainingChunks = array_slice($chunks, 1); + $completedResponse = $isUploadComplete($response) ? $response : null; + + foreach ($remainingChunks as $chunk) { + $response = $uploadChunk($chunk, $uploadId); + $completedCount++; + $uploadedSize += $chunk['end'] - $chunk['start']; + if ($isUploadComplete($response)) { + $completedResponse = $response; + } + if ($onProgress !== null) { + $onProgress([ + '$id' => $uploadId, + 'progress' => $uploadedSize / $size * 100, + 'sizeUploaded' => $uploadedSize, + 'chunksTotal' => $totalChunks, + 'chunksUploaded' => $completedCount, + ]); + } + } + + $response = $completedResponse ?? $response; + if (!empty($handle)) { + @fclose($handle); + } + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Account::from($response); + } + + /** + * Delete the profile photo of the currently authenticated user and store the + * built-in static placeholder in its place. The placeholder is the user's + * photo from then on, so it takes priority over every other photo source — + * OAuth2 identity photos, Gravatar, Libravatar, and initials — until a new + * photo is uploaded with avatars.updatePhoto. + * + * @throws AppwriteException + */ + public function deletePhoto(): string + { + $apiPath = str_replace( + [], + [], + '/avatars/photo' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Converts a given plain text to a QR code image. You can use the query * parameters to change the size and style of the resulting image. diff --git a/src/Appwrite/Services/Databases.php b/src/Appwrite/Services/Databases.php index 3579519b..6dd497fe 100644 --- a/src/Appwrite/Services/Databases.php +++ b/src/Appwrite/Services/Databases.php @@ -113,7 +113,7 @@ public function create(string $databaseId, string $name, ?bool $enabled = null): * @deprecated This API has been deprecated since 1.8.0. Please use `listTransactions` instead. * @see TablesDB::listTransactions */ - public function listTransactions(?array $queries = null): \Appwrite\Models\TransactionList + public function listTransactions(?array $queries = null, ?bool $total = null): \Appwrite\Models\TransactionList { $apiPath = str_replace( [], @@ -127,6 +127,10 @@ public function listTransactions(?array $queries = null): \Appwrite\Models\Trans $apiParams['queries'] = $queries; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['accept'] = 'application/json'; diff --git a/src/Appwrite/Services/DocumentsDB.php b/src/Appwrite/Services/DocumentsDB.php index 7947b14b..4e0e734f 100644 --- a/src/Appwrite/Services/DocumentsDB.php +++ b/src/Appwrite/Services/DocumentsDB.php @@ -142,7 +142,7 @@ public function listSpecifications(): \Appwrite\Models\DedicatedDatabaseSpecific * * @throws AppwriteException */ - public function listTransactions(?array $queries = null): \Appwrite\Models\TransactionList + public function listTransactions(?array $queries = null, ?bool $total = null): \Appwrite\Models\TransactionList { $apiPath = str_replace( [], @@ -156,6 +156,10 @@ public function listTransactions(?array $queries = null): \Appwrite\Models\Trans $apiParams['queries'] = $queries; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['accept'] = 'application/json'; diff --git a/src/Appwrite/Services/Domains.php b/src/Appwrite/Services/Domains.php new file mode 100644 index 00000000..98a05c19 --- /dev/null +++ b/src/Appwrite/Services/Domains.php @@ -0,0 +1,2182 @@ +client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $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\DomainsList::from($response); + } + + /** + * Create a new domain. Before creating a domain, you need to ensure that your + * DNS provider is properly configured. After creating the domain, you can use + * the verification endpoint to check if the domain is ready to be used. + * + * @throws AppwriteException + */ + public function create(string $teamId, string $domain): \Appwrite\Models\Domain + { + $apiPath = str_replace( + [], + [], + '/domains' + ); + + $apiParams = []; + $apiParams['teamId'] = $teamId; + $apiParams['domain'] = $domain; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\Domain::from($response); + } + + /** + * Get the registration price for a domain name. + * + * @throws AppwriteException + * + * @deprecated This API has been deprecated since 2.0.0. Please use `listPrices` instead. + * @see Domains::listPrices + */ + public function getPrice(string $domain, ?int $periodYears = null, ?DomainRegistrationType $registrationType = null): \Appwrite\Models\DomainPrice + { + $apiPath = str_replace( + [], + [], + '/domains/price' + ); + + $apiParams = []; + $apiParams['domain'] = $domain; + + if (!is_null($periodYears)) { + $apiParams['periodYears'] = $periodYears; + } + + if (!is_null($registrationType)) { + $apiParams['registrationType'] = $registrationType; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $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\DomainPrice::from($response); + } + + /** + * Check availability and get the requested registration price for one or more + * domain names. Availability is resolved for all domains in a single + * registrar lookup. Unavailable domains have a null price for new + * registrations, but can still be priced for renewal, transfer, or trade. + * Every priced domain also carries its renewal price for the same period, so + * a separate renewal lookup is not needed. A domain whose price could not be + * resolved, for example because its TLD is not supported, is returned with a + * null price. + * + * @throws AppwriteException + */ + public function listPrices(array $domains, ?int $periodYears = null, ?DomainRegistrationType $registrationType = null): \Appwrite\Models\DomainPricesList + { + $apiPath = str_replace( + [], + [], + '/domains/prices' + ); + + $apiParams = []; + $apiParams['domains'] = $domains; + + if (!is_null($periodYears)) { + $apiParams['periodYears'] = $periodYears; + } + + if (!is_null($registrationType)) { + $apiParams['registrationType'] = $registrationType; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $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\DomainPricesList::from($response); + } + + /** + * Get a domain by its unique ID. + * + * @throws AppwriteException + */ + public function get(string $domainId): \Appwrite\Models\Domain + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $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\Domain::from($response); + } + + /** + * Delete a domain by its unique ID. This endpoint can be used to delete a + * domain from your project. + * Once deleted, the domain will no longer be available for use and all + * associated resources will be removed. + * + * @throws AppwriteException + */ + public function delete(string $domainId): string + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update the registrar nameservers for the given domain. When nameservers are + * not provided, + * the domain will be updated to use Appwrite nameservers. + * + * @throws AppwriteException + */ + public function updateNameservers(string $domainId, ?array $nameservers = null): \Appwrite\Models\Domain + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/nameservers' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + + if (!is_null($nameservers)) { + $apiParams['nameservers'] = $nameservers; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\Domain::from($response); + } + + /** + * Verify which NS records are used and update the domain accordingly. This + * will check the domain's + * nameservers and update the domain's status based on whether the nameservers + * match the expected + * Appwrite nameservers. + * + * @throws AppwriteException + */ + public function verifyNameservers(string $domainId): \Appwrite\Models\Domain + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/nameservers/verification' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\Domain::from($response); + } + + /** + * List Google Workspace DNS records. + * + * @throws AppwriteException + */ + public function getPresetGoogleWorkspace(string $domainId): \Appwrite\Models\DnsRecordsList + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/presets/google-workspace' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $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\DnsRecordsList::from($response); + } + + /** + * Add Google Workspace DNS records to the domain. This will create the + * required MX records + * for Google Workspace email hosting. + * + * @throws AppwriteException + */ + public function createPresetGoogleWorkspace(string $domainId): \Appwrite\Models\DnsRecordsList + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/presets/google-workspace' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecordsList::from($response); + } + + /** + * List iCloud DNS records. + * + * @throws AppwriteException + */ + public function getPresetICloud(string $domainId): \Appwrite\Models\DnsRecordsList + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/presets/icloud' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $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\DnsRecordsList::from($response); + } + + /** + * Add iCloud DNS records to the domain. This will create the required MX and + * SPF records + * for using iCloud email services with your domain. + * + * @throws AppwriteException + */ + public function createPresetICloud(string $domainId): \Appwrite\Models\DnsRecordsList + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/presets/icloud' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecordsList::from($response); + } + + /** + * List Mailgun DNS records. + * + * @throws AppwriteException + */ + public function getPresetMailgun(string $domainId): \Appwrite\Models\DnsRecordsList + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/presets/mailgun' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $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\DnsRecordsList::from($response); + } + + /** + * Add Mailgun DNS records to the domain. This endpoint will create the + * required DNS records + * for Mailgun in the specified domain. + * + * @throws AppwriteException + */ + public function createPresetMailgun(string $domainId): \Appwrite\Models\DnsRecordsList + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/presets/mailgun' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecordsList::from($response); + } + + /** + * List Outlook DNS records. + * + * @throws AppwriteException + */ + public function getPresetOutlook(string $domainId): \Appwrite\Models\DnsRecordsList + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/presets/outlook' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $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\DnsRecordsList::from($response); + } + + /** + * Add Outlook DNS records to the domain. This will create the required MX + * records + * for setting up Outlook email hosting for your domain. + * + * @throws AppwriteException + */ + public function createPresetOutlook(string $domainId): \Appwrite\Models\DnsRecordsList + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/presets/outlook' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecordsList::from($response); + } + + /** + * List ProtonMail DNS records. + * + * @throws AppwriteException + */ + public function getPresetProtonMail(string $domainId): \Appwrite\Models\DnsRecordsList + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/presets/proton-mail' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $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\DnsRecordsList::from($response); + } + + /** + * Add ProtonMail DNS records to the domain. This will create the required MX + * records + * for using ProtonMail with your custom domain. + * + * @throws AppwriteException + */ + public function createPresetProtonMail(string $domainId): \Appwrite\Models\DnsRecordsList + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/presets/proton-mail' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecordsList::from($response); + } + + /** + * List Zoho DNS records. + * + * @throws AppwriteException + */ + public function getPresetZoho(string $domainId): \Appwrite\Models\DnsRecordsList + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/presets/zoho' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $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\DnsRecordsList::from($response); + } + + /** + * Add Zoho Mail DNS records to the domain. This will create the required MX + * records + * for setting up Zoho Mail on your domain. + * + * @throws AppwriteException + */ + public function createPresetZoho(string $domainId): \Appwrite\Models\DnsRecordsList + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/presets/zoho' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecordsList::from($response); + } + + /** + * List DNS records for a given domain. You can use this endpoint to list all + * the DNS records + * associated with your domain. + * + * @throws AppwriteException + */ + public function listRecords(string $domainId, ?array $queries = null): \Appwrite\Models\DnsRecordsList + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/records' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $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\DnsRecordsList::from($response); + } + + /** + * Create a new A record for the given domain. A records are used to point a + * domain name + * to an IPv4 address. The record value should be a valid IPv4 address. + * + * @throws AppwriteException + */ + public function createRecordA(string $domainId, string $name, string $value, int $ttl, ?string $comment = null): \Appwrite\Models\DnsRecord + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/records/a' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['name'] = $name; + $apiParams['value'] = $value; + $apiParams['ttl'] = $ttl; + + if (!is_null($comment)) { + $apiParams['comment'] = $comment; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecord::from($response); + } + + /** + * Update an existing A record for the given domain. This endpoint allows you + * to modify + * the properties of an A record including its name (subdomain), IPv4 address, + * TTL, + * and optional comment. + * + * @throws AppwriteException + */ + public function updateRecordA(string $domainId, string $recordId, string $name, string $value, int $ttl, ?string $comment = null): \Appwrite\Models\DnsRecord + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + if ($recordId === '') { + throw new AppwriteException('Missing required parameter: "recordId"'); + } + + $apiPath = str_replace( + ['{domainId}', '{recordId}'], + [$domainId, $recordId], + '/domains/{domainId}/records/a/{recordId}' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['recordId'] = $recordId; + $apiParams['name'] = $name; + $apiParams['value'] = $value; + $apiParams['ttl'] = $ttl; + + if (!is_null($comment)) { + $apiParams['comment'] = $comment; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecord::from($response); + } + + /** + * Create a new AAAA record for the given domain. This endpoint allows you to + * add a new IPv6 DNS record + * to your domain. The record will be used to point a hostname to an IPv6 + * address. + * + * @throws AppwriteException + */ + public function createRecordAAAA(string $domainId, string $name, string $value, int $ttl, ?string $comment = null): \Appwrite\Models\DnsRecord + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/records/aaaa' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['name'] = $name; + $apiParams['value'] = $value; + $apiParams['ttl'] = $ttl; + + if (!is_null($comment)) { + $apiParams['comment'] = $comment; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecord::from($response); + } + + /** + * Update an existing AAAA record for the given domain. This endpoint allows + * you to modify + * the properties of an existing AAAA record, including its name (subdomain), + * IPv6 address, + * TTL, and optional comment. + * + * @throws AppwriteException + */ + public function updateRecordAAAA(string $domainId, string $recordId, string $name, string $value, int $ttl, ?string $comment = null): \Appwrite\Models\DnsRecord + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + if ($recordId === '') { + throw new AppwriteException('Missing required parameter: "recordId"'); + } + + $apiPath = str_replace( + ['{domainId}', '{recordId}'], + [$domainId, $recordId], + '/domains/{domainId}/records/aaaa/{recordId}' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['recordId'] = $recordId; + $apiParams['name'] = $name; + $apiParams['value'] = $value; + $apiParams['ttl'] = $ttl; + + if (!is_null($comment)) { + $apiParams['comment'] = $comment; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecord::from($response); + } + + /** + * Create a new ALIAS record for the given domain. This record type can be + * used to point your domain + * to another domain name that will serve as an alias. This is particularly + * useful when you want to + * map your domain to a target domain that may change its IP address. + * + * @throws AppwriteException + */ + public function createRecordAlias(string $domainId, string $name, string $value, int $ttl, ?string $comment = null): \Appwrite\Models\DnsRecord + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/records/alias' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['name'] = $name; + $apiParams['value'] = $value; + $apiParams['ttl'] = $ttl; + + if (!is_null($comment)) { + $apiParams['comment'] = $comment; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecord::from($response); + } + + /** + * Update an existing ALIAS record for the specified domain. This endpoint + * allows you to modify + * the properties of an existing ALIAS record including its name, target + * domain, TTL, and comment. + * + * The ALIAS record type is similar to a CNAME record but can be used at the + * zone apex (root domain). + * It provides a way to map one domain name to another. + * + * @throws AppwriteException + */ + public function updateRecordAlias(string $domainId, string $recordId, string $name, string $value, int $ttl, ?string $comment = null): \Appwrite\Models\DnsRecord + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + if ($recordId === '') { + throw new AppwriteException('Missing required parameter: "recordId"'); + } + + $apiPath = str_replace( + ['{domainId}', '{recordId}'], + [$domainId, $recordId], + '/domains/{domainId}/records/alias/{recordId}' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['recordId'] = $recordId; + $apiParams['name'] = $name; + $apiParams['value'] = $value; + $apiParams['ttl'] = $ttl; + + if (!is_null($comment)) { + $apiParams['comment'] = $comment; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecord::from($response); + } + + /** + * Create a new CAA record for the given domain. CAA records are used to + * specify which + * Certificate Authorities (CAs) are allowed to issue SSL/TLS certificates for + * your domain. + * + * @throws AppwriteException + */ + public function createRecordCAA(string $domainId, string $name, string $value, int $ttl, ?string $comment = null): \Appwrite\Models\DnsRecord + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/records/caa' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['name'] = $name; + $apiParams['value'] = $value; + $apiParams['ttl'] = $ttl; + + if (!is_null($comment)) { + $apiParams['comment'] = $comment; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecord::from($response); + } + + /** + * Update an existing CAA record for the given domain. A CAA (Certification + * Authority Authorization) + * record is used to specify which certificate authorities (CAs) are + * authorized to issue certificates + * for a domain. + * + * @throws AppwriteException + */ + public function updateRecordCAA(string $domainId, string $recordId, string $name, string $value, int $ttl, ?string $comment = null): \Appwrite\Models\DnsRecord + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + if ($recordId === '') { + throw new AppwriteException('Missing required parameter: "recordId"'); + } + + $apiPath = str_replace( + ['{domainId}', '{recordId}'], + [$domainId, $recordId], + '/domains/{domainId}/records/caa/{recordId}' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['recordId'] = $recordId; + $apiParams['name'] = $name; + $apiParams['value'] = $value; + $apiParams['ttl'] = $ttl; + + if (!is_null($comment)) { + $apiParams['comment'] = $comment; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecord::from($response); + } + + /** + * Create a new CNAME record for the given domain. + * + * A CNAME record maps a subdomain to another domain name, allowing you to + * create aliases + * for your domain. For example, you can create a CNAME record to point + * 'blog.example.com' + * to 'example.wordpress.com'. + * + * @throws AppwriteException + */ + public function createRecordCNAME(string $domainId, string $name, string $value, int $ttl, ?string $comment = null): \Appwrite\Models\DnsRecord + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/records/cname' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['name'] = $name; + $apiParams['value'] = $value; + $apiParams['ttl'] = $ttl; + + if (!is_null($comment)) { + $apiParams['comment'] = $comment; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecord::from($response); + } + + /** + * Update an existing CNAME record for the given domain. + * + * @throws AppwriteException + */ + public function updateRecordCNAME(string $domainId, string $recordId, string $name, string $value, int $ttl, ?string $comment = null): \Appwrite\Models\DnsRecord + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + if ($recordId === '') { + throw new AppwriteException('Missing required parameter: "recordId"'); + } + + $apiPath = str_replace( + ['{domainId}', '{recordId}'], + [$domainId, $recordId], + '/domains/{domainId}/records/cname/{recordId}' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['recordId'] = $recordId; + $apiParams['name'] = $name; + $apiParams['value'] = $value; + $apiParams['ttl'] = $ttl; + + if (!is_null($comment)) { + $apiParams['comment'] = $comment; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecord::from($response); + } + + /** + * Create a new HTTPS record for the given domain. This record is used to + * configure HTTPS + * settings for your domain, enabling secure communication over SSL/TLS. + * + * @throws AppwriteException + */ + public function createRecordHTTPS(string $domainId, string $name, string $value, int $ttl, ?string $comment = null): \Appwrite\Models\DnsRecord + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/records/https' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['name'] = $name; + $apiParams['value'] = $value; + $apiParams['ttl'] = $ttl; + + if (!is_null($comment)) { + $apiParams['comment'] = $comment; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecord::from($response); + } + + /** + * Update an existing HTTPS record for the given domain. This endpoint allows + * you to modify + * the properties of an HTTPS record associated with your domain, including + * the name (subdomain), + * target value, TTL, and optional comment. + * + * @throws AppwriteException + */ + public function updateRecordHTTPS(string $domainId, string $recordId, string $name, string $value, int $ttl, ?string $comment = null): \Appwrite\Models\DnsRecord + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + if ($recordId === '') { + throw new AppwriteException('Missing required parameter: "recordId"'); + } + + $apiPath = str_replace( + ['{domainId}', '{recordId}'], + [$domainId, $recordId], + '/domains/{domainId}/records/https/{recordId}' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['recordId'] = $recordId; + $apiParams['name'] = $name; + $apiParams['value'] = $value; + $apiParams['ttl'] = $ttl; + + if (!is_null($comment)) { + $apiParams['comment'] = $comment; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecord::from($response); + } + + /** + * Create a new MX record for the given domain. MX records are used to define + * the mail servers responsible + * for accepting email messages for the domain. Multiple MX records can be + * created with different priorities. + * The priority parameter determines the order in which mail servers are used, + * with lower values indicating + * higher priority. + * + * @throws AppwriteException + */ + public function createRecordMX(string $domainId, string $name, string $value, int $ttl, int $priority, ?string $comment = null): \Appwrite\Models\DnsRecord + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/records/mx' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['name'] = $name; + $apiParams['value'] = $value; + $apiParams['ttl'] = $ttl; + $apiParams['priority'] = $priority; + + if (!is_null($comment)) { + $apiParams['comment'] = $comment; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecord::from($response); + } + + /** + * Update an existing MX record for the given domain. + * + * @throws AppwriteException + */ + public function updateRecordMX(string $domainId, string $recordId, string $name, string $value, int $ttl, int $priority, ?string $comment = null): \Appwrite\Models\DnsRecord + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + if ($recordId === '') { + throw new AppwriteException('Missing required parameter: "recordId"'); + } + + $apiPath = str_replace( + ['{domainId}', '{recordId}'], + [$domainId, $recordId], + '/domains/{domainId}/records/mx/{recordId}' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['recordId'] = $recordId; + $apiParams['name'] = $name; + $apiParams['value'] = $value; + $apiParams['ttl'] = $ttl; + $apiParams['priority'] = $priority; + + if (!is_null($comment)) { + $apiParams['comment'] = $comment; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecord::from($response); + } + + /** + * Create a new NS record for the given domain. NS records specify the + * nameservers that are used + * to resolve the domain name to IP addresses. Each domain can have multiple + * NS records. + * + * @throws AppwriteException + */ + public function createRecordNS(string $domainId, string $name, string $value, int $ttl, ?string $comment = null): \Appwrite\Models\DnsRecord + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/records/ns' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['name'] = $name; + $apiParams['value'] = $value; + $apiParams['ttl'] = $ttl; + + if (!is_null($comment)) { + $apiParams['comment'] = $comment; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecord::from($response); + } + + /** + * Update an existing NS record for the given domain. This endpoint allows you + * to modify + * the properties of an NS (nameserver) record associated with your domain. + * You can update + * the record name (subdomain), target nameserver value, TTL, and add or + * modify comments + * for better record management. + * + * @throws AppwriteException + */ + public function updateRecordNS(string $domainId, string $recordId, string $name, string $value, int $ttl, ?string $comment = null): \Appwrite\Models\DnsRecord + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + if ($recordId === '') { + throw new AppwriteException('Missing required parameter: "recordId"'); + } + + $apiPath = str_replace( + ['{domainId}', '{recordId}'], + [$domainId, $recordId], + '/domains/{domainId}/records/ns/{recordId}' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['recordId'] = $recordId; + $apiParams['name'] = $name; + $apiParams['value'] = $value; + $apiParams['ttl'] = $ttl; + + if (!is_null($comment)) { + $apiParams['comment'] = $comment; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecord::from($response); + } + + /** + * Create a new SRV record for the given domain. SRV records are used to + * define the location + * of servers for specific services. For example, they can be used to specify + * which server + * handles a specific service like SIP or XMPP for the domain. + * + * @throws AppwriteException + */ + public function createRecordSRV(string $domainId, string $name, string $value, int $ttl, int $priority, int $weight, int $port, ?string $comment = null): \Appwrite\Models\DnsRecord + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/records/srv' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['name'] = $name; + $apiParams['value'] = $value; + $apiParams['ttl'] = $ttl; + $apiParams['priority'] = $priority; + $apiParams['weight'] = $weight; + $apiParams['port'] = $port; + + if (!is_null($comment)) { + $apiParams['comment'] = $comment; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecord::from($response); + } + + /** + * Update an existing SRV record for the given domain. + * + * Required parameters: + * - domainId: Domain unique ID + * - recordId: DNS record unique ID + * - name: Record name (service name) + * - value: Target hostname for this SRV record + * - ttl: Time to live, in seconds + * - priority: Record priority + * - weight: Record weight + * - port: Port number for the service + * + * Optional parameters: + * - comment: A comment for this record + * + * @throws AppwriteException + */ + public function updateRecordSRV(string $domainId, string $recordId, string $name, string $value, int $ttl, int $priority, int $weight, int $port, ?string $comment = null): \Appwrite\Models\DnsRecord + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + if ($recordId === '') { + throw new AppwriteException('Missing required parameter: "recordId"'); + } + + $apiPath = str_replace( + ['{domainId}', '{recordId}'], + [$domainId, $recordId], + '/domains/{domainId}/records/srv/{recordId}' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['recordId'] = $recordId; + $apiParams['name'] = $name; + $apiParams['value'] = $value; + $apiParams['ttl'] = $ttl; + $apiParams['priority'] = $priority; + $apiParams['weight'] = $weight; + $apiParams['port'] = $port; + + if (!is_null($comment)) { + $apiParams['comment'] = $comment; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecord::from($response); + } + + /** + * Create a new TXT record for the given domain. TXT records can be used + * to provide additional information about your domain, such as domain + * verification records, SPF records, or DKIM records. + * + * @throws AppwriteException + */ + public function createRecordTXT(string $domainId, string $name, int $ttl, ?string $value = null, ?string $comment = null): \Appwrite\Models\DnsRecord + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/records/txt' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['name'] = $name; + $apiParams['ttl'] = $ttl; + + if (!is_null($value)) { + $apiParams['value'] = $value; + } + + if (!is_null($comment)) { + $apiParams['comment'] = $comment; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecord::from($response); + } + + /** + * Update an existing TXT record for the given domain. + * + * Update the TXT record details for a specific domain by providing the domain + * ID, + * record ID, and the new record configuration including name, value, TTL, and + * an optional comment. + * + * @throws AppwriteException + */ + public function updateRecordTXT(string $domainId, string $recordId, string $name, string $value, int $ttl, ?string $comment = null): \Appwrite\Models\DnsRecord + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + if ($recordId === '') { + throw new AppwriteException('Missing required parameter: "recordId"'); + } + + $apiPath = str_replace( + ['{domainId}', '{recordId}'], + [$domainId, $recordId], + '/domains/{domainId}/records/txt/{recordId}' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['recordId'] = $recordId; + $apiParams['name'] = $name; + $apiParams['value'] = $value; + $apiParams['ttl'] = $ttl; + + if (!is_null($comment)) { + $apiParams['comment'] = $comment; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\DnsRecord::from($response); + } + + /** + * Get a single DNS record for a given domain by record ID. + * + * This endpoint allows you to retrieve a specific DNS record associated with + * a domain + * using its unique identifier. The record contains information about the DNS + * configuration + * such as type, value, and TTL settings. + * + * @throws AppwriteException + */ + public function getRecord(string $domainId, string $recordId): \Appwrite\Models\DnsRecord + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + if ($recordId === '') { + throw new AppwriteException('Missing required parameter: "recordId"'); + } + + $apiPath = str_replace( + ['{domainId}', '{recordId}'], + [$domainId, $recordId], + '/domains/{domainId}/records/{recordId}' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['recordId'] = $recordId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $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\DnsRecord::from($response); + } + + /** + * Delete a DNS record for the given domain. This endpoint allows you to + * delete an existing DNS record + * from a specific domain. + * + * @throws AppwriteException + */ + public function deleteRecord(string $domainId, string $recordId): string + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + if ($recordId === '') { + throw new AppwriteException('Missing required parameter: "recordId"'); + } + + $apiPath = str_replace( + ['{domainId}', '{recordId}'], + [$domainId, $recordId], + '/domains/{domainId}/records/{recordId}' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['recordId'] = $recordId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update the team ID for a specific domain. The caller must administer the + * current + * team and be an owner of the destination team. + * + * Updating the team ID will transfer ownership and access control of the + * domain + * and all its DNS records to the new team. + * + * @throws AppwriteException + */ + public function updateTeam(string $domainId, string $teamId): \Appwrite\Models\Domain + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/team' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['teamId'] = $teamId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\Domain::from($response); + } + + /** + * Retrieve the current transfer status for a domain. Returns the status, an + * optional reason, and a timestamp of the last status change. + * + * @throws AppwriteException + */ + public function getTransferStatus(string $domainId): \Appwrite\Models\DomainTransferStatus + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/transfers/status' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $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\DomainTransferStatus::from($response); + } + + /** + * Retrieve the DNS zone file for the given domain. This endpoint will return + * the DNS + * zone file in a standardized format that can be used to configure DNS + * servers. + * + * @throws AppwriteException + */ + public function getZone(string $domainId): string + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/zone' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'text/plain'; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update the DNS zone for the given domain using the provided zone file + * content. + * All parsed records are imported and then the main domain document is + * returned. + * + * @throws AppwriteException + */ + public function updateZone(string $domainId, string $content): \Appwrite\Models\Domain + { + if ($domainId === '') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + + $apiPath = str_replace( + ['{domainId}'], + [$domainId], + '/domains/{domainId}/zone' + ); + + $apiParams = []; + $apiParams['domainId'] = $domainId; + $apiParams['content'] = $content; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\Domain::from($response); + } +} diff --git a/src/Appwrite/Services/Functions.php b/src/Appwrite/Services/Functions.php index da2e8250..d1bb5dda 100644 --- a/src/Appwrite/Services/Functions.php +++ b/src/Appwrite/Services/Functions.php @@ -188,7 +188,7 @@ public function create(string $functionId, string $name, Runtime $runtime, ?arra * * @throws AppwriteException */ - public function listRuntimes(): \Appwrite\Models\RuntimeList + public function listRuntimes(?bool $total = null): \Appwrite\Models\RuntimeList { $apiPath = str_replace( [], @@ -198,6 +198,10 @@ public function listRuntimes(): \Appwrite\Models\RuntimeList $apiParams = []; + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['accept'] = 'application/json'; @@ -221,7 +225,7 @@ public function listRuntimes(): \Appwrite\Models\RuntimeList * * @throws AppwriteException */ - public function listSpecifications(?string $type = null): \Appwrite\Models\SpecificationList + public function listSpecifications(?string $type = null, ?bool $total = null): \Appwrite\Models\SpecificationList { $apiPath = str_replace( [], @@ -235,6 +239,10 @@ public function listSpecifications(?string $type = null): \Appwrite\Models\Speci $apiParams['type'] = $type; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['accept'] = 'application/json'; diff --git a/src/Appwrite/Services/Locale.php b/src/Appwrite/Services/Locale.php index 6d0f10d5..7368b782 100644 --- a/src/Appwrite/Services/Locale.php +++ b/src/Appwrite/Services/Locale.php @@ -54,7 +54,7 @@ public function get(): \Appwrite\Models\Locale * * @throws AppwriteException */ - public function listCodes(): \Appwrite\Models\LocaleCodeList + public function listCodes(?bool $total = null): \Appwrite\Models\LocaleCodeList { $apiPath = str_replace( [], @@ -64,6 +64,10 @@ public function listCodes(): \Appwrite\Models\LocaleCodeList $apiParams = []; + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['accept'] = 'application/json'; @@ -88,7 +92,7 @@ public function listCodes(): \Appwrite\Models\LocaleCodeList * * @throws AppwriteException */ - public function listContinents(): \Appwrite\Models\ContinentList + public function listContinents(?bool $total = null): \Appwrite\Models\ContinentList { $apiPath = str_replace( [], @@ -98,6 +102,10 @@ public function listContinents(): \Appwrite\Models\ContinentList $apiParams = []; + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['accept'] = 'application/json'; @@ -122,7 +130,7 @@ public function listContinents(): \Appwrite\Models\ContinentList * * @throws AppwriteException */ - public function listCountries(): \Appwrite\Models\CountryList + public function listCountries(?bool $total = null): \Appwrite\Models\CountryList { $apiPath = str_replace( [], @@ -132,6 +140,10 @@ public function listCountries(): \Appwrite\Models\CountryList $apiParams = []; + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['accept'] = 'application/json'; @@ -156,7 +168,7 @@ public function listCountries(): \Appwrite\Models\CountryList * * @throws AppwriteException */ - public function listCountriesEU(): \Appwrite\Models\CountryList + public function listCountriesEU(?bool $total = null): \Appwrite\Models\CountryList { $apiPath = str_replace( [], @@ -166,6 +178,10 @@ public function listCountriesEU(): \Appwrite\Models\CountryList $apiParams = []; + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['accept'] = 'application/json'; @@ -190,7 +206,7 @@ public function listCountriesEU(): \Appwrite\Models\CountryList * * @throws AppwriteException */ - public function listCountriesPhones(): \Appwrite\Models\PhoneList + public function listCountriesPhones(?bool $total = null): \Appwrite\Models\PhoneList { $apiPath = str_replace( [], @@ -200,6 +216,10 @@ public function listCountriesPhones(): \Appwrite\Models\PhoneList $apiParams = []; + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['accept'] = 'application/json'; @@ -225,7 +245,7 @@ public function listCountriesPhones(): \Appwrite\Models\PhoneList * * @throws AppwriteException */ - public function listCurrencies(): \Appwrite\Models\CurrencyList + public function listCurrencies(?bool $total = null): \Appwrite\Models\CurrencyList { $apiPath = str_replace( [], @@ -235,6 +255,10 @@ public function listCurrencies(): \Appwrite\Models\CurrencyList $apiParams = []; + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['accept'] = 'application/json'; @@ -259,7 +283,7 @@ public function listCurrencies(): \Appwrite\Models\CurrencyList * * @throws AppwriteException */ - public function listLanguages(): \Appwrite\Models\LanguageList + public function listLanguages(?bool $total = null): \Appwrite\Models\LanguageList { $apiPath = str_replace( [], @@ -269,6 +293,10 @@ public function listLanguages(): \Appwrite\Models\LanguageList $apiParams = []; + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['accept'] = 'application/json'; diff --git a/src/Appwrite/Services/Messaging.php b/src/Appwrite/Services/Messaging.php index 6ac9e181..053d0e67 100644 --- a/src/Appwrite/Services/Messaging.php +++ b/src/Appwrite/Services/Messaging.php @@ -62,7 +62,7 @@ public function listMessages(?array $queries = null, ?string $search = null, ?bo * * @throws AppwriteException */ - public function createEmail(string $messageId, string $subject, string $content, ?array $topics = null, ?array $users = null, ?array $targets = null, ?array $cc = null, ?array $bcc = null, ?array $attachments = null, ?bool $draft = null, ?bool $html = null, ?string $scheduledAt = null): \Appwrite\Models\Message + public function createEmail(string $messageId, string $subject, string $content, ?array $topics = null, ?array $users = null, ?array $targets = null, ?array $cc = null, ?array $bcc = null, ?array $attachments = null, ?bool $draft = null, ?bool $html = null, ?string $scheduledAt = null, ?string $replyToEmail = null, ?string $replyToName = null): \Appwrite\Models\Message { $apiPath = str_replace( [], @@ -108,6 +108,14 @@ public function createEmail(string $messageId, string $subject, string $content, } $apiParams['scheduledAt'] = $scheduledAt; + if (!is_null($replyToEmail)) { + $apiParams['replyToEmail'] = $replyToEmail; + } + + if (!is_null($replyToName)) { + $apiParams['replyToName'] = $replyToName; + } + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; @@ -134,7 +142,7 @@ public function createEmail(string $messageId, string $subject, string $content, * * @throws AppwriteException */ - public function updateEmail(string $messageId, ?array $topics = null, ?array $users = null, ?array $targets = null, ?string $subject = null, ?string $content = null, ?bool $draft = null, ?bool $html = null, ?array $cc = null, ?array $bcc = null, ?string $scheduledAt = null, ?array $attachments = null): \Appwrite\Models\Message + public function updateEmail(string $messageId, ?array $topics = null, ?array $users = null, ?array $targets = null, ?string $subject = null, ?string $content = null, ?bool $draft = null, ?bool $html = null, ?array $cc = null, ?array $bcc = null, ?string $scheduledAt = null, ?array $attachments = null, ?string $replyToEmail = null, ?string $replyToName = null): \Appwrite\Models\Message { $apiPath = str_replace( ['{messageId}'], @@ -155,6 +163,8 @@ public function updateEmail(string $messageId, ?array $topics = null, ?array $us $apiParams['bcc'] = $bcc; $apiParams['scheduledAt'] = $scheduledAt; $apiParams['attachments'] = $attachments; + $apiParams['replyToEmail'] = $replyToEmail; + $apiParams['replyToName'] = $replyToName; $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); @@ -180,7 +190,7 @@ public function updateEmail(string $messageId, ?array $topics = null, ?array $us * * @throws AppwriteException */ - public function createPush(string $messageId, ?string $title = null, ?string $body = null, ?array $topics = null, ?array $users = null, ?array $targets = null, ?array $data = null, ?string $action = null, ?string $image = null, ?string $icon = null, ?string $sound = null, ?string $color = null, ?string $tag = null, ?int $badge = null, ?bool $draft = null, ?string $scheduledAt = null, ?bool $contentAvailable = null, ?bool $critical = null, ?MessagePriority $priority = null): \Appwrite\Models\Message + public function createPush(string $messageId, ?string $title = null, ?string $body = null, ?array $topics = null, ?array $users = null, ?array $targets = null, ?array $data = null, ?string $action = null, ?string $image = null, ?string $icon = null, ?string $sound = null, ?string $color = null, ?string $tag = null, ?int $badge = null, ?bool $draft = null, ?string $scheduledAt = null, ?bool $contentAvailable = null, ?bool $critical = null, ?MessagePriority $priority = null, ?string $channelId = null): \Appwrite\Models\Message { $apiPath = str_replace( [], @@ -257,6 +267,10 @@ public function createPush(string $messageId, ?string $title = null, ?string $bo $apiParams['priority'] = $priority; } + if (!is_null($channelId)) { + $apiParams['channelId'] = $channelId; + } + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; @@ -283,7 +297,7 @@ public function createPush(string $messageId, ?string $title = null, ?string $bo * * @throws AppwriteException */ - public function updatePush(string $messageId, ?array $topics = null, ?array $users = null, ?array $targets = null, ?string $title = null, ?string $body = null, ?array $data = null, ?string $action = null, ?string $image = null, ?string $icon = null, ?string $sound = null, ?string $color = null, ?string $tag = null, ?int $badge = null, ?bool $draft = null, ?string $scheduledAt = null, ?bool $contentAvailable = null, ?bool $critical = null, ?MessagePriority $priority = null): \Appwrite\Models\Message + public function updatePush(string $messageId, ?array $topics = null, ?array $users = null, ?array $targets = null, ?string $title = null, ?string $body = null, ?array $data = null, ?string $action = null, ?string $image = null, ?string $icon = null, ?string $sound = null, ?string $color = null, ?string $tag = null, ?int $badge = null, ?bool $draft = null, ?string $scheduledAt = null, ?bool $contentAvailable = null, ?bool $critical = null, ?MessagePriority $priority = null, ?string $channelId = null): \Appwrite\Models\Message { $apiPath = str_replace( ['{messageId}'], @@ -311,6 +325,7 @@ public function updatePush(string $messageId, ?array $topics = null, ?array $use $apiParams['contentAvailable'] = $contentAvailable; $apiParams['critical'] = $critical; $apiParams['priority'] = $priority; + $apiParams['channelId'] = $channelId; $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); @@ -691,6 +706,91 @@ public function updateAPNSProvider(string $providerId, ?string $name = null, ?bo return \Appwrite\Models\Provider::from($response); } + /** + * Create a new Appwrite push provider. + * + * @throws AppwriteException + */ + public function createAppwriteProvider(string $providerId, string $name, ?bool $enabled = null, ?int $qos = null, ?int $expiry = null): \Appwrite\Models\Provider + { + $apiPath = str_replace( + [], + [], + '/messaging/providers/appwrite' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + $apiParams['name'] = $name; + $apiParams['enabled'] = $enabled; + $apiParams['qos'] = $qos; + $apiParams['expiry'] = $expiry; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\Provider::from($response); + } + + /** + * Update an Appwrite push provider by its unique ID. + * + * @throws AppwriteException + */ + public function updateAppwriteProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?int $qos = null, ?int $expiry = null): \Appwrite\Models\Provider + { + if ($providerId === '') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/appwrite/{providerId}' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + $apiParams['enabled'] = $enabled; + $apiParams['qos'] = $qos; + $apiParams['expiry'] = $expiry; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\Provider::from($response); + } + /** * Create a new Firebase Cloud Messaging provider. * @@ -2037,7 +2137,7 @@ public function listTopics(?array $queries = null, ?string $search = null, ?bool * * @throws AppwriteException */ - public function createTopic(string $topicId, string $name, ?array $subscribe = null): \Appwrite\Models\Topic + public function createTopic(string $topicId, string $name, ?array $subscribe = null, ?int $qos = null, ?int $expiry = null): \Appwrite\Models\Topic { $apiPath = str_replace( [], @@ -2052,6 +2152,8 @@ public function createTopic(string $topicId, string $name, ?array $subscribe = n if (!is_null($subscribe)) { $apiParams['subscribe'] = $subscribe; } + $apiParams['qos'] = $qos; + $apiParams['expiry'] = $expiry; $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); @@ -2111,7 +2213,7 @@ public function getTopic(string $topicId): \Appwrite\Models\Topic * * @throws AppwriteException */ - public function updateTopic(string $topicId, ?string $name = null, ?array $subscribe = null): \Appwrite\Models\Topic + public function updateTopic(string $topicId, ?string $name = null, ?array $subscribe = null, ?int $qos = null, ?int $expiry = null): \Appwrite\Models\Topic { $apiPath = str_replace( ['{topicId}'], @@ -2123,6 +2225,8 @@ public function updateTopic(string $topicId, ?string $name = null, ?array $subsc $apiParams['topicId'] = $topicId; $apiParams['name'] = $name; $apiParams['subscribe'] = $subscribe; + $apiParams['qos'] = $qos; + $apiParams['expiry'] = $expiry; $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); diff --git a/src/Appwrite/Services/Oauth2.php b/src/Appwrite/Services/Oauth2.php index 918ac8f9..45d4927a 100644 --- a/src/Appwrite/Services/Oauth2.php +++ b/src/Appwrite/Services/Oauth2.php @@ -364,6 +364,55 @@ public function getGrant(string $grantId): \Appwrite\Models\Oauth2Grant return \Appwrite\Models\Oauth2Grant::from($response); } + /** + * Introspect an OAuth2 access token or refresh token. Authenticate with an + * API key holding the `oauth2.introspect` scope to introspect any token in + * the project, or with the client credentials of the app the token was issued + * to. + * + * @throws AppwriteException + */ + public function introspect(string $token, ?string $tokenTypeHint = null, ?string $clientId = null, ?string $clientSecret = null): \Appwrite\Models\Oauth2Introspection + { + $apiPath = str_replace( + ['{project_id}'], + [$this->client->getConfig('project')], + '/oauth2/{project_id}/introspect' + ); + + $apiParams = []; + $apiParams['token'] = $token; + + if (!is_null($tokenTypeHint)) { + $apiParams['token_type_hint'] = $tokenTypeHint; + } + + if (!is_null($clientId)) { + $apiParams['client_id'] = $clientId; + } + + if (!is_null($clientSecret)) { + $apiParams['client_secret'] = $clientSecret; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\Oauth2Introspection::from($response); + } + /** * List the organizations the OAuth2 access token can access. Resolves the * token's `organization` authorization details, expanding the `*` wildcard diff --git a/src/Appwrite/Services/Organization.php b/src/Appwrite/Services/Organization.php index 271df32f..3b572126 100644 --- a/src/Appwrite/Services/Organization.php +++ b/src/Appwrite/Services/Organization.php @@ -861,4 +861,226 @@ public function deleteProject(string $projectId): string $apiParams ); } + + /** + * Get a list of all API keys of a project in your organization. + * + * @throws AppwriteException + */ + public function listProjectKeys(string $projectId, ?array $queries = null, ?bool $total = null): \Appwrite\Models\KeyList + { + if ($projectId === '') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + + $apiPath = str_replace( + ['{projectId}'], + [$projectId], + '/organization/projects/{projectId}/keys' + ); + + $apiParams = []; + $apiParams['projectId'] = $projectId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($total)) { + $apiParams['total'] = $total; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $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\KeyList::from($response); + } + + /** + * Create a new ephemeral API key for a project in your organization. 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. + * + * @throws AppwriteException + */ + public function createEphemeralProjectKey(string $projectId, array $scopes, int $duration): \Appwrite\Models\EphemeralKey + { + if ($projectId === '') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + + $apiPath = str_replace( + ['{projectId}'], + [$projectId], + '/organization/projects/{projectId}/keys/ephemeral' + ); + + $apiParams = []; + $apiParams['projectId'] = $projectId; + $apiParams['scopes'] = $scopes; + $apiParams['duration'] = $duration; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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 project key by its unique ID. + * + * @throws AppwriteException + */ + public function getProjectKey(string $projectId, string $keyId): \Appwrite\Models\Key + { + if ($projectId === '') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + + if ($keyId === '') { + throw new AppwriteException('Missing required parameter: "keyId"'); + } + + $apiPath = str_replace( + ['{projectId}', '{keyId}'], + [$projectId, $keyId], + '/organization/projects/{projectId}/keys/{keyId}' + ); + + $apiParams = []; + $apiParams['projectId'] = $projectId; + $apiParams['keyId'] = $keyId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $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\Key::from($response); + } + + /** + * Update a project key by its unique ID. Use this endpoint to update the + * name, scopes, or expiration time of an API key. + * + * @throws AppwriteException + */ + public function updateProjectKey(string $projectId, string $keyId, string $name, array $scopes, ?string $expire = null): \Appwrite\Models\Key + { + if ($projectId === '') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + + if ($keyId === '') { + throw new AppwriteException('Missing required parameter: "keyId"'); + } + + $apiPath = str_replace( + ['{projectId}', '{keyId}'], + [$projectId, $keyId], + '/organization/projects/{projectId}/keys/{keyId}' + ); + + $apiParams = []; + $apiParams['projectId'] = $projectId; + $apiParams['keyId'] = $keyId; + $apiParams['name'] = $name; + $apiParams['scopes'] = $scopes; + $apiParams['expire'] = $expire; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\Key::from($response); + } + + /** + * Delete a project key by its unique ID. Once deleted, the key can no longer + * be used to authenticate API calls. + * + * @throws AppwriteException + */ + public function deleteProjectKey(string $projectId, string $keyId): string + { + if ($projectId === '') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + + if ($keyId === '') { + throw new AppwriteException('Missing required parameter: "keyId"'); + } + + $apiPath = str_replace( + ['{projectId}', '{keyId}'], + [$projectId, $keyId], + '/organization/projects/{projectId}/keys/{keyId}' + ); + + $apiParams = []; + $apiParams['projectId'] = $projectId; + $apiParams['keyId'] = $keyId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } } diff --git a/src/Appwrite/Services/Project.php b/src/Appwrite/Services/Project.php index 172ad2d0..05577731 100644 --- a/src/Appwrite/Services/Project.php +++ b/src/Appwrite/Services/Project.php @@ -114,6 +114,197 @@ public function updateAuthMethod(ProjectAuthMethodId $methodId, bool $enabled): return \Appwrite\Models\Project::from($response); } + /** + * Get a list of all environments of the project. You can use the query params + * to filter your results. + * + * @throws AppwriteException + */ + public function listEnvironments(?array $queries = null, ?bool $total = null): \Appwrite\Models\ProjectList + { + $apiPath = str_replace( + [], + [], + '/project/environments' + ); + + $apiParams = []; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($total)) { + $apiParams['total'] = $total; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $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\ProjectList::from($response); + } + + /** + * Create a new environment of the project. An environment is a separate + * project in the same organization and region, with its own resources and + * users. Its usage is billed under the project it belongs to. + * + * @throws AppwriteException + */ + public function createEnvironment(string $environmentId, string $name): \Appwrite\Models\Project + { + $apiPath = str_replace( + [], + [], + '/project/environments' + ); + + $apiParams = []; + $apiParams['environmentId'] = $environmentId; + $apiParams['name'] = $name; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\Project::from($response); + } + + /** + * Get an environment of the project by its unique ID. + * + * @throws AppwriteException + */ + public function getEnvironment(string $environmentId): \Appwrite\Models\Project + { + if ($environmentId === '') { + throw new AppwriteException('Missing required parameter: "environmentId"'); + } + + $apiPath = str_replace( + ['{environmentId}'], + [$environmentId], + '/project/environments/{environmentId}' + ); + + $apiParams = []; + $apiParams['environmentId'] = $environmentId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Project::from($response); + } + + /** + * Update the name of an environment of the project. + * + * @throws AppwriteException + */ + public function updateEnvironment(string $environmentId, string $name): \Appwrite\Models\Project + { + if ($environmentId === '') { + throw new AppwriteException('Missing required parameter: "environmentId"'); + } + + $apiPath = str_replace( + ['{environmentId}'], + [$environmentId], + '/project/environments/{environmentId}' + ); + + $apiParams = []; + $apiParams['environmentId'] = $environmentId; + $apiParams['name'] = $name; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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); + } + + /** + * Delete an environment of the project, with all of its resources and users. + * + * @throws AppwriteException + */ + public function deleteEnvironment(string $environmentId): string + { + if ($environmentId === '') { + throw new AppwriteException('Missing required parameter: "environmentId"'); + } + + $apiPath = str_replace( + ['{environmentId}'], + [$environmentId], + '/project/environments/{environmentId}' + ); + + $apiParams = []; + $apiParams['environmentId'] = $environmentId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Get a list of all API keys from the current project. * @@ -666,7 +857,7 @@ public function updateOAuth2Amazon(?string $clientId = null, ?string $clientSecr * * @throws AppwriteException */ - public function updateOAuth2Apple(?string $serviceId = null, ?string $keyId = null, ?string $teamId = null, ?string $p8File = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Apple + public function updateOAuth2Apple(?string $serviceId = null, ?string $keyId = null, ?string $teamId = null, ?string $p8File = null, ?bool $enabled = null, ?array $nativeClientIds = null, ?bool $nativeEnabled = null): \Appwrite\Models\OAuth2Apple { $apiPath = str_replace( [], @@ -680,6 +871,8 @@ public function updateOAuth2Apple(?string $serviceId = null, ?string $keyId = nu $apiParams['teamId'] = $teamId; $apiParams['p8File'] = $p8File; $apiParams['enabled'] = $enabled; + $apiParams['nativeClientIds'] = $nativeClientIds; + $apiParams['nativeEnabled'] = $nativeEnabled; $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); @@ -742,7 +935,7 @@ public function updateOAuth2Appwrite(?string $clientId = null, ?string $clientSe * * @throws AppwriteException */ - public function updateOAuth2Auth0(?string $clientId = null, ?string $clientSecret = null, ?string $endpoint = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Auth0 + public function updateOAuth2Auth0(?string $clientId = null, ?string $clientSecret = null, ?string $endpoint = null, ?bool $enabled = null, ?array $prompt = null): \Appwrite\Models\OAuth2Auth0 { $apiPath = str_replace( [], @@ -755,6 +948,7 @@ public function updateOAuth2Auth0(?string $clientId = null, ?string $clientSecre $apiParams['clientSecret'] = $clientSecret; $apiParams['endpoint'] = $endpoint; $apiParams['enabled'] = $enabled; + $apiParams['prompt'] = $prompt; $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); @@ -1040,7 +1234,7 @@ public function updateOAuth2Dailymotion(?string $apiKey = null, ?string $apiSecr * * @throws AppwriteException */ - public function updateOAuth2Discord(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Discord + public function updateOAuth2Discord(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null, ?array $prompt = null): \Appwrite\Models\OAuth2Discord { $apiPath = str_replace( [], @@ -1052,6 +1246,7 @@ public function updateOAuth2Discord(?string $clientId = null, ?string $clientSec $apiParams['clientId'] = $clientId; $apiParams['clientSecret'] = $clientSecret; $apiParams['enabled'] = $enabled; + $apiParams['prompt'] = $prompt; $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); @@ -1300,7 +1495,7 @@ public function updateOAuth2FusionAuth(?string $clientId = null, ?string $client * * @throws AppwriteException */ - public function updateOAuth2GitHub(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Github + public function updateOAuth2GitHub(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null, ?array $prompt = null): \Appwrite\Models\OAuth2Github { $apiPath = str_replace( [], @@ -1312,6 +1507,7 @@ public function updateOAuth2GitHub(?string $clientId = null, ?string $clientSecr $apiParams['clientId'] = $clientId; $apiParams['clientSecret'] = $clientSecret; $apiParams['enabled'] = $enabled; + $apiParams['prompt'] = $prompt; $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); @@ -1375,7 +1571,7 @@ public function updateOAuth2Gitlab(?string $applicationId = null, ?string $secre * * @throws AppwriteException */ - public function updateOAuth2Google(?string $clientId = null, ?string $clientSecret = null, ?array $prompt = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Google + public function updateOAuth2Google(?string $clientId = null, ?string $clientSecret = null, ?array $prompt = null, ?bool $enabled = null, ?array $nativeClientIds = null, ?bool $nativeEnabled = null): \Appwrite\Models\OAuth2Google { $apiPath = str_replace( [], @@ -1388,6 +1584,8 @@ public function updateOAuth2Google(?string $clientId = null, ?string $clientSecr $apiParams['clientSecret'] = $clientSecret; $apiParams['prompt'] = $prompt; $apiParams['enabled'] = $enabled; + $apiParams['nativeClientIds'] = $nativeClientIds; + $apiParams['nativeEnabled'] = $nativeEnabled; $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); @@ -1445,6 +1643,44 @@ public function updateOAuth2HuggingFace(?string $clientId = null, ?string $clien return \Appwrite\Models\OAuth2HuggingFace::from($response); } + /** + * Update the project OAuth2 Kakao configuration. + * + * @throws AppwriteException + */ + public function updateOAuth2Kakao(?string $clientId = null, ?string $clientSecret = null, ?array $prompt = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Kakao + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/kakao' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $apiParams['prompt'] = $prompt; + $apiParams['enabled'] = $enabled; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\OAuth2Kakao::from($response); + } + /** * Update the project OAuth2 Keycloak configuration. * @@ -1563,7 +1799,7 @@ public function updateOAuth2Linkedin(?string $clientId = null, ?string $primaryC * * @throws AppwriteException */ - public function updateOAuth2Microsoft(?string $applicationId = null, ?string $applicationSecret = null, ?string $tenant = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Microsoft + public function updateOAuth2Microsoft(?string $applicationId = null, ?string $applicationSecret = null, ?string $tenant = null, ?bool $enabled = null, ?array $prompt = null): \Appwrite\Models\OAuth2Microsoft { $apiPath = str_replace( [], @@ -1576,6 +1812,7 @@ public function updateOAuth2Microsoft(?string $applicationId = null, ?string $ap $apiParams['applicationSecret'] = $applicationSecret; $apiParams['tenant'] = $tenant; $apiParams['enabled'] = $enabled; + $apiParams['prompt'] = $prompt; $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); @@ -1681,7 +1918,7 @@ public function updateOAuth2Oidc(?string $clientId = null, ?string $clientSecret * * @throws AppwriteException */ - public function updateOAuth2Okta(?string $clientId = null, ?string $clientSecret = null, ?string $domain = null, ?string $authorizationServerId = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Okta + public function updateOAuth2Okta(?string $clientId = null, ?string $clientSecret = null, ?string $domain = null, ?string $authorizationServerId = null, ?bool $enabled = null, ?array $prompt = null): \Appwrite\Models\OAuth2Okta { $apiPath = str_replace( [], @@ -1695,6 +1932,7 @@ public function updateOAuth2Okta(?string $clientId = null, ?string $clientSecret $apiParams['domain'] = $domain; $apiParams['authorizationServerId'] = $authorizationServerId; $apiParams['enabled'] = $enabled; + $apiParams['prompt'] = $prompt; $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); @@ -1868,7 +2106,7 @@ public function updateOAuth2Resend(?string $clientId = null, ?string $clientSecr * * @throws AppwriteException */ - public function updateOAuth2Salesforce(?string $customerKey = null, ?string $customerSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Salesforce + public function updateOAuth2Salesforce(?string $customerKey = null, ?string $customerSecret = null, ?bool $enabled = null, ?array $prompt = null): \Appwrite\Models\OAuth2Salesforce { $apiPath = str_replace( [], @@ -1880,6 +2118,7 @@ public function updateOAuth2Salesforce(?string $customerKey = null, ?string $cus $apiParams['customerKey'] = $customerKey; $apiParams['customerSecret'] = $customerSecret; $apiParams['enabled'] = $enabled; + $apiParams['prompt'] = $prompt; $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); @@ -2011,6 +2250,43 @@ public function updateOAuth2Stripe(?string $clientId = null, ?string $apiSecretK return \Appwrite\Models\OAuth2Stripe::from($response); } + /** + * Update the project OAuth2 TikTok configuration. + * + * @throws AppwriteException + */ + public function updateOAuth2TikTok(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2TikTok + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/tiktok' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $apiParams['enabled'] = $enabled; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\OAuth2TikTok::from($response); + } + /** * Update the project OAuth2 Tradeshift configuration. * @@ -2122,6 +2398,43 @@ public function updateOAuth2Twitch(?string $clientId = null, ?string $clientSecr return \Appwrite\Models\OAuth2Twitch::from($response); } + /** + * Update the project OAuth2 Webflow configuration. + * + * @throws AppwriteException + */ + public function updateOAuth2Webflow(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Webflow + { + $apiPath = str_replace( + [], + [], + '/project/oauth2/webflow' + ); + + $apiParams = []; + $apiParams['clientId'] = $clientId; + $apiParams['clientSecret'] = $clientSecret; + $apiParams['enabled'] = $enabled; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\OAuth2Webflow::from($response); + } + /** * Update the project OAuth2 WordPress configuration. * @@ -2275,7 +2588,7 @@ public function updateOAuth2Yandex(?string $clientId = null, ?string $clientSecr * * @throws AppwriteException */ - public function updateOAuth2Zoho(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null): \Appwrite\Models\OAuth2Zoho + public function updateOAuth2Zoho(?string $clientId = null, ?string $clientSecret = null, ?bool $enabled = null, ?array $prompt = null): \Appwrite\Models\OAuth2Zoho { $apiPath = str_replace( [], @@ -2287,6 +2600,7 @@ public function updateOAuth2Zoho(?string $clientId = null, ?string $clientSecret $apiParams['clientId'] = $clientId; $apiParams['clientSecret'] = $clientSecret; $apiParams['enabled'] = $enabled; + $apiParams['prompt'] = $prompt; $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); @@ -2350,7 +2664,7 @@ public function updateOAuth2Zoom(?string $clientId = null, ?string $clientSecret * * @throws AppwriteException */ - public function getOAuth2Provider(ProjectOAuthProviderId $providerId): \Appwrite\Models\OAuth2Github|\Appwrite\Models\OAuth2Discord|\Appwrite\Models\OAuth2Figma|\Appwrite\Models\OAuth2Dropbox|\Appwrite\Models\OAuth2Dailymotion|\Appwrite\Models\OAuth2Bitbucket|\Appwrite\Models\OAuth2Bitly|\Appwrite\Models\OAuth2Box|\Appwrite\Models\OAuth2Autodesk|\Appwrite\Models\OAuth2Google|\Appwrite\Models\OAuth2Zoom|\Appwrite\Models\OAuth2Zoho|\Appwrite\Models\OAuth2Yandex|\Appwrite\Models\OAuth2X|\Appwrite\Models\OAuth2WordPress|\Appwrite\Models\OAuth2Twitch|\Appwrite\Models\OAuth2Stripe|\Appwrite\Models\OAuth2Spotify|\Appwrite\Models\OAuth2Slack|\Appwrite\Models\OAuth2Podio|\Appwrite\Models\OAuth2Notion|\Appwrite\Models\OAuth2Salesforce|\Appwrite\Models\OAuth2Yahoo|\Appwrite\Models\OAuth2HuggingFace|\Appwrite\Models\OAuth2Resend|\Appwrite\Models\OAuth2Cloudflare|\Appwrite\Models\OAuth2Linkedin|\Appwrite\Models\OAuth2Disqus|\Appwrite\Models\OAuth2Amazon|\Appwrite\Models\OAuth2Etsy|\Appwrite\Models\OAuth2Facebook|\Appwrite\Models\OAuth2Tradeshift|\Appwrite\Models\OAuth2Paypal|\Appwrite\Models\OAuth2Gitlab|\Appwrite\Models\OAuth2Authentik|\Appwrite\Models\OAuth2Auth0|\Appwrite\Models\OAuth2FusionAuth|\Appwrite\Models\OAuth2Keycloak|\Appwrite\Models\OAuth2Oidc|\Appwrite\Models\OAuth2Apple|\Appwrite\Models\OAuth2Okta|\Appwrite\Models\OAuth2Kick|\Appwrite\Models\OAuth2Microsoft + public function getOAuth2Provider(ProjectOAuthProviderId $providerId): \Appwrite\Models\OAuth2Github|\Appwrite\Models\OAuth2Discord|\Appwrite\Models\OAuth2Figma|\Appwrite\Models\OAuth2Dropbox|\Appwrite\Models\OAuth2Dailymotion|\Appwrite\Models\OAuth2Bitbucket|\Appwrite\Models\OAuth2Bitly|\Appwrite\Models\OAuth2Box|\Appwrite\Models\OAuth2Autodesk|\Appwrite\Models\OAuth2Google|\Appwrite\Models\OAuth2Zoom|\Appwrite\Models\OAuth2Zoho|\Appwrite\Models\OAuth2Yandex|\Appwrite\Models\OAuth2X|\Appwrite\Models\OAuth2WordPress|\Appwrite\Models\OAuth2Webflow|\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\OAuth2HuggingFace|\Appwrite\Models\OAuth2Resend|\Appwrite\Models\OAuth2Cloudflare|\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|\Appwrite\Models\OAuth2TikTok|\Appwrite\Models\OAuth2Kakao { $apiPath = str_replace( ['{providerId}'], @@ -2436,6 +2750,10 @@ public function getOAuth2Provider(ProjectOAuthProviderId $providerId): \Appwrite return \Appwrite\Models\OAuth2WordPress::from($response); } + if (($response['$id'] ?? null) === 'webflow') { + return \Appwrite\Models\OAuth2Webflow::from($response); + } + if (($response['$id'] ?? null) === 'twitch') { return \Appwrite\Models\OAuth2Twitch::from($response); } @@ -2548,6 +2866,14 @@ public function getOAuth2Provider(ProjectOAuthProviderId $providerId): \Appwrite return \Appwrite\Models\OAuth2Microsoft::from($response); } + if (($response['$id'] ?? null) === 'tiktok') { + return \Appwrite\Models\OAuth2TikTok::from($response); + } + + if (($response['$id'] ?? null) === 'kakao') { + return \Appwrite\Models\OAuth2Kakao::from($response); + } + throw new \UnexpectedValueException('Unable to match response to any expected response model.'); } @@ -2600,7 +2926,7 @@ public function listPlatforms(?array $queries = null, ?bool $total = null): \App * * @throws AppwriteException */ - public function createAndroidPlatform(string $platformId, string $name, string $applicationId): \Appwrite\Models\PlatformAndroid + public function createAndroidPlatform(string $platformId, string $name, string $applicationId, ?array $fingerprints = null): \Appwrite\Models\PlatformAndroid { $apiPath = str_replace( [], @@ -2613,6 +2939,10 @@ public function createAndroidPlatform(string $platformId, string $name, string $ $apiParams['name'] = $name; $apiParams['applicationId'] = $applicationId; + if (!is_null($fingerprints)) { + $apiParams['fingerprints'] = $fingerprints; + } + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; @@ -2638,7 +2968,7 @@ public function createAndroidPlatform(string $platformId, string $name, string $ * * @throws AppwriteException */ - public function updateAndroidPlatform(string $platformId, string $name, string $applicationId): \Appwrite\Models\PlatformAndroid + public function updateAndroidPlatform(string $platformId, string $name, string $applicationId, ?array $fingerprints = null): \Appwrite\Models\PlatformAndroid { $apiPath = str_replace( ['{platformId}'], @@ -2650,6 +2980,7 @@ public function updateAndroidPlatform(string $platformId, string $name, string $ $apiParams['platformId'] = $platformId; $apiParams['name'] = $name; $apiParams['applicationId'] = $applicationId; + $apiParams['fingerprints'] = $fingerprints; $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); @@ -3519,6 +3850,103 @@ public function updatePasswordPersonalDataPolicy(bool $enabled): \Appwrite\Model return \Appwrite\Models\Project::from($response); } + /** + * Updating this policy allows you to control if passwords are checked against + * the Have I Been Pwned breach database. When enabled, every password a user + * signs up, signs in or resets with is checked and the result is recorded on + * the user as `passwordPwned`. On its own the policy only records. Enable + * `users` to reject a breached password when a user signs up or sets a new + * password, and `sessions` to refuse a sign-in with a breached password until + * it is reset. Only the first five characters of the password hash are ever + * shared with the service. Options left out keep their current value. + * + * @throws AppwriteException + */ + public function updatePasswordPwnedPolicy(?bool $enabled = null, ?bool $sessions = null, ?bool $users = null): \Appwrite\Models\Project + { + $apiPath = str_replace( + [], + [], + '/project/policies/password-pwned' + ); + + $apiParams = []; + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($sessions)) { + $apiParams['sessions'] = $sessions; + } + + if (!is_null($users)) { + $apiParams['users'] = $users; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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); + } + + /** + * Require a password reset when an email/password sign-in uses a password + * older than the configured maximum age. Options left out keep their current + * value. + * + * @throws AppwriteException + */ + public function updatePasswordRotationPolicy(?bool $enabled = null, ?int $maxAge = null): \Appwrite\Models\Project + { + $apiPath = str_replace( + [], + [], + '/project/policies/password-rotation' + ); + + $apiParams = []; + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($maxAge)) { + $apiParams['maxAge'] = $maxAge; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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 the password strength requirements for users in the project. * @@ -3764,7 +4192,7 @@ public function updateUserLimitPolicy(?int $total): \Appwrite\Models\Project * * @throws AppwriteException */ - public function getPolicy(ProjectPolicyId $policyId): \Appwrite\Models\PolicyPasswordDictionary|\Appwrite\Models\PolicyPasswordHistory|\Appwrite\Models\PolicyPasswordStrength|\Appwrite\Models\PolicyPasswordPersonalData|\Appwrite\Models\PolicySessionAlert|\Appwrite\Models\PolicySessionDuration|\Appwrite\Models\PolicySessionInvalidation|\Appwrite\Models\PolicySessionLimit|\Appwrite\Models\PolicyUserLimit|\Appwrite\Models\PolicyMembershipPrivacy|\Appwrite\Models\PolicyMfaFactors|\Appwrite\Models\PolicyDenyAliasedEmail|\Appwrite\Models\PolicyDenyDisposableEmail|\Appwrite\Models\PolicyDenyFreeEmail|\Appwrite\Models\PolicyDenyCorporateEmail|\Appwrite\Models\PolicyPasskey + public function getPolicy(ProjectPolicyId $policyId): \Appwrite\Models\PolicyPasswordDictionary|\Appwrite\Models\PolicyPasswordHistory|\Appwrite\Models\PolicyPasswordStrength|\Appwrite\Models\PolicyPasswordPersonalData|\Appwrite\Models\PolicyPasswordPwned|\Appwrite\Models\PolicyPasswordRotation|\Appwrite\Models\PolicySessionAlert|\Appwrite\Models\PolicySessionDuration|\Appwrite\Models\PolicySessionInvalidation|\Appwrite\Models\PolicySessionLimit|\Appwrite\Models\PolicyUserLimit|\Appwrite\Models\PolicyMembershipPrivacy|\Appwrite\Models\PolicyMfaFactors|\Appwrite\Models\PolicyDenyAliasedEmail|\Appwrite\Models\PolicyDenyDisposableEmail|\Appwrite\Models\PolicyDenyFreeEmail|\Appwrite\Models\PolicyDenyCorporateEmail|\Appwrite\Models\PolicyPasskey { $apiPath = str_replace( ['{policyId}'], @@ -3806,6 +4234,14 @@ public function getPolicy(ProjectPolicyId $policyId): \Appwrite\Models\PolicyPas return \Appwrite\Models\PolicyPasswordPersonalData::from($response); } + if (($response['$id'] ?? null) === 'password-pwned') { + return \Appwrite\Models\PolicyPasswordPwned::from($response); + } + + if (($response['$id'] ?? null) === 'password-rotation') { + return \Appwrite\Models\PolicyPasswordRotation::from($response); + } + if (($response['$id'] ?? null) === 'session-alert') { return \Appwrite\Models\PolicySessionAlert::from($response); } diff --git a/src/Appwrite/Services/Sites.php b/src/Appwrite/Services/Sites.php index 59b2c791..3aeb94d8 100644 --- a/src/Appwrite/Services/Sites.php +++ b/src/Appwrite/Services/Sites.php @@ -188,7 +188,7 @@ public function create(string $siteId, string $name, Framework $framework, Build * * @throws AppwriteException */ - public function listFrameworks(): \Appwrite\Models\FrameworkList + public function listFrameworks(?bool $total = null): \Appwrite\Models\FrameworkList { $apiPath = str_replace( [], @@ -198,6 +198,10 @@ public function listFrameworks(): \Appwrite\Models\FrameworkList $apiParams = []; + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['accept'] = 'application/json'; @@ -221,7 +225,7 @@ public function listFrameworks(): \Appwrite\Models\FrameworkList * * @throws AppwriteException */ - public function listSpecifications(?string $type = null): \Appwrite\Models\SpecificationList + public function listSpecifications(?string $type = null, ?bool $total = null): \Appwrite\Models\SpecificationList { $apiPath = str_replace( [], @@ -235,6 +239,10 @@ public function listSpecifications(?string $type = null): \Appwrite\Models\Speci $apiParams['type'] = $type; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['accept'] = 'application/json'; diff --git a/src/Appwrite/Services/TablesDB.php b/src/Appwrite/Services/TablesDB.php index 73dfe40b..4ec544bd 100644 --- a/src/Appwrite/Services/TablesDB.php +++ b/src/Appwrite/Services/TablesDB.php @@ -148,7 +148,7 @@ public function listSpecifications(): \Appwrite\Models\DedicatedDatabaseSpecific * * @throws AppwriteException */ - public function listTransactions(?array $queries = null): \Appwrite\Models\TransactionList + public function listTransactions(?array $queries = null, ?bool $total = null): \Appwrite\Models\TransactionList { $apiPath = str_replace( [], @@ -162,6 +162,10 @@ public function listTransactions(?array $queries = null): \Appwrite\Models\Trans $apiParams['queries'] = $queries; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['accept'] = 'application/json'; diff --git a/src/Appwrite/Services/Teams.php b/src/Appwrite/Services/Teams.php index 9796da0d..3aad4091 100644 --- a/src/Appwrite/Services/Teams.php +++ b/src/Appwrite/Services/Teams.php @@ -462,7 +462,7 @@ public function listMemberships(string $teamId, ?array $queries = null, ?string * * @throws AppwriteException */ - public function createMembership(string $teamId, array $roles, ?string $email = null, ?string $userId = null, ?string $phone = null, ?string $url = null, ?string $name = null): \Appwrite\Models\Membership + public function createMembership(string $teamId, array $roles, ?string $email = null, ?string $userId = null, ?string $phone = null, ?string $url = null, ?string $name = null, ?string $membershipId = null): \Appwrite\Models\Membership { $apiPath = str_replace( ['{teamId}'], @@ -494,6 +494,10 @@ public function createMembership(string $teamId, array $roles, ?string $email = $apiParams['name'] = $name; } + if (!is_null($membershipId)) { + $apiParams['membershipId'] = $membershipId; + } + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; diff --git a/src/Appwrite/Services/VectorsDB.php b/src/Appwrite/Services/VectorsDB.php index 45d9820e..c2a5c12a 100644 --- a/src/Appwrite/Services/VectorsDB.php +++ b/src/Appwrite/Services/VectorsDB.php @@ -142,7 +142,7 @@ public function listSpecifications(): \Appwrite\Models\DedicatedDatabaseSpecific * * @throws AppwriteException */ - public function listTransactions(?array $queries = null): \Appwrite\Models\TransactionList + public function listTransactions(?array $queries = null, ?bool $total = null): \Appwrite\Models\TransactionList { $apiPath = str_replace( [], @@ -156,6 +156,10 @@ public function listTransactions(?array $queries = null): \Appwrite\Models\Trans $apiParams['queries'] = $queries; } + if (!is_null($total)) { + $apiParams['total'] = $total; + } + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['accept'] = 'application/json'; diff --git a/src/Appwrite/Services/Waf.php b/src/Appwrite/Services/Waf.php new file mode 100644 index 00000000..ef3926fb --- /dev/null +++ b/src/Appwrite/Services/Waf.php @@ -0,0 +1,740 @@ +client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $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\WafRuleList::from($response); + } + + /** + * Create a bypass WAF rule. Conditions can match request attributes including + * `ip` (plain IPs or CIDR blocks like `10.0.0.0/8`), `method`, `path`, + * `host`, `country`, `continent`, `headers.`, `query.`, + * `queryKeys`, `userAgent`, `os`, `osVersion`, `browser`, and + * `browserVersion`. Conditions on `city` and `state` require the premium Geo + * DB addon. + * + * @throws AppwriteException + */ + public function createBypassRule(string $ruleId, string $resourceType, string $name, ?string $resourceId = null, ?string $description = null, ?int $priority = null, ?bool $enabled = null, ?array $conditions = null): \Appwrite\Models\WafRuleBypass + { + $apiPath = str_replace( + [], + [], + '/waf/rules/bypass' + ); + + $apiParams = []; + $apiParams['ruleId'] = $ruleId; + $apiParams['resourceType'] = $resourceType; + $apiParams['name'] = $name; + $apiParams['resourceId'] = $resourceId; + + if (!is_null($description)) { + $apiParams['description'] = $description; + } + + if (!is_null($priority)) { + $apiParams['priority'] = $priority; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($conditions)) { + $apiParams['conditions'] = $conditions; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\WafRuleBypass::from($response); + } + + /** + * Update a bypass WAF rule. Conditions can match request attributes including + * `ip` (plain IPs or CIDR blocks like `10.0.0.0/8`), `method`, `path`, + * `host`, `country`, `continent`, `headers.`, `query.`, + * `queryKeys`, `userAgent`, `os`, `osVersion`, `browser`, and + * `browserVersion`. Conditions on `city` and `state` require the premium Geo + * DB addon. + * + * @throws AppwriteException + */ + public function updateBypassRule(string $ruleId, ?string $resourceType = null, ?string $resourceId = null, ?string $name = null, ?string $description = null, ?int $priority = null, ?bool $enabled = null, ?array $conditions = null): \Appwrite\Models\WafRuleBypass + { + if ($ruleId === '') { + throw new AppwriteException('Missing required parameter: "ruleId"'); + } + + $apiPath = str_replace( + ['{ruleId}'], + [$ruleId], + '/waf/rules/bypass/{ruleId}' + ); + + $apiParams = []; + $apiParams['ruleId'] = $ruleId; + $apiParams['resourceType'] = $resourceType; + $apiParams['resourceId'] = $resourceId; + $apiParams['name'] = $name; + $apiParams['description'] = $description; + $apiParams['priority'] = $priority; + $apiParams['enabled'] = $enabled; + $apiParams['conditions'] = $conditions; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\WafRuleBypass::from($response); + } + + /** + * Create a challenge WAF rule. Use `difficulty` (1 easiest to 5 hardest) to + * tune the client-side proof-of-work cost, and `ttl` to control how long, in + * seconds, a visitor stays cleared after passing the challenge before being + * challenged again. Conditions can match request attributes including `ip` + * (plain IPs or CIDR blocks like `10.0.0.0/8`), `method`, `path`, `host`, + * `country`, `continent`, `headers.`, `query.`, `queryKeys`, + * `userAgent`, `os`, `osVersion`, `browser`, and `browserVersion`. Conditions + * on `city` and `state` require the premium Geo DB addon. + * + * @throws AppwriteException + */ + public function createChallengeRule(string $ruleId, string $resourceType, string $name, ?string $resourceId = null, ?string $description = null, ?string $challengeType = null, ?int $priority = null, ?bool $enabled = null, ?array $conditions = null, ?int $difficulty = null, ?int $ttl = null): \Appwrite\Models\WafRuleChallenge + { + $apiPath = str_replace( + [], + [], + '/waf/rules/challenge' + ); + + $apiParams = []; + $apiParams['ruleId'] = $ruleId; + $apiParams['resourceType'] = $resourceType; + $apiParams['name'] = $name; + $apiParams['resourceId'] = $resourceId; + + if (!is_null($description)) { + $apiParams['description'] = $description; + } + + if (!is_null($challengeType)) { + $apiParams['challengeType'] = $challengeType; + } + + if (!is_null($priority)) { + $apiParams['priority'] = $priority; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($conditions)) { + $apiParams['conditions'] = $conditions; + } + + if (!is_null($difficulty)) { + $apiParams['difficulty'] = $difficulty; + } + + if (!is_null($ttl)) { + $apiParams['ttl'] = $ttl; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\WafRuleChallenge::from($response); + } + + /** + * Update a challenge WAF rule. Use `difficulty` (1 easiest to 5 hardest) to + * tune the client-side proof-of-work cost, and `ttl` to control how long, in + * seconds, a visitor stays cleared after passing the challenge before being + * challenged again. Conditions can match request attributes including `ip` + * (plain IPs or CIDR blocks like `10.0.0.0/8`), `method`, `path`, `host`, + * `country`, `continent`, `headers.`, `query.`, `queryKeys`, + * `userAgent`, `os`, `osVersion`, `browser`, and `browserVersion`. Conditions + * on `city` and `state` require the premium Geo DB addon. + * + * @throws AppwriteException + */ + public function updateChallengeRule(string $ruleId, ?string $resourceType = null, ?string $resourceId = null, ?string $name = null, ?string $description = null, ?string $challengeType = null, ?int $priority = null, ?bool $enabled = null, ?array $conditions = null, ?int $difficulty = null, ?int $ttl = null): \Appwrite\Models\WafRuleChallenge + { + if ($ruleId === '') { + throw new AppwriteException('Missing required parameter: "ruleId"'); + } + + $apiPath = str_replace( + ['{ruleId}'], + [$ruleId], + '/waf/rules/challenge/{ruleId}' + ); + + $apiParams = []; + $apiParams['ruleId'] = $ruleId; + $apiParams['resourceType'] = $resourceType; + $apiParams['resourceId'] = $resourceId; + $apiParams['name'] = $name; + $apiParams['description'] = $description; + $apiParams['challengeType'] = $challengeType; + $apiParams['priority'] = $priority; + $apiParams['enabled'] = $enabled; + $apiParams['conditions'] = $conditions; + $apiParams['difficulty'] = $difficulty; + $apiParams['ttl'] = $ttl; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\WafRuleChallenge::from($response); + } + + /** + * Create a deny WAF rule. Conditions can match request attributes including + * `ip` (plain IPs or CIDR blocks like `10.0.0.0/8`), `method`, `path`, + * `host`, `country`, `continent`, `headers.`, `query.`, + * `queryKeys`, `userAgent`, `os`, `osVersion`, `browser`, and + * `browserVersion`. Conditions on `city` and `state` require the premium Geo + * DB addon. + * + * @throws AppwriteException + */ + public function createDenyRule(string $ruleId, string $resourceType, string $name, ?string $resourceId = null, ?string $description = null, ?int $priority = null, ?bool $enabled = null, ?array $conditions = null): \Appwrite\Models\WafRuleDeny + { + $apiPath = str_replace( + [], + [], + '/waf/rules/deny' + ); + + $apiParams = []; + $apiParams['ruleId'] = $ruleId; + $apiParams['resourceType'] = $resourceType; + $apiParams['name'] = $name; + $apiParams['resourceId'] = $resourceId; + + if (!is_null($description)) { + $apiParams['description'] = $description; + } + + if (!is_null($priority)) { + $apiParams['priority'] = $priority; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($conditions)) { + $apiParams['conditions'] = $conditions; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\WafRuleDeny::from($response); + } + + /** + * Update a deny WAF rule. Conditions can match request attributes including + * `ip` (plain IPs or CIDR blocks like `10.0.0.0/8`), `method`, `path`, + * `host`, `country`, `continent`, `headers.`, `query.`, + * `queryKeys`, `userAgent`, `os`, `osVersion`, `browser`, and + * `browserVersion`. Conditions on `city` and `state` require the premium Geo + * DB addon. + * + * @throws AppwriteException + */ + public function updateDenyRule(string $ruleId, ?string $resourceType = null, ?string $resourceId = null, ?string $name = null, ?string $description = null, ?int $priority = null, ?bool $enabled = null, ?array $conditions = null): \Appwrite\Models\WafRuleDeny + { + if ($ruleId === '') { + throw new AppwriteException('Missing required parameter: "ruleId"'); + } + + $apiPath = str_replace( + ['{ruleId}'], + [$ruleId], + '/waf/rules/deny/{ruleId}' + ); + + $apiParams = []; + $apiParams['ruleId'] = $ruleId; + $apiParams['resourceType'] = $resourceType; + $apiParams['resourceId'] = $resourceId; + $apiParams['name'] = $name; + $apiParams['description'] = $description; + $apiParams['priority'] = $priority; + $apiParams['enabled'] = $enabled; + $apiParams['conditions'] = $conditions; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\WafRuleDeny::from($response); + } + + /** + * Create a rate limit WAF rule. Use `key` to choose the counter: `ip` limits + * per client IP, while `userId` limits per authenticated user (requests + * without an authenticated user skip `userId` rules). Conditions can match + * request attributes including `ip` (plain IPs or CIDR blocks like + * `10.0.0.0/8`), `method`, `path`, `host`, `country`, `continent`, + * `headers.`, `query.`, `queryKeys`, `userAgent`, `os`, + * `osVersion`, `browser`, and `browserVersion`. Conditions on `city` and + * `state` require the premium Geo DB addon. + * + * @throws AppwriteException + */ + public function createRateLimitRule(string $ruleId, string $resourceType, string $name, int $limit, int $interval, ?string $resourceId = null, ?string $description = null, ?string $key = null, ?string $strategy = null, ?int $maxBucketSize = null, ?int $priority = null, ?bool $enabled = null, ?array $conditions = null): \Appwrite\Models\WafRuleRateLimit + { + $apiPath = str_replace( + [], + [], + '/waf/rules/rate-limit' + ); + + $apiParams = []; + $apiParams['ruleId'] = $ruleId; + $apiParams['resourceType'] = $resourceType; + $apiParams['name'] = $name; + $apiParams['limit'] = $limit; + $apiParams['interval'] = $interval; + $apiParams['resourceId'] = $resourceId; + + if (!is_null($description)) { + $apiParams['description'] = $description; + } + + if (!is_null($key)) { + $apiParams['key'] = $key; + } + + if (!is_null($strategy)) { + $apiParams['strategy'] = $strategy; + } + $apiParams['maxBucketSize'] = $maxBucketSize; + + if (!is_null($priority)) { + $apiParams['priority'] = $priority; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($conditions)) { + $apiParams['conditions'] = $conditions; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\WafRuleRateLimit::from($response); + } + + /** + * Update a rate limit WAF rule. Use `key` to choose the counter: `ip` limits + * per client IP, while `userId` limits per authenticated user (requests + * without an authenticated user skip `userId` rules). Conditions can match + * request attributes including `ip` (plain IPs or CIDR blocks like + * `10.0.0.0/8`), `method`, `path`, `host`, `country`, `continent`, + * `headers.`, `query.`, `queryKeys`, `userAgent`, `os`, + * `osVersion`, `browser`, and `browserVersion`. Conditions on `city` and + * `state` require the premium Geo DB addon. + * + * @throws AppwriteException + */ + public function updateRateLimitRule(string $ruleId, ?string $resourceType = null, ?string $resourceId = null, ?string $name = null, ?string $description = null, ?int $limit = null, ?int $interval = null, ?string $key = null, ?int $maxBucketSize = null, ?int $priority = null, ?bool $enabled = null, ?array $conditions = null): \Appwrite\Models\WafRuleRateLimit + { + if ($ruleId === '') { + throw new AppwriteException('Missing required parameter: "ruleId"'); + } + + $apiPath = str_replace( + ['{ruleId}'], + [$ruleId], + '/waf/rules/rate-limit/{ruleId}' + ); + + $apiParams = []; + $apiParams['ruleId'] = $ruleId; + $apiParams['resourceType'] = $resourceType; + $apiParams['resourceId'] = $resourceId; + $apiParams['name'] = $name; + $apiParams['description'] = $description; + $apiParams['limit'] = $limit; + $apiParams['interval'] = $interval; + $apiParams['key'] = $key; + $apiParams['maxBucketSize'] = $maxBucketSize; + $apiParams['priority'] = $priority; + $apiParams['enabled'] = $enabled; + $apiParams['conditions'] = $conditions; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\WafRuleRateLimit::from($response); + } + + /** + * Create a redirect WAF rule. Conditions can match request attributes + * including `ip` (plain IPs or CIDR blocks like `10.0.0.0/8`), `method`, + * `path`, `host`, `country`, `continent`, `headers.`, `query.`, + * `queryKeys`, `userAgent`, `os`, `osVersion`, `browser`, and + * `browserVersion`. Conditions on `city` and `state` require the premium Geo + * DB addon. + * + * @throws AppwriteException + */ + public function createRedirectRule(string $ruleId, string $resourceType, string $name, string $location, int $statusCode, ?string $resourceId = null, ?string $description = null, ?int $priority = null, ?bool $enabled = null, ?array $conditions = null): \Appwrite\Models\WafRuleRedirect + { + $apiPath = str_replace( + [], + [], + '/waf/rules/redirect' + ); + + $apiParams = []; + $apiParams['ruleId'] = $ruleId; + $apiParams['resourceType'] = $resourceType; + $apiParams['name'] = $name; + $apiParams['location'] = $location; + $apiParams['statusCode'] = $statusCode; + $apiParams['resourceId'] = $resourceId; + + if (!is_null($description)) { + $apiParams['description'] = $description; + } + + if (!is_null($priority)) { + $apiParams['priority'] = $priority; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($conditions)) { + $apiParams['conditions'] = $conditions; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\WafRuleRedirect::from($response); + } + + /** + * Update a redirect WAF rule. Conditions can match request attributes + * including `ip` (plain IPs or CIDR blocks like `10.0.0.0/8`), `method`, + * `path`, `host`, `country`, `continent`, `headers.`, `query.`, + * `queryKeys`, `userAgent`, `os`, `osVersion`, `browser`, and + * `browserVersion`. Conditions on `city` and `state` require the premium Geo + * DB addon. + * + * @throws AppwriteException + */ + public function updateRedirectRule(string $ruleId, ?string $resourceType = null, ?string $resourceId = null, ?string $name = null, ?string $description = null, ?string $location = null, ?int $statusCode = null, ?int $priority = null, ?bool $enabled = null, ?array $conditions = null): \Appwrite\Models\WafRuleRedirect + { + if ($ruleId === '') { + throw new AppwriteException('Missing required parameter: "ruleId"'); + } + + $apiPath = str_replace( + ['{ruleId}'], + [$ruleId], + '/waf/rules/redirect/{ruleId}' + ); + + $apiParams = []; + $apiParams['ruleId'] = $ruleId; + $apiParams['resourceType'] = $resourceType; + $apiParams['resourceId'] = $resourceId; + $apiParams['name'] = $name; + $apiParams['description'] = $description; + $apiParams['location'] = $location; + $apiParams['statusCode'] = $statusCode; + $apiParams['priority'] = $priority; + $apiParams['enabled'] = $enabled; + $apiParams['conditions'] = $conditions; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = '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\WafRuleRedirect::from($response); + } + + /** + * Get a WAF rule by its ID. + * + * @throws AppwriteException + */ + public function getRule(string $ruleId): \Appwrite\Models\WafRuleBypass|\Appwrite\Models\WafRuleDeny|\Appwrite\Models\WafRuleChallenge|\Appwrite\Models\WafRuleRateLimit|\Appwrite\Models\WafRuleRedirect + { + if ($ruleId === '') { + throw new AppwriteException('Missing required parameter: "ruleId"'); + } + + $apiPath = str_replace( + ['{ruleId}'], + [$ruleId], + '/waf/rules/{ruleId}' + ); + + $apiParams = []; + $apiParams['ruleId'] = $ruleId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $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['action'] ?? null) === 'bypass') { + return \Appwrite\Models\WafRuleBypass::from($response); + } + + if (($response['action'] ?? null) === 'deny') { + return \Appwrite\Models\WafRuleDeny::from($response); + } + + if (($response['action'] ?? null) === 'challenge') { + return \Appwrite\Models\WafRuleChallenge::from($response); + } + + if (($response['action'] ?? null) === 'rateLimit') { + return \Appwrite\Models\WafRuleRateLimit::from($response); + } + + if (($response['action'] ?? null) === 'redirect') { + return \Appwrite\Models\WafRuleRedirect::from($response); + } + + throw new \UnexpectedValueException('Unable to match response to any expected response model.'); + } + + /** + * Delete a WAF rule. + * + * @throws AppwriteException + */ + public function deleteRule(string $ruleId): string + { + if ($ruleId === '') { + throw new AppwriteException('Missing required parameter: "ruleId"'); + } + + $apiPath = str_replace( + ['{ruleId}'], + [$ruleId], + '/waf/rules/{ruleId}' + ); + + $apiParams = []; + $apiParams['ruleId'] = $ruleId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } +} diff --git a/tests/Appwrite/Services/AccountTest.php b/tests/Appwrite/Services/AccountTest.php index 33b3f25a..c4a20ad2 100644 --- a/tests/Appwrite/Services/AccountTest.php +++ b/tests/Appwrite/Services/AccountTest.php @@ -10,6 +10,7 @@ use PHPUnit\Framework\TestCase; use Appwrite\Enums\AuthenticatorType; use Appwrite\Enums\AuthenticationFactor; +use Appwrite\Enums\IdTokenProvider; use Appwrite\Enums\OAuthProvider; final class AccountTest extends TestCase @@ -1060,6 +1061,56 @@ public function testMethodUpdateRecovery(): void $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); } + public function testMethodCreateRecoveryOTP(): void + { + $data = [ + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "secret" => "[SECRET]", + "expire" => "2020-10-15T06:38:00.000+00:00", + "phrase" => "Golden Fox" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->account->createRecoveryOTP( + "email@example.com" + ); + + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } + public function testMethodUpdateRecoveryOTP(): void + { + $data = [ + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "secret" => "[SECRET]", + "expire" => "2020-10-15T06:38:00.000+00:00", + "phrase" => "Golden Fox" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->account->updateRecoveryOTP( + "", + "", + "password" + ); + + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } public function testMethodListSessions(): void { $data = [ @@ -1218,6 +1269,54 @@ public function testMethodCreateEmailPasswordSession(): void $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); } + public function testMethodCreateIdTokenSession(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5bb8c16897e", + "expire" => "2020-10-15T06:38:00.000+00:00", + "provider" => "email", + "providerUid" => "user@example.com", + "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", + "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "ip" => "127.0.0.1", + "osCode" => "Mac", + "osName" => "Mac", + "osVersion" => "Mac", + "clientType" => "browser", + "clientCode" => "CM", + "clientName" => "Chrome Mobile iOS", + "clientVersion" => "84.0", + "clientEngine" => "WebKit", + "clientEngineVersion" => "605.1.15", + "deviceName" => "smartphone", + "deviceBrand" => "Google", + "deviceModel" => "Nexus 5", + "countryCode" => "US", + "countryName" => "United States", + "current" => true, + "factors" => [], + "secret" => "5e5bb8c16897e", + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->account->createIdTokenSession( + IdTokenProvider::APPLE(), + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Session::class, $response); + } public function testMethodUpdateMagicURLSession(): void { $data = [ @@ -1752,6 +1851,53 @@ public function testMethodUpdateVerification(): void $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); } + public function testMethodCreateEmailVerificationOTP(): void + { + $data = [ + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "secret" => "[SECRET]", + "expire" => "2020-10-15T06:38:00.000+00:00", + "phrase" => "Golden Fox" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->account->createEmailVerificationOTP(); + + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } + public function testMethodUpdateEmailVerificationOTP(): void + { + $data = [ + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "secret" => "[SECRET]", + "expire" => "2020-10-15T06:38:00.000+00:00", + "phrase" => "Golden Fox" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->account->updateEmailVerificationOTP( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); + } public function testMethodCreatePhoneVerification(): void { $data = [ diff --git a/tests/Appwrite/Services/AvatarsTest.php b/tests/Appwrite/Services/AvatarsTest.php index cfa7469f..aa887545 100644 --- a/tests/Appwrite/Services/AvatarsTest.php +++ b/tests/Appwrite/Services/AvatarsTest.php @@ -11,6 +11,7 @@ use Appwrite\Enums\Browser; use Appwrite\Enums\CreditCard; use Appwrite\Enums\Flag; +use Appwrite\InputFile; final class AvatarsTest extends TestCase { @@ -138,6 +139,66 @@ public function testMethodGetPhoto(): void $this->assertSame($data, $response); } + public function testMethodUpdatePhoto(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => [], + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => [], + "targets" => [ + [ + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Apple iPhone 12", + "userId" => "259125845563242502", + "providerType" => "email", + "identifier" => "token", + "expired" => true + ] + ], + "accessedAt" => "2020-10-15T06:38:00.000+00:00" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->avatars->updatePhoto( + InputFile::withData('', 'image/png') + ); + + $this->assertInstanceOf(\Appwrite\Models\Account::class, $response); + } + public function testMethodDeletePhoto(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->avatars->deletePhoto(); + + $this->assertSame($data, $response); + } public function testMethodGetQR(): void { $data = ''; diff --git a/tests/Appwrite/Services/DomainsTest.php b/tests/Appwrite/Services/DomainsTest.php new file mode 100644 index 00000000..55406567 --- /dev/null +++ b/tests/Appwrite/Services/DomainsTest.php @@ -0,0 +1,1633 @@ +client = Mockery::mock(Client::class); + $this->domains = new Domains($this->client); + } + + public function testMethodList(): void + { + $data = [ + "total" => 5, + "domains" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "domain" => "example.com", + "registrar" => "appwrite", + "nameservers" => "Appwrite", + "expire" => "2020-10-15T06:38:00.000+00:00", + "renewal" => "2020-10-15T06:38:00.000+00:00", + "autoRenewal" => true, + "renewalPrice" => 2599, + "teamId" => "5e5ea5c16897e", + "dnsRecords" => [ + [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ] + ] + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->list(); + + $this->assertInstanceOf(\Appwrite\Models\DomainsList::class, $response); + } + public function testMethodCreate(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "domain" => "example.com", + "registrar" => "appwrite", + "nameservers" => "Appwrite", + "expire" => "2020-10-15T06:38:00.000+00:00", + "renewal" => "2020-10-15T06:38:00.000+00:00", + "autoRenewal" => true, + "renewalPrice" => 2599, + "teamId" => "5e5ea5c16897e", + "dnsRecords" => [ + [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->create( + "", + "example.com" + ); + + $this->assertInstanceOf(\Appwrite\Models\Domain::class, $response); + } + public function testMethodGetPrice(): void + { + $data = [ + "domain" => "example.com", + "tld" => "com", + "available" => true, + "periodYears" => 1, + "premium" => true, + "renewalPeriodYears" => 1 + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->getPrice( + "example.com" + ); + + $this->assertInstanceOf(\Appwrite\Models\DomainPrice::class, $response); + } + public function testMethodListPrices(): void + { + $data = [ + "total" => 5, + "prices" => [ + [ + "domain" => "example.com", + "tld" => "com", + "available" => true, + "periodYears" => 1, + "premium" => true, + "renewalPeriodYears" => 1 + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->listPrices( + [] + ); + + $this->assertInstanceOf(\Appwrite\Models\DomainPricesList::class, $response); + } + public function testMethodGet(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "domain" => "example.com", + "registrar" => "appwrite", + "nameservers" => "Appwrite", + "expire" => "2020-10-15T06:38:00.000+00:00", + "renewal" => "2020-10-15T06:38:00.000+00:00", + "autoRenewal" => true, + "renewalPrice" => 2599, + "teamId" => "5e5ea5c16897e", + "dnsRecords" => [ + [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->get( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Domain::class, $response); + } + public function testMethodDelete(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->delete( + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodUpdateNameservers(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "domain" => "example.com", + "registrar" => "appwrite", + "nameservers" => "Appwrite", + "expire" => "2020-10-15T06:38:00.000+00:00", + "renewal" => "2020-10-15T06:38:00.000+00:00", + "autoRenewal" => true, + "renewalPrice" => 2599, + "teamId" => "5e5ea5c16897e", + "dnsRecords" => [ + [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->updateNameservers( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Domain::class, $response); + } + public function testMethodVerifyNameservers(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "domain" => "example.com", + "registrar" => "appwrite", + "nameservers" => "Appwrite", + "expire" => "2020-10-15T06:38:00.000+00:00", + "renewal" => "2020-10-15T06:38:00.000+00:00", + "autoRenewal" => true, + "renewalPrice" => 2599, + "teamId" => "5e5ea5c16897e", + "dnsRecords" => [ + [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->verifyNameservers( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Domain::class, $response); + } + public function testMethodGetPresetGoogleWorkspace(): void + { + $data = [ + "total" => 5, + "dnsRecords" => [ + [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->getPresetGoogleWorkspace( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecordsList::class, $response); + } + public function testMethodCreatePresetGoogleWorkspace(): void + { + $data = [ + "total" => 5, + "dnsRecords" => [ + [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->createPresetGoogleWorkspace( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecordsList::class, $response); + } + public function testMethodGetPresetICloud(): void + { + $data = [ + "total" => 5, + "dnsRecords" => [ + [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->getPresetICloud( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecordsList::class, $response); + } + public function testMethodCreatePresetICloud(): void + { + $data = [ + "total" => 5, + "dnsRecords" => [ + [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->createPresetICloud( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecordsList::class, $response); + } + public function testMethodGetPresetMailgun(): void + { + $data = [ + "total" => 5, + "dnsRecords" => [ + [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->getPresetMailgun( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecordsList::class, $response); + } + public function testMethodCreatePresetMailgun(): void + { + $data = [ + "total" => 5, + "dnsRecords" => [ + [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->createPresetMailgun( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecordsList::class, $response); + } + public function testMethodGetPresetOutlook(): void + { + $data = [ + "total" => 5, + "dnsRecords" => [ + [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->getPresetOutlook( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecordsList::class, $response); + } + public function testMethodCreatePresetOutlook(): void + { + $data = [ + "total" => 5, + "dnsRecords" => [ + [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->createPresetOutlook( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecordsList::class, $response); + } + public function testMethodGetPresetProtonMail(): void + { + $data = [ + "total" => 5, + "dnsRecords" => [ + [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->getPresetProtonMail( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecordsList::class, $response); + } + public function testMethodCreatePresetProtonMail(): void + { + $data = [ + "total" => 5, + "dnsRecords" => [ + [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->createPresetProtonMail( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecordsList::class, $response); + } + public function testMethodGetPresetZoho(): void + { + $data = [ + "total" => 5, + "dnsRecords" => [ + [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->getPresetZoho( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecordsList::class, $response); + } + public function testMethodCreatePresetZoho(): void + { + $data = [ + "total" => 5, + "dnsRecords" => [ + [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->createPresetZoho( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecordsList::class, $response); + } + public function testMethodListRecords(): void + { + $data = [ + "total" => 5, + "dnsRecords" => [ + [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->listRecords( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecordsList::class, $response); + } + public function testMethodCreateRecordA(): void + { + $data = [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->createRecordA( + "", + "name", + "value", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecord::class, $response); + } + public function testMethodUpdateRecordA(): void + { + $data = [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->updateRecordA( + "", + "", + "name", + "value", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecord::class, $response); + } + public function testMethodCreateRecordAAAA(): void + { + $data = [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->createRecordAAAA( + "", + "name", + "value", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecord::class, $response); + } + public function testMethodUpdateRecordAAAA(): void + { + $data = [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->updateRecordAAAA( + "", + "", + "name", + "value", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecord::class, $response); + } + public function testMethodCreateRecordAlias(): void + { + $data = [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->createRecordAlias( + "", + "name", + "", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecord::class, $response); + } + public function testMethodUpdateRecordAlias(): void + { + $data = [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->updateRecordAlias( + "", + "", + "name", + "", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecord::class, $response); + } + public function testMethodCreateRecordCAA(): void + { + $data = [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->createRecordCAA( + "", + "name", + "value", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecord::class, $response); + } + public function testMethodUpdateRecordCAA(): void + { + $data = [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->updateRecordCAA( + "", + "", + "name", + "value", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecord::class, $response); + } + public function testMethodCreateRecordCNAME(): void + { + $data = [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->createRecordCNAME( + "", + "name", + "", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecord::class, $response); + } + public function testMethodUpdateRecordCNAME(): void + { + $data = [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->updateRecordCNAME( + "", + "", + "name", + "", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecord::class, $response); + } + public function testMethodCreateRecordHTTPS(): void + { + $data = [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->createRecordHTTPS( + "", + "name", + "", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecord::class, $response); + } + public function testMethodUpdateRecordHTTPS(): void + { + $data = [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->updateRecordHTTPS( + "", + "", + "name", + "", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecord::class, $response); + } + public function testMethodCreateRecordMX(): void + { + $data = [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->createRecordMX( + "", + "name", + "", + 1, + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecord::class, $response); + } + public function testMethodUpdateRecordMX(): void + { + $data = [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->updateRecordMX( + "", + "", + "name", + "", + 1, + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecord::class, $response); + } + public function testMethodCreateRecordNS(): void + { + $data = [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->createRecordNS( + "", + "name", + "", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecord::class, $response); + } + public function testMethodUpdateRecordNS(): void + { + $data = [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->updateRecordNS( + "", + "", + "name", + "", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecord::class, $response); + } + public function testMethodCreateRecordSRV(): void + { + $data = [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->createRecordSRV( + "", + "name", + "", + 1, + 1, + 1, + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecord::class, $response); + } + public function testMethodUpdateRecordSRV(): void + { + $data = [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->updateRecordSRV( + "", + "", + "name", + "", + 1, + 1, + 1, + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecord::class, $response); + } + public function testMethodCreateRecordTXT(): void + { + $data = [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->createRecordTXT( + "", + "name", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecord::class, $response); + } + public function testMethodUpdateRecordTXT(): void + { + $data = [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->updateRecordTXT( + "", + "", + "name", + "", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecord::class, $response); + } + public function testMethodGetRecord(): void + { + $data = [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->getRecord( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DnsRecord::class, $response); + } + public function testMethodDeleteRecord(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->deleteRecord( + "", + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodUpdateTeam(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "domain" => "example.com", + "registrar" => "appwrite", + "nameservers" => "Appwrite", + "expire" => "2020-10-15T06:38:00.000+00:00", + "renewal" => "2020-10-15T06:38:00.000+00:00", + "autoRenewal" => true, + "renewalPrice" => 2599, + "teamId" => "5e5ea5c16897e", + "dnsRecords" => [ + [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->updateTeam( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Domain::class, $response); + } + public function testMethodGetTransferStatus(): void + { + $data = [ + "status" => "transferrable", + "reason" => "Transfer in progress", + "timestamp" => "2020-10-15T06:38:00.000+00:00" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->getTransferStatus( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DomainTransferStatus::class, $response); + } + public function testMethodGetZone(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->getZone( + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodUpdateZone(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "domain" => "example.com", + "registrar" => "appwrite", + "nameservers" => "Appwrite", + "expire" => "2020-10-15T06:38:00.000+00:00", + "renewal" => "2020-10-15T06:38:00.000+00:00", + "autoRenewal" => true, + "renewalPrice" => 2599, + "teamId" => "5e5ea5c16897e", + "dnsRecords" => [ + [ + "\$id" => "5f40a6e10c65e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "type" => "A", + "name" => "mail", + "value" => "192.0.2.1", + "ttl" => 86400, + "priority" => 10, + "lock" => true, + "weight" => 10, + "port" => 443, + "comment" => "Mail server record" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->domains->updateZone( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Domain::class, $response); + } +} diff --git a/tests/Appwrite/Services/MessagingTest.php b/tests/Appwrite/Services/MessagingTest.php index 3ba423ce..41ee48b5 100644 --- a/tests/Appwrite/Services/MessagingTest.php +++ b/tests/Appwrite/Services/MessagingTest.php @@ -380,6 +380,59 @@ public function testMethodUpdateAPNSProvider(): void $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); } + public function testMethodCreateAppwriteProvider(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->messaging->createAppwriteProvider( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } + public function testMethodUpdateAppwriteProvider(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->messaging->updateAppwriteProvider( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Provider::class, $response); + } public function testMethodCreateFCMProvider(): void { $data = [ diff --git a/tests/Appwrite/Services/Oauth2Test.php b/tests/Appwrite/Services/Oauth2Test.php index bfff4992..3196d5e8 100644 --- a/tests/Appwrite/Services/Oauth2Test.php +++ b/tests/Appwrite/Services/Oauth2Test.php @@ -157,6 +157,25 @@ public function testMethodGetGrant(): void $this->assertInstanceOf(\Appwrite\Models\Oauth2Grant::class, $response); } + public function testMethodIntrospect(): void + { + $data = [ + "active" => true + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->oauth2->introspect( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Oauth2Introspection::class, $response); + } public function testMethodListOrganizations(): void { $data = [ diff --git a/tests/Appwrite/Services/OrganizationTest.php b/tests/Appwrite/Services/OrganizationTest.php index 316f69ca..1132dac0 100644 --- a/tests/Appwrite/Services/OrganizationTest.php +++ b/tests/Appwrite/Services/OrganizationTest.php @@ -9,6 +9,7 @@ use Mockery\MockInterface; use PHPUnit\Framework\TestCase; use Appwrite\Enums\OrganizationKeyScopes; +use Appwrite\Enums\ProjectKeyScopes; final class OrganizationTest extends TestCase { @@ -1147,6 +1148,143 @@ public function testMethodDeleteProject(): void "" ); + $this->assertSame($data, $response); + } + public function testMethodListProjectKeys(): void + { + $data = [ + "total" => 5, + "keys" => [ + [ + "\$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" => [], + "secret" => "919c2d18fb5d4...a2ae413da83346ad2", + "accessedAt" => "2020-10-15T06:38:00.000+00:00", + "sdks" => [] + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->organization->listProjectKeys( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\KeyList::class, $response); + } + public function testMethodCreateEphemeralProjectKey(): void + { + $data = [ + "\$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" => [], + "secret" => "919c2d18fb5d4...a2ae413da83346ad2", + "accessedAt" => "2020-10-15T06:38:00.000+00:00", + "sdks" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->organization->createEphemeralProjectKey( + "", + [ProjectKeyScopes::PROJECTREAD()], + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\EphemeralKey::class, $response); + } + public function testMethodGetProjectKey(): void + { + $data = [ + "\$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" => [], + "secret" => "919c2d18fb5d4...a2ae413da83346ad2", + "accessedAt" => "2020-10-15T06:38:00.000+00:00", + "sdks" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->organization->getProjectKey( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Key::class, $response); + } + public function testMethodUpdateProjectKey(): void + { + $data = [ + "\$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" => [], + "secret" => "919c2d18fb5d4...a2ae413da83346ad2", + "accessedAt" => "2020-10-15T06:38:00.000+00:00", + "sdks" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->organization->updateProjectKey( + "", + "", + "", + [ProjectKeyScopes::PROJECTREAD()] + ); + + $this->assertInstanceOf(\Appwrite\Models\Key::class, $response); + } + public function testMethodDeleteProjectKey(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->organization->deleteProjectKey( + "", + "" + ); + $this->assertSame($data, $response); } } diff --git a/tests/Appwrite/Services/ProjectTest.php b/tests/Appwrite/Services/ProjectTest.php index 620addb8..ca05b4f6 100644 --- a/tests/Appwrite/Services/ProjectTest.php +++ b/tests/Appwrite/Services/ProjectTest.php @@ -207,6 +207,316 @@ public function testMethodUpdateAuthMethod(): void $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); } + public function testMethodListEnvironments(): void + { + $data = [ + "total" => 5, + "projects" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "New Project", + "teamId" => "1592981250", + "region" => "fra", + "devKeys" => [], + "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" => "smtp-password", + "smtpSecure" => "tls", + "pingCount" => 1, + "pingedAt" => "2020-10-15T06:38:00.000+00:00", + "labels" => [], + "status" => "active", + "onboarding" => [], + "authMethods" => [ + [ + "\$id" => "email-password", + "enabled" => true + ] + ], + "services" => [ + [ + "\$id" => "account", + "enabled" => true + ] + ], + "protocols" => [ + [ + "\$id" => "rest", + "enabled" => true + ] + ], + "blocks" => [ + [ + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "resourceType" => "project", + "resourceId" => "5e5ea5c16897e", + "mode" => "readOnly", + "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); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->project->listEnvironments(); + + $this->assertInstanceOf(\Appwrite\Models\ProjectList::class, $response); + } + public function testMethodCreateEnvironment(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "New Project", + "teamId" => "1592981250", + "region" => "fra", + "devKeys" => [], + "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" => "smtp-password", + "smtpSecure" => "tls", + "pingCount" => 1, + "pingedAt" => "2020-10-15T06:38:00.000+00:00", + "labels" => [], + "status" => "active", + "onboarding" => [], + "authMethods" => [ + [ + "\$id" => "email-password", + "enabled" => true + ] + ], + "services" => [ + [ + "\$id" => "account", + "enabled" => true + ] + ], + "protocols" => [ + [ + "\$id" => "rest", + "enabled" => true + ] + ], + "blocks" => [ + [ + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "resourceType" => "project", + "resourceId" => "5e5ea5c16897e", + "mode" => "readOnly", + "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); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->project->createEnvironment( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); + } + public function testMethodGetEnvironment(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "New Project", + "teamId" => "1592981250", + "region" => "fra", + "devKeys" => [], + "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" => "smtp-password", + "smtpSecure" => "tls", + "pingCount" => 1, + "pingedAt" => "2020-10-15T06:38:00.000+00:00", + "labels" => [], + "status" => "active", + "onboarding" => [], + "authMethods" => [ + [ + "\$id" => "email-password", + "enabled" => true + ] + ], + "services" => [ + [ + "\$id" => "account", + "enabled" => true + ] + ], + "protocols" => [ + [ + "\$id" => "rest", + "enabled" => true + ] + ], + "blocks" => [ + [ + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "resourceType" => "project", + "resourceId" => "5e5ea5c16897e", + "mode" => "readOnly", + "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); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->project->getEnvironment( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); + } + public function testMethodUpdateEnvironment(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "New Project", + "teamId" => "1592981250", + "region" => "fra", + "devKeys" => [], + "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" => "smtp-password", + "smtpSecure" => "tls", + "pingCount" => 1, + "pingedAt" => "2020-10-15T06:38:00.000+00:00", + "labels" => [], + "status" => "active", + "onboarding" => [], + "authMethods" => [ + [ + "\$id" => "email-password", + "enabled" => true + ] + ], + "services" => [ + [ + "\$id" => "account", + "enabled" => true + ] + ], + "protocols" => [ + [ + "\$id" => "rest", + "enabled" => true + ] + ], + "blocks" => [ + [ + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "resourceType" => "project", + "resourceId" => "5e5ea5c16897e", + "mode" => "readOnly", + "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); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->project->updateEnvironment( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); + } + public function testMethodDeleteEnvironment(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->project->deleteEnvironment( + "" + ); + + $this->assertSame($data, $response); + } public function testMethodListKeys(): void { $data = [ @@ -1080,6 +1390,27 @@ public function testMethodUpdateOAuth2HuggingFace(): void $this->assertInstanceOf(\Appwrite\Models\OAuth2HuggingFace::class, $response); } + public function testMethodUpdateOAuth2Kakao(): void + { + $data = [ + "\$id" => "github", + "enabled" => true, + "clientId" => "839ff5000000000000000000013206de", + "clientSecret" => "jLNVOK00000000000000000000yJebea", + "prompt" => ["none"] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->project->updateOAuth2Kakao(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Kakao::class, $response); + } public function testMethodUpdateOAuth2Keycloak(): void { $data = [ @@ -1390,6 +1721,26 @@ public function testMethodUpdateOAuth2Stripe(): void $this->assertInstanceOf(\Appwrite\Models\OAuth2Stripe::class, $response); } + public function testMethodUpdateOAuth2TikTok(): void + { + $data = [ + "\$id" => "github", + "enabled" => true, + "clientId" => "awz000000000tyw0", + "clientSecret" => "6wXewM00000000000000000000yXnite" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->project->updateOAuth2TikTok(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2TikTok::class, $response); + } public function testMethodUpdateOAuth2Tradeshift(): void { $data = [ @@ -1450,6 +1801,26 @@ public function testMethodUpdateOAuth2Twitch(): void $this->assertInstanceOf(\Appwrite\Models\OAuth2Twitch::class, $response); } + public function testMethodUpdateOAuth2Webflow(): void + { + $data = [ + "\$id" => "github", + "enabled" => true, + "clientId" => "8bb20000000000000000000000000000000000000000000000000000000040dd", + "clientSecret" => "59bf00000000000000000000000000000000000000000000000000000000fe59" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->project->updateOAuth2Webflow(); + + $this->assertInstanceOf(\Appwrite\Models\OAuth2Webflow::class, $response); + } public function testMethodUpdateOAuth2WordPress(): void { $data = [ @@ -1576,12 +1947,12 @@ public function testMethodGetOAuth2Provider(): void [ "\$id" => "github", "enabled" => true, - "applicationId" => "00001111-aaaa-2222-bbbb-3333cccc4444", - "applicationSecret" => "A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u", - "tenant" => "common" + "clientId" => "839ff5000000000000000000013206de", + "clientSecret" => "jLNVOK00000000000000000000yJebea", + "prompt" => ["none"] ], [ - "\$id" => "microsoft" + "\$id" => "kakao" ] ); @@ -1596,7 +1967,7 @@ public function testMethodGetOAuth2Provider(): void ProjectOAuthProviderId::AMAZON() ); - $this->assertInstanceOf(\Appwrite\Models\OAuth2Microsoft::class, $response); + $this->assertInstanceOf(\Appwrite\Models\OAuth2Kakao::class, $response); } public function testMethodListPlatforms(): void { @@ -2766,6 +3137,146 @@ public function testMethodUpdatePasswordPersonalDataPolicy(): void $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); } + public function testMethodUpdatePasswordPwnedPolicy(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "New Project", + "teamId" => "1592981250", + "region" => "fra", + "devKeys" => [], + "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" => "smtp-password", + "smtpSecure" => "tls", + "pingCount" => 1, + "pingedAt" => "2020-10-15T06:38:00.000+00:00", + "labels" => [], + "status" => "active", + "onboarding" => [], + "authMethods" => [ + [ + "\$id" => "email-password", + "enabled" => true + ] + ], + "services" => [ + [ + "\$id" => "account", + "enabled" => true + ] + ], + "protocols" => [ + [ + "\$id" => "rest", + "enabled" => true + ] + ], + "blocks" => [ + [ + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "resourceType" => "project", + "resourceId" => "5e5ea5c16897e", + "mode" => "readOnly", + "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); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->project->updatePasswordPwnedPolicy(); + + $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); + } + public function testMethodUpdatePasswordRotationPolicy(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "New Project", + "teamId" => "1592981250", + "region" => "fra", + "devKeys" => [], + "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" => "smtp-password", + "smtpSecure" => "tls", + "pingCount" => 1, + "pingedAt" => "2020-10-15T06:38:00.000+00:00", + "labels" => [], + "status" => "active", + "onboarding" => [], + "authMethods" => [ + [ + "\$id" => "email-password", + "enabled" => true + ] + ], + "services" => [ + [ + "\$id" => "account", + "enabled" => true + ] + ], + "protocols" => [ + [ + "\$id" => "rest", + "enabled" => true + ] + ], + "blocks" => [ + [ + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "resourceType" => "project", + "resourceId" => "5e5ea5c16897e", + "mode" => "readOnly", + "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); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->project->updatePasswordRotationPolicy(); + + $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); + } public function testMethodUpdatePasswordStrengthPolicy(): void { $data = [ diff --git a/tests/Appwrite/Services/WafTest.php b/tests/Appwrite/Services/WafTest.php new file mode 100644 index 00000000..bb4f1b2c --- /dev/null +++ b/tests/Appwrite/Services/WafTest.php @@ -0,0 +1,451 @@ +client = Mockery::mock(Client::class); + $this->waf = new Waf($this->client); + } + + public function testMethodListRules(): void + { + $data = [ + "total" => 5, + "rules" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->waf->listRules(); + + $this->assertInstanceOf(\Appwrite\Models\WafRuleList::class, $response); + } + public function testMethodCreateBypassRule(): void + { + $data = [ + "\$id" => "wafRule1", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Block anonymous POST traffic", + "description" => "Blocks anonymous POST calls to /v1/graphql", + "teamId" => "5e5ea5c16897e", + "projectId" => "cloudConsole", + "resourceType" => "functions", + "resourceId" => "functionId", + "action" => "bypass", + "priority" => 100, + "enabled" => true, + "conditions" => [], + "config" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->waf->createBypassRule( + "", + "api", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\WafRuleBypass::class, $response); + } + public function testMethodUpdateBypassRule(): void + { + $data = [ + "\$id" => "wafRule1", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Block anonymous POST traffic", + "description" => "Blocks anonymous POST calls to /v1/graphql", + "teamId" => "5e5ea5c16897e", + "projectId" => "cloudConsole", + "resourceType" => "functions", + "resourceId" => "functionId", + "action" => "bypass", + "priority" => 100, + "enabled" => true, + "conditions" => [], + "config" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->waf->updateBypassRule( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\WafRuleBypass::class, $response); + } + public function testMethodCreateChallengeRule(): void + { + $data = [ + "\$id" => "wafRule1", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Block anonymous POST traffic", + "description" => "Blocks anonymous POST calls to /v1/graphql", + "teamId" => "5e5ea5c16897e", + "projectId" => "cloudConsole", + "resourceType" => "functions", + "resourceId" => "functionId", + "action" => "bypass", + "priority" => 100, + "enabled" => true, + "conditions" => [], + "config" => [], + "challengeType" => "compute", + "difficulty" => 3, + "ttl" => 1800 + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->waf->createChallengeRule( + "", + "api", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\WafRuleChallenge::class, $response); + } + public function testMethodUpdateChallengeRule(): void + { + $data = [ + "\$id" => "wafRule1", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Block anonymous POST traffic", + "description" => "Blocks anonymous POST calls to /v1/graphql", + "teamId" => "5e5ea5c16897e", + "projectId" => "cloudConsole", + "resourceType" => "functions", + "resourceId" => "functionId", + "action" => "bypass", + "priority" => 100, + "enabled" => true, + "conditions" => [], + "config" => [], + "challengeType" => "compute", + "difficulty" => 3, + "ttl" => 1800 + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->waf->updateChallengeRule( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\WafRuleChallenge::class, $response); + } + public function testMethodCreateDenyRule(): void + { + $data = [ + "\$id" => "wafRule1", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Block anonymous POST traffic", + "description" => "Blocks anonymous POST calls to /v1/graphql", + "teamId" => "5e5ea5c16897e", + "projectId" => "cloudConsole", + "resourceType" => "functions", + "resourceId" => "functionId", + "action" => "bypass", + "priority" => 100, + "enabled" => true, + "conditions" => [], + "config" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->waf->createDenyRule( + "", + "api", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\WafRuleDeny::class, $response); + } + public function testMethodUpdateDenyRule(): void + { + $data = [ + "\$id" => "wafRule1", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Block anonymous POST traffic", + "description" => "Blocks anonymous POST calls to /v1/graphql", + "teamId" => "5e5ea5c16897e", + "projectId" => "cloudConsole", + "resourceType" => "functions", + "resourceId" => "functionId", + "action" => "bypass", + "priority" => 100, + "enabled" => true, + "conditions" => [], + "config" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->waf->updateDenyRule( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\WafRuleDeny::class, $response); + } + public function testMethodCreateRateLimitRule(): void + { + $data = [ + "\$id" => "wafRule1", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Block anonymous POST traffic", + "description" => "Blocks anonymous POST calls to /v1/graphql", + "teamId" => "5e5ea5c16897e", + "projectId" => "cloudConsole", + "resourceType" => "functions", + "resourceId" => "functionId", + "action" => "bypass", + "priority" => 100, + "enabled" => true, + "conditions" => [], + "config" => [], + "limit" => 1000, + "interval" => 60, + "key" => "userId", + "strategy" => "slidingWindow", + "maxBucketSize" => 200 + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->waf->createRateLimitRule( + "", + "api", + "", + 1, + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\WafRuleRateLimit::class, $response); + } + public function testMethodUpdateRateLimitRule(): void + { + $data = [ + "\$id" => "wafRule1", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Block anonymous POST traffic", + "description" => "Blocks anonymous POST calls to /v1/graphql", + "teamId" => "5e5ea5c16897e", + "projectId" => "cloudConsole", + "resourceType" => "functions", + "resourceId" => "functionId", + "action" => "bypass", + "priority" => 100, + "enabled" => true, + "conditions" => [], + "config" => [], + "limit" => 1000, + "interval" => 60, + "key" => "userId", + "strategy" => "slidingWindow", + "maxBucketSize" => 200 + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->waf->updateRateLimitRule( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\WafRuleRateLimit::class, $response); + } + public function testMethodCreateRedirectRule(): void + { + $data = [ + "\$id" => "wafRule1", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Block anonymous POST traffic", + "description" => "Blocks anonymous POST calls to /v1/graphql", + "teamId" => "5e5ea5c16897e", + "projectId" => "cloudConsole", + "resourceType" => "functions", + "resourceId" => "functionId", + "action" => "bypass", + "priority" => 100, + "enabled" => true, + "conditions" => [], + "config" => [], + "location" => "/maintenance", + "statusCode" => 301 + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->waf->createRedirectRule( + "", + "api", + "", + "", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\WafRuleRedirect::class, $response); + } + public function testMethodUpdateRedirectRule(): void + { + $data = [ + "\$id" => "wafRule1", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Block anonymous POST traffic", + "description" => "Blocks anonymous POST calls to /v1/graphql", + "teamId" => "5e5ea5c16897e", + "projectId" => "cloudConsole", + "resourceType" => "functions", + "resourceId" => "functionId", + "action" => "bypass", + "priority" => 100, + "enabled" => true, + "conditions" => [], + "config" => [], + "location" => "/maintenance", + "statusCode" => 301 + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->waf->updateRedirectRule( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\WafRuleRedirect::class, $response); + } + public function testMethodGetRule(): void + { + $data = array_replace( + [ + "\$id" => "wafRule1", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Block anonymous POST traffic", + "description" => "Blocks anonymous POST calls to /v1/graphql", + "teamId" => "5e5ea5c16897e", + "projectId" => "cloudConsole", + "resourceType" => "functions", + "resourceId" => "functionId", + "action" => "bypass", + "priority" => 100, + "enabled" => true, + "conditions" => [], + "config" => [], + "location" => "/maintenance", + "statusCode" => 301 + ], + [ + "action" => "redirect" + ] + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->waf->getRule( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\WafRuleRedirect::class, $response); + } + public function testMethodDeleteRule(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->waf->deleteRule( + "" + ); + + $this->assertSame($data, $response); + } +} From 76d72406bbd41ea187c146de617b2da05cfef985 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 14 Oct 2026 12:56:34 +0100 Subject: [PATCH 2/2] docs: correct the domains changelog entry The domains service reads transfer status; it does not start transfers. --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa3b2ea3..7353dbb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 30.4.0 -* Added: `domains` service to register, transfer and manage domains, DNS records, email presets and zones +* Added: `domains` service to manage domains, DNS records, email presets, prices, transfer status and zones * Added: `waf` service with bypass, challenge, deny, rate-limit and redirect rules * Added: `account.createEmailVerificationOTP`, `updateEmailVerificationOTP`, `createRecoveryOTP` and `updateRecoveryOTP` * Added: `account.createIdTokenSession` and `Identity.providerIdToken`